@hotmeshio/long-tail 0.31.0 → 0.32.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/build/api/escalations/create.js +17 -6
- package/build/api/escalations/files.d.ts +18 -0
- package/build/api/escalations/files.js +73 -0
- package/build/api/escalations/index.d.ts +1 -0
- package/build/api/escalations/index.js +4 -2
- package/build/api/escalations/metadata.js +5 -4
- package/build/api/escalations/resolve.js +6 -4
- package/build/bin/ltc.js +4 -2
- package/build/index.d.ts +2 -0
- package/build/index.js +13 -2
- package/build/lib/cli/commands/escalations.d.ts +2 -0
- package/build/lib/cli/commands/escalations.js +12 -4
- package/build/lib/storage/s3.js +1 -0
- package/build/modules/config.d.ts +9 -0
- package/build/modules/config.js +9 -0
- package/build/routes/escalations/single.js +11 -0
- package/build/scripts/bambu-boat.d.ts +4 -2
- package/build/scripts/bambu-boat.js +4 -2
- package/build/scripts/bambu-print.d.ts +2 -1
- package/build/scripts/bambu-print.js +7 -3
- package/build/scripts/machine-line.js +2 -1
- package/build/sdk/index.d.ts +4 -0
- package/build/sdk/index.js +2 -0
- package/build/services/escalation/aggregate-resolved-sql.d.ts +19 -0
- package/build/services/escalation/aggregate-resolved-sql.js +57 -0
- package/build/services/escalation/aggregate-sql.d.ts +6 -1
- package/build/services/escalation/aggregate-sql.js +33 -12
- package/build/services/escalation/aggregate-validate.d.ts +5 -2
- package/build/services/escalation/aggregate-validate.js +7 -4
- package/build/services/escalation/aggregates.js +5 -3
- package/build/services/escalation/crud.js +3 -0
- package/build/services/escalation/file-links.d.ts +39 -0
- package/build/services/escalation/file-links.js +118 -0
- package/build/services/escalation/resolver-validation.d.ts +33 -0
- package/build/services/escalation/resolver-validation.js +22 -6
- package/build/services/orchestrator/condition.d.ts +20 -4
- package/build/services/orchestrator/condition.js +27 -8
- package/build/shared/form-validation/display-only-widgets.d.ts +3 -2
- package/build/shared/form-validation/display-only-widgets.js +3 -2
- 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-confidence-facets.d.ts +27 -0
- package/build/shared/form-validation/x-lt-confidence-facets.js +60 -0
- package/build/shared/form-validation/x-lt-confidence.d.ts +57 -0
- package/build/shared/form-validation/x-lt-confidence.js +177 -0
- package/build/shared/form-validation/x-lt-help.d.ts +1 -1
- package/build/shared/form-validation/x-lt-help.js +1 -1
- package/build/system/mcp-servers/admin/escalations.js +4 -2
- package/build/system/mcp-servers/admin/labels-schemas.d.ts +4 -4
- package/build/system/mcp-servers/admin/schemas.d.ts +111 -70
- package/build/system/mcp-servers/admin/schemas.js +8 -3
- package/build/system/mcp-servers/human-queue-files.d.ts +8 -0
- package/build/system/mcp-servers/human-queue-files.js +32 -0
- package/build/system/mcp-servers/human-queue-schemas.d.ts +7 -0
- package/build/system/mcp-servers/human-queue-schemas.js +4 -1
- package/build/system/mcp-servers/human-queue.d.ts +1 -0
- package/build/system/mcp-servers/human-queue.js +23 -16
- package/build/system/seed/tool-manifests-admin.js +1 -1
- package/build/system/seed/tool-manifests-escalation.js +13 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/analytics.d.ts +14 -3
- package/build/types/analytics.js +3 -1
- package/build/types/escalation.d.ts +34 -0
- package/build/types/escalation.js +72 -1
- package/build/types/index.d.ts +4 -4
- package/build/types/index.js +5 -1
- package/dashboard/dist/assets/{AdminDashboard-BafKaq50.js → AdminDashboard-C25co77C.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-BafKaq50.js.map → AdminDashboard-C25co77C.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-CFHf31DT.js → AgentConfigPage-CsCpI15j.js} +5 -5
- package/dashboard/dist/assets/{AgentConfigPage-CFHf31DT.js.map → AgentConfigPage-CsCpI15j.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-CEvz5rJr.js → AgentDetailPage-ByaepsB5.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-CEvz5rJr.js.map → AgentDetailPage-ByaepsB5.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-DjQaio0O.js → AgentsPage-ByHU42SO.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-DjQaio0O.js.map → AgentsPage-ByHU42SO.js.map} +1 -1
- package/dashboard/dist/assets/{AvailableEscalationsPage-UB03VTJx.js → AvailableEscalationsPage--o6qcz7-.js} +2 -2
- package/dashboard/dist/assets/{AvailableEscalationsPage-UB03VTJx.js.map → AvailableEscalationsPage--o6qcz7-.js.map} +1 -1
- package/dashboard/dist/assets/{BotPicker-C7MNWOF7.js → BotPicker-B3y3H3fs.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-C7MNWOF7.js.map → BotPicker-B3y3H3fs.js.map} +1 -1
- package/dashboard/dist/assets/{BulkAssignModal-h5fX-_cV.js → BulkAssignModal-DMNIkIn6.js} +2 -2
- package/dashboard/dist/assets/{BulkAssignModal-h5fX-_cV.js.map → BulkAssignModal-DMNIkIn6.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-BIzDl-ZT.js → CapabilitiesPage-BekfKHlk.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-BIzDl-ZT.js.map → CapabilitiesPage-BekfKHlk.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-B5TivtEg.js → CollapsibleSection-BAteHgBG.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-B5TivtEg.js.map → CollapsibleSection-BAteHgBG.js.map} +1 -1
- package/dashboard/dist/assets/{ConfirmDeleteModal-CB4nKePb.js → ConfirmDeleteModal-BNY287W9.js} +2 -2
- package/dashboard/dist/assets/{ConfirmDeleteModal-CB4nKePb.js.map → ConfirmDeleteModal-BNY287W9.js.map} +1 -1
- package/dashboard/dist/assets/{ConnectedAppsPage-B3S5gVWw.js → ConnectedAppsPage-LLiiH3da.js} +2 -2
- package/dashboard/dist/assets/{ConnectedAppsPage-B3S5gVWw.js.map → ConnectedAppsPage-LLiiH3da.js.map} +1 -1
- package/dashboard/dist/assets/{CountdownTimer-BHVIq3kA.js → CountdownTimer-DBLURjxh.js} +2 -2
- package/dashboard/dist/assets/{CountdownTimer-BHVIq3kA.js.map → CountdownTimer-DBLURjxh.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialConfirmModal-w0AGmCIe.js → CredentialConfirmModal-BqpY3yen.js} +2 -2
- package/dashboard/dist/assets/{CredentialConfirmModal-w0AGmCIe.js.map → CredentialConfirmModal-BqpY3yen.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-BtCGBJrT.js → CredentialsPage-CW3_dbm2.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-BtCGBJrT.js.map → CredentialsPage-CW3_dbm2.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-BG1rZK-5.js → CronLabel-CR6DiZZr.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-BG1rZK-5.js.map → CronLabel-CR6DiZZr.js.map} +1 -1
- package/dashboard/dist/assets/{DataTable-FjFhx0SE.js → DataTable-C-IlbLhY.js} +2 -2
- package/dashboard/dist/assets/{DataTable-FjFhx0SE.js.map → DataTable-C-IlbLhY.js.map} +1 -1
- package/dashboard/dist/assets/{DropZone-D8ZVdEb5.js → DropZone-CHmz59w4.js} +2 -2
- package/dashboard/dist/assets/{DropZone-D8ZVdEb5.js.map → DropZone-CHmz59w4.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-l4m8Yvfv.js → ElapsedCell-CEapQvgU.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-l4m8Yvfv.js.map → ElapsedCell-CEapQvgU.js.map} +1 -1
- package/dashboard/dist/assets/{EntityTimelinePanel-BOHlIaxF.js → EntityTimelinePanel-DqD_BpJM.js} +2 -2
- package/dashboard/dist/assets/{EntityTimelinePanel-BOHlIaxF.js.map → EntityTimelinePanel-DqD_BpJM.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListSchemaPage-BotlwlX3.js → EscalationListSchemaPage-DDKcrVbb.js} +3 -3
- package/dashboard/dist/assets/{EscalationListSchemaPage-BotlwlX3.js.map → EscalationListSchemaPage-DDKcrVbb.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationSchemaPage-CfZSVOSD.js → EscalationSchemaPage-BZHZfJiQ.js} +3 -3
- package/dashboard/dist/assets/{EscalationSchemaPage-CfZSVOSD.js.map → EscalationSchemaPage-BZHZfJiQ.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationTimeline-CCKpuRBU.js → EscalationTimeline-Dv0XUgQX.js} +2 -2
- package/dashboard/dist/assets/{EscalationTimeline-CCKpuRBU.js.map → EscalationTimeline-Dv0XUgQX.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationTitleSelect-cpTzPHiW.js → EscalationTitleSelect-BN7D52wT.js} +2 -2
- package/dashboard/dist/assets/{EscalationTitleSelect-cpTzPHiW.js.map → EscalationTitleSelect-BN7D52wT.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-DS-nK0qV.js → EscalationsOverview-DE6EPkhT.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-DS-nK0qV.js.map → EscalationsOverview-DE6EPkhT.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-UfebhJf0.js → EventTable-CiV62txY.js} +2 -2
- package/dashboard/dist/assets/{EventTable-UfebhJf0.js.map → EventTable-CiV62txY.js.map} +1 -1
- package/dashboard/dist/assets/{FilterBar-newA5l-X.js → FilterBar-WyNQPyQ1.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-newA5l-X.js.map → FilterBar-WyNQPyQ1.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage-6SCDyQcK.js → GraphInvokePage--gn48yUD.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-6SCDyQcK.js.map → GraphInvokePage--gn48yUD.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-BEc-XdKj.js → HomePage-IR_jgBE8.js} +2 -2
- package/dashboard/dist/assets/{HomePage-BEc-XdKj.js.map → HomePage-IR_jgBE8.js.map} +1 -1
- package/dashboard/dist/assets/{LabelJobsPage-BO50zXT5.js → LabelJobsPage-C8LSts4O.js} +2 -2
- package/dashboard/dist/assets/{LabelJobsPage-BO50zXT5.js.map → LabelJobsPage-C8LSts4O.js.map} +1 -1
- package/dashboard/dist/assets/{LinePage-NYxJQ-ex.js → LinePage-CS7uUv00.js} +2 -2
- package/dashboard/dist/assets/{LinePage-NYxJQ-ex.js.map → LinePage-CS7uUv00.js.map} +1 -1
- package/dashboard/dist/assets/{LinesPage-RbWTaQRh.js → LinesPage-CJprjG39.js} +3 -3
- package/dashboard/dist/assets/{LinesPage-RbWTaQRh.js.map → LinesPage-CJprjG39.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-B-E9-toh.js → ListToolbar-YP3uwvXC.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-B-E9-toh.js.map → ListToolbar-YP3uwvXC.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-Shcf9QhZ.js → McpOverview-Ce-m2JON.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-Shcf9QhZ.js.map → McpOverview-Ce-m2JON.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-D8kmjy2v.js → McpQueryDetailPage-CtnUqO1v.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-D8kmjy2v.js.map → McpQueryDetailPage-CtnUqO1v.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-ck-o5m8A.js → McpQueryPage-C-lqUPlg.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-ck-o5m8A.js.map → McpQueryPage-C-lqUPlg.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-BJKkM9-3.js → McpRunDetailPage-MnIe0hwz.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-BJKkM9-3.js.map → McpRunDetailPage-MnIe0hwz.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-DqhHfD5G.js → McpRunsPage-CpYLXVPF.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-DqhHfD5G.js.map → McpRunsPage-CpYLXVPF.js.map} +1 -1
- package/dashboard/dist/assets/{NamespacePill--uIaGtrN.js → NamespacePill-DilSgLyE.js} +2 -2
- package/dashboard/dist/assets/{NamespacePill--uIaGtrN.js.map → NamespacePill-DilSgLyE.js.map} +1 -1
- package/dashboard/dist/assets/{OperationsPage-D6B9Vv__.js → OperationsPage-xe6bAwaq.js} +2 -2
- package/dashboard/dist/assets/{OperationsPage-D6B9Vv__.js.map → OperationsPage-xe6bAwaq.js.map} +1 -1
- package/dashboard/dist/assets/{OperatorDashboard-CIH1cxjQ.js → OperatorDashboard-Cm9_C0EP.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-CIH1cxjQ.js.map → OperatorDashboard-Cm9_C0EP.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeader-DClJ33fV.js → PageHeader-B7SOvLT8.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-DClJ33fV.js.map → PageHeader-B7SOvLT8.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-C-TrbKQL.js → PageHeaderWithStats-DWKap7gs.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-C-TrbKQL.js.map → PageHeaderWithStats-DWKap7gs.js.map} +1 -1
- package/dashboard/dist/assets/{PersonaDetailPage-DjvfyIph.js → PersonaDetailPage-CvstNkh3.js} +2 -2
- package/dashboard/dist/assets/{PersonaDetailPage-DjvfyIph.js.map → PersonaDetailPage-CvstNkh3.js.map} +1 -1
- package/dashboard/dist/assets/{PersonasPage-D7ryA8Vc.js → PersonasPage-ba1KeInW.js} +2 -2
- package/dashboard/dist/assets/{PersonasPage-D7ryA8Vc.js.map → PersonasPage-ba1KeInW.js.map} +1 -1
- package/dashboard/dist/assets/{PortalPage-D3ybr0mo.js → PortalPage-GDgG88TM.js} +2 -2
- package/dashboard/dist/assets/{PortalPage-D3ybr0mo.js.map → PortalPage-GDgG88TM.js.map} +1 -1
- package/dashboard/dist/assets/{PrintLabelsPanel-D0HF5x8b.js → PrintLabelsPanel-BkUN00Qd.js} +2 -2
- package/dashboard/dist/assets/{PrintLabelsPanel-D0HF5x8b.js.map → PrintLabelsPanel-BkUN00Qd.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-0xS9EdHe.js → ProcessDetailPage-BKu9_wWv.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-0xS9EdHe.js.map → ProcessDetailPage-BKu9_wWv.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-93SMj1Fd.js → ProcessesListPage-BfJYTU_v.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-93SMj1Fd.js.map → ProcessesListPage-BfJYTU_v.js.map} +1 -1
- package/dashboard/dist/assets/ResolverForm-DZmY6wJV.js +8 -0
- package/dashboard/dist/assets/ResolverForm-DZmY6wJV.js.map +1 -0
- package/dashboard/dist/assets/{RoleDetailPage-DlUOJWSB.js → RoleDetailPage-vGeth3ve.js} +3 -3
- package/dashboard/dist/assets/{RoleDetailPage-DlUOJWSB.js.map → RoleDetailPage-vGeth3ve.js.map} +1 -1
- package/dashboard/dist/assets/{RolePill-BjD1Qw5y.js → RolePill-KhT-Yehm.js} +2 -2
- package/dashboard/dist/assets/{RolePill-BjD1Qw5y.js.map → RolePill-KhT-Yehm.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-DqhHSvaw.js → RolesPage-CwxHOkqF.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-DqhHSvaw.js.map → RolesPage-CwxHOkqF.js.map} +1 -1
- package/dashboard/dist/assets/{RosterWidget-BrIq61HR.js → RosterWidget-DRVj9xyk.js} +2 -2
- package/dashboard/dist/assets/{RosterWidget-BrIq61HR.js.map → RosterWidget-DRVj9xyk.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-D6zQrCNr.js → RunAsSelector-DvPX3XmA.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-D6zQrCNr.js.map → RunAsSelector-DvPX3XmA.js.map} +1 -1
- package/dashboard/dist/assets/{ScanCodesPage-B2S9DR2f.js → ScanCodesPage-Cptbe7h8.js} +2 -2
- package/dashboard/dist/assets/{ScanCodesPage-B2S9DR2f.js.map → ScanCodesPage-Cptbe7h8.js.map} +1 -1
- package/dashboard/dist/assets/{ScanSchemeDetailPage-gpxKN-pL.js → ScanSchemeDetailPage-DquNJ7Or.js} +4 -4
- package/dashboard/dist/assets/{ScanSchemeDetailPage-gpxKN-pL.js.map → ScanSchemeDetailPage-DquNJ7Or.js.map} +1 -1
- package/dashboard/dist/assets/{ScanStationPage-B-UTgXsG.js → ScanStationPage-DaRfGGa8.js} +2 -2
- package/dashboard/dist/assets/{ScanStationPage-B-UTgXsG.js.map → ScanStationPage-DaRfGGa8.js.map} +1 -1
- package/dashboard/dist/assets/{SchemeMatchFields-BK24aa7K.js → SchemeMatchFields-w-pffi98.js} +2 -2
- package/dashboard/dist/assets/{SchemeMatchFields-BK24aa7K.js.map → SchemeMatchFields-w-pffi98.js.map} +1 -1
- package/dashboard/dist/assets/{ScopeBadge-ofLQ6HW-.js → ScopeBadge-HeuiMJhW.js} +2 -2
- package/dashboard/dist/assets/{ScopeBadge-ofLQ6HW-.js.map → ScopeBadge-HeuiMJhW.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-CgVv7vc_.js → StickyPagination-D6fDHCcJ.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-CgVv7vc_.js.map → StickyPagination-D6fDHCcJ.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-B9sxDVw4.js → StreamMessageDetail-BmYVQrzl.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-B9sxDVw4.js.map → StreamMessageDetail-BmYVQrzl.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-DQc0CYSL.js → SwimlaneTimeline-KCqA-PeL.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-DQc0CYSL.js.map → SwimlaneTimeline-KCqA-PeL.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-47qVYzke.js → TagInput-CZBAu1Hy.js} +2 -2
- package/dashboard/dist/assets/{TagInput-47qVYzke.js.map → TagInput-CZBAu1Hy.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-D6VOsA1f.js → TaskDetailPage-WtVv2z7T.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-D6VOsA1f.js.map → TaskDetailPage-WtVv2z7T.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-C5KmdXAl.js → TaskQueuePill-DWGn3CWx.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-C5KmdXAl.js.map → TaskQueuePill-DWGn3CWx.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-DG8hvO8G.js → TasksListPage-DMYQNDIw.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-DG8hvO8G.js.map → TasksListPage-DMYQNDIw.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-CL02EhFi.js → TimeAgo-BkY4lahi.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-CL02EhFi.js.map → TimeAgo-BkY4lahi.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-BE7oKVJg.js → TimestampCell-BBPb9TI2.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-BE7oKVJg.js.map → TimestampCell-BBPb9TI2.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-Cp9Drk1s.js → ToolPill-B2aRk0o1.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-Cp9Drk1s.js.map → ToolPill-B2aRk0o1.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-CRecLh6S.js → ToolTestPanel-CNMbmymK.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-CRecLh6S.js.map → ToolTestPanel-CNMbmymK.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-QzkinTfN.js → TopicDetailPage-CodBRylU.js} +2 -2
- package/dashboard/dist/assets/{TopicDetailPage-QzkinTfN.js.map → TopicDetailPage-CodBRylU.js.map} +1 -1
- package/dashboard/dist/assets/TopicsPage-BtD8jTU7.js +2 -0
- package/dashboard/dist/assets/{TopicsPage-D8dW6J65.js.map → TopicsPage-BtD8jTU7.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-Dw3R_zrl.js → UserName-D6y9AnuY.js} +2 -2
- package/dashboard/dist/assets/{UserName-Dw3R_zrl.js.map → UserName-D6y9AnuY.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-BTocv8or.js → WorkflowExecutionPage-BeffqV13.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-BTocv8or.js.map → WorkflowExecutionPage-BeffqV13.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowPill-BiLYq__w.js → WorkflowPill-BNm3R4pP.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill-BiLYq__w.js.map → WorkflowPill-BNm3R4pP.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-CIPEt3et.js → WorkflowsDashboard-m4Co5diK.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-CIPEt3et.js.map → WorkflowsDashboard-m4Co5diK.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-Bj4MJIE-.js → WorkflowsOverview-DNoI9qY8.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-Bj4MJIE-.js.map → WorkflowsOverview-DNoI9qY8.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-DMEk5k9-.js → YamlWorkflowDetailPage-8Vpc4Oxy.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-DMEk5k9-.js.map → YamlWorkflowDetailPage-8Vpc4Oxy.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-F2yyyoiB.js → YamlWorkflowsPage-D1JNwDSg.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-F2yyyoiB.js.map → YamlWorkflowsPage-D1JNwDSg.js.map} +1 -1
- package/dashboard/dist/assets/{agents-mSgxEPpI.js → agents-LTHUsfv3.js} +2 -2
- package/dashboard/dist/assets/{agents-mSgxEPpI.js.map → agents-LTHUsfv3.js.map} +1 -1
- package/dashboard/dist/assets/{bots-p4Hp0CV6.js → bots-CQxehfBo.js} +2 -2
- package/dashboard/dist/assets/{bots-p4Hp0CV6.js.map → bots-CQxehfBo.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-D_-I_SXR.js → capabilities-DECTnJrK.js} +2 -2
- package/dashboard/dist/assets/{capabilities-D_-I_SXR.js.map → capabilities-DECTnJrK.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-DjdoQnRU.js → controlplane-Dx20db5g.js} +2 -2
- package/dashboard/dist/assets/{controlplane-DjdoQnRU.js.map → controlplane-Dx20db5g.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-R_IEVQjQ.js → escalation-columns-CVFGUB79.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-R_IEVQjQ.js.map → escalation-columns-CVFGUB79.js.map} +1 -1
- package/dashboard/dist/assets/escalation-items-Bj7bkwWy.js +2 -0
- package/dashboard/dist/assets/escalation-items-Bj7bkwWy.js.map +1 -0
- package/dashboard/dist/assets/index-BD4O-ISx.js +13 -0
- package/dashboard/dist/assets/{index-Dk2KKo0z.js.map → index-BD4O-ISx.js.map} +1 -1
- package/dashboard/dist/assets/{index-D9RAN9sA.js → index-BL8XOMHT.js} +2 -2
- package/dashboard/dist/assets/{index-D9RAN9sA.js.map → index-BL8XOMHT.js.map} +1 -1
- package/dashboard/dist/assets/index-C2vRDf96.js +2 -0
- package/dashboard/dist/assets/{index-C5osluV3.js.map → index-C2vRDf96.js.map} +1 -1
- package/dashboard/dist/assets/{index-DUYAGxwc.js → index-CNgyKRQ8.js} +2 -2
- package/dashboard/dist/assets/{index-DUYAGxwc.js.map → index-CNgyKRQ8.js.map} +1 -1
- package/dashboard/dist/assets/{index-DlJkZ12b.js → index-CdXPbBgs.js} +2 -2
- package/dashboard/dist/assets/{index-DlJkZ12b.js.map → index-CdXPbBgs.js.map} +1 -1
- package/dashboard/dist/assets/{index-BuCEhhnl.js → index-CnBUFCV7.js} +2 -2
- package/dashboard/dist/assets/{index-BuCEhhnl.js.map → index-CnBUFCV7.js.map} +1 -1
- package/dashboard/dist/assets/index-CoLciFzq.css +1 -0
- package/dashboard/dist/assets/{index-D-FYj9jT.js → index-D_TSx-k_.js} +2 -2
- package/dashboard/dist/assets/{index-D-FYj9jT.js.map → index-D_TSx-k_.js.map} +1 -1
- package/dashboard/dist/assets/{index-C_dAJUzh.js → index-Do9Y6Fgt.js} +16 -16
- package/dashboard/dist/assets/index-Do9Y6Fgt.js.map +1 -0
- package/dashboard/dist/assets/{index-D6K_IgCz.js → index-Dq1zjilj.js} +2 -2
- package/dashboard/dist/assets/{index-D6K_IgCz.js.map → index-Dq1zjilj.js.map} +1 -1
- package/dashboard/dist/assets/{index-BEMdD58x.js → index-Dz4LSzA2.js} +2 -2
- package/dashboard/dist/assets/{index-BEMdD58x.js.map → index-Dz4LSzA2.js.map} +1 -1
- package/dashboard/dist/assets/{index-D7L_VoBD.js → index-g1MmARVR.js} +2 -2
- package/dashboard/dist/assets/{index-D7L_VoBD.js.map → index-g1MmARVR.js.map} +1 -1
- package/dashboard/dist/assets/{index-BxbQmeqh.js → index-qEd4FVmN.js} +2 -2
- package/dashboard/dist/assets/{index-BxbQmeqh.js.map → index-qEd4FVmN.js.map} +1 -1
- package/dashboard/dist/assets/index-v4rQ8ctJ.js +3 -0
- package/dashboard/dist/assets/index-v4rQ8ctJ.js.map +1 -0
- package/dashboard/dist/assets/{knowledge-DSsPTqkK.js → knowledge-CT1I1t1S.js} +2 -2
- package/dashboard/dist/assets/{knowledge-DSsPTqkK.js.map → knowledge-CT1I1t1S.js.map} +1 -1
- package/dashboard/dist/assets/{machines-DSgGtqqr.js → machines-Dsuw-l1y.js} +2 -2
- package/dashboard/dist/assets/{machines-DSgGtqqr.js.map → machines-Dsuw-l1y.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-Cg-_uLw8.js → mcp-C3o5wzO8.js} +2 -2
- package/dashboard/dist/assets/{mcp-Cg-_uLw8.js.map → mcp-C3o5wzO8.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-DQombEK_.js → mcp-query-IvkIG7gH.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-DQombEK_.js.map → mcp-query-IvkIG7gH.js.map} +1 -1
- package/dashboard/dist/assets/pdf-CcZYcL52.js +13 -0
- package/dashboard/dist/assets/pdf-CcZYcL52.js.map +1 -0
- package/dashboard/dist/assets/pdf.worker.min-DgRcL-GR.js +2 -0
- package/dashboard/dist/assets/pdf.worker.min-DgRcL-GR.js.map +1 -0
- package/dashboard/dist/assets/pdf.worker.min-yatZIOMy.mjs +21 -0
- package/dashboard/dist/assets/{personas-DYrcoVBu.js → personas-zWlWjj6j.js} +2 -2
- package/dashboard/dist/assets/{personas-DYrcoVBu.js.map → personas-zWlWjj6j.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-wdb4xsey.js → pipelines-BKNvBMdf.js} +2 -2
- package/dashboard/dist/assets/{pipelines-wdb4xsey.js.map → pipelines-BKNvBMdf.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-Bil7gvm9.js → tasks-BQSO3Sjv.js} +2 -2
- package/dashboard/dist/assets/{tasks-Bil7gvm9.js.map → tasks-BQSO3Sjv.js.map} +1 -1
- package/dashboard/dist/assets/{topics-wBqaVhRR.js → topics-Dr_1TtUM.js} +2 -2
- package/dashboard/dist/assets/{topics-wBqaVhRR.js.map → topics-Dr_1TtUM.js.map} +1 -1
- package/dashboard/dist/assets/{useContainerWidth-DSLp1gEm.js → useContainerWidth-D38m8eub.js} +2 -2
- package/dashboard/dist/assets/{useContainerWidth-DSLp1gEm.js.map → useContainerWidth-D38m8eub.js.map} +1 -1
- package/dashboard/dist/assets/{useDebouncedValue-CwrY8TpV.js → useDebouncedValue-C5ESASfo.js} +2 -2
- package/dashboard/dist/assets/{useDebouncedValue-CwrY8TpV.js.map → useDebouncedValue-C5ESASfo.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-Sod_xApz.js → useNamespace-DLLOJRYY.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-Sod_xApz.js.map → useNamespace-DLLOJRYY.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-CKLInV3C.js → useYamlActivityEvents-D0XNXli1.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-CKLInV3C.js.map → useYamlActivityEvents-D0XNXli1.js.map} +1 -1
- package/dashboard/dist/assets/{validate-CYhW1xMJ.js → validate-Be4GWnJ1.js} +2 -2
- package/dashboard/dist/assets/{validate-CYhW1xMJ.js.map → validate-Be4GWnJ1.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-ed7mYQw4.js → vendor-icons-D48ijXZU.js} +209 -189
- package/dashboard/dist/assets/vendor-icons-D48ijXZU.js.map +1 -0
- package/dashboard/dist/assets/{yaml-workflows-C20qHo3L.js → yaml-workflows-BQpO-G-I.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-C20qHo3L.js.map → yaml-workflows-BQpO-G-I.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/docs/api/http/escalations.md +54 -7
- package/docs/api/mcp/admin.md +7 -5
- package/docs/api/mcp/human-queue.md +17 -1
- package/docs/api/sdk/escalations.md +30 -4
- package/docs/api/sdk/files.md +19 -0
- package/docs/cli.md +4 -1
- package/docs/escalation-analytics.md +17 -0
- package/docs/hitl/files.md +104 -0
- package/docs/hitl/x-lt-confidence.md +139 -0
- package/docs/hitl/x-lt-layout.md +19 -0
- package/docs/hitl/x-lt-widget.md +20 -0
- package/docs/hitl-guide.md +6 -0
- package/docs/machines.md +2 -2
- package/docs/mcp.md +2 -1
- package/package.json +1 -1
- package/dashboard/dist/assets/ResolverForm-DfogHDzl.js +0 -8
- package/dashboard/dist/assets/ResolverForm-DfogHDzl.js.map +0 -1
- package/dashboard/dist/assets/TopicsPage-D8dW6J65.js +0 -2
- package/dashboard/dist/assets/escalation-items-BGZlJMpk.js +0 -2
- package/dashboard/dist/assets/escalation-items-BGZlJMpk.js.map +0 -1
- package/dashboard/dist/assets/index-BUmz0NMg.css +0 -1
- package/dashboard/dist/assets/index-C5osluV3.js +0 -2
- package/dashboard/dist/assets/index-C_dAJUzh.js.map +0 -1
- package/dashboard/dist/assets/index-Dk2KKo0z.js +0 -13
- package/dashboard/dist/assets/index-FiNThtNU.js +0 -3
- package/dashboard/dist/assets/index-FiNThtNU.js.map +0 -1
- package/dashboard/dist/assets/vendor-icons-ed7mYQw4.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-
|
|
2
|
-
var pS=Object.defineProperty;var yS=(n,e,s)=>e in n?pS(n,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[e]=s;var j=(n,e,s)=>yS(n,typeof e!="symbol"?e+"":e,s);import{r as gS,u as
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-BfJYTU_v.js","./vendor-query-DvWWuNIB.js","./tasks-BQSO3Sjv.js","./useFilterParams-DBRw1Hcv.js","./vendor-react-_9U4mKFr.js","./useDebouncedValue-C5ESASfo.js","./api-path-u2Jf9QXS.js","./DataTable-C-IlbLhY.js","./EmptyState-DgC_6njU.js","./useContainerWidth-D38m8eub.js","./TimestampCell-BBPb9TI2.js","./StickyPagination-D6fDHCcJ.js","./FilterBar-WyNQPyQ1.js","./vendor-icons-D48ijXZU.js","./PageHeader-B7SOvLT8.js","./ListToolbar-YP3uwvXC.js","./WorkflowPill-BNm3R4pP.js","./ProcessDetailPage-BKu9_wWv.js","./PageHeaderWithStats-DWKap7gs.js","./StatusBadge-DHVwxre2.js","./RolePill-KhT-Yehm.js","./UserName-D6y9AnuY.js","./McpOverview-Ce-m2JON.js","./mcp-C3o5wzO8.js","./pipelines-BKNvBMdf.js","./yaml-workflows-BQpO-G-I.js","./controlplane-Dx20db5g.js","./StatCard-nWY4sndl.js","./McpRunsPage-CpYLXVPF.js","./useNamespace-DLLOJRYY.js","./ElapsedCell-CEapQvgU.js","./RowActions-Bdd7z4eB.js","./McpRunDetailPage-MnIe0hwz.js","./SegmentedTabs-BpJh4Hwn.js","./EventTable-CiV62txY.js","./SwimlaneTimeline-KCqA-PeL.js","./StreamMessageDetail-BmYVQrzl.js","./CopyableId-Bn02zYxt.js","./McpQueryPage-C-lqUPlg.js","./mcp-query-IvkIG7gH.js","./McpQueryDetailPage-CtnUqO1v.js","./TagInput-CZBAu1Hy.js","./CollapsibleSection-BAteHgBG.js","./useYamlActivityEvents-D0XNXli1.js","./helpers-DzO-OGPe.js","./RunAsSelector-DvPX3XmA.js","./BotPicker-B3y3H3fs.js","./bots-CQxehfBo.js","./ToolPill-B2aRk0o1.js","./TimeAgo-BkY4lahi.js","./EscalationsOverview-DE6EPkhT.js","./AvailableEscalationsPage--o6qcz7-.js","./task-queues-7-sHKPsN.js","./BulkAssignModal-DMNIkIn6.js","./constants-CeBBTzf5.js","./EscalationTitleSelect-BN7D52wT.js","./EscalationTimeline-Dv0XUgQX.js","./escalation-items-Bj7bkwWy.js","./validate-Be4GWnJ1.js","./escalation-columns-CVFGUB79.js","./EntityTimelinePanel-DqD_BpJM.js","./PriorityBadge-r33mpDju.js","./CountdownTimer-DBLURjxh.js","./CredentialConfirmModal-BqpY3yen.js","./PrintLabelsPanel-BkUN00Qd.js","./OperatorDashboard-Cm9_C0EP.js","./index-v4rQ8ctJ.js","./ResolverForm-DZmY6wJV.js","./RosterWidget-DRVj9xyk.js","./metadata-display-B7X5hGxG.js","./WorkflowsOverview-DNoI9qY8.js","./index-C2vRDf96.js","./NamespacePill-DilSgLyE.js","./WorkflowsDashboard-m4Co5diK.js","./YamlWorkflowsPage-D1JNwDSg.js","./GraphInvokePage--gn48yUD.js","./YamlWorkflowDetailPage-8Vpc4Oxy.js","./TasksListPage-DMYQNDIw.js","./TaskDetailPage-WtVv2z7T.js","./WorkflowExecutionPage-BeffqV13.js","./AdminDashboard-C25co77C.js","./index-Dq1zjilj.js","./TaskQueuePill-DWGn3CWx.js","./index-BD4O-ISx.js","./ConfirmDeleteModal-BNY287W9.js","./index-qEd4FVmN.js","./ToolTestPanel-CNMbmymK.js","./index-Dz4LSzA2.js","./index-g1MmARVR.js","./personas-zWlWjj6j.js","./ScopeBadge-HeuiMJhW.js","./RolesPage-CwxHOkqF.js","./RoleDetailPage-vGeth3ve.js","./AutoGrowTextarea-7X3T9La8.js","./PersonasPage-ba1KeInW.js","./PersonaDetailPage-CvstNkh3.js","./EscalationSchemaPage-BZHZfJiQ.js","./PortalPage-GDgG88TM.js","./EscalationListSchemaPage-DDKcrVbb.js","./ScanCodesPage-Cptbe7h8.js","./SchemeMatchFields-w-pffi98.js","./LabelJobsPage-C8LSts4O.js","./ScanSchemeDetailPage-DquNJ7Or.js","./ScanStationPage-DaRfGGa8.js","./index-CnBUFCV7.js","./OperationsPage-xe6bAwaq.js","./index-CdXPbBgs.js","./index-D_TSx-k_.js","./CredentialsPage-CW3_dbm2.js","./ConnectedAppsPage-LLiiH3da.js","./index-BL8XOMHT.js","./DropZone-CHmz59w4.js","./index-CNgyKRQ8.js","./knowledge-CT1I1t1S.js","./LinesPage-CJprjG39.js","./machines-Dsuw-l1y.js","./LinePage-CS7uUv00.js","./HomePage-IR_jgBE8.js","./AgentsPage-ByHU42SO.js","./agents-LTHUsfv3.js","./AgentDetailPage-ByaepsB5.js","./CronLabel-CR6DiZZr.js","./AgentConfigPage-CsCpI15j.js","./capabilities-DECTnJrK.js","./topics-Dr_1TtUM.js","./CapabilitiesPage-BekfKHlk.js","./TopicsPage-BtD8jTU7.js","./TopicDetailPage-CodBRylU.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var pS=Object.defineProperty;var yS=(n,e,s)=>e in n?pS(n,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[e]=s;var j=(n,e,s)=>yS(n,typeof e!="symbol"?e+"":e,s);import{r as gS,u as Le,a as E,j as h,b as qe,c as ze,g as bS,d as xS,Q as vS,e as _S}from"./vendor-query-DvWWuNIB.js";import{r as wS,u as ri,a as tn,b as lm,L as ar,N as As,c as un,O as _s,d as SS,R as ES}from"./vendor-react-_9U4mKFr.js";import{X as en,E as OS,S as AS,M as jS,a as Ro,C as cm,b as kS,B as NS,c as TS,d as hx,e as xd,I as vd,U as CS,L as _d,f as MS,G as RS,T as DS,F as LS,R as dx,g as qS,Z as PS,P as qg,h as mx,i as BS,j as Pg,k as wd,l as Bg,m as US,W as um,n as zS,o as $S,p as IS,q as px,r as HS,D as FS,s as GS,N as VS,t as YS,u as yx,v as gx,w as bx,x as KS,y as JS,z as QS,A as XS,H as WS,J as ZS,K as eE,O as tE,Q as nE}from"./vendor-icons-D48ijXZU.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.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 Qh={exports:{}},io={},Xh={exports:{}},Wh={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* scheduler.production.js
|
|
5
5
|
*
|
|
@@ -17,13 +17,13 @@ var pS=Object.defineProperty;var yS=(n,e,s)=>e in n?pS(n,e,{enumerable:!0,config
|
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
18
|
*/var $g;function iE(){if($g)return io;$g=1;var n=sE(),e=gS(),s=wS();function i(t){var r="https://react.dev/errors/"+t;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 #"+t+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var r=t,a=t;if(t.alternate)for(;r.return;)r=r.return;else{t=r;do r=t,(r.flags&4098)!==0&&(a=r.return),t=r.return;while(t)}return r.tag===3?a:null}function d(t){if(t.tag===13){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function p(t){if(t.tag===31){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function g(t){if(c(t)!==t)throw Error(i(188))}function u(t){var r=t.alternate;if(!r){if(r=c(t),r===null)throw Error(i(188));return r!==t?null:t}for(var a=t,l=r;;){var f=a.return;if(f===null)break;var y=f.alternate;if(y===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===y.child){for(y=f.child;y;){if(y===a)return g(f),t;if(y===l)return g(f),r;y=y.sibling}throw Error(i(188))}if(a.return!==l.return)a=f,l=y;else{for(var w=!1,O=f.child;O;){if(O===a){w=!0,a=f,l=y;break}if(O===l){w=!0,l=f,a=y;break}O=O.sibling}if(!w){for(O=y.child;O;){if(O===a){w=!0,a=y,l=f;break}if(O===l){w=!0,l=y,a=f;break}O=O.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?t:r}function m(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t;for(t=t.child;t!==null;){if(r=m(t),r!==null)return r;t=t.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"),B=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),ne=Symbol.for("react.context"),te=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function W(t){return t===null||typeof t!="object"?null:(t=Q&&t[Q]||t["@@iterator"],typeof t=="function"?t:null)}var he=Symbol.for("react.client.reference");function Ee(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===he?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case S:return"Fragment";case B:return"Profiler";case C:return"StrictMode";case M:return"Suspense";case z:return"SuspenseList";case U:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case _:return"Portal";case ne:return t.displayName||"Context";case q:return(t._context.displayName||"Context")+".Consumer";case te:var r=t.render;return t=t.displayName,t||(t=r.displayName||r.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ae:return r=t.displayName||null,r!==null?r:Ee(t.type)||"Memo";case F:r=t._payload,t=t._init;try{return Ee(t(r))}catch{}}return null}var Ae=Array.isArray,H=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},pe=[],ge=-1;function Ce(t){return{current:t}}function Ne(t){0>ge||(t.current=pe[ge],pe[ge]=null,ge--)}function Me(t,r){ge++,pe[ge]=t.current,t.current=r}var Xe=Ce(null),pt=Ce(null),Ot=Ce(null),mt=Ce(null);function _e(t,r){switch(Me(Ot,r),Me(pt,t),Me(Xe,null),r.nodeType){case 9:case 11:t=(t=r.documentElement)&&(t=t.namespaceURI)?ig(t):0;break;default:if(t=r.tagName,r=r.namespaceURI)r=ig(r),t=ag(r,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Ne(Xe),Me(Xe,t)}function oe(){Ne(Xe),Ne(pt),Ne(Ot)}function Be(t){t.memoizedState!==null&&Me(mt,t);var r=Xe.current,a=ag(r,t.type);r!==a&&(Me(pt,t),Me(Xe,a))}function zt(t){pt.current===t&&(Ne(Xe),Ne(pt)),mt.current===t&&(Ne(mt),to._currentValue=ce)}var Mt,tt;function ye(t){if(Mt===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);Mt=r&&r[1]||"",tt=-1<a.stack.indexOf(`
|
|
19
19
|
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
-
`+Mt+t+tt}var
|
|
20
|
+
`+Mt+t+tt}var Pe=!1;function yt(t,r){if(!t||Pe)return"";Pe=!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(X){var Y=X}Reflect.construct(t,[],ie)}else{try{ie.call()}catch(X){Y=X}t.call(ie.prototype)}}else{try{throw Error()}catch(X){Y=X}(ie=t())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(X){if(X&&Y&&typeof X.stack=="string")return[X.stack,Y.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=l.DetermineComponentFrameRoot(),w=y[0],O=y[1];if(w&&O){var R=w.split(`
|
|
21
21
|
`),V=O.split(`
|
|
22
22
|
`);for(f=l=0;l<R.length&&!R[l].includes("DetermineComponentFrameRoot");)l++;for(;f<V.length&&!V[f].includes("DetermineComponentFrameRoot");)f++;if(l===R.length||f===V.length)for(l=R.length-1,f=V.length-1;1<=l&&0<=f&&R[l]!==V[f];)f--;for(;1<=l&&0<=f;l--,f--)if(R[l]!==V[f]){if(l!==1||f!==1)do if(l--,f--,0>f||R[l]!==V[f]){var Z=`
|
|
23
|
-
`+R[l].replace(" at new "," at ");return t.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",t.displayName)),Z}while(1<=l&&0<=f);break}}}finally{
|
|
23
|
+
`+R[l].replace(" at new "," at ");return t.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",t.displayName)),Z}while(1<=l&&0<=f);break}}}finally{Pe=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?ye(a):""}function At(t,r){switch(t.tag){case 26:case 27:case 5:return ye(t.type);case 16:return ye("Lazy");case 13:return t.child!==r&&r!==null?ye("Suspense Fallback"):ye("Suspense");case 19:return ye("SuspenseList");case 0:case 15:return yt(t.type,!1);case 11:return yt(t.type.render,!1);case 1:return yt(t.type,!0);case 31:return ye("Activity");default:return""}}function Ur(t){try{var r="",a=null;do r+=At(t,a),a=t,t=t.return;while(t);return r}catch(l){return`
|
|
24
24
|
Error generating stack: `+l.message+`
|
|
25
25
|
`+l.stack}}var fa=Object.prototype.hasOwnProperty,ha=n.unstable_scheduleCallback,hr=n.unstable_cancelCallback,$o=n.unstable_shouldYield,ii=n.unstable_requestPaint,ut=n.unstable_now,Uu=n.unstable_getCurrentPriorityLevel,Io=n.unstable_ImmediatePriority,Ho=n.unstable_UserBlockingPriority,ai=n.unstable_NormalPriority,zu=n.unstable_LowPriority,Fo=n.unstable_IdlePriority,$u=n.log,Go=n.unstable_setDisableYieldValue,Ts=null,_t=null;function fn(t){if(typeof $u=="function"&&Go(t),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(Ts,t)}catch{}}var Gt=Math.clz32?Math.clz32:oi,da=Math.log,ma=Math.LN2;function oi(t){return t>>>=0,t===0?32:31-(da(t)/ma|0)|0}var zr=256,dr=262144,$r=4194304;function Fn(t){var r=t&42;if(r!==0)return r;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Cs(t,r,a){var l=t.pendingLanes;if(l===0)return 0;var f=0,y=t.suspendedLanes,w=t.pingedLanes;t=t.warmLanes;var O=l&134217727;return O!==0?(l=O&~y,l!==0?f=Fn(l):(w&=O,w!==0?f=Fn(w):a||(a=O&~t,a!==0&&(f=Fn(a))))):(O=l&~y,O!==0?f=Fn(O):w!==0?f=Fn(w):a||(a=l&~t,a!==0&&(f=Fn(a)))),f===0?0:r!==0&&r!==f&&(r&y)===0&&(y=f&-f,a=r&-r,y>=a||y===32&&(a&4194048)!==0)?r:f}function Ms(t,r){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&r)===0}function pa(t,r){switch(t){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 li(){var t=$r;return $r<<=1,($r&62914560)===0&&($r=4194304),t}function Ir(t){for(var r=[],a=0;31>a;a++)r.push(t);return r}function Gn(t,r){t.pendingLanes|=r,r!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Hr(t,r,a,l,f,y){var w=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var O=t.entanglements,R=t.expirationTimes,V=t.hiddenUpdates;for(a=w&~a;0<a;){var Z=31-Gt(a),ie=1<<Z;O[Z]=0,R[Z]=-1;var Y=V[Z];if(Y!==null)for(V[Z]=null,Z=0;Z<Y.length;Z++){var X=Y[Z];X!==null&&(X.lane&=-536870913)}a&=~ie}l!==0&&Fr(t,l,0),y!==0&&f===0&&t.tag!==0&&(t.suspendedLanes|=y&~(w&~r))}function Fr(t,r,a){t.pendingLanes|=r,t.suspendedLanes&=~r;var l=31-Gt(r);t.entangledLanes|=r,t.entanglements[l]=t.entanglements[l]|1073741824|a&261930}function Rs(t,r){var a=t.entangledLanes|=r;for(t=t.entanglements;a;){var l=31-Gt(a),f=1<<l;f&r|t[l]&r&&(t[l]|=r),a&=~f}}function Gr(t,r){var a=r&-r;return a=(a&42)!==0?1:mr(a),(a&(t.suspendedLanes|r))!==0?0:a}function mr(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Ds(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function ya(){var t=J.p;return t!==0?t:(t=window.event,t===void 0?32:Ng(t.type))}function Vo(t,r){var a=J.p;try{return J.p=t,r()}finally{J.p=a}}var tr=Math.random().toString(36).slice(2),it="__reactFiber$"+tr,gt="__reactProps$"+tr,hn="__reactContainer$"+tr,Ls="__reactEvents$"+tr,ga="__reactListeners$"+tr,Yo="__reactHandles$"+tr,Ko="__reactResources$"+tr,Rt="__reactMarker$"+tr;function ci(t){delete t[it],delete t[gt],delete t[Ls],delete t[ga],delete t[Yo]}function A(t){var r=t[it];if(r)return r;for(var a=t.parentNode;a;){if(r=a[hn]||a[it]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(t=dg(t);t!==null;){if(a=t[it])return a;t=dg(t)}return r}t=a,a=t.parentNode}return null}function N(t){if(t=t[it]||t[hn]){var r=t.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return t}return null}function k(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t.stateNode;throw Error(i(33))}function T(t){var r=t[Ko];return r||(r=t[Ko]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function L(t){t[Rt]=!0}var I=new Set,se={};function le(t,r){K(t,r),K(t+"Capture",r)}function K(t,r){for(se[t]=r,t=0;t<r.length;t++)I.add(r[t])}var re=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]*$"),xe={},Ue={};function ot(t){return fa.call(Ue,t)?!0:fa.call(xe,t)?!1:re.test(t)?Ue[t]=!0:(xe[t]=!0,!1)}function Vt(t,r,a){if(ot(r))if(a===null)t.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(r);return;case"boolean":var l=r.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){t.removeAttribute(r);return}}t.setAttribute(r,""+a)}}function Vn(t,r,a){if(a===null)t.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(r);return}t.setAttribute(r,""+a)}}function pr(t,r,a,l){if(l===null)t.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(r,a,""+l)}}function Tn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Xm(t){var r=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function l_(t,r,a){var l=Object.getOwnPropertyDescriptor(t.constructor.prototype,r);if(!t.hasOwnProperty(r)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,y=l.set;return Object.defineProperty(t,r,{configurable:!0,get:function(){return f.call(this)},set:function(w){a=""+w,y.call(this,w)}}),Object.defineProperty(t,r,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){t._valueTracker=null,delete t[r]}}}}function Iu(t){if(!t._valueTracker){var r=Xm(t)?"checked":"value";t._valueTracker=l_(t,r,""+t[r])}}function Wm(t){if(!t)return!1;var r=t._valueTracker;if(!r)return!0;var a=r.getValue(),l="";return t&&(l=Xm(t)?t.checked?"true":"false":t.value),t=l,t!==a?(r.setValue(t),!0):!1}function Jo(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var c_=/[\n"\\]/g;function Cn(t){return t.replace(c_,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Hu(t,r,a,l,f,y,w,O){t.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?t.type=w:t.removeAttribute("type"),r!=null?w==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+Tn(r)):t.value!==""+Tn(r)&&(t.value=""+Tn(r)):w!=="submit"&&w!=="reset"||t.removeAttribute("value"),r!=null?Fu(t,w,Tn(r)):a!=null?Fu(t,w,Tn(a)):l!=null&&t.removeAttribute("value"),f==null&&y!=null&&(t.defaultChecked=!!y),f!=null&&(t.checked=f&&typeof f!="function"&&typeof f!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?t.name=""+Tn(O):t.removeAttribute("name")}function Zm(t,r,a,l,f,y,w,O){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.type=y),r!=null||a!=null){if(!(y!=="submit"&&y!=="reset"||r!=null)){Iu(t);return}a=a!=null?""+Tn(a):"",r=r!=null?""+Tn(r):a,O||r===t.value||(t.value=r),t.defaultValue=r}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,t.checked=O?t.checked:!!l,t.defaultChecked=!!l,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(t.name=w),Iu(t)}function Fu(t,r,a){r==="number"&&Jo(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function ui(t,r,a,l){if(t=t.options,r){r={};for(var f=0;f<a.length;f++)r["$"+a[f]]=!0;for(a=0;a<t.length;a++)f=r.hasOwnProperty("$"+t[a].value),t[a].selected!==f&&(t[a].selected=f),f&&l&&(t[a].defaultSelected=!0)}else{for(a=""+Tn(a),r=null,f=0;f<t.length;f++){if(t[f].value===a){t[f].selected=!0,l&&(t[f].defaultSelected=!0);return}r!==null||t[f].disabled||(r=t[f])}r!==null&&(r.selected=!0)}}function e0(t,r,a){if(r!=null&&(r=""+Tn(r),r!==t.value&&(t.value=r),a==null)){t.defaultValue!==r&&(t.defaultValue=r);return}t.defaultValue=a!=null?""+Tn(a):""}function t0(t,r,a,l){if(r==null){if(l!=null){if(a!=null)throw Error(i(92));if(Ae(l)){if(1<l.length)throw Error(i(93));l=l[0]}a=l}a==null&&(a=""),r=a}a=Tn(r),t.defaultValue=a,l=t.textContent,l===a&&l!==""&&l!==null&&(t.value=l),Iu(t)}function fi(t,r){if(r){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=r;return}}t.textContent=r}var u_=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 n0(t,r,a){var l=r.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?t.setProperty(r,""):r==="float"?t.cssFloat="":t[r]="":l?t.setProperty(r,a):typeof a!="number"||a===0||u_.has(r)?r==="float"?t.cssFloat=a:t[r]=(""+a).trim():t[r]=a+"px"}function r0(t,r,a){if(r!=null&&typeof r!="object")throw Error(i(62));if(t=t.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||r!=null&&r.hasOwnProperty(l)||(l.indexOf("--")===0?t.setProperty(l,""):l==="float"?t.cssFloat="":t[l]="");for(var f in r)l=r[f],r.hasOwnProperty(f)&&a[f]!==l&&n0(t,f,l)}else for(var y in r)r.hasOwnProperty(y)&&n0(t,y,r[y])}function Gu(t){if(t.indexOf("-")===-1)return!1;switch(t){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 f_=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"]]),h_=/^[\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 Qo(t){return h_.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function yr(){}var Vu=null;function Yu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var hi=null,di=null;function s0(t){var r=N(t);if(r&&(t=r.stateNode)){var a=t[gt]||null;e:switch(t=r.stateNode,r.type){case"input":if(Hu(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),r=a.name,a.type==="radio"&&r!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Cn(""+r)+'"][type="radio"]'),r=0;r<a.length;r++){var l=a[r];if(l!==t&&l.form===t.form){var f=l[gt]||null;if(!f)throw Error(i(90));Hu(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(r=0;r<a.length;r++)l=a[r],l.form===t.form&&Wm(l)}break e;case"textarea":e0(t,a.value,a.defaultValue);break e;case"select":r=a.value,r!=null&&ui(t,!!a.multiple,r,!1)}}}var Ku=!1;function i0(t,r,a){if(Ku)return t(r,a);Ku=!0;try{var l=t(r);return l}finally{if(Ku=!1,(hi!==null||di!==null)&&(Pl(),hi&&(r=hi,t=di,di=hi=null,s0(r),t)))for(r=0;r<t.length;r++)s0(t[r])}}function ba(t,r){var a=t.stateNode;if(a===null)return null;var l=a[gt]||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)||(t=t.type,l=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!l;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(i(231,r,typeof a));return a}var gr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ju=!1;if(gr)try{var xa={};Object.defineProperty(xa,"passive",{get:function(){Ju=!0}}),window.addEventListener("test",xa,xa),window.removeEventListener("test",xa,xa)}catch{Ju=!1}var Vr=null,Qu=null,Xo=null;function a0(){if(Xo)return Xo;var t,r=Qu,a=r.length,l,f="value"in Vr?Vr.value:Vr.textContent,y=f.length;for(t=0;t<a&&r[t]===f[t];t++);var w=a-t;for(l=1;l<=w&&r[a-l]===f[y-l];l++);return Xo=f.slice(t,1<l?1-l:void 0)}function Wo(t){var r=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&r===13&&(t=13)):t=r,t===10&&(t=13),32<=t||t===13?t:0}function Zo(){return!0}function o0(){return!1}function rn(t){function r(a,l,f,y,w){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=y,this.target=w,this.currentTarget=null;for(var O in t)t.hasOwnProperty(O)&&(a=t[O],this[O]=a?a(y):y[O]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Zo:o0,this.isPropagationStopped=o0,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=Zo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Zo)},persist:function(){},isPersistent:Zo}),r}var qs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},el=rn(qs),va=b({},qs,{view:0,detail:0}),d_=rn(va),Xu,Wu,_a,tl=b({},va,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ef,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==_a&&(_a&&t.type==="mousemove"?(Xu=t.screenX-_a.screenX,Wu=t.screenY-_a.screenY):Wu=Xu=0,_a=t),Xu)},movementY:function(t){return"movementY"in t?t.movementY:Wu}}),l0=rn(tl),m_=b({},tl,{dataTransfer:0}),p_=rn(m_),y_=b({},va,{relatedTarget:0}),Zu=rn(y_),g_=b({},qs,{animationName:0,elapsedTime:0,pseudoElement:0}),b_=rn(g_),x_=b({},qs,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),v_=rn(x_),__=b({},qs,{data:0}),c0=rn(__),w_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},S_={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"},E_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function O_(t){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(t):(t=E_[t])?!!r[t]:!1}function ef(){return O_}var A_=b({},va,{key:function(t){if(t.key){var r=w_[t.key]||t.key;if(r!=="Unidentified")return r}return t.type==="keypress"?(t=Wo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?S_[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ef,charCode:function(t){return t.type==="keypress"?Wo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Wo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),j_=rn(A_),k_=b({},tl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),u0=rn(k_),N_=b({},va,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ef}),T_=rn(N_),C_=b({},qs,{propertyName:0,elapsedTime:0,pseudoElement:0}),M_=rn(C_),R_=b({},tl,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),D_=rn(R_),L_=b({},qs,{newState:0,oldState:0}),q_=rn(L_),P_=[9,13,27,32],tf=gr&&"CompositionEvent"in window,wa=null;gr&&"documentMode"in document&&(wa=document.documentMode);var B_=gr&&"TextEvent"in window&&!wa,f0=gr&&(!tf||wa&&8<wa&&11>=wa),h0=" ",d0=!1;function m0(t,r){switch(t){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 p0(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var mi=!1;function U_(t,r){switch(t){case"compositionend":return p0(r);case"keypress":return r.which!==32?null:(d0=!0,h0);case"textInput":return t=r.data,t===h0&&d0?null:t;default:return null}}function z_(t,r){if(mi)return t==="compositionend"||!tf&&m0(t,r)?(t=a0(),Xo=Qu=Vr=null,mi=!1,t):null;switch(t){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 f0&&r.locale!=="ko"?null:r.data;default:return null}}var $_={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 y0(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r==="input"?!!$_[t.type]:r==="textarea"}function g0(t,r,a,l){hi?di?di.push(l):di=[l]:hi=l,r=Fl(r,"onChange"),0<r.length&&(a=new el("onChange","change",null,a,l),t.push({event:a,listeners:r}))}var Sa=null,Ea=null;function I_(t){Zy(t,0)}function nl(t){var r=k(t);if(Wm(r))return t}function b0(t,r){if(t==="change")return r}var x0=!1;if(gr){var nf;if(gr){var rf="oninput"in document;if(!rf){var v0=document.createElement("div");v0.setAttribute("oninput","return;"),rf=typeof v0.oninput=="function"}nf=rf}else nf=!1;x0=nf&&(!document.documentMode||9<document.documentMode)}function _0(){Sa&&(Sa.detachEvent("onpropertychange",w0),Ea=Sa=null)}function w0(t){if(t.propertyName==="value"&&nl(Ea)){var r=[];g0(r,Ea,t,Yu(t)),i0(I_,r)}}function H_(t,r,a){t==="focusin"?(_0(),Sa=r,Ea=a,Sa.attachEvent("onpropertychange",w0)):t==="focusout"&&_0()}function F_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return nl(Ea)}function G_(t,r){if(t==="click")return nl(r)}function V_(t,r){if(t==="input"||t==="change")return nl(r)}function Y_(t,r){return t===r&&(t!==0||1/t===1/r)||t!==t&&r!==r}var dn=typeof Object.is=="function"?Object.is:Y_;function Oa(t,r){if(dn(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;var a=Object.keys(t),l=Object.keys(r);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!fa.call(r,f)||!dn(t[f],r[f]))return!1}return!0}function S0(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function E0(t,r){var a=S0(t);t=0;for(var l;a;){if(a.nodeType===3){if(l=t+a.textContent.length,t<=r&&l>=r)return{node:a,offset:r-t};t=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=S0(a)}}function O0(t,r){return t&&r?t===r?!0:t&&t.nodeType===3?!1:r&&r.nodeType===3?O0(t,r.parentNode):"contains"in t?t.contains(r):t.compareDocumentPosition?!!(t.compareDocumentPosition(r)&16):!1:!1}function A0(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var r=Jo(t.document);r instanceof t.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)t=r.contentWindow;else break;r=Jo(t.document)}return r}function sf(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r&&(r==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||r==="textarea"||t.contentEditable==="true")}var K_=gr&&"documentMode"in document&&11>=document.documentMode,pi=null,af=null,Aa=null,of=!1;function j0(t,r,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;of||pi==null||pi!==Jo(l)||(l=pi,"selectionStart"in l&&sf(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}),Aa&&Oa(Aa,l)||(Aa=l,l=Fl(af,"onSelect"),0<l.length&&(r=new el("onSelect","select",null,r,a),t.push({event:r,listeners:l}),r.target=pi)))}function Ps(t,r){var a={};return a[t.toLowerCase()]=r.toLowerCase(),a["Webkit"+t]="webkit"+r,a["Moz"+t]="moz"+r,a}var yi={animationend:Ps("Animation","AnimationEnd"),animationiteration:Ps("Animation","AnimationIteration"),animationstart:Ps("Animation","AnimationStart"),transitionrun:Ps("Transition","TransitionRun"),transitionstart:Ps("Transition","TransitionStart"),transitioncancel:Ps("Transition","TransitionCancel"),transitionend:Ps("Transition","TransitionEnd")},lf={},k0={};gr&&(k0=document.createElement("div").style,"AnimationEvent"in window||(delete yi.animationend.animation,delete yi.animationiteration.animation,delete yi.animationstart.animation),"TransitionEvent"in window||delete yi.transitionend.transition);function Bs(t){if(lf[t])return lf[t];if(!yi[t])return t;var r=yi[t],a;for(a in r)if(r.hasOwnProperty(a)&&a in k0)return lf[t]=r[a];return t}var N0=Bs("animationend"),T0=Bs("animationiteration"),C0=Bs("animationstart"),J_=Bs("transitionrun"),Q_=Bs("transitionstart"),X_=Bs("transitioncancel"),M0=Bs("transitionend"),R0=new Map,cf="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(" ");cf.push("scrollEnd");function Yn(t,r){R0.set(t,r),le(r,[t])}var rl=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Mn=[],gi=0,uf=0;function sl(){for(var t=gi,r=uf=gi=0;r<t;){var a=Mn[r];Mn[r++]=null;var l=Mn[r];Mn[r++]=null;var f=Mn[r];Mn[r++]=null;var y=Mn[r];if(Mn[r++]=null,l!==null&&f!==null){var w=l.pending;w===null?f.next=f:(f.next=w.next,w.next=f),l.pending=f}y!==0&&D0(a,f,y)}}function il(t,r,a,l){Mn[gi++]=t,Mn[gi++]=r,Mn[gi++]=a,Mn[gi++]=l,uf|=l,t.lanes|=l,t=t.alternate,t!==null&&(t.lanes|=l)}function ff(t,r,a,l){return il(t,r,a,l),al(t)}function Us(t,r){return il(t,null,null,r),al(t)}function D0(t,r,a){t.lanes|=a;var l=t.alternate;l!==null&&(l.lanes|=a);for(var f=!1,y=t.return;y!==null;)y.childLanes|=a,l=y.alternate,l!==null&&(l.childLanes|=a),y.tag===22&&(t=y.stateNode,t===null||t._visibility&1||(f=!0)),t=y,y=y.return;return t.tag===3?(y=t.stateNode,f&&r!==null&&(f=31-Gt(a),t=y.hiddenUpdates,l=t[f],l===null?t[f]=[r]:l.push(r),r.lane=a|536870912),y):null}function al(t){if(50<Ka)throw Ka=0,vh=null,Error(i(185));for(var r=t.return;r!==null;)t=r,r=t.return;return t.tag===3?t.stateNode:null}var bi={};function W_(t,r,a,l){this.tag=t,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 mn(t,r,a,l){return new W_(t,r,a,l)}function hf(t){return t=t.prototype,!(!t||!t.isReactComponent)}function br(t,r){var a=t.alternate;return a===null?(a=mn(t.tag,r,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=r,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,r=t.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function L0(t,r){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=r,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,r=a.dependencies,t.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),t}function ol(t,r,a,l,f,y){var w=0;if(l=t,typeof t=="function")hf(t)&&(w=1);else if(typeof t=="string")w=rS(t,a,Xe.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case U:return t=mn(31,a,r,f),t.elementType=U,t.lanes=y,t;case S:return zs(a.children,f,y,r);case C:w=8,f|=24;break;case B:return t=mn(12,a,r,f|2),t.elementType=B,t.lanes=y,t;case M:return t=mn(13,a,r,f),t.elementType=M,t.lanes=y,t;case z:return t=mn(19,a,r,f),t.elementType=z,t.lanes=y,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ne:w=10;break e;case q:w=9;break e;case te:w=11;break e;case ae:w=14;break e;case F:w=16,l=null;break e}w=29,a=Error(i(130,t===null?"null":typeof t,"")),l=null}return r=mn(w,a,r,f),r.elementType=t,r.type=l,r.lanes=y,r}function zs(t,r,a,l){return t=mn(7,t,l,r),t.lanes=a,t}function df(t,r,a){return t=mn(6,t,null,r),t.lanes=a,t}function q0(t){var r=mn(18,null,null,0);return r.stateNode=t,r}function mf(t,r,a){return r=mn(4,t.children!==null?t.children:[],t.key,r),r.lanes=a,r.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},r}var P0=new WeakMap;function Rn(t,r){if(typeof t=="object"&&t!==null){var a=P0.get(t);return a!==void 0?a:(r={value:t,source:r,stack:Ur(r)},P0.set(t,r),r)}return{value:t,source:r,stack:Ur(r)}}var xi=[],vi=0,ll=null,ja=0,Dn=[],Ln=0,Yr=null,nr=1,rr="";function xr(t,r){xi[vi++]=ja,xi[vi++]=ll,ll=t,ja=r}function B0(t,r,a){Dn[Ln++]=nr,Dn[Ln++]=rr,Dn[Ln++]=Yr,Yr=t;var l=nr;t=rr;var f=32-Gt(l)-1;l&=~(1<<f),a+=1;var y=32-Gt(r)+f;if(30<y){var w=f-f%5;y=(l&(1<<w)-1).toString(32),l>>=w,f-=w,nr=1<<32-Gt(r)+f|a<<f|l,rr=y+t}else nr=1<<y|a<<f|l,rr=t}function pf(t){t.return!==null&&(xr(t,1),B0(t,1,0))}function yf(t){for(;t===ll;)ll=xi[--vi],xi[vi]=null,ja=xi[--vi],xi[vi]=null;for(;t===Yr;)Yr=Dn[--Ln],Dn[Ln]=null,rr=Dn[--Ln],Dn[Ln]=null,nr=Dn[--Ln],Dn[Ln]=null}function U0(t,r){Dn[Ln++]=nr,Dn[Ln++]=rr,Dn[Ln++]=Yr,nr=r.id,rr=r.overflow,Yr=t}var $t=null,lt=null,Ge=!1,Kr=null,qn=!1,gf=Error(i(519));function Jr(t){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ka(Rn(r,t)),gf}function z0(t){var r=t.stateNode,a=t.type,l=t.memoizedProps;switch(r[it]=t,r[gt]=l,a){case"dialog":Ie("cancel",r),Ie("close",r);break;case"iframe":case"object":case"embed":Ie("load",r);break;case"video":case"audio":for(a=0;a<Qa.length;a++)Ie(Qa[a],r);break;case"source":Ie("error",r);break;case"img":case"image":case"link":Ie("error",r),Ie("load",r);break;case"details":Ie("toggle",r);break;case"input":Ie("invalid",r),Zm(r,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ie("invalid",r);break;case"textarea":Ie("invalid",r),t0(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||rg(r.textContent,a)?(l.popover!=null&&(Ie("beforetoggle",r),Ie("toggle",r)),l.onScroll!=null&&Ie("scroll",r),l.onScrollEnd!=null&&Ie("scrollend",r),l.onClick!=null&&(r.onclick=yr),r=!0):r=!1,r||Jr(t,!0)}function $0(t){for($t=t.return;$t;)switch($t.tag){case 5:case 31:case 13:qn=!1;return;case 27:case 3:qn=!0;return;default:$t=$t.return}}function _i(t){if(t!==$t)return!1;if(!Ge)return $0(t),Ge=!0,!1;var r=t.tag,a;if((a=r!==3&&r!==27)&&((a=r===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||Lh(t.type,t.memoizedProps)),a=!a),a&<&&Jr(t),$0(t),r===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));lt=hg(t)}else if(r===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));lt=hg(t)}else r===27?(r=lt,cs(t.type)?(t=zh,zh=null,lt=t):lt=r):lt=$t?Bn(t.stateNode.nextSibling):null;return!0}function $s(){lt=$t=null,Ge=!1}function bf(){var t=Kr;return t!==null&&(ln===null?ln=t:ln.push.apply(ln,t),Kr=null),t}function ka(t){Kr===null?Kr=[t]:Kr.push(t)}var xf=Ce(null),Is=null,vr=null;function Qr(t,r,a){Me(xf,r._currentValue),r._currentValue=a}function _r(t){t._currentValue=xf.current,Ne(xf)}function vf(t,r,a){for(;t!==null;){var l=t.alternate;if((t.childLanes&r)!==r?(t.childLanes|=r,l!==null&&(l.childLanes|=r)):l!==null&&(l.childLanes&r)!==r&&(l.childLanes|=r),t===a)break;t=t.return}}function _f(t,r,a,l){var f=t.child;for(f!==null&&(f.return=t);f!==null;){var y=f.dependencies;if(y!==null){var w=f.child;y=y.firstContext;e:for(;y!==null;){var O=y;y=f;for(var R=0;R<r.length;R++)if(O.context===r[R]){y.lanes|=a,O=y.alternate,O!==null&&(O.lanes|=a),vf(y.return,a,t),l||(w=null);break e}y=O.next}}else if(f.tag===18){if(w=f.return,w===null)throw Error(i(341));w.lanes|=a,y=w.alternate,y!==null&&(y.lanes|=a),vf(w,a,t),w=null}else w=f.child;if(w!==null)w.return=f;else for(w=f;w!==null;){if(w===t){w=null;break}if(f=w.sibling,f!==null){f.return=w.return,w=f;break}w=w.return}f=w}}function wi(t,r,a,l){t=null;for(var f=r,y=!1;f!==null;){if(!y){if((f.flags&524288)!==0)y=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var w=f.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var O=f.type;dn(f.pendingProps.value,w.value)||(t!==null?t.push(O):t=[O])}}else if(f===mt.current){if(w=f.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(t!==null?t.push(to):t=[to])}f=f.return}t!==null&&_f(r,t,a,l),r.flags|=262144}function cl(t){for(t=t.firstContext;t!==null;){if(!dn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Hs(t){Is=t,vr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function It(t){return I0(Is,t)}function ul(t,r){return Is===null&&Hs(t),I0(t,r)}function I0(t,r){var a=r._currentValue;if(r={context:r,memoizedValue:a,next:null},vr===null){if(t===null)throw Error(i(308));vr=r,t.dependencies={lanes:0,firstContext:r},t.flags|=524288}else vr=vr.next=r;return a}var Z_=typeof AbortController<"u"?AbortController:function(){var t=[],r=this.signal={aborted:!1,addEventListener:function(a,l){t.push(l)}};this.abort=function(){r.aborted=!0,t.forEach(function(a){return a()})}},ew=n.unstable_scheduleCallback,tw=n.unstable_NormalPriority,jt={$$typeof:ne,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function wf(){return{controller:new Z_,data:new Map,refCount:0}}function Na(t){t.refCount--,t.refCount===0&&ew(tw,function(){t.controller.abort()})}var Ta=null,Sf=0,Si=0,Ei=null;function nw(t,r){if(Ta===null){var a=Ta=[];Sf=0,Si=Ah(),Ei={status:"pending",value:void 0,then:function(l){a.push(l)}}}return Sf++,r.then(H0,H0),r}function H0(){if(--Sf===0&&Ta!==null){Ei!==null&&(Ei.status="fulfilled");var t=Ta;Ta=null,Si=0,Ei=null;for(var r=0;r<t.length;r++)(0,t[r])()}}function rw(t,r){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return t.then(function(){l.status="fulfilled",l.value=r;for(var f=0;f<a.length;f++)(0,a[f])(r)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var F0=H.S;H.S=function(t,r){jy=ut(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&nw(t,r),F0!==null&&F0(t,r)};var Fs=Ce(null);function Ef(){var t=Fs.current;return t!==null?t:at.pooledCache}function fl(t,r){r===null?Me(Fs,Fs.current):Me(Fs,r.pool)}function G0(){var t=Ef();return t===null?null:{parent:jt._currentValue,pool:t}}var Oi=Error(i(460)),Of=Error(i(474)),hl=Error(i(542)),dl={then:function(){}};function V0(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Y0(t,r,a){switch(a=t[a],a===void 0?t.push(r):a!==r&&(r.then(yr,yr),r=a),r.status){case"fulfilled":return r.value;case"rejected":throw t=r.reason,J0(t),t;default:if(typeof r.status=="string")r.then(yr,yr);else{if(t=at,t!==null&&100<t.shellSuspendCounter)throw Error(i(482));t=r,t.status="pending",t.then(function(l){if(r.status==="pending"){var f=r;f.status="fulfilled",f.value=l}},function(l){if(r.status==="pending"){var f=r;f.status="rejected",f.reason=l}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw t=r.reason,J0(t),t}throw Vs=r,Oi}}function Gs(t){try{var r=t._init;return r(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Vs=a,Oi):a}}var Vs=null;function K0(){if(Vs===null)throw Error(i(459));var t=Vs;return Vs=null,t}function J0(t){if(t===Oi||t===hl)throw Error(i(483))}var Ai=null,Ca=0;function ml(t){var r=Ca;return Ca+=1,Ai===null&&(Ai=[]),Y0(Ai,t,r)}function Ma(t,r){r=r.props.ref,t.ref=r!==void 0?r:null}function pl(t,r){throw r.$$typeof===x?Error(i(525)):(t=Object.prototype.toString.call(r),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":t)))}function Q0(t){function r($,P){if(t){var G=$.deletions;G===null?($.deletions=[P],$.flags|=16):G.push(P)}}function a($,P){if(!t)return null;for(;P!==null;)r($,P),P=P.sibling;return null}function l($){for(var P=new Map;$!==null;)$.key!==null?P.set($.key,$):P.set($.index,$),$=$.sibling;return P}function f($,P){return $=br($,P),$.index=0,$.sibling=null,$}function y($,P,G){return $.index=G,t?(G=$.alternate,G!==null?(G=G.index,G<P?($.flags|=67108866,P):G):($.flags|=67108866,P)):($.flags|=1048576,P)}function w($){return t&&$.alternate===null&&($.flags|=67108866),$}function O($,P,G,ee){return P===null||P.tag!==6?(P=df(G,$.mode,ee),P.return=$,P):(P=f(P,G),P.return=$,P)}function R($,P,G,ee){var je=G.type;return je===S?Z($,P,G.props.children,ee,G.key):P!==null&&(P.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===F&&Gs(je)===P.type)?(P=f(P,G.props),Ma(P,G),P.return=$,P):(P=ol(G.type,G.key,G.props,null,$.mode,ee),Ma(P,G),P.return=$,P)}function V($,P,G,ee){return P===null||P.tag!==4||P.stateNode.containerInfo!==G.containerInfo||P.stateNode.implementation!==G.implementation?(P=mf(G,$.mode,ee),P.return=$,P):(P=f(P,G.children||[]),P.return=$,P)}function Z($,P,G,ee,je){return P===null||P.tag!==7?(P=zs(G,$.mode,ee,je),P.return=$,P):(P=f(P,G),P.return=$,P)}function ie($,P,G){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return P=df(""+P,$.mode,G),P.return=$,P;if(typeof P=="object"&&P!==null){switch(P.$$typeof){case v:return G=ol(P.type,P.key,P.props,null,$.mode,G),Ma(G,P),G.return=$,G;case _:return P=mf(P,$.mode,G),P.return=$,P;case F:return P=Gs(P),ie($,P,G)}if(Ae(P)||W(P))return P=zs(P,$.mode,G,null),P.return=$,P;if(typeof P.then=="function")return ie($,ml(P),G);if(P.$$typeof===ne)return ie($,ul($,P),G);pl($,P)}return null}function Y($,P,G,ee){var je=P!==null?P.key:null;if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return je!==null?null:O($,P,""+G,ee);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case v:return G.key===je?R($,P,G,ee):null;case _:return G.key===je?V($,P,G,ee):null;case F:return G=Gs(G),Y($,P,G,ee)}if(Ae(G)||W(G))return je!==null?null:Z($,P,G,ee,null);if(typeof G.then=="function")return Y($,P,ml(G),ee);if(G.$$typeof===ne)return Y($,P,ul($,G),ee);pl($,G)}return null}function X($,P,G,ee,je){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return $=$.get(G)||null,O(P,$,""+ee,je);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case v:return $=$.get(ee.key===null?G:ee.key)||null,R(P,$,ee,je);case _:return $=$.get(ee.key===null?G:ee.key)||null,V(P,$,ee,je);case F:return ee=Gs(ee),X($,P,G,ee,je)}if(Ae(ee)||W(ee))return $=$.get(G)||null,Z(P,$,ee,je,null);if(typeof ee.then=="function")return X($,P,G,ml(ee),je);if(ee.$$typeof===ne)return X($,P,G,ul(P,ee),je);pl(P,ee)}return null}function ve($,P,G,ee){for(var je=null,Ke=null,Se=P,De=P=0,Fe=null;Se!==null&&De<G.length;De++){Se.index>De?(Fe=Se,Se=null):Fe=Se.sibling;var Je=Y($,Se,G[De],ee);if(Je===null){Se===null&&(Se=Fe);break}t&&Se&&Je.alternate===null&&r($,Se),P=y(Je,P,De),Ke===null?je=Je:Ke.sibling=Je,Ke=Je,Se=Fe}if(De===G.length)return a($,Se),Ge&&xr($,De),je;if(Se===null){for(;De<G.length;De++)Se=ie($,G[De],ee),Se!==null&&(P=y(Se,P,De),Ke===null?je=Se:Ke.sibling=Se,Ke=Se);return Ge&&xr($,De),je}for(Se=l(Se);De<G.length;De++)Fe=X(Se,$,De,G[De],ee),Fe!==null&&(t&&Fe.alternate!==null&&Se.delete(Fe.key===null?De:Fe.key),P=y(Fe,P,De),Ke===null?je=Fe:Ke.sibling=Fe,Ke=Fe);return t&&Se.forEach(function(ms){return r($,ms)}),Ge&&xr($,De),je}function Te($,P,G,ee){if(G==null)throw Error(i(151));for(var je=null,Ke=null,Se=P,De=P=0,Fe=null,Je=G.next();Se!==null&&!Je.done;De++,Je=G.next()){Se.index>De?(Fe=Se,Se=null):Fe=Se.sibling;var ms=Y($,Se,Je.value,ee);if(ms===null){Se===null&&(Se=Fe);break}t&&Se&&ms.alternate===null&&r($,Se),P=y(ms,P,De),Ke===null?je=ms:Ke.sibling=ms,Ke=ms,Se=Fe}if(Je.done)return a($,Se),Ge&&xr($,De),je;if(Se===null){for(;!Je.done;De++,Je=G.next())Je=ie($,Je.value,ee),Je!==null&&(P=y(Je,P,De),Ke===null?je=Je:Ke.sibling=Je,Ke=Je);return Ge&&xr($,De),je}for(Se=l(Se);!Je.done;De++,Je=G.next())Je=X(Se,$,De,Je.value,ee),Je!==null&&(t&&Je.alternate!==null&&Se.delete(Je.key===null?De:Je.key),P=y(Je,P,De),Ke===null?je=Je:Ke.sibling=Je,Ke=Je);return t&&Se.forEach(function(mS){return r($,mS)}),Ge&&xr($,De),je}function st($,P,G,ee){if(typeof G=="object"&&G!==null&&G.type===S&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case v:e:{for(var je=G.key;P!==null;){if(P.key===je){if(je=G.type,je===S){if(P.tag===7){a($,P.sibling),ee=f(P,G.props.children),ee.return=$,$=ee;break e}}else if(P.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===F&&Gs(je)===P.type){a($,P.sibling),ee=f(P,G.props),Ma(ee,G),ee.return=$,$=ee;break e}a($,P);break}else r($,P);P=P.sibling}G.type===S?(ee=zs(G.props.children,$.mode,ee,G.key),ee.return=$,$=ee):(ee=ol(G.type,G.key,G.props,null,$.mode,ee),Ma(ee,G),ee.return=$,$=ee)}return w($);case _:e:{for(je=G.key;P!==null;){if(P.key===je)if(P.tag===4&&P.stateNode.containerInfo===G.containerInfo&&P.stateNode.implementation===G.implementation){a($,P.sibling),ee=f(P,G.children||[]),ee.return=$,$=ee;break e}else{a($,P);break}else r($,P);P=P.sibling}ee=mf(G,$.mode,ee),ee.return=$,$=ee}return w($);case F:return G=Gs(G),st($,P,G,ee)}if(Ae(G))return ve($,P,G,ee);if(W(G)){if(je=W(G),typeof je!="function")throw Error(i(150));return G=je.call(G),Te($,P,G,ee)}if(typeof G.then=="function")return st($,P,ml(G),ee);if(G.$$typeof===ne)return st($,P,ul($,G),ee);pl($,G)}return typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint"?(G=""+G,P!==null&&P.tag===6?(a($,P.sibling),ee=f(P,G),ee.return=$,$=ee):(a($,P),ee=df(G,$.mode,ee),ee.return=$,$=ee),w($)):a($,P)}return function($,P,G,ee){try{Ca=0;var je=st($,P,G,ee);return Ai=null,je}catch(Se){if(Se===Oi||Se===hl)throw Se;var Ke=mn(29,Se,null,$.mode);return Ke.lanes=ee,Ke.return=$,Ke}finally{}}}var Ys=Q0(!0),X0=Q0(!1),Xr=!1;function Af(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function jf(t,r){t=t.updateQueue,r.updateQueue===t&&(r.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Wr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Zr(t,r,a){var l=t.updateQueue;if(l===null)return null;if(l=l.shared,(Qe&2)!==0){var f=l.pending;return f===null?r.next=r:(r.next=f.next,f.next=r),l.pending=r,r=al(t),D0(t,null,a),r}return il(t,l,r,a),al(t)}function Ra(t,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194048)!==0)){var l=r.lanes;l&=t.pendingLanes,a|=l,r.lanes=a,Rs(t,a)}}function kf(t,r){var a=t.updateQueue,l=t.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,y=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};y===null?f=y=w:y=y.next=w,a=a.next}while(a!==null);y===null?f=y=r:y=y.next=r}else f=y=r;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:y,shared:l.shared,callbacks:l.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=r:t.next=r,a.lastBaseUpdate=r}var Nf=!1;function Da(){if(Nf){var t=Ei;if(t!==null)throw t}}function La(t,r,a,l){Nf=!1;var f=t.updateQueue;Xr=!1;var y=f.firstBaseUpdate,w=f.lastBaseUpdate,O=f.shared.pending;if(O!==null){f.shared.pending=null;var R=O,V=R.next;R.next=null,w===null?y=V:w.next=V,w=R;var Z=t.alternate;Z!==null&&(Z=Z.updateQueue,O=Z.lastBaseUpdate,O!==w&&(O===null?Z.firstBaseUpdate=V:O.next=V,Z.lastBaseUpdate=R))}if(y!==null){var ie=f.baseState;w=0,Z=V=R=null,O=y;do{var Y=O.lane&-536870913,X=Y!==O.lane;if(X?(He&Y)===Y:(l&Y)===Y){Y!==0&&Y===Si&&(Nf=!0),Z!==null&&(Z=Z.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var ve=t,Te=O;Y=r;var st=a;switch(Te.tag){case 1:if(ve=Te.payload,typeof ve=="function"){ie=ve.call(st,ie,Y);break e}ie=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=Te.payload,Y=typeof ve=="function"?ve.call(st,ie,Y):ve,Y==null)break e;ie=b({},ie,Y);break e;case 2:Xr=!0}}Y=O.callback,Y!==null&&(t.flags|=64,X&&(t.flags|=8192),X=f.callbacks,X===null?f.callbacks=[Y]:X.push(Y))}else X={lane:Y,tag:O.tag,payload:O.payload,callback:O.callback,next:null},Z===null?(V=Z=X,R=ie):Z=Z.next=X,w|=Y;if(O=O.next,O===null){if(O=f.shared.pending,O===null)break;X=O,O=X.next,X.next=null,f.lastBaseUpdate=X,f.shared.pending=null}}while(!0);Z===null&&(R=ie),f.baseState=R,f.firstBaseUpdate=V,f.lastBaseUpdate=Z,y===null&&(f.shared.lanes=0),ss|=w,t.lanes=w,t.memoizedState=ie}}function W0(t,r){if(typeof t!="function")throw Error(i(191,t));t.call(r)}function Z0(t,r){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)W0(a[t],r)}var ji=Ce(null),yl=Ce(0);function ep(t,r){t=Tr,Me(yl,t),Me(ji,r),Tr=t|r.baseLanes}function Tf(){Me(yl,Tr),Me(ji,ji.current)}function Cf(){Tr=yl.current,Ne(ji),Ne(yl)}var pn=Ce(null),Pn=null;function es(t){var r=t.alternate;Me(wt,wt.current&1),Me(pn,t),Pn===null&&(r===null||ji.current!==null||r.memoizedState!==null)&&(Pn=t)}function Mf(t){Me(wt,wt.current),Me(pn,t),Pn===null&&(Pn=t)}function tp(t){t.tag===22?(Me(wt,wt.current),Me(pn,t),Pn===null&&(Pn=t)):ts()}function ts(){Me(wt,wt.current),Me(pn,pn.current)}function yn(t){Ne(pn),Pn===t&&(Pn=null),Ne(wt)}var wt=Ce(0);function gl(t){for(var r=t;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Bh(a)||Uh(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===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var wr=0,Re=null,nt=null,kt=null,bl=!1,ki=!1,Ks=!1,xl=0,qa=0,Ni=null,sw=0;function bt(){throw Error(i(321))}function Rf(t,r){if(r===null)return!1;for(var a=0;a<r.length&&a<t.length;a++)if(!dn(t[a],r[a]))return!1;return!0}function Df(t,r,a,l,f,y){return wr=y,Re=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,H.H=t===null||t.memoizedState===null?Bp:Jf,Ks=!1,y=a(l,f),Ks=!1,ki&&(y=rp(r,a,l,f)),np(t),y}function np(t){H.H=Ua;var r=nt!==null&&nt.next!==null;if(wr=0,kt=nt=Re=null,bl=!1,qa=0,Ni=null,r)throw Error(i(300));t===null||Nt||(t=t.dependencies,t!==null&&cl(t)&&(Nt=!0))}function rp(t,r,a,l){Re=t;var f=0;do{if(ki&&(Ni=null),qa=0,ki=!1,25<=f)throw Error(i(301));if(f+=1,kt=nt=null,t.updateQueue!=null){var y=t.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}H.H=Up,y=r(a,l)}while(ki);return y}function iw(){var t=H.H,r=t.useState()[0];return r=typeof r.then=="function"?Pa(r):r,t=t.useState()[0],(nt!==null?nt.memoizedState:null)!==t&&(Re.flags|=1024),r}function Lf(){var t=xl!==0;return xl=0,t}function qf(t,r,a){r.updateQueue=t.updateQueue,r.flags&=-2053,t.lanes&=~a}function Pf(t){if(bl){for(t=t.memoizedState;t!==null;){var r=t.queue;r!==null&&(r.pending=null),t=t.next}bl=!1}wr=0,kt=nt=Re=null,ki=!1,qa=xl=0,Ni=null}function Kt(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return kt===null?Re.memoizedState=kt=t:kt=kt.next=t,kt}function St(){if(nt===null){var t=Re.alternate;t=t!==null?t.memoizedState:null}else t=nt.next;var r=kt===null?Re.memoizedState:kt.next;if(r!==null)kt=r,nt=t;else{if(t===null)throw Re.alternate===null?Error(i(467)):Error(i(310));nt=t,t={memoizedState:nt.memoizedState,baseState:nt.baseState,baseQueue:nt.baseQueue,queue:nt.queue,next:null},kt===null?Re.memoizedState=kt=t:kt=kt.next=t}return kt}function vl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Pa(t){var r=qa;return qa+=1,Ni===null&&(Ni=[]),t=Y0(Ni,t,r),r=Re,(kt===null?r.memoizedState:kt.next)===null&&(r=r.alternate,H.H=r===null||r.memoizedState===null?Bp:Jf),t}function _l(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Pa(t);if(t.$$typeof===ne)return It(t)}throw Error(i(438,String(t)))}function Bf(t){var r=null,a=Re.updateQueue;if(a!==null&&(r=a.memoCache),r==null){var l=Re.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(r={data:l.data.map(function(f){return f.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),a===null&&(a=vl(),Re.updateQueue=a),a.memoCache=r,a=r.data[r.index],a===void 0)for(a=r.data[r.index]=Array(t),l=0;l<t;l++)a[l]=D;return r.index++,a}function Sr(t,r){return typeof r=="function"?r(t):r}function wl(t){var r=St();return Uf(r,nt,t)}function Uf(t,r,a){var l=t.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=a;var f=t.baseQueue,y=l.pending;if(y!==null){if(f!==null){var w=f.next;f.next=y.next,y.next=w}r.baseQueue=f=y,l.pending=null}if(y=t.baseState,f===null)t.memoizedState=y;else{r=f.next;var O=w=null,R=null,V=r,Z=!1;do{var ie=V.lane&-536870913;if(ie!==V.lane?(He&ie)===ie:(wr&ie)===ie){var Y=V.revertLane;if(Y===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),ie===Si&&(Z=!0);else if((wr&Y)===Y){V=V.next,Y===Si&&(Z=!0);continue}else ie={lane:0,revertLane:V.revertLane,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},R===null?(O=R=ie,w=y):R=R.next=ie,Re.lanes|=Y,ss|=Y;ie=V.action,Ks&&a(y,ie),y=V.hasEagerState?V.eagerState:a(y,ie)}else Y={lane:ie,revertLane:V.revertLane,gesture:V.gesture,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},R===null?(O=R=Y,w=y):R=R.next=Y,Re.lanes|=ie,ss|=ie;V=V.next}while(V!==null&&V!==r);if(R===null?w=y:R.next=O,!dn(y,t.memoizedState)&&(Nt=!0,Z&&(a=Ei,a!==null)))throw a;t.memoizedState=y,t.baseState=w,t.baseQueue=R,l.lastRenderedState=y}return f===null&&(l.lanes=0),[t.memoizedState,l.dispatch]}function zf(t){var r=St(),a=r.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=t;var l=a.dispatch,f=a.pending,y=r.memoizedState;if(f!==null){a.pending=null;var w=f=f.next;do y=t(y,w.action),w=w.next;while(w!==f);dn(y,r.memoizedState)||(Nt=!0),r.memoizedState=y,r.baseQueue===null&&(r.baseState=y),a.lastRenderedState=y}return[y,l]}function sp(t,r,a){var l=Re,f=St(),y=Ge;if(y){if(a===void 0)throw Error(i(407));a=a()}else a=r();var w=!dn((nt||f).memoizedState,a);if(w&&(f.memoizedState=a,Nt=!0),f=f.queue,Hf(op.bind(null,l,f,t),[t]),f.getSnapshot!==r||w||kt!==null&&kt.memoizedState.tag&1){if(l.flags|=2048,Ti(9,{destroy:void 0},ap.bind(null,l,f,a,r),null),at===null)throw Error(i(349));y||(wr&127)!==0||ip(l,r,a)}return a}function ip(t,r,a){t.flags|=16384,t={getSnapshot:r,value:a},r=Re.updateQueue,r===null?(r=vl(),Re.updateQueue=r,r.stores=[t]):(a=r.stores,a===null?r.stores=[t]:a.push(t))}function ap(t,r,a,l){r.value=a,r.getSnapshot=l,lp(r)&&cp(t)}function op(t,r,a){return a(function(){lp(r)&&cp(t)})}function lp(t){var r=t.getSnapshot;t=t.value;try{var a=r();return!dn(t,a)}catch{return!0}}function cp(t){var r=Us(t,2);r!==null&&cn(r,t,2)}function $f(t){var r=Kt();if(typeof t=="function"){var a=t;if(t=a(),Ks){fn(!0);try{a()}finally{fn(!1)}}}return r.memoizedState=r.baseState=t,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:t},r}function up(t,r,a,l){return t.baseState=a,Uf(t,nt,typeof l=="function"?l:Sr)}function aw(t,r,a,l,f){if(Ol(t))throw Error(i(485));if(t=r.action,t!==null){var y={payload:f,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){y.listeners.push(w)}};H.T!==null?a(!0):y.isTransition=!1,l(y),a=r.pending,a===null?(y.next=r.pending=y,fp(r,y)):(y.next=a.next,r.pending=a.next=y)}}function fp(t,r){var a=r.action,l=r.payload,f=t.state;if(r.isTransition){var y=H.T,w={};H.T=w;try{var O=a(f,l),R=H.S;R!==null&&R(w,O),hp(t,r,O)}catch(V){If(t,r,V)}finally{y!==null&&w.types!==null&&(y.types=w.types),H.T=y}}else try{y=a(f,l),hp(t,r,y)}catch(V){If(t,r,V)}}function hp(t,r,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){dp(t,r,l)},function(l){return If(t,r,l)}):dp(t,r,a)}function dp(t,r,a){r.status="fulfilled",r.value=a,mp(r),t.state=a,r=t.pending,r!==null&&(a=r.next,a===r?t.pending=null:(a=a.next,r.next=a,fp(t,a)))}function If(t,r,a){var l=t.pending;if(t.pending=null,l!==null){l=l.next;do r.status="rejected",r.reason=a,mp(r),r=r.next;while(r!==l)}t.action=null}function mp(t){t=t.listeners;for(var r=0;r<t.length;r++)(0,t[r])()}function pp(t,r){return r}function yp(t,r){if(Ge){var a=at.formState;if(a!==null){e:{var l=Re;if(Ge){if(lt){t:{for(var f=lt,y=qn;f.nodeType!==8;){if(!y){f=null;break t}if(f=Bn(f.nextSibling),f===null){f=null;break t}}y=f.data,f=y==="F!"||y==="F"?f:null}if(f){lt=Bn(f.nextSibling),l=f.data==="F!";break e}}Jr(l)}l=!1}l&&(r=a[0])}}return a=Kt(),a.memoizedState=a.baseState=r,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pp,lastRenderedState:r},a.queue=l,a=Lp.bind(null,Re,l),l.dispatch=a,l=$f(!1),y=Kf.bind(null,Re,!1,l.queue),l=Kt(),f={state:r,dispatch:null,action:t,pending:null},l.queue=f,a=aw.bind(null,Re,f,y,a),f.dispatch=a,l.memoizedState=t,[r,a,!1]}function gp(t){var r=St();return bp(r,nt,t)}function bp(t,r,a){if(r=Uf(t,r,pp)[0],t=wl(Sr)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var l=Pa(r)}catch(w){throw w===Oi?hl:w}else l=r;r=St();var f=r.queue,y=f.dispatch;return a!==r.memoizedState&&(Re.flags|=2048,Ti(9,{destroy:void 0},ow.bind(null,f,a),null)),[l,y,t]}function ow(t,r){t.action=r}function xp(t){var r=St(),a=nt;if(a!==null)return bp(r,a,t);St(),r=r.memoizedState,a=St();var l=a.queue.dispatch;return a.memoizedState=t,[r,l,!1]}function Ti(t,r,a,l){return t={tag:t,create:a,deps:l,inst:r,next:null},r=Re.updateQueue,r===null&&(r=vl(),Re.updateQueue=r),a=r.lastEffect,a===null?r.lastEffect=t.next=t:(l=a.next,a.next=t,t.next=l,r.lastEffect=t),t}function vp(){return St().memoizedState}function Sl(t,r,a,l){var f=Kt();Re.flags|=t,f.memoizedState=Ti(1|r,{destroy:void 0},a,l===void 0?null:l)}function El(t,r,a,l){var f=St();l=l===void 0?null:l;var y=f.memoizedState.inst;nt!==null&&l!==null&&Rf(l,nt.memoizedState.deps)?f.memoizedState=Ti(r,y,a,l):(Re.flags|=t,f.memoizedState=Ti(1|r,y,a,l))}function _p(t,r){Sl(8390656,8,t,r)}function Hf(t,r){El(2048,8,t,r)}function lw(t){Re.flags|=4;var r=Re.updateQueue;if(r===null)r=vl(),Re.updateQueue=r,r.events=[t];else{var a=r.events;a===null?r.events=[t]:a.push(t)}}function wp(t){var r=St().memoizedState;return lw({ref:r,nextImpl:t}),function(){if((Qe&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function Sp(t,r){return El(4,2,t,r)}function Ep(t,r){return El(4,4,t,r)}function Op(t,r){if(typeof r=="function"){t=t();var a=r(t);return function(){typeof a=="function"?a():r(null)}}if(r!=null)return t=t(),r.current=t,function(){r.current=null}}function Ap(t,r,a){a=a!=null?a.concat([t]):null,El(4,4,Op.bind(null,r,t),a)}function Ff(){}function jp(t,r){var a=St();r=r===void 0?null:r;var l=a.memoizedState;return r!==null&&Rf(r,l[1])?l[0]:(a.memoizedState=[t,r],t)}function kp(t,r){var a=St();r=r===void 0?null:r;var l=a.memoizedState;if(r!==null&&Rf(r,l[1]))return l[0];if(l=t(),Ks){fn(!0);try{t()}finally{fn(!1)}}return a.memoizedState=[l,r],l}function Gf(t,r,a){return a===void 0||(wr&1073741824)!==0&&(He&261930)===0?t.memoizedState=r:(t.memoizedState=a,t=Ny(),Re.lanes|=t,ss|=t,a)}function Np(t,r,a,l){return dn(a,r)?a:ji.current!==null?(t=Gf(t,a,l),dn(t,r)||(Nt=!0),t):(wr&42)===0||(wr&1073741824)!==0&&(He&261930)===0?(Nt=!0,t.memoizedState=a):(t=Ny(),Re.lanes|=t,ss|=t,r)}function Tp(t,r,a,l,f){var y=J.p;J.p=y!==0&&8>y?y:8;var w=H.T,O={};H.T=O,Kf(t,!1,r,a);try{var R=f(),V=H.S;if(V!==null&&V(O,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var Z=rw(R,l);Ba(t,r,Z,xn(t))}else Ba(t,r,l,xn(t))}catch(ie){Ba(t,r,{then:function(){},status:"rejected",reason:ie},xn())}finally{J.p=y,w!==null&&O.types!==null&&(w.types=O.types),H.T=w}}function cw(){}function Vf(t,r,a,l){if(t.tag!==5)throw Error(i(476));var f=Cp(t).queue;Tp(t,f,r,ce,a===null?cw:function(){return Mp(t),a(l)})}function Cp(t){var r=t.memoizedState;if(r!==null)return r;r={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:ce},next:null};var a={};return r.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:a},next:null},t.memoizedState=r,t=t.alternate,t!==null&&(t.memoizedState=r),r}function Mp(t){var r=Cp(t);r.next===null&&(r=t.alternate.memoizedState),Ba(t,r.next.queue,{},xn())}function Yf(){return It(to)}function Rp(){return St().memoizedState}function Dp(){return St().memoizedState}function uw(t){for(var r=t.return;r!==null;){switch(r.tag){case 24:case 3:var a=xn();t=Wr(a);var l=Zr(r,t,a);l!==null&&(cn(l,r,a),Ra(l,r,a)),r={cache:wf()},t.payload=r;return}r=r.return}}function fw(t,r,a){var l=xn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ol(t)?qp(r,a):(a=ff(t,r,a,l),a!==null&&(cn(a,t,l),Pp(a,r,l)))}function Lp(t,r,a){var l=xn();Ba(t,r,a,l)}function Ba(t,r,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ol(t))qp(r,f);else{var y=t.alternate;if(t.lanes===0&&(y===null||y.lanes===0)&&(y=r.lastRenderedReducer,y!==null))try{var w=r.lastRenderedState,O=y(w,a);if(f.hasEagerState=!0,f.eagerState=O,dn(O,w))return il(t,r,f,0),at===null&&sl(),!1}catch{}finally{}if(a=ff(t,r,f,l),a!==null)return cn(a,t,l),Pp(a,r,l),!0}return!1}function Kf(t,r,a,l){if(l={lane:2,revertLane:Ah(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ol(t)){if(r)throw Error(i(479))}else r=ff(t,a,l,2),r!==null&&cn(r,t,2)}function Ol(t){var r=t.alternate;return t===Re||r!==null&&r===Re}function qp(t,r){ki=bl=!0;var a=t.pending;a===null?r.next=r:(r.next=a.next,a.next=r),t.pending=r}function Pp(t,r,a){if((a&4194048)!==0){var l=r.lanes;l&=t.pendingLanes,a|=l,r.lanes=a,Rs(t,a)}}var Ua={readContext:It,use:_l,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useLayoutEffect:bt,useInsertionEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useSyncExternalStore:bt,useId:bt,useHostTransitionStatus:bt,useFormState:bt,useActionState:bt,useOptimistic:bt,useMemoCache:bt,useCacheRefresh:bt};Ua.useEffectEvent=bt;var Bp={readContext:It,use:_l,useCallback:function(t,r){return Kt().memoizedState=[t,r===void 0?null:r],t},useContext:It,useEffect:_p,useImperativeHandle:function(t,r,a){a=a!=null?a.concat([t]):null,Sl(4194308,4,Op.bind(null,r,t),a)},useLayoutEffect:function(t,r){return Sl(4194308,4,t,r)},useInsertionEffect:function(t,r){Sl(4,2,t,r)},useMemo:function(t,r){var a=Kt();r=r===void 0?null:r;var l=t();if(Ks){fn(!0);try{t()}finally{fn(!1)}}return a.memoizedState=[l,r],l},useReducer:function(t,r,a){var l=Kt();if(a!==void 0){var f=a(r);if(Ks){fn(!0);try{a(r)}finally{fn(!1)}}}else f=r;return l.memoizedState=l.baseState=f,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:f},l.queue=t,t=t.dispatch=fw.bind(null,Re,t),[l.memoizedState,t]},useRef:function(t){var r=Kt();return t={current:t},r.memoizedState=t},useState:function(t){t=$f(t);var r=t.queue,a=Lp.bind(null,Re,r);return r.dispatch=a,[t.memoizedState,a]},useDebugValue:Ff,useDeferredValue:function(t,r){var a=Kt();return Gf(a,t,r)},useTransition:function(){var t=$f(!1);return t=Tp.bind(null,Re,t.queue,!0,!1),Kt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,r,a){var l=Re,f=Kt();if(Ge){if(a===void 0)throw Error(i(407));a=a()}else{if(a=r(),at===null)throw Error(i(349));(He&127)!==0||ip(l,r,a)}f.memoizedState=a;var y={value:a,getSnapshot:r};return f.queue=y,_p(op.bind(null,l,y,t),[t]),l.flags|=2048,Ti(9,{destroy:void 0},ap.bind(null,l,y,a,r),null),a},useId:function(){var t=Kt(),r=at.identifierPrefix;if(Ge){var a=rr,l=nr;a=(l&~(1<<32-Gt(l)-1)).toString(32)+a,r="_"+r+"R_"+a,a=xl++,0<a&&(r+="H"+a.toString(32)),r+="_"}else a=sw++,r="_"+r+"r_"+a.toString(32)+"_";return t.memoizedState=r},useHostTransitionStatus:Yf,useFormState:yp,useActionState:yp,useOptimistic:function(t){var r=Kt();r.memoizedState=r.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=a,r=Kf.bind(null,Re,!0,a),a.dispatch=r,[t,r]},useMemoCache:Bf,useCacheRefresh:function(){return Kt().memoizedState=uw.bind(null,Re)},useEffectEvent:function(t){var r=Kt(),a={impl:t};return r.memoizedState=a,function(){if((Qe&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Jf={readContext:It,use:_l,useCallback:jp,useContext:It,useEffect:Hf,useImperativeHandle:Ap,useInsertionEffect:Sp,useLayoutEffect:Ep,useMemo:kp,useReducer:wl,useRef:vp,useState:function(){return wl(Sr)},useDebugValue:Ff,useDeferredValue:function(t,r){var a=St();return Np(a,nt.memoizedState,t,r)},useTransition:function(){var t=wl(Sr)[0],r=St().memoizedState;return[typeof t=="boolean"?t:Pa(t),r]},useSyncExternalStore:sp,useId:Rp,useHostTransitionStatus:Yf,useFormState:gp,useActionState:gp,useOptimistic:function(t,r){var a=St();return up(a,nt,t,r)},useMemoCache:Bf,useCacheRefresh:Dp};Jf.useEffectEvent=wp;var Up={readContext:It,use:_l,useCallback:jp,useContext:It,useEffect:Hf,useImperativeHandle:Ap,useInsertionEffect:Sp,useLayoutEffect:Ep,useMemo:kp,useReducer:zf,useRef:vp,useState:function(){return zf(Sr)},useDebugValue:Ff,useDeferredValue:function(t,r){var a=St();return nt===null?Gf(a,t,r):Np(a,nt.memoizedState,t,r)},useTransition:function(){var t=zf(Sr)[0],r=St().memoizedState;return[typeof t=="boolean"?t:Pa(t),r]},useSyncExternalStore:sp,useId:Rp,useHostTransitionStatus:Yf,useFormState:xp,useActionState:xp,useOptimistic:function(t,r){var a=St();return nt!==null?up(a,nt,t,r):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:Bf,useCacheRefresh:Dp};Up.useEffectEvent=wp;function Qf(t,r,a,l){r=t.memoizedState,a=a(l,r),a=a==null?r:b({},r,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var Xf={enqueueSetState:function(t,r,a){t=t._reactInternals;var l=xn(),f=Wr(l);f.payload=r,a!=null&&(f.callback=a),r=Zr(t,f,l),r!==null&&(cn(r,t,l),Ra(r,t,l))},enqueueReplaceState:function(t,r,a){t=t._reactInternals;var l=xn(),f=Wr(l);f.tag=1,f.payload=r,a!=null&&(f.callback=a),r=Zr(t,f,l),r!==null&&(cn(r,t,l),Ra(r,t,l))},enqueueForceUpdate:function(t,r){t=t._reactInternals;var a=xn(),l=Wr(a);l.tag=2,r!=null&&(l.callback=r),r=Zr(t,l,a),r!==null&&(cn(r,t,a),Ra(r,t,a))}};function zp(t,r,a,l,f,y,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(l,y,w):r.prototype&&r.prototype.isPureReactComponent?!Oa(a,l)||!Oa(f,y):!0}function $p(t,r,a,l){t=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(a,l),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(a,l),r.state!==t&&Xf.enqueueReplaceState(r,r.state,null)}function Js(t,r){var a=r;if("ref"in r){a={};for(var l in r)l!=="ref"&&(a[l]=r[l])}if(t=t.defaultProps){a===r&&(a=b({},a));for(var f in t)a[f]===void 0&&(a[f]=t[f])}return a}function Ip(t){rl(t)}function Hp(t){console.error(t)}function Fp(t){rl(t)}function Al(t,r){try{var a=t.onUncaughtError;a(r.value,{componentStack:r.stack})}catch(l){setTimeout(function(){throw l})}}function Gp(t,r,a){try{var l=t.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Wf(t,r,a){return a=Wr(a),a.tag=3,a.payload={element:null},a.callback=function(){Al(t,r)},a}function Vp(t){return t=Wr(t),t.tag=3,t}function Yp(t,r,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var y=l.value;t.payload=function(){return f(y)},t.callback=function(){Gp(r,a,l)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(t.callback=function(){Gp(r,a,l),typeof f!="function"&&(is===null?is=new Set([this]):is.add(this));var O=l.stack;this.componentDidCatch(l.value,{componentStack:O!==null?O:""})})}function hw(t,r,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(r=a.alternate,r!==null&&wi(r,a,f,!0),a=pn.current,a!==null){switch(a.tag){case 31:case 13:return Pn===null?Bl():a.alternate===null&&xt===0&&(xt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===dl?a.flags|=16384:(r=a.updateQueue,r===null?a.updateQueue=new Set([l]):r.add(l),Sh(t,l,f)),!1;case 22:return a.flags|=65536,l===dl?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)),Sh(t,l,f)),!1}throw Error(i(435,a.tag))}return Sh(t,l,f),Bl(),!1}if(Ge)return r=pn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=f,l!==gf&&(t=Error(i(422),{cause:l}),ka(Rn(t,a)))):(l!==gf&&(r=Error(i(423),{cause:l}),ka(Rn(r,a))),t=t.current.alternate,t.flags|=65536,f&=-f,t.lanes|=f,l=Rn(l,a),f=Wf(t.stateNode,l,f),kf(t,f),xt!==4&&(xt=2)),!1;var y=Error(i(520),{cause:l});if(y=Rn(y,a),Ya===null?Ya=[y]:Ya.push(y),xt!==4&&(xt=2),r===null)return!0;l=Rn(l,a),a=r;do{switch(a.tag){case 3:return a.flags|=65536,t=f&-f,a.lanes|=t,t=Wf(a.stateNode,l,t),kf(a,t),!1;case 1:if(r=a.type,y=a.stateNode,(a.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(is===null||!is.has(y))))return a.flags|=65536,f&=-f,a.lanes|=f,f=Vp(f),Yp(f,t,a,l),kf(a,f),!1}a=a.return}while(a!==null);return!1}var Zf=Error(i(461)),Nt=!1;function Ht(t,r,a,l){r.child=t===null?X0(r,null,a,l):Ys(r,t.child,a,l)}function Kp(t,r,a,l,f){a=a.render;var y=r.ref;if("ref"in l){var w={};for(var O in l)O!=="ref"&&(w[O]=l[O])}else w=l;return Hs(r),l=Df(t,r,a,w,y,f),O=Lf(),t!==null&&!Nt?(qf(t,r,f),Er(t,r,f)):(Ge&&O&&pf(r),r.flags|=1,Ht(t,r,l,f),r.child)}function Jp(t,r,a,l,f){if(t===null){var y=a.type;return typeof y=="function"&&!hf(y)&&y.defaultProps===void 0&&a.compare===null?(r.tag=15,r.type=y,Qp(t,r,y,l,f)):(t=ol(a.type,null,l,r,r.mode,f),t.ref=r.ref,t.return=r,r.child=t)}if(y=t.child,!oh(t,f)){var w=y.memoizedProps;if(a=a.compare,a=a!==null?a:Oa,a(w,l)&&t.ref===r.ref)return Er(t,r,f)}return r.flags|=1,t=br(y,l),t.ref=r.ref,t.return=r,r.child=t}function Qp(t,r,a,l,f){if(t!==null){var y=t.memoizedProps;if(Oa(y,l)&&t.ref===r.ref)if(Nt=!1,r.pendingProps=l=y,oh(t,f))(t.flags&131072)!==0&&(Nt=!0);else return r.lanes=t.lanes,Er(t,r,f)}return eh(t,r,a,l,f)}function Xp(t,r,a,l){var f=l.children,y=t!==null?t.memoizedState:null;if(t===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((r.flags&128)!==0){if(y=y!==null?y.baseLanes|a:a,t!==null){for(l=r.child=t.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~y}else l=0,r.child=null;return Wp(t,r,y,a,l)}if((a&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},t!==null&&fl(r,y!==null?y.cachePool:null),y!==null?ep(r,y):Tf(),tp(r);else return l=r.lanes=536870912,Wp(t,r,y!==null?y.baseLanes|a:a,a,l)}else y!==null?(fl(r,y.cachePool),ep(r,y),ts(),r.memoizedState=null):(t!==null&&fl(r,null),Tf(),ts());return Ht(t,r,f,a),r.child}function za(t,r){return t!==null&&t.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Wp(t,r,a,l,f){var y=Ef();return y=y===null?null:{parent:jt._currentValue,pool:y},r.memoizedState={baseLanes:a,cachePool:y},t!==null&&fl(r,null),Tf(),tp(r),t!==null&&wi(t,r,l,!0),r.childLanes=f,null}function jl(t,r){return r=Nl({mode:r.mode,children:r.children},t.mode),r.ref=t.ref,t.child=r,r.return=t,r}function Zp(t,r,a){return Ys(r,t.child,null,a),t=jl(r,r.pendingProps),t.flags|=2,yn(r),r.memoizedState=null,t}function dw(t,r,a){var l=r.pendingProps,f=(r.flags&128)!==0;if(r.flags&=-129,t===null){if(Ge){if(l.mode==="hidden")return t=jl(r,l),r.lanes=536870912,za(null,t);if(Mf(r),(t=lt)?(t=fg(t,qn),t=t!==null&&t.data==="&"?t:null,t!==null&&(r.memoizedState={dehydrated:t,treeContext:Yr!==null?{id:nr,overflow:rr}:null,retryLane:536870912,hydrationErrors:null},a=q0(t),a.return=r,r.child=a,$t=r,lt=null)):t=null,t===null)throw Jr(r);return r.lanes=536870912,null}return jl(r,l)}var y=t.memoizedState;if(y!==null){var w=y.dehydrated;if(Mf(r),f)if(r.flags&256)r.flags&=-257,r=Zp(t,r,a);else if(r.memoizedState!==null)r.child=t.child,r.flags|=128,r=null;else throw Error(i(558));else if(Nt||wi(t,r,a,!1),f=(a&t.childLanes)!==0,Nt||f){if(l=at,l!==null&&(w=Gr(l,a),w!==0&&w!==y.retryLane))throw y.retryLane=w,Us(t,w),cn(l,t,w),Zf;Bl(),r=Zp(t,r,a)}else t=y.treeContext,lt=Bn(w.nextSibling),$t=r,Ge=!0,Kr=null,qn=!1,t!==null&&U0(r,t),r=jl(r,l),r.flags|=4096;return r}return t=br(t.child,{mode:l.mode,children:l.children}),t.ref=r.ref,r.child=t,t.return=r,t}function kl(t,r){var a=r.ref;if(a===null)t!==null&&t.ref!==null&&(r.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(t===null||t.ref!==a)&&(r.flags|=4194816)}}function eh(t,r,a,l,f){return Hs(r),a=Df(t,r,a,l,void 0,f),l=Lf(),t!==null&&!Nt?(qf(t,r,f),Er(t,r,f)):(Ge&&l&&pf(r),r.flags|=1,Ht(t,r,a,f),r.child)}function ey(t,r,a,l,f,y){return Hs(r),r.updateQueue=null,a=rp(r,l,a,f),np(t),l=Lf(),t!==null&&!Nt?(qf(t,r,y),Er(t,r,y)):(Ge&&l&&pf(r),r.flags|=1,Ht(t,r,a,y),r.child)}function ty(t,r,a,l,f){if(Hs(r),r.stateNode===null){var y=bi,w=a.contextType;typeof w=="object"&&w!==null&&(y=It(w)),y=new a(l,y),r.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Xf,r.stateNode=y,y._reactInternals=r,y=r.stateNode,y.props=l,y.state=r.memoizedState,y.refs={},Af(r),w=a.contextType,y.context=typeof w=="object"&&w!==null?It(w):bi,y.state=r.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(Qf(r,a,w,l),y.state=r.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(w=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),w!==y.state&&Xf.enqueueReplaceState(y,y.state,null),La(r,l,y,f),Da(),y.state=r.memoizedState),typeof y.componentDidMount=="function"&&(r.flags|=4194308),l=!0}else if(t===null){y=r.stateNode;var O=r.memoizedProps,R=Js(a,O);y.props=R;var V=y.context,Z=a.contextType;w=bi,typeof Z=="object"&&Z!==null&&(w=It(Z));var ie=a.getDerivedStateFromProps;Z=typeof ie=="function"||typeof y.getSnapshotBeforeUpdate=="function",O=r.pendingProps!==O,Z||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(O||V!==w)&&$p(r,y,l,w),Xr=!1;var Y=r.memoizedState;y.state=Y,La(r,l,y,f),Da(),V=r.memoizedState,O||Y!==V||Xr?(typeof ie=="function"&&(Qf(r,a,ie,l),V=r.memoizedState),(R=Xr||zp(r,a,R,l,Y,V,w))?(Z||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(r.flags|=4194308)):(typeof y.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=l,r.memoizedState=V),y.props=l,y.state=V,y.context=w,l=R):(typeof y.componentDidMount=="function"&&(r.flags|=4194308),l=!1)}else{y=r.stateNode,jf(t,r),w=r.memoizedProps,Z=Js(a,w),y.props=Z,ie=r.pendingProps,Y=y.context,V=a.contextType,R=bi,typeof V=="object"&&V!==null&&(R=It(V)),O=a.getDerivedStateFromProps,(V=typeof O=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(w!==ie||Y!==R)&&$p(r,y,l,R),Xr=!1,Y=r.memoizedState,y.state=Y,La(r,l,y,f),Da();var X=r.memoizedState;w!==ie||Y!==X||Xr||t!==null&&t.dependencies!==null&&cl(t.dependencies)?(typeof O=="function"&&(Qf(r,a,O,l),X=r.memoizedState),(Z=Xr||zp(r,a,Z,l,Y,X,R)||t!==null&&t.dependencies!==null&&cl(t.dependencies))?(V||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(l,X,R),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(l,X,R)),typeof y.componentDidUpdate=="function"&&(r.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof y.componentDidUpdate!="function"||w===t.memoizedProps&&Y===t.memoizedState||(r.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&Y===t.memoizedState||(r.flags|=1024),r.memoizedProps=l,r.memoizedState=X),y.props=l,y.state=X,y.context=R,l=Z):(typeof y.componentDidUpdate!="function"||w===t.memoizedProps&&Y===t.memoizedState||(r.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&Y===t.memoizedState||(r.flags|=1024),l=!1)}return y=l,kl(t,r),l=(r.flags&128)!==0,y||l?(y=r.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:y.render(),r.flags|=1,t!==null&&l?(r.child=Ys(r,t.child,null,f),r.child=Ys(r,null,a,f)):Ht(t,r,a,f),r.memoizedState=y.state,t=r.child):t=Er(t,r,f),t}function ny(t,r,a,l){return $s(),r.flags|=256,Ht(t,r,a,l),r.child}var th={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function nh(t){return{baseLanes:t,cachePool:G0()}}function rh(t,r,a){return t=t!==null?t.childLanes&~a:0,r&&(t|=bn),t}function ry(t,r,a){var l=r.pendingProps,f=!1,y=(r.flags&128)!==0,w;if((w=y)||(w=t!==null&&t.memoizedState===null?!1:(wt.current&2)!==0),w&&(f=!0,r.flags&=-129),w=(r.flags&32)!==0,r.flags&=-33,t===null){if(Ge){if(f?es(r):ts(),(t=lt)?(t=fg(t,qn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(r.memoizedState={dehydrated:t,treeContext:Yr!==null?{id:nr,overflow:rr}:null,retryLane:536870912,hydrationErrors:null},a=q0(t),a.return=r,r.child=a,$t=r,lt=null)):t=null,t===null)throw Jr(r);return Uh(t)?r.lanes=32:r.lanes=536870912,null}var O=l.children;return l=l.fallback,f?(ts(),f=r.mode,O=Nl({mode:"hidden",children:O},f),l=zs(l,f,a,null),O.return=r,l.return=r,O.sibling=l,r.child=O,l=r.child,l.memoizedState=nh(a),l.childLanes=rh(t,w,a),r.memoizedState=th,za(null,l)):(es(r),sh(r,O))}var R=t.memoizedState;if(R!==null&&(O=R.dehydrated,O!==null)){if(y)r.flags&256?(es(r),r.flags&=-257,r=ih(t,r,a)):r.memoizedState!==null?(ts(),r.child=t.child,r.flags|=128,r=null):(ts(),O=l.fallback,f=r.mode,l=Nl({mode:"visible",children:l.children},f),O=zs(O,f,a,null),O.flags|=2,l.return=r,O.return=r,l.sibling=O,r.child=l,Ys(r,t.child,null,a),l=r.child,l.memoizedState=nh(a),l.childLanes=rh(t,w,a),r.memoizedState=th,r=za(null,l));else if(es(r),Uh(O)){if(w=O.nextSibling&&O.nextSibling.dataset,w)var V=w.dgst;w=V,l=Error(i(419)),l.stack="",l.digest=w,ka({value:l,source:null,stack:null}),r=ih(t,r,a)}else if(Nt||wi(t,r,a,!1),w=(a&t.childLanes)!==0,Nt||w){if(w=at,w!==null&&(l=Gr(w,a),l!==0&&l!==R.retryLane))throw R.retryLane=l,Us(t,l),cn(w,t,l),Zf;Bh(O)||Bl(),r=ih(t,r,a)}else Bh(O)?(r.flags|=192,r.child=t.child,r=null):(t=R.treeContext,lt=Bn(O.nextSibling),$t=r,Ge=!0,Kr=null,qn=!1,t!==null&&U0(r,t),r=sh(r,l.children),r.flags|=4096);return r}return f?(ts(),O=l.fallback,f=r.mode,R=t.child,V=R.sibling,l=br(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,V!==null?O=br(V,O):(O=zs(O,f,a,null),O.flags|=2),O.return=r,l.return=r,l.sibling=O,r.child=l,za(null,l),l=r.child,O=t.child.memoizedState,O===null?O=nh(a):(f=O.cachePool,f!==null?(R=jt._currentValue,f=f.parent!==R?{parent:R,pool:R}:f):f=G0(),O={baseLanes:O.baseLanes|a,cachePool:f}),l.memoizedState=O,l.childLanes=rh(t,w,a),r.memoizedState=th,za(t.child,l)):(es(r),a=t.child,t=a.sibling,a=br(a,{mode:"visible",children:l.children}),a.return=r,a.sibling=null,t!==null&&(w=r.deletions,w===null?(r.deletions=[t],r.flags|=16):w.push(t)),r.child=a,r.memoizedState=null,a)}function sh(t,r){return r=Nl({mode:"visible",children:r},t.mode),r.return=t,t.child=r}function Nl(t,r){return t=mn(22,t,null,r),t.lanes=0,t}function ih(t,r,a){return Ys(r,t.child,null,a),t=sh(r,r.pendingProps.children),t.flags|=2,r.memoizedState=null,t}function sy(t,r,a){t.lanes|=r;var l=t.alternate;l!==null&&(l.lanes|=r),vf(t.return,r,a)}function ah(t,r,a,l,f,y){var w=t.memoizedState;w===null?t.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:y}:(w.isBackwards=r,w.rendering=null,w.renderingStartTime=0,w.last=l,w.tail=a,w.tailMode=f,w.treeForkCount=y)}function iy(t,r,a){var l=r.pendingProps,f=l.revealOrder,y=l.tail;l=l.children;var w=wt.current,O=(w&2)!==0;if(O?(w=w&1|2,r.flags|=128):w&=1,Me(wt,w),Ht(t,r,l,a),l=Ge?ja:0,!O&&t!==null&&(t.flags&128)!==0)e:for(t=r.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&sy(t,a,r);else if(t.tag===19)sy(t,a,r);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===r)break e;for(;t.sibling===null;){if(t.return===null||t.return===r)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(f){case"forwards":for(a=r.child,f=null;a!==null;)t=a.alternate,t!==null&&gl(t)===null&&(f=a),a=a.sibling;a=f,a===null?(f=r.child,r.child=null):(f=a.sibling,a.sibling=null),ah(r,!1,f,a,y,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=r.child,r.child=null;f!==null;){if(t=f.alternate,t!==null&&gl(t)===null){r.child=f;break}t=f.sibling,f.sibling=a,a=f,f=t}ah(r,!0,a,null,y,l);break;case"together":ah(r,!1,null,null,void 0,l);break;default:r.memoizedState=null}return r.child}function Er(t,r,a){if(t!==null&&(r.dependencies=t.dependencies),ss|=r.lanes,(a&r.childLanes)===0)if(t!==null){if(wi(t,r,a,!1),(a&r.childLanes)===0)return null}else return null;if(t!==null&&r.child!==t.child)throw Error(i(153));if(r.child!==null){for(t=r.child,a=br(t,t.pendingProps),r.child=a,a.return=r;t.sibling!==null;)t=t.sibling,a=a.sibling=br(t,t.pendingProps),a.return=r;a.sibling=null}return r.child}function oh(t,r){return(t.lanes&r)!==0?!0:(t=t.dependencies,!!(t!==null&&cl(t)))}function mw(t,r,a){switch(r.tag){case 3:_e(r,r.stateNode.containerInfo),Qr(r,jt,t.memoizedState.cache),$s();break;case 27:case 5:Be(r);break;case 4:_e(r,r.stateNode.containerInfo);break;case 10:Qr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Mf(r),null;break;case 13:var l=r.memoizedState;if(l!==null)return l.dehydrated!==null?(es(r),r.flags|=128,null):(a&r.child.childLanes)!==0?ry(t,r,a):(es(r),t=Er(t,r,a),t!==null?t.sibling:null);es(r);break;case 19:var f=(t.flags&128)!==0;if(l=(a&r.childLanes)!==0,l||(wi(t,r,a,!1),l=(a&r.childLanes)!==0),f){if(l)return iy(t,r,a);r.flags|=128}if(f=r.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Me(wt,wt.current),l)break;return null;case 22:return r.lanes=0,Xp(t,r,a,r.pendingProps);case 24:Qr(r,jt,t.memoizedState.cache)}return Er(t,r,a)}function ay(t,r,a){if(t!==null)if(t.memoizedProps!==r.pendingProps)Nt=!0;else{if(!oh(t,a)&&(r.flags&128)===0)return Nt=!1,mw(t,r,a);Nt=(t.flags&131072)!==0}else Nt=!1,Ge&&(r.flags&1048576)!==0&&B0(r,ja,r.index);switch(r.lanes=0,r.tag){case 16:e:{var l=r.pendingProps;if(t=Gs(r.elementType),r.type=t,typeof t=="function")hf(t)?(l=Js(t,l),r.tag=1,r=ty(null,r,t,l,a)):(r.tag=0,r=eh(null,r,t,l,a));else{if(t!=null){var f=t.$$typeof;if(f===te){r.tag=11,r=Kp(null,r,t,l,a);break e}else if(f===ae){r.tag=14,r=Jp(null,r,t,l,a);break e}}throw r=Ee(t)||t,Error(i(306,r,""))}}return r;case 0:return eh(t,r,r.type,r.pendingProps,a);case 1:return l=r.type,f=Js(l,r.pendingProps),ty(t,r,l,f,a);case 3:e:{if(_e(r,r.stateNode.containerInfo),t===null)throw Error(i(387));l=r.pendingProps;var y=r.memoizedState;f=y.element,jf(t,r),La(r,l,null,a);var w=r.memoizedState;if(l=w.cache,Qr(r,jt,l),l!==y.cache&&_f(r,[jt],a,!0),Da(),l=w.element,y.isDehydrated)if(y={element:l,isDehydrated:!1,cache:w.cache},r.updateQueue.baseState=y,r.memoizedState=y,r.flags&256){r=ny(t,r,l,a);break e}else if(l!==f){f=Rn(Error(i(424)),r),ka(f),r=ny(t,r,l,a);break e}else{switch(t=r.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(lt=Bn(t.firstChild),$t=r,Ge=!0,Kr=null,qn=!0,a=X0(r,null,l,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if($s(),l===f){r=Er(t,r,a);break e}Ht(t,r,l,a)}r=r.child}return r;case 26:return kl(t,r),t===null?(a=gg(r.type,null,r.pendingProps,null))?r.memoizedState=a:Ge||(a=r.type,t=r.pendingProps,l=Gl(Ot.current).createElement(a),l[it]=r,l[gt]=t,Ft(l,a,t),L(l),r.stateNode=l):r.memoizedState=gg(r.type,t.memoizedProps,r.pendingProps,t.memoizedState),null;case 27:return Be(r),t===null&&Ge&&(l=r.stateNode=mg(r.type,r.pendingProps,Ot.current),$t=r,qn=!0,f=lt,cs(r.type)?(zh=f,lt=Bn(l.firstChild)):lt=f),Ht(t,r,r.pendingProps.children,a),kl(t,r),t===null&&(r.flags|=4194304),r.child;case 5:return t===null&&Ge&&((f=l=lt)&&(l=Fw(l,r.type,r.pendingProps,qn),l!==null?(r.stateNode=l,$t=r,lt=Bn(l.firstChild),qn=!1,f=!0):f=!1),f||Jr(r)),Be(r),f=r.type,y=r.pendingProps,w=t!==null?t.memoizedProps:null,l=y.children,Lh(f,y)?l=null:w!==null&&Lh(f,w)&&(r.flags|=32),r.memoizedState!==null&&(f=Df(t,r,iw,null,null,a),to._currentValue=f),kl(t,r),Ht(t,r,l,a),r.child;case 6:return t===null&&Ge&&((t=a=lt)&&(a=Gw(a,r.pendingProps,qn),a!==null?(r.stateNode=a,$t=r,lt=null,t=!0):t=!1),t||Jr(r)),null;case 13:return ry(t,r,a);case 4:return _e(r,r.stateNode.containerInfo),l=r.pendingProps,t===null?r.child=Ys(r,null,l,a):Ht(t,r,l,a),r.child;case 11:return Kp(t,r,r.type,r.pendingProps,a);case 7:return Ht(t,r,r.pendingProps,a),r.child;case 8:return Ht(t,r,r.pendingProps.children,a),r.child;case 12:return Ht(t,r,r.pendingProps.children,a),r.child;case 10:return l=r.pendingProps,Qr(r,r.type,l.value),Ht(t,r,l.children,a),r.child;case 9:return f=r.type._context,l=r.pendingProps.children,Hs(r),f=It(f),l=l(f),r.flags|=1,Ht(t,r,l,a),r.child;case 14:return Jp(t,r,r.type,r.pendingProps,a);case 15:return Qp(t,r,r.type,r.pendingProps,a);case 19:return iy(t,r,a);case 31:return dw(t,r,a);case 22:return Xp(t,r,a,r.pendingProps);case 24:return Hs(r),l=It(jt),t===null?(f=Ef(),f===null&&(f=at,y=wf(),f.pooledCache=y,y.refCount++,y!==null&&(f.pooledCacheLanes|=a),f=y),r.memoizedState={parent:l,cache:f},Af(r),Qr(r,jt,f)):((t.lanes&a)!==0&&(jf(t,r),La(r,null,null,a),Da()),f=t.memoizedState,y=r.memoizedState,f.parent!==l?(f={parent:l,cache:l},r.memoizedState=f,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=f),Qr(r,jt,l)):(l=y.cache,Qr(r,jt,l),l!==f.cache&&_f(r,[jt],a,!0))),Ht(t,r,r.pendingProps.children,a),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function Or(t){t.flags|=4}function lh(t,r,a,l,f){if((r=(t.mode&32)!==0)&&(r=!1),r){if(t.flags|=16777216,(f&335544128)===f)if(t.stateNode.complete)t.flags|=8192;else if(Ry())t.flags|=8192;else throw Vs=dl,Of}else t.flags&=-16777217}function oy(t,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!wg(r))if(Ry())t.flags|=8192;else throw Vs=dl,Of}function Tl(t,r){r!==null&&(t.flags|=4),t.flags&16384&&(r=t.tag!==22?li():536870912,t.lanes|=r,Di|=r)}function $a(t,r){if(!Ge)switch(t.tailMode){case"hidden":r=t.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?r||t.tail===null?t.tail=null:t.tail.sibling=null:l.sibling=null}}function ct(t){var r=t.alternate!==null&&t.alternate.child===t.child,a=0,l=0;if(r)for(var f=t.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=t,f=f.sibling;else for(f=t.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=t,f=f.sibling;return t.subtreeFlags|=l,t.childLanes=a,r}function pw(t,r,a){var l=r.pendingProps;switch(yf(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(r),null;case 1:return ct(r),null;case 3:return a=r.stateNode,l=null,t!==null&&(l=t.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),_r(jt),oe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(_i(r)?Or(r):t===null||t.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,bf())),ct(r),null;case 26:var f=r.type,y=r.memoizedState;return t===null?(Or(r),y!==null?(ct(r),oy(r,y)):(ct(r),lh(r,f,null,l,a))):y?y!==t.memoizedState?(Or(r),ct(r),oy(r,y)):(ct(r),r.flags&=-16777217):(t=t.memoizedProps,t!==l&&Or(r),ct(r),lh(r,f,t,l,a)),null;case 27:if(zt(r),a=Ot.current,f=r.type,t!==null&&r.stateNode!=null)t.memoizedProps!==l&&Or(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return ct(r),null}t=Xe.current,_i(r)?z0(r):(t=mg(f,l,a),r.stateNode=t,Or(r))}return ct(r),null;case 5:if(zt(r),f=r.type,t!==null&&r.stateNode!=null)t.memoizedProps!==l&&Or(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return ct(r),null}if(y=Xe.current,_i(r))z0(r);else{var w=Gl(Ot.current);switch(y){case 1:y=w.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:y=w.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":y=w.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":y=w.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":y=w.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof l.is=="string"?w.createElement("select",{is:l.is}):w.createElement("select"),l.multiple?y.multiple=!0:l.size&&(y.size=l.size);break;default:y=typeof l.is=="string"?w.createElement(f,{is:l.is}):w.createElement(f)}}y[it]=r,y[gt]=l;e:for(w=r.child;w!==null;){if(w.tag===5||w.tag===6)y.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=y;e:switch(Ft(y,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Or(r)}}return ct(r),lh(r,r.type,t===null?null:t.memoizedProps,r.pendingProps,a),null;case 6:if(t&&r.stateNode!=null)t.memoizedProps!==l&&Or(r);else{if(typeof l!="string"&&r.stateNode===null)throw Error(i(166));if(t=Ot.current,_i(r)){if(t=r.stateNode,a=r.memoizedProps,l=null,f=$t,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}t[it]=r,t=!!(t.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||rg(t.nodeValue,a)),t||Jr(r,!0)}else t=Gl(t).createTextNode(l),t[it]=r,r.stateNode=t}return ct(r),null;case 31:if(a=r.memoizedState,t===null||t.memoizedState!==null){if(l=_i(r),a!==null){if(t===null){if(!l)throw Error(i(318));if(t=r.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[it]=r}else $s(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ct(r),t=!1}else a=bf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return r.flags&256?(yn(r),r):(yn(r),null);if((r.flags&128)!==0)throw Error(i(558))}return ct(r),null;case 13:if(l=r.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(f=_i(r),l!==null&&l.dehydrated!==null){if(t===null){if(!f)throw Error(i(318));if(f=r.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[it]=r}else $s(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ct(r),f=!1}else f=bf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=f),f=!0;if(!f)return r.flags&256?(yn(r),r):(yn(r),null)}return yn(r),(r.flags&128)!==0?(r.lanes=a,r):(a=l!==null,t=t!==null&&t.memoizedState!==null,a&&(l=r.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),y=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(y=l.memoizedState.cachePool.pool),y!==f&&(l.flags|=2048)),a!==t&&a&&(r.child.flags|=8192),Tl(r,r.updateQueue),ct(r),null);case 4:return oe(),t===null&&Th(r.stateNode.containerInfo),ct(r),null;case 10:return _r(r.type),ct(r),null;case 19:if(Ne(wt),l=r.memoizedState,l===null)return ct(r),null;if(f=(r.flags&128)!==0,y=l.rendering,y===null)if(f)$a(l,!1);else{if(xt!==0||t!==null&&(t.flags&128)!==0)for(t=r.child;t!==null;){if(y=gl(t),y!==null){for(r.flags|=128,$a(l,!1),t=y.updateQueue,r.updateQueue=t,Tl(r,t),r.subtreeFlags=0,t=a,a=r.child;a!==null;)L0(a,t),a=a.sibling;return Me(wt,wt.current&1|2),Ge&&xr(r,l.treeForkCount),r.child}t=t.sibling}l.tail!==null&&ut()>Ll&&(r.flags|=128,f=!0,$a(l,!1),r.lanes=4194304)}else{if(!f)if(t=gl(y),t!==null){if(r.flags|=128,f=!0,t=t.updateQueue,r.updateQueue=t,Tl(r,t),$a(l,!0),l.tail===null&&l.tailMode==="hidden"&&!y.alternate&&!Ge)return ct(r),null}else 2*ut()-l.renderingStartTime>Ll&&a!==536870912&&(r.flags|=128,f=!0,$a(l,!1),r.lanes=4194304);l.isBackwards?(y.sibling=r.child,r.child=y):(t=l.last,t!==null?t.sibling=y:r.child=y,l.last=y)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=ut(),t.sibling=null,a=wt.current,Me(wt,f?a&1|2:a&1),Ge&&xr(r,l.treeForkCount),t):(ct(r),null);case 22:case 23:return yn(r),Cf(),l=r.memoizedState!==null,t!==null?t.memoizedState!==null!==l&&(r.flags|=8192):l&&(r.flags|=8192),l?(a&536870912)!==0&&(r.flags&128)===0&&(ct(r),r.subtreeFlags&6&&(r.flags|=8192)):ct(r),a=r.updateQueue,a!==null&&Tl(r,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),l=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),l!==a&&(r.flags|=2048),t!==null&&Ne(Fs),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),_r(jt),ct(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function yw(t,r){switch(yf(r),r.tag){case 1:return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 3:return _r(jt),oe(),t=r.flags,(t&65536)!==0&&(t&128)===0?(r.flags=t&-65537|128,r):null;case 26:case 27:case 5:return zt(r),null;case 31:if(r.memoizedState!==null){if(yn(r),r.alternate===null)throw Error(i(340));$s()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 13:if(yn(r),t=r.memoizedState,t!==null&&t.dehydrated!==null){if(r.alternate===null)throw Error(i(340));$s()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 19:return Ne(wt),null;case 4:return oe(),null;case 10:return _r(r.type),null;case 22:case 23:return yn(r),Cf(),t!==null&&Ne(Fs),t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 24:return _r(jt),null;case 25:return null;default:return null}}function ly(t,r){switch(yf(r),r.tag){case 3:_r(jt),oe();break;case 26:case 27:case 5:zt(r);break;case 4:oe();break;case 31:r.memoizedState!==null&&yn(r);break;case 13:yn(r);break;case 19:Ne(wt);break;case 10:_r(r.type);break;case 22:case 23:yn(r),Cf(),t!==null&&Ne(Fs);break;case 24:_r(jt)}}function Ia(t,r){try{var a=r.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&t)===t){l=void 0;var y=a.create,w=a.inst;l=y(),w.destroy=l}a=a.next}while(a!==f)}}catch(O){Ze(r,r.return,O)}}function ns(t,r,a){try{var l=r.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var y=f.next;l=y;do{if((l.tag&t)===t){var w=l.inst,O=w.destroy;if(O!==void 0){w.destroy=void 0,f=r;var R=a,V=O;try{V()}catch(Z){Ze(f,R,Z)}}}l=l.next}while(l!==y)}}catch(Z){Ze(r,r.return,Z)}}function cy(t){var r=t.updateQueue;if(r!==null){var a=t.stateNode;try{Z0(r,a)}catch(l){Ze(t,t.return,l)}}}function uy(t,r,a){a.props=Js(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(l){Ze(t,r,l)}}function Ha(t,r){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var l=t.stateNode;break;case 30:l=t.stateNode;break;default:l=t.stateNode}typeof a=="function"?t.refCleanup=a(l):a.current=l}}catch(f){Ze(t,r,f)}}function sr(t,r){var a=t.ref,l=t.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){Ze(t,r,f)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){Ze(t,r,f)}else a.current=null}function fy(t){var r=t.type,a=t.memoizedProps,l=t.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(f){Ze(t,t.return,f)}}function ch(t,r,a){try{var l=t.stateNode;Bw(l,t.type,a,r),l[gt]=r}catch(f){Ze(t,t.return,f)}}function hy(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&cs(t.type)||t.tag===4}function uh(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||hy(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&cs(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function fh(t,r,a){var l=t.tag;if(l===5||l===6)t=t.stateNode,r?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,r):(r=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,r.appendChild(t),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=yr));else if(l!==4&&(l===27&&cs(t.type)&&(a=t.stateNode,r=null),t=t.child,t!==null))for(fh(t,r,a),t=t.sibling;t!==null;)fh(t,r,a),t=t.sibling}function Cl(t,r,a){var l=t.tag;if(l===5||l===6)t=t.stateNode,r?a.insertBefore(t,r):a.appendChild(t);else if(l!==4&&(l===27&&cs(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Cl(t,r,a),t=t.sibling;t!==null;)Cl(t,r,a),t=t.sibling}function dy(t){var r=t.stateNode,a=t.memoizedProps;try{for(var l=t.type,f=r.attributes;f.length;)r.removeAttributeNode(f[0]);Ft(r,l,a),r[it]=t,r[gt]=a}catch(y){Ze(t,t.return,y)}}var Ar=!1,Tt=!1,hh=!1,my=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function gw(t,r){if(t=t.containerInfo,Rh=Wl,t=A0(t),sf(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,y=l.focusNode;l=l.focusOffset;try{a.nodeType,y.nodeType}catch{a=null;break e}var w=0,O=-1,R=-1,V=0,Z=0,ie=t,Y=null;t:for(;;){for(var X;ie!==a||f!==0&&ie.nodeType!==3||(O=w+f),ie!==y||l!==0&&ie.nodeType!==3||(R=w+l),ie.nodeType===3&&(w+=ie.nodeValue.length),(X=ie.firstChild)!==null;)Y=ie,ie=X;for(;;){if(ie===t)break t;if(Y===a&&++V===f&&(O=w),Y===y&&++Z===l&&(R=w),(X=ie.nextSibling)!==null)break;ie=Y,Y=ie.parentNode}ie=X}a=O===-1||R===-1?null:{start:O,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Dh={focusedElem:t,selectionRange:a},Wl=!1,Pt=r;Pt!==null;)if(r=Pt,t=r.child,(r.subtreeFlags&1028)!==0&&t!==null)t.return=r,Pt=t;else for(;Pt!==null;){switch(r=Pt,y=r.alternate,t=r.flags,r.tag){case 0:if((t&4)!==0&&(t=r.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)f=t[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&y!==null){t=void 0,a=r,f=y.memoizedProps,y=y.memoizedState,l=a.stateNode;try{var ve=Js(a.type,f);t=l.getSnapshotBeforeUpdate(ve,y),l.__reactInternalSnapshotBeforeUpdate=t}catch(Te){Ze(a,a.return,Te)}}break;case 3:if((t&1024)!==0){if(t=r.stateNode.containerInfo,a=t.nodeType,a===9)Ph(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Ph(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(i(163))}if(t=r.sibling,t!==null){t.return=r.return,Pt=t;break}Pt=r.return}}function py(t,r,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:kr(t,a),l&4&&Ia(5,a);break;case 1:if(kr(t,a),l&4)if(t=a.stateNode,r===null)try{t.componentDidMount()}catch(w){Ze(a,a.return,w)}else{var f=Js(a.type,r.memoizedProps);r=r.memoizedState;try{t.componentDidUpdate(f,r,t.__reactInternalSnapshotBeforeUpdate)}catch(w){Ze(a,a.return,w)}}l&64&&cy(a),l&512&&Ha(a,a.return);break;case 3:if(kr(t,a),l&64&&(t=a.updateQueue,t!==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{Z0(t,r)}catch(w){Ze(a,a.return,w)}}break;case 27:r===null&&l&4&&dy(a);case 26:case 5:kr(t,a),r===null&&l&4&&fy(a),l&512&&Ha(a,a.return);break;case 12:kr(t,a);break;case 31:kr(t,a),l&4&&by(t,a);break;case 13:kr(t,a),l&4&&xy(t,a),l&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=Aw.bind(null,a),Vw(t,a))));break;case 22:if(l=a.memoizedState!==null||Ar,!l){r=r!==null&&r.memoizedState!==null||Tt,f=Ar;var y=Tt;Ar=l,(Tt=r)&&!y?Nr(t,a,(a.subtreeFlags&8772)!==0):kr(t,a),Ar=f,Tt=y}break;case 30:break;default:kr(t,a)}}function yy(t){var r=t.alternate;r!==null&&(t.alternate=null,yy(r)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(r=t.stateNode,r!==null&&ci(r)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var ft=null,sn=!1;function jr(t,r,a){for(a=a.child;a!==null;)gy(t,r,a),a=a.sibling}function gy(t,r,a){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(Ts,a)}catch{}switch(a.tag){case 26:Tt||sr(a,r),jr(t,r,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Tt||sr(a,r);var l=ft,f=sn;cs(a.type)&&(ft=a.stateNode,sn=!1),jr(t,r,a),Wa(a.stateNode),ft=l,sn=f;break;case 5:Tt||sr(a,r);case 6:if(l=ft,f=sn,ft=null,jr(t,r,a),ft=l,sn=f,ft!==null)if(sn)try{(ft.nodeType===9?ft.body:ft.nodeName==="HTML"?ft.ownerDocument.body:ft).removeChild(a.stateNode)}catch(y){Ze(a,r,y)}else try{ft.removeChild(a.stateNode)}catch(y){Ze(a,r,y)}break;case 18:ft!==null&&(sn?(t=ft,cg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),Ii(t)):cg(ft,a.stateNode));break;case 4:l=ft,f=sn,ft=a.stateNode.containerInfo,sn=!0,jr(t,r,a),ft=l,sn=f;break;case 0:case 11:case 14:case 15:ns(2,a,r),Tt||ns(4,a,r),jr(t,r,a);break;case 1:Tt||(sr(a,r),l=a.stateNode,typeof l.componentWillUnmount=="function"&&uy(a,r,l)),jr(t,r,a);break;case 21:jr(t,r,a);break;case 22:Tt=(l=Tt)||a.memoizedState!==null,jr(t,r,a),Tt=l;break;default:jr(t,r,a)}}function by(t,r){if(r.memoizedState===null&&(t=r.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Ii(t)}catch(a){Ze(r,r.return,a)}}}function xy(t,r){if(r.memoizedState===null&&(t=r.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Ii(t)}catch(a){Ze(r,r.return,a)}}function bw(t){switch(t.tag){case 31:case 13:case 19:var r=t.stateNode;return r===null&&(r=t.stateNode=new my),r;case 22:return t=t.stateNode,r=t._retryCache,r===null&&(r=t._retryCache=new my),r;default:throw Error(i(435,t.tag))}}function Ml(t,r){var a=bw(t);r.forEach(function(l){if(!a.has(l)){a.add(l);var f=jw.bind(null,t,l);l.then(f,f)}})}function an(t,r){var a=r.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],y=t,w=r,O=w;e:for(;O!==null;){switch(O.tag){case 27:if(cs(O.type)){ft=O.stateNode,sn=!1;break e}break;case 5:ft=O.stateNode,sn=!1;break e;case 3:case 4:ft=O.stateNode.containerInfo,sn=!0;break e}O=O.return}if(ft===null)throw Error(i(160));gy(y,w,f),ft=null,sn=!1,y=f.alternate,y!==null&&(y.return=null),f.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)vy(r,t),r=r.sibling}var Kn=null;function vy(t,r){var a=t.alternate,l=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:an(r,t),on(t),l&4&&(ns(3,t,t.return),Ia(3,t),ns(5,t,t.return));break;case 1:an(r,t),on(t),l&512&&(Tt||a===null||sr(a,a.return)),l&64&&Ar&&(t=t.updateQueue,t!==null&&(l=t.callbacks,l!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=Kn;if(an(r,t),on(t),l&512&&(Tt||a===null||sr(a,a.return)),l&4){var y=a!==null?a.memoizedState:null;if(l=t.memoizedState,a===null)if(l===null)if(t.stateNode===null){e:{l=t.type,a=t.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":y=f.getElementsByTagName("title")[0],(!y||y[Rt]||y[it]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=f.createElement(l),f.head.insertBefore(y,f.querySelector("head > title"))),Ft(y,l,a),y[it]=t,L(y),l=y;break e;case"link":var w=vg("link","href",f).get(l+(a.href||""));if(w){for(var O=0;O<w.length;O++)if(y=w[O],y.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&y.getAttribute("rel")===(a.rel==null?null:a.rel)&&y.getAttribute("title")===(a.title==null?null:a.title)&&y.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(O,1);break t}}y=f.createElement(l),Ft(y,l,a),f.head.appendChild(y);break;case"meta":if(w=vg("meta","content",f).get(l+(a.content||""))){for(O=0;O<w.length;O++)if(y=w[O],y.getAttribute("content")===(a.content==null?null:""+a.content)&&y.getAttribute("name")===(a.name==null?null:a.name)&&y.getAttribute("property")===(a.property==null?null:a.property)&&y.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&y.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(O,1);break t}}y=f.createElement(l),Ft(y,l,a),f.head.appendChild(y);break;default:throw Error(i(468,l))}y[it]=t,L(y),l=y}t.stateNode=l}else _g(f,t.type,t.stateNode);else t.stateNode=xg(f,l,t.memoizedProps);else y!==l?(y===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):y.count--,l===null?_g(f,t.type,t.stateNode):xg(f,l,t.memoizedProps)):l===null&&t.stateNode!==null&&ch(t,t.memoizedProps,a.memoizedProps)}break;case 27:an(r,t),on(t),l&512&&(Tt||a===null||sr(a,a.return)),a!==null&&l&4&&ch(t,t.memoizedProps,a.memoizedProps);break;case 5:if(an(r,t),on(t),l&512&&(Tt||a===null||sr(a,a.return)),t.flags&32){f=t.stateNode;try{fi(f,"")}catch(ve){Ze(t,t.return,ve)}}l&4&&t.stateNode!=null&&(f=t.memoizedProps,ch(t,f,a!==null?a.memoizedProps:f)),l&1024&&(hh=!0);break;case 6:if(an(r,t),on(t),l&4){if(t.stateNode===null)throw Error(i(162));l=t.memoizedProps,a=t.stateNode;try{a.nodeValue=l}catch(ve){Ze(t,t.return,ve)}}break;case 3:if(Kl=null,f=Kn,Kn=Vl(r.containerInfo),an(r,t),Kn=f,on(t),l&4&&a!==null&&a.memoizedState.isDehydrated)try{Ii(r.containerInfo)}catch(ve){Ze(t,t.return,ve)}hh&&(hh=!1,_y(t));break;case 4:l=Kn,Kn=Vl(t.stateNode.containerInfo),an(r,t),on(t),Kn=l;break;case 12:an(r,t),on(t);break;case 31:an(r,t),on(t),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,Ml(t,l)));break;case 13:an(r,t),on(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Dl=ut()),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,Ml(t,l)));break;case 22:f=t.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,V=Ar,Z=Tt;if(Ar=V||f,Tt=Z||R,an(r,t),Tt=Z,Ar=V,on(t),l&8192)e:for(r=t.stateNode,r._visibility=f?r._visibility&-2:r._visibility|1,f&&(a===null||R||Ar||Tt||Qs(t)),a=null,r=t;;){if(r.tag===5||r.tag===26){if(a===null){R=a=r;try{if(y=R.stateNode,f)w=y.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{O=R.stateNode;var ie=R.memoizedProps.style,Y=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;O.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(ve){Ze(R,R.return,ve)}}}else if(r.tag===6){if(a===null){R=r;try{R.stateNode.nodeValue=f?"":R.memoizedProps}catch(ve){Ze(R,R.return,ve)}}}else if(r.tag===18){if(a===null){R=r;try{var X=R.stateNode;f?ug(X,!0):ug(R.stateNode,!1)}catch(ve){Ze(R,R.return,ve)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===t)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break e;for(;r.sibling===null;){if(r.return===null||r.return===t)break e;a===r&&(a=null),r=r.return}a===r&&(a=null),r.sibling.return=r.return,r=r.sibling}l&4&&(l=t.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,Ml(t,a))));break;case 19:an(r,t),on(t),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,Ml(t,l)));break;case 30:break;case 21:break;default:an(r,t),on(t)}}function on(t){var r=t.flags;if(r&2){try{for(var a,l=t.return;l!==null;){if(hy(l)){a=l;break}l=l.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var f=a.stateNode,y=uh(t);Cl(t,y,f);break;case 5:var w=a.stateNode;a.flags&32&&(fi(w,""),a.flags&=-33);var O=uh(t);Cl(t,O,w);break;case 3:case 4:var R=a.stateNode.containerInfo,V=uh(t);fh(t,V,R);break;default:throw Error(i(161))}}catch(Z){Ze(t,t.return,Z)}t.flags&=-3}r&4096&&(t.flags&=-4097)}function _y(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var r=t;_y(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),t=t.sibling}}function kr(t,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)py(t,r.alternate,r),r=r.sibling}function Qs(t){for(t=t.child;t!==null;){var r=t;switch(r.tag){case 0:case 11:case 14:case 15:ns(4,r,r.return),Qs(r);break;case 1:sr(r,r.return);var a=r.stateNode;typeof a.componentWillUnmount=="function"&&uy(r,r.return,a),Qs(r);break;case 27:Wa(r.stateNode);case 26:case 5:sr(r,r.return),Qs(r);break;case 22:r.memoizedState===null&&Qs(r);break;case 30:Qs(r);break;default:Qs(r)}t=t.sibling}}function Nr(t,r,a){for(a=a&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var l=r.alternate,f=t,y=r,w=y.flags;switch(y.tag){case 0:case 11:case 15:Nr(f,y,a),Ia(4,y);break;case 1:if(Nr(f,y,a),l=y,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(V){Ze(l,l.return,V)}if(l=y,f=l.updateQueue,f!==null){var O=l.stateNode;try{var R=f.shared.hiddenCallbacks;if(R!==null)for(f.shared.hiddenCallbacks=null,f=0;f<R.length;f++)W0(R[f],O)}catch(V){Ze(l,l.return,V)}}a&&w&64&&cy(y),Ha(y,y.return);break;case 27:dy(y);case 26:case 5:Nr(f,y,a),a&&l===null&&w&4&&fy(y),Ha(y,y.return);break;case 12:Nr(f,y,a);break;case 31:Nr(f,y,a),a&&w&4&&by(f,y);break;case 13:Nr(f,y,a),a&&w&4&&xy(f,y);break;case 22:y.memoizedState===null&&Nr(f,y,a),Ha(y,y.return);break;case 30:break;default:Nr(f,y,a)}r=r.sibling}}function dh(t,r){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(t=r.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&Na(a))}function mh(t,r){t=null,r.alternate!==null&&(t=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==t&&(r.refCount++,t!=null&&Na(t))}function Jn(t,r,a,l){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)wy(t,r,a,l),r=r.sibling}function wy(t,r,a,l){var f=r.flags;switch(r.tag){case 0:case 11:case 15:Jn(t,r,a,l),f&2048&&Ia(9,r);break;case 1:Jn(t,r,a,l);break;case 3:Jn(t,r,a,l),f&2048&&(t=null,r.alternate!==null&&(t=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==t&&(r.refCount++,t!=null&&Na(t)));break;case 12:if(f&2048){Jn(t,r,a,l),t=r.stateNode;try{var y=r.memoizedProps,w=y.id,O=y.onPostCommit;typeof O=="function"&&O(w,r.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(R){Ze(r,r.return,R)}}else Jn(t,r,a,l);break;case 31:Jn(t,r,a,l);break;case 13:Jn(t,r,a,l);break;case 23:break;case 22:y=r.stateNode,w=r.alternate,r.memoizedState!==null?y._visibility&2?Jn(t,r,a,l):Fa(t,r):y._visibility&2?Jn(t,r,a,l):(y._visibility|=2,Ci(t,r,a,l,(r.subtreeFlags&10256)!==0||!1)),f&2048&&dh(w,r);break;case 24:Jn(t,r,a,l),f&2048&&mh(r.alternate,r);break;default:Jn(t,r,a,l)}}function Ci(t,r,a,l,f){for(f=f&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var y=t,w=r,O=a,R=l,V=w.flags;switch(w.tag){case 0:case 11:case 15:Ci(y,w,O,R,f),Ia(8,w);break;case 23:break;case 22:var Z=w.stateNode;w.memoizedState!==null?Z._visibility&2?Ci(y,w,O,R,f):Fa(y,w):(Z._visibility|=2,Ci(y,w,O,R,f)),f&&V&2048&&dh(w.alternate,w);break;case 24:Ci(y,w,O,R,f),f&&V&2048&&mh(w.alternate,w);break;default:Ci(y,w,O,R,f)}r=r.sibling}}function Fa(t,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var a=t,l=r,f=l.flags;switch(l.tag){case 22:Fa(a,l),f&2048&&dh(l.alternate,l);break;case 24:Fa(a,l),f&2048&&mh(l.alternate,l);break;default:Fa(a,l)}r=r.sibling}}var Ga=8192;function Mi(t,r,a){if(t.subtreeFlags&Ga)for(t=t.child;t!==null;)Sy(t,r,a),t=t.sibling}function Sy(t,r,a){switch(t.tag){case 26:Mi(t,r,a),t.flags&Ga&&t.memoizedState!==null&&sS(a,Kn,t.memoizedState,t.memoizedProps);break;case 5:Mi(t,r,a);break;case 3:case 4:var l=Kn;Kn=Vl(t.stateNode.containerInfo),Mi(t,r,a),Kn=l;break;case 22:t.memoizedState===null&&(l=t.alternate,l!==null&&l.memoizedState!==null?(l=Ga,Ga=16777216,Mi(t,r,a),Ga=l):Mi(t,r,a));break;default:Mi(t,r,a)}}function Ey(t){var r=t.alternate;if(r!==null&&(t=r.child,t!==null)){r.child=null;do r=t.sibling,t.sibling=null,t=r;while(t!==null)}}function Va(t){var r=t.deletions;if((t.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Pt=l,Ay(l,t)}Ey(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Oy(t),t=t.sibling}function Oy(t){switch(t.tag){case 0:case 11:case 15:Va(t),t.flags&2048&&ns(9,t,t.return);break;case 3:Va(t);break;case 12:Va(t);break;case 22:var r=t.stateNode;t.memoizedState!==null&&r._visibility&2&&(t.return===null||t.return.tag!==13)?(r._visibility&=-3,Rl(t)):Va(t);break;default:Va(t)}}function Rl(t){var r=t.deletions;if((t.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Pt=l,Ay(l,t)}Ey(t)}for(t=t.child;t!==null;){switch(r=t,r.tag){case 0:case 11:case 15:ns(8,r,r.return),Rl(r);break;case 22:a=r.stateNode,a._visibility&2&&(a._visibility&=-3,Rl(r));break;default:Rl(r)}t=t.sibling}}function Ay(t,r){for(;Pt!==null;){var a=Pt;switch(a.tag){case 0:case 11:case 15:ns(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:Na(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Pt=l;else e:for(a=t;Pt!==null;){l=Pt;var f=l.sibling,y=l.return;if(yy(l),l===a){Pt=null;break e}if(f!==null){f.return=y,Pt=f;break e}Pt=y}}}var xw={getCacheForType:function(t){var r=It(jt),a=r.data.get(t);return a===void 0&&(a=t(),r.data.set(t,a)),a},cacheSignal:function(){return It(jt).controller.signal}},vw=typeof WeakMap=="function"?WeakMap:Map,Qe=0,at=null,$e=null,He=0,We=0,gn=null,rs=!1,Ri=!1,ph=!1,Tr=0,xt=0,ss=0,Xs=0,yh=0,bn=0,Di=0,Ya=null,ln=null,gh=!1,Dl=0,jy=0,Ll=1/0,ql=null,is=null,Dt=0,as=null,Li=null,Cr=0,bh=0,xh=null,ky=null,Ka=0,vh=null;function xn(){return(Qe&2)!==0&&He!==0?He&-He:H.T!==null?Ah():ya()}function Ny(){if(bn===0)if((He&536870912)===0||Ge){var t=dr;dr<<=1,(dr&3932160)===0&&(dr=262144),bn=t}else bn=536870912;return t=pn.current,t!==null&&(t.flags|=32),bn}function cn(t,r,a){(t===at&&(We===2||We===9)||t.cancelPendingCommit!==null)&&(qi(t,0),os(t,He,bn,!1)),Gn(t,a),((Qe&2)===0||t!==at)&&(t===at&&((Qe&2)===0&&(Xs|=a),xt===4&&os(t,He,bn,!1)),ir(t))}function Ty(t,r,a){if((Qe&6)!==0)throw Error(i(327));var l=!a&&(r&127)===0&&(r&t.expiredLanes)===0||Ms(t,r),f=l?Sw(t,r):wh(t,r,!0),y=l;do{if(f===0){Ri&&!l&&os(t,r,0,!1);break}else{if(a=t.current.alternate,y&&!_w(a)){f=wh(t,r,!1),y=!1;continue}if(f===2){if(y=r,t.errorRecoveryDisabledLanes&y)var w=0;else w=t.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){r=w;e:{var O=t;f=Ya;var R=O.current.memoizedState.isDehydrated;if(R&&(qi(O,w).flags|=256),w=wh(O,w,!1),w!==2){if(ph&&!R){O.errorRecoveryDisabledLanes|=y,Xs|=y,f=4;break e}y=ln,ln=f,y!==null&&(ln===null?ln=y:ln.push.apply(ln,y))}f=w}if(y=!1,f!==2)continue}}if(f===1){qi(t,0),os(t,r,0,!0);break}e:{switch(l=t,y=f,y){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:os(l,r,bn,!rs);break e;case 2:ln=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(f=Dl+300-ut(),10<f)){if(os(l,r,bn,!rs),Cs(l,0,!0)!==0)break e;Cr=r,l.timeoutHandle=og(Cy.bind(null,l,a,ln,ql,gh,r,bn,Xs,Di,rs,y,"Throttled",-0,0),f);break e}Cy(l,a,ln,ql,gh,r,bn,Xs,Di,rs,y,null,-0,0)}}break}while(!0);ir(t)}function Cy(t,r,a,l,f,y,w,O,R,V,Z,ie,Y,X){if(t.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:yr},Sy(r,y,ie);var ve=(y&62914560)===y?Dl-ut():(y&4194048)===y?jy-ut():0;if(ve=iS(ie,ve),ve!==null){Cr=y,t.cancelPendingCommit=ve(Uy.bind(null,t,r,y,a,l,f,w,O,R,Z,ie,null,Y,X)),os(t,y,w,!V);return}}Uy(t,r,y,a,l,f,w,O,R)}function _w(t){for(var r=t;;){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 f=a[l],y=f.getSnapshot;f=f.value;try{if(!dn(y(),f))return!1}catch{return!1}}if(a=r.child,r.subtreeFlags&16384&&a!==null)a.return=r,r=a;else{if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function os(t,r,a,l){r&=~yh,r&=~Xs,t.suspendedLanes|=r,t.pingedLanes&=~r,l&&(t.warmLanes|=r),l=t.expirationTimes;for(var f=r;0<f;){var y=31-Gt(f),w=1<<y;l[y]=-1,f&=~w}a!==0&&Fr(t,a,r)}function Pl(){return(Qe&6)===0?(Ja(0),!1):!0}function _h(){if($e!==null){if(We===0)var t=$e.return;else t=$e,vr=Is=null,Pf(t),Ai=null,Ca=0,t=$e;for(;t!==null;)ly(t.alternate,t),t=t.return;$e=null}}function qi(t,r){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,$w(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Cr=0,_h(),at=t,$e=a=br(t.current,null),He=r,We=0,gn=null,rs=!1,Ri=Ms(t,r),ph=!1,Di=bn=yh=Xs=ss=xt=0,ln=Ya=null,gh=!1,(r&8)!==0&&(r|=r&32);var l=t.entangledLanes;if(l!==0)for(t=t.entanglements,l&=r;0<l;){var f=31-Gt(l),y=1<<f;r|=t[f],l&=~y}return Tr=r,sl(),a}function My(t,r){Re=null,H.H=Ua,r===Oi||r===hl?(r=K0(),We=3):r===Of?(r=K0(),We=4):We=r===Zf?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,gn=r,$e===null&&(xt=1,Al(t,Rn(r,t.current)))}function Ry(){var t=pn.current;return t===null?!0:(He&4194048)===He?Pn===null:(He&62914560)===He||(He&536870912)!==0?t===Pn:!1}function Dy(){var t=H.H;return H.H=Ua,t===null?Ua:t}function Ly(){var t=H.A;return H.A=xw,t}function Bl(){xt=4,rs||(He&4194048)!==He&&pn.current!==null||(Ri=!0),(ss&134217727)===0&&(Xs&134217727)===0||at===null||os(at,He,bn,!1)}function wh(t,r,a){var l=Qe;Qe|=2;var f=Dy(),y=Ly();(at!==t||He!==r)&&(ql=null,qi(t,r)),r=!1;var w=xt;e:do try{if(We!==0&&$e!==null){var O=$e,R=gn;switch(We){case 8:_h(),w=6;break e;case 3:case 2:case 9:case 6:pn.current===null&&(r=!0);var V=We;if(We=0,gn=null,Pi(t,O,R,V),a&&Ri){w=0;break e}break;default:V=We,We=0,gn=null,Pi(t,O,R,V)}}ww(),w=xt;break}catch(Z){My(t,Z)}while(!0);return r&&t.shellSuspendCounter++,vr=Is=null,Qe=l,H.H=f,H.A=y,$e===null&&(at=null,He=0,sl()),w}function ww(){for(;$e!==null;)qy($e)}function Sw(t,r){var a=Qe;Qe|=2;var l=Dy(),f=Ly();at!==t||He!==r?(ql=null,Ll=ut()+500,qi(t,r)):Ri=Ms(t,r);e:do try{if(We!==0&&$e!==null){r=$e;var y=gn;t:switch(We){case 1:We=0,gn=null,Pi(t,r,y,1);break;case 2:case 9:if(V0(y)){We=0,gn=null,Py(r);break}r=function(){We!==2&&We!==9||at!==t||(We=7),ir(t)},y.then(r,r);break e;case 3:We=7;break e;case 4:We=5;break e;case 7:V0(y)?(We=0,gn=null,Py(r)):(We=0,gn=null,Pi(t,r,y,7));break;case 5:var w=null;switch($e.tag){case 26:w=$e.memoizedState;case 5:case 27:var O=$e;if(w?wg(w):O.stateNode.complete){We=0,gn=null;var R=O.sibling;if(R!==null)$e=R;else{var V=O.return;V!==null?($e=V,Ul(V)):$e=null}break t}}We=0,gn=null,Pi(t,r,y,5);break;case 6:We=0,gn=null,Pi(t,r,y,6);break;case 8:_h(),xt=6;break e;default:throw Error(i(462))}}Ew();break}catch(Z){My(t,Z)}while(!0);return vr=Is=null,H.H=l,H.A=f,Qe=a,$e!==null?0:(at=null,He=0,sl(),xt)}function Ew(){for(;$e!==null&&!$o();)qy($e)}function qy(t){var r=ay(t.alternate,t,Tr);t.memoizedProps=t.pendingProps,r===null?Ul(t):$e=r}function Py(t){var r=t,a=r.alternate;switch(r.tag){case 15:case 0:r=ey(a,r,r.pendingProps,r.type,void 0,He);break;case 11:r=ey(a,r,r.pendingProps,r.type.render,r.ref,He);break;case 5:Pf(r);default:ly(a,r),r=$e=L0(r,Tr),r=ay(a,r,Tr)}t.memoizedProps=t.pendingProps,r===null?Ul(t):$e=r}function Pi(t,r,a,l){vr=Is=null,Pf(r),Ai=null,Ca=0;var f=r.return;try{if(hw(t,f,r,a,He)){xt=1,Al(t,Rn(a,t.current)),$e=null;return}}catch(y){if(f!==null)throw $e=f,y;xt=1,Al(t,Rn(a,t.current)),$e=null;return}r.flags&32768?(Ge||l===1?t=!0:Ri||(He&536870912)!==0?t=!1:(rs=t=!0,(l===2||l===9||l===3||l===6)&&(l=pn.current,l!==null&&l.tag===13&&(l.flags|=16384))),By(r,t)):Ul(r)}function Ul(t){var r=t;do{if((r.flags&32768)!==0){By(r,rs);return}t=r.return;var a=pw(r.alternate,r,Tr);if(a!==null){$e=a;return}if(r=r.sibling,r!==null){$e=r;return}$e=r=t}while(r!==null);xt===0&&(xt=5)}function By(t,r){do{var a=yw(t.alternate,t);if(a!==null){a.flags&=32767,$e=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!r&&(t=t.sibling,t!==null)){$e=t;return}$e=t=a}while(t!==null);xt=6,$e=null}function Uy(t,r,a,l,f,y,w,O,R){t.cancelPendingCommit=null;do zl();while(Dt!==0);if((Qe&6)!==0)throw Error(i(327));if(r!==null){if(r===t.current)throw Error(i(177));if(y=r.lanes|r.childLanes,y|=uf,Hr(t,a,y,w,O,R),t===at&&($e=at=null,He=0),Li=r,as=t,Cr=a,bh=y,xh=f,ky=l,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,kw(ai,function(){return Fy(),null})):(t.callbackNode=null,t.callbackPriority=0),l=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||l){l=H.T,H.T=null,f=J.p,J.p=2,w=Qe,Qe|=4;try{gw(t,r,a)}finally{Qe=w,J.p=f,H.T=l}}Dt=1,zy(),$y(),Iy()}}function zy(){if(Dt===1){Dt=0;var t=as,r=Li,a=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||a){a=H.T,H.T=null;var l=J.p;J.p=2;var f=Qe;Qe|=4;try{vy(r,t);var y=Dh,w=A0(t.containerInfo),O=y.focusedElem,R=y.selectionRange;if(w!==O&&O&&O.ownerDocument&&O0(O.ownerDocument.documentElement,O)){if(R!==null&&sf(O)){var V=R.start,Z=R.end;if(Z===void 0&&(Z=V),"selectionStart"in O)O.selectionStart=V,O.selectionEnd=Math.min(Z,O.value.length);else{var ie=O.ownerDocument||document,Y=ie&&ie.defaultView||window;if(Y.getSelection){var X=Y.getSelection(),ve=O.textContent.length,Te=Math.min(R.start,ve),st=R.end===void 0?Te:Math.min(R.end,ve);!X.extend&&Te>st&&(w=st,st=Te,Te=w);var $=E0(O,Te),P=E0(O,st);if($&&P&&(X.rangeCount!==1||X.anchorNode!==$.node||X.anchorOffset!==$.offset||X.focusNode!==P.node||X.focusOffset!==P.offset)){var G=ie.createRange();G.setStart($.node,$.offset),X.removeAllRanges(),Te>st?(X.addRange(G),X.extend(P.node,P.offset)):(G.setEnd(P.node,P.offset),X.addRange(G))}}}}for(ie=[],X=O;X=X.parentNode;)X.nodeType===1&&ie.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<ie.length;O++){var ee=ie[O];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}Wl=!!Rh,Dh=Rh=null}finally{Qe=f,J.p=l,H.T=a}}t.current=r,Dt=2}}function $y(){if(Dt===2){Dt=0;var t=as,r=Li,a=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||a){a=H.T,H.T=null;var l=J.p;J.p=2;var f=Qe;Qe|=4;try{py(t,r.alternate,r)}finally{Qe=f,J.p=l,H.T=a}}Dt=3}}function Iy(){if(Dt===4||Dt===3){Dt=0,ii();var t=as,r=Li,a=Cr,l=ky;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Dt=5:(Dt=0,Li=as=null,Hy(t,t.pendingLanes));var f=t.pendingLanes;if(f===0&&(is=null),Ds(a),r=r.stateNode,_t&&typeof _t.onCommitFiberRoot=="function")try{_t.onCommitFiberRoot(Ts,r,void 0,(r.current.flags&128)===128)}catch{}if(l!==null){r=H.T,f=J.p,J.p=2,H.T=null;try{for(var y=t.onRecoverableError,w=0;w<l.length;w++){var O=l[w];y(O.value,{componentStack:O.stack})}}finally{H.T=r,J.p=f}}(Cr&3)!==0&&zl(),ir(t),f=t.pendingLanes,(a&261930)!==0&&(f&42)!==0?t===vh?Ka++:(Ka=0,vh=t):Ka=0,Ja(0)}}function Hy(t,r){(t.pooledCacheLanes&=r)===0&&(r=t.pooledCache,r!=null&&(t.pooledCache=null,Na(r)))}function zl(){return zy(),$y(),Iy(),Fy()}function Fy(){if(Dt!==5)return!1;var t=as,r=bh;bh=0;var a=Ds(Cr),l=H.T,f=J.p;try{J.p=32>a?32:a,H.T=null,a=xh,xh=null;var y=as,w=Cr;if(Dt=0,Li=as=null,Cr=0,(Qe&6)!==0)throw Error(i(331));var O=Qe;if(Qe|=4,Oy(y.current),wy(y,y.current,w,a),Qe=O,Ja(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(Ts,y)}catch{}return!0}finally{J.p=f,H.T=l,Hy(t,r)}}function Gy(t,r,a){r=Rn(a,r),r=Wf(t.stateNode,r,2),t=Zr(t,r,2),t!==null&&(Gn(t,2),ir(t))}function Ze(t,r,a){if(t.tag===3)Gy(t,t,a);else for(;r!==null;){if(r.tag===3){Gy(r,t,a);break}else if(r.tag===1){var l=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(is===null||!is.has(l))){t=Rn(a,t),a=Vp(2),l=Zr(r,a,2),l!==null&&(Yp(a,l,r,t),Gn(l,2),ir(l));break}}r=r.return}}function Sh(t,r,a){var l=t.pingCache;if(l===null){l=t.pingCache=new vw;var f=new Set;l.set(r,f)}else f=l.get(r),f===void 0&&(f=new Set,l.set(r,f));f.has(a)||(ph=!0,f.add(a),t=Ow.bind(null,t,r,a),r.then(t,t))}function Ow(t,r,a){var l=t.pingCache;l!==null&&l.delete(r),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,at===t&&(He&a)===a&&(xt===4||xt===3&&(He&62914560)===He&&300>ut()-Dl?(Qe&2)===0&&qi(t,0):yh|=a,Di===He&&(Di=0)),ir(t)}function Vy(t,r){r===0&&(r=li()),t=Us(t,r),t!==null&&(Gn(t,r),ir(t))}function Aw(t){var r=t.memoizedState,a=0;r!==null&&(a=r.retryLane),Vy(t,a)}function jw(t,r){var a=0;switch(t.tag){case 31:case 13:var l=t.stateNode,f=t.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=t.stateNode;break;case 22:l=t.stateNode._retryCache;break;default:throw Error(i(314))}l!==null&&l.delete(r),Vy(t,a)}function kw(t,r){return ha(t,r)}var $l=null,Bi=null,Eh=!1,Il=!1,Oh=!1,ls=0;function ir(t){t!==Bi&&t.next===null&&(Bi===null?$l=Bi=t:Bi=Bi.next=t),Il=!0,Eh||(Eh=!0,Tw())}function Ja(t,r){if(!Oh&&Il){Oh=!0;do for(var a=!1,l=$l;l!==null;){if(t!==0){var f=l.pendingLanes;if(f===0)var y=0;else{var w=l.suspendedLanes,O=l.pingedLanes;y=(1<<31-Gt(42|t)+1)-1,y&=f&~(w&~O),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(a=!0,Qy(l,y))}else y=He,y=Cs(l,l===at?y:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(y&3)===0||Ms(l,y)||(a=!0,Qy(l,y));l=l.next}while(a);Oh=!1}}function Nw(){Yy()}function Yy(){Il=Eh=!1;var t=0;ls!==0&&zw()&&(t=ls);for(var r=ut(),a=null,l=$l;l!==null;){var f=l.next,y=Ky(l,r);y===0?(l.next=null,a===null?$l=f:a.next=f,f===null&&(Bi=a)):(a=l,(t!==0||(y&3)!==0)&&(Il=!0)),l=f}Dt!==0&&Dt!==5||Ja(t),ls!==0&&(ls=0)}function Ky(t,r){for(var a=t.suspendedLanes,l=t.pingedLanes,f=t.expirationTimes,y=t.pendingLanes&-62914561;0<y;){var w=31-Gt(y),O=1<<w,R=f[w];R===-1?((O&a)===0||(O&l)!==0)&&(f[w]=pa(O,r)):R<=r&&(t.expiredLanes|=O),y&=~O}if(r=at,a=He,a=Cs(t,t===r?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l=t.callbackNode,a===0||t===r&&(We===2||We===9)||t.cancelPendingCommit!==null)return l!==null&&l!==null&&hr(l),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Ms(t,a)){if(r=a&-a,r===t.callbackPriority)return r;switch(l!==null&&hr(l),Ds(a)){case 2:case 8:a=Ho;break;case 32:a=ai;break;case 268435456:a=Fo;break;default:a=ai}return l=Jy.bind(null,t),a=ha(a,l),t.callbackPriority=r,t.callbackNode=a,r}return l!==null&&l!==null&&hr(l),t.callbackPriority=2,t.callbackNode=null,2}function Jy(t,r){if(Dt!==0&&Dt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(zl()&&t.callbackNode!==a)return null;var l=He;return l=Cs(t,t===at?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l===0?null:(Ty(t,l,r),Ky(t,ut()),t.callbackNode!=null&&t.callbackNode===a?Jy.bind(null,t):null)}function Qy(t,r){if(zl())return null;Ty(t,r,!0)}function Tw(){Iw(function(){(Qe&6)!==0?ha(Io,Nw):Yy()})}function Ah(){if(ls===0){var t=Si;t===0&&(t=zr,zr<<=1,(zr&261888)===0&&(zr=256)),ls=t}return ls}function Xy(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Qo(""+t)}function Wy(t,r){var a=r.ownerDocument.createElement("input");return a.name=r.name,a.value=r.value,t.id&&a.setAttribute("form",t.id),r.parentNode.insertBefore(a,r),t=new FormData(t),a.parentNode.removeChild(a),t}function Cw(t,r,a,l,f){if(r==="submit"&&a&&a.stateNode===f){var y=Xy((f[gt]||null).action),w=l.submitter;w&&(r=(r=w[gt]||null)?Xy(r.formAction):w.getAttribute("formAction"),r!==null&&(y=r,w=null));var O=new el("action","action",null,l,f);t.push({event:O,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ls!==0){var R=w?Wy(f,w):new FormData(f);Vf(a,{pending:!0,data:R,method:f.method,action:y},null,R)}}else typeof y=="function"&&(O.preventDefault(),R=w?Wy(f,w):new FormData(f),Vf(a,{pending:!0,data:R,method:f.method,action:y},y,R))},currentTarget:f}]})}}for(var jh=0;jh<cf.length;jh++){var kh=cf[jh],Mw=kh.toLowerCase(),Rw=kh[0].toUpperCase()+kh.slice(1);Yn(Mw,"on"+Rw)}Yn(N0,"onAnimationEnd"),Yn(T0,"onAnimationIteration"),Yn(C0,"onAnimationStart"),Yn("dblclick","onDoubleClick"),Yn("focusin","onFocus"),Yn("focusout","onBlur"),Yn(J_,"onTransitionRun"),Yn(Q_,"onTransitionStart"),Yn(X_,"onTransitionCancel"),Yn(M0,"onTransitionEnd"),K("onMouseEnter",["mouseout","mouseover"]),K("onMouseLeave",["mouseout","mouseover"]),K("onPointerEnter",["pointerout","pointerover"]),K("onPointerLeave",["pointerout","pointerover"]),le("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),le("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),le("onBeforeInput",["compositionend","keypress","textInput","paste"]),le("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),le("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),le("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qa="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(" "),Dw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qa));function Zy(t,r){r=(r&4)!==0;for(var a=0;a<t.length;a++){var l=t[a],f=l.event;l=l.listeners;e:{var y=void 0;if(r)for(var w=l.length-1;0<=w;w--){var O=l[w],R=O.instance,V=O.currentTarget;if(O=O.listener,R!==y&&f.isPropagationStopped())break e;y=O,f.currentTarget=V;try{y(f)}catch(Z){rl(Z)}f.currentTarget=null,y=R}else for(w=0;w<l.length;w++){if(O=l[w],R=O.instance,V=O.currentTarget,O=O.listener,R!==y&&f.isPropagationStopped())break e;y=O,f.currentTarget=V;try{y(f)}catch(Z){rl(Z)}f.currentTarget=null,y=R}}}}function Ie(t,r){var a=r[Ls];a===void 0&&(a=r[Ls]=new Set);var l=t+"__bubble";a.has(l)||(eg(r,t,2,!1),a.add(l))}function Nh(t,r,a){var l=0;r&&(l|=4),eg(a,t,l,r)}var Hl="_reactListening"+Math.random().toString(36).slice(2);function Th(t){if(!t[Hl]){t[Hl]=!0,I.forEach(function(a){a!=="selectionchange"&&(Dw.has(a)||Nh(a,!1,t),Nh(a,!0,t))});var r=t.nodeType===9?t:t.ownerDocument;r===null||r[Hl]||(r[Hl]=!0,Nh("selectionchange",!1,r))}}function eg(t,r,a,l){switch(Ng(r)){case 2:var f=lS;break;case 8:f=cS;break;default:f=Gh}a=f.bind(null,r,a,t),f=void 0,!Ju||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(f=!0),l?f!==void 0?t.addEventListener(r,a,{capture:!0,passive:f}):t.addEventListener(r,a,!0):f!==void 0?t.addEventListener(r,a,{passive:f}):t.addEventListener(r,a,!1)}function Ch(t,r,a,l,f){var y=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 O=l.stateNode.containerInfo;if(O===f)break;if(w===4)for(w=l.return;w!==null;){var R=w.tag;if((R===3||R===4)&&w.stateNode.containerInfo===f)return;w=w.return}for(;O!==null;){if(w=A(O),w===null)return;if(R=w.tag,R===5||R===6||R===26||R===27){l=y=w;continue e}O=O.parentNode}}l=l.return}i0(function(){var V=y,Z=Yu(a),ie=[];e:{var Y=R0.get(t);if(Y!==void 0){var X=el,ve=t;switch(t){case"keypress":if(Wo(a)===0)break e;case"keydown":case"keyup":X=j_;break;case"focusin":ve="focus",X=Zu;break;case"focusout":ve="blur",X=Zu;break;case"beforeblur":case"afterblur":X=Zu;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":X=l0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=p_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=T_;break;case N0:case T0:case C0:X=b_;break;case M0:X=M_;break;case"scroll":case"scrollend":X=d_;break;case"wheel":X=D_;break;case"copy":case"cut":case"paste":X=v_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=u0;break;case"toggle":case"beforetoggle":X=q_}var Te=(r&4)!==0,st=!Te&&(t==="scroll"||t==="scrollend"),$=Te?Y!==null?Y+"Capture":null:Y;Te=[];for(var P=V,G;P!==null;){var ee=P;if(G=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||G===null||$===null||(ee=ba(P,$),ee!=null&&Te.push(Xa(P,ee,G))),st)break;P=P.return}0<Te.length&&(Y=new X(Y,ve,null,a,Z),ie.push({event:Y,listeners:Te}))}}if((r&7)===0){e:{if(Y=t==="mouseover"||t==="pointerover",X=t==="mouseout"||t==="pointerout",Y&&a!==Vu&&(ve=a.relatedTarget||a.fromElement)&&(A(ve)||ve[hn]))break e;if((X||Y)&&(Y=Z.window===Z?Z:(Y=Z.ownerDocument)?Y.defaultView||Y.parentWindow:window,X?(ve=a.relatedTarget||a.toElement,X=V,ve=ve?A(ve):null,ve!==null&&(st=c(ve),Te=ve.tag,ve!==st||Te!==5&&Te!==27&&Te!==6)&&(ve=null)):(X=null,ve=V),X!==ve)){if(Te=l0,ee="onMouseLeave",$="onMouseEnter",P="mouse",(t==="pointerout"||t==="pointerover")&&(Te=u0,ee="onPointerLeave",$="onPointerEnter",P="pointer"),st=X==null?Y:k(X),G=ve==null?Y:k(ve),Y=new Te(ee,P+"leave",X,a,Z),Y.target=st,Y.relatedTarget=G,ee=null,A(Z)===V&&(Te=new Te($,P+"enter",ve,a,Z),Te.target=G,Te.relatedTarget=st,ee=Te),st=ee,X&&ve)t:{for(Te=Lw,$=X,P=ve,G=0,ee=$;ee;ee=Te(ee))G++;ee=0;for(var je=P;je;je=Te(je))ee++;for(;0<G-ee;)$=Te($),G--;for(;0<ee-G;)P=Te(P),ee--;for(;G--;){if($===P||P!==null&&$===P.alternate){Te=$;break t}$=Te($),P=Te(P)}Te=null}else Te=null;X!==null&&tg(ie,Y,X,Te,!1),ve!==null&&st!==null&&tg(ie,st,ve,Te,!0)}}e:{if(Y=V?k(V):window,X=Y.nodeName&&Y.nodeName.toLowerCase(),X==="select"||X==="input"&&Y.type==="file")var Ke=b0;else if(y0(Y))if(x0)Ke=V_;else{Ke=F_;var Se=H_}else X=Y.nodeName,!X||X.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?V&&Gu(V.elementType)&&(Ke=b0):Ke=G_;if(Ke&&(Ke=Ke(t,V))){g0(ie,Ke,a,Z);break e}Se&&Se(t,Y,V),t==="focusout"&&V&&Y.type==="number"&&V.memoizedProps.value!=null&&Fu(Y,"number",Y.value)}switch(Se=V?k(V):window,t){case"focusin":(y0(Se)||Se.contentEditable==="true")&&(pi=Se,af=V,Aa=null);break;case"focusout":Aa=af=pi=null;break;case"mousedown":of=!0;break;case"contextmenu":case"mouseup":case"dragend":of=!1,j0(ie,a,Z);break;case"selectionchange":if(K_)break;case"keydown":case"keyup":j0(ie,a,Z)}var De;if(tf)e:{switch(t){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else mi?m0(t,a)&&(Fe="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(Fe="onCompositionStart");Fe&&(f0&&a.locale!=="ko"&&(mi||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&mi&&(De=a0()):(Vr=Z,Qu="value"in Vr?Vr.value:Vr.textContent,mi=!0)),Se=Fl(V,Fe),0<Se.length&&(Fe=new c0(Fe,t,null,a,Z),ie.push({event:Fe,listeners:Se}),De?Fe.data=De:(De=p0(a),De!==null&&(Fe.data=De)))),(De=B_?U_(t,a):z_(t,a))&&(Fe=Fl(V,"onBeforeInput"),0<Fe.length&&(Se=new c0("onBeforeInput","beforeinput",null,a,Z),ie.push({event:Se,listeners:Fe}),Se.data=De)),Cw(ie,t,V,a,Z)}Zy(ie,r)})}function Xa(t,r,a){return{instance:t,listener:r,currentTarget:a}}function Fl(t,r){for(var a=r+"Capture",l=[];t!==null;){var f=t,y=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||y===null||(f=ba(t,a),f!=null&&l.unshift(Xa(t,f,y)),f=ba(t,r),f!=null&&l.push(Xa(t,f,y))),t.tag===3)return l;t=t.return}return[]}function Lw(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function tg(t,r,a,l,f){for(var y=r._reactName,w=[];a!==null&&a!==l;){var O=a,R=O.alternate,V=O.stateNode;if(O=O.tag,R!==null&&R===l)break;O!==5&&O!==26&&O!==27||V===null||(R=V,f?(V=ba(a,y),V!=null&&w.unshift(Xa(a,V,R))):f||(V=ba(a,y),V!=null&&w.push(Xa(a,V,R)))),a=a.return}w.length!==0&&t.push({event:r,listeners:w})}var qw=/\r\n?/g,Pw=/\u0000|\uFFFD/g;function ng(t){return(typeof t=="string"?t:""+t).replace(qw,`
|
|
26
|
-
`).replace(Pw,"")}function rg(t,r){return r=ng(r),ng(t)===r}function rt(t,r,a,l,f,y){switch(a){case"children":typeof l=="string"?r==="body"||r==="textarea"&&l===""||fi(t,l):(typeof l=="number"||typeof l=="bigint")&&r!=="body"&&fi(t,""+l);break;case"className":Vn(t,"class",l);break;case"tabIndex":Vn(t,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Vn(t,a,l);break;case"style":r0(t,l,y);break;case"data":if(r!=="object"){Vn(t,"data",l);break}case"src":case"href":if(l===""&&(r!=="a"||a!=="href")){t.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(a);break}l=Qo(""+l),t.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){t.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 y=="function"&&(a==="formAction"?(r!=="input"&&rt(t,r,"name",f.name,f,null),rt(t,r,"formEncType",f.formEncType,f,null),rt(t,r,"formMethod",f.formMethod,f,null),rt(t,r,"formTarget",f.formTarget,f,null)):(rt(t,r,"encType",f.encType,f,null),rt(t,r,"method",f.method,f,null),rt(t,r,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(a);break}l=Qo(""+l),t.setAttribute(a,l);break;case"onClick":l!=null&&(t.onclick=yr);break;case"onScroll":l!=null&&Ie("scroll",t);break;case"onScrollEnd":l!=null&&Ie("scrollend",t);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"multiple":t.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":t.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"){t.removeAttribute("xlink:href");break}a=Qo(""+l),t.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"?t.setAttribute(a,""+l):t.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"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":l===!0?t.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,l):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?t.setAttribute(a,l):t.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?t.removeAttribute(a):t.setAttribute(a,l);break;case"popover":Ie("beforetoggle",t),Ie("toggle",t),Vt(t,"popover",l);break;case"xlinkActuate":pr(t,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":pr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":pr(t,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":pr(t,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":pr(t,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":pr(t,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":pr(t,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":pr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":pr(t,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Vt(t,"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=f_.get(a)||a,Vt(t,a,l))}}function Mh(t,r,a,l,f,y){switch(a){case"style":r0(t,l,y);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"children":typeof l=="string"?fi(t,l):(typeof l=="number"||typeof l=="bigint")&&fi(t,""+l);break;case"onScroll":l!=null&&Ie("scroll",t);break;case"onScrollEnd":l!=null&&Ie("scrollend",t);break;case"onClick":l!=null&&(t.onclick=yr);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"&&(f=a.endsWith("Capture"),r=a.slice(2,f?a.length-7:void 0),y=t[gt]||null,y=y!=null?y[a]:null,typeof y=="function"&&t.removeEventListener(r,y,f),typeof l=="function")){typeof y!="function"&&y!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(r,l,f);break e}a in t?t[a]=l:l===!0?t.setAttribute(a,""):Vt(t,a,l)}}}function Ft(t,r,a){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ie("error",t),Ie("load",t);var l=!1,f=!1,y;for(y in a)if(a.hasOwnProperty(y)){var w=a[y];if(w!=null)switch(y){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:rt(t,r,y,w,a,null)}}f&&rt(t,r,"srcSet",a.srcSet,a,null),l&&rt(t,r,"src",a.src,a,null);return;case"input":Ie("invalid",t);var O=y=w=f=null,R=null,V=null;for(l in a)if(a.hasOwnProperty(l)){var Z=a[l];if(Z!=null)switch(l){case"name":f=Z;break;case"type":w=Z;break;case"checked":R=Z;break;case"defaultChecked":V=Z;break;case"value":y=Z;break;case"defaultValue":O=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(i(137,r));break;default:rt(t,r,l,Z,a,null)}}Zm(t,y,O,R,V,w,f,!1);return;case"select":Ie("invalid",t),l=w=y=null;for(f in a)if(a.hasOwnProperty(f)&&(O=a[f],O!=null))switch(f){case"value":y=O;break;case"defaultValue":w=O;break;case"multiple":l=O;default:rt(t,r,f,O,a,null)}r=y,a=w,t.multiple=!!l,r!=null?ui(t,!!l,r,!1):a!=null&&ui(t,!!l,a,!0);return;case"textarea":Ie("invalid",t),y=f=l=null;for(w in a)if(a.hasOwnProperty(w)&&(O=a[w],O!=null))switch(w){case"value":l=O;break;case"defaultValue":f=O;break;case"children":y=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(i(91));break;default:rt(t,r,w,O,a,null)}t0(t,l,f,y);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(l=a[R],l!=null))switch(R){case"selected":t.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:rt(t,r,R,l,a,null)}return;case"dialog":Ie("beforetoggle",t),Ie("toggle",t),Ie("cancel",t),Ie("close",t);break;case"iframe":case"object":Ie("load",t);break;case"video":case"audio":for(l=0;l<Qa.length;l++)Ie(Qa[l],t);break;case"image":Ie("error",t),Ie("load",t);break;case"details":Ie("toggle",t);break;case"embed":case"source":case"link":Ie("error",t),Ie("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(V in a)if(a.hasOwnProperty(V)&&(l=a[V],l!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:rt(t,r,V,l,a,null)}return;default:if(Gu(r)){for(Z in a)a.hasOwnProperty(Z)&&(l=a[Z],l!==void 0&&Mh(t,r,Z,l,a,void 0));return}}for(O in a)a.hasOwnProperty(O)&&(l=a[O],l!=null&&rt(t,r,O,l,a,null))}function Bw(t,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 f=null,y=null,w=null,O=null,R=null,V=null,Z=null;for(X in a){var ie=a[X];if(a.hasOwnProperty(X)&&ie!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":R=ie;default:l.hasOwnProperty(X)||rt(t,r,X,null,l,ie)}}for(var Y in l){var X=l[Y];if(ie=a[Y],l.hasOwnProperty(Y)&&(X!=null||ie!=null))switch(Y){case"type":y=X;break;case"name":f=X;break;case"checked":V=X;break;case"defaultChecked":Z=X;break;case"value":w=X;break;case"defaultValue":O=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(i(137,r));break;default:X!==ie&&rt(t,r,Y,X,l,ie)}}Hu(t,w,O,R,V,Z,y,f);return;case"select":X=w=O=Y=null;for(y in a)if(R=a[y],a.hasOwnProperty(y)&&R!=null)switch(y){case"value":break;case"multiple":X=R;default:l.hasOwnProperty(y)||rt(t,r,y,null,l,R)}for(f in l)if(y=l[f],R=a[f],l.hasOwnProperty(f)&&(y!=null||R!=null))switch(f){case"value":Y=y;break;case"defaultValue":O=y;break;case"multiple":w=y;default:y!==R&&rt(t,r,f,y,l,R)}r=O,a=w,l=X,Y!=null?ui(t,!!a,Y,!1):!!l!=!!a&&(r!=null?ui(t,!!a,r,!0):ui(t,!!a,a?[]:"",!1));return;case"textarea":X=Y=null;for(O in a)if(f=a[O],a.hasOwnProperty(O)&&f!=null&&!l.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:rt(t,r,O,null,l,f)}for(w in l)if(f=l[w],y=a[w],l.hasOwnProperty(w)&&(f!=null||y!=null))switch(w){case"value":Y=f;break;case"defaultValue":X=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(i(91));break;default:f!==y&&rt(t,r,w,f,l,y)}e0(t,Y,X);return;case"option":for(var ve in a)if(Y=a[ve],a.hasOwnProperty(ve)&&Y!=null&&!l.hasOwnProperty(ve))switch(ve){case"selected":t.selected=!1;break;default:rt(t,r,ve,null,l,Y)}for(R in l)if(Y=l[R],X=a[R],l.hasOwnProperty(R)&&Y!==X&&(Y!=null||X!=null))switch(R){case"selected":t.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:rt(t,r,R,Y,l,X)}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 Te in a)Y=a[Te],a.hasOwnProperty(Te)&&Y!=null&&!l.hasOwnProperty(Te)&&rt(t,r,Te,null,l,Y);for(V in l)if(Y=l[V],X=a[V],l.hasOwnProperty(V)&&Y!==X&&(Y!=null||X!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(i(137,r));break;default:rt(t,r,V,Y,l,X)}return;default:if(Gu(r)){for(var st in a)Y=a[st],a.hasOwnProperty(st)&&Y!==void 0&&!l.hasOwnProperty(st)&&Mh(t,r,st,void 0,l,Y);for(Z in l)Y=l[Z],X=a[Z],!l.hasOwnProperty(Z)||Y===X||Y===void 0&&X===void 0||Mh(t,r,Z,Y,l,X);return}}for(var $ in a)Y=a[$],a.hasOwnProperty($)&&Y!=null&&!l.hasOwnProperty($)&&rt(t,r,$,null,l,Y);for(ie in l)Y=l[ie],X=a[ie],!l.hasOwnProperty(ie)||Y===X||Y==null&&X==null||rt(t,r,ie,Y,l,X)}function sg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Uw(){if(typeof performance.getEntriesByType=="function"){for(var t=0,r=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],y=f.transferSize,w=f.initiatorType,O=f.duration;if(y&&O&&sg(w)){for(w=0,O=f.responseEnd,l+=1;l<a.length;l++){var R=a[l],V=R.startTime;if(V>O)break;var Z=R.transferSize,ie=R.initiatorType;Z&&sg(ie)&&(R=R.responseEnd,w+=Z*(R<O?1:(O-V)/(R-V)))}if(--l,r+=8*(y+w)/(f.duration/1e3),t++,10<t)break}}if(0<t)return r/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Rh=null,Dh=null;function Gl(t){return t.nodeType===9?t:t.ownerDocument}function ig(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ag(t,r){if(t===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&r==="foreignObject"?0:t}function Lh(t,r){return t==="textarea"||t==="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 qh=null;function zw(){var t=window.event;return t&&t.type==="popstate"?t===qh?!1:(qh=t,!0):(qh=null,!1)}var og=typeof setTimeout=="function"?setTimeout:void 0,$w=typeof clearTimeout=="function"?clearTimeout:void 0,lg=typeof Promise=="function"?Promise:void 0,Iw=typeof queueMicrotask=="function"?queueMicrotask:typeof lg<"u"?function(t){return lg.resolve(null).then(t).catch(Hw)}:og;function Hw(t){setTimeout(function(){throw t})}function cs(t){return t==="head"}function cg(t,r){var a=r,l=0;do{var f=a.nextSibling;if(t.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(l===0){t.removeChild(f),Ii(r);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Wa(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,Wa(a);for(var y=a.firstChild;y;){var w=y.nextSibling,O=y.nodeName;y[Rt]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&y.rel.toLowerCase()==="stylesheet"||a.removeChild(y),y=w}}else a==="body"&&Wa(t.ownerDocument.body);a=f}while(a);Ii(r)}function ug(t,r){var a=t;t=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(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=l}while(a)}function Ph(t){var r=t.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":Ph(a),ci(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function Fw(t,r,a,l){for(;t.nodeType===1;){var f=a;if(t.nodeName.toLowerCase()!==r.toLowerCase()){if(!l&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(l){if(!t[Rt])switch(r){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(y=t.getAttribute("rel"),y==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(y!==f.rel||t.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||t.getAttribute("title")!==(f.title==null?null:f.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(y=t.getAttribute("src"),(y!==(f.src==null?null:f.src)||t.getAttribute("type")!==(f.type==null?null:f.type)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&y&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(r==="input"&&t.type==="hidden"){var y=f.name==null?null:""+f.name;if(f.type==="hidden"&&t.getAttribute("name")===y)return t}else return t;if(t=Bn(t.nextSibling),t===null)break}return null}function Gw(t,r,a){if(r==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Bn(t.nextSibling),t===null))return null;return t}function fg(t,r){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!r||(t=Bn(t.nextSibling),t===null))return null;return t}function Bh(t){return t.data==="$?"||t.data==="$~"}function Uh(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Vw(t,r){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=r;else if(t.data!=="$?"||a.readyState!=="loading")r();else{var l=function(){r(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),t._reactRetry=l}}function Bn(t){for(;t!=null;t=t.nextSibling){var r=t.nodeType;if(r===1||r===3)break;if(r===8){if(r=t.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return t}var zh=null;function hg(t){t=t.nextSibling;for(var r=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(r===0)return Bn(t.nextSibling);r--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||r++}t=t.nextSibling}return null}function dg(t){t=t.previousSibling;for(var r=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(r===0)return t;r--}else a!=="/$"&&a!=="/&"||r++}t=t.previousSibling}return null}function mg(t,r,a){switch(r=Gl(a),t){case"html":if(t=r.documentElement,!t)throw Error(i(452));return t;case"head":if(t=r.head,!t)throw Error(i(453));return t;case"body":if(t=r.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function Wa(t){for(var r=t.attributes;r.length;)t.removeAttributeNode(r[0]);ci(t)}var Un=new Map,pg=new Set;function Vl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Mr=J.d;J.d={f:Yw,r:Kw,D:Jw,C:Qw,L:Xw,m:Ww,X:eS,S:Zw,M:tS};function Yw(){var t=Mr.f(),r=Pl();return t||r}function Kw(t){var r=N(t);r!==null&&r.tag===5&&r.type==="form"?Mp(r):Mr.r(t)}var Ui=typeof document>"u"?null:document;function yg(t,r,a){var l=Ui;if(l&&typeof r=="string"&&r){var f=Cn(r);f='link[rel="'+t+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),pg.has(f)||(pg.add(f),t={rel:t,crossOrigin:a,href:r},l.querySelector(f)===null&&(r=l.createElement("link"),Ft(r,"link",t),L(r),l.head.appendChild(r)))}}function Jw(t){Mr.D(t),yg("dns-prefetch",t,null)}function Qw(t,r){Mr.C(t,r),yg("preconnect",t,r)}function Xw(t,r,a){Mr.L(t,r,a);var l=Ui;if(l&&t&&r){var f='link[rel="preload"][as="'+Cn(r)+'"]';r==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Cn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Cn(a.imageSizes)+'"]')):f+='[href="'+Cn(t)+'"]';var y=f;switch(r){case"style":y=zi(t);break;case"script":y=$i(t)}Un.has(y)||(t=b({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:t,as:r},a),Un.set(y,t),l.querySelector(f)!==null||r==="style"&&l.querySelector(Za(y))||r==="script"&&l.querySelector(eo(y))||(r=l.createElement("link"),Ft(r,"link",t),L(r),l.head.appendChild(r)))}}function Ww(t,r){Mr.m(t,r);var a=Ui;if(a&&t){var l=r&&typeof r.as=="string"?r.as:"script",f='link[rel="modulepreload"][as="'+Cn(l)+'"][href="'+Cn(t)+'"]',y=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=$i(t)}if(!Un.has(y)&&(t=b({rel:"modulepreload",href:t},r),Un.set(y,t),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(eo(y)))return}l=a.createElement("link"),Ft(l,"link",t),L(l),a.head.appendChild(l)}}}function Zw(t,r,a){Mr.S(t,r,a);var l=Ui;if(l&&t){var f=T(l).hoistableStyles,y=zi(t);r=r||"default";var w=f.get(y);if(!w){var O={loading:0,preload:null};if(w=l.querySelector(Za(y)))O.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":r},a),(a=Un.get(y))&&$h(t,a);var R=w=l.createElement("link");L(R),Ft(R,"link",t),R._p=new Promise(function(V,Z){R.onload=V,R.onerror=Z}),R.addEventListener("load",function(){O.loading|=1}),R.addEventListener("error",function(){O.loading|=2}),O.loading|=4,Yl(w,r,l)}w={type:"stylesheet",instance:w,count:1,state:O},f.set(y,w)}}}function eS(t,r){Mr.X(t,r);var a=Ui;if(a&&t){var l=T(a).hoistableScripts,f=$i(t),y=l.get(f);y||(y=a.querySelector(eo(f)),y||(t=b({src:t,async:!0},r),(r=Un.get(f))&&Ih(t,r),y=a.createElement("script"),L(y),Ft(y,"link",t),a.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},l.set(f,y))}}function tS(t,r){Mr.M(t,r);var a=Ui;if(a&&t){var l=T(a).hoistableScripts,f=$i(t),y=l.get(f);y||(y=a.querySelector(eo(f)),y||(t=b({src:t,async:!0,type:"module"},r),(r=Un.get(f))&&Ih(t,r),y=a.createElement("script"),L(y),Ft(y,"link",t),a.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},l.set(f,y))}}function gg(t,r,a,l){var f=(f=Ot.current)?Vl(f):null;if(!f)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(r=zi(a.href),a=T(f).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"){t=zi(a.href);var y=T(f).hoistableStyles,w=y.get(t);if(w||(f=f.ownerDocument||f,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(t,w),(y=f.querySelector(Za(t)))&&!y._p&&(w.instance=y,w.state.loading=5),Un.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Un.set(t,a),y||nS(f,t,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=$i(a),a=T(f).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,t))}}function zi(t){return'href="'+Cn(t)+'"'}function Za(t){return'link[rel="stylesheet"]['+t+"]"}function bg(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function nS(t,r,a,l){t.querySelector('link[rel="preload"][as="style"]['+r+"]")?l.loading=1:(r=t.createElement("link"),l.preload=r,r.addEventListener("load",function(){return l.loading|=1}),r.addEventListener("error",function(){return l.loading|=2}),Ft(r,"link",a),L(r),t.head.appendChild(r))}function $i(t){return'[src="'+Cn(t)+'"]'}function eo(t){return"script[async]"+t}function xg(t,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var l=t.querySelector('style[data-href~="'+Cn(a.href)+'"]');if(l)return r.instance=l,L(l),l;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(t.ownerDocument||t).createElement("style"),L(l),Ft(l,"style",f),Yl(l,a.precedence,t),r.instance=l;case"stylesheet":f=zi(a.href);var y=t.querySelector(Za(f));if(y)return r.state.loading|=4,r.instance=y,L(y),y;l=bg(a),(f=Un.get(f))&&$h(l,f),y=(t.ownerDocument||t).createElement("link"),L(y);var w=y;return w._p=new Promise(function(O,R){w.onload=O,w.onerror=R}),Ft(y,"link",l),r.state.loading|=4,Yl(y,a.precedence,t),r.instance=y;case"script":return y=$i(a.src),(f=t.querySelector(eo(y)))?(r.instance=f,L(f),f):(l=a,(f=Un.get(y))&&(l=b({},a),Ih(l,f)),t=t.ownerDocument||t,f=t.createElement("script"),L(f),Ft(f,"link",l),t.head.appendChild(f),r.instance=f);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,Yl(l,a.precedence,t));return r.instance}function Yl(t,r,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,y=f,w=0;w<l.length;w++){var O=l[w];if(O.dataset.precedence===r)y=O;else if(y!==f)break}y?y.parentNode.insertBefore(t,y.nextSibling):(r=a.nodeType===9?a.head:a,r.insertBefore(t,r.firstChild))}function $h(t,r){t.crossOrigin==null&&(t.crossOrigin=r.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=r.referrerPolicy),t.title==null&&(t.title=r.title)}function Ih(t,r){t.crossOrigin==null&&(t.crossOrigin=r.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=r.referrerPolicy),t.integrity==null&&(t.integrity=r.integrity)}var Kl=null;function vg(t,r,a){if(Kl===null){var l=new Map,f=Kl=new Map;f.set(a,l)}else f=Kl,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(t))return l;for(l.set(t,null),a=a.getElementsByTagName(t),f=0;f<a.length;f++){var y=a[f];if(!(y[Rt]||y[it]||t==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var w=y.getAttribute(r)||"";w=t+w;var O=l.get(w);O?O.push(y):l.set(w,[y])}}return l}function _g(t,r,a){t=t.ownerDocument||t,t.head.insertBefore(a,r==="title"?t.querySelector("head > title"):null)}function rS(t,r,a){if(a===1||r.itemProp!=null)return!1;switch(t){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 t=r.disabled,typeof r.precedence=="string"&&t==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 wg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function sS(t,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 f=zi(l.href),y=r.querySelector(Za(f));if(y){r=y._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(t.count++,t=Jl.bind(t),r.then(t,t)),a.state.loading|=4,a.instance=y,L(y);return}y=r.ownerDocument||r,l=bg(l),(f=Un.get(f))&&$h(l,f),y=y.createElement("link"),L(y);var w=y;w._p=new Promise(function(O,R){w.onload=O,w.onerror=R}),Ft(y,"link",l),a.instance=y}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,r),(r=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=Jl.bind(t),r.addEventListener("load",a),r.addEventListener("error",a))}}var Hh=0;function iS(t,r){return t.stylesheets&&t.count===0&&Xl(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var l=setTimeout(function(){if(t.stylesheets&&Xl(t,t.stylesheets),t.unsuspend){var y=t.unsuspend;t.unsuspend=null,y()}},6e4+r);0<t.imgBytes&&Hh===0&&(Hh=62500*Uw());var f=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Xl(t,t.stylesheets),t.unsuspend)){var y=t.unsuspend;t.unsuspend=null,y()}},(t.imgBytes>Hh?50:800)+r);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function Jl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Ql=null;function Xl(t,r){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Ql=new Map,r.forEach(aS,t),Ql=null,Jl.call(t))}function aS(t,r){if(!(r.state.loading&4)){var a=Ql.get(t);if(a)var l=a.get(null);else{a=new Map,Ql.set(t,a);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<f.length;y++){var w=f[y];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),l=w)}l&&a.set(null,l)}f=r.instance,w=f.getAttribute("data-precedence"),y=a.get(w)||l,y===l&&a.set(null,f),a.set(w,f),this.count++,l=Jl.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),y?y.parentNode.insertBefore(f,y.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(f,t.firstChild)),r.state.loading|=4}}var to={$$typeof:ne,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function oS(t,r,a,l,f,y,w,O,R){this.tag=1,this.containerInfo=t,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=f,this.onCaughtError=y,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Sg(t,r,a,l,f,y,w,O,R,V,Z,ie){return t=new oS(t,r,a,w,R,V,Z,ie,O),r=1,y===!0&&(r|=24),y=mn(3,null,null,r),t.current=y,y.stateNode=t,r=wf(),r.refCount++,t.pooledCache=r,r.refCount++,y.memoizedState={element:l,isDehydrated:a,cache:r},Af(y),t}function Eg(t){return t?(t=bi,t):bi}function Og(t,r,a,l,f,y){f=Eg(f),l.context===null?l.context=f:l.pendingContext=f,l=Wr(r),l.payload={element:a},y=y===void 0?null:y,y!==null&&(l.callback=y),a=Zr(t,l,r),a!==null&&(cn(a,t,r),Ra(a,t,r))}function Ag(t,r){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<r?a:r}}function Fh(t,r){Ag(t,r),(t=t.alternate)&&Ag(t,r)}function jg(t){if(t.tag===13||t.tag===31){var r=Us(t,67108864);r!==null&&cn(r,t,67108864),Fh(t,67108864)}}function kg(t){if(t.tag===13||t.tag===31){var r=xn();r=mr(r);var a=Us(t,r);a!==null&&cn(a,t,r),Fh(t,r)}}var Wl=!0;function lS(t,r,a,l){var f=H.T;H.T=null;var y=J.p;try{J.p=2,Gh(t,r,a,l)}finally{J.p=y,H.T=f}}function cS(t,r,a,l){var f=H.T;H.T=null;var y=J.p;try{J.p=8,Gh(t,r,a,l)}finally{J.p=y,H.T=f}}function Gh(t,r,a,l){if(Wl){var f=Vh(l);if(f===null)Ch(t,r,l,Zl,a),Tg(t,l);else if(fS(f,t,r,a,l))l.stopPropagation();else if(Tg(t,l),r&4&&-1<uS.indexOf(t)){for(;f!==null;){var y=N(f);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var w=Fn(y.pendingLanes);if(w!==0){var O=y;for(O.pendingLanes|=2,O.entangledLanes|=2;w;){var R=1<<31-Gt(w);O.entanglements[1]|=R,w&=~R}ir(y),(Qe&6)===0&&(Ll=ut()+500,Ja(0))}}break;case 31:case 13:O=Us(y,2),O!==null&&cn(O,y,2),Pl(),Fh(y,2)}if(y=Vh(l),y===null&&Ch(t,r,l,Zl,a),y===f)break;f=y}f!==null&&l.stopPropagation()}else Ch(t,r,l,null,a)}}function Vh(t){return t=Yu(t),Yh(t)}var Zl=null;function Yh(t){if(Zl=null,t=A(t),t!==null){var r=c(t);if(r===null)t=null;else{var a=r.tag;if(a===13){if(t=d(r),t!==null)return t;t=null}else if(a===31){if(t=p(r),t!==null)return t;t=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;t=null}else r!==t&&(t=null)}}return Zl=t,null}function Ng(t){switch(t){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(Uu()){case Io:return 2;case Ho:return 8;case ai:case zu:return 32;case Fo:return 268435456;default:return 32}default:return 32}}var Kh=!1,us=null,fs=null,hs=null,no=new Map,ro=new Map,ds=[],uS="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 Tg(t,r){switch(t){case"focusin":case"focusout":us=null;break;case"dragenter":case"dragleave":fs=null;break;case"mouseover":case"mouseout":hs=null;break;case"pointerover":case"pointerout":no.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":ro.delete(r.pointerId)}}function so(t,r,a,l,f,y){return t===null||t.nativeEvent!==y?(t={blockedOn:r,domEventName:a,eventSystemFlags:l,nativeEvent:y,targetContainers:[f]},r!==null&&(r=N(r),r!==null&&jg(r)),t):(t.eventSystemFlags|=l,r=t.targetContainers,f!==null&&r.indexOf(f)===-1&&r.push(f),t)}function fS(t,r,a,l,f){switch(r){case"focusin":return us=so(us,t,r,a,l,f),!0;case"dragenter":return fs=so(fs,t,r,a,l,f),!0;case"mouseover":return hs=so(hs,t,r,a,l,f),!0;case"pointerover":var y=f.pointerId;return no.set(y,so(no.get(y)||null,t,r,a,l,f)),!0;case"gotpointercapture":return y=f.pointerId,ro.set(y,so(ro.get(y)||null,t,r,a,l,f)),!0}return!1}function Cg(t){var r=A(t.target);if(r!==null){var a=c(r);if(a!==null){if(r=a.tag,r===13){if(r=d(a),r!==null){t.blockedOn=r,Vo(t.priority,function(){kg(a)});return}}else if(r===31){if(r=p(a),r!==null){t.blockedOn=r,Vo(t.priority,function(){kg(a)});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function ec(t){if(t.blockedOn!==null)return!1;for(var r=t.targetContainers;0<r.length;){var a=Vh(t.nativeEvent);if(a===null){a=t.nativeEvent;var l=new a.constructor(a.type,a);Vu=l,a.target.dispatchEvent(l),Vu=null}else return r=N(a),r!==null&&jg(r),t.blockedOn=a,!1;r.shift()}return!0}function Mg(t,r,a){ec(t)&&a.delete(r)}function hS(){Kh=!1,us!==null&&ec(us)&&(us=null),fs!==null&&ec(fs)&&(fs=null),hs!==null&&ec(hs)&&(hs=null),no.forEach(Mg),ro.forEach(Mg)}function tc(t,r){t.blockedOn===r&&(t.blockedOn=null,Kh||(Kh=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,hS)))}var nc=null;function Rg(t){nc!==t&&(nc=t,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){nc===t&&(nc=null);for(var r=0;r<t.length;r+=3){var a=t[r],l=t[r+1],f=t[r+2];if(typeof l!="function"){if(Yh(l||a)===null)continue;break}var y=N(a);y!==null&&(t.splice(r,3),r-=3,Vf(y,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function Ii(t){function r(R){return tc(R,t)}us!==null&&tc(us,t),fs!==null&&tc(fs,t),hs!==null&&tc(hs,t),no.forEach(r),ro.forEach(r);for(var a=0;a<ds.length;a++){var l=ds[a];l.blockedOn===t&&(l.blockedOn=null)}for(;0<ds.length&&(a=ds[0],a.blockedOn===null);)Cg(a),a.blockedOn===null&&ds.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],y=a[l+1],w=f[gt]||null;if(typeof y=="function")w||Rg(a);else if(w){var O=null;if(y&&y.hasAttribute("formAction")){if(f=y,w=y[gt]||null)O=w.formAction;else if(Yh(f)!==null)continue}else O=w.action;typeof O=="function"?a[l+1]=O:(a.splice(l,3),l-=3),Rg(a)}}}function Dg(){function t(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(w){return f=w})},focusReset:"manual",scroll:"manual"})}function r(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),f!==null&&(f(),f=null)}}}function Jh(t){this._internalRoot=t}rc.prototype.render=Jh.prototype.render=function(t){var r=this._internalRoot;if(r===null)throw Error(i(409));var a=r.current,l=xn();Og(a,l,t,r,null,null)},rc.prototype.unmount=Jh.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var r=t.containerInfo;Og(t.current,2,null,t,null,null),Pl(),r[hn]=null}};function rc(t){this._internalRoot=t}rc.prototype.unstable_scheduleHydration=function(t){if(t){var r=ya();t={blockedOn:null,target:t,priority:r};for(var a=0;a<ds.length&&r!==0&&r<ds[a].priority;a++);ds.splice(a,0,t),a===0&&Cg(t)}};var Lg=e.version;if(Lg!=="19.2.4")throw Error(i(527,Lg,"19.2.4"));J.findDOMNode=function(t){var r=t._reactInternals;if(r===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=u(r),t=t!==null?m(t):null,t=t===null?null:t.stateNode,t};var dS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var sc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sc.isDisabled&&sc.supportsFiber)try{Ts=sc.inject(dS),_t=sc}catch{}}return io.createRoot=function(t,r){if(!o(t))throw Error(i(299));var a=!1,l="",f=Ip,y=Hp,w=Fp;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(l=r.identifierPrefix),r.onUncaughtError!==void 0&&(f=r.onUncaughtError),r.onCaughtError!==void 0&&(y=r.onCaughtError),r.onRecoverableError!==void 0&&(w=r.onRecoverableError)),r=Sg(t,1,!1,null,null,a,l,null,f,y,w,Dg),t[hn]=r.current,Th(t),new Jh(r)},io.hydrateRoot=function(t,r,a){if(!o(t))throw Error(i(299));var l=!1,f="",y=Ip,w=Hp,O=Fp,R=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(O=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),r=Sg(t,1,!0,r,a??null,l,f,R,y,w,O,Dg),r.context=Eg(null),a=r.current,l=xn(),l=mr(l),f=Wr(l),f.callback=null,Zr(a,f,l),a=l,r.current.lanes=a,Gn(r,a),ir(r),t[hn]=r.current,Th(t),new rc(r)},io.version="19.2.4",io}var Ig;function aE(){if(Ig)return Qh.exports;Ig=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(e){console.error(e)}}return n(),Qh.exports=iE(),Qh.exports}var oE=aE();const lE="modulepreload",cE=function(n,e){return new URL(n,e).href},Hg={},Oe=function(e,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 p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),u=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=d(s.map(m=>{if(m=cE(m,i),m in Hg)return;Hg[m]=!0;const b=m.endsWith(".css"),x=b?'[rel="stylesheet"]':"";if(!!i)for(let S=p.length-1;S>=0;S--){const C=p[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":lE,b||(_.as="script"),_.crossOrigin="",_.href=m,u&&_.setAttribute("nonce",u),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 p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return o.then(d=>{for(const p of d||[])p.status==="rejected"&&c(p.reason);return e().catch(c)})};function Ou(n){try{const e=n.split(".");if(e.length!==3)return null;const s=atob(e[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function xx(n){const e=Ou(n);return!e||typeof e.exp!="number"?null:e.exp}function fm(n,e=0){const s=xx(n);return s===null?!0:Date.now()/1e3>=s-e}const Yt=window.__LT_BASE__??"",Sd=`${Yt}/api`;class Fg extends Error{constructor(e,s,i){super(e),this.status=s,this.body=i,this.name="ApiError"}}let bs=null;function ic(n){bs=n}function Ed(){return bs}const uE="X-LT-Acting-Token",fE="X-LT-Acting-Remaining";let tu=null,nu=null;function Gg(n){tu=n}let ru=null;function Vg(n){ru=n}function Yg(n){nu=n}function hE(n){const e=n==null?void 0:n.error;return typeof e=="string"&&/acting[- ]identity/i.test(e)}async function Kg(){const n=sessionStorage.getItem("lt_credentials");if(!n)return null;try{const{username:e,password:s}=JSON.parse(n),i=await fetch(`${Sd}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,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 ps=null;async function vx(n,e={}){const s={"Content-Type":"application/json",...e.headers};if(bs){if(fm(bs)){ps||(ps=Kg().finally(()=>{ps=null}));const p=await ps;if(p)bs=p,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:p}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${bs}`}const o=(e.method??"GET").toUpperCase()==="GET"?null:(tu==null?void 0:tu())??null;o&&(s[uE]=o);let c=await fetch(`${Sd}${n}`,{...e,headers:s});const d=o?c.headers.get(fE):null;if(o&&d!==null&&(ru==null||ru(o,d==="unbounded"?null:Number(d))),c.status===401&&o){const p=await c.clone().json().catch(()=>null);if(hE(p))throw nu==null||nu(),new Fg(p.error,401,p)}if(c.status===401&&bs){ps||(ps=Kg().finally(()=>{ps=null}));const p=await ps;if(p&&(bs=p,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:p}})),s.Authorization=`Bearer ${p}`,c=await fetch(`${Sd}${n}`,{...e,headers:s})),c.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(c.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!c.ok){const p=await c.json().catch(()=>({error:c.statusText}));throw new Fg(p.message||p.error||c.statusText,c.status,p)}return c}async function ue(n,e={}){return(await vx(n,e)).json()}async function z5(n,e={}){const s=await vx(n,e);return{blob:await s.blob(),headers:s.headers}}const dE="lt_ai_override";let ac=null;function hm(){return ac||(ac=fetch(`${Yt}/api/settings`).then(n=>{if(!n.ok)throw new Error(`settings ${n.status}`);return n.json()}).catch(n=>{throw ac=null,n})),ac}function mE(){try{if(localStorage.getItem(dE)==="off")return!1}catch{}return null}function Hn(){var s;const n=Pe({queryKey:["settings"],queryFn:hm,staleTime:1/0}),e=mE();return n.data&&e===!1&&((s=n.data.ai)!=null&&s.enabled)?{...n,data:{...n.data,ai:{enabled:!1}}}:n}function pE(n){var u,m,b;const{data:e}=Hn(),s=((u=e==null?void 0:e.auth)==null?void 0:u.ssoKeepaliveSeconds)??0,i=((m=e==null?void 0:e.auth)==null?void 0:m.ssoKeepaliveIdleTimeoutSeconds)??0,o=E.useRef(Date.now()),c=E.useRef(Date.now()),d=E.useRef(!1),g=!!n&&((b=Ou(n))==null?void 0:b.sso)===!0&&s>0;E.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(`${Yt}/api/auth/sso`,{method:"POST"});if(C.status===401||C.status===403){window.dispatchEvent(new CustomEvent("auth:unauthorized"));return}if(!C.ok)return;const B=await C.json().catch(()=>null);B!=null&&B.token&&(c.current=Date.now(),window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:B.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 _x=E.createContext(null),yE=300;function Zh(n,e){if(fm(n))return null;const s=Ou(n);if(!s)return null;const i=e??(()=>{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 gE({children:n}){const[e,s]=E.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?fm(b)?(sessionStorage.removeItem("lt_token"),null):(ic(b),Zh(b)):null}),i=E.useRef(void 0),o=E.useCallback(b=>{clearTimeout(i.current);const x=xx(b);if(!x)return;const v=(x-yE)*1e3-Date.now();v<=0||(i.current=setTimeout(async()=>{try{const _=Ou(b);if(_!=null&&_.sso){const te=await fetch(`${Yt}/api/auth/sso`,{method:"POST"});if(!te.ok)return;const M=await te.json();M.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:M.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:C,password:B}=JSON.parse(S),q=await fetch(`${Yt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:C,password:B})});if(!q.ok)return;const ne=await q.json();ne.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:ne.token}}))}catch{}},v))},[]),c=E.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=Zh(b,_);S&&(ic(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=E.useCallback(()=>{clearTimeout(i.current);const b=sessionStorage.getItem("lt_sso_logout_url");ic(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)},[]);E.useEffect(()=>{const b=()=>d(),x=v=>{var C;const _=(C=v.detail)==null?void 0:C.token;if(!_)return;const S=Zh(_);S&&(ic(_),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]),E.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&e&&o(b),()=>clearTimeout(i.current)},[]);const p=(e==null?void 0:e.roles.some(b=>b.type==="superadmin"))??!1,g=E.useCallback(b=>(e==null?void 0:e.roles.some(x=>x.role===b))??!1,[e]),u=E.useCallback(b=>(e==null?void 0:e.roles.some(x=>x.type===b))??!1,[e]),m=(e==null?void 0:e.roles.map(b=>b.role))??[];return h.jsxs(_x.Provider,{value:{user:e,isAuthenticated:!!e,isSuperAdmin:p,login:c,logout:d,hasRole:g,hasRoleType:u,userRoleNames:m},children:[h.jsx(bE,{authenticated:e!==null}),n]})}function bE({authenticated:n}){return pE(n?sessionStorage.getItem("lt_token"):null),null}function qt(){const n=E.useContext(_x);if(!n)throw new Error("useAuth must be used within AuthProvider");return n}async function xE(n){if(!Ed())return{kind:"session-ended"};try{const e=await ue("/nats-credentials"),s=e.natsWsUrl??n;return s?{kind:"ok",url:s,token:e.natsToken??null}:{kind:"unavailable"}}catch{return Ed()?{kind:"unavailable"}:{kind:"session-ended"}}}const bo={initialDelayMs:1e3,maxDelayMs:6e4,noticeAfterMs:3e4,spreadMs:5e3};function vE(n,e,s=Math.random){const i=Math.min(e.maxDelayMs,e.initialDelayMs*2**Math.max(0,n));return Math.round(i/2+s()*(i/2))}function Jg(n,e=Math.random){return Math.round(e()*n.spreadMs)}function Qg(n){const e=(s,i)=>typeof s=="number"&&Number.isFinite(s)&&s>0?s:i;return{initialDelayMs:e(n==null?void 0:n.initialDelayMs,bo.initialDelayMs),maxDelayMs:e(n==null?void 0:n.maxDelayMs,bo.maxDelayMs),noticeAfterMs:e(n==null?void 0:n.noticeAfterMs,bo.noticeAfterMs),spreadMs:e(n==null?void 0:n.spreadMs,bo.spreadMs)}}const jn=new Uint8Array(0),si=new TextEncoder,En=new TextDecoder;function _E(...n){let e=0;for(let o=0;o<n.length;o++)e+=n[o].length;const s=new Uint8Array(e);let i=0;for(let o=0;o<n.length;o++)s.set(n[o],i),i+=n[o].length;return s}function wo(...n){const e=[];for(let s=0;s<n.length;s++)e.push(si.encode(n[s]));return e.length===0?jn:e.length===1?e[0]:_E(...e)}function Xg(n){return!n||n.length===0?"":En.decode(n)}const Wg="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",Zg=36,wE=0xcfd41b9100000,eb=33,SE=333,tb=22;function EE(n){for(let e=0;e<n.length;e++)n[e]=Math.floor(Math.random()*255)}function OE(n){var e;(e=globalThis==null?void 0:globalThis.crypto)!=null&&e.getRandomValues?globalThis.crypto.getRandomValues(n):EE(n)}class AE{constructor(){j(this,"buf");j(this,"seq");j(this,"inc");j(this,"inited");this.buf=new Uint8Array(tb),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*wE),this.inc=Math.floor(Math.random()*(SE-eb)+eb)}setPre(){const e=new Uint8Array(12);OE(e);for(let s=0;s<12;s++){const i=e[s]%36;this.buf[s]=Wg.charCodeAt(i)}}fillSeq(){let e=this.seq;for(let s=tb-1;s>=12;s--)this.buf[s]=Wg.charCodeAt(e%Zg),e=Math.floor(e/Zg)}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 js=new AE;var Dr;(function(n){n.Disconnect="disconnect",n.Reconnect="reconnect",n.Update="update",n.LDM="ldm",n.Error="error"})(Dr||(Dr={}));var Xi;(function(n){n.Reconnecting="reconnecting",n.PingTimer="pingTimer",n.StaleConnection="staleConnection",n.ClientInitiatedReconnect="client initiated reconnect"})(Xi||(Xi={}));var fe;(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"})(fe||(fe={}));function jE(n){return typeof n.code=="string"}class wx{constructor(){j(this,"messages");this.messages=new Map,this.messages.set(fe.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(fe.BadJson,"Bad JSON"),this.messages.set(fe.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(e){return kE.getMessage(e)}getMessage(e){return this.messages.get(e)||e}}const kE=new wx;class be 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=wx.getMessage(s);return new be(o,s,i)}isAuthError(){return this.code===fe.AuthenticationExpired||this.code===fe.AuthorizationViolation||this.code===fe.AccountExpired}isAuthTimeout(){return this.code===fe.AuthenticationTimeout}isPermissionError(){return this.code===fe.PermissionsViolation}isProtocolError(){return this.code===fe.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var wn;(function(n){n[n.Exact=0]="Exact",n[n.CanonicalMIME=1]="CanonicalMIME",n[n.IgnoreCase=2]="IgnoreCase"})(wn||(wn={}));var Zn;(function(n){n.Timer="timer",n.Count="count",n.JitterTimer="jitterTimer",n.SentinelMsg="sentinelMsg"})(Zn||(Zn={}));var So;(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"})(So||(So={}));const fu="Nats-Service-Error",hu="Nats-Service-Error-Code";class du extends Error{constructor(s,i){super(i);j(this,"code");this.code=s}static isServiceError(s){return du.toServiceError(s)!==null}static toServiceError(s){var o,c;const i=((o=s==null?void 0:s.headers)==null?void 0:o.get(hu))||"";if(i!==""){const d=parseInt(i)||400,p=((c=s==null?void 0:s.headers)==null?void 0:c.get(fu))||"";return new du(d,p.length?p:i)}return null}}function Lr(n=""){if(n=n||"_INBOX",typeof n!="string")throw new Error("prefix must be a string");return n.split(".").forEach(e=>{if(e==="*"||e===">")throw new Error(`inbox prefixes cannot have wildcards '${n}'`)}),`${n}.${js.next()}`}const Od="127.0.0.1";var ws;(function(n){n.PING="PING",n.STATS="STATS",n.INFO="INFO"})(ws||(ws={}));function Au(n,...e){for(let s=0;s<e.length;s++){const i=e[s];Object.keys(i).forEach(function(o){n[o]=i[o]})}return n}function oc(n){return En.decode(n).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ia(n,e=!0){const s=e?be.errorForCode(fe.Timeout):null;let i,o;const c=new Promise((d,p)=>{i={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{p(s===null?be.errorForCode(fe.Timeout):s)},n)});return Object.assign(c,i)}function la(n=0){let e;const s=new Promise(i=>{const o=setTimeout(()=>{i()},n);e={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,e)}function dt(){let n={};const e=new Promise((s,i)=>{n={resolve:s,reject:i}});return Object.assign(e,n)}function Sx(n){for(let e=n.length-1;e>0;e--){const s=Math.floor(Math.random()*(e+1));[n[e],n[s]]=[n[s],n[e]]}return n}function NE(n){return n===0?0:Math.floor(n/2+Math.random()*n)}function dm(n=[0,250,250,500,500,3e3,5e3]){Array.isArray(n)||(n=[0,250,250,500,500,3e3,5e3]);const e=n.length-1;return{backoff(s){return NE(s>e?n[e]:n[s])}}}function ht(n){return n*1e6}function mm(n){return Math.floor(n/1e6)}function nb(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 be(`'${n[c]}' is not a valid character for a header key`,fe.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 Pr(n=0,e=""){if(n===0&&e!==""||n>0&&e==="")throw new Error("setting status requires both code and description");return new Ss(n,e)}const ed="NATS/1.0";class Ss{constructor(e=0,s=""){j(this,"_code");j(this,"headers");j(this,"_description");this._code=e,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(e){if(e&&this.headers.size===e.headers.size&&this._code===e._code){for(const[s,i]of this.headers){const o=e.values(s);if(i.length!==o.length)return!1;const c=[...i].sort(),d=[...o].sort();for(let p=0;p<c.length;p++)if(c[p]!==d[p])return!1}return!0}return!1}static decode(e){const s=new Ss,o=En.decode(e).split(`\r
|
|
26
|
+
`).replace(Pw,"")}function rg(t,r){return r=ng(r),ng(t)===r}function rt(t,r,a,l,f,y){switch(a){case"children":typeof l=="string"?r==="body"||r==="textarea"&&l===""||fi(t,l):(typeof l=="number"||typeof l=="bigint")&&r!=="body"&&fi(t,""+l);break;case"className":Vn(t,"class",l);break;case"tabIndex":Vn(t,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Vn(t,a,l);break;case"style":r0(t,l,y);break;case"data":if(r!=="object"){Vn(t,"data",l);break}case"src":case"href":if(l===""&&(r!=="a"||a!=="href")){t.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(a);break}l=Qo(""+l),t.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){t.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 y=="function"&&(a==="formAction"?(r!=="input"&&rt(t,r,"name",f.name,f,null),rt(t,r,"formEncType",f.formEncType,f,null),rt(t,r,"formMethod",f.formMethod,f,null),rt(t,r,"formTarget",f.formTarget,f,null)):(rt(t,r,"encType",f.encType,f,null),rt(t,r,"method",f.method,f,null),rt(t,r,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(a);break}l=Qo(""+l),t.setAttribute(a,l);break;case"onClick":l!=null&&(t.onclick=yr);break;case"onScroll":l!=null&&Ie("scroll",t);break;case"onScrollEnd":l!=null&&Ie("scrollend",t);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"multiple":t.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":t.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"){t.removeAttribute("xlink:href");break}a=Qo(""+l),t.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"?t.setAttribute(a,""+l):t.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"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":l===!0?t.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,l):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?t.setAttribute(a,l):t.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?t.removeAttribute(a):t.setAttribute(a,l);break;case"popover":Ie("beforetoggle",t),Ie("toggle",t),Vt(t,"popover",l);break;case"xlinkActuate":pr(t,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":pr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":pr(t,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":pr(t,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":pr(t,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":pr(t,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":pr(t,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":pr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":pr(t,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Vt(t,"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=f_.get(a)||a,Vt(t,a,l))}}function Mh(t,r,a,l,f,y){switch(a){case"style":r0(t,l,y);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"children":typeof l=="string"?fi(t,l):(typeof l=="number"||typeof l=="bigint")&&fi(t,""+l);break;case"onScroll":l!=null&&Ie("scroll",t);break;case"onScrollEnd":l!=null&&Ie("scrollend",t);break;case"onClick":l!=null&&(t.onclick=yr);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"&&(f=a.endsWith("Capture"),r=a.slice(2,f?a.length-7:void 0),y=t[gt]||null,y=y!=null?y[a]:null,typeof y=="function"&&t.removeEventListener(r,y,f),typeof l=="function")){typeof y!="function"&&y!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(r,l,f);break e}a in t?t[a]=l:l===!0?t.setAttribute(a,""):Vt(t,a,l)}}}function Ft(t,r,a){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ie("error",t),Ie("load",t);var l=!1,f=!1,y;for(y in a)if(a.hasOwnProperty(y)){var w=a[y];if(w!=null)switch(y){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:rt(t,r,y,w,a,null)}}f&&rt(t,r,"srcSet",a.srcSet,a,null),l&&rt(t,r,"src",a.src,a,null);return;case"input":Ie("invalid",t);var O=y=w=f=null,R=null,V=null;for(l in a)if(a.hasOwnProperty(l)){var Z=a[l];if(Z!=null)switch(l){case"name":f=Z;break;case"type":w=Z;break;case"checked":R=Z;break;case"defaultChecked":V=Z;break;case"value":y=Z;break;case"defaultValue":O=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(i(137,r));break;default:rt(t,r,l,Z,a,null)}}Zm(t,y,O,R,V,w,f,!1);return;case"select":Ie("invalid",t),l=w=y=null;for(f in a)if(a.hasOwnProperty(f)&&(O=a[f],O!=null))switch(f){case"value":y=O;break;case"defaultValue":w=O;break;case"multiple":l=O;default:rt(t,r,f,O,a,null)}r=y,a=w,t.multiple=!!l,r!=null?ui(t,!!l,r,!1):a!=null&&ui(t,!!l,a,!0);return;case"textarea":Ie("invalid",t),y=f=l=null;for(w in a)if(a.hasOwnProperty(w)&&(O=a[w],O!=null))switch(w){case"value":l=O;break;case"defaultValue":f=O;break;case"children":y=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(i(91));break;default:rt(t,r,w,O,a,null)}t0(t,l,f,y);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(l=a[R],l!=null))switch(R){case"selected":t.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:rt(t,r,R,l,a,null)}return;case"dialog":Ie("beforetoggle",t),Ie("toggle",t),Ie("cancel",t),Ie("close",t);break;case"iframe":case"object":Ie("load",t);break;case"video":case"audio":for(l=0;l<Qa.length;l++)Ie(Qa[l],t);break;case"image":Ie("error",t),Ie("load",t);break;case"details":Ie("toggle",t);break;case"embed":case"source":case"link":Ie("error",t),Ie("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(V in a)if(a.hasOwnProperty(V)&&(l=a[V],l!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:rt(t,r,V,l,a,null)}return;default:if(Gu(r)){for(Z in a)a.hasOwnProperty(Z)&&(l=a[Z],l!==void 0&&Mh(t,r,Z,l,a,void 0));return}}for(O in a)a.hasOwnProperty(O)&&(l=a[O],l!=null&&rt(t,r,O,l,a,null))}function Bw(t,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 f=null,y=null,w=null,O=null,R=null,V=null,Z=null;for(X in a){var ie=a[X];if(a.hasOwnProperty(X)&&ie!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":R=ie;default:l.hasOwnProperty(X)||rt(t,r,X,null,l,ie)}}for(var Y in l){var X=l[Y];if(ie=a[Y],l.hasOwnProperty(Y)&&(X!=null||ie!=null))switch(Y){case"type":y=X;break;case"name":f=X;break;case"checked":V=X;break;case"defaultChecked":Z=X;break;case"value":w=X;break;case"defaultValue":O=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(i(137,r));break;default:X!==ie&&rt(t,r,Y,X,l,ie)}}Hu(t,w,O,R,V,Z,y,f);return;case"select":X=w=O=Y=null;for(y in a)if(R=a[y],a.hasOwnProperty(y)&&R!=null)switch(y){case"value":break;case"multiple":X=R;default:l.hasOwnProperty(y)||rt(t,r,y,null,l,R)}for(f in l)if(y=l[f],R=a[f],l.hasOwnProperty(f)&&(y!=null||R!=null))switch(f){case"value":Y=y;break;case"defaultValue":O=y;break;case"multiple":w=y;default:y!==R&&rt(t,r,f,y,l,R)}r=O,a=w,l=X,Y!=null?ui(t,!!a,Y,!1):!!l!=!!a&&(r!=null?ui(t,!!a,r,!0):ui(t,!!a,a?[]:"",!1));return;case"textarea":X=Y=null;for(O in a)if(f=a[O],a.hasOwnProperty(O)&&f!=null&&!l.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:rt(t,r,O,null,l,f)}for(w in l)if(f=l[w],y=a[w],l.hasOwnProperty(w)&&(f!=null||y!=null))switch(w){case"value":Y=f;break;case"defaultValue":X=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(i(91));break;default:f!==y&&rt(t,r,w,f,l,y)}e0(t,Y,X);return;case"option":for(var ve in a)if(Y=a[ve],a.hasOwnProperty(ve)&&Y!=null&&!l.hasOwnProperty(ve))switch(ve){case"selected":t.selected=!1;break;default:rt(t,r,ve,null,l,Y)}for(R in l)if(Y=l[R],X=a[R],l.hasOwnProperty(R)&&Y!==X&&(Y!=null||X!=null))switch(R){case"selected":t.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:rt(t,r,R,Y,l,X)}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 Te in a)Y=a[Te],a.hasOwnProperty(Te)&&Y!=null&&!l.hasOwnProperty(Te)&&rt(t,r,Te,null,l,Y);for(V in l)if(Y=l[V],X=a[V],l.hasOwnProperty(V)&&Y!==X&&(Y!=null||X!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(i(137,r));break;default:rt(t,r,V,Y,l,X)}return;default:if(Gu(r)){for(var st in a)Y=a[st],a.hasOwnProperty(st)&&Y!==void 0&&!l.hasOwnProperty(st)&&Mh(t,r,st,void 0,l,Y);for(Z in l)Y=l[Z],X=a[Z],!l.hasOwnProperty(Z)||Y===X||Y===void 0&&X===void 0||Mh(t,r,Z,Y,l,X);return}}for(var $ in a)Y=a[$],a.hasOwnProperty($)&&Y!=null&&!l.hasOwnProperty($)&&rt(t,r,$,null,l,Y);for(ie in l)Y=l[ie],X=a[ie],!l.hasOwnProperty(ie)||Y===X||Y==null&&X==null||rt(t,r,ie,Y,l,X)}function sg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Uw(){if(typeof performance.getEntriesByType=="function"){for(var t=0,r=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],y=f.transferSize,w=f.initiatorType,O=f.duration;if(y&&O&&sg(w)){for(w=0,O=f.responseEnd,l+=1;l<a.length;l++){var R=a[l],V=R.startTime;if(V>O)break;var Z=R.transferSize,ie=R.initiatorType;Z&&sg(ie)&&(R=R.responseEnd,w+=Z*(R<O?1:(O-V)/(R-V)))}if(--l,r+=8*(y+w)/(f.duration/1e3),t++,10<t)break}}if(0<t)return r/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Rh=null,Dh=null;function Gl(t){return t.nodeType===9?t:t.ownerDocument}function ig(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ag(t,r){if(t===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&r==="foreignObject"?0:t}function Lh(t,r){return t==="textarea"||t==="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 qh=null;function zw(){var t=window.event;return t&&t.type==="popstate"?t===qh?!1:(qh=t,!0):(qh=null,!1)}var og=typeof setTimeout=="function"?setTimeout:void 0,$w=typeof clearTimeout=="function"?clearTimeout:void 0,lg=typeof Promise=="function"?Promise:void 0,Iw=typeof queueMicrotask=="function"?queueMicrotask:typeof lg<"u"?function(t){return lg.resolve(null).then(t).catch(Hw)}:og;function Hw(t){setTimeout(function(){throw t})}function cs(t){return t==="head"}function cg(t,r){var a=r,l=0;do{var f=a.nextSibling;if(t.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(l===0){t.removeChild(f),Ii(r);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Wa(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,Wa(a);for(var y=a.firstChild;y;){var w=y.nextSibling,O=y.nodeName;y[Rt]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&y.rel.toLowerCase()==="stylesheet"||a.removeChild(y),y=w}}else a==="body"&&Wa(t.ownerDocument.body);a=f}while(a);Ii(r)}function ug(t,r){var a=t;t=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(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=l}while(a)}function Ph(t){var r=t.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":Ph(a),ci(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function Fw(t,r,a,l){for(;t.nodeType===1;){var f=a;if(t.nodeName.toLowerCase()!==r.toLowerCase()){if(!l&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(l){if(!t[Rt])switch(r){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(y=t.getAttribute("rel"),y==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(y!==f.rel||t.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||t.getAttribute("title")!==(f.title==null?null:f.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(y=t.getAttribute("src"),(y!==(f.src==null?null:f.src)||t.getAttribute("type")!==(f.type==null?null:f.type)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&y&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(r==="input"&&t.type==="hidden"){var y=f.name==null?null:""+f.name;if(f.type==="hidden"&&t.getAttribute("name")===y)return t}else return t;if(t=Bn(t.nextSibling),t===null)break}return null}function Gw(t,r,a){if(r==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Bn(t.nextSibling),t===null))return null;return t}function fg(t,r){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!r||(t=Bn(t.nextSibling),t===null))return null;return t}function Bh(t){return t.data==="$?"||t.data==="$~"}function Uh(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Vw(t,r){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=r;else if(t.data!=="$?"||a.readyState!=="loading")r();else{var l=function(){r(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),t._reactRetry=l}}function Bn(t){for(;t!=null;t=t.nextSibling){var r=t.nodeType;if(r===1||r===3)break;if(r===8){if(r=t.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return t}var zh=null;function hg(t){t=t.nextSibling;for(var r=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(r===0)return Bn(t.nextSibling);r--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||r++}t=t.nextSibling}return null}function dg(t){t=t.previousSibling;for(var r=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(r===0)return t;r--}else a!=="/$"&&a!=="/&"||r++}t=t.previousSibling}return null}function mg(t,r,a){switch(r=Gl(a),t){case"html":if(t=r.documentElement,!t)throw Error(i(452));return t;case"head":if(t=r.head,!t)throw Error(i(453));return t;case"body":if(t=r.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function Wa(t){for(var r=t.attributes;r.length;)t.removeAttributeNode(r[0]);ci(t)}var Un=new Map,pg=new Set;function Vl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Mr=J.d;J.d={f:Yw,r:Kw,D:Jw,C:Qw,L:Xw,m:Ww,X:eS,S:Zw,M:tS};function Yw(){var t=Mr.f(),r=Pl();return t||r}function Kw(t){var r=N(t);r!==null&&r.tag===5&&r.type==="form"?Mp(r):Mr.r(t)}var Ui=typeof document>"u"?null:document;function yg(t,r,a){var l=Ui;if(l&&typeof r=="string"&&r){var f=Cn(r);f='link[rel="'+t+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),pg.has(f)||(pg.add(f),t={rel:t,crossOrigin:a,href:r},l.querySelector(f)===null&&(r=l.createElement("link"),Ft(r,"link",t),L(r),l.head.appendChild(r)))}}function Jw(t){Mr.D(t),yg("dns-prefetch",t,null)}function Qw(t,r){Mr.C(t,r),yg("preconnect",t,r)}function Xw(t,r,a){Mr.L(t,r,a);var l=Ui;if(l&&t&&r){var f='link[rel="preload"][as="'+Cn(r)+'"]';r==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Cn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Cn(a.imageSizes)+'"]')):f+='[href="'+Cn(t)+'"]';var y=f;switch(r){case"style":y=zi(t);break;case"script":y=$i(t)}Un.has(y)||(t=b({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:t,as:r},a),Un.set(y,t),l.querySelector(f)!==null||r==="style"&&l.querySelector(Za(y))||r==="script"&&l.querySelector(eo(y))||(r=l.createElement("link"),Ft(r,"link",t),L(r),l.head.appendChild(r)))}}function Ww(t,r){Mr.m(t,r);var a=Ui;if(a&&t){var l=r&&typeof r.as=="string"?r.as:"script",f='link[rel="modulepreload"][as="'+Cn(l)+'"][href="'+Cn(t)+'"]',y=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=$i(t)}if(!Un.has(y)&&(t=b({rel:"modulepreload",href:t},r),Un.set(y,t),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(eo(y)))return}l=a.createElement("link"),Ft(l,"link",t),L(l),a.head.appendChild(l)}}}function Zw(t,r,a){Mr.S(t,r,a);var l=Ui;if(l&&t){var f=T(l).hoistableStyles,y=zi(t);r=r||"default";var w=f.get(y);if(!w){var O={loading:0,preload:null};if(w=l.querySelector(Za(y)))O.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":r},a),(a=Un.get(y))&&$h(t,a);var R=w=l.createElement("link");L(R),Ft(R,"link",t),R._p=new Promise(function(V,Z){R.onload=V,R.onerror=Z}),R.addEventListener("load",function(){O.loading|=1}),R.addEventListener("error",function(){O.loading|=2}),O.loading|=4,Yl(w,r,l)}w={type:"stylesheet",instance:w,count:1,state:O},f.set(y,w)}}}function eS(t,r){Mr.X(t,r);var a=Ui;if(a&&t){var l=T(a).hoistableScripts,f=$i(t),y=l.get(f);y||(y=a.querySelector(eo(f)),y||(t=b({src:t,async:!0},r),(r=Un.get(f))&&Ih(t,r),y=a.createElement("script"),L(y),Ft(y,"link",t),a.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},l.set(f,y))}}function tS(t,r){Mr.M(t,r);var a=Ui;if(a&&t){var l=T(a).hoistableScripts,f=$i(t),y=l.get(f);y||(y=a.querySelector(eo(f)),y||(t=b({src:t,async:!0,type:"module"},r),(r=Un.get(f))&&Ih(t,r),y=a.createElement("script"),L(y),Ft(y,"link",t),a.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},l.set(f,y))}}function gg(t,r,a,l){var f=(f=Ot.current)?Vl(f):null;if(!f)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(r=zi(a.href),a=T(f).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"){t=zi(a.href);var y=T(f).hoistableStyles,w=y.get(t);if(w||(f=f.ownerDocument||f,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(t,w),(y=f.querySelector(Za(t)))&&!y._p&&(w.instance=y,w.state.loading=5),Un.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Un.set(t,a),y||nS(f,t,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=$i(a),a=T(f).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,t))}}function zi(t){return'href="'+Cn(t)+'"'}function Za(t){return'link[rel="stylesheet"]['+t+"]"}function bg(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function nS(t,r,a,l){t.querySelector('link[rel="preload"][as="style"]['+r+"]")?l.loading=1:(r=t.createElement("link"),l.preload=r,r.addEventListener("load",function(){return l.loading|=1}),r.addEventListener("error",function(){return l.loading|=2}),Ft(r,"link",a),L(r),t.head.appendChild(r))}function $i(t){return'[src="'+Cn(t)+'"]'}function eo(t){return"script[async]"+t}function xg(t,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var l=t.querySelector('style[data-href~="'+Cn(a.href)+'"]');if(l)return r.instance=l,L(l),l;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(t.ownerDocument||t).createElement("style"),L(l),Ft(l,"style",f),Yl(l,a.precedence,t),r.instance=l;case"stylesheet":f=zi(a.href);var y=t.querySelector(Za(f));if(y)return r.state.loading|=4,r.instance=y,L(y),y;l=bg(a),(f=Un.get(f))&&$h(l,f),y=(t.ownerDocument||t).createElement("link"),L(y);var w=y;return w._p=new Promise(function(O,R){w.onload=O,w.onerror=R}),Ft(y,"link",l),r.state.loading|=4,Yl(y,a.precedence,t),r.instance=y;case"script":return y=$i(a.src),(f=t.querySelector(eo(y)))?(r.instance=f,L(f),f):(l=a,(f=Un.get(y))&&(l=b({},a),Ih(l,f)),t=t.ownerDocument||t,f=t.createElement("script"),L(f),Ft(f,"link",l),t.head.appendChild(f),r.instance=f);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,Yl(l,a.precedence,t));return r.instance}function Yl(t,r,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,y=f,w=0;w<l.length;w++){var O=l[w];if(O.dataset.precedence===r)y=O;else if(y!==f)break}y?y.parentNode.insertBefore(t,y.nextSibling):(r=a.nodeType===9?a.head:a,r.insertBefore(t,r.firstChild))}function $h(t,r){t.crossOrigin==null&&(t.crossOrigin=r.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=r.referrerPolicy),t.title==null&&(t.title=r.title)}function Ih(t,r){t.crossOrigin==null&&(t.crossOrigin=r.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=r.referrerPolicy),t.integrity==null&&(t.integrity=r.integrity)}var Kl=null;function vg(t,r,a){if(Kl===null){var l=new Map,f=Kl=new Map;f.set(a,l)}else f=Kl,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(t))return l;for(l.set(t,null),a=a.getElementsByTagName(t),f=0;f<a.length;f++){var y=a[f];if(!(y[Rt]||y[it]||t==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var w=y.getAttribute(r)||"";w=t+w;var O=l.get(w);O?O.push(y):l.set(w,[y])}}return l}function _g(t,r,a){t=t.ownerDocument||t,t.head.insertBefore(a,r==="title"?t.querySelector("head > title"):null)}function rS(t,r,a){if(a===1||r.itemProp!=null)return!1;switch(t){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 t=r.disabled,typeof r.precedence=="string"&&t==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 wg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function sS(t,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 f=zi(l.href),y=r.querySelector(Za(f));if(y){r=y._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(t.count++,t=Jl.bind(t),r.then(t,t)),a.state.loading|=4,a.instance=y,L(y);return}y=r.ownerDocument||r,l=bg(l),(f=Un.get(f))&&$h(l,f),y=y.createElement("link"),L(y);var w=y;w._p=new Promise(function(O,R){w.onload=O,w.onerror=R}),Ft(y,"link",l),a.instance=y}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,r),(r=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=Jl.bind(t),r.addEventListener("load",a),r.addEventListener("error",a))}}var Hh=0;function iS(t,r){return t.stylesheets&&t.count===0&&Xl(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var l=setTimeout(function(){if(t.stylesheets&&Xl(t,t.stylesheets),t.unsuspend){var y=t.unsuspend;t.unsuspend=null,y()}},6e4+r);0<t.imgBytes&&Hh===0&&(Hh=62500*Uw());var f=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Xl(t,t.stylesheets),t.unsuspend)){var y=t.unsuspend;t.unsuspend=null,y()}},(t.imgBytes>Hh?50:800)+r);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function Jl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Ql=null;function Xl(t,r){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Ql=new Map,r.forEach(aS,t),Ql=null,Jl.call(t))}function aS(t,r){if(!(r.state.loading&4)){var a=Ql.get(t);if(a)var l=a.get(null);else{a=new Map,Ql.set(t,a);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<f.length;y++){var w=f[y];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),l=w)}l&&a.set(null,l)}f=r.instance,w=f.getAttribute("data-precedence"),y=a.get(w)||l,y===l&&a.set(null,f),a.set(w,f),this.count++,l=Jl.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),y?y.parentNode.insertBefore(f,y.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(f,t.firstChild)),r.state.loading|=4}}var to={$$typeof:ne,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function oS(t,r,a,l,f,y,w,O,R){this.tag=1,this.containerInfo=t,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=f,this.onCaughtError=y,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Sg(t,r,a,l,f,y,w,O,R,V,Z,ie){return t=new oS(t,r,a,w,R,V,Z,ie,O),r=1,y===!0&&(r|=24),y=mn(3,null,null,r),t.current=y,y.stateNode=t,r=wf(),r.refCount++,t.pooledCache=r,r.refCount++,y.memoizedState={element:l,isDehydrated:a,cache:r},Af(y),t}function Eg(t){return t?(t=bi,t):bi}function Og(t,r,a,l,f,y){f=Eg(f),l.context===null?l.context=f:l.pendingContext=f,l=Wr(r),l.payload={element:a},y=y===void 0?null:y,y!==null&&(l.callback=y),a=Zr(t,l,r),a!==null&&(cn(a,t,r),Ra(a,t,r))}function Ag(t,r){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<r?a:r}}function Fh(t,r){Ag(t,r),(t=t.alternate)&&Ag(t,r)}function jg(t){if(t.tag===13||t.tag===31){var r=Us(t,67108864);r!==null&&cn(r,t,67108864),Fh(t,67108864)}}function kg(t){if(t.tag===13||t.tag===31){var r=xn();r=mr(r);var a=Us(t,r);a!==null&&cn(a,t,r),Fh(t,r)}}var Wl=!0;function lS(t,r,a,l){var f=H.T;H.T=null;var y=J.p;try{J.p=2,Gh(t,r,a,l)}finally{J.p=y,H.T=f}}function cS(t,r,a,l){var f=H.T;H.T=null;var y=J.p;try{J.p=8,Gh(t,r,a,l)}finally{J.p=y,H.T=f}}function Gh(t,r,a,l){if(Wl){var f=Vh(l);if(f===null)Ch(t,r,l,Zl,a),Tg(t,l);else if(fS(f,t,r,a,l))l.stopPropagation();else if(Tg(t,l),r&4&&-1<uS.indexOf(t)){for(;f!==null;){var y=N(f);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var w=Fn(y.pendingLanes);if(w!==0){var O=y;for(O.pendingLanes|=2,O.entangledLanes|=2;w;){var R=1<<31-Gt(w);O.entanglements[1]|=R,w&=~R}ir(y),(Qe&6)===0&&(Ll=ut()+500,Ja(0))}}break;case 31:case 13:O=Us(y,2),O!==null&&cn(O,y,2),Pl(),Fh(y,2)}if(y=Vh(l),y===null&&Ch(t,r,l,Zl,a),y===f)break;f=y}f!==null&&l.stopPropagation()}else Ch(t,r,l,null,a)}}function Vh(t){return t=Yu(t),Yh(t)}var Zl=null;function Yh(t){if(Zl=null,t=A(t),t!==null){var r=c(t);if(r===null)t=null;else{var a=r.tag;if(a===13){if(t=d(r),t!==null)return t;t=null}else if(a===31){if(t=p(r),t!==null)return t;t=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;t=null}else r!==t&&(t=null)}}return Zl=t,null}function Ng(t){switch(t){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(Uu()){case Io:return 2;case Ho:return 8;case ai:case zu:return 32;case Fo:return 268435456;default:return 32}default:return 32}}var Kh=!1,us=null,fs=null,hs=null,no=new Map,ro=new Map,ds=[],uS="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 Tg(t,r){switch(t){case"focusin":case"focusout":us=null;break;case"dragenter":case"dragleave":fs=null;break;case"mouseover":case"mouseout":hs=null;break;case"pointerover":case"pointerout":no.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":ro.delete(r.pointerId)}}function so(t,r,a,l,f,y){return t===null||t.nativeEvent!==y?(t={blockedOn:r,domEventName:a,eventSystemFlags:l,nativeEvent:y,targetContainers:[f]},r!==null&&(r=N(r),r!==null&&jg(r)),t):(t.eventSystemFlags|=l,r=t.targetContainers,f!==null&&r.indexOf(f)===-1&&r.push(f),t)}function fS(t,r,a,l,f){switch(r){case"focusin":return us=so(us,t,r,a,l,f),!0;case"dragenter":return fs=so(fs,t,r,a,l,f),!0;case"mouseover":return hs=so(hs,t,r,a,l,f),!0;case"pointerover":var y=f.pointerId;return no.set(y,so(no.get(y)||null,t,r,a,l,f)),!0;case"gotpointercapture":return y=f.pointerId,ro.set(y,so(ro.get(y)||null,t,r,a,l,f)),!0}return!1}function Cg(t){var r=A(t.target);if(r!==null){var a=c(r);if(a!==null){if(r=a.tag,r===13){if(r=d(a),r!==null){t.blockedOn=r,Vo(t.priority,function(){kg(a)});return}}else if(r===31){if(r=p(a),r!==null){t.blockedOn=r,Vo(t.priority,function(){kg(a)});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function ec(t){if(t.blockedOn!==null)return!1;for(var r=t.targetContainers;0<r.length;){var a=Vh(t.nativeEvent);if(a===null){a=t.nativeEvent;var l=new a.constructor(a.type,a);Vu=l,a.target.dispatchEvent(l),Vu=null}else return r=N(a),r!==null&&jg(r),t.blockedOn=a,!1;r.shift()}return!0}function Mg(t,r,a){ec(t)&&a.delete(r)}function hS(){Kh=!1,us!==null&&ec(us)&&(us=null),fs!==null&&ec(fs)&&(fs=null),hs!==null&&ec(hs)&&(hs=null),no.forEach(Mg),ro.forEach(Mg)}function tc(t,r){t.blockedOn===r&&(t.blockedOn=null,Kh||(Kh=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,hS)))}var nc=null;function Rg(t){nc!==t&&(nc=t,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){nc===t&&(nc=null);for(var r=0;r<t.length;r+=3){var a=t[r],l=t[r+1],f=t[r+2];if(typeof l!="function"){if(Yh(l||a)===null)continue;break}var y=N(a);y!==null&&(t.splice(r,3),r-=3,Vf(y,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function Ii(t){function r(R){return tc(R,t)}us!==null&&tc(us,t),fs!==null&&tc(fs,t),hs!==null&&tc(hs,t),no.forEach(r),ro.forEach(r);for(var a=0;a<ds.length;a++){var l=ds[a];l.blockedOn===t&&(l.blockedOn=null)}for(;0<ds.length&&(a=ds[0],a.blockedOn===null);)Cg(a),a.blockedOn===null&&ds.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],y=a[l+1],w=f[gt]||null;if(typeof y=="function")w||Rg(a);else if(w){var O=null;if(y&&y.hasAttribute("formAction")){if(f=y,w=y[gt]||null)O=w.formAction;else if(Yh(f)!==null)continue}else O=w.action;typeof O=="function"?a[l+1]=O:(a.splice(l,3),l-=3),Rg(a)}}}function Dg(){function t(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(w){return f=w})},focusReset:"manual",scroll:"manual"})}function r(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),f!==null&&(f(),f=null)}}}function Jh(t){this._internalRoot=t}rc.prototype.render=Jh.prototype.render=function(t){var r=this._internalRoot;if(r===null)throw Error(i(409));var a=r.current,l=xn();Og(a,l,t,r,null,null)},rc.prototype.unmount=Jh.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var r=t.containerInfo;Og(t.current,2,null,t,null,null),Pl(),r[hn]=null}};function rc(t){this._internalRoot=t}rc.prototype.unstable_scheduleHydration=function(t){if(t){var r=ya();t={blockedOn:null,target:t,priority:r};for(var a=0;a<ds.length&&r!==0&&r<ds[a].priority;a++);ds.splice(a,0,t),a===0&&Cg(t)}};var Lg=e.version;if(Lg!=="19.2.4")throw Error(i(527,Lg,"19.2.4"));J.findDOMNode=function(t){var r=t._reactInternals;if(r===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=u(r),t=t!==null?m(t):null,t=t===null?null:t.stateNode,t};var dS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var sc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sc.isDisabled&&sc.supportsFiber)try{Ts=sc.inject(dS),_t=sc}catch{}}return io.createRoot=function(t,r){if(!o(t))throw Error(i(299));var a=!1,l="",f=Ip,y=Hp,w=Fp;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(l=r.identifierPrefix),r.onUncaughtError!==void 0&&(f=r.onUncaughtError),r.onCaughtError!==void 0&&(y=r.onCaughtError),r.onRecoverableError!==void 0&&(w=r.onRecoverableError)),r=Sg(t,1,!1,null,null,a,l,null,f,y,w,Dg),t[hn]=r.current,Th(t),new Jh(r)},io.hydrateRoot=function(t,r,a){if(!o(t))throw Error(i(299));var l=!1,f="",y=Ip,w=Hp,O=Fp,R=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(O=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),r=Sg(t,1,!0,r,a??null,l,f,R,y,w,O,Dg),r.context=Eg(null),a=r.current,l=xn(),l=mr(l),f=Wr(l),f.callback=null,Zr(a,f,l),a=l,r.current.lanes=a,Gn(r,a),ir(r),t[hn]=r.current,Th(t),new rc(r)},io.version="19.2.4",io}var Ig;function aE(){if(Ig)return Qh.exports;Ig=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(e){console.error(e)}}return n(),Qh.exports=iE(),Qh.exports}var oE=aE();const lE="modulepreload",cE=function(n,e){return new URL(n,e).href},Hg={},Oe=function(e,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 p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),u=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=d(s.map(m=>{if(m=cE(m,i),m in Hg)return;Hg[m]=!0;const b=m.endsWith(".css"),x=b?'[rel="stylesheet"]':"";if(!!i)for(let S=p.length-1;S>=0;S--){const C=p[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":lE,b||(_.as="script"),_.crossOrigin="",_.href=m,u&&_.setAttribute("nonce",u),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 p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return o.then(d=>{for(const p of d||[])p.status==="rejected"&&c(p.reason);return e().catch(c)})};function Ou(n){try{const e=n.split(".");if(e.length!==3)return null;const s=atob(e[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function xx(n){const e=Ou(n);return!e||typeof e.exp!="number"?null:e.exp}function fm(n,e=0){const s=xx(n);return s===null?!0:Date.now()/1e3>=s-e}const Yt=window.__LT_BASE__??"",Sd=`${Yt}/api`;class Fg extends Error{constructor(e,s,i){super(e),this.status=s,this.body=i,this.name="ApiError"}}let bs=null;function ic(n){bs=n}function Ed(){return bs}const uE="X-LT-Acting-Token",fE="X-LT-Acting-Remaining";let tu=null,nu=null;function Gg(n){tu=n}let ru=null;function Vg(n){ru=n}function Yg(n){nu=n}function hE(n){const e=n==null?void 0:n.error;return typeof e=="string"&&/acting[- ]identity/i.test(e)}async function Kg(){const n=sessionStorage.getItem("lt_credentials");if(!n)return null;try{const{username:e,password:s}=JSON.parse(n),i=await fetch(`${Sd}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,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 ps=null;async function vx(n,e={}){const s={"Content-Type":"application/json",...e.headers};if(bs){if(fm(bs)){ps||(ps=Kg().finally(()=>{ps=null}));const p=await ps;if(p)bs=p,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:p}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${bs}`}const o=(e.method??"GET").toUpperCase()==="GET"?null:(tu==null?void 0:tu())??null;o&&(s[uE]=o);let c=await fetch(`${Sd}${n}`,{...e,headers:s});const d=o?c.headers.get(fE):null;if(o&&d!==null&&(ru==null||ru(o,d==="unbounded"?null:Number(d))),c.status===401&&o){const p=await c.clone().json().catch(()=>null);if(hE(p))throw nu==null||nu(),new Fg(p.error,401,p)}if(c.status===401&&bs){ps||(ps=Kg().finally(()=>{ps=null}));const p=await ps;if(p&&(bs=p,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:p}})),s.Authorization=`Bearer ${p}`,c=await fetch(`${Sd}${n}`,{...e,headers:s})),c.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(c.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!c.ok){const p=await c.json().catch(()=>({error:c.statusText}));throw new Fg(p.message||p.error||c.statusText,c.status,p)}return c}async function ue(n,e={}){return(await vx(n,e)).json()}async function $5(n,e={}){const s=await vx(n,e);return{blob:await s.blob(),headers:s.headers}}const dE="lt_ai_override";let ac=null;function hm(){return ac||(ac=fetch(`${Yt}/api/settings`).then(n=>{if(!n.ok)throw new Error(`settings ${n.status}`);return n.json()}).catch(n=>{throw ac=null,n})),ac}function mE(){try{if(localStorage.getItem(dE)==="off")return!1}catch{}return null}function Hn(){var s;const n=Le({queryKey:["settings"],queryFn:hm,staleTime:1/0}),e=mE();return n.data&&e===!1&&((s=n.data.ai)!=null&&s.enabled)?{...n,data:{...n.data,ai:{enabled:!1}}}:n}function pE(n){var u,m,b;const{data:e}=Hn(),s=((u=e==null?void 0:e.auth)==null?void 0:u.ssoKeepaliveSeconds)??0,i=((m=e==null?void 0:e.auth)==null?void 0:m.ssoKeepaliveIdleTimeoutSeconds)??0,o=E.useRef(Date.now()),c=E.useRef(Date.now()),d=E.useRef(!1),g=!!n&&((b=Ou(n))==null?void 0:b.sso)===!0&&s>0;E.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(`${Yt}/api/auth/sso`,{method:"POST"});if(C.status===401||C.status===403){window.dispatchEvent(new CustomEvent("auth:unauthorized"));return}if(!C.ok)return;const B=await C.json().catch(()=>null);B!=null&&B.token&&(c.current=Date.now(),window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:B.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 _x=E.createContext(null),yE=300;function Zh(n,e){if(fm(n))return null;const s=Ou(n);if(!s)return null;const i=e??(()=>{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 gE({children:n}){const[e,s]=E.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?fm(b)?(sessionStorage.removeItem("lt_token"),null):(ic(b),Zh(b)):null}),i=E.useRef(void 0),o=E.useCallback(b=>{clearTimeout(i.current);const x=xx(b);if(!x)return;const v=(x-yE)*1e3-Date.now();v<=0||(i.current=setTimeout(async()=>{try{const _=Ou(b);if(_!=null&&_.sso){const te=await fetch(`${Yt}/api/auth/sso`,{method:"POST"});if(!te.ok)return;const M=await te.json();M.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:M.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:C,password:B}=JSON.parse(S),q=await fetch(`${Yt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:C,password:B})});if(!q.ok)return;const ne=await q.json();ne.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:ne.token}}))}catch{}},v))},[]),c=E.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=Zh(b,_);S&&(ic(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=E.useCallback(()=>{clearTimeout(i.current);const b=sessionStorage.getItem("lt_sso_logout_url");ic(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)},[]);E.useEffect(()=>{const b=()=>d(),x=v=>{var C;const _=(C=v.detail)==null?void 0:C.token;if(!_)return;const S=Zh(_);S&&(ic(_),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]),E.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&e&&o(b),()=>clearTimeout(i.current)},[]);const p=(e==null?void 0:e.roles.some(b=>b.type==="superadmin"))??!1,g=E.useCallback(b=>(e==null?void 0:e.roles.some(x=>x.role===b))??!1,[e]),u=E.useCallback(b=>(e==null?void 0:e.roles.some(x=>x.type===b))??!1,[e]),m=(e==null?void 0:e.roles.map(b=>b.role))??[];return h.jsxs(_x.Provider,{value:{user:e,isAuthenticated:!!e,isSuperAdmin:p,login:c,logout:d,hasRole:g,hasRoleType:u,userRoleNames:m},children:[h.jsx(bE,{authenticated:e!==null}),n]})}function bE({authenticated:n}){return pE(n?sessionStorage.getItem("lt_token"):null),null}function qt(){const n=E.useContext(_x);if(!n)throw new Error("useAuth must be used within AuthProvider");return n}async function xE(n){if(!Ed())return{kind:"session-ended"};try{const e=await ue("/nats-credentials"),s=e.natsWsUrl??n;return s?{kind:"ok",url:s,token:e.natsToken??null}:{kind:"unavailable"}}catch{return Ed()?{kind:"unavailable"}:{kind:"session-ended"}}}const bo={initialDelayMs:1e3,maxDelayMs:6e4,noticeAfterMs:3e4,spreadMs:5e3};function vE(n,e,s=Math.random){const i=Math.min(e.maxDelayMs,e.initialDelayMs*2**Math.max(0,n));return Math.round(i/2+s()*(i/2))}function Jg(n,e=Math.random){return Math.round(e()*n.spreadMs)}function Qg(n){const e=(s,i)=>typeof s=="number"&&Number.isFinite(s)&&s>0?s:i;return{initialDelayMs:e(n==null?void 0:n.initialDelayMs,bo.initialDelayMs),maxDelayMs:e(n==null?void 0:n.maxDelayMs,bo.maxDelayMs),noticeAfterMs:e(n==null?void 0:n.noticeAfterMs,bo.noticeAfterMs),spreadMs:e(n==null?void 0:n.spreadMs,bo.spreadMs)}}const jn=new Uint8Array(0),si=new TextEncoder,En=new TextDecoder;function _E(...n){let e=0;for(let o=0;o<n.length;o++)e+=n[o].length;const s=new Uint8Array(e);let i=0;for(let o=0;o<n.length;o++)s.set(n[o],i),i+=n[o].length;return s}function wo(...n){const e=[];for(let s=0;s<n.length;s++)e.push(si.encode(n[s]));return e.length===0?jn:e.length===1?e[0]:_E(...e)}function Xg(n){return!n||n.length===0?"":En.decode(n)}const Wg="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",Zg=36,wE=0xcfd41b9100000,eb=33,SE=333,tb=22;function EE(n){for(let e=0;e<n.length;e++)n[e]=Math.floor(Math.random()*255)}function OE(n){var e;(e=globalThis==null?void 0:globalThis.crypto)!=null&&e.getRandomValues?globalThis.crypto.getRandomValues(n):EE(n)}class AE{constructor(){j(this,"buf");j(this,"seq");j(this,"inc");j(this,"inited");this.buf=new Uint8Array(tb),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*wE),this.inc=Math.floor(Math.random()*(SE-eb)+eb)}setPre(){const e=new Uint8Array(12);OE(e);for(let s=0;s<12;s++){const i=e[s]%36;this.buf[s]=Wg.charCodeAt(i)}}fillSeq(){let e=this.seq;for(let s=tb-1;s>=12;s--)this.buf[s]=Wg.charCodeAt(e%Zg),e=Math.floor(e/Zg)}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 js=new AE;var Dr;(function(n){n.Disconnect="disconnect",n.Reconnect="reconnect",n.Update="update",n.LDM="ldm",n.Error="error"})(Dr||(Dr={}));var Xi;(function(n){n.Reconnecting="reconnecting",n.PingTimer="pingTimer",n.StaleConnection="staleConnection",n.ClientInitiatedReconnect="client initiated reconnect"})(Xi||(Xi={}));var fe;(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"})(fe||(fe={}));function jE(n){return typeof n.code=="string"}class wx{constructor(){j(this,"messages");this.messages=new Map,this.messages.set(fe.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(fe.BadJson,"Bad JSON"),this.messages.set(fe.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(e){return kE.getMessage(e)}getMessage(e){return this.messages.get(e)||e}}const kE=new wx;class be 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=wx.getMessage(s);return new be(o,s,i)}isAuthError(){return this.code===fe.AuthenticationExpired||this.code===fe.AuthorizationViolation||this.code===fe.AccountExpired}isAuthTimeout(){return this.code===fe.AuthenticationTimeout}isPermissionError(){return this.code===fe.PermissionsViolation}isProtocolError(){return this.code===fe.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var wn;(function(n){n[n.Exact=0]="Exact",n[n.CanonicalMIME=1]="CanonicalMIME",n[n.IgnoreCase=2]="IgnoreCase"})(wn||(wn={}));var Zn;(function(n){n.Timer="timer",n.Count="count",n.JitterTimer="jitterTimer",n.SentinelMsg="sentinelMsg"})(Zn||(Zn={}));var So;(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"})(So||(So={}));const fu="Nats-Service-Error",hu="Nats-Service-Error-Code";class du extends Error{constructor(s,i){super(i);j(this,"code");this.code=s}static isServiceError(s){return du.toServiceError(s)!==null}static toServiceError(s){var o,c;const i=((o=s==null?void 0:s.headers)==null?void 0:o.get(hu))||"";if(i!==""){const d=parseInt(i)||400,p=((c=s==null?void 0:s.headers)==null?void 0:c.get(fu))||"";return new du(d,p.length?p:i)}return null}}function Lr(n=""){if(n=n||"_INBOX",typeof n!="string")throw new Error("prefix must be a string");return n.split(".").forEach(e=>{if(e==="*"||e===">")throw new Error(`inbox prefixes cannot have wildcards '${n}'`)}),`${n}.${js.next()}`}const Od="127.0.0.1";var ws;(function(n){n.PING="PING",n.STATS="STATS",n.INFO="INFO"})(ws||(ws={}));function Au(n,...e){for(let s=0;s<e.length;s++){const i=e[s];Object.keys(i).forEach(function(o){n[o]=i[o]})}return n}function oc(n){return En.decode(n).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ia(n,e=!0){const s=e?be.errorForCode(fe.Timeout):null;let i,o;const c=new Promise((d,p)=>{i={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{p(s===null?be.errorForCode(fe.Timeout):s)},n)});return Object.assign(c,i)}function la(n=0){let e;const s=new Promise(i=>{const o=setTimeout(()=>{i()},n);e={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,e)}function dt(){let n={};const e=new Promise((s,i)=>{n={resolve:s,reject:i}});return Object.assign(e,n)}function Sx(n){for(let e=n.length-1;e>0;e--){const s=Math.floor(Math.random()*(e+1));[n[e],n[s]]=[n[s],n[e]]}return n}function NE(n){return n===0?0:Math.floor(n/2+Math.random()*n)}function dm(n=[0,250,250,500,500,3e3,5e3]){Array.isArray(n)||(n=[0,250,250,500,500,3e3,5e3]);const e=n.length-1;return{backoff(s){return NE(s>e?n[e]:n[s])}}}function ht(n){return n*1e6}function mm(n){return Math.floor(n/1e6)}function nb(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 be(`'${n[c]}' is not a valid character for a header key`,fe.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 Pr(n=0,e=""){if(n===0&&e!==""||n>0&&e==="")throw new Error("setting status requires both code and description");return new Ss(n,e)}const ed="NATS/1.0";class Ss{constructor(e=0,s=""){j(this,"_code");j(this,"headers");j(this,"_description");this._code=e,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(e){if(e&&this.headers.size===e.headers.size&&this._code===e._code){for(const[s,i]of this.headers){const o=e.values(s);if(i.length!==o.length)return!1;const c=[...i].sort(),d=[...o].sort();for(let p=0;p<c.length;p++)if(c[p]!==d[p])return!1}return!0}return!1}static decode(e){const s=new Ss,o=En.decode(e).split(`\r
|
|
27
27
|
`),c=o[0];if(c!==ed){let d=c.replace(ed,"").trim();if(d.length>0){s._code=parseInt(d,10),isNaN(s._code)&&(s._code=0);const p=s._code.toString();d=d.replace(p,""),s._description=d.trim()}}return o.length>=1&&o.slice(1).map(d=>{if(d){const p=d.indexOf(":");if(p>-1){const g=d.slice(0,p),u=d.slice(p+1).trim();s.append(g,u)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let e=ed;this._code>0&&this._description!==""&&(e+=` ${this._code} ${this._description}`);for(const[s,i]of this.headers)for(let o=0;o<i.length;o++)e=`${e}\r
|
|
28
28
|
${s}: ${i[o]}`;return`${e}\r
|
|
29
29
|
\r
|
|
@@ -34,7 +34,7 @@ ${s}: ${i[o]}`;return`${e}\r
|
|
|
34
34
|
${this.ctx.stack}`),this.cancel(s)):(this.callback(null,i),this.opts.strategy===Zn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Zn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Zn.SentinelMsg&&i&&i.data.length===0&&this.cancel())}}class jx extends Ax{constructor(s,i,o={timeout:1e3},c=!0){super(s,i,c);j(this,"deferred");j(this,"timer");this.deferred=dt(),this.timer=ia(o.timeout,c)}resolver(s,i){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
|
|
35
35
|
|
|
36
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||be.errorForCode(fe.Cancelled))}}const KE="$JS.API";function JE(n){return n=n||{},n.domain&&(n.apiPrefix=`$JS.${n.domain}.API`,delete n.domain),Au({apiPrefix:KE,timeout:5e3},n)}class Do{constructor(e,s){j(this,"nc");j(this,"opts");j(this,"prefix");j(this,"timeout");j(this,"jc");this.nc=e,this.opts=JE(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=er()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let e=this.opts.apiPrefix;if(!e||e.length===0)throw new Error("invalid empty prefix");e[e.length-1]==="."&&(e=e.substr(0,e.length-1)),this.opts.apiPrefix=e}async _request(e,s=null,i){i=i||{},i.timeout=this.timeout;let o=jn;s&&(o=this.jc.encode(s));let{retries:c}=i;c=c||1,c=c===-1?Number.MAX_SAFE_INTEGER:c;const d=dm();for(let p=0;p<c;p++)try{const g=await this.nc.request(e,o,i);return this.parseJsResponse(g)}catch(g){const u=g;if((u.code==="503"||u.code===fe.Timeout)&&p+1<c)await la(d.backoff(p));else throw g}}async findStream(e){const s={subject:e},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(e){const s=this.jc.decode(e.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 vo{constructor(e,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(!e)throw new Error("subject is required");this.subject=e,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 e={offset:this.offset};this.payload&&Object.assign(e,this.payload);try{const s=await this.jsm._request(this.subject,e,{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(e){var s,i,o;switch(e==null?void 0:e.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=e.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((i=e.consumers)==null?void 0:i.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${e==null?void 0:e.type}`),((o=e.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let e=await this.next();for(;e.length>0;){for(const s of e)yield s;e=await this.next()}}}function ni(n=""){const e=n.match(/(\d+).(\d+).(\d+)/);if(e)return{major:parseInt(e[1]),minor:parseInt(e[2]),micro:parseInt(e[3])};throw new Error(`'${n}' is not a semver value`)}function Md(n,e){return n.major<e.major?-1:n.major>e.major?1:n.minor<e.minor?-1:n.minor>e.minor?1:n.micro<e.micro?-1:n.micro>e.micro?1:0}var Ye;(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"})(Ye||(Ye={}));class QE{constructor(e){j(this,"server");j(this,"features");j(this,"disabled");this.features=new Map,this.disabled=[],this.update(e)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(e){this.disabled.push(e),this.update(this.server)}isDisabled(e){return this.disabled.indexOf(e)!==-1}update(e){typeof e=="string"&&(e=ni(e)),this.server=e,this.set(Ye.JS_KV,"2.6.2"),this.set(Ye.JS_OBJECTSTORE,"2.6.3"),this.set(Ye.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ye.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ye.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ye.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ye.JS_SIMPLIFICATION,"2.9.4"),this.set(Ye.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ye.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ye.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ye.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ye.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ye.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ye.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ye.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(e,s){this.features.set(e,{min:s,ok:Md(this.server,ni(s))>=0})}get(e){return this.features.get(e)||{min:"unknown",ok:!1}}supports(e){var s;return((s=this.get(e))==null?void 0:s.ok)||!1}require(e){return typeof e=="string"&&(e=ni(e)),Md(this.server,e)>=0}}class pu extends Do{constructor(e,s){super(e,s)}async add(e,s,i=mu.Create){if(Qt(e),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=e,o.action=i,o.config.durable_name&&Wi(o.config.durable_name);const c=this.nc;let{min:d,ok:p}=c.features.get(Ye.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!p)throw new Error(`consumer 'name' requires server ${d}`);if(g)try{ju("name",g)}catch(x){const v=x.message,_=v.indexOf("cannot contain");throw _!==-1?new Error(`consumer 'name' ${v.substring(_)}`):x}let u,m="";if(Array.isArray(s.filter_subjects)){const{min:x,ok:v}=c.features.get(Ye.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${x}`);p=!1}if(s.metadata){const{min:x,ok:v}=c.features.get(Ye.JS_STREAM_CONSUMER_METADATA);if(!v)throw new Error(`consumer 'metadata' requires server ${x}`)}if(p&&(m=s.name??s.durable_name??""),m!==""){let x=s.filter_subject??void 0;x===">"&&(x=void 0),u=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${e}.${m}.${x}`:`${this.prefix}.CONSUMER.CREATE.${e}.${m}`}else u=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${e}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${e}`;return await this._request(u,o)}async update(e,s,i){const o=await this.info(e,s),c=i;return this.add(e,Object.assign(o.config,c),mu.Update)}async info(e,s){return Qt(e),Wi(s),await this._request(`${this.prefix}.CONSUMER.INFO.${e}.${s}`)}async delete(e,s){return Qt(e),Wi(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${e}.${s}`)).success}list(e){Qt(e);const s=o=>o.consumers,i=`${this.prefix}.CONSUMER.LIST.${e}`;return new vo(i,s,this)}pause(e,s,i){const o=`${this.prefix}.CONSUMER.PAUSE.${e}.${s}`,c={pause_until:i.toISOString()};return this._request(o,c)}resume(e,s){return this.pause(e,s,new Date(0))}}function Hi(n,e,s=!1){if(s===!0&&!n)throw be.errorForCode(fe.ApiError,new Error(`${e} is not a function`));if(n&&typeof n!="function")throw be.errorForCode(fe.ApiError,new Error(`${e} is not a function`))}class XE extends Ut{constructor(s,i,o){super();j(this,"sub");j(this,"adapter");j(this,"subIterDone");Hi(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&Hi(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(Hi(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(Hi(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(Hi(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&Hi(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:p,timeout:g}=o,u={queue:p,timeout:g,callback:c};d&&d>0&&(u.max=d),this.sub=s.subscribe(i,u),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=dt(),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 On;function WE(n){On=n}function kx(){return On!==void 0&&On.defaultPort!==void 0?On.defaultPort:4222}function nd(){return On!==void 0&&On.urlParseFn?On.urlParseFn:void 0}function ZE(){if(!On||typeof On.factory!="function")throw new Error("transport fn is not set");return On.factory()}function Rd(){return On!==void 0&&On.dnsResolveFn?On.dnsResolveFn:void 0}const su=`\r
|
|
37
|
-
`,yu=oa.fromAscii(su),e2=new Uint8Array(yu)[0],t2=new Uint8Array(yu)[1];function n2(n){for(let e=0;e<n.length;e++){const s=e+1;if(n.byteLength>s&&n[e]===e2&&n[s]===t2)return s+1}return 0}function r2(n){const e=n2(n);if(e>0){const i=new Uint8Array(n).slice(0,e);return En.decode(i)}return""}const s2=4,Nx=48,i2=65,a2=97;function o2(n,e,s,i){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((d,p)=>{o[p]=d}),o[12]=n,o[13]=e,o[14]=s,o[15]=i,o}function Dd(n){return l2(n)!==void 0}function l2(n){for(let e=0;e<n.length;e++)switch(n[e]){case".":return Tx(n);case":":return c2(n)}}function Tx(n){const e=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}=u2(n);if(!c||i>255)return;n=n.substring(o),e[s]=i}return o2(e[0],e[1],e[2],e[3])}function c2(n){const e=new Uint8Array(16);let s=-1;if(n.length>=2&&n[0]===":"&&n[1]===":"&&(s=0,n=n.substring(2),n.length===0))return e;let i=0;for(;i<16;){const{n:o,c,ok:d}=f2(n);if(!d||o>65535)return;if(c<n.length&&n[c]==="."){if(s<0&&i!=12||i+4>16)return;const p=Tx(n);if(p===void 0)return;e[i]=p[12],e[i+1]=p[13],e[i+2]=p[14],e[i+3]=p[15],n="",i+=s2;break}if(e[i]=o>>8,e[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--)e[c+o]=e[c];for(let c=s+o-1;c>=s;c--)e[c]=0}else if(s>=0)return;return e}}function u2(n){let e=0,s=0;for(e=0;e<n.length&&48<=n.charCodeAt(e)&&n.charCodeAt(e)<=57;e++)if(s=s*10+(n.charCodeAt(e)-Nx),s>=16777215)return{n:16777215,c:e,ok:!1};return e===0?{n:0,c:0,ok:!1}:{n:s,c:e,ok:!0}}function f2(n){let e=0,s=0;for(s=0;s<n.length;s++){if(48<=n.charCodeAt(s)&&n.charCodeAt(s)<=57)e*=16,e+=n.charCodeAt(s)-Nx;else if(97<=n.charCodeAt(s)&&n.charCodeAt(s)<=102)e*=16,e+=n.charCodeAt(s)-a2+10;else if(65<=n.charCodeAt(s)&&n.charCodeAt(s)<=70)e*=16,e+=n.charCodeAt(s)-i2+10;else break;if(e>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n:e,c:s,ok:!0}}function h2(n){return n.indexOf("[")!==-1||n.indexOf("::")!==-1?!1:n.indexOf(".")!==-1||n.split(":").length<=2}function Ld(n){return!h2(n)}function d2(n){const e="::FFFF:",s=n.toUpperCase().indexOf(e);if(s!==-1&&n.indexOf(".")!==-1){let i=n.substring(s+e.length);return i=i.replace("[",""),i.replace("]","")}return n}function m2(n){n=n.trim(),n.match(/^(.*:\/\/)(.*)/m)&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2")),n=d2(n),Ld(n)&&n.indexOf("[")===-1&&(n=`[${n}]`);const e=Ld(n)?n.match(/(]:)(\d+)/):n.match(/(:)(\d+)/),s=e&&e.length===3&&e[1]&&e[2]?parseInt(e[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 Eo{constructor(e,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=e,this.tlsName="";const i=m2(e);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(e){if(!e.fn||e.resolve===!1)return[this];const s=[];if(Dd(this.hostname))return[this];{const i=await e.fn(this.hostname);e.debug&&console.log(`resolve ${this.hostname} = ${i.join(",")}`);for(const o of i){const c=this.port===80?"https":"http",d=new URL(`${c}://${Ld(o)?"["+o+"]":o}`);d.port=`${this.port}`;const p=new Eo(d.host,!1);p.tlsName=this.hostname,s.push(p)}}return e.randomize&&Sx(s),this.resolves=s,s}}class p2{constructor(e=[],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=nd();e&&(e.forEach(o=>{o=i?i(o):o,this.servers.push(new Eo(o))}),this.randomize&&(this.servers=Sx(this.servers))),this.servers.length===0&&this.addServer(`${Od}:${kx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const e=this.getCurrentServer();Dd(e.hostname)||(this.tlsName=e.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(e,s=!1){const i=nd();e=i?i(e):e;const o=new Eo(e,s);Dd(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const e=this.servers.shift();return e&&(this.servers.push(e),this.currentServer=e),e}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(e){if(e){const s=this.servers.indexOf(e);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(e,s){const i=[];let o=[];const c=nd(),d=new Map;e.connect_urls&&e.connect_urls.length>0&&e.connect_urls.forEach(g=>{g=c?c(g,s):g;const u=new Eo(g,!0);d.set(g,u)});const p=[];return this.servers.forEach((g,u)=>{const m=g.listen;g.gossiped&&this.currentServer.listen!==m&&d.get(m)===void 0&&p.push(u),d.delete(m)}),p.reverse(),p.forEach(g=>{const u=this.servers.splice(g,1);o=o.concat(u[0].listen)}),d.forEach((g,u)=>{this.servers.push(g),i.push(u)}),{added:i,deleted:o}}}class y2{constructor(){j(this,"baseInbox");j(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(e){return this.baseInbox=`${Lr(e)}.`,this.baseInbox}add(e){isNaN(e.received)||(e.received=0),this.reqs.set(e.token,e)}get(e){return this.reqs.get(e)}cancel(e){this.reqs.delete(e.token)}getToken(e){const s=e.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(e,s){if(s&&s.permissionContext){if(e)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(e,s)=>{const i=this.getToken(s);if(i){const o=this.get(i);o&&(e===null&&s.headers&&(e=Ex(s)),o.resolver(e,s))}}}close(){const e=be.errorForCode(fe.Timeout);this.reqs.forEach(s=>{s.resolver(e,{})})}}class g2{constructor(e,s,i){j(this,"ph");j(this,"interval");j(this,"maxOut");j(this,"timer");j(this,"pendings");this.ph=e,this.interval=s,this.maxOut=i,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(e){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),e&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Xi.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const e=dt();this.ph.flush(e).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(e),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(e=>(e.resolve(),!1))}}class b2 extends Error{constructor(e){super(e),this.name="AssertionError"}}function x2(n,e="Assertion failed."){if(!n)throw new b2(e)}const ub=32*1024,rd=2**32-2;function lc(n,e,s=0){const i=e.byteLength-s;return n.byteLength>i&&(n=n.subarray(0,i)),e.set(n,s),n.byteLength}class sd{constructor(e){j(this,"_buf");j(this,"_off");if(this._off=0,e==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(e)}bytes(e={copy:!0}){return e.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(e){if(e===0){this.reset();return}if(e<0||e>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+e)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(e){const s=this._buf.byteLength;return e<=this.capacity-s?(this._reslice(s+e),s):-1}_reslice(e){x2(e<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,e)}readByte(){const e=new Uint8Array(1);return this.read(e)?e[0]:null}read(e){if(this.empty())return this.reset(),e.byteLength===0?0:null;const s=lc(this._buf.subarray(this._off),e);return this._off+=s,s}writeByte(e){return this.write(Uint8Array.of(e))}writeString(e){return this.write(si.encode(e))}write(e){const s=this._grow(e.byteLength);return lc(e,this._buf,s)}_grow(e){const s=this.length;s===0&&this._off!==0&&this.reset();const i=this._tryGrowByReslice(e);if(i>=0)return i;const o=this.capacity;if(e<=Math.floor(o/2)-s)lc(this._buf.subarray(this._off),this._buf);else{if(o+e>rd)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*o+e,rd));lc(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(s+e,rd)),s}grow(e){if(e<0)throw Error("Buffer._grow: negative count");const s=this._grow(e);this._reslice(s)}readFrom(e){let s=0;const i=new Uint8Array(ub);for(;;){const o=this.capacity-this.length<ub,c=o?i:new Uint8Array(this._buf.buffer,this.length),d=e.read(c);if(d===null)return s;o?this.write(c.subarray(0,d)):this._reslice(this.length+d),s+=d}}}var Xt;(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"})(Xt||(Xt={}));function fb(){const n={};return n.sid=-1,n.hdr=-1,n.size=-1,n}const v2=48;class hb{constructor(e){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=e,this.state=de.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(e){let s;for(s=0;s<e.length;s++){const i=e[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=fb();break;case me.H:case me.h:this.state=de.OP_H,this.hdr=0,this.ma=fb();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(e.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(e.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(e.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(e.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(e.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():e.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:Xt.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=e.length-s;c<o&&(o=c),o>0?(this.msgBuf.write(e.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(i)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Xt.MSG,msg:this.ma,data:e.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(e.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(e.subarray(s))}break;case de.OP_PLUS_OK:switch(i){case me.NL:this.dispatcher.push({kind:Xt.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(e.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(e.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(e.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(e.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=e.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Xt.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(e.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(e.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(e.subarray(s))}break;case de.OP_PONG:switch(i){case me.NL:this.dispatcher.push({kind:Xt.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(e.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(e.subarray(s))}break;case de.OP_PING:switch(i){case me.NL:this.dispatcher.push({kind:Xt.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(e.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(e.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(e.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(e.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=e.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Xt.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(e.subarray(s))}}(this.state===de.MSG_ARG||this.state===de.MINUS_ERR_ARG||this.state===de.INFO_ARG)&&!this.argBuf&&(this.argBuf=new sd(e.subarray(this.as,s-this.drop))),this.state===de.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new sd(e.subarray(this.as)))}cloneMsgArg(){const e=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,i=new Uint8Array(e+s);i.set(this.ma.subject),this.ma.reply&&i.set(this.ma.reply,e),this.argBuf=new sd(i),this.ma.subject=i.subarray(0,e),this.ma.reply&&(this.ma.reply=i.subarray(e))}processMsgArgs(e){if(this.hdr>=0)return this.processHeaderMsgArgs(e);const s=[];let i=-1;for(let o=0;o<e.length;o++)switch(e[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(e.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(e.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(e,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(e,"processMsgArgs Bad or Missing Size Error")}fail(e,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${En.decode(e)}`)}processHeaderMsgArgs(e){const s=[];let i=-1;for(let o=0;o<e.length;o++)switch(e[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(e.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(e.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(e,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(e){if(e.length===0)return-1;let s=0;for(let i=0;i<e.length;i++){if(e[i]<48||e[i]>57)return-1;s=s*10+(e[i]-v2)}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 e=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(),p=s([1]),g=s([56129,1]),u=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 e(k,T)}function B(A,N,k){var T;for(T=0;T<4;T++)A[N+T]=k&255,k>>>=8}function q(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 ne(A,N,k,T,L){var I,se=0;for(I=0;I<L;I++)se|=A[N+I]^k[T+I];return(1&se-1>>>8)-1}function te(A,N,k,T){return ne(A,N,k,T,16)}function M(A,N,k,T){return ne(A,N,k,T,32)}function z(A,N,k,T,L){var I=new Uint32Array(16),se=new Uint32Array(16),le=new Uint32Array(16),K=new Uint32Array(4),re,xe,Ue;for(re=0;re<4;re++)se[5*re]=S(T,4*re),se[1+re]=S(k,4*re),se[6+re]=S(N,4*re),se[11+re]=S(k,16+4*re);for(re=0;re<16;re++)le[re]=se[re];for(re=0;re<20;re++){for(xe=0;xe<4;xe++){for(Ue=0;Ue<4;Ue++)K[Ue]=se[(5*xe+4*Ue)%16];for(K[1]^=_(K[0]+K[3]|0,7),K[2]^=_(K[1]+K[0]|0,9),K[3]^=_(K[2]+K[1]|0,13),K[0]^=_(K[3]+K[2]|0,18),Ue=0;Ue<4;Ue++)I[4*xe+(xe+Ue)%4]=K[Ue]}for(Ue=0;Ue<16;Ue++)se[Ue]=I[Ue]}if(L){for(re=0;re<16;re++)se[re]=se[re]+le[re]|0;for(re=0;re<4;re++)se[5*re]=se[5*re]-S(T,4*re)|0,se[6+re]=se[6+re]-S(N,4*re)|0;for(re=0;re<4;re++)B(A,4*re,se[5*re]),B(A,16+4*re,se[6+re])}else for(re=0;re<16;re++)B(A,4*re,se[re]+le[re]|0)}function ae(A,N,k,T){return z(A,N,k,T,!1),0}function F(A,N,k,T){return z(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,L,I,se){var le=new Uint8Array(16),K=new Uint8Array(64),re,xe;if(!L)return 0;for(xe=0;xe<16;xe++)le[xe]=0;for(xe=0;xe<8;xe++)le[xe]=I[xe];for(;L>=64;){for(ae(K,le,se,U),xe=0;xe<64;xe++)A[N+xe]=(k?k[T+xe]:0)^K[xe];for(re=1,xe=8;xe<16;xe++)re=re+(le[xe]&255)|0,le[xe]=re&255,re>>>=8;L-=64,N+=64,k&&(T+=64)}if(L>0)for(ae(K,le,se,U),xe=0;xe<L;xe++)A[N+xe]=(k?k[T+xe]:0)^K[xe];return 0}function Q(A,N,k,T,L){return D(A,N,null,0,k,T,L)}function W(A,N,k,T,L){var I=new Uint8Array(32);return F(I,T,L,U),Q(A,N,k,T.subarray(16),I)}function he(A,N,k,T,L,I,se){var le=new Uint8Array(32);return F(le,I,se,U),D(A,N,k,T,L,I.subarray(16),le)}function Ee(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 Ae=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,L,I){var se,le,K,re,xe=new Uint32Array(17),Ue=new Uint32Array(17),ot=new Uint32Array(17),Vt=new Uint32Array(17),Vn=new Uint32Array(17);for(K=0;K<17;K++)Ue[K]=ot[K]=0;for(K=0;K<16;K++)Ue[K]=I[K];for(Ue[3]&=15,Ue[4]&=252,Ue[7]&=15,Ue[8]&=252,Ue[11]&=15,Ue[12]&=252,Ue[15]&=15;L>0;){for(K=0;K<17;K++)Vt[K]=0;for(K=0;K<16&&K<L;++K)Vt[K]=k[T+K];for(Vt[K]=1,T+=K,L-=K,Ee(ot,Vt),le=0;le<17;le++)for(xe[le]=0,K=0;K<17;K++)xe[le]=xe[le]+ot[K]*(K<=le?Ue[le-K]:320*Ue[le+17-K]|0)|0|0;for(le=0;le<17;le++)ot[le]=xe[le];for(re=0,K=0;K<16;K++)re=re+ot[K]|0,ot[K]=re&255,re>>>=8;for(re=re+ot[16]|0,ot[16]=re&3,re=5*(re>>>2)|0,K=0;K<16;K++)re=re+ot[K]|0,ot[K]=re&255,re>>>=8;re=re+ot[16]|0,ot[16]=re}for(K=0;K<17;K++)Vn[K]=ot[K];for(Ee(ot,Ae),se=-(ot[16]>>>7)|0,K=0;K<17;K++)ot[K]^=se&(Vn[K]^ot[K]);for(K=0;K<16;K++)Vt[K]=I[K+16];for(Vt[16]=0,Ee(ot,Vt),K=0;K<16;K++)A[N+K]=ot[K];return 0}function J(A,N,k,T,L,I){var se=new Uint8Array(16);return H(se,0,k,T,L,I),te(A,N,se,0)}function ce(A,N,k,T,L){var I;if(k<32)return-1;for(he(A,0,N,0,k,T,L),H(A,16,A,32,k-32,A),I=0;I<16;I++)A[I]=0;return 0}function pe(A,N,k,T,L){var I,se=new Uint8Array(32);if(k<32||(W(se,0,32,T,L),J(N,16,N,32,k-32,se)!==0))return-1;for(he(A,0,N,0,k,T,L),I=0;I<32;I++)A[I]=0;return 0}function ge(A,N){var k;for(k=0;k<16;k++)A[k]=N[k]|0}function Ce(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 Ne(A,N,k){for(var T,L=~(k-1),I=0;I<16;I++)T=L&(A[I]^N[I]),A[I]^=T,N[I]^=T}function Me(A,N){var k,T,L,I=s(),se=s();for(k=0;k<16;k++)se[k]=N[k];for(Ce(se),Ce(se),Ce(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),L=I[15]>>16&1,I[14]&=65535,Ne(se,I,1-L)}for(k=0;k<16;k++)A[2*k]=se[k]&255,A[2*k+1]=se[k]>>8}function Xe(A,N){var k=new Uint8Array(32),T=new Uint8Array(32);return Me(k,A),Me(T,N),M(k,0,T,0)}function pt(A){var N=new Uint8Array(32);return Me(N,A),N[0]&1}function Ot(A,N){var k;for(k=0;k<16;k++)A[k]=N[2*k]+(N[2*k+1]<<8);A[15]&=32767}function mt(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]+k[T]|0}function _e(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]-k[T]|0}function oe(A,N,k){var T,L,I=new Float64Array(31);for(T=0;T<31;T++)I[T]=0;for(T=0;T<16;T++)for(L=0;L<16;L++)I[T+L]+=N[T]*k[L];for(T=0;T<15;T++)I[T]+=38*I[T+16];for(T=0;T<16;T++)A[T]=I[T];Ce(A),Ce(A)}function Be(A,N){oe(A,N,N)}function zt(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=253;T>=0;T--)Be(k,k),T!==2&&T!==4&&oe(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function Mt(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=250;T>=0;T--)Be(k,k),T!==1&&oe(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function tt(A,N,k){var T=new Uint8Array(32),L=new Float64Array(80),I,se,le=s(),K=s(),re=s(),xe=s(),Ue=s(),ot=s();for(se=0;se<31;se++)T[se]=N[se];for(T[31]=N[31]&127|64,T[0]&=248,Ot(L,k),se=0;se<16;se++)K[se]=L[se],xe[se]=le[se]=re[se]=0;for(le[0]=xe[0]=1,se=254;se>=0;--se)I=T[se>>>3]>>>(se&7)&1,Ne(le,K,I),Ne(re,xe,I),mt(Ue,le,re),_e(le,le,re),mt(re,K,xe),_e(K,K,xe),Be(xe,Ue),Be(ot,le),oe(le,re,le),oe(re,K,Ue),mt(Ue,le,re),_e(le,le,re),Be(K,le),_e(re,xe,ot),oe(le,re,g),mt(le,le,xe),oe(re,re,le),oe(le,xe,ot),oe(xe,K,L),Be(K,Ue),Ne(le,K,I),Ne(re,xe,I);for(se=0;se<16;se++)L[se+16]=le[se],L[se+32]=re[se],L[se+48]=K[se],L[se+64]=xe[se];var Vt=L.subarray(32),Vn=L.subarray(16);return zt(Vt,Vt),oe(Vn,Vn,Vt),Me(A,Vn),0}function ye(A,N){return tt(A,N,c)}function qe(A,N){return i(N,32),ye(A,N)}function yt(A,N,k){var T=new Uint8Array(32);return tt(T,k,N),F(A,o,T,U)}var At=ce,Ur=pe;function fa(A,N,k,T,L,I){var se=new Uint8Array(32);return yt(se,L,I),At(A,N,k,T,se)}function ha(A,N,k,T,L,I){var se=new Uint8Array(32);return yt(se,L,I),Ur(A,N,k,T,se)}function hr(){var A=0,N=0,k=0,T=0,L=65535,I,se,le;for(le=0;le<arguments.length;le++)I=arguments[le].lo,se=arguments[le].hi,A+=I&L,N+=I>>>16,k+=se&L,T+=se>>>16;return N+=A>>>16,k+=N>>>16,T+=k>>>16,new e(k&L|T<<16,A&L|N<<16)}function $o(A,N){return new e(A.hi>>>N,A.lo>>>N|A.hi<<32-N)}function ii(){var A=0,N=0,k;for(k=0;k<arguments.length;k++)A^=arguments[k].lo,N^=arguments[k].hi;return new e(N,A)}function ut(A,N){var k,T,L=32-N;return N<32?(k=A.hi>>>N|A.lo<<L,T=A.lo>>>N|A.hi<<L):N<64&&(k=A.lo>>>N|A.hi<<L,T=A.hi>>>N|A.lo<<L),new e(k,T)}function Uu(A,N,k){var T=A.hi&N.hi^~A.hi&k.hi,L=A.lo&N.lo^~A.lo&k.lo;return new e(T,L)}function Io(A,N,k){var T=A.hi&N.hi^A.hi&k.hi^N.hi&k.hi,L=A.lo&N.lo^A.lo&k.lo^N.lo&k.lo;return new e(T,L)}function Ho(A){return ii(ut(A,28),ut(A,34),ut(A,39))}function ai(A){return ii(ut(A,14),ut(A,18),ut(A,41))}function zu(A){return ii(ut(A,1),ut(A,8),$o(A,7))}function Fo(A){return ii(ut(A,19),ut(A,61),$o(A,6))}var $u=[new e(1116352408,3609767458),new e(1899447441,602891725),new e(3049323471,3964484399),new e(3921009573,2173295548),new e(961987163,4081628472),new e(1508970993,3053834265),new e(2453635748,2937671579),new e(2870763221,3664609560),new e(3624381080,2734883394),new e(310598401,1164996542),new e(607225278,1323610764),new e(1426881987,3590304994),new e(1925078388,4068182383),new e(2162078206,991336113),new e(2614888103,633803317),new e(3248222580,3479774868),new e(3835390401,2666613458),new e(4022224774,944711139),new e(264347078,2341262773),new e(604807628,2007800933),new e(770255983,1495990901),new e(1249150122,1856431235),new e(1555081692,3175218132),new e(1996064986,2198950837),new e(2554220882,3999719339),new e(2821834349,766784016),new e(2952996808,2566594879),new e(3210313671,3203337956),new e(3336571891,1034457026),new e(3584528711,2466948901),new e(113926993,3758326383),new e(338241895,168717936),new e(666307205,1188179964),new e(773529912,1546045734),new e(1294757372,1522805485),new e(1396182291,2643833823),new e(1695183700,2343527390),new e(1986661051,1014477480),new e(2177026350,1206759142),new e(2456956037,344077627),new e(2730485921,1290863460),new e(2820302411,3158454273),new e(3259730800,3505952657),new e(3345764771,106217008),new e(3516065817,3606008344),new e(3600352804,1432725776),new e(4094571909,1467031594),new e(275423344,851169720),new e(430227734,3100823752),new e(506948616,1363258195),new e(659060556,3750685593),new e(883997877,3785050280),new e(958139571,3318307427),new e(1322822218,3812723403),new e(1537002063,2003034995),new e(1747873779,3602036899),new e(1955562222,1575990012),new e(2024104815,1125592928),new e(2227730452,2716904306),new e(2361852424,442776044),new e(2428436474,593698344),new e(2756734187,3733110249),new e(3204031479,2999351573),new e(3329325298,3815920427),new e(3391569614,3928383900),new e(3515267271,566280711),new e(3940187606,3454069534),new e(4118630271,4000239992),new e(116418474,1914138554),new e(174292421,2731055270),new e(289380356,3203993006),new e(460393269,320620315),new e(685471733,587496836),new e(852142971,1086792851),new e(1017036298,365543100),new e(1126000580,2618297676),new e(1288033470,3409855158),new e(1501505948,4234509866),new e(1607167915,987167468),new e(1816402316,1246189591)];function Go(A,N,k){var T=[],L=[],I=[],se=[],le,K,re;for(K=0;K<8;K++)T[K]=I[K]=C(A,8*K);for(var xe=0;k>=128;){for(K=0;K<16;K++)se[K]=C(N,8*K+xe);for(K=0;K<80;K++){for(re=0;re<8;re++)L[re]=I[re];for(le=hr(I[7],ai(I[4]),Uu(I[4],I[5],I[6]),$u[K],se[K%16]),L[7]=hr(le,Ho(I[0]),Io(I[0],I[1],I[2])),L[3]=hr(L[3],le),re=0;re<8;re++)I[(re+1)%8]=L[re];if(K%16===15)for(re=0;re<16;re++)se[re]=hr(se[re],se[(re+9)%16],zu(se[(re+1)%16]),Fo(se[(re+14)%16]))}for(K=0;K<8;K++)I[K]=hr(I[K],T[K]),T[K]=I[K];xe+=128,k-=128}for(K=0;K<8;K++)q(A,8*K,T[K]);return k}var Ts=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 _t(A,N,k){var T=new Uint8Array(64),L=new Uint8Array(256),I,se=k;for(I=0;I<64;I++)T[I]=Ts[I];for(Go(T,N,k),k%=128,I=0;I<256;I++)L[I]=0;for(I=0;I<k;I++)L[I]=N[se-k+I];for(L[k]=128,k=256-128*(k<112?1:0),L[k-9]=0,q(L,k-8,new e(se/536870912|0,se<<3)),Go(T,L,k),I=0;I<64;I++)A[I]=T[I];return 0}function fn(A,N){var k=s(),T=s(),L=s(),I=s(),se=s(),le=s(),K=s(),re=s(),xe=s();_e(k,A[1],A[0]),_e(xe,N[1],N[0]),oe(k,k,xe),mt(T,A[0],A[1]),mt(xe,N[0],N[1]),oe(T,T,xe),oe(L,A[3],N[3]),oe(L,L,m),oe(I,A[2],N[2]),mt(I,I,I),_e(se,T,k),_e(le,I,L),mt(K,I,L),mt(re,T,k),oe(A[0],se,le),oe(A[1],re,K),oe(A[2],K,le),oe(A[3],se,re)}function Gt(A,N,k){var T;for(T=0;T<4;T++)Ne(A[T],N[T],k)}function da(A,N){var k=s(),T=s(),L=s();zt(L,N[2]),oe(k,N[0],L),oe(T,N[1],L),Me(A,T),A[31]^=pt(k)<<7}function ma(A,N,k){var T,L;for(ge(A[0],d),ge(A[1],p),ge(A[2],p),ge(A[3],d),L=255;L>=0;--L)T=k[L/8|0]>>(L&7)&1,Gt(A,N,T),fn(N,A),fn(A,A),Gt(A,N,T)}function oi(A,N){var k=[s(),s(),s(),s()];ge(k[0],b),ge(k[1],x),ge(k[2],p),oe(k[3],b,x),ma(A,k,N)}function zr(A,N,k){var T=new Uint8Array(64),L=[s(),s(),s(),s()],I;for(k||i(N,32),_t(T,N,32),T[0]&=248,T[31]&=127,T[31]|=64,oi(L,T),da(A,L),I=0;I<32;I++)N[I+32]=A[I];return 0}var dr=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 $r(A,N){var k,T,L,I;for(T=63;T>=32;--T){for(k=0,L=T-32,I=T-12;L<I;++L)N[L]+=k-16*N[T]*dr[L-(T-32)],k=Math.floor((N[L]+128)/256),N[L]-=k*256;N[L]+=k,N[T]=0}for(k=0,L=0;L<32;L++)N[L]+=k-(N[31]>>4)*dr[L],k=N[L]>>8,N[L]&=255;for(L=0;L<32;L++)N[L]-=k*dr[L];for(T=0;T<32;T++)N[T+1]+=N[T]>>8,A[T]=N[T]&255}function Fn(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;$r(A,N)}function Cs(A,N,k,T){var L=new Uint8Array(64),I=new Uint8Array(64),se=new Uint8Array(64),le,K,re=new Float64Array(64),xe=[s(),s(),s(),s()];_t(L,T,32),L[0]&=248,L[31]&=127,L[31]|=64;var Ue=k+64;for(le=0;le<k;le++)A[64+le]=N[le];for(le=0;le<32;le++)A[32+le]=L[32+le];for(_t(se,A.subarray(32),k+32),Fn(se),oi(xe,se),da(A,xe),le=32;le<64;le++)A[le]=T[le];for(_t(I,A,k+64),Fn(I),le=0;le<64;le++)re[le]=0;for(le=0;le<32;le++)re[le]=se[le];for(le=0;le<32;le++)for(K=0;K<32;K++)re[le+K]+=I[le]*L[K];return $r(A.subarray(32),re),Ue}function Ms(A,N){var k=s(),T=s(),L=s(),I=s(),se=s(),le=s(),K=s();return ge(A[2],p),Ot(A[1],N),Be(L,A[1]),oe(I,L,u),_e(L,L,A[2]),mt(I,A[2],I),Be(se,I),Be(le,se),oe(K,le,se),oe(k,K,L),oe(k,k,I),Mt(k,k),oe(k,k,L),oe(k,k,I),oe(k,k,I),oe(A[0],k,I),Be(T,A[0]),oe(T,T,I),Xe(T,L)&&oe(A[0],A[0],v),Be(T,A[0]),oe(T,T,I),Xe(T,L)?-1:(pt(A[0])===N[31]>>7&&_e(A[0],d,A[0]),oe(A[3],A[0],A[1]),0)}function pa(A,N,k,T){var L,I=new Uint8Array(32),se=new Uint8Array(64),le=[s(),s(),s(),s()],K=[s(),s(),s(),s()];if(k<64||Ms(K,T))return-1;for(L=0;L<k;L++)A[L]=N[L];for(L=0;L<32;L++)A[L+32]=T[L];if(_t(se,A,k),Fn(se),ma(le,K,se),oi(K,N.subarray(32)),fn(le,K),da(I,le),k-=64,M(N,0,I,0)){for(L=0;L<k;L++)A[L]=0;return-1}for(L=0;L<k;L++)A[L]=N[L+64];return k}var li=32,Ir=24,Gn=32,Hr=16,Fr=32,Rs=32,Gr=32,mr=32,Ds=32,ya=Ir,Vo=Gn,tr=Hr,it=64,gt=32,hn=64,Ls=32,ga=64;n.lowlevel={crypto_core_hsalsa20:F,crypto_stream_xor:he,crypto_stream:W,crypto_stream_salsa20_xor:D,crypto_stream_salsa20:Q,crypto_onetimeauth:H,crypto_onetimeauth_verify:J,crypto_verify_16:te,crypto_verify_32:M,crypto_secretbox:ce,crypto_secretbox_open:pe,crypto_scalarmult:tt,crypto_scalarmult_base:ye,crypto_box_beforenm:yt,crypto_box_afternm:At,crypto_box:fa,crypto_box_open:ha,crypto_box_keypair:qe,crypto_hash:_t,crypto_sign:Cs,crypto_sign_keypair:zr,crypto_sign_open:pa,crypto_secretbox_KEYBYTES:li,crypto_secretbox_NONCEBYTES:Ir,crypto_secretbox_ZEROBYTES:Gn,crypto_secretbox_BOXZEROBYTES:Hr,crypto_scalarmult_BYTES:Fr,crypto_scalarmult_SCALARBYTES:Rs,crypto_box_PUBLICKEYBYTES:Gr,crypto_box_SECRETKEYBYTES:mr,crypto_box_BEFORENMBYTES:Ds,crypto_box_NONCEBYTES:ya,crypto_box_ZEROBYTES:Vo,crypto_box_BOXZEROBYTES:tr,crypto_sign_BYTES:it,crypto_sign_PUBLICKEYBYTES:gt,crypto_sign_SECRETKEYBYTES:hn,crypto_sign_SEEDBYTES:Ls,crypto_hash_BYTES:ga,gf:s,D:u,L:dr,pack25519:Me,unpack25519:Ot,M:oe,A:mt,S:Be,Z:_e,pow2523:Mt,add:fn,set25519:ge,modL:$r,scalarmult:ma,scalarbase:oi};function Yo(A,N){if(A.length!==li)throw new Error("bad key size");if(N.length!==Ir)throw new Error("bad nonce size")}function Ko(A,N){if(A.length!==Gr)throw new Error("bad public key size");if(N.length!==mr)throw new Error("bad secret key size")}function Rt(){for(var A=0;A<arguments.length;A++)if(!(arguments[A]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ci(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){Rt(A,N,k),Yo(k,N);for(var T=new Uint8Array(Gn+A.length),L=new Uint8Array(T.length),I=0;I<A.length;I++)T[I+Gn]=A[I];return ce(L,T,T.length,N,k),L.subarray(Hr)},n.secretbox.open=function(A,N,k){Rt(A,N,k),Yo(k,N);for(var T=new Uint8Array(Hr+A.length),L=new Uint8Array(T.length),I=0;I<A.length;I++)T[I+Hr]=A[I];return T.length<32||pe(L,T,T.length,N,k)!==0?null:L.subarray(Gn)},n.secretbox.keyLength=li,n.secretbox.nonceLength=Ir,n.secretbox.overheadLength=Hr,n.scalarMult=function(A,N){if(Rt(A,N),A.length!==Rs)throw new Error("bad n size");if(N.length!==Fr)throw new Error("bad p size");var k=new Uint8Array(Fr);return tt(k,A,N),k},n.scalarMult.base=function(A){if(Rt(A),A.length!==Rs)throw new Error("bad n size");var N=new Uint8Array(Fr);return ye(N,A),N},n.scalarMult.scalarLength=Rs,n.scalarMult.groupElementLength=Fr,n.box=function(A,N,k,T){var L=n.box.before(k,T);return n.secretbox(A,N,L)},n.box.before=function(A,N){Rt(A,N),Ko(A,N);var k=new Uint8Array(Ds);return yt(k,A,N),k},n.box.after=n.secretbox,n.box.open=function(A,N,k,T){var L=n.box.before(k,T);return n.secretbox.open(A,N,L)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var A=new Uint8Array(Gr),N=new Uint8Array(mr);return qe(A,N),{publicKey:A,secretKey:N}},n.box.keyPair.fromSecretKey=function(A){if(Rt(A),A.length!==mr)throw new Error("bad secret key size");var N=new Uint8Array(Gr);return ye(N,A),{publicKey:N,secretKey:new Uint8Array(A)}},n.box.publicKeyLength=Gr,n.box.secretKeyLength=mr,n.box.sharedKeyLength=Ds,n.box.nonceLength=ya,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(A,N){if(Rt(A,N),N.length!==hn)throw new Error("bad secret key size");var k=new Uint8Array(it+A.length);return Cs(k,A,A.length,N),k},n.sign.open=function(A,N){if(Rt(A,N),N.length!==gt)throw new Error("bad public key size");var k=new Uint8Array(A.length),T=pa(k,A,A.length,N);if(T<0)return null;for(var L=new Uint8Array(T),I=0;I<L.length;I++)L[I]=k[I];return L},n.sign.detached=function(A,N){for(var k=n.sign(A,N),T=new Uint8Array(it),L=0;L<T.length;L++)T[L]=k[L];return T},n.sign.detached.verify=function(A,N,k){if(Rt(A,N,k),N.length!==it)throw new Error("bad signature size");if(k.length!==gt)throw new Error("bad public key size");var T=new Uint8Array(it+A.length),L=new Uint8Array(it+A.length),I;for(I=0;I<it;I++)T[I]=N[I];for(I=0;I<A.length;I++)T[I+it]=A[I];return pa(L,T,T.length,k)>=0},n.sign.keyPair=function(){var A=new Uint8Array(gt),N=new Uint8Array(hn);return zr(A,N),{publicKey:A,secretKey:N}},n.sign.keyPair.fromSecretKey=function(A){if(Rt(A),A.length!==hn)throw new Error("bad secret key size");for(var N=new Uint8Array(gt),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(Rt(A),A.length!==Ls)throw new Error("bad seed size");for(var N=new Uint8Array(gt),k=new Uint8Array(hn),T=0;T<32;T++)k[T]=A[T];return zr(N,k,!0),{publicKey:N,secretKey:k}},n.sign.publicKeyLength=gt,n.sign.secretKeyLength=hn,n.sign.seedLength=Ls,n.sign.signatureLength=it,n.hash=function(A){Rt(A);var N=new Uint8Array(ga);return _t(N,A,A.length),N},n.hash.hashLength=ga,n.verify=function(A,N){return Rt(A,N),A.length===0||N.length===0||A.length!==N.length?!1:ne(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 L,I=new Uint8Array(T);for(L=0;L<T;L+=N)A.getRandomValues(I.subarray(L,L+Math.min(T-L,N)));for(L=0;L<T;L++)k[L]=I[L];ci(I)})}else typeof require<"u"&&(A=require("crypto"),A&&A.randomBytes&&n.setPRNG(function(k,T){var L,I=A.randomBytes(T);for(L=0;L<T;L++)k[L]=I[L];ci(I)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const cc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;cc.sign.keyPair.fromSeed,cc.sign.detached,cc.sign.detached.verify,cc.randomBytes;var db;(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"})(db||(db={}));var mb;(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"})(mb||(mb={}));function _2(n){return e=>{let s={};return n.forEach(i=>{const o=i(e)||{};s=Object.assign(s,o)}),s}}function w2(){return()=>{}}function S2(n,e){return()=>{const s=typeof n=="function"?n():n,i=typeof e=="function"?e():e;return{user:s,pass:i}}}function E2(n){return()=>({auth_token:typeof n=="function"?n():n})}const Cx=120*1e3,O2=2,Mx=2*1e3;function A2(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Cx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Mx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function j2(n){const e=[];return typeof n.authenticator=="function"&&e.push(n.authenticator),Array.isArray(n.authenticator)&&e.push(...n.authenticator),n.token&&e.push(E2(n.token)),n.user&&e.push(S2(n.user,n.pass)),e.length===0?w2():_2(e)}function k2(n){const e=`${Od}:${kx()}`;if(n=n||{servers:[e]},n.servers=n.servers||[],typeof n.servers=="string"&&(n.servers=[n.servers]),n.servers.length>0&&n.port)throw new be("port and servers options are mutually exclusive",fe.InvalidOption);n.servers.length===0&&n.port&&(n.servers=[`${Od}:${n.port}`]),n.servers&&n.servers.length===0&&(n.servers=[e]);const s=Au(A2(),n);if(s.authenticator=j2(s),["reconnectDelayHandler","authenticator"].forEach(i=>{if(s[i]&&typeof s[i]!="function")throw new be(`${i} option should be a function`,fe.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{Lr(s.inboxPrefix)}catch(i){throw new be(i.message,fe.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Rd()=="function"),s.resolve&&typeof Rd()!="function")throw new be("'resolve' is not supported on this client",fe.InvalidOption);return s}function N2(n,e){const{proto:s,tls_required:i,tls_available:o}=n;if((s===void 0||s<1)&&e.noEcho)throw new be("noEcho",fe.ServerOptionNotAvailable);const c=i||o||!1;if(e.tls&&!c)throw new be("tls",fe.ServerOptionNotAvailable)}const T2=1024*32,C2=/^INFO\s+([^\r\n]+)\r\n/i,M2=wo(`PONG\r
|
|
37
|
+
`,yu=oa.fromAscii(su),e2=new Uint8Array(yu)[0],t2=new Uint8Array(yu)[1];function n2(n){for(let e=0;e<n.length;e++){const s=e+1;if(n.byteLength>s&&n[e]===e2&&n[s]===t2)return s+1}return 0}function r2(n){const e=n2(n);if(e>0){const i=new Uint8Array(n).slice(0,e);return En.decode(i)}return""}const s2=4,Nx=48,i2=65,a2=97;function o2(n,e,s,i){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((d,p)=>{o[p]=d}),o[12]=n,o[13]=e,o[14]=s,o[15]=i,o}function Dd(n){return l2(n)!==void 0}function l2(n){for(let e=0;e<n.length;e++)switch(n[e]){case".":return Tx(n);case":":return c2(n)}}function Tx(n){const e=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}=u2(n);if(!c||i>255)return;n=n.substring(o),e[s]=i}return o2(e[0],e[1],e[2],e[3])}function c2(n){const e=new Uint8Array(16);let s=-1;if(n.length>=2&&n[0]===":"&&n[1]===":"&&(s=0,n=n.substring(2),n.length===0))return e;let i=0;for(;i<16;){const{n:o,c,ok:d}=f2(n);if(!d||o>65535)return;if(c<n.length&&n[c]==="."){if(s<0&&i!=12||i+4>16)return;const p=Tx(n);if(p===void 0)return;e[i]=p[12],e[i+1]=p[13],e[i+2]=p[14],e[i+3]=p[15],n="",i+=s2;break}if(e[i]=o>>8,e[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--)e[c+o]=e[c];for(let c=s+o-1;c>=s;c--)e[c]=0}else if(s>=0)return;return e}}function u2(n){let e=0,s=0;for(e=0;e<n.length&&48<=n.charCodeAt(e)&&n.charCodeAt(e)<=57;e++)if(s=s*10+(n.charCodeAt(e)-Nx),s>=16777215)return{n:16777215,c:e,ok:!1};return e===0?{n:0,c:0,ok:!1}:{n:s,c:e,ok:!0}}function f2(n){let e=0,s=0;for(s=0;s<n.length;s++){if(48<=n.charCodeAt(s)&&n.charCodeAt(s)<=57)e*=16,e+=n.charCodeAt(s)-Nx;else if(97<=n.charCodeAt(s)&&n.charCodeAt(s)<=102)e*=16,e+=n.charCodeAt(s)-a2+10;else if(65<=n.charCodeAt(s)&&n.charCodeAt(s)<=70)e*=16,e+=n.charCodeAt(s)-i2+10;else break;if(e>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n:e,c:s,ok:!0}}function h2(n){return n.indexOf("[")!==-1||n.indexOf("::")!==-1?!1:n.indexOf(".")!==-1||n.split(":").length<=2}function Ld(n){return!h2(n)}function d2(n){const e="::FFFF:",s=n.toUpperCase().indexOf(e);if(s!==-1&&n.indexOf(".")!==-1){let i=n.substring(s+e.length);return i=i.replace("[",""),i.replace("]","")}return n}function m2(n){n=n.trim(),n.match(/^(.*:\/\/)(.*)/m)&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2")),n=d2(n),Ld(n)&&n.indexOf("[")===-1&&(n=`[${n}]`);const e=Ld(n)?n.match(/(]:)(\d+)/):n.match(/(:)(\d+)/),s=e&&e.length===3&&e[1]&&e[2]?parseInt(e[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 Eo{constructor(e,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=e,this.tlsName="";const i=m2(e);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(e){if(!e.fn||e.resolve===!1)return[this];const s=[];if(Dd(this.hostname))return[this];{const i=await e.fn(this.hostname);e.debug&&console.log(`resolve ${this.hostname} = ${i.join(",")}`);for(const o of i){const c=this.port===80?"https":"http",d=new URL(`${c}://${Ld(o)?"["+o+"]":o}`);d.port=`${this.port}`;const p=new Eo(d.host,!1);p.tlsName=this.hostname,s.push(p)}}return e.randomize&&Sx(s),this.resolves=s,s}}class p2{constructor(e=[],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=nd();e&&(e.forEach(o=>{o=i?i(o):o,this.servers.push(new Eo(o))}),this.randomize&&(this.servers=Sx(this.servers))),this.servers.length===0&&this.addServer(`${Od}:${kx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const e=this.getCurrentServer();Dd(e.hostname)||(this.tlsName=e.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(e,s=!1){const i=nd();e=i?i(e):e;const o=new Eo(e,s);Dd(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const e=this.servers.shift();return e&&(this.servers.push(e),this.currentServer=e),e}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(e){if(e){const s=this.servers.indexOf(e);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(e,s){const i=[];let o=[];const c=nd(),d=new Map;e.connect_urls&&e.connect_urls.length>0&&e.connect_urls.forEach(g=>{g=c?c(g,s):g;const u=new Eo(g,!0);d.set(g,u)});const p=[];return this.servers.forEach((g,u)=>{const m=g.listen;g.gossiped&&this.currentServer.listen!==m&&d.get(m)===void 0&&p.push(u),d.delete(m)}),p.reverse(),p.forEach(g=>{const u=this.servers.splice(g,1);o=o.concat(u[0].listen)}),d.forEach((g,u)=>{this.servers.push(g),i.push(u)}),{added:i,deleted:o}}}class y2{constructor(){j(this,"baseInbox");j(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(e){return this.baseInbox=`${Lr(e)}.`,this.baseInbox}add(e){isNaN(e.received)||(e.received=0),this.reqs.set(e.token,e)}get(e){return this.reqs.get(e)}cancel(e){this.reqs.delete(e.token)}getToken(e){const s=e.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(e,s){if(s&&s.permissionContext){if(e)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(e,s)=>{const i=this.getToken(s);if(i){const o=this.get(i);o&&(e===null&&s.headers&&(e=Ex(s)),o.resolver(e,s))}}}close(){const e=be.errorForCode(fe.Timeout);this.reqs.forEach(s=>{s.resolver(e,{})})}}class g2{constructor(e,s,i){j(this,"ph");j(this,"interval");j(this,"maxOut");j(this,"timer");j(this,"pendings");this.ph=e,this.interval=s,this.maxOut=i,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(e){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),e&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Xi.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const e=dt();this.ph.flush(e).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(e),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(e=>(e.resolve(),!1))}}class b2 extends Error{constructor(e){super(e),this.name="AssertionError"}}function x2(n,e="Assertion failed."){if(!n)throw new b2(e)}const ub=32*1024,rd=2**32-2;function lc(n,e,s=0){const i=e.byteLength-s;return n.byteLength>i&&(n=n.subarray(0,i)),e.set(n,s),n.byteLength}class sd{constructor(e){j(this,"_buf");j(this,"_off");if(this._off=0,e==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(e)}bytes(e={copy:!0}){return e.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(e){if(e===0){this.reset();return}if(e<0||e>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+e)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(e){const s=this._buf.byteLength;return e<=this.capacity-s?(this._reslice(s+e),s):-1}_reslice(e){x2(e<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,e)}readByte(){const e=new Uint8Array(1);return this.read(e)?e[0]:null}read(e){if(this.empty())return this.reset(),e.byteLength===0?0:null;const s=lc(this._buf.subarray(this._off),e);return this._off+=s,s}writeByte(e){return this.write(Uint8Array.of(e))}writeString(e){return this.write(si.encode(e))}write(e){const s=this._grow(e.byteLength);return lc(e,this._buf,s)}_grow(e){const s=this.length;s===0&&this._off!==0&&this.reset();const i=this._tryGrowByReslice(e);if(i>=0)return i;const o=this.capacity;if(e<=Math.floor(o/2)-s)lc(this._buf.subarray(this._off),this._buf);else{if(o+e>rd)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*o+e,rd));lc(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(s+e,rd)),s}grow(e){if(e<0)throw Error("Buffer._grow: negative count");const s=this._grow(e);this._reslice(s)}readFrom(e){let s=0;const i=new Uint8Array(ub);for(;;){const o=this.capacity-this.length<ub,c=o?i:new Uint8Array(this._buf.buffer,this.length),d=e.read(c);if(d===null)return s;o?this.write(c.subarray(0,d)):this._reslice(this.length+d),s+=d}}}var Xt;(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"})(Xt||(Xt={}));function fb(){const n={};return n.sid=-1,n.hdr=-1,n.size=-1,n}const v2=48;class hb{constructor(e){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=e,this.state=de.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(e){let s;for(s=0;s<e.length;s++){const i=e[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=fb();break;case me.H:case me.h:this.state=de.OP_H,this.hdr=0,this.ma=fb();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(e.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(e.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(e.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(e.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(e.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():e.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:Xt.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=e.length-s;c<o&&(o=c),o>0?(this.msgBuf.write(e.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(i)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Xt.MSG,msg:this.ma,data:e.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(e.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(e.subarray(s))}break;case de.OP_PLUS_OK:switch(i){case me.NL:this.dispatcher.push({kind:Xt.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(e.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(e.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(e.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(e.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=e.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Xt.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(e.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(e.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(e.subarray(s))}break;case de.OP_PONG:switch(i){case me.NL:this.dispatcher.push({kind:Xt.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(e.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(e.subarray(s))}break;case de.OP_PING:switch(i){case me.NL:this.dispatcher.push({kind:Xt.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(e.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(e.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(e.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(e.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=e.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Xt.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(e.subarray(s))}}(this.state===de.MSG_ARG||this.state===de.MINUS_ERR_ARG||this.state===de.INFO_ARG)&&!this.argBuf&&(this.argBuf=new sd(e.subarray(this.as,s-this.drop))),this.state===de.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new sd(e.subarray(this.as)))}cloneMsgArg(){const e=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,i=new Uint8Array(e+s);i.set(this.ma.subject),this.ma.reply&&i.set(this.ma.reply,e),this.argBuf=new sd(i),this.ma.subject=i.subarray(0,e),this.ma.reply&&(this.ma.reply=i.subarray(e))}processMsgArgs(e){if(this.hdr>=0)return this.processHeaderMsgArgs(e);const s=[];let i=-1;for(let o=0;o<e.length;o++)switch(e[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(e.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(e.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(e,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(e,"processMsgArgs Bad or Missing Size Error")}fail(e,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${En.decode(e)}`)}processHeaderMsgArgs(e){const s=[];let i=-1;for(let o=0;o<e.length;o++)switch(e[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(e.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(e.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(e,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(e){if(e.length===0)return-1;let s=0;for(let i=0;i<e.length;i++){if(e[i]<48||e[i]>57)return-1;s=s*10+(e[i]-v2)}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 e=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(),p=s([1]),g=s([56129,1]),u=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 e(k,T)}function B(A,N,k){var T;for(T=0;T<4;T++)A[N+T]=k&255,k>>>=8}function q(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 ne(A,N,k,T,L){var I,se=0;for(I=0;I<L;I++)se|=A[N+I]^k[T+I];return(1&se-1>>>8)-1}function te(A,N,k,T){return ne(A,N,k,T,16)}function M(A,N,k,T){return ne(A,N,k,T,32)}function z(A,N,k,T,L){var I=new Uint32Array(16),se=new Uint32Array(16),le=new Uint32Array(16),K=new Uint32Array(4),re,xe,Ue;for(re=0;re<4;re++)se[5*re]=S(T,4*re),se[1+re]=S(k,4*re),se[6+re]=S(N,4*re),se[11+re]=S(k,16+4*re);for(re=0;re<16;re++)le[re]=se[re];for(re=0;re<20;re++){for(xe=0;xe<4;xe++){for(Ue=0;Ue<4;Ue++)K[Ue]=se[(5*xe+4*Ue)%16];for(K[1]^=_(K[0]+K[3]|0,7),K[2]^=_(K[1]+K[0]|0,9),K[3]^=_(K[2]+K[1]|0,13),K[0]^=_(K[3]+K[2]|0,18),Ue=0;Ue<4;Ue++)I[4*xe+(xe+Ue)%4]=K[Ue]}for(Ue=0;Ue<16;Ue++)se[Ue]=I[Ue]}if(L){for(re=0;re<16;re++)se[re]=se[re]+le[re]|0;for(re=0;re<4;re++)se[5*re]=se[5*re]-S(T,4*re)|0,se[6+re]=se[6+re]-S(N,4*re)|0;for(re=0;re<4;re++)B(A,4*re,se[5*re]),B(A,16+4*re,se[6+re])}else for(re=0;re<16;re++)B(A,4*re,se[re]+le[re]|0)}function ae(A,N,k,T){return z(A,N,k,T,!1),0}function F(A,N,k,T){return z(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,L,I,se){var le=new Uint8Array(16),K=new Uint8Array(64),re,xe;if(!L)return 0;for(xe=0;xe<16;xe++)le[xe]=0;for(xe=0;xe<8;xe++)le[xe]=I[xe];for(;L>=64;){for(ae(K,le,se,U),xe=0;xe<64;xe++)A[N+xe]=(k?k[T+xe]:0)^K[xe];for(re=1,xe=8;xe<16;xe++)re=re+(le[xe]&255)|0,le[xe]=re&255,re>>>=8;L-=64,N+=64,k&&(T+=64)}if(L>0)for(ae(K,le,se,U),xe=0;xe<L;xe++)A[N+xe]=(k?k[T+xe]:0)^K[xe];return 0}function Q(A,N,k,T,L){return D(A,N,null,0,k,T,L)}function W(A,N,k,T,L){var I=new Uint8Array(32);return F(I,T,L,U),Q(A,N,k,T.subarray(16),I)}function he(A,N,k,T,L,I,se){var le=new Uint8Array(32);return F(le,I,se,U),D(A,N,k,T,L,I.subarray(16),le)}function Ee(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 Ae=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,L,I){var se,le,K,re,xe=new Uint32Array(17),Ue=new Uint32Array(17),ot=new Uint32Array(17),Vt=new Uint32Array(17),Vn=new Uint32Array(17);for(K=0;K<17;K++)Ue[K]=ot[K]=0;for(K=0;K<16;K++)Ue[K]=I[K];for(Ue[3]&=15,Ue[4]&=252,Ue[7]&=15,Ue[8]&=252,Ue[11]&=15,Ue[12]&=252,Ue[15]&=15;L>0;){for(K=0;K<17;K++)Vt[K]=0;for(K=0;K<16&&K<L;++K)Vt[K]=k[T+K];for(Vt[K]=1,T+=K,L-=K,Ee(ot,Vt),le=0;le<17;le++)for(xe[le]=0,K=0;K<17;K++)xe[le]=xe[le]+ot[K]*(K<=le?Ue[le-K]:320*Ue[le+17-K]|0)|0|0;for(le=0;le<17;le++)ot[le]=xe[le];for(re=0,K=0;K<16;K++)re=re+ot[K]|0,ot[K]=re&255,re>>>=8;for(re=re+ot[16]|0,ot[16]=re&3,re=5*(re>>>2)|0,K=0;K<16;K++)re=re+ot[K]|0,ot[K]=re&255,re>>>=8;re=re+ot[16]|0,ot[16]=re}for(K=0;K<17;K++)Vn[K]=ot[K];for(Ee(ot,Ae),se=-(ot[16]>>>7)|0,K=0;K<17;K++)ot[K]^=se&(Vn[K]^ot[K]);for(K=0;K<16;K++)Vt[K]=I[K+16];for(Vt[16]=0,Ee(ot,Vt),K=0;K<16;K++)A[N+K]=ot[K];return 0}function J(A,N,k,T,L,I){var se=new Uint8Array(16);return H(se,0,k,T,L,I),te(A,N,se,0)}function ce(A,N,k,T,L){var I;if(k<32)return-1;for(he(A,0,N,0,k,T,L),H(A,16,A,32,k-32,A),I=0;I<16;I++)A[I]=0;return 0}function pe(A,N,k,T,L){var I,se=new Uint8Array(32);if(k<32||(W(se,0,32,T,L),J(N,16,N,32,k-32,se)!==0))return-1;for(he(A,0,N,0,k,T,L),I=0;I<32;I++)A[I]=0;return 0}function ge(A,N){var k;for(k=0;k<16;k++)A[k]=N[k]|0}function Ce(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 Ne(A,N,k){for(var T,L=~(k-1),I=0;I<16;I++)T=L&(A[I]^N[I]),A[I]^=T,N[I]^=T}function Me(A,N){var k,T,L,I=s(),se=s();for(k=0;k<16;k++)se[k]=N[k];for(Ce(se),Ce(se),Ce(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),L=I[15]>>16&1,I[14]&=65535,Ne(se,I,1-L)}for(k=0;k<16;k++)A[2*k]=se[k]&255,A[2*k+1]=se[k]>>8}function Xe(A,N){var k=new Uint8Array(32),T=new Uint8Array(32);return Me(k,A),Me(T,N),M(k,0,T,0)}function pt(A){var N=new Uint8Array(32);return Me(N,A),N[0]&1}function Ot(A,N){var k;for(k=0;k<16;k++)A[k]=N[2*k]+(N[2*k+1]<<8);A[15]&=32767}function mt(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]+k[T]|0}function _e(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]-k[T]|0}function oe(A,N,k){var T,L,I=new Float64Array(31);for(T=0;T<31;T++)I[T]=0;for(T=0;T<16;T++)for(L=0;L<16;L++)I[T+L]+=N[T]*k[L];for(T=0;T<15;T++)I[T]+=38*I[T+16];for(T=0;T<16;T++)A[T]=I[T];Ce(A),Ce(A)}function Be(A,N){oe(A,N,N)}function zt(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=253;T>=0;T--)Be(k,k),T!==2&&T!==4&&oe(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function Mt(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=250;T>=0;T--)Be(k,k),T!==1&&oe(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function tt(A,N,k){var T=new Uint8Array(32),L=new Float64Array(80),I,se,le=s(),K=s(),re=s(),xe=s(),Ue=s(),ot=s();for(se=0;se<31;se++)T[se]=N[se];for(T[31]=N[31]&127|64,T[0]&=248,Ot(L,k),se=0;se<16;se++)K[se]=L[se],xe[se]=le[se]=re[se]=0;for(le[0]=xe[0]=1,se=254;se>=0;--se)I=T[se>>>3]>>>(se&7)&1,Ne(le,K,I),Ne(re,xe,I),mt(Ue,le,re),_e(le,le,re),mt(re,K,xe),_e(K,K,xe),Be(xe,Ue),Be(ot,le),oe(le,re,le),oe(re,K,Ue),mt(Ue,le,re),_e(le,le,re),Be(K,le),_e(re,xe,ot),oe(le,re,g),mt(le,le,xe),oe(re,re,le),oe(le,xe,ot),oe(xe,K,L),Be(K,Ue),Ne(le,K,I),Ne(re,xe,I);for(se=0;se<16;se++)L[se+16]=le[se],L[se+32]=re[se],L[se+48]=K[se],L[se+64]=xe[se];var Vt=L.subarray(32),Vn=L.subarray(16);return zt(Vt,Vt),oe(Vn,Vn,Vt),Me(A,Vn),0}function ye(A,N){return tt(A,N,c)}function Pe(A,N){return i(N,32),ye(A,N)}function yt(A,N,k){var T=new Uint8Array(32);return tt(T,k,N),F(A,o,T,U)}var At=ce,Ur=pe;function fa(A,N,k,T,L,I){var se=new Uint8Array(32);return yt(se,L,I),At(A,N,k,T,se)}function ha(A,N,k,T,L,I){var se=new Uint8Array(32);return yt(se,L,I),Ur(A,N,k,T,se)}function hr(){var A=0,N=0,k=0,T=0,L=65535,I,se,le;for(le=0;le<arguments.length;le++)I=arguments[le].lo,se=arguments[le].hi,A+=I&L,N+=I>>>16,k+=se&L,T+=se>>>16;return N+=A>>>16,k+=N>>>16,T+=k>>>16,new e(k&L|T<<16,A&L|N<<16)}function $o(A,N){return new e(A.hi>>>N,A.lo>>>N|A.hi<<32-N)}function ii(){var A=0,N=0,k;for(k=0;k<arguments.length;k++)A^=arguments[k].lo,N^=arguments[k].hi;return new e(N,A)}function ut(A,N){var k,T,L=32-N;return N<32?(k=A.hi>>>N|A.lo<<L,T=A.lo>>>N|A.hi<<L):N<64&&(k=A.lo>>>N|A.hi<<L,T=A.hi>>>N|A.lo<<L),new e(k,T)}function Uu(A,N,k){var T=A.hi&N.hi^~A.hi&k.hi,L=A.lo&N.lo^~A.lo&k.lo;return new e(T,L)}function Io(A,N,k){var T=A.hi&N.hi^A.hi&k.hi^N.hi&k.hi,L=A.lo&N.lo^A.lo&k.lo^N.lo&k.lo;return new e(T,L)}function Ho(A){return ii(ut(A,28),ut(A,34),ut(A,39))}function ai(A){return ii(ut(A,14),ut(A,18),ut(A,41))}function zu(A){return ii(ut(A,1),ut(A,8),$o(A,7))}function Fo(A){return ii(ut(A,19),ut(A,61),$o(A,6))}var $u=[new e(1116352408,3609767458),new e(1899447441,602891725),new e(3049323471,3964484399),new e(3921009573,2173295548),new e(961987163,4081628472),new e(1508970993,3053834265),new e(2453635748,2937671579),new e(2870763221,3664609560),new e(3624381080,2734883394),new e(310598401,1164996542),new e(607225278,1323610764),new e(1426881987,3590304994),new e(1925078388,4068182383),new e(2162078206,991336113),new e(2614888103,633803317),new e(3248222580,3479774868),new e(3835390401,2666613458),new e(4022224774,944711139),new e(264347078,2341262773),new e(604807628,2007800933),new e(770255983,1495990901),new e(1249150122,1856431235),new e(1555081692,3175218132),new e(1996064986,2198950837),new e(2554220882,3999719339),new e(2821834349,766784016),new e(2952996808,2566594879),new e(3210313671,3203337956),new e(3336571891,1034457026),new e(3584528711,2466948901),new e(113926993,3758326383),new e(338241895,168717936),new e(666307205,1188179964),new e(773529912,1546045734),new e(1294757372,1522805485),new e(1396182291,2643833823),new e(1695183700,2343527390),new e(1986661051,1014477480),new e(2177026350,1206759142),new e(2456956037,344077627),new e(2730485921,1290863460),new e(2820302411,3158454273),new e(3259730800,3505952657),new e(3345764771,106217008),new e(3516065817,3606008344),new e(3600352804,1432725776),new e(4094571909,1467031594),new e(275423344,851169720),new e(430227734,3100823752),new e(506948616,1363258195),new e(659060556,3750685593),new e(883997877,3785050280),new e(958139571,3318307427),new e(1322822218,3812723403),new e(1537002063,2003034995),new e(1747873779,3602036899),new e(1955562222,1575990012),new e(2024104815,1125592928),new e(2227730452,2716904306),new e(2361852424,442776044),new e(2428436474,593698344),new e(2756734187,3733110249),new e(3204031479,2999351573),new e(3329325298,3815920427),new e(3391569614,3928383900),new e(3515267271,566280711),new e(3940187606,3454069534),new e(4118630271,4000239992),new e(116418474,1914138554),new e(174292421,2731055270),new e(289380356,3203993006),new e(460393269,320620315),new e(685471733,587496836),new e(852142971,1086792851),new e(1017036298,365543100),new e(1126000580,2618297676),new e(1288033470,3409855158),new e(1501505948,4234509866),new e(1607167915,987167468),new e(1816402316,1246189591)];function Go(A,N,k){var T=[],L=[],I=[],se=[],le,K,re;for(K=0;K<8;K++)T[K]=I[K]=C(A,8*K);for(var xe=0;k>=128;){for(K=0;K<16;K++)se[K]=C(N,8*K+xe);for(K=0;K<80;K++){for(re=0;re<8;re++)L[re]=I[re];for(le=hr(I[7],ai(I[4]),Uu(I[4],I[5],I[6]),$u[K],se[K%16]),L[7]=hr(le,Ho(I[0]),Io(I[0],I[1],I[2])),L[3]=hr(L[3],le),re=0;re<8;re++)I[(re+1)%8]=L[re];if(K%16===15)for(re=0;re<16;re++)se[re]=hr(se[re],se[(re+9)%16],zu(se[(re+1)%16]),Fo(se[(re+14)%16]))}for(K=0;K<8;K++)I[K]=hr(I[K],T[K]),T[K]=I[K];xe+=128,k-=128}for(K=0;K<8;K++)q(A,8*K,T[K]);return k}var Ts=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 _t(A,N,k){var T=new Uint8Array(64),L=new Uint8Array(256),I,se=k;for(I=0;I<64;I++)T[I]=Ts[I];for(Go(T,N,k),k%=128,I=0;I<256;I++)L[I]=0;for(I=0;I<k;I++)L[I]=N[se-k+I];for(L[k]=128,k=256-128*(k<112?1:0),L[k-9]=0,q(L,k-8,new e(se/536870912|0,se<<3)),Go(T,L,k),I=0;I<64;I++)A[I]=T[I];return 0}function fn(A,N){var k=s(),T=s(),L=s(),I=s(),se=s(),le=s(),K=s(),re=s(),xe=s();_e(k,A[1],A[0]),_e(xe,N[1],N[0]),oe(k,k,xe),mt(T,A[0],A[1]),mt(xe,N[0],N[1]),oe(T,T,xe),oe(L,A[3],N[3]),oe(L,L,m),oe(I,A[2],N[2]),mt(I,I,I),_e(se,T,k),_e(le,I,L),mt(K,I,L),mt(re,T,k),oe(A[0],se,le),oe(A[1],re,K),oe(A[2],K,le),oe(A[3],se,re)}function Gt(A,N,k){var T;for(T=0;T<4;T++)Ne(A[T],N[T],k)}function da(A,N){var k=s(),T=s(),L=s();zt(L,N[2]),oe(k,N[0],L),oe(T,N[1],L),Me(A,T),A[31]^=pt(k)<<7}function ma(A,N,k){var T,L;for(ge(A[0],d),ge(A[1],p),ge(A[2],p),ge(A[3],d),L=255;L>=0;--L)T=k[L/8|0]>>(L&7)&1,Gt(A,N,T),fn(N,A),fn(A,A),Gt(A,N,T)}function oi(A,N){var k=[s(),s(),s(),s()];ge(k[0],b),ge(k[1],x),ge(k[2],p),oe(k[3],b,x),ma(A,k,N)}function zr(A,N,k){var T=new Uint8Array(64),L=[s(),s(),s(),s()],I;for(k||i(N,32),_t(T,N,32),T[0]&=248,T[31]&=127,T[31]|=64,oi(L,T),da(A,L),I=0;I<32;I++)N[I+32]=A[I];return 0}var dr=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 $r(A,N){var k,T,L,I;for(T=63;T>=32;--T){for(k=0,L=T-32,I=T-12;L<I;++L)N[L]+=k-16*N[T]*dr[L-(T-32)],k=Math.floor((N[L]+128)/256),N[L]-=k*256;N[L]+=k,N[T]=0}for(k=0,L=0;L<32;L++)N[L]+=k-(N[31]>>4)*dr[L],k=N[L]>>8,N[L]&=255;for(L=0;L<32;L++)N[L]-=k*dr[L];for(T=0;T<32;T++)N[T+1]+=N[T]>>8,A[T]=N[T]&255}function Fn(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;$r(A,N)}function Cs(A,N,k,T){var L=new Uint8Array(64),I=new Uint8Array(64),se=new Uint8Array(64),le,K,re=new Float64Array(64),xe=[s(),s(),s(),s()];_t(L,T,32),L[0]&=248,L[31]&=127,L[31]|=64;var Ue=k+64;for(le=0;le<k;le++)A[64+le]=N[le];for(le=0;le<32;le++)A[32+le]=L[32+le];for(_t(se,A.subarray(32),k+32),Fn(se),oi(xe,se),da(A,xe),le=32;le<64;le++)A[le]=T[le];for(_t(I,A,k+64),Fn(I),le=0;le<64;le++)re[le]=0;for(le=0;le<32;le++)re[le]=se[le];for(le=0;le<32;le++)for(K=0;K<32;K++)re[le+K]+=I[le]*L[K];return $r(A.subarray(32),re),Ue}function Ms(A,N){var k=s(),T=s(),L=s(),I=s(),se=s(),le=s(),K=s();return ge(A[2],p),Ot(A[1],N),Be(L,A[1]),oe(I,L,u),_e(L,L,A[2]),mt(I,A[2],I),Be(se,I),Be(le,se),oe(K,le,se),oe(k,K,L),oe(k,k,I),Mt(k,k),oe(k,k,L),oe(k,k,I),oe(k,k,I),oe(A[0],k,I),Be(T,A[0]),oe(T,T,I),Xe(T,L)&&oe(A[0],A[0],v),Be(T,A[0]),oe(T,T,I),Xe(T,L)?-1:(pt(A[0])===N[31]>>7&&_e(A[0],d,A[0]),oe(A[3],A[0],A[1]),0)}function pa(A,N,k,T){var L,I=new Uint8Array(32),se=new Uint8Array(64),le=[s(),s(),s(),s()],K=[s(),s(),s(),s()];if(k<64||Ms(K,T))return-1;for(L=0;L<k;L++)A[L]=N[L];for(L=0;L<32;L++)A[L+32]=T[L];if(_t(se,A,k),Fn(se),ma(le,K,se),oi(K,N.subarray(32)),fn(le,K),da(I,le),k-=64,M(N,0,I,0)){for(L=0;L<k;L++)A[L]=0;return-1}for(L=0;L<k;L++)A[L]=N[L+64];return k}var li=32,Ir=24,Gn=32,Hr=16,Fr=32,Rs=32,Gr=32,mr=32,Ds=32,ya=Ir,Vo=Gn,tr=Hr,it=64,gt=32,hn=64,Ls=32,ga=64;n.lowlevel={crypto_core_hsalsa20:F,crypto_stream_xor:he,crypto_stream:W,crypto_stream_salsa20_xor:D,crypto_stream_salsa20:Q,crypto_onetimeauth:H,crypto_onetimeauth_verify:J,crypto_verify_16:te,crypto_verify_32:M,crypto_secretbox:ce,crypto_secretbox_open:pe,crypto_scalarmult:tt,crypto_scalarmult_base:ye,crypto_box_beforenm:yt,crypto_box_afternm:At,crypto_box:fa,crypto_box_open:ha,crypto_box_keypair:Pe,crypto_hash:_t,crypto_sign:Cs,crypto_sign_keypair:zr,crypto_sign_open:pa,crypto_secretbox_KEYBYTES:li,crypto_secretbox_NONCEBYTES:Ir,crypto_secretbox_ZEROBYTES:Gn,crypto_secretbox_BOXZEROBYTES:Hr,crypto_scalarmult_BYTES:Fr,crypto_scalarmult_SCALARBYTES:Rs,crypto_box_PUBLICKEYBYTES:Gr,crypto_box_SECRETKEYBYTES:mr,crypto_box_BEFORENMBYTES:Ds,crypto_box_NONCEBYTES:ya,crypto_box_ZEROBYTES:Vo,crypto_box_BOXZEROBYTES:tr,crypto_sign_BYTES:it,crypto_sign_PUBLICKEYBYTES:gt,crypto_sign_SECRETKEYBYTES:hn,crypto_sign_SEEDBYTES:Ls,crypto_hash_BYTES:ga,gf:s,D:u,L:dr,pack25519:Me,unpack25519:Ot,M:oe,A:mt,S:Be,Z:_e,pow2523:Mt,add:fn,set25519:ge,modL:$r,scalarmult:ma,scalarbase:oi};function Yo(A,N){if(A.length!==li)throw new Error("bad key size");if(N.length!==Ir)throw new Error("bad nonce size")}function Ko(A,N){if(A.length!==Gr)throw new Error("bad public key size");if(N.length!==mr)throw new Error("bad secret key size")}function Rt(){for(var A=0;A<arguments.length;A++)if(!(arguments[A]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ci(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){Rt(A,N,k),Yo(k,N);for(var T=new Uint8Array(Gn+A.length),L=new Uint8Array(T.length),I=0;I<A.length;I++)T[I+Gn]=A[I];return ce(L,T,T.length,N,k),L.subarray(Hr)},n.secretbox.open=function(A,N,k){Rt(A,N,k),Yo(k,N);for(var T=new Uint8Array(Hr+A.length),L=new Uint8Array(T.length),I=0;I<A.length;I++)T[I+Hr]=A[I];return T.length<32||pe(L,T,T.length,N,k)!==0?null:L.subarray(Gn)},n.secretbox.keyLength=li,n.secretbox.nonceLength=Ir,n.secretbox.overheadLength=Hr,n.scalarMult=function(A,N){if(Rt(A,N),A.length!==Rs)throw new Error("bad n size");if(N.length!==Fr)throw new Error("bad p size");var k=new Uint8Array(Fr);return tt(k,A,N),k},n.scalarMult.base=function(A){if(Rt(A),A.length!==Rs)throw new Error("bad n size");var N=new Uint8Array(Fr);return ye(N,A),N},n.scalarMult.scalarLength=Rs,n.scalarMult.groupElementLength=Fr,n.box=function(A,N,k,T){var L=n.box.before(k,T);return n.secretbox(A,N,L)},n.box.before=function(A,N){Rt(A,N),Ko(A,N);var k=new Uint8Array(Ds);return yt(k,A,N),k},n.box.after=n.secretbox,n.box.open=function(A,N,k,T){var L=n.box.before(k,T);return n.secretbox.open(A,N,L)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var A=new Uint8Array(Gr),N=new Uint8Array(mr);return Pe(A,N),{publicKey:A,secretKey:N}},n.box.keyPair.fromSecretKey=function(A){if(Rt(A),A.length!==mr)throw new Error("bad secret key size");var N=new Uint8Array(Gr);return ye(N,A),{publicKey:N,secretKey:new Uint8Array(A)}},n.box.publicKeyLength=Gr,n.box.secretKeyLength=mr,n.box.sharedKeyLength=Ds,n.box.nonceLength=ya,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(A,N){if(Rt(A,N),N.length!==hn)throw new Error("bad secret key size");var k=new Uint8Array(it+A.length);return Cs(k,A,A.length,N),k},n.sign.open=function(A,N){if(Rt(A,N),N.length!==gt)throw new Error("bad public key size");var k=new Uint8Array(A.length),T=pa(k,A,A.length,N);if(T<0)return null;for(var L=new Uint8Array(T),I=0;I<L.length;I++)L[I]=k[I];return L},n.sign.detached=function(A,N){for(var k=n.sign(A,N),T=new Uint8Array(it),L=0;L<T.length;L++)T[L]=k[L];return T},n.sign.detached.verify=function(A,N,k){if(Rt(A,N,k),N.length!==it)throw new Error("bad signature size");if(k.length!==gt)throw new Error("bad public key size");var T=new Uint8Array(it+A.length),L=new Uint8Array(it+A.length),I;for(I=0;I<it;I++)T[I]=N[I];for(I=0;I<A.length;I++)T[I+it]=A[I];return pa(L,T,T.length,k)>=0},n.sign.keyPair=function(){var A=new Uint8Array(gt),N=new Uint8Array(hn);return zr(A,N),{publicKey:A,secretKey:N}},n.sign.keyPair.fromSecretKey=function(A){if(Rt(A),A.length!==hn)throw new Error("bad secret key size");for(var N=new Uint8Array(gt),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(Rt(A),A.length!==Ls)throw new Error("bad seed size");for(var N=new Uint8Array(gt),k=new Uint8Array(hn),T=0;T<32;T++)k[T]=A[T];return zr(N,k,!0),{publicKey:N,secretKey:k}},n.sign.publicKeyLength=gt,n.sign.secretKeyLength=hn,n.sign.seedLength=Ls,n.sign.signatureLength=it,n.hash=function(A){Rt(A);var N=new Uint8Array(ga);return _t(N,A,A.length),N},n.hash.hashLength=ga,n.verify=function(A,N){return Rt(A,N),A.length===0||N.length===0||A.length!==N.length?!1:ne(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 L,I=new Uint8Array(T);for(L=0;L<T;L+=N)A.getRandomValues(I.subarray(L,L+Math.min(T-L,N)));for(L=0;L<T;L++)k[L]=I[L];ci(I)})}else typeof require<"u"&&(A=require("crypto"),A&&A.randomBytes&&n.setPRNG(function(k,T){var L,I=A.randomBytes(T);for(L=0;L<T;L++)k[L]=I[L];ci(I)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const cc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;cc.sign.keyPair.fromSeed,cc.sign.detached,cc.sign.detached.verify,cc.randomBytes;var db;(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"})(db||(db={}));var mb;(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"})(mb||(mb={}));function _2(n){return e=>{let s={};return n.forEach(i=>{const o=i(e)||{};s=Object.assign(s,o)}),s}}function w2(){return()=>{}}function S2(n,e){return()=>{const s=typeof n=="function"?n():n,i=typeof e=="function"?e():e;return{user:s,pass:i}}}function E2(n){return()=>({auth_token:typeof n=="function"?n():n})}const Cx=120*1e3,O2=2,Mx=2*1e3;function A2(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Cx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Mx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function j2(n){const e=[];return typeof n.authenticator=="function"&&e.push(n.authenticator),Array.isArray(n.authenticator)&&e.push(...n.authenticator),n.token&&e.push(E2(n.token)),n.user&&e.push(S2(n.user,n.pass)),e.length===0?w2():_2(e)}function k2(n){const e=`${Od}:${kx()}`;if(n=n||{servers:[e]},n.servers=n.servers||[],typeof n.servers=="string"&&(n.servers=[n.servers]),n.servers.length>0&&n.port)throw new be("port and servers options are mutually exclusive",fe.InvalidOption);n.servers.length===0&&n.port&&(n.servers=[`${Od}:${n.port}`]),n.servers&&n.servers.length===0&&(n.servers=[e]);const s=Au(A2(),n);if(s.authenticator=j2(s),["reconnectDelayHandler","authenticator"].forEach(i=>{if(s[i]&&typeof s[i]!="function")throw new be(`${i} option should be a function`,fe.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{Lr(s.inboxPrefix)}catch(i){throw new be(i.message,fe.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Rd()=="function"),s.resolve&&typeof Rd()!="function")throw new be("'resolve' is not supported on this client",fe.InvalidOption);return s}function N2(n,e){const{proto:s,tls_required:i,tls_available:o}=n;if((s===void 0||s<1)&&e.noEcho)throw new be("noEcho",fe.ServerOptionNotAvailable);const c=i||o||!1;if(e.tls&&!c)throw new be("tls",fe.ServerOptionNotAvailable)}const T2=1024*32,C2=/^INFO\s+([^\r\n]+)\r\n/i,M2=wo(`PONG\r
|
|
38
38
|
`),pb=wo(`PING\r
|
|
39
39
|
`);class R2{constructor(e,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=e.version,this.lang=e.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):{})||{};Au(this,o)}}class Rx extends Ut{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");Au(this,o),this.protocol=s,this.subject=i,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=dt();const c=!((d=s.options)!=null&&d.noAsyncTraces);o.timeout&&(this.timer=ia(o.timeout,c),this.timer.then(()=>{this.timer=void 0}).catch(p=>{this.stop(p),this.noIterator&&this.callback(p,{})})),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=(p,g)=>{const{ingest:u}=o(g);u&&c(g)&&(i(p,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(be.errorForCode(fe.ConnectionClosed)):this.isClosed()?Promise.reject(be.errorForCode(fe.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(dt()).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 D2{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(e){return this.sidCounter++,e.sid=this.sidCounter,this.subs.set(e.sid,e),e}setMux(e){return this.mux=e,e}getMux(){return this.mux}get(e){return this.subs.get(e)}resub(e){return this.sidCounter++,this.subs.delete(e.sid),e.sid=this.sidCounter,this.subs.set(e.sid,e),e}all(){return Array.from(this.subs.values())}cancel(e){e&&(e.close(),this.subs.delete(e.sid))}handleError(e){if(e&&e.permissionContext){const s=e.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(e,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(e=>{e.close()})}}class gu{constructor(e,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=T2,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=e,this.publisher=s,this.subscriptions=new D2,this.muxSubscriptions=new y2,this.outbound=new oa,this.pongs=[],this.whyClosed="",this.pendingLimit=e.pendingLimit||this.pendingLimit,this.features=new QE({major:0,minor:0,micro:0}),this.connectPromise=null;const i=typeof e.servers=="string"?[e.servers]:e.servers;this.servers=new p2(i,{randomize:!e.noRandomize}),this.closed=dt(),this.parser=new hb(this),this.heartbeats=new g2(this,this.options.pingInterval||Cx,this.options.maxPingOut||O2)}resetOutbound(){this.outbound.reset();const e=this.pongs;this.pongs=[];const s=be.errorForCode(fe.Disconnect);s.stack="",e.forEach(i=>{i.reject(s)}),this.parser=new hb(this),this.infoReceived=!1}dispatchStatus(e){this.listeners.forEach(s=>{s.push(e)})}status(){const e=new Ut;return this.listeners.push(e),e}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const e=dt();return e.catch(()=>{}),this.pongs.unshift(e),this.connectError=s=>{e.reject(s)},this.transport=ZE(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),e}disconnect(){this.dispatchStatus({type:Xi.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Xi.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(e){this.dispatchStatus({type:Dr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:Dr.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===fe.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(e)}async dial(e){const s=this.prepare();let i;try{i=ia(this.options.timeout||2e4);const o=this.transport.connect(e,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(e){const{resolve:s}=this.options,i=await e.resolve({fn:Rd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const c of i)try{o=null,this.dispatchStatus({type:Xi.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 e;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 e||(this.lastError?this.lastError:be.errorForCode(fe.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(e=d,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const p=this.options.maxReconnectAttempts||0;p!==-1&&o.reconnects>=p&&this.servers.removeCurrentServer()}}else i=Math.min(i,o.lastConnect+s-c),await la(i)}}static async connect(e,s){const i=new gu(e,s);return await i.dialLoop(),i}static toError(e){const s=e?e.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const i=new be(e,fe.PermissionsViolation),o=e.match(/(Publish|Subscription) to "(\S+)"/);if(o){i.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const c=e.match(/using queue "(\S+)"/);c&&(i.permissionContext.queue=c[1])}return i}else return s.indexOf("authorization violation")!==-1?new be(e,fe.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new be(e,fe.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new be(e,fe.AccountExpired):s.indexOf("authentication timeout")!==-1?new be(e,fe.AuthenticationTimeout):new be(e,fe.ProtocolError)}processMsg(e,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const i=this.subscriptions.get(e.sid);i&&(i.received+=1,i.callback&&i.callback(null,new pm(e,s,this)),i.max!==void 0&&i.received>=i.max&&i.unsubscribe())}processError(e){const s=Xg(e),i=gu.toError(s),o={type:Dr.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(e){e.isAuthError()?this.handleAuthError(e):e.isProtocolError()?this.lastError=e:e.isAuthTimeout()&&(this.lastError=e),e.isPermissionError()||(this.lastError=e)}handleAuthError(e){this.lastError&&e.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(e):this.disconnect()}processPing(){this.transport.send(M2)}processPong(){const e=this.pongs.shift();e&&e.resolve()}processInfo(e){const s=JSON.parse(Xg(e));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(ni(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:c,lang:d}=this.transport;try{const p=new R2({version:c,lang:d},this.options,s.nonce);s.headers&&(p.headers=!0,p.no_responders=!0);const g=JSON.stringify(p);this.transport.send(wo(`CONNECT ${g}${su}`)),this.transport.send(pb)}catch(p){this._close(p)}}i&&this.dispatchStatus({type:Dr.Update,data:i}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:Dr.LDM,data:this.servers.getCurrentServer().toString()})}push(e){switch(e.kind){case Xt.MSG:{const{msg:s,data:i}=e;this.processMsg(s,i);break}case Xt.OK:break;case Xt.ERR:this.processError(e.data);break;case Xt.PING:this.processPing();break;case Xt.PONG:this.processPong();break;case Xt.INFO:this.processInfo(e.data);break}}sendCommand(e,...s){const i=this.outbound.length();let o;typeof e=="string"?o=wo(e):o=e,this.outbound.fill(o,...s),i===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(e,s=jn,i){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=si.encode(s);else throw be.errorForCode(fe.BadPayload);let c=o.length;i=i||{},i.reply=i.reply||"";let d=jn,p=0;if(i.headers){if(this.info&&!this.info.headers)throw new be("headers",fe.ServerOptionNotAvailable);d=i.headers.encode(),p=d.length,c=o.length+p}if(this.info&&c>this.info.max_payload)throw be.errorForCode(fe.MaxPayloadExceeded);this.outBytes+=c,this.outMsgs++;let g;i.headers?(i.reply?g=`HPUB ${e} ${i.reply} ${p} ${c}\r
|
|
40
40
|
`:g=`HPUB ${e} ${p} ${c}\r
|
|
@@ -50,18 +50,18 @@ ${g}`),b(_);return}p(null,S),i.strategy===Zn.Count&&(u--,u===0&&b()),i.strategy=
|
|
|
50
50
|
|
|
51
51
|
${p.stack}`),g.unsubscribe(),d.reject(u)):(u=Ex(m),u?(p&&(u.stack+=`
|
|
52
52
|
|
|
53
|
-
${p.stack}`),d.reject(u)):d.resolve(m))}});return g.requestSubject=e,this.protocol.publish(e,s,{reply:c,headers:i.headers}),d}else{const c=new jx(this.protocol.muxSubscriptions,e,i,o);this.protocol.request(c);try{this.publish(e,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${c.token}`,headers:i.headers})}catch(p){c.cancel(p)}const d=Promise.race([c.timer,c.deferred]);return d.catch(()=>{c.cancel()}),d}}flush(){return this.isClosed()?Promise.reject(be.errorForCode(fe.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(be.errorForCode(fe.ConnectionClosed)):this.isDraining()?Promise.reject(be.errorForCode(fe.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const e=this.protocol.getServer();return e?e.listen:""}status(){const e=new Ut;return e.iterClosed.then(()=>{const s=this.listeners.indexOf(e);this.listeners.splice(s,1)}),this.listeners.push(e),e}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(e={}){const s=new nO(this,e);if(e.checkAPI!==!1)try{await s.getAccountInfo()}catch(i){const o=i;throw o.code===fe.NoResponders&&(o.code=fe.JetStreamNotEnabled),o}return s}jetstream(e={}){return new xm(this,e)}getServerVersion(){const e=this.info;return e?ni(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw be.errorForCode(fe.Disconnect);const e=Date.now();return await this.flush(),Date.now()-e}get features(){return this.protocol.features}get services(){return this._services||(this._services=new aO(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(be.errorForCode(fe.ConnectionClosed)):this.isDraining()?Promise.reject(be.errorForCode(fe.ConnectionDraining)):this.protocol.reconnect()}}class aO{constructor(e){j(this,"nc");this.nc=e}add(e){try{return new Lo(this.nc,e).start()}catch(s){return Promise.reject(s)}}client(e,s){return new U2(this.nc,e,s)}}class oO{constructor(e,s,i){j(this,"bucket");j(this,"sm");j(this,"prefixLen");this.bucket=e,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(bu)||"PUT"}get length(){const e=this.sm.header.get(Zt.MessageSizeHdr)||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class lO{constructor(e,s,i){j(this,"bucket");j(this,"key");j(this,"sm");this.bucket=e,this.key=s,this.sm=i}get value(){return this.sm.data}get created(){return new Date(mm(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var e;return((e=this.sm.headers)==null?void 0:e.get(bu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const e=((s=this.sm.headers)==null?void 0:s.get(Zt.MessageSizeHdr))||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Px extends XE{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=Lr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,i);const c=this.info;c.config.name=js.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=Et.StartSequence,c.config.opt_start_seq=s;const d={};d.stream_name=this.info.stream,d.config=c.config;const p=`${c.api.prefix}.CONSUMER.CREATE.${c.stream}`;this.js._request(p,d,{retries:-1}).then(g=>{const u=g,m=this.sub.info;m.last=u,this.info.config=u.config,this.info.name=u.name}).catch(g=>{const u=new be(`unable to recreate ordered consumer ${c.stream} at seq ${s}`,fe.RequestError,g);this.sub.callback(u,{})})}_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(mm(s))}_setupHbMonitoring(s,i=0){const o={cancelAfter:0,maxOut:2};i&&(o.cancelAfter=i);const c=this.sub,d=p=>{var m,b,x,v;const g=CE(409,`${$n.IdleHeartbeatMissed}: ${p}`,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 ym(s,d,o)}_checkHbOrderConsumer(s){const i=s.headers.get(Zt.ConsumerStalledHdr);i!==""&&this.js.nc.publish(i);const o=parseInt(s.headers.get(Zt.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 cO extends Px{constructor(e,s,i){super(e,s,i)}pull(e={batch:1}){const{stream:s,config:i,name:o}=this.sub.info,c=i.durable_name??o,d={};if(d.batch=e.batch||1,d.no_wait=e.no_wait||!1,(e.max_bytes??0)>0){const u=this.js.nc.features.get(Ye.JS_PULL_MAX_BYTES);if(!u.ok)throw new Error(`max_bytes is only supported on servers ${u.min} or better`);d.max_bytes=e.max_bytes}let p=0;e.expires&&e.expires>0&&(p=e.expires,d.expires=ht(p));let g=0;if(e.idle_heartbeat&&e.idle_heartbeat>0&&(g=e.idle_heartbeat,d.idle_heartbeat=ht(g)),g&&p===0)throw new Error("idle_heartbeat requires expires");if(g>p)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),p&&g&&(this.monitor?this.monitor._change(g,p):this._setupHbMonitoring(g,p));const u=this.info.api,m=`${u.prefix}.CONSUMER.MSG.NEXT.${s}.${c}`,b=this.sub.subject;u.nc.publish(m,u.jc.encode(d),{reply:b})}}}function uO(n,e){return n?hO(e):fO(e)}function fO(n){return(e,s)=>e?[e,null]:(e=Zi(s),e?[e,null]:[null,To(s,n)])}function hO(n){return(e,s)=>{if(e)return[e,null];const i=Zi(s);return i!==null?[Bx(i),null]:[null,To(s,n)]}}function Bx(n){if(n!==null)switch(n.code){case fe.JetStream404NoMessages:case fe.JetStream408RequestTimeout:return null;case fe.JetStream409:return ME(n)?n:null;default:return n}return null}function dO(n){n&&n.ack()}function mO(n){const e=n.split(".");if(e.length===9&&e.splice(2,0,"_",""),e.length<11||e[0]!=="$JS"||e[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=e[2]==="_"?"":e[2],s.account_hash=e[3],s.stream=e[4],s.consumer=e[5],s.deliveryCount=parseInt(e[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(e[7],10),s.deliverySequence=parseInt(e[8],10),s.timestampNanos=parseInt(e[9],10),s.pending=parseInt(e[10],10),s}class pO{constructor(e,s){j(this,"msg");j(this,"di");j(this,"didAck");j(this,"timeout");this.msg=e,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=mO(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(e){this.didAck||(this.didAck=!this.isWIP(e),this.msg.respond(e))}isWIP(e){return e.length===4&&e[0]===oo[0]&&e[1]===oo[1]&&e[2]===oo[2]&&e[3]===oo[3]}async ackAck(e){var i;e=e||{},e.timeout=e.timeout||this.timeout;const s=dt();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),p=new jx(c.muxSubscriptions,this.msg.reply,{timeout:e.timeout},d);c.request(p);try{c.publish(this.msg.reply,xb,{reply:`${c.muxSubscriptions.baseInbox}${p.token}`})}catch(g){p.cancel(g)}try{await Promise.race([p.timer,p.deferred]),s.resolve(!0)}catch(g){p.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(xb)}nak(e){let s=J2;e&&(s=Ad().encode(`-NAK ${JSON.stringify({delay:ht(e)})}`)),this.doAck(s)}working(){this.doAck(oo)}next(e,s={batch:1}){const i={};i.batch=s.batch||1,i.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(i.expires=ht(s.expires));const o=er().encode(i),c=oa.concat(Q2,W2,o),d=e?{reply:e}:void 0;this.msg.respond(c,d)}term(e=""){let s=X2;(e==null?void 0:e.length)>0&&(s=Ad().encode(`+TERM ${e}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const yO="1.30.3",gO="nats.ws";class bO{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=yO,this.lang=gO,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=dt(),this.closedNotification=dt()}async connect(e,s){const i=dt();if(s.tls)return i.reject(new be("tls",fe.InvalidOption)),i;this.options=s;const o=e.src;if(s.wsFactory){const{socket:c,encrypted:d}=await s.wsFactory(e.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=oa.concat(...this.yields),p=r2(d);if(p!==""){const g=C2.exec(p);if(!g){s.debug&&console.error("!!!",oc(d)),i.reject(new Error("unexpected response from server"));return}try{const u=JSON.parse(g[1]);N2(u,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),i.resolve()}catch(u){i.reject(u);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,p=new be(d.message,fe.Unknown,new Error(d.error));i.reject(p)},i}disconnect(){this._closed(void 0,!0)}async _closed(e,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=e,!e)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await la(100);this.done=!0;try{this.socket.close(e?1002:1e3,e?e.message:void 0)}catch{}s&&this.closedNotification.resolve(e)}}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 e=this.yields;this.yields=[];for(let s=0;s<e.length;s++)this.options.debug&&console.info(`> ${oc(e[s])}`),yield e[s];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=dt())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.isDiscarded())try{this.socket.send(e.buffer),this.options.debug&&console.info(`< ${oc(e)}`);return}catch(s){this.options.debug&&console.error(`!!! ${oc(e)}: ${s}`)}}close(e){return this._closed(e,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var e;this.done=!0;try{(e=this.socket)==null||e.close()}catch{}}}function xO(n,e){/^(.*:\/\/)(.*)/.test(n)||(typeof e=="boolean"?n=`${e===!0?"https":"http"}://${n}`:n=`https://${n}`);let i=new URL(n);const o=i.protocol.toLowerCase();o==="ws:"&&(e=!1),o==="wss:"&&(e=!0),o!=="https:"&&o!=="http"&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2"),i=new URL(`http://${n}`));let c,d;const p=i.hostname,g=i.pathname,u=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||e===!0?"443":"80",c=e===!0?"wss:":"ws:";break}return`${c}//${p}:${d}${g}${u}`}function vO(n={}){return WE({defaultPort:443,urlParseFn:xO,factory:()=>new bO}),vm.connect(n)}const _O=null,wO=null,Wt="lt.events";function Ux(n,e){const s=n.split("."),i=e.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 ca=E.createContext({connected:!1,subscribe:()=>()=>{}});function zx(){const{connected:n}=E.useContext(ca);return{connected:n}}function An(n,e){const{subscribe:s}=E.useContext(ca),i=E.useRef(e);i.current=e,E.useEffect(()=>s(n,c=>i.current(c)),[s,n])}function Ns(n,e){const{subscribe:s}=E.useContext(ca),i=E.useRef(e);i.current=e;const o=n.join(","),c=E.useMemo(()=>o.split(",").filter(Boolean),[o]);E.useEffect(()=>{const d=g=>i.current(g),p=c.map(g=>s(g,d));return()=>p.forEach(g=>g())},[s,c])}const $x=E.createContext({connected:!1,unavailable:!1,subscribe:()=>()=>{}});function SO(){const{connected:n,unavailable:e}=E.useContext($x);return{connected:n,unavailable:e}}const EO=Ad();function OO({children:n,url:e,token:s,resolveCredentials:i,policy:o=bo,onReconnect:c,sessionKey:d}){const p=E.useRef(null),[g,u]=E.useState(!1),[m,b]=E.useState(!1),[x,v]=E.useState(!1),_=E.useRef({url:e,token:s,resolveCredentials:i,policy:o,onReconnect:c});_.current={url:e,token:s,resolveCredentials:i,policy:o,onReconnect:c};const S=E.useRef(new Map),C=E.useRef(new Map),B=E.useCallback((te,M)=>{(async()=>{for await(const z of M)try{if(!Ux(z.subject,te))continue;const ae=JSON.parse(EO.decode(z.data)),F=S.current.get(te);if(!F)continue;for(const U of F)try{U(ae)}catch{}}catch{}})()},[]),q=E.useCallback(te=>{var z;const M=p.current;if(!(!M||(z=M.isClosed)!=null&&z.call(M)||C.current.has(te)))try{const ae=M.subscribe(te);C.current.set(te,ae),B(te,ae)}catch{}},[B]),ne=E.useCallback((te,M)=>{const z=S.current;return z.has(te)||z.set(te,new Set),z.get(te).add(M),q(te),()=>{const ae=z.get(te);if(ae&&(ae.delete(M),ae.size===0)){z.delete(te);const F=C.current.get(te);if(F){C.current.delete(te);try{F.unsubscribe()}catch{}}}}},[q]);return E.useEffect(()=>{let te=!1,M=!1,z=!1,ae=!1,F=0,U,D;v(!1);const Q=()=>typeof document<"u"&&document.visibilityState==="hidden",W=async()=>{const{url:J,token:ce,resolveCredentials:pe}=_.current;if(pe)return pe();const ge=J||_O;return ge?{kind:"ok",url:ge,token:ce||wO||null}:{kind:"unavailable"}},he=(J=vE(F++,_.current.policy))=>{te||M||(U=setTimeout(Ae,J))},Ee=J=>{J.closed().then(()=>{p.current===J&&(p.current=null,C.current.clear(),u(!1),he(Jg(_.current.policy)))})};async function Ae(){if(U=void 0,!(te||M||z||p.current)&&!Q()){z=!0;try{const J=await W();if(te)return;if(J.kind==="session-ended"){M=!0,v(!0);return}if(J.kind==="unavailable"){he();return}const ce=await vO({servers:J.url,token:J.token??void 0,reconnect:!1});if(te){ce.close().catch(()=>{});return}p.current=ce,F=0,u(!0),C.current.clear();for(const pe of S.current.keys())q(pe);ae&&(D=setTimeout(()=>{var pe,ge;return(ge=(pe=_.current).onReconnect)==null?void 0:ge.call(pe)},Jg(_.current.policy))),ae=!0,Ee(ce)}catch{te||he()}finally{z=!1}}}const H=()=>{te||M||z||p.current||Q()||(U&&clearTimeout(U),F=0,Ae())};return document.addEventListener("visibilitychange",H),window.addEventListener("online",H),Ae(),()=>{te=!0,U&&clearTimeout(U),D&&clearTimeout(D),document.removeEventListener("visibilitychange",H),window.removeEventListener("online",H);for(const J of C.current.values())try{J.unsubscribe()}catch{}C.current.clear(),p.current&&(p.current.close().catch(()=>{}),p.current=null),u(!1)}},[q,d]),E.useEffect(()=>{if(g||x){b(!1);return}const te=setTimeout(()=>b(!0),o.noticeAfterMs);return()=>clearTimeout(te)},[g,x,o.noticeAfterMs]),h.jsx($x.Provider,{value:{connected:g,unavailable:m,subscribe:ne},children:h.jsx(ca.Provider,{value:{connected:g,subscribe:ne},children:n})})}const ur=Object.create(null);ur.open="0";ur.close="1";ur.ping="2";ur.pong="3";ur.message="4";ur.upgrade="5";ur.noop="6";const au=Object.create(null);Object.keys(ur).forEach(n=>{au[ur[n]]=n});const zd={type:"error",data:"parser error"},Ix=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Hx=typeof ArrayBuffer=="function",Fx=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,_m=({type:n,data:e},s,i)=>Ix&&e instanceof Blob?s?i(e):_b(e,i):Hx&&(e instanceof ArrayBuffer||Fx(e))?s?i(e):_b(new Blob([e]),i):i(ur[n]+(e||"")),_b=(n,e)=>{const s=new FileReader;return s.onload=function(){const i=s.result.split(",")[1];e("b"+(i||""))},s.readAsDataURL(n)};function wb(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let od;function AO(n,e){if(Ix&&n.data instanceof Blob)return n.data.arrayBuffer().then(wb).then(e);if(Hx&&(n.data instanceof ArrayBuffer||Fx(n.data)))return e(wb(n.data));_m(n,!1,s=>{od||(od=new TextEncoder),e(od.encode(s))})}const Sb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_o=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<Sb.length;n++)_o[Sb.charCodeAt(n)]=n;const jO=n=>{let e=n.length*.75,s=n.length,i,o=0,c,d,p,g;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const u=new ArrayBuffer(e),m=new Uint8Array(u);for(i=0;i<s;i+=4)c=_o[n.charCodeAt(i)],d=_o[n.charCodeAt(i+1)],p=_o[n.charCodeAt(i+2)],g=_o[n.charCodeAt(i+3)],m[o++]=c<<2|d>>4,m[o++]=(d&15)<<4|p>>2,m[o++]=(p&3)<<6|g&63;return u},kO=typeof ArrayBuffer=="function",wm=(n,e)=>{if(typeof n!="string")return{type:"message",data:Gx(n,e)};const s=n.charAt(0);return s==="b"?{type:"message",data:NO(n.substring(1),e)}:au[s]?n.length>1?{type:au[s],data:n.substring(1)}:{type:au[s]}:zd},NO=(n,e)=>{if(kO){const s=jO(n);return Gx(s,e)}else return{base64:!0,data:n}},Gx=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},Vx="",TO=(n,e)=>{const s=n.length,i=new Array(s);let o=0;n.forEach((c,d)=>{_m(c,!1,p=>{i[d]=p,++o===s&&e(i.join(Vx))})})},CO=(n,e)=>{const s=n.split(Vx),i=[];for(let o=0;o<s.length;o++){const c=wm(s[o],e);if(i.push(c),c.type==="error")break}return i};function MO(){return new TransformStream({transform(n,e){AO(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),e.enqueue(o),e.enqueue(s)})}})}let ld;function fc(n){return n.reduce((e,s)=>e+s.length,0)}function hc(n,e){if(n[0].length===e)return n.shift();const s=new Uint8Array(e);let i=0;for(let o=0;o<e;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 RO(n,e){ld||(ld=new TextDecoder);const s=[];let i=0,o=-1,c=!1;return new TransformStream({transform(d,p){for(s.push(d);;){if(i===0){if(fc(s)<1)break;const g=hc(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(fc(s)<2)break;const g=hc(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),i=3}else if(i===2){if(fc(s)<8)break;const g=hc(s,8),u=new DataView(g.buffer,g.byteOffset,g.length),m=u.getUint32(0);if(m>Math.pow(2,21)-1){p.enqueue(zd);break}o=m*Math.pow(2,32)+u.getUint32(4),i=3}else{if(fc(s)<o)break;const g=hc(s,o);p.enqueue(wm(c?g:ld.decode(g),e)),i=0}if(o===0||o>n){p.enqueue(zd);break}}}})}const Yx=4;function Ct(n){if(n)return DO(n)}function DO(n){for(var e in Ct.prototype)n[e]=Ct.prototype[e];return n}Ct.prototype.on=Ct.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};Ct.prototype.once=function(n,e){function s(){this.off(n,s),e.apply(this,arguments)}return s.fn=e,this.on(n,s),this};Ct.prototype.off=Ct.prototype.removeListener=Ct.prototype.removeAllListeners=Ct.prototype.removeEventListener=function(n,e){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===e||i.fn===e){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+n],this};Ct.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),s=this._callbacks["$"+n],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,o=s.length;i<o;++i)s[i].apply(this,e)}return this};Ct.prototype.emitReserved=Ct.prototype.emit;Ct.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};Ct.prototype.hasListeners=function(n){return!!this.listeners(n).length};const Tu=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,s)=>s(e,0),In=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),LO="arraybuffer";function Kx(n,...e){return e.reduce((s,i)=>(n.hasOwnProperty(i)&&(s[i]=n[i]),s),{})}const qO=In.setTimeout,PO=In.clearTimeout;function Cu(n,e){e.useNativeTimers?(n.setTimeoutFn=qO.bind(In),n.clearTimeoutFn=PO.bind(In)):(n.setTimeoutFn=In.setTimeout.bind(In),n.clearTimeoutFn=In.clearTimeout.bind(In))}const BO=1.33;function UO(n){return typeof n=="string"?zO(n):Math.ceil((n.byteLength||n.size)*BO)}function zO(n){let e=0,s=0;for(let i=0,o=n.length;i<o;i++)e=n.charCodeAt(i),e<128?s+=1:e<2048?s+=2:e<55296||e>=57344?s+=3:(i++,s+=4);return s}function Jx(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function $O(n){let e="";for(let s in n)n.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(n[s]));return e}function IO(n){let e={},s=n.split("&");for(let i=0,o=s.length;i<o;i++){let c=s[i].split("=");e[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return e}class HO extends Error{constructor(e,s,i){super(e),this.description=s,this.context=i,this.type="TransportError"}}class Sm extends Ct{constructor(e){super(),this.writable=!1,Cu(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,s,i){return super.emitReserved("error",new HO(e,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(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const s=wm(e,this.socket.binaryType);this.onPacket(s)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,s={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_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(e){const s=$O(e);return s.length?"?"+s:""}}class FO extends Sm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const s=()=>{this.readyState="paused",e()};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(e){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)};CO(e,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,TO(e,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Jx()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(e,s)}}let Qx=!1;try{Qx=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const GO=Qx;function VO(){}class YO extends FO{constructor(e){if(super(e),typeof location<"u"){const s=location.protocol==="https:";let i=location.port;i||(i=s?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,s){const i=this.request({method:"POST",data:e});i.on("success",s),i.on("error",(o,c)=>{this.onError("xhr post error",o,c)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=e}}class cr extends Ct{constructor(e,s,i){super(),this.createRequest=e,Cu(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 e;const s=Kx(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{}(e=this._opts.cookieJar)===null||e===void 0||e.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=cr.requestsCount++,cr.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=VO,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete cr.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}cr.requestsCount=0;cr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Eb);else if(typeof addEventListener=="function"){const n="onpagehide"in In?"pagehide":"unload";addEventListener(n,Eb,!1)}}function Eb(){for(let n in cr.requests)cr.requests.hasOwnProperty(n)&&cr.requests[n].abort()}const KO=(function(){const n=Xx({xdomain:!1});return n&&n.responseType!==null})();class JO extends YO{constructor(e){super(e);const s=e&&e.forceBase64;this.supportsBinary=KO&&!s}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new cr(Xx,this.uri(),e)}}function Xx(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||GO))return new XMLHttpRequest}catch{}if(!e)try{return new In[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Wx=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class QO extends Sm{get name(){return"websocket"}doOpen(){const e=this.uri(),s=this.opts.protocols,i=Wx?{}:Kx(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(e,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=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let s=0;s<e.length;s++){const i=e[s],o=s===e.length-1;_m(i,this.supportsBinary,c=>{try{this.doWrite(i,c)}catch{}o&&Tu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Jx()),this.supportsBinary||(s.b64=1),this.createUri(e,s)}}const cd=In.WebSocket||In.MozWebSocket;class XO extends QO{createSocket(e,s,i){return Wx?new cd(e,s,i):s?new cd(e,s):new cd(e)}doWrite(e,s){this.ws.send(s)}}class WO extends Sm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const s=RO(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(s).getReader(),o=MO();o.readable.pipeTo(e.writable),this._writer=o.writable.getWriter();const c=()=>{i.read().then(({done:p,value:g})=>{p||(this.onPacket(g),c())}).catch(p=>{})};c();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let s=0;s<e.length;s++){const i=e[s],o=s===e.length-1;this._writer.write(i).then(()=>{o&&Tu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const ZO={websocket:XO,webtransport:WO,polling:JO},eA=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,tA=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function $d(n){if(n.length>8e3)throw"URI too long";const e=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=eA.exec(n||""),c={},d=14;for(;d--;)c[tA[d]]=o[d]||"";return s!=-1&&i!=-1&&(c.source=e,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=nA(c,c.path),c.queryKey=rA(c,c.query),c}function nA(n,e){const s=/\/{2,9}/g,i=e.replace(s,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function rA(n,e){const s={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,o,c){o&&(s[o]=c)}),s}const Id=typeof addEventListener=="function"&&typeof removeEventListener=="function",ou=[];Id&&addEventListener("offline",()=>{ou.forEach(n=>n())},!1);class Os extends Ct{constructor(e,s){if(super(),this.binaryType=LO,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(s=e,e=null),e){const i=$d(e);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=$d(s.host).host);Cu(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=IO(this.opts.query)),Id&&(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"})},ou.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const s=Object.assign({},this.opts.query);s.EIO=Yx,s.transport=e,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[e]);return new this._transportsByName[e](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Os.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(e);s.open(),this.setTransport(s)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.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",Os.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.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=e.data,this._onError(s);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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 e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.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+=UO(o)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Tu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,s,i){return this._sendPacket("message",e,s,i),this}send(e,s,i){return this._sendPacket("message",e,s,i),this}_sendPacket(e,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:e,data:s,options:i};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),o&&this.once("flush",o),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),e()},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():e()}):this.upgrading?i():e()),this}_onError(e){if(Os.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,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(),Id&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=ou.indexOf(this._offlineEventListener);i!==-1&&ou.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,s),this.writeBuffer=[],this._prevBufferLen=0}}}Os.protocol=Yx;class sA extends Os{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let s=this.createTransport(e),i=!1;Os.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;Os.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 p(){d("transport closed")}function g(){d("socket closed")}function u(b){s&&b.name!==s.name&&c()}const m=()=>{s.removeListener("open",o),s.removeListener("error",d),s.removeListener("close",p),this.off("close",g),this.off("upgrading",u)};s.once("open",o),s.once("error",d),s.once("close",p),this.once("close",g),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const s=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&s.push(e[i]);return s}}let iA=class extends sA{constructor(e,s={}){const i=typeof e=="object"?e:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(o=>ZO[o]).filter(o=>!!o)),super(e,i)}};function aA(n,e="",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=$d(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+e,i.href=i.protocol+"://"+c+(s&&s.port===i.port?"":":"+i.port),i}const oA=typeof ArrayBuffer=="function",lA=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Zx=Object.prototype.toString,cA=typeof Blob=="function"||typeof Blob<"u"&&Zx.call(Blob)==="[object BlobConstructor]",uA=typeof File=="function"||typeof File<"u"&&Zx.call(File)==="[object FileConstructor]";function Em(n){return oA&&(n instanceof ArrayBuffer||lA(n))||cA&&n instanceof Blob||uA&&n instanceof File}function lu(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let s=0,i=n.length;s<i;s++)if(lu(n[s]))return!0;return!1}if(Em(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return lu(n.toJSON(),!0);for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&lu(n[s]))return!0;return!1}function fA(n){const e=[],s=n.data,i=n;return i.data=Hd(s,e),i.attachments=e.length,{packet:i,buffers:e}}function Hd(n,e){if(!n)return n;if(Em(n)){const s={_placeholder:!0,num:e.length};return e.push(n),s}else if(Array.isArray(n)){const s=new Array(n.length);for(let i=0;i<n.length;i++)s[i]=Hd(n[i],e);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]=Hd(n[i],e));return s}return n}function hA(n,e){return n.data=Fd(n.data,e),delete n.attachments,n}function Fd(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let s=0;s<n.length;s++)n[s]=Fd(n[s],e);else if(typeof n=="object")for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]=Fd(n[s],e));return n}const dA=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ve;(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"})(Ve||(Ve={}));class mA{constructor(e){this.replacer=e}encode(e){return(e.type===Ve.EVENT||e.type===Ve.ACK)&&lu(e)?this.encodeAsBinary({type:e.type===Ve.EVENT?Ve.BINARY_EVENT:Ve.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let s=""+e.type;return(e.type===Ve.BINARY_EVENT||e.type===Ve.BINARY_ACK)&&(s+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(s+=e.nsp+","),e.id!=null&&(s+=e.id),e.data!=null&&(s+=JSON.stringify(e.data,this.replacer)),s}encodeAsBinary(e){const s=fA(e),i=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(i),o}}class Om extends Ct{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}:e)}add(e){let s;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(e);const i=s.type===Ve.BINARY_EVENT;i||s.type===Ve.BINARY_ACK?(s.type=i?Ve.EVENT:Ve.ACK,this.reconstructor=new pA(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(Em(e)||e.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(e),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: "+e)}decodeString(e){let s=0;const i={type:Number(e.charAt(0))};if(Ve[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===Ve.BINARY_EVENT||i.type===Ve.BINARY_ACK){const c=s+1;for(;e.charAt(++s)!=="-"&&s!=e.length;);const d=e.substring(c,s);if(d!=Number(d)||e.charAt(s)!=="-")throw new Error("Illegal attachments");const p=Number(d);if(!yA(p)||p<0)throw new Error("Illegal attachments");if(p>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=p}if(e.charAt(s+1)==="/"){const c=s+1;for(;++s&&!(e.charAt(s)===","||s===e.length););i.nsp=e.substring(c,s)}else i.nsp="/";const o=e.charAt(s+1);if(o!==""&&Number(o)==o){const c=s+1;for(;++s;){const d=e.charAt(s);if(d==null||Number(d)!=d){--s;break}if(s===e.length)break}i.id=Number(e.substring(c,s+1))}if(e.charAt(++s)){const c=this.tryParse(e.substr(s));if(Om.isPayloadValid(i.type,c))i.data=c;else throw new Error("invalid payload")}return i}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,s){switch(e){case Ve.CONNECT:return Ob(s);case Ve.DISCONNECT:return s===void 0;case Ve.CONNECT_ERROR:return typeof s=="string"||Ob(s);case Ve.EVENT:case Ve.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&dA.indexOf(s[0])===-1);case Ve.ACK:case Ve.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class pA{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const s=hA(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const yA=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};function Ob(n){return Object.prototype.toString.call(n)==="[object Object]"}const gA=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Om,Encoder:mA,get PacketType(){return Ve}},Symbol.toStringTag,{value:"Module"}));function Wn(n,e,s){return n.on(e,s),function(){n.off(e,s)}}const bA=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ev extends Ct{constructor(e,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=e,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 e=this.io;this.subs=[Wn(e,"open",this.onopen.bind(this)),Wn(e,"packet",this.onpacket.bind(this)),Wn(e,"error",this.onerror.bind(this)),Wn(e,"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(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...s){var i,o,c;if(bA.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(s.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const d={type:Ve.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 p=(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&&!p||(g?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(e,s){var i;const o=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(o===void 0){this.acks[e]=s;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===e&&this.sendBuffer.splice(p,1);s.call(this,new Error("operation has timed out"))},o),d=(...p)=>{this.io.clearTimeoutFn(c),s.apply(this,p)};d.withError=!0,this.acks[e]=d}emitWithAck(e,...s){return new Promise((i,o)=>{const c=(d,p)=>d?o(d):i(p);c.withError=!0,s.push(c),this.emit(e,...s)})}_addToQueue(e){let s;typeof e[e.length-1]=="function"&&(s=e.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.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(e=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!e||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ve.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){const i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ve.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 Ve.EVENT:case Ve.BINARY_EVENT:this.onevent(e);break;case Ve.ACK:case Ve.BINARY_ACK:this.onack(e);break;case Ve.DISCONNECT:this.ondisconnect();break;case Ve.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){const s=e.data||[];e.id!=null&&s.push(this.ack(e.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const i of s)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const s=this;let i=!1;return function(...o){i||(i=!0,s.packet({type:Ve.ACK,id:e,data:o}))}}onack(e){const s=this.acks[e.id];typeof s=="function"&&(delete this.acks[e.id],s.withError&&e.data.unshift(null),s.apply(this,e.data))}onconnect(e,s){this.id=e,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ve.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const s=this._anyListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const i of s)i.apply(this,e.data)}}}function ua(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}ua.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),s=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-s:n+s}return Math.min(n,this.max)|0};ua.prototype.reset=function(){this.attempts=0};ua.prototype.setMin=function(n){this.ms=n};ua.prototype.setMax=function(n){this.max=n};ua.prototype.setJitter=function(n){this.jitter=n};class Gd extends Ct{constructor(e,s){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(s=e,e=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Cu(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 ua({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=e;const o=s.parser||gA;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var s;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(s=this.backoff)===null||s===void 0||s.setMin(e),this)}randomizationFactor(e){var s;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(s=this.backoff)===null||s===void 0||s.setJitter(e),this)}reconnectionDelayMax(e){var s;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(s=this.backoff)===null||s===void 0||s.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new iA(this.uri,this.opts);const s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const o=Wn(s,"open",function(){i.onopen(),e&&e()}),c=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),e?e(p):this.maybeReconnectOnOpen()},d=Wn(s,"error",c);if(this._timeout!==!1){const p=this._timeout,g=this.setTimeoutFn(()=>{o(),c(new Error("timeout")),s.close()},p);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(d),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Wn(e,"ping",this.onping.bind(this)),Wn(e,"data",this.ondata.bind(this)),Wn(e,"error",this.onerror.bind(this)),Wn(e,"close",this.onclose.bind(this)),Wn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(s){this.onclose("parse error",s)}}ondecoded(e){Tu(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,s){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new ev(this,e,s),this.nsps[e]=i),i}_destroy(e){const s=Object.keys(this.nsps);for(const i of s)if(this.nsps[i].active)return;this._close()}_packet(e){const s=this.encoder.encode(e);for(let i=0;i<s.length;i++)this.engine.write(s[i],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,s){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=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(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(o=>{o?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",o)):e.onreconnect()}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const lo={};function cu(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const s=aA(n,e.path||"/socket.io"),i=s.source,o=s.id,c=s.path,d=lo[o]&&c in lo[o].nsps,p=e.forceNew||e["force new connection"]||e.multiplex===!1||d;let g;return p?g=new Gd(i,e):(lo[o]||(lo[o]=new Gd(i,e)),g=lo[o]),s.query&&!e.query&&(e.query=s.queryKey),g.socket(s.path,e)}Object.assign(cu,{Manager:Gd,Socket:ev,io:cu,connect:cu});const xA=E.createContext({connected:!1,subscribe:()=>()=>{}});function vA({children:n}){const{isAuthenticated:e}=qt(),s=E.useRef(null),[i,o]=E.useState(!1),c=E.useRef(new Map),d=E.useCallback((g,u)=>{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(u),()=>{var v;const x=m.get(g);x&&(x.delete(u),x.size===0&&(m.delete(g),(v=s.current)==null||v.emit("lt.unsubscribe",g)))}},[]),p=E.useCallback((g,u)=>{for(const[m,b]of c.current)if(Ux(g,m))for(const x of b)try{x(u)}catch{}},[]);return E.useEffect(()=>{if(!e)return;const g=cu({path:`${Yt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,auth:u=>{const m=Ed();u(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 u of c.current.keys())g.emit("lt.subscribe",u)}),g.on("disconnect",u=>{console.log("[lt-socketio] disconnected:",u),o(!1)}),g.on("connect_error",u=>{console.warn("[lt-socketio] connect error:",u.message),o(!1)}),g.onAny((u,m)=>{if(u.startsWith("lt."))try{const b=typeof m=="string"?JSON.parse(m):m;p(u,b)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),s.current=null,o(!1)}},[p,e]),h.jsx(xA.Provider,{value:{connected:i,subscribe:d},children:h.jsx(ca.Provider,{value:{connected:i,subscribe:d},children:n})})}function _A({children:n}){const{isAuthenticated:e}=qt(),s=Le(),[i,o]=E.useState(null),[c,d]=E.useState({url:null,policy:Qg(null)});E.useEffect(()=>{let u=!1;async function m(){var b;try{console.log("[lt-transport] detecting event transport...");const x=await hm(),v=(b=x==null?void 0:x.events)==null?void 0:b.transport;console.log("[lt-transport] server reports:",v),u||(v==="nats"&&d({url:x.events.natsWsUrl??null,policy:Qg(x.events.reconnect)}),o(v==="nats"?"nats":"socketio"))}catch(x){console.warn("[lt-transport] settings fetch error, falling back to socketio",x),u||o("socketio")}}return m(),()=>{u=!0}},[e]);const p=E.useCallback(()=>xE(c.url),[c.url]),g=E.useCallback(()=>{s.invalidateQueries({refetchType:"active"})},[s]);return i==="nats"?h.jsx(OO,{resolveCredentials:p,policy:c.policy,onReconnect:g,sessionKey:e,children:n}):i==="socketio"?h.jsx(vA,{children:n}):h.jsx(h.Fragment,{children:n})}const Am="lt_view_as",jm="lt_ai_override",Vd="lt_graph_enabled",Yd="lt_infrastructure_enabled",km="lt_scan_override";function tv(){try{const n=localStorage.getItem(jm);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function wA(n){try{localStorage.setItem(jm,String(n))}catch{}}function SA(){try{localStorage.removeItem(jm)}catch{}}function Nm(){try{const n=localStorage.getItem(Am);if(n==="admin"||n==="engineer"||n==="operator")return n}catch{}return null}function EA(n){try{localStorage.setItem(Am,n)}catch{}window.location.reload()}function Kd(){try{localStorage.removeItem(Am)}catch{}window.location.reload()}function nv(){try{return localStorage.getItem(Vd)==="true"}catch{return!1}}function OA(n){try{n?localStorage.setItem(Vd,"true"):localStorage.removeItem(Vd)}catch{}}function rv(){try{return localStorage.getItem(Yd)==="true"}catch{return!1}}function AA(n){try{n?localStorage.setItem(Yd,"true"):localStorage.removeItem(Yd)}catch{}}function sv(){try{const n=localStorage.getItem(km);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function jA(n){try{localStorage.setItem(km,String(n))}catch{}}function kA(){try{localStorage.removeItem(km)}catch{}}const NA="credential-issuer";function iv(){const{isSuperAdmin:n,hasRoleType:e,hasRole:s}=qt(),i=Nm(),o=n||s("engineer"),c=e("admin"),d=n||e("admin"),p=i?!1:o,g=i?i==="admin"||i==="engineer":c,u=i?i==="admin":d,m=u,b=i?!1:n||s(NA);return{isBuilder:p,isOps:g,canBulk:u,canAdminister:m,canIssueCredentials:b,viewAs:i,realIsBuilder:o}}function av(){var u;const{isSuperAdmin:n,hasRoleType:e,hasRole:s}=qt(),{data:i}=Hn(),o=((u=i==null?void 0:i.features)==null?void 0:u.publicPaceBoard)!==!1,c=n?"superadmin":e("admin")?"admin":s("engineer")?"engineer":"operator",d=Nm(),p=d==="admin"||d==="engineer"||d==="operator"?d:null,g=p??c;return{tier:g,realTier:c,viewAs:p,canSeePaceBoard:o||g==="superadmin"||g==="admin",canSeeWorkflows:g==="superadmin"||g==="engineer",showTaskQueueCards:g==="operator"&&!o}}const Tm=E.createContext(null);function Mu(){const n=E.useContext(Tm);if(!n)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return n}function TA(){var n;return((n=E.useContext(Tm))==null?void 0:n.identity)??null}function CA({children:n}){const[e,s]=E.useState(null),i=E.useRef(e);i.current=e,E.useEffect(()=>{if(!(e!=null&&e.expiresAt))return;const m=new Date(e.expiresAt).getTime()-Date.now();if(m<=0){s(null);return}const b=setTimeout(()=>s(null),m);return()=>clearTimeout(b)},[e]);const o=E.useCallback(m=>{var x;if(!m.actingToken||!m.actor)return null;const b=((x=i.current)==null?void 0:x.actingToken)??null;return s({actingToken:m.actingToken,actorId:m.actor.id,displayName:m.actor.displayName,expiresAt:m.expiresAt??null,subjectScoped:m.grantScope==="subject"}),b},[]),c=E.useCallback(()=>s(null),[]),d=E.useCallback((m,b)=>{const x=i.current;b===0&&(x==null?void 0:x.actingToken)===m&&s(null)},[]),p=E.useCallback((m,b)=>{const x=i.current;if(!x||x.actingToken!==m||!b.acting)return;const{consumed:v,remaining:_,bound:S}=b.acting;(v&&_===0||S&&b.clearSubject)&&s(null)},[]);E.useEffect(()=>(Gg(()=>{var m;return((m=i.current)==null?void 0:m.actingToken)??null}),Yg(c),Vg(d),()=>{Gg(null),Yg(null),Vg(null)}),[c,d]);const g=E.useCallback(()=>{var b;const m=(b=i.current)==null?void 0:b.expiresAt;return m?Math.max(0,Math.floor((new Date(m).getTime()-Date.now())/1e3)):0},[]),u=E.useMemo(()=>({identity:e,prime:o,clear:c,settle:p,remainingSeconds:g}),[e,o,c,p,g]);return h.jsx(Tm.Provider,{value:u,children:n})}function MA(){const{user:n}=qt(),{identity:e}=Mu(),s=n==null?void 0:n.userId,i=e==null?void 0:e.actorId,o=E.useCallback(c=>!!c&&(c===i||c===s),[i,s]);return{viewerId:i??s,isViewer:o}}function ov(n){return(n??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function fr(n={}){const e=n.role?ov(n.role):"*",s=n.id??"*",i=n.verb??">";return`${Wt}.system.escalation.${e}.${s}.${i}`}function Jd(n){return n.verbs.map(e=>fr({role:n.role,verb:e}))}function Cm(n){const{user:e,isSuperAdmin:s,hasRoleType:i}=qt(),o=s||i("admin"),c=((e==null?void 0:e.roles)??[]).map(p=>p.role).sort().join(","),d=(n??[]).join(",");return E.useMemo(()=>{const p=d?d.split(","):null;return o||!c?p?Jd({verbs:p}):[fr({})]:c.split(",").flatMap(g=>p?Jd({role:g,verbs:p}):[fr({role:g})])},[o,c,d])}const Qd="/escalations/detail/";function RA(n){return n.startsWith(Qd)&&n.slice(Qd.length).split("/")[0]||void 0}function DA(){const{isViewer:n}=MA(),e=ri(),s=tn(),i=E.useRef(s.pathname);i.current=s.pathname;const o=E.useRef(n);o.current=n;const c=E.useCallback(d=>{var b,x,v;if((d==null?void 0:d.assignedAtCreation)!==!0)return;const p=(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,u=(v=d==null?void 0:d.data)==null?void 0:v.parent_id;if(!p||!o.current(g)||!u||u!==RA(i.current))return;const m=`${Qd}${p}`;i.current!==m&&e(m)},[e]);Ns(Cm(["claimed"]),c)}const lv=6048e5,LA=864e5,Ab=6e4,jb=525600,kb=43200,Nb=1440,Tb=Symbol.for("constructDateFrom");function Br(n,e){return typeof n=="function"?n(e):n&&typeof n=="object"&&Tb in n?n[Tb](e):n instanceof Date?new n.constructor(e):new Date(e)}function kn(n,e){return Br(e||n,n)}let qA={};function qo(){return qA}function Co(n,e){var p,g,u,m;const s=qo(),i=(e==null?void 0:e.weekStartsOn)??((g=(p=e==null?void 0:e.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((m=(u=s.locale)==null?void 0:u.options)==null?void 0:m.weekStartsOn)??0,o=kn(n,e==null?void 0:e.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 xu(n,e){return Co(n,{...e,weekStartsOn:1})}function cv(n,e){const s=kn(n,e==null?void 0:e.in),i=s.getFullYear(),o=Br(s,0);o.setFullYear(i+1,0,4),o.setHours(0,0,0,0);const c=xu(o),d=Br(s,0);d.setFullYear(i,0,4),d.setHours(0,0,0,0);const p=xu(d);return s.getTime()>=c.getTime()?i+1:s.getTime()>=p.getTime()?i:i-1}function vu(n){const e=kn(n),s=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return s.setUTCFullYear(e.getFullYear()),+n-+s}function uv(n,...e){const s=Br.bind(null,n||e.find(i=>typeof i=="object"));return e.map(s)}function Cb(n,e){const s=kn(n,e==null?void 0:e.in);return s.setHours(0,0,0,0),s}function PA(n,e,s){const[i,o]=uv(s==null?void 0:s.in,n,e),c=Cb(i),d=Cb(o),p=+c-vu(c),g=+d-vu(d);return Math.round((p-g)/LA)}function BA(n,e){const s=cv(n,e),i=Br(n,0);return i.setFullYear(s,0,4),i.setHours(0,0,0,0),xu(i)}function UA(n,e){const s=+kn(n)-+kn(e);return s<0?-1:s>0?1:s}function zA(n){return Br(n,Date.now())}function $A(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function IA(n){return!(!$A(n)&&typeof n!="number"||isNaN(+kn(n)))}function HA(n){return e=>{const i=(n?Math[n]:Math.trunc)(e);return i===0?0:i}}function FA(n,e){const s=kn(n,e==null?void 0:e.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const GA={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"}},VA=(n,e,s)=>{let i;const o=GA[n];return typeof o=="string"?i=o:e===1?i=o.one:i=o.other.replace("{{count}}",e.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+i:i+" ago":i};function ud(n){return(e={})=>{const s=e.width?String(e.width):n.defaultWidth;return n.formats[s]||n.formats[n.defaultWidth]}}const YA={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},KA={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},JA={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},QA={date:ud({formats:YA,defaultWidth:"full"}),time:ud({formats:KA,defaultWidth:"full"}),dateTime:ud({formats:JA,defaultWidth:"full"})},XA={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},WA=(n,e,s,i)=>XA[n];function co(n){return(e,s)=>{const i=s!=null&&s.context?String(s.context):"standalone";let o;if(i==="formatting"&&n.formattingValues){const d=n.defaultFormattingWidth||n.defaultWidth,p=s!=null&&s.width?String(s.width):d;o=n.formattingValues[p]||n.formattingValues[d]}else{const d=n.defaultWidth,p=s!=null&&s.width?String(s.width):n.defaultWidth;o=n.values[p]||n.values[d]}const c=n.argumentCallback?n.argumentCallback(e):e;return o[c]}}const ZA={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},ej={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},tj={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"]},nj={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"]},rj={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"}},sj={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"}},ij=(n,e)=>{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"},aj={ordinalNumber:ij,era:co({values:ZA,defaultWidth:"wide"}),quarter:co({values:ej,defaultWidth:"wide",argumentCallback:n=>n-1}),month:co({values:tj,defaultWidth:"wide"}),day:co({values:nj,defaultWidth:"wide"}),dayPeriod:co({values:rj,defaultWidth:"wide",formattingValues:sj,defaultFormattingWidth:"wide"})};function uo(n){return(e,s={})=>{const i=s.width,o=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],c=e.match(o);if(!c)return null;const d=c[0],p=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],g=Array.isArray(p)?lj(p,b=>b.test(d)):oj(p,b=>b.test(d));let u;u=n.valueCallback?n.valueCallback(g):g,u=s.valueCallback?s.valueCallback(u):u;const m=e.slice(d.length);return{value:u,rest:m}}}function oj(n,e){for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&e(n[s]))return s}function lj(n,e){for(let s=0;s<n.length;s++)if(e(n[s]))return s}function cj(n){return(e,s={})=>{const i=e.match(n.matchPattern);if(!i)return null;const o=i[0],c=e.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 p=e.slice(o.length);return{value:d,rest:p}}}const uj=/^(\d+)(th|st|nd|rd)?/i,fj=/\d+/i,hj={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},dj={any:[/^b/i,/^(a|c)/i]},mj={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},pj={any:[/1/i,/2/i,/3/i,/4/i]},yj={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},gj={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]},bj={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},xj={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]},vj={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},_j={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}},wj={ordinalNumber:cj({matchPattern:uj,parsePattern:fj,valueCallback:n=>parseInt(n,10)}),era:uo({matchPatterns:hj,defaultMatchWidth:"wide",parsePatterns:dj,defaultParseWidth:"any"}),quarter:uo({matchPatterns:mj,defaultMatchWidth:"wide",parsePatterns:pj,defaultParseWidth:"any",valueCallback:n=>n+1}),month:uo({matchPatterns:yj,defaultMatchWidth:"wide",parsePatterns:gj,defaultParseWidth:"any"}),day:uo({matchPatterns:bj,defaultMatchWidth:"wide",parsePatterns:xj,defaultParseWidth:"any"}),dayPeriod:uo({matchPatterns:vj,defaultMatchWidth:"any",parsePatterns:_j,defaultParseWidth:"any"})},fv={code:"en-US",formatDistance:VA,formatLong:QA,formatRelative:WA,localize:aj,match:wj,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Sj(n,e){const s=kn(n,e==null?void 0:e.in);return PA(s,FA(s))+1}function Ej(n,e){const s=kn(n,e==null?void 0:e.in),i=+xu(s)-+BA(s);return Math.round(i/lv)+1}function hv(n,e){var m,b,x,v;const s=kn(n,e==null?void 0:e.in),i=s.getFullYear(),o=qo(),c=(e==null?void 0:e.firstWeekContainsDate)??((b=(m=e==null?void 0:e.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((e==null?void 0:e.in)||n,0);d.setFullYear(i+1,0,c),d.setHours(0,0,0,0);const p=Co(d,e),g=Br((e==null?void 0:e.in)||n,0);g.setFullYear(i,0,c),g.setHours(0,0,0,0);const u=Co(g,e);return+s>=+p?i+1:+s>=+u?i:i-1}function Oj(n,e){var p,g,u,m;const s=qo(),i=(e==null?void 0:e.firstWeekContainsDate)??((g=(p=e==null?void 0:e.locale)==null?void 0:p.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((m=(u=s.locale)==null?void 0:u.options)==null?void 0:m.firstWeekContainsDate)??1,o=hv(n,e),c=Br((e==null?void 0:e.in)||n,0);return c.setFullYear(o,0,i),c.setHours(0,0,0,0),Co(c,e)}function Aj(n,e){const s=kn(n,e==null?void 0:e.in),i=+Co(s,e)-+Oj(s,e);return Math.round(i/lv)+1}function et(n,e){const s=n<0?"-":"",i=Math.abs(n).toString().padStart(e,"0");return s+i}const ys={y(n,e){const s=n.getFullYear(),i=s>0?s:1-s;return et(e==="yy"?i%100:i,e.length)},M(n,e){const s=n.getMonth();return e==="M"?String(s+1):et(s+1,2)},d(n,e){return et(n.getDate(),e.length)},a(n,e){const s=n.getHours()/12>=1?"pm":"am";switch(e){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,e){return et(n.getHours()%12||12,e.length)},H(n,e){return et(n.getHours(),e.length)},m(n,e){return et(n.getMinutes(),e.length)},s(n,e){return et(n.getSeconds(),e.length)},S(n,e){const s=e.length,i=n.getMilliseconds(),o=Math.trunc(i*Math.pow(10,s-3));return et(o,e.length)}},Fi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Mb={G:function(n,e,s){const i=n.getFullYear()>0?1:0;switch(e){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,e,s){if(e==="yo"){const i=n.getFullYear(),o=i>0?i:1-i;return s.ordinalNumber(o,{unit:"year"})}return ys.y(n,e)},Y:function(n,e,s,i){const o=hv(n,i),c=o>0?o:1-o;if(e==="YY"){const d=c%100;return et(d,2)}return e==="Yo"?s.ordinalNumber(c,{unit:"year"}):et(c,e.length)},R:function(n,e){const s=cv(n);return et(s,e.length)},u:function(n,e){const s=n.getFullYear();return et(s,e.length)},Q:function(n,e,s){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return et(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,e,s){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return et(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,e,s){const i=n.getMonth();switch(e){case"M":case"MM":return ys.M(n,e);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,e,s){const i=n.getMonth();switch(e){case"L":return String(i+1);case"LL":return et(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,e,s,i){const o=Aj(n,i);return e==="wo"?s.ordinalNumber(o,{unit:"week"}):et(o,e.length)},I:function(n,e,s){const i=Ej(n);return e==="Io"?s.ordinalNumber(i,{unit:"week"}):et(i,e.length)},d:function(n,e,s){return e==="do"?s.ordinalNumber(n.getDate(),{unit:"date"}):ys.d(n,e)},D:function(n,e,s){const i=Sj(n);return e==="Do"?s.ordinalNumber(i,{unit:"dayOfYear"}):et(i,e.length)},E:function(n,e,s){const i=n.getDay();switch(e){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,e,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(c);case"ee":return et(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,e,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(c);case"cc":return et(c,e.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,e,s){const i=n.getDay(),o=i===0?7:i;switch(e){case"i":return String(o);case"ii":return et(o,e.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,e,s){const o=n.getHours()/12>=1?"pm":"am";switch(e){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,e,s){const i=n.getHours();let o;switch(i===12?o=Fi.noon:i===0?o=Fi.midnight:o=i/12>=1?"pm":"am",e){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,e,s){const i=n.getHours();let o;switch(i>=17?o=Fi.evening:i>=12?o=Fi.afternoon:i>=4?o=Fi.morning:o=Fi.night,e){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,e,s){if(e==="ho"){let i=n.getHours()%12;return i===0&&(i=12),s.ordinalNumber(i,{unit:"hour"})}return ys.h(n,e)},H:function(n,e,s){return e==="Ho"?s.ordinalNumber(n.getHours(),{unit:"hour"}):ys.H(n,e)},K:function(n,e,s){const i=n.getHours()%12;return e==="Ko"?s.ordinalNumber(i,{unit:"hour"}):et(i,e.length)},k:function(n,e,s){let i=n.getHours();return i===0&&(i=24),e==="ko"?s.ordinalNumber(i,{unit:"hour"}):et(i,e.length)},m:function(n,e,s){return e==="mo"?s.ordinalNumber(n.getMinutes(),{unit:"minute"}):ys.m(n,e)},s:function(n,e,s){return e==="so"?s.ordinalNumber(n.getSeconds(),{unit:"second"}):ys.s(n,e)},S:function(n,e){return ys.S(n,e)},X:function(n,e,s){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return Db(i);case"XXXX":case"XX":return ei(i);case"XXXXX":case"XXX":default:return ei(i,":")}},x:function(n,e,s){const i=n.getTimezoneOffset();switch(e){case"x":return Db(i);case"xxxx":case"xx":return ei(i);case"xxxxx":case"xxx":default:return ei(i,":")}},O:function(n,e,s){const i=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Rb(i,":");case"OOOO":default:return"GMT"+ei(i,":")}},z:function(n,e,s){const i=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Rb(i,":");case"zzzz":default:return"GMT"+ei(i,":")}},t:function(n,e,s){const i=Math.trunc(+n/1e3);return et(i,e.length)},T:function(n,e,s){return et(+n,e.length)}};function Rb(n,e=""){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)+e+et(c,2)}function Db(n,e){return n%60===0?(n>0?"-":"+")+et(Math.abs(n)/60,2):ei(n,e)}function ei(n,e=""){const s=n>0?"-":"+",i=Math.abs(n),o=et(Math.trunc(i/60),2),c=et(i%60,2);return s+o+e+c}const Lb=(n,e)=>{switch(n){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},dv=(n,e)=>{switch(n){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},jj=(n,e)=>{const s=n.match(/(P+)(p+)?/)||[],i=s[1],o=s[2];if(!o)return Lb(n,e);let c;switch(i){case"P":c=e.dateTime({width:"short"});break;case"PP":c=e.dateTime({width:"medium"});break;case"PPP":c=e.dateTime({width:"long"});break;case"PPPP":default:c=e.dateTime({width:"full"});break}return c.replace("{{date}}",Lb(i,e)).replace("{{time}}",dv(o,e))},kj={p:dv,P:jj},Nj=/^D+$/,Tj=/^Y+$/,Cj=["D","DD","YY","YYYY"];function Mj(n){return Nj.test(n)}function Rj(n){return Tj.test(n)}function Dj(n,e,s){const i=Lj(n,e,s);if(console.warn(i),Cj.includes(n))throw new RangeError(i)}function Lj(n,e,s){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${i} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const qj=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Pj=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bj=/^'([^]*?)'?$/,Uj=/''/g,zj=/[a-zA-Z]/;function $j(n,e,s){var m,b,x,v;const i=qo(),o=i.locale??fv,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,p=kn(n,s==null?void 0:s.in);if(!IA(p))throw new RangeError("Invalid time value");let g=e.match(Pj).map(_=>{const S=_[0];if(S==="p"||S==="P"){const C=kj[S];return C(_,o.formatLong)}return _}).join("").match(qj).map(_=>{if(_==="''")return{isToken:!1,value:"'"};const S=_[0];if(S==="'")return{isToken:!1,value:Ij(_)};if(Mb[S])return{isToken:!0,value:_};if(S.match(zj))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:_}});o.localize.preprocessor&&(g=o.localize.preprocessor(p,g));const u={firstWeekContainsDate:c,weekStartsOn:d,locale:o};return g.map(_=>{if(!_.isToken)return _.value;const S=_.value;(Rj(S)||Mj(S))&&Dj(S,e,String(n));const C=Mb[S[0]];return C(p,S,o.localize,u)}).join("")}function Ij(n){const e=n.match(Bj);return e?e[1].replace(Uj,"'"):n}function Hj(n,e,s){const i=qo(),o=(s==null?void 0:s.locale)??i.locale??fv,c=UA(n,e);if(isNaN(c))throw new RangeError("Invalid time value");const d=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:c}),[p,g]=uv(s==null?void 0:s.in,...c>0?[e,n]:[n,e]),u=HA((s==null?void 0:s.roundingMethod)??"round"),m=g.getTime()-p.getTime(),b=m/Ab,x=vu(g)-vu(p),v=(m-x)/Ab,_=s==null?void 0:s.unit;let S;if(_?S=_:b<1?S="second":b<60?S="minute":b<Nb?S="hour":v<kb?S="day":v<jb?S="month":S="year",S==="second"){const C=u(m/1e3);return o.formatDistance("xSeconds",C,d)}else if(S==="minute"){const C=u(b);return o.formatDistance("xMinutes",C,d)}else if(S==="hour"){const C=u(b/60);return o.formatDistance("xHours",C,d)}else if(S==="day"){const C=u(v/Nb);return o.formatDistance("xDays",C,d)}else if(S==="month"){const C=u(v/kb);return C===12&&_!=="month"?o.formatDistance("xYears",1,d):o.formatDistance("xMonths",C,d)}else{const C=u(v/jb);return o.formatDistance("xYears",C,d)}}function Fj(n,e){return Hj(n,zA(n),e)}let _u=null;function Gj(n){_u=n||null}function Vj(){return _u}function Yj(n,e,s){const i=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...s?{second:"2-digit"}:{},hour12:!0}).formatToParts(n);return Object.fromEntries(i.map(o=>[o.type,o.value]))}function Mm(n,e=!1){const s=typeof n=="string"?new Date(n):n;if(Number.isNaN(s.getTime()))return String(n);if(!_u)return $j(s,e?"MMM d, yyyy h:mm:ss a":"MMM d, yyyy h:mm a");const i=Yj(s,_u,e),o=`${i.hour}:${i.minute}${e?`:${i.second}`:""}`;return`${i.month} ${i.day}, ${i.year} ${o} ${i.dayPeriod}`}function mv(n){const e=n??[];return e.length>0&&e.every(s=>s.type==="member"&&s.write_scope==="none")}function I5(n,e,s){return!e||!mv(n)?!0:!!s&&!s.subjectScoped}const Rm={staleTime:5*6e4,refetchOnWindowFocus:!1};function H5(n={},e={}){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:()=>ue(`/users?${s}`),enabled:e.enabled??!0,...Rm})}const qb=200;async function Kj(n){const e=[];for(let s=0;s<n.length;s+=qb){const i=await ue("/users/names",{method:"POST",body:JSON.stringify({ids:n.slice(s,s+qb)})});e.push(...i.users??[])}return e}let Xd=[],Wd=new Map,Zd=!1;function Jj(){const n=Xd,e=Wd;Xd=[],Wd=new Map,Zd=!1,Kj(n).then(s=>{const i=new Map(s.map(o=>[o.id,o]));for(const[o,c]of e)c.resolve(i.get(o)??null)}).catch(s=>{for(const i of e.values())i.reject(s)})}function Qj(n){return new Promise((e,s)=>{Xd.push(n),Wd.set(n,{resolve:e,reject:s}),Zd||(Zd=!0,setTimeout(Jj,0))})}function F5(n){return Pe({queryKey:["user-name",n],queryFn:()=>Qj(n),enabled:!!n,...Rm})}function Xj(n){return Pe({queryKey:["users",n,"roles"],queryFn:async()=>(await ue(`/users/${n}/roles`)).roles??[],enabled:!!n,...Rm})}function G5(){const n=Le();return ze({mutationFn:e=>ue("/users",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function V5(){const n=Le();return ze({mutationFn:({id:e,...s})=>ue(`/users/${e}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function Y5(){const n=Le();return ze({mutationFn:({id:e,ops:s})=>ue(`/users/${e}/properties`,{method:"PATCH",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function K5(){return Pe({queryKey:["users","system-property-keys"],queryFn:()=>ue("/users/system-property-keys")})}function J5(){const n=Le();return ze({mutationFn:e=>ue(`/users/${e}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function Q5(){const n=Le();return ze({mutationFn:({userId:e,role:s,type:i,read_scope:o,write_scope:c})=>ue(`/users/${e}/roles`,{method:"POST",body:JSON.stringify({role:s,type:i,read_scope:o,write_scope:c})}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function X5(){const n=Le();return ze({mutationFn:({userId:e,role:s})=>ue(`/users/${e}/roles/${encodeURIComponent(s)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}const W5={MAX_PORTALS:12,MAX_ROWS:4,MAX_COLS:6,MAX_COUNTS:8};function Wj(){return Pe({queryKey:["roles"],queryFn:()=>ue("/roles")})}function Ru(n){return Pe({queryKey:["roles","details"],queryFn:()=>ue("/roles/details"),enabled:(n==null?void 0:n.enabled)??!0})}function Z5(n,e,s=!0){return Pe({queryKey:["roles",n,"schema",e??"latest"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/schema${e!=null?`?version=${e}`:""}`),enabled:s&&!!n})}function eM(n){return Pe({queryKey:["roles",n,"schema-versions"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/schema/versions`),enabled:!!n})}function tM(n,e,s=!0){return Pe({queryKey:["roles",n,"list-schema",e??"latest"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/list-schema${e!=null?`?version=${e}`:""}`),enabled:s&&!!n})}function nM(n){return Pe({queryKey:["roles",n,"list-schema-versions"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/list-schema/versions`),enabled:!!n})}function rM(){const n=Le();return ze({mutationFn:e=>ue("/roles",{method:"POST",body:JSON.stringify({role:e})}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function sM(){const n=Le();return ze({mutationFn:({role:e,...s})=>ue(`/roles/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:e,...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===e?{...o,...s}:o)}),{previous:i}},onError:(e,s,i)=>{i!=null&&i.previous&&n.setQueryData(["roles","details"],i.previous)},onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function iM(){const n=Le();return ze({mutationFn:e=>ue(`/roles/${encodeURIComponent(e)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}const pv="lt:station:kiosk-role:";function em(n){return`${pv}${n}`}const tm=new Set;function Zj(){for(const n of tm)n()}function ek(n){try{return localStorage.getItem(em(n))}catch{return null}}function tk(n,e){try{e===null?localStorage.removeItem(em(n)):localStorage.setItem(em(n),e)}catch{}Zj()}function nk(n){tm.add(n);const e=s=>{(s.key===null||s.key.startsWith(pv))&&n()};try{window.addEventListener("storage",e)}catch{}return()=>{tm.delete(n);try{window.removeEventListener("storage",e)}catch{}}}function rk(n){return E.useSyncExternalStore(nk,()=>n?ek(n):null)}const wu="/portal";function sk(n){return n===wu||n.startsWith(`${wu}/`)}function Dm(n,e){const s=`${wu}/${encodeURIComponent(n)}`;return e?`${s}/${encodeURIComponent(e)}`:s}function na(n){return Array.isArray(n==null?void 0:n.portals)?n.portals:[]}function ik(n){return na(n).length>0}function aM(n,e){const s=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"portal",i=new Set(e);if(!i.has(s))return s;let o=2;for(;i.has(`${s}-${o}`);)o+=1;return`${s}-${o}`}function yv(n,e){return e.length>0?Dm(n,e[0].key):`/escalations/available?role=${encodeURIComponent(n)}&status=available`}function Lm(){const{user:n}=qt(),e=(n==null?void 0:n.userId)??null,{data:s}=Xj(e),{data:i}=Ru(),o=rk(e),c=E.useCallback(d=>{e&&tk(e,d)},[e]);return E.useMemo(()=>{const d={kiosk:!1,role:null,homePath:null,targets:[],selectable:!1,selectRole:c},p=s??[];if(p.length===0||p.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)},u=v=>{var _,S;return((S=(_=g(v))==null?void 0:_.properties)==null?void 0:S.kiosk)===!0},m=p.map(v=>v.role).filter(u),b=v=>({kiosk:!0,role:v,homePath:yv(v,na(g(v))),targets:m,selectable:m.length>=2,selectRole:c});if(p.length===1)return m.length===1?b(m[0]):d;if(!mv(p)||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 ak="/escalations/available",ok=["/escalations",wu,"/scan","/login"];function lk(n,e=""){if(n===ak){const s=new URLSearchParams(e);if(!s.get("role")&&!s.get("facets"))return!1}return ok.some(s=>n===s||n.startsWith(`${s}/`)||n.startsWith(`${s}?`))}const qm=E.createContext(null),fd="lt_sidebar_collapsed",gv="(max-width: 1023px)";function ck(){try{return window.matchMedia(gv).matches}catch{return!1}}function uk({children:n}){const[e,s]=E.useState(()=>{if(ck())return!0;try{return localStorage.getItem(fd)==="true"}catch{return!1}});E.useEffect(()=>{let o;try{o=window.matchMedia(gv)}catch{return}const c=d=>{if(d.matches)s(!0);else try{s(localStorage.getItem(fd)==="true")}catch{s(!1)}};return o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[]);const i=E.useCallback(()=>{s(o=>{const c=!o;try{localStorage.setItem(fd,String(c))}catch{}return c})},[]);return h.jsx(qm.Provider,{value:{collapsed:e,toggle:i},children:n})}function fk({children:n}){return h.jsx(qm.Provider,{value:{collapsed:!1,toggle:()=>{}},children:n})}function Pm(){const n=E.useContext(qm);if(!n)throw new Error("useSidebar must be used within SidebarProvider");return n}const Pb=380,Bm=E.createContext(null);function hk({children:n}){const[e,s]=E.useState({node:null,width:Pb,open:!1,ownerKey:null}),i=tn(),o=E.useRef(i.pathname),c=E.useCallback((p,g)=>{s({node:p,width:(g==null?void 0:g.width)??Pb,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),d=E.useCallback(p=>{s(g=>typeof p=="string"&&g.ownerKey!==p?g:{...g,open:!1})},[]);return E.useEffect(()=>{i.pathname!==o.current&&(o.current=i.pathname,s(p=>p.open||p.node?{...p,node:null,open:!1,ownerKey:null}:p))},[i.pathname]),h.jsx(Bm.Provider,{value:{...e,setPanel:c,closePanel:d},children:n})}function Um(){const n=E.useContext(Bm);if(!n)throw new Error("useShellPanel must be used within ShellPanelProvider");return n}function oM(){return E.useContext(Bm)}function dk({open:n,width:e=380,children:s,className:i=""}){const[o,c]=E.useState(n);return E.useEffect(()=>{n&&c(!0)},[n]),h.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${i}`,style:{width:n?e:0,maxWidth:"50%"},onTransitionEnd:d=>{!n&&d.propertyName==="width"&&c(!1)},children:h.jsx("div",{style:{width:e},className:"h-full",children:o?s:null})})}function lM({label:n,children:e}){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:e})]})}function cM({views:n,activeId:e,onViewChange:s,onClose:i,headerActions:o,stickyClassName:c,labelInline:d}){const p=n.find(g=>g.id===e)??n[0];return p?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 u=g.icon,m=g.id===p.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(u,{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:p.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(en,{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:p.label}),h.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${d?"pt-4 pb-8":"pb-5 pt-1"}`,children:p.content})]})}):null}function bv(n,e){var s,i,o,c,d;e.facets&&Object.keys(e.facets).length&&n.set("facets",JSON.stringify(e.facets)),(s=e.block)!=null&&s.length&&n.set("block",JSON.stringify(e.block)),(i=e.range)!=null&&i.length&&n.set("range",JSON.stringify(e.range)),(o=e.exists)!=null&&o.length&&n.set("exists",JSON.stringify(e.exists)),(c=e.roles)!=null&&c.length&&n.set("roles",JSON.stringify(e.roles)),(d=e.orderBy)!=null&&d.length&&n.set("orderBy",JSON.stringify(e.orderBy)),e.available!==void 0&&n.set("available",String(e.available)),e.jeopardy===!0&&n.set("jeopardy","1"),e.include&&n.set("include",e.include),e.groupBy&&n.set("groupBy",e.groupBy)}function uM(n,e,s){const i=n??"24h",o=e&&Object.keys(e).length?JSON.stringify(e):null;return Pe({queryKey:["stationMetrics",i,o],queryFn:()=>ue(`/escalations/station-metrics?period=${i}${o?`&facets=${encodeURIComponent(o)}`:""}`),staleTime:5e3,enabled:(s==null?void 0:s.enabled)??!0})}function fM(n){const e=n?`?period=${n}`:"";return Pe({queryKey:["escalationStats",n],queryFn:()=>ue(`/escalations/stats${e}`)})}function hM(){return Pe({queryKey:["escalationTypes"],queryFn:()=>ue("/escalations/types")})}function dM(n=!0){return Pe({queryKey:["escalationFacetKeys"],queryFn:()=>ue("/escalations/facet-keys"),enabled:n,staleTime:6e4})}function mk(n){return Pe({queryKey:["escalationFacetValues",n],queryFn:()=>ue(`/escalations/facet-values?key=${encodeURIComponent(n)}`),enabled:!!n,staleTime:6e4})}function pk(n){const e=new URLSearchParams;return n.status&&e.set("status",n.status),n.role&&e.set("role",n.role),n.type&&e.set("type",n.type),n.subtype&&e.set("subtype",n.subtype),n.assigned_to&&e.set("assigned_to",n.assigned_to),n.parent_id&&e.set("parent_id",n.parent_id),n.claimed&&e.set("claimed","true"),n.priority&&e.set("priority",String(n.priority)),n.limit&&e.set("limit",String(n.limit)),n.offset!==void 0&&e.set("offset",String(n.offset)),n.sort_by&&e.set("sort_by",n.sort_by),n.order&&e.set("order",n.order),n.search&&e.set("search",n.search),bv(e,n),e}function yk(n){return{queryKey:["escalations",n],queryFn:()=>ue(`/escalations?${pk(n)}`)}}function xv(n){const{enabled:e=!0,staleTime:s,...i}=n;return Pe({...yk(i),enabled:e,...s!==void 0?{staleTime:s}:{}})}function vv(n){const{enabled:e=!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),bv(o,i),Pe({queryKey:["escalations","available",i],queryFn:()=>ue(`/escalations/available?${o}`),enabled:e,...s!==void 0?{staleTime:s}:{}})}function mM(n){return Pe({queryKey:["escalations","by-workflow",n],queryFn:()=>ue(`/escalations/by-workflow/${n}`),enabled:!!n})}function pM(n){return Pe({queryKey:["escalations",n],queryFn:()=>ue(`/escalations/${n}`),enabled:!!n})}function yM(n,e){return Pe({queryKey:["escalations",n,"lookups"],queryFn:()=>ue(`/escalations/${n}/lookups`),enabled:!!n&&e,staleTime:0,refetchOnWindowFocus:!1})}function gM(){const n=Le();return ze({mutationFn:({id:e,durationMinutes:s})=>ue(`/escalations/${e}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function bM(){const n=Le();return ze({mutationFn:e=>ue(`/escalations/${e}/release`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function xM(){const n=Le();return ze({mutationFn:({id:e,resolverPayload:s})=>ue(`/escalations/${e}/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"]})}})}const vM={NEEDS_BADGE:"needs_badge",ROLE_REFUSED:"role_refused"};function _M(){const n=Le();return ze({mutationFn:({id:e,...s})=>ue(`/escalations/${e}/roster-action`,{method:"POST",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]}),n.invalidateQueries({queryKey:["escalationStats"]})}})}function wM(){const n=Le();return ze({mutationFn:({id:e,field:s,code:i})=>ue(`/escalations/${e}/roster-scan`,{method:"POST",body:JSON.stringify({field:s,code:i})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]}),n.invalidateQueries({queryKey:["escalationStats"]})}})}function SM(){const n=Le();return ze({mutationFn:({id:e,itemKey:s,payload:i})=>ue(`/escalations/${e}/accumulate`,{method:"POST",body:JSON.stringify({itemKey:s,...i?{payload:i}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function EM(){const n=Le();return ze({mutationFn:({id:e,itemKey:s})=>ue(`/escalations/${e}/remove-item`,{method:"POST",body:JSON.stringify({itemKey:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function OM(){const n=Le();return ze({mutationFn:({id:e,targetRole:s})=>ue(`/escalations/${e}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function AM(){const n=Le();return ze({mutationFn:({ids:e,priority:s})=>ue("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:e,priority:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function jM(){const n=Le();return ze({mutationFn:({ids:e,durationMinutes:s})=>ue("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:e,durationMinutes:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function kM(){const n=Le();return ze({mutationFn:({ids:e,targetUserId:s,durationMinutes:i,reassign:o})=>ue("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:e,targetUserId:s,durationMinutes:i,...o?{reassign:!0}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function NM(){const n=Le();return ze({mutationFn:({ids:e})=>ue("/escalations/bulk-unassign",{method:"POST",body:JSON.stringify({ids:e})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function TM(){const n=Le();return ze({mutationFn:({ids:e,hint:s})=>ue("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:e,...s?{hint:s}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function CM(){const n=Le();return ze({mutationFn:e=>ue(`/escalations/${e}/cancel`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function MM(){const n=Le();return ze({mutationFn:({ids:e})=>ue("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:e})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function zm(n){const e=[],s=n.type.split(".");switch(s[0]==="system"?s[1]:s[0]){case"task":e.push(["tasks"]),e.push(["jobs"]),e.push(["processes"]),n.workflowId&&(e.push(["workflowExecution",n.workflowId]),e.push(["workflowState",n.workflowId]),e.push(["mcpQueryExecution",n.workflowId])),n.originId&&e.push(["processes",n.originId]);break;case"escalation":e.push(["escalations"]),e.push(["escalationStats"]),e.push(["stationMetrics"]),n.workflowId&&e.push(["workflowExecution",n.workflowId]);break;case"workflow":e.push(["jobs"]),e.push(["tasks"]),e.push(["processes"]),n.workflowId&&(e.push(["workflowExecution",n.workflowId]),e.push(["workflowState",n.workflowId]),e.push(["mcpQueryExecution",n.workflowId]),e.push(["mcpQueryResult",n.workflowId]),e.push(["builderResult",n.workflowId]));break;case"activity":n.workflowId&&e.push(["mcpRunExecution",n.workflowId]),e.push(["mcpRuns"]);break;case"milestone":n.workflowId&&(e.push(["workflowExecution",n.workflowId]),e.push(["mcpQueryExecution",n.workflowId])),e.push(["tasks"]);break;case"knowledge":e.push(["knowledge"]);break;case"file":e.push(["files"]);break;case"agent":e.push(["agents"]);break;default:e.push(["jobs"]),e.push(["tasks"]);break}return e}const gk={DETAIL:{coalesceMs:300,minIntervalMs:2e3},LIST:{coalesceMs:500,minIntervalMs:3e3},SUMMARY:{coalesceMs:1e3,minIntervalMs:1e4}},RM=300,Bb={DETAIL:0,LIST:1,SUMMARY:2};function bk(n){const e=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 e)_===m&&b.push(v);for(const v of b)e.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 p(m){if(s[m])return;const{coalesceMs:b,minIntervalMs:x}=gk[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),_=e.get(v);(_===void 0||Bb[m]<Bb[_])&&e.set(v,m)}p(m)}const u=()=>{typeof document>"u"||document.visibilityState==="visible"&&o&&(o=!1,n.refetchQueries({type:"active",stale:!0}))};return typeof document<"u"&&document.addEventListener("visibilitychange",u),{request:g,dispose(){for(const m of Object.keys(s)){const b=s[m];b&&clearTimeout(b),delete s[m]}e.clear(),typeof document<"u"&&document.removeEventListener("visibilitychange",u)}}}const Ub=new WeakMap;function xk(n){let e=Ub.get(n);return e||(e=bk(n),Ub.set(n,e)),e}function nn(n){const e=Le();return E.useCallback(s=>{xk(e).request(n,s)},[e,n])}function $m(n){return n?[`${Wt}.system.workflow.>`,`${Wt}.system.activity.>`,`${Wt}.system.milestone.>`,`${Wt}.system.task.>`,`${Wt}.system.escalation.>`]:[]}function DM(){const n=nn("LIST");An(`${Wt}.system.task.>`,()=>{n([["jobs"]])}),An(`${Wt}.system.workflow.>`,()=>{n([["jobs"]])})}function LM(n){const e=nn("DETAIL");Ns($m(n),s=>{var p;if(!n||!(s.workflowId===n||((p=s.workflowId)==null?void 0:p.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],d=zm(s);c==="escalation"&&d.push(["escalations","by-workflow",n]),e(d)})}function qM(n){const e=nn("DETAIL");Ns($m(n),s=>{var p;if(!n||!(s.workflowId===n||((p=s.workflowId)==null?void 0:p.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],d=zm(s);c==="escalation"&&d.push(["escalations","by-workflow",n]),e(d)})}function PM(n){const e=nn("DETAIL");Ns($m(n),s=>{var c;if(!n||!(s.workflowId===n||((c=s.workflowId)==null?void 0:c.includes(n))))return;const o=zm(s);o.push(["workflowSets"]),o.push(["yamlWorkflows"]),e(o)})}function BM(n){const e=nn("DETAIL"),s=E.useCallback(i=>{n&&(i.originId!==n&&i.workflowId!==n||e([["processes",n]]))},[n,e]);An(`${Wt}.system.task.>`,s),An(`${Wt}.system.workflow.>`,s),An(`${Wt}.system.escalation.>`,s)}function UM(){const n=nn("SUMMARY");An(fr({}),()=>{n([["escalationStats"]])})}function zM(){const n=nn("SUMMARY");An(fr({}),()=>{n([["stationMetrics"]])})}function $M(){const n=nn("SUMMARY");An(fr({}),()=>{n([["escAggregate"],["escTimeline"]])})}function IM(n){const e=nn("LIST"),s=(n==null?void 0:n.role)??null,i=((n==null?void 0:n.verbs)??[]).join(","),o=E.useMemo(()=>{const c=i?i.split(","):null;return c?Jd({role:s,verbs:c}):[fr({role:s})]},[s,i]);Ns(o,()=>{e([["escalations"]])})}const vk=[["escalations","related"],["escalations","related-rows"]];function HM(n){const e=nn("LIST"),s=[...new Set(n)].sort().join(","),i=E.useMemo(()=>s?s.split(",").map(o=>fr({role:o})):[],[s]);Ns(i,()=>{e(vk)})}function FM(n){const e=nn("DETAIL");An(fr(n?{id:n}:{id:"__none__"}),s=>{!n||s.escalationId!==n||e([["escalations",n]])})}function GM(){const n=nn("LIST");An(`${Wt}.system.agent.>`,()=>{n([["agents"]])})}function VM(){const n=nn("LIST");An(`${Wt}.system.task.>`,()=>{n([["processes"]])}),An(`${Wt}.system.workflow.>`,()=>{n([["processes"]])})}function _k(){const{user:n}=qt(),e=n==null?void 0:n.userId,s=nn("SUMMARY");Ns(Cm(),()=>{s([["escalations"]])});const{data:i}=vv({limit:1}),{data:o}=xv({assigned_to:e,status:"pending",limit:1});return{available:(i==null?void 0:i.total)??0,mine:(o==null?void 0:o.total)??0}}function Du({size:n="sm",hideLabel:e=!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(${Yt}/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(${Yt}/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",p=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(${Yt}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${p} ${e?"opacity-0":""}`,children:i})]})}const wk="system.surfaces.dashboard",Sk=`${Wt}.${wk}`;function _v(n=!0){return Pe({queryKey:["announcements"],queryFn:()=>ue("/announcements"),enabled:n,staleTime:3e4})}function Ek(){const n=Le();return ze({mutationFn:e=>ue("/announcements",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function Ok(){const n=Le();return ze({mutationFn:e=>ue(`/announcements/${encodeURIComponent(e)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function YM(n){return n.toLocaleString()}function KM(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 Ak(n){const e=new Date(n);return e.getTime()>Date.now()?"just now":Fj(e,{addSuffix:!0})}function JM(n){const e=Date.now()-new Date(n).getTime();if(e<0)return"now";const s=Math.floor(e/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 QM(n){return n<=0?"Expired":Im(n)}function jk(n){return n==null?"--":Im(n)}function XM(n){return n?Mm(n):"--"}function Im(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 e=Math.floor(n/1e3),s=Math.floor(e/86400),i=Math.floor(e%86400/3600),o=Math.floor(e%3600/60),c=e%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 WM(n,e){const s=new Date(n).getTime(),i=e?new Date(e).getTime():Date.now();return Im(i-s)}function wv({options:n,children:e,className:s=""}){const[i,o]=E.useState(!1),[c,d]=E.useState(null),[p,g]=E.useState(null),u=E.useRef(null),m=E.useRef(void 0),b=E.useRef(void 0),x=220,v=E.useCallback(()=>{if(!u.current)return;const B=u.current.getBoundingClientRect(),q=window.innerWidth-x-8,ne=Math.max(8,Math.min(B.left,q));g({top:B.bottom+4,left:ne})},[]),_=E.useCallback(async(B,q)=>{try{await navigator.clipboard.writeText(B),d(q),clearTimeout(m.current),m.current=setTimeout(()=>d(null),1200)}catch{}},[]),S=E.useCallback(()=>{clearTimeout(b.current),v(),o(!0)},[v]),C=E.useCallback(()=>{b.current=setTimeout(()=>o(!1),150)},[]);return E.useEffect(()=>()=>{clearTimeout(m.current),clearTimeout(b.current)},[]),h.jsxs("span",{ref:u,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:S,onMouseLeave:C,children:[e,i&&p&&lm.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:p.top,left:p.left},onMouseEnter:S,onMouseLeave:C,children:n.map(B=>h.jsxs("button",{onClick:q=>{q.stopPropagation(),_(B.value,B.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:B.label}),h.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===B.label?"✓":B.value})]},B.label))}),document.body)]})}function kk(n,e){const s=new Date(n);switch(e){case"relative":return Ak(n);case"datetime":return Mm(s);case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:Vj()??void 0})}}function Nk(n){const e=new Date(n);return[{label:"ms",value:String(e.getTime())},{label:"utc",value:e.toISOString()},{label:"local",value:Mm(e,!0)}]}function Sv({date:n,format:e="relative",className:s=""}){const[,i]=E.useState(0);E.useEffect(()=>{if(e!=="relative")return;const c=setInterval(()=>i(d=>d+1),3e4);return()=>clearInterval(c)},[e]);const o=E.useMemo(()=>Nk(n),[n]);return h.jsx(wv,{options:o,children:h.jsx("time",{dateTime:n,className:`text-xs text-text-tertiary ${s}`,children:kk(n,e)})})}function Tk({values:n,options:e,onChange:s,addLabel:i,emptyText:o,ariaLabel:c}){const d=e.filter(p=>!n.includes(p));return h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.map(p=>h.jsxs("button",{type:"button",onClick:()=>s(n.filter(g=>g!==p)),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 ${p}`,children:[p,h.jsx(en,{className:"w-3 h-3",strokeWidth:1.5})]},p)),n.length===0&&o&&h.jsx("span",{className:"text-2xs text-text-tertiary italic",children:o}),d.length>0&&h.jsxs("select",{value:"",onChange:p=>p.target.value&&s([...n,p.target.value]),className:"select font-mono","aria-label":c??i,children:[h.jsx("option",{value:"",children:i}),d.map(p=>h.jsx("option",{value:p,children:p},p))]})]})}const Ck=[{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 Mk(){const{data:n}=_v(),{data:e}=Wj(),s=Ek(),i=Ok(),[o,c]=E.useState(""),[d,p]=E.useState(""),[g,u]=E.useState(1440),[m,b]=E.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(""),p(""),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:_=>p(_.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:_=>u(Number(_.target.value)),className:"select text-xs w-full",children:Ck.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(Tk,{values:m,options:(e==null?void 0:e.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(en,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]},_.id))})]})]})}const Rk=[{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"}],Dk=["operator","engineer","admin","superadmin"];function zb(n){return Dk.indexOf(n)}function Lk(n,e){return zb(n)>=zb(e)}function qk({onClose:n}){var Ne,Me,Xe,pt,Ot,mt,_e;const{isSuperAdmin:e,hasRoleType:s,hasRole:i}=qt(),{data:o}=Hn(),c=Nm(),d=!!((Ne=o==null?void 0:o.ai)!=null&&Ne.enabled),p=tv(),g=p!==null?p:d,[u,m]=E.useState(g),b=(Me=o==null?void 0:o.features)==null?void 0:Me.graphWorkflows,x=b==null,[v,_]=E.useState(b===!0||x&&nv()),S=e||i("engineer"),[C,B]=E.useState(rv()),q=!!((Xe=o==null?void 0:o.features)!=null&&Xe.scanCodes),ne=sv(),[te,M]=E.useState(ne!==null?ne:q),z=e?"superadmin":s("admin")?"admin":i("engineer")?"engineer":"operator",ae=((pt=o==null?void 0:o.branding)==null?void 0:pt.appName)??"LongTail",F=(Ot=o==null?void 0:o.environment)==null?void 0:Ot.longTailVersion,U=(mt=o==null?void 0:o.environment)==null?void 0:mt.hotmeshVersion,D=(_e=o==null?void 0:o.environment)==null?void 0:_e.nodeEnv;E.useEffect(()=>{const oe=Be=>{Be.key==="Escape"&&n()};return document.addEventListener("keydown",oe),()=>document.removeEventListener("keydown",oe)},[n]);const Q=Rk.filter(oe=>Lk(z,oe.minTier)),W=Q.length>1,he=z!=="operator",Ee=[...W?[{id:"viewas",label:"View As",icon:OS}]:[],{id:"features",label:"Features",icon:AS},...he?[{id:"alerts",label:"Alerts",icon:jS}]:[]],[Ae,H]=E.useState(Ee[0].id),J=oe=>{oe===null?Kd():EA(oe)},ce=()=>{const oe=!u;m(oe),oe===d?SA():wA(oe),window.location.reload()},pe=()=>{const oe=!v;_(oe),OA(oe),window.location.reload()},ge=()=>{const oe=!C;B(oe),AA(oe),window.location.reload()},Ce=()=>{const oe=!te;M(oe),oe===q?kA():jA(oe),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:oe=>oe.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(en,{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(${Yt}/logo512.png)`}}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:ae}),F&&h.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",F,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"}),Ee.length>1&&h.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:Ee.map(oe=>{const Be=Ae===oe.id;return h.jsxs("button",{role:"tab","aria-selected":Be,onClick:()=>H(oe.id),title:oe.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${Be?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[h.jsx(oe.icon,{className:"w-5 h-5",strokeWidth:1.5,...Be?{fill:"currentColor",fillOpacity:.15}:{}}),h.jsx("span",{className:"text-2xs font-medium",children:oe.label})]},oe.id)})}),Ae==="viewas"&&W&&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"}),Q.map(oe=>{const Be=c===oe.id,zt=oe.id===null?`Your view · ${z}`:oe.label;return h.jsxs("button",{onClick:()=>J(oe.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 ${Be?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:Be&&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 ${Be?"text-accent":"text-text-primary group-hover:text-accent"}`,children:zt}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:oe.description})]})]},String(oe.id))})]}),Ae==="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:ce,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:u?"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 ${u?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${u?"translate-x-4":"translate-x-0"}`})})]}),x&&h.jsxs("button",{onClick:pe,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:ge,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:Ce,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:te?"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 ${te?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${te?"translate-x-4":"translate-x-0"}`})})]})]}),Ae==="alerts"&&he&&h.jsx(Mk,{}),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 Ev=[{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"}],$b="blue",Ov="lt.theme";let Av=[];function Pk(n){const e=new Set(Ev.map(i=>i.id)),s=new Set;Av=n.filter(i=>!(i!=null&&i.id)||e.has(i.id)||s.has(i.id)?!1:(s.add(i.id),!0))}function Bk(){return[...Ev,...Av]}function jv(){try{return localStorage.getItem(Ov)||$b}catch{return $b}}function kv(n){document.documentElement.dataset.theme=n}function Uk(n){try{localStorage.setItem(Ov,n)}catch{}kv(n)}const zk=[8,12,13,14];function Nv(n){if(!/^[0-9]+$/.test(n)||!zk.includes(n.length))return!1;const e=n.split("").map(Number),s=e.pop();let i=0;for(let o=e.length-1,c=3;o>=0;o--,c=c===3?1:3)i+=e[o]*c;return(10-i%10)%10===s}function $k(n){return n.padStart(14,"0")}const Ik="0",Hk="0",nm=64;function ZM(n,e){const s=n.trim();if(!s)return{ok:!1,failure:{reason:"empty",detail:"empty scan code"}};const i=Fk(s,e);return i.ok?i:Tv(s,e,!1)??i}function Fk(n,e){if(/^[0-9]+$/.test(n)){const c=e.find(p=>p.encoding==="fixed"&&p.version===Number(n.slice(0,2)));if(!((c==null?void 0:c.enabled)&&Gk(n,c))){const p=Tv(n,e,!0);if(p)return p;const g=Vk(n,e);if(g)return g}}const s=n.slice(0,2),i=Number(s);if(!/^[0-9]{2}$/.test(s)||i<10||i>99)return{ok:!1,failure:{reason:"unknown_version",detail:`code must start with a two-digit scheme 10-99, got "${s}"`}};const o=e.find(c=>c.version===i);return o?o.enabled?o.encoding==="gtin"?vs(o,"reads manufacturer barcodes, which carry no scheme prefix"):o.encoding==="pattern"?vs(o,"reads codes by its declared patterns, which carry no scheme prefix"):o.encoding==="delimited"?Kk(n,i,o):Jk(n,i,o):{ok:!1,failure:{reason:"scheme_disabled",detail:`scan scheme ${i} ("${o.name}") is disabled`}}:{ok:!1,failure:{reason:"unknown_version",detail:`no scan scheme configured for version ${i}`}}}function Gk(n,e){const s=3+(e.target_length??0);return n.length===s||n.length===s+1}function Vk(n,e){if(!Nv(n))return null;const s=e.find(i=>i.encoding==="gtin"&&i.enabled)??e.find(i=>i.encoding==="gtin");return s?s.enabled?{ok:!0,parsed:{version:s.version,category:Ik,target:$k(n),raw:n},scheme:s}:{ok:!1,failure:{reason:"scheme_disabled",detail:`scan scheme ${s.version} ("${s.name}") is disabled`}}:null}function Tv(n,e,s){const i=e.filter(c=>c.encoding==="pattern"&&(!s||c.precedes_gtin)).filter(c=>Cv(c.patterns??[],n)).sort((c,d)=>c.version-d.version),o=i.find(c=>c.enabled)??i[0];return o?o.enabled?{ok:!0,parsed:{version:o.version,category:Hk,target:n},scheme:o}:{ok:!1,failure:{reason:"scheme_disabled",detail:`scan scheme ${o.version} ("${o.name}") is disabled`}}:null}function Cv(n,e){return e.length>nm?!1:n.some(s=>{var i;return(i=Yk(s))==null?void 0:i.test(e)})}const hd=new Map;function Yk(n){if(hd.has(n))return hd.get(n);let e;try{e=new RegExp(`^(?:${Mv(n)})$`)}catch{e=null}return hd.set(n,e),e}function Mv(n){let e=n.startsWith("^")?n.slice(1):n;return e.endsWith("$")&&!e.endsWith("\\$")&&(e=e.slice(0,-1)),e}function Kk(n,e,s){const i=s.delimiter;if(n[2]!==i)return vs(s,`expected "${i}" after the two-digit scheme`);const o=n.slice(3,4);if(!/^[0-9]$/.test(o))return vs(s,"category must be a single digit");if(n[4]!==i)return vs(s,`expected "${i}" after the category`);const c=n.slice(5);return c?{ok:!0,parsed:{version:e,category:o,target:c},scheme:s}:vs(s,"target is empty")}function Jk(n,e,s){const i=s.target_length??0,o=3+i;if(!/^[0-9]+$/.test(n))return vs(s,"fixed encoding accepts digits only");if(n.length!==o&&n.length!==o+1)return vs(s,`expected ${o} digits (or ${o+1} with check digit), got ${n.length}`);const c=n.slice(2,3),d=n.slice(3,3+i);return{ok:!0,parsed:{version:e,category:c,target:d},scheme:s}}function vs(n,e){return{ok:!1,failure:{reason:"malformed",detail:`scheme ${n.version} ("${n.name}"): ${e}`}}}const uu={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},Rv="lt_scan_wedge_config";function Dv(){try{const n=localStorage.getItem(Rv);return n?{...uu,...JSON.parse(n)}:uu}catch{return uu}}function Qk(n){const e={...Dv(),...n};return localStorage.setItem(Rv,JSON.stringify(e)),e}const Hm=[{pattern:/(?:^|[^0-9])([1-9][0-9]:[0-9]:[a-zA-Z0-9._-]+)$/,scannerPaced:!1},{pattern:/(?:^|[^0-9])([1-9][0-9]{7,})$/,scannerPaced:!0}];function Xk(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Wk(n){try{return new RegExp(`(?:^|[^A-Za-z0-9])((?:${Mv(n)}))$`)}catch{return null}}function Zk(n){const e=[];for(const s of n.filter(i=>i.enabled))if(s.encoding==="delimited"){const i=Xk(s.delimiter);e.push({pattern:new RegExp(`(?:^|[^0-9])(${s.version}${i}[0-9]${i}[a-zA-Z0-9._-]+)$`),scannerPaced:!1})}else if(s.encoding==="fixed"){const i=1+(s.target_length??0);e.push({pattern:new RegExp(`(?:^|[^0-9])(${s.version}[0-9]{${i},${i+1}})$`),scannerPaced:!0})}else if(s.encoding==="gtin")e.push({pattern:/(?:^|[^0-9])([0-9]{8}|[0-9]{12,14})$/,scannerPaced:!0,accept:Nv});else if(s.encoding==="pattern")for(const i of s.patterns??[]){const o=Wk(i);o&&e.push({pattern:o,scannerPaced:!0,maxTail:nm+1,accept:c=>c.length<=nm})}return e.length?e:Hm}function eN(n,e=Hm){var i;let s=null;for(const o of e){const d=(i=(o.maxTail?n.slice(-o.maxTail):n).match(o.pattern))==null?void 0:i[1];!d||o.accept&&!o.accept(d)||(!s||d.length>s.code.length)&&(s={code:d,shape:o})}return s}const tN=new Set(["Shift","CapsLock"]),dc={suppress:!1,emit:null};function nN(n=uu,e=Hm){let s={buffer:"",times:[],lastKeyMs:0};function i(u){const m=s.times.slice(-u.length);return m.length<2?!1:(m[m.length-1]-m[0])/(m.length-1)<=n.autoFireMaxAvgKeyMs}function o(){const u=eN(s.buffer,e);return!u||u.code.length<n.minLength||u.shape.scannerPaced&&!i(u.code)?null:u.code}function c(){s={buffer:"",times:[],lastKeyMs:0}}function d(u){const{key:m,timeMs:b,hasModifier:x,isRepeat:v}=u;if(tN.has(m))return dc;if(n.terminators.includes(m)){const q=o();return c(),q?{suppress:!0,emit:q,consumedLength:q.length}:dc}if(x||v||m.length!==1)return c(),dc;const _=b-s.lastKeyMs,S=s.lastKeyMs>0&&_<=n.maxKeyGapMs,C=(S?s.buffer+m:m).slice(-128),B=(S?[...s.times,b]:[b]).slice(-128);return s={buffer:C,times:B,lastKeyMs:b},dc}function p(){return{buffer:s.buffer}}function g(){const u=o();return!u||!i(u)?null:{code:u,consumedLength:u.length}}return{step:d,reset:c,snapshot:p,pendingAutoFire:g}}function rN(){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 sN(n,e,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,e):n.value=e;try{n.setSelectionRange(s,s)}catch{}n.dispatchEvent(new Event("input",{bubbles:!0}))}function Ib(n){if(n<=0)return;const e=rN();if(!e)return;const s=e.selectionStart??e.value.length,i=Math.max(0,s-n);sN(e,e.value.slice(0,i)+e.value.slice(s),i)}const ra={KEYBOARD_WEDGE:"keyboard-wedge",MANUAL:"manual",TOOLBAR:"toolbar",FOLLOW:"follow"},iN="data-lt-scan-capture",aN="off";function oN(n){return n instanceof Element&&!!n.closest(`[${iN}="${aN}"]`)}function lN({active:n,wedgeConfig:e,tailShapes:s,diagnosticsOn:i,onScan:o,onDiag:c}){const d=E.useRef({diagnosticsOn:i,onScan:o,onDiag:c});d.current={diagnosticsOn:i,onScan:o,onDiag:c};const p=E.useRef(0),g=E.useRef(0);E.useEffect(()=>{if(!n)return;const u=nN(e,s);let m=null;const b=()=>{m&&(clearTimeout(m),m=null)},x=(S,C,B)=>{C&&Ib(C),d.current.diagnosticsOn&&(console.debug("[scan]",B),d.current.onDiag({seq:++p.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:B})),d.current.onScan(S)},v=()=>{b(),u.pendingAutoFire()&&(m=setTimeout(()=>{m=null;const S=u.pendingAutoFire();S&&(u.reset(),x(S.code,S.consumedLength,`capture → ${S.code} (quiet period — no suffix)`))},e.autoFireQuietMs))},_=S=>{if(oN(S.target)){u.reset(),b();return}const C=u.snapshot().buffer,{suppress:B,emit:q,consumedLength:ne}=u.step({key:S.key,timeMs:S.timeStamp,hasModifier:S.ctrlKey||S.metaKey||S.altKey,isRepeat:S.repeat});if(B&&(S.preventDefault(),S.stopPropagation()),d.current.diagnosticsOn){const te=u.snapshot().buffer,M=e.terminators.includes(S.key),z=q?`capture → ${q}`:M?`terminator — no code tail in "${C.slice(-24)}"`:te===C?C?"neutral (chord key)":"ignored":te===""?"reset (edit/chord/non-printable)":te.length<=1&&C.length>1?"gap — new episode":"accumulate",ae=g.current?Math.round(S.timeStamp-g.current):0,F={seq:++p.current,key:S.key,code:S.code!==S.key?S.code:"",deltaMs:ae,buffer:te.slice(-24),note:z};console.debug("[scan]",F.key,F.code,`${F.deltaMs}ms`,F.note),d.current.onDiag(F)}g.current=S.timeStamp,q?(b(),ne&&Ib(ne),d.current.onScan(q)):v()};return window.addEventListener("keydown",_,{capture:!0}),()=>{b(),window.removeEventListener("keydown",_,{capture:!0})}},[n,e,s])}const ke={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",NO_OPEN_CONTAINER:"no_open_container",HELD:"held",REFUSED:"refused",SUBJECT_STALE:"subject_stale"},mc={SHOW_DETAIL:"show-detail",SHOW_LIST:"show-list",CLAIM:"claim",CLAIM_SHOW_DETAIL:"claim-show-detail",RELEASE:"release",RESOLVE:"resolve",ESCALATE:"escalate",CANCEL:"cancel",ACCUMULATE:"accumulate",PRESENT:"present",HOLD:"hold",FILL:"fill"},cN={ACTION:"action",IDENTITY:"identity"};function uN(n,e){return ue("/scan-codes/execute",{method:"POST",body:JSON.stringify({code:n,...e!=null&&e.actingToken?{actingToken:e.actingToken}:{},...e!=null&&e.previousActingToken?{previousActingToken:e.previousActingToken}:{},...e!=null&&e.subject?{subject:e.subject}:{},...e!=null&&e.stationRole?{stationRole:e.stationRole}:{}})})}function eR(n){return ue("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(n)})}function Lv(n){return Pe({queryKey:["scan-schemes"],queryFn:()=>ue("/scan-codes/schemes"),...n})}function tR(n){return Pe({queryKey:["scan-schemes",n],queryFn:()=>ue(`/scan-codes/schemes/${n}`),enabled:n!=null})}function nR(){const n=Le();return ze({mutationFn:e=>ue(`/scan-codes/schemes/${e.version}`,{method:"PUT",body:JSON.stringify(e)}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function rR(){const n=Le();return ze({mutationFn:e=>ue(`/scan-codes/schemes/${e}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function sR(){const n=Le();return ze({mutationFn:e=>ue(`/scan-codes/schemes/${e.scheme_version}/actions/${e.category}`,{method:"PUT",body:JSON.stringify(e)}),onSuccess:(e,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}function iR(){const n=Le();return ze({mutationFn:e=>ue(`/scan-codes/schemes/${e.scheme_version}/actions/${e.category}`,{method:"DELETE"}),onSuccess:(e,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}const fN=3e4;function hN(n,e=Date.now()){if(!(!n||Date.parse(n.expiresAt)<=e))return{code:n.code,escalationId:n.escalationId}}function Hb(n,e,s=Date.now()){if(e.outcome===ke.HELD&&e.subject){const i=Math.max(0,Date.parse(e.subject.expiresAt)-s);return{...e.subject,ttlMs:i}}return e.clearSubject||!n?null:e.outcome===ke.EXECUTED&&e.progress&&e.progress.remaining>0?{...n,expiresAt:new Date(s+n.ttlMs).toISOString()}:n}function Fb(n){return n.outcome===ke.NOT_PRIMED&&n.replayable===!0}function dN(n,e=Date.now()){return n&&e-n.at<=fN?n:null}const mN=[ke.HELD,ke.REFUSED,ke.SUBJECT_STALE],Gi=n=>{if(n)try{return JSON.parse(n)}catch{return}},ti=n=>n==null||Array.isArray(n)&&n.length===0||typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).length===0;function pN(n){const e={},s=Gi(n.get("facets"));ti(s)||(e.facets=s);const i=Gi(n.get("block"));ti(i)||(e.block=i);const o=Gi(n.get("range"));ti(o)||(e.range=o);const c=Gi(n.get("exists"));ti(c)||(e.exists=c);const d=Gi(n.get("roles"));ti(d)||(e.roles=d);const p=Gi(n.get("orderBy"));ti(p)||(e.orderBy=p),n.get("available")!=null&&(e.available=n.get("available")==="true");const g=n.get("jeopardy");return(g==="1"||g==="true")&&(e.jeopardy=!0),e}function aR(n,e){const s=(i,o)=>ti(o)?n.delete(i):n.set(i,JSON.stringify(o));s("facets",e.facets),s("block",e.block),s("range",e.range),s("exists",e.exists),s("roles",e.roles),s("orderBy",e.orderBy),e.available==null?n.delete("available"):n.set("available",String(e.available)),e.jeopardy===!0?n.set("jeopardy","1"):n.delete("jeopardy")}const rm=`&status=all&view=table&orderBy=${encodeURIComponent(JSON.stringify([{field:"created_at",direction:"desc"}]))}`;function qv(n,e){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 e?`/escalations/available?role=${encodeURIComponent(e)}&facets=${i}${rm}`:`/escalations/available?facets=${i}${rm}`}function yN(n,e,s){const i=encodeURIComponent(JSON.stringify({[n]:[e]}));return`/escalations/available?${s?`role=${encodeURIComponent(s)}&`:""}facets=${i}${rm}`}function gN(n,e,s){return qv({[n]:e},s)}function oR(n){var e,s,i;return Object.keys(n.facets??{}).length+(((e=n.block)==null?void 0:e.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 Fm(){var s;const{data:n}=Hn(),e=sv();return e!==null?e:!!((s=n==null?void 0:n.features)!=null&&s.scanCodes)}const Gm=E.createContext(null);function Vm(){const n=E.useContext(Gm);if(!n)throw new Error("useScanInput must be used within ScanInputProvider");return n}function lR(){return E.useContext(Gm)}const bN="scanPendingAction",xN="scanChoices",dd="/scan/station";function vN({children:n}){const{user:e}=qt(),s=Fm(),i=ri(),o=tn(),{identity:c,prime:d,clear:p,settle:g}=Mu(),[u,m]=E.useState(null),[b,x]=E.useState(null),[v,_]=E.useState(null),{data:S}=Lv({enabled:!!e&&s,staleTime:6e4}),C=E.useRef(null);C.current=Lm().role;const B=E.useMemo(()=>Zk((S==null?void 0:S.schemes)??[]),[S]),[q,ne]=E.useState(!1),[te,M]=E.useState(()=>Dv()),[z,ae]=E.useState([]),[F,U]=E.useState(!1),D=E.useCallback(_e=>{var zt;const{outcome:oe}=_e;if(oe===ke.CONFIRM_REQUIRED&&_e.pendingAction)return i(`/escalations/detail/${_e.pendingAction.escalationId}`,{state:{[bN]:_e.pendingAction}}),!0;const Be=oe===ke.EXECUTED&&!!H.current;if(mN.includes(oe)||Fb(_e)||Be)return ce.current!==dd&&i(dd),!0;if(oe===ke.EXECUTED&&_e.escalation){const Mt=[mc.SHOW_DETAIL,mc.CLAIM_SHOW_DETAIL,mc.CLAIM,mc.ESCALATE];return _e.verb&&Mt.includes(_e.verb)?(i(`/escalations/detail/${_e.escalation.id}`),!0):!1}if(oe===ke.MATCHED_LIST&&_e.listQuery){const{targetFacet:Mt,target:tt,targetMatch:ye,roles:qe}=_e.listQuery;return i(ye==="member"?yN(Mt,tt,(qe==null?void 0:qe[0])??null):qv({[Mt]:tt},(qe==null?void 0:qe[0])??null)),!0}return oe===ke.CHOICES&&_e.choices?(i(dd,{state:{[xN]:_e}}),!0):oe===ke.NO_MATCH_FALLBACK&&((zt=_e.fallback)!=null&&zt.route)?(i(_e.fallback.route),!0):!1},[i]),Q=E.useRef(null);Q.current=(c==null?void 0:c.actingToken)??null;const W=E.useRef(null),he=E.useRef([]),Ee=E.useCallback(_e=>(he.current=[_e,...he.current],()=>{he.current=he.current.filter(oe=>oe!==_e)}),[]),Ae=E.useRef(null);Ae.current=b;const H=E.useRef(void 0),J=E.useRef(null);J.current=v;const ce=E.useRef(o.pathname);ce.current=o.pathname,E.useEffect(()=>{if(!b)return;const _e=Date.parse(b.expiresAt)-Date.now();if(_e<=0){x(null);return}const oe=setTimeout(()=>x(null),_e);return()=>clearTimeout(oe)},[b]);const pe=E.useCallback(async(_e,oe,Be,zt=!1)=>{ne(!0);const Mt=Date.now();try{H.current=hN(Ae.current);const tt=await uN(_e,{actingToken:Be??void 0,previousActingToken:W.current??void 0,subject:H.current,stationRole:C.current??void 0});if(Be&&g(Be,tt),x(qe=>Hb(qe,tt)),tt.outcome===ke.IDENTITY_PRIMED){W.current=d(tt);const qe=dN(J.current);if(_(null),qe&&tt.actingToken)return m({code:_e,source:oe,at:Mt,response:tt,error:null,navigated:!1}),pe(qe.code,oe,tt.actingToken)}else Fb(tt)?_({code:_e,at:Mt}):_(null);tt.outcome===ke.NOT_PRIMED&&Be&&p();const ye=zt||D(tt);return m({code:_e,source:oe,at:Mt,response:tt,error:null,navigated:ye}),tt}catch(tt){return m({code:_e,source:oe,at:Mt,response:null,error:tt.message,navigated:!1}),null}finally{ne(!1)}},[D,d,p,g]),ge=E.useCallback(async(_e,oe=ra.MANUAL)=>{for(const Be of he.current)if(Be(_e))return;await pe(_e,oe,Q.current)},[pe]),Ce=E.useCallback(async _e=>{const oe=await pe(_e,ra.FOLLOW,Q.current,!0);return(oe==null?void 0:oe.outcome)===ke.HELD},[pe]),Ne=E.useCallback(()=>x(null),[]),Me=E.useCallback(_e=>{x(oe=>Hb(oe,_e))},[]),Xe=E.useCallback(()=>_(null),[]),pt=E.useRef(ge);pt.current=ge,lN({active:!!e&&s,wedgeConfig:te,tailShapes:B,diagnosticsOn:F,onScan:_e=>void pt.current(_e,ra.KEYBOARD_WEDGE),onDiag:_e=>ae(oe=>[...oe.slice(-29),_e])});const Ot=E.useCallback(_e=>{M(Qk(_e))},[]),mt=E.useMemo(()=>({submitCode:ge,pushCodeInterceptor:Ee,lastResult:u,subject:b,dropSubject:Ne,adoptResponse:Me,followCode:Ce,pendingScan:v,dropPendingScan:Xe,busy:q,wedgeConfig:te,updateWedgeConfig:Ot,diagnostics:z,diagnosticsOn:F,setDiagnosticsOn:U}),[ge,Ee,u,b,Ne,Me,Ce,v,Xe,q,te,Ot,z,F]);return h.jsx(Gm.Provider,{value:mt,children:n})}var pc={},fo={},yc={},Gb;function Nn(){if(Gb)return yc;Gb=1,Object.defineProperty(yc,"__esModule",{value:!0});function n(s,i){if(!(s instanceof i))throw new TypeError("Cannot call a class as a function")}var e=function s(i,o){n(this,s),this.data=i,this.text=o.text||i,this.options=o};return yc.default=e,yc}var Vb;function _N(){if(Vb)return fo;Vb=1,Object.defineProperty(fo,"__esModule",{value:!0}),fo.CODE39=void 0;var n=(function(){function S(C,B){for(var q=0;q<B.length;q++){var ne=B[q];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(C,ne.key,ne)}}return function(C,B,q){return B&&S(C.prototype,B),q&&S(C,q),C}})(),e=Nn(),s=i(e);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 p=(function(S){d(C,S);function C(B,q){return o(this,C),B=B.toUpperCase(),q.mod43&&(B+=x(_(B))),c(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,B,q))}return n(C,[{key:"encode",value:function(){for(var q=m("*"),ne=0;ne<this.data.length;ne++)q+=m(this.data[ne])+"0";return q+=m("*"),{data:q,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","-","."," ","$","/","+","%","*"],u=[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 u[S].toString(2)}function x(S){return g[S]}function v(S){return g.indexOf(S)}function _(S){for(var C=0,B=0;B<S.length;B++)C+=v(S[B]);return C=C%43,C}return fo.CODE39=p,fo}var Qn={},gc={},bc={},vt={},Yb;function Po(){if(Yb)return vt;Yb=1,Object.defineProperty(vt,"__esModule",{value:!0});var n;function e(g,u,m){return u in g?Object.defineProperty(g,u,{value:m,enumerable:!0,configurable:!0,writable:!0}):g[u]=m,g}var s=vt.SET_A=0,i=vt.SET_B=1,o=vt.SET_C=2;vt.SHIFT=98;var c=vt.START_A=103,d=vt.START_B=104,p=vt.START_C=105;return vt.MODULO=103,vt.STOP=106,vt.FNC1=207,vt.SET_BY_CODE=(n={},e(n,c,s),e(n,d,i),e(n,p,o),n),vt.SWAP={101:s,100:i,99:o},vt.A_START_CHAR="Ð",vt.B_START_CHAR="Ñ",vt.C_START_CHAR="Ò",vt.A_CHARS="[\0-_È-Ï]",vt.B_CHARS="[ -È-Ï]",vt.C_CHARS="(Ï*[0-9]{2}Ï*)",vt.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],vt}var Kb;function Lu(){if(Kb)return bc;Kb=1,Object.defineProperty(bc,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=Nn(),s=o(e),i=Po();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);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 B=i.SWAP[C];B!==void 0?S=m.next(x,v+1,B):((_===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 q=m.getBar(C),ne=C*v;return{result:q+S.result,checksum:ne+S.checksum}}}]),m})(s.default);return bc.default=g,bc}var xc={},Jb;function wN(){if(Jb)return xc;Jb=1,Object.defineProperty(xc,"__esModule",{value:!0});var n=Po(),e=function(p){return p.match(new RegExp("^"+n.A_CHARS+"*"))[0].length},s=function(p){return p.match(new RegExp("^"+n.B_CHARS+"*"))[0].length},i=function(p){return p.match(new RegExp("^"+n.C_CHARS+"*"))[0]};function o(d,p){var g=p?n.A_CHARS:n.B_CHARS,u=d.match(new RegExp("^("+g+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(u)return u[1]+"Ì"+c(d.substring(u[1].length));var m=d.match(new RegExp("^"+g+"+"))[0];return m.length===d.length?d:m+String.fromCharCode(p?205:206)+o(d.substring(m.length),!p)}function c(d){var p=i(d),g=p.length;if(g===d.length)return d;d=d.substring(g);var u=e(d)>=s(d);return p+String.fromCharCode(u?206:205)+o(d,u)}return xc.default=function(d){var p=void 0,g=i(d).length;if(g>=2)p=n.C_START_CHAR+c(d);else{var u=e(d)>s(d);p=(u?n.A_START_CHAR:n.B_START_CHAR)+o(d,u)}return p.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(m,b){return"Ë"+b})},xc}var Qb;function SN(){if(Qb)return gc;Qb=1,Object.defineProperty(gc,"__esModule",{value:!0});var n=Lu(),e=o(n),s=wN(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);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})(e.default);return gc.default=g,gc}var vc={},Xb;function EN(){if(Xb)return vc;Xb=1,Object.defineProperty(vc,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=Lu(),s=o(e),i=Po();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);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 vc.default=g,vc}var _c={},Wb;function ON(){if(Wb)return _c;Wb=1,Object.defineProperty(_c,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=Lu(),s=o(e),i=Po();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);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 _c.default=g,_c}var wc={},Zb;function AN(){if(Zb)return wc;Zb=1,Object.defineProperty(wc,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=Lu(),s=o(e),i=Po();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);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 wc.default=g,wc}var e1;function jN(){if(e1)return Qn;e1=1,Object.defineProperty(Qn,"__esModule",{value:!0}),Qn.CODE128C=Qn.CODE128B=Qn.CODE128A=Qn.CODE128=void 0;var n=SN(),e=g(n),s=EN(),i=g(s),o=ON(),c=g(o),d=AN(),p=g(d);function g(u){return u&&u.__esModule?u:{default:u}}return Qn.CODE128=e.default,Qn.CODE128A=i.default,Qn.CODE128B=c.default,Qn.CODE128C=p.default,Qn}var Jt={},Sc={},Rr={},t1;function Bo(){return t1||(t1=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.SIDE_BIN="101",Rr.MIDDLE_BIN="01010",Rr.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"]},Rr.EAN2_STRUCTURE=["LL","LG","GL","GG"],Rr.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],Rr.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),Rr}var Ec={},Oc={},n1;function Uo(){if(n1)return Oc;n1=1,Object.defineProperty(Oc,"__esModule",{value:!0});var n=Bo(),e=function(i,o,c){var d=i.split("").map(function(g,u){return n.BINARIES[o[u]]}).map(function(g,u){return g?g[i[u]]:""});if(c){var p=i.length-1;d=d.map(function(g,u){return u<p?g+c:g})}return d.join("")};return Oc.default=e,Oc}var r1;function Pv(){if(r1)return Ec;r1=1,Object.defineProperty(Ec,"__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}})(),e=Bo(),s=Uo(),i=d(s),o=Nn(),c=d(o);function d(b){return b&&b.__esModule?b:{default:b}}function p(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 u(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){u(x,b);function x(v,_){p(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:e.SIDE_BIN,options:S},{data:this.leftEncode(),text:this.leftText(),options:_},{data:e.MIDDLE_BIN,options:S},{data:this.rightEncode(),text:this.rightText(),options:_},{data:e.SIDE_BIN,options:S}]}},{key:"encodeFlat",value:function(){var _=[e.SIDE_BIN,this.leftEncode(),e.MIDDLE_BIN,this.rightEncode(),e.SIDE_BIN];return{data:_.join(""),text:this.text}}}]),x})(c.default);return Ec.default=m,Ec}var s1;function kN(){if(s1)return Sc;s1=1,Object.defineProperty(Sc,"__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}})(),e=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 B=S.get;return B===void 0?void 0:B.call(_)}},s=Bo(),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 p(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 u=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+=u(v));var S=p(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]===u(this.data)}},{key:"leftText",value:function(){return e(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 e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftEncode",this).call(this,_,S)}},{key:"rightText",value:function(){return e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var _=this.data.substr(7,6);return e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightEncode",this).call(this,_,"RRRRRR")}},{key:"encodeGuarded",value:function(){var _=e(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 Sc.default=m,Sc}var Ac={},i1;function NN(){if(i1)return Ac;i1=1,Object.defineProperty(Ac,"__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}})(),e=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 p(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},u=(function(m){p(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 e(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 e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,v,"LLLL")}},{key:"rightText",value:function(){return e(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 e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,v,"RRRR")}}]),b})(i.default);return Ac.default=u,Ac}var jc={},a1;function TN(){if(a1)return jc;a1=1,Object.defineProperty(jc,"__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}})(),e=Bo(),s=Uo(),i=d(s),o=Nn(),c=d(o);function d(x){return x&&x.__esModule?x:{default:x}}function p(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 u(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,B){return B%2?S+C*9:S+C*3},0);return _%10},b=(function(x){u(v,x);function v(_,S){return p(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=e.EAN5_STRUCTURE[m(this.data)];return{data:"1011"+(0,i.default)(this.data,S,"01"),text:this.text}}}]),v})(c.default);return jc.default=b,jc}var kc={},o1;function CN(){if(o1)return kc;o1=1,Object.defineProperty(kc,"__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}})(),e=Bo(),s=Uo(),i=d(s),o=Nn(),c=d(o);function d(b){return b&&b.__esModule?b:{default:b}}function p(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 u(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){u(x,b);function x(v,_){return p(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 _=e.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,i.default)(this.data,_,"01"),text:this.text}}}]),x})(c.default);return kc.default=m,kc}var ho={},l1;function Bv(){if(l1)return ho;l1=1,Object.defineProperty(ho,"__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}})();ho.checksum=m;var e=Uo(),s=c(e),i=Nn(),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 p(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 u=(function(b){g(x,b);function x(v,_){d(this,x),v.search(/^[0-9]{11}$/)!==-1&&(v+=m(v));var S=p(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 ho.default=u,ho}var Nc={},c1;function MN(){if(c1)return Nc;c1=1,Object.defineProperty(Nc,"__esModule",{value:!0});var n=(function(){function _(S,C){for(var B=0;B<C.length;B++){var q=C[B];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(S,q.key,q)}}return function(S,C,B){return C&&_(S.prototype,C),B&&_(S,B),S}})(),e=Uo(),s=d(e),i=Nn(),o=d(i),c=Bv();function d(_){return _&&_.__esModule?_:{default:_}}function p(_,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 u(_,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(_){u(S,_);function S(C,B){p(this,S);var q=g(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,C,B));if(q.isValid=!1,C.search(/^[0-9]{6}$/)!==-1)q.middleDigits=C,q.upcA=v(C,"0"),q.text=B.text||""+q.upcA[0]+C+q.upcA[q.upcA.length-1],q.isValid=!0;else if(C.search(/^[01][0-9]{7}$/)!==-1)if(q.middleDigits=C.substring(1,C.length-1),q.upcA=v(q.middleDigits,C[0]),q.upcA[q.upcA.length-1]===C[C.length-1])q.isValid=!0;else return g(q);else return g(q);return q.displayValue=B.displayValue,B.fontSize>B.width*10?q.fontSize=B.width*10:q.fontSize=B.fontSize,q.guardHeight=B.height+q.fontSize/2+B.textMargin,q}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 B="";return B+="101",B+=this.encodeMiddleDigits(),B+="010101",{data:B,text:this.text}}},{key:"guardedEncoding",value:function(){var B=[];return this.displayValue&&B.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),B.push({data:"101",options:{height:this.guardHeight}}),B.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),B.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&B.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),B}},{key:"encodeMiddleDigits",value:function(){var B=this.upcA[0],q=this.upcA[this.upcA.length-1],ne=b[parseInt(q)][parseInt(B)];return(0,s.default)(this.middleDigits,ne)}}]),S})(o.default);function v(_,S){for(var C=parseInt(_[_.length-1]),B=m[C],q="",ne=0,te=0;te<B.length;te++){var M=B[te];M==="X"?q+=_[ne++]:q+=M}return q=""+S+q,""+q+(0,c.checksum)(q)}return Nc.default=x,Nc}var u1;function RN(){if(u1)return Jt;u1=1,Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.UPCE=Jt.UPC=Jt.EAN2=Jt.EAN5=Jt.EAN8=Jt.EAN13=void 0;var n=kN(),e=x(n),s=NN(),i=x(s),o=TN(),c=x(o),d=CN(),p=x(d),g=Bv(),u=x(g),m=MN(),b=x(m);function x(v){return v&&v.__esModule?v:{default:v}}return Jt.EAN13=e.default,Jt.EAN8=i.default,Jt.EAN5=c.default,Jt.EAN2=p.default,Jt.UPC=u.default,Jt.UPCE=b.default,Jt}var Ws={},Tc={},Vi={},f1;function DN(){return f1||(f1=1,Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.START_BIN="1010",Vi.END_BIN="11101",Vi.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Vi}var h1;function Uv(){if(h1)return Tc;h1=1,Object.defineProperty(Tc,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=DN(),s=Nn(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);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:e.START_BIN+v+e.END_BIN,text:this.text}}},{key:"encodePair",value:function(x){var v=e.BINARIES[x[1]];return e.BINARIES[x[0]].split("").map(function(_,S){return(_==="1"?"111":"1")+(v[S]==="1"?"000":"0")}).join("")}}]),m})(i.default);return Tc.default=g,Tc}var Cc={},d1;function LN(){if(d1)return Cc;d1=1,Object.defineProperty(Cc,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=Uv(),s=i(e);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function c(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function d(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var p=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(u){d(m,u);function m(b,x){return o(this,m),b.search(/^[0-9]{13}$/)!==-1&&(b+=p(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]===p(this.data)}}]),m})(s.default);return Cc.default=g,Cc}var m1;function qN(){if(m1)return Ws;m1=1,Object.defineProperty(Ws,"__esModule",{value:!0}),Ws.ITF14=Ws.ITF=void 0;var n=Uv(),e=o(n),s=LN(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Ws.ITF=e.default,Ws.ITF14=i.default,Ws}var vn={},Mc={},p1;function zo(){if(p1)return Mc;p1=1,Object.defineProperty(Mc,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=Nn(),s=i(e);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function c(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function d(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var p=(function(u){d(m,u);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(u,m){for(var b=0;b<m;b++)u="0"+u;return u}return Mc.default=p,Mc}var Rc={},mo={},y1;function qu(){if(y1)return mo;y1=1,Object.defineProperty(mo,"__esModule",{value:!0}),mo.mod10=n,mo.mod11=e;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 e(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 mo}var g1;function PN(){if(g1)return Rc;g1=1,Object.defineProperty(Rc,"__esModule",{value:!0});var n=zo(),e=i(n),s=qu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m+(0,s.mod10)(m),b))}return u})(e.default);return Rc.default=p,Rc}var Dc={},b1;function BN(){if(b1)return Dc;b1=1,Object.defineProperty(Dc,"__esModule",{value:!0});var n=zo(),e=i(n),s=qu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m+(0,s.mod11)(m),b))}return u})(e.default);return Dc.default=p,Dc}var Lc={},x1;function UN(){if(x1)return Lc;x1=1,Object.defineProperty(Lc,"__esModule",{value:!0});var n=zo(),e=i(n),s=qu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),m+=(0,s.mod10)(m),m+=(0,s.mod10)(m),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return u})(e.default);return Lc.default=p,Lc}var qc={},v1;function zN(){if(v1)return qc;v1=1,Object.defineProperty(qc,"__esModule",{value:!0});var n=zo(),e=i(n),s=qu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),m+=(0,s.mod11)(m),m+=(0,s.mod10)(m),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return u})(e.default);return qc.default=p,qc}var _1;function $N(){if(_1)return vn;_1=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.MSI1110=vn.MSI1010=vn.MSI11=vn.MSI10=vn.MSI=void 0;var n=zo(),e=m(n),s=PN(),i=m(s),o=BN(),c=m(o),d=UN(),p=m(d),g=zN(),u=m(g);function m(b){return b&&b.__esModule?b:{default:b}}return vn.MSI=e.default,vn.MSI10=i.default,vn.MSI11=c.default,vn.MSI1010=p.default,vn.MSI1110=u.default,vn}var po={},w1;function IN(){if(w1)return po;w1=1,Object.defineProperty(po,"__esModule",{value:!0}),po.pharmacode=void 0;var n=(function(){function g(u,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(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),e=Nn(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){o(this,u);var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b));return x.number=parseInt(m,10),x}return n(u,[{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}}]),u})(s.default);return po.pharmacode=p,po}var yo={},S1;function HN(){if(S1)return yo;S1=1,Object.defineProperty(yo,"__esModule",{value:!0}),yo.codabar=void 0;var n=(function(){function g(u,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(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),e=Nn(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){o(this,u),m.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(m="A"+m+"A");var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m.toUpperCase(),b));return x.text=x.options.text||x.text.replace(/[A-D]/g,""),x}return n(u,[{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"}}}]),u})(s.default);return yo.codabar=p,yo}var Zs={},Pc={},Yi={},E1;function FN(){return E1||(E1=1,Object.defineProperty(Yi,"__esModule",{value:!0}),Yi.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","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],Yi.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"],Yi.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"]}),Yi}var O1;function zv(){if(O1)return Pc;O1=1,Object.defineProperty(Pc,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=FN(),s=Nn(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);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 e.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 e.BINARIES[m.symbolValue(x)]}},{key:"getSymbol",value:function(x){return e.SYMBOLS[x]}},{key:"symbolValue",value:function(x){return e.SYMBOLS.indexOf(x)}},{key:"checksum",value:function(x,v){var _=x.slice().reverse().reduce(function(S,C,B){var q=B%v+1;return S+m.symbolValue(C)*q},0);return m.getSymbol(_%47)}}]),m})(i.default);return Pc.default=g,Pc}var Bc={},A1;function GN(){if(A1)return Bc;A1=1,Object.defineProperty(Bc,"__esModule",{value:!0});var n=(function(){function g(u,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(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),e=zv(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return n(u,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),u})(s.default);return Bc.default=p,Bc}var j1;function VN(){if(j1)return Zs;j1=1,Object.defineProperty(Zs,"__esModule",{value:!0}),Zs.CODE93FullASCII=Zs.CODE93=void 0;var n=zv(),e=o(n),s=GN(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Zs.CODE93=e.default,Zs.CODE93FullASCII=i.default,Zs}var go={},k1;function YN(){if(k1)return go;k1=1,Object.defineProperty(go,"__esModule",{value:!0}),go.GenericBarcode=void 0;var n=(function(){function g(u,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(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),e=Nn(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return n(u,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),u})(s.default);return go.GenericBarcode=p,go}var N1;function KN(){if(N1)return pc;N1=1,Object.defineProperty(pc,"__esModule",{value:!0});var n=_N(),e=jN(),s=RN(),i=qN(),o=$N(),c=IN(),d=HN(),p=VN(),g=YN();return pc.default={CODE39:n.CODE39,CODE128:e.CODE128,CODE128A:e.CODE128A,CODE128B:e.CODE128B,CODE128C:e.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:p.CODE93,CODE93FullASCII:p.CODE93FullASCII,GenericBarcode:g.GenericBarcode},pc}var Uc={},T1;function Pu(){if(T1)return Uc;T1=1,Object.defineProperty(Uc,"__esModule",{value:!0});var n=Object.assign||function(e){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e};return Uc.default=function(e,s){return n({},e,s)},Uc}var zc={},C1;function JN(){if(C1)return zc;C1=1,Object.defineProperty(zc,"__esModule",{value:!0}),zc.default=n;function n(e){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(e),s}return zc}var $c={},M1;function QN(){if(M1)return $c;M1=1,Object.defineProperty($c,"__esModule",{value:!0}),$c.default=n;function n(e){return e.marginTop=e.marginTop||e.margin,e.marginBottom=e.marginBottom||e.margin,e.marginRight=e.marginRight||e.margin,e.marginLeft=e.marginLeft||e.margin,e}return $c}var Ic={},Hc={},Fc={},R1;function $v(){if(R1)return Fc;R1=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.default=n;function n(e){var s=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var i in s)s.hasOwnProperty(i)&&(i=s[i],typeof e[i]=="string"&&(e[i]=parseInt(e[i],10)));return typeof e.displayValue=="string"&&(e.displayValue=e.displayValue!="false"),e}return Fc}var Gc={},D1;function Iv(){if(D1)return Gc;D1=1,Object.defineProperty(Gc,"__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 Gc.default=n,Gc}var L1;function XN(){if(L1)return Hc;L1=1,Object.defineProperty(Hc,"__esModule",{value:!0});var n=$v(),e=o(n),s=Iv(),i=o(s);function o(d){return d&&d.__esModule?d:{default:d}}function c(d){var p={};for(var g in i.default)i.default.hasOwnProperty(g)&&(d.hasAttribute("jsbarcode-"+g.toLowerCase())&&(p[g]=d.getAttribute("jsbarcode-"+g.toLowerCase())),d.hasAttribute("data-"+g.toLowerCase())&&(p[g]=d.getAttribute("data-"+g.toLowerCase())));return p.value=d.getAttribute("jsbarcode-value")||d.getAttribute("data-value"),p=(0,e.default)(p),p}return Hc.default=c,Hc}var Vc={},Yc={},_n={},q1;function Hv(){if(q1)return _n;q1=1,Object.defineProperty(_n,"__esModule",{value:!0}),_n.getTotalWidthOfEncodings=_n.calculateEncodingAttributes=_n.getBarcodePadding=_n.getEncodingHeight=_n.getMaximumHeightOfEncodings=void 0;var n=Pu(),e=s(n);function s(u){return u&&u.__esModule?u:{default:u}}function i(u,m){return m.height+(m.displayValue&&u.text.length>0?m.fontSize+m.textMargin:0)+m.marginTop+m.marginBottom}function o(u,m,b){if(b.displayValue&&m<u){if(b.textAlign=="center")return Math.floor((u-m)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(u-m)}return 0}function c(u,m,b){for(var x=0;x<u.length;x++){var v=u[x],_=(0,e.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(u){for(var m=0,b=0;b<u.length;b++)m+=u[b].width;return m}function p(u){for(var m=0,b=0;b<u.length;b++)u[b].height>m&&(m=u[b].height);return m}function g(u,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(u);if(!v)return 0;var _=v.width;return _}return _n.getMaximumHeightOfEncodings=p,_n.getEncodingHeight=i,_n.getBarcodePadding=o,_n.calculateEncodingAttributes=c,_n.getTotalWidthOfEncodings=d,_n}var P1;function WN(){if(P1)return Yc;P1=1,Object.defineProperty(Yc,"__esModule",{value:!0});var n=(function(){function p(g,u){for(var m=0;m<u.length;m++){var b=u[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}return function(g,u,m){return u&&p(g.prototype,u),m&&p(g,m),g}})(),e=Pu(),s=o(e),i=Hv();function o(p){return p&&p.__esModule?p:{default:p}}function c(p,g){if(!(p instanceof g))throw new TypeError("Cannot call a class as a function")}var d=(function(){function p(g,u,m){c(this,p),this.canvas=g,this.encodings=u,this.options=m}return n(p,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var u=0;u<this.encodings.length;u++){var m=(0,s.default)(this.options,this.encodings[u].options);this.drawCanvasBarcode(m,this.encodings[u]),this.drawCanvasText(m,this.encodings[u]),this.moveCanvasDrawing(this.encodings[u])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var u=this.canvas.getContext("2d");u.save(),(0,i.calculateEncodingAttributes)(this.encodings,this.options,u);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,u.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(u.fillStyle=this.options.background,u.fillRect(0,0,this.canvas.width,this.canvas.height)),u.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(u,m){var b=this.canvas.getContext("2d"),x=m.data,v;u.textPosition=="top"?v=u.marginTop+u.fontSize+u.textMargin:v=u.marginTop,b.fillStyle=u.lineColor;for(var _=0;_<x.length;_++){var S=_*u.width+m.barcodePadding;x[_]==="1"?b.fillRect(S,v,u.width,u.height):x[_]&&b.fillRect(S,v,u.width,u.height*x[_])}}},{key:"drawCanvasText",value:function(u,m){var b=this.canvas.getContext("2d"),x=u.fontOptions+" "+u.fontSize+"px "+u.font;if(u.displayValue){var v,_;u.textPosition=="top"?_=u.marginTop+u.fontSize-u.textMargin:_=u.height+u.textMargin+u.marginTop+u.fontSize,b.font=x,u.textAlign=="left"||m.barcodePadding>0?(v=0,b.textAlign="left"):u.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(u){var m=this.canvas.getContext("2d");m.translate(u.width,0)}},{key:"restoreCanvas",value:function(){var u=this.canvas.getContext("2d");u.restore()}}]),p})();return Yc.default=d,Yc}var Kc={},B1;function ZN(){if(B1)return Kc;B1=1,Object.defineProperty(Kc,"__esModule",{value:!0});var n=(function(){function g(u,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(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),e=Pu(),s=o(e),i=Hv();function o(g){return g&&g.__esModule?g:{default:g}}function c(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}var d="http://www.w3.org/2000/svg",p=(function(){function g(u,m,b){c(this,g),this.svg=u,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,B=0;B<v.length;B++)C=B*b.width+x.barcodePadding,v[B]==="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 Kc.default=p,Kc}var Jc={},U1;function eT(){if(U1)return Jc;U1=1,Object.defineProperty(Jc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var d=0;d<c.length;d++){var p=c[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(o,p.key,p)}}return function(o,c,d){return c&&i(o.prototype,c),d&&i(o,d),o}})();function e(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o,c,d){e(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 Jc.default=s,Jc}var z1;function tT(){if(z1)return Vc;z1=1,Object.defineProperty(Vc,"__esModule",{value:!0});var n=WN(),e=d(n),s=ZN(),i=d(s),o=eT(),c=d(o);function d(p){return p&&p.__esModule?p:{default:p}}return Vc.default={CanvasRenderer:e.default,SVGRenderer:i.default,ObjectRenderer:c.default},Vc}var Ki={},$1;function Fv(){if($1)return Ki;$1=1,Object.defineProperty(Ki,"__esModule",{value:!0});function n(d,p){if(!(d instanceof p))throw new TypeError("Cannot call a class as a function")}function e(d,p){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:d}function s(d,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);d.prototype=Object.create(p&&p.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(d,p):d.__proto__=p)}var i=(function(d){s(p,d);function p(g,u){n(this,p);var m=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return m.name="InvalidInputException",m.symbology=g,m.input=u,m.message='"'+m.input+'" is not a valid input for '+m.symbology,m}return p})(Error),o=(function(d){s(p,d);function p(){n(this,p);var g=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="InvalidElementException",g.message="Not supported type to render on",g}return p})(Error),c=(function(d){s(p,d);function p(){n(this,p);var g=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="NoElementException",g.message="No element to render on.",g}return p})(Error);return Ki.InvalidInputException=i,Ki.InvalidElementException=o,Ki.NoElementException=c,Ki}var I1;function nT(){if(I1)return Ic;I1=1,Object.defineProperty(Ic,"__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},e=XN(),s=d(e),i=tT(),o=d(i),c=Fv();function d(m){return m&&m.__esModule?m:{default:m}}function p(m){if(typeof m=="string")return g(m);if(Array.isArray(m)){for(var b=[],x=0;x<m.length;x++)b.push(p(m[x]));return b}else{if(typeof HTMLCanvasElement<"u"&&m instanceof HTMLImageElement)return u(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(p(b[v]));return x}}function u(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 Ic.default=p,Ic}var Qc={},H1;function rT(){if(H1)return Qc;H1=1,Object.defineProperty(Qc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var d=0;d<c.length;d++){var p=c[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(o,p.key,p)}}return function(o,c,d){return c&&i(o.prototype,c),d&&i(o,d),o}})();function e(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o){e(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(p){return this.handleCatch(p),this.api}}}]),i})();return Qc.default=s,Qc}var md,F1;function sT(){if(F1)return md;F1=1;var n=KN(),e=B(n),s=Pu(),i=B(s),o=JN(),c=B(o),d=QN(),p=B(d),g=nT(),u=B(g),m=$v(),b=B(m),x=rT(),v=B(x),_=Fv(),S=Iv(),C=B(S);function B(U){return U&&U.__esModule?U:{default:U}}var q=function(){},ne=function(D,Q,W){var he=new q;if(typeof D>"u")throw Error("No element to render on was provided.");return he._renderProperties=(0,u.default)(D),he._encodings=[],he._options=C.default,he._errorHandler=new v.default(he),typeof Q<"u"&&(W=W||{},W.format||(W.format=ae()),he.options(W)[W.format](Q,W).render()),he};ne.getModule=function(U){return e.default[U]};for(var te in e.default)e.default.hasOwnProperty(te)&&M(e.default,te);function M(U,D){q.prototype[D]=q.prototype[D.toUpperCase()]=q.prototype[D.toLowerCase()]=function(Q,W){var he=this;return he._errorHandler.wrapBarcodeCall(function(){W.text=typeof W.text>"u"?void 0:""+W.text;var Ee=(0,i.default)(he._options,W);Ee=(0,b.default)(Ee);var Ae=U[D],H=z(Q,Ae,Ee);return he._encodings.push(H),he})}}function z(U,D,Q){U=""+U;var W=new D(U,Q);if(!W.valid())throw new _.InvalidInputException(W.constructor.name,U);var he=W.encode();he=(0,c.default)(he);for(var Ee=0;Ee<he.length;Ee++)he[Ee].options=(0,i.default)(Q,he[Ee].options);return he}function ae(){return e.default.CODE128?"CODE128":Object.keys(e.default)[0]}q.prototype.options=function(U){return this._options=(0,i.default)(this._options,U),this},q.prototype.blank=function(U){var D=new Array(U+1).join("0");return this._encodings.push({data:D}),this},q.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 Q=(0,i.default)(this._options,U.options);Q.format=="auto"&&(Q.format=ae()),this._errorHandler.wrapBarcodeCall(function(){var W=Q.value,he=e.default[Q.format.toUpperCase()],Ee=z(W,he,Q);F(U,Ee,Q)})}}},q.prototype.render=function(){if(!this._renderProperties)throw new _.NoElementException;if(Array.isArray(this._renderProperties))for(var U=0;U<this._renderProperties.length;U++)F(this._renderProperties[U],this._encodings,this._options);else F(this._renderProperties,this._encodings,this._options);return this},q.prototype._defaults=C.default;function F(U,D,Q){D=(0,c.default)(D);for(var W=0;W<D.length;W++)D[W].options=(0,i.default)(Q,D[W].options),(0,p.default)(D[W].options);(0,p.default)(Q);var he=U.renderer,Ee=new he(U.element,D,Q);Ee.render(),U.afterRender&&U.afterRender()}return typeof window<"u"&&(window.JsBarcode=ne),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(U,D){var Q=[];return jQuery(this).each(function(){Q.push(this)}),ne(Q,U,D)}),md=ne,md}var iT=sT();const aT=bS(iT),oT={[ke.EXECUTED]:"Executed",[ke.MATCHED_LIST]:"Matched list",[ke.CONFIRM_REQUIRED]:"Awaiting confirmation",[ke.NO_MATCH_FALLBACK]:"No match",[ke.UNCONFIGURED]:"Not configured",[ke.INVALID_CODE]:"Invalid code",[ke.FORBIDDEN]:"Not permitted",[ke.CONFLICT]:"Conflict",[ke.IDENTITY_PRIMED]:"Identity primed",[ke.IDENTITY_UNKNOWN]:"Badge not recognized",[ke.NOT_PRIMED]:"Badge required",[ke.CHOICES]:"Choices presented",[ke.NO_OPEN_CONTAINER]:"Container closing, scan again",[ke.HELD]:"Holding",[ke.REFUSED]:"Not placed",[ke.SUBJECT_STALE]:"Scan it again"},lT={[ke.EXECUTED]:"text-status-success",[ke.MATCHED_LIST]:"text-status-success",[ke.CONFIRM_REQUIRED]:"text-status-warning",[ke.NO_MATCH_FALLBACK]:"text-text-secondary",[ke.UNCONFIGURED]:"text-status-warning",[ke.INVALID_CODE]:"text-status-error",[ke.FORBIDDEN]:"text-status-error",[ke.CONFLICT]:"text-status-warning",[ke.IDENTITY_PRIMED]:"text-status-success",[ke.IDENTITY_UNKNOWN]:"text-status-warning",[ke.NOT_PRIMED]:"text-status-warning",[ke.CHOICES]:"text-status-success",[ke.NO_OPEN_CONTAINER]:"text-status-warning",[ke.HELD]:"text-status-success",[ke.REFUSED]:"text-status-error",[ke.SUBJECT_STALE]:"text-status-warning"};function cT(n){return n.outcome===ke.IDENTITY_PRIMED&&n.actor?`Hi ${n.actor.displayName}`:`${oT[n.outcome]}${n.rule?` — ${n.rule.name}`:""}`}function uT(n){var e,s,i,o,c,d,p;return n.outcome===ke.NO_MATCH_FALLBACK?((e=n.fallback)==null?void 0:e.markdown)??null:n.outcome===ke.IDENTITY_UNKNOWN?((s=n.fallback)==null?void 0:s.markdown)??null:n.outcome===ke.NOT_PRIMED?((i=n.notPrimed)==null?void 0:i.markdown)??null:n.outcome===ke.NO_OPEN_CONTAINER?((o=n.fallback)==null?void 0:o.markdown)??null:n.outcome===ke.REFUSED?((c=n.refusal)==null?void 0:c.markdown)??n.error??null:n.outcome===ke.HELD?((p=(d=n.subject)==null?void 0:d.expect)==null?void 0:p.prompt)??null:n.outcome===ke.SUBJECT_STALE?n.error??null:null}function gs(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 fT({content:n,compact:e,inherit:s}){const i=[],o=/^```(\w*)\n([\s\S]*?)^```$/gm;let c=0,d;for(;(d=o.exec(n))!==null;)d.index>c&&i.push({type:"text",text:n.slice(c,d.index)}),i.push({type:"code",lang:d[1],code:d[2].replace(/\n$/,"")}),c=d.index+d[0].length;c<n.length&&i.push({type:"text",text:n.slice(c)});const p=s?{text:"",heading:"",list:"",code:"text-[0.85em]",tone:""}:e?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs",tone:"text-text-secondary"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs",tone:"text-text-secondary"},g=[];for(const u of i){if(u.type==="code"){const m=u.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");g.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${p.code} font-mono text-text-secondary leading-relaxed">${m}</code></pre>`);continue}g.push(...hT(u.text,p))}return h.jsx("div",{className:s?void 0:"prose-sm",dangerouslySetInnerHTML:{__html:g.join(`
|
|
55
|
-
`)}})}function
|
|
56
|
-
`),i=[];let o=!1,c=!1,d=[];for(const p of s){const g=p.trim();if(g.startsWith("|")&&g.endsWith("|")){const u=g.slice(1,-1).split("|").map(m=>m.trim());if(u.every(m=>/^[-:]+$/.test(m)))continue;c||(c=!0,d=[]),d.push(u);continue}if(c){c=!1;const[u,...m]=d;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of u)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${gs(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">${gs(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="${e.heading} font-semibold text-text-primary mt-3 mb-1">${gs(g.slice(4))}</h4>`);continue}if(g.startsWith("## ")){o&&(i.push("</ul>"),o=!1),i.push(`<h3 class="${e.heading} font-semibold text-text-primary mt-3 mb-1">${gs(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="${e.list} ${e.tone} flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${gs(g.slice(2))}</span></li>`);continue}o&&(i.push("</ul>"),o=!1),i.push(`<p class="${e.text} ${e.tone} my-1">${gs(g)}</p>`)}if(c&&d.length){const[p,...g]=d;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const u of p)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${gs(u)}</th>`);i.push("</tr></thead><tbody>");for(const u of g){i.push("<tr>");for(const m of u)i.push(`<td class="py-1 px-2 border-b border-border/50">${gs(m)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>")}return o&&i.push("</ul>"),i}function Ym({result:n,compact:e=!1}){const{response:s}=n,i=e?"text-xs":"text-sm",o=s?uT(s):null,c=s!=null&&s.error&&s.error!==o?s.error:null;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 ${lT[s.outcome]}`,children:cT(s)}),c&&h.jsx("div",{className:"text-xs text-text-tertiary mt-0.5",children:c}),o&&h.jsx("div",{className:"text-xs text-text-secondary mt-1.5",children:h.jsx(fT,{content:o,compact:!0})})]}):h.jsx("div",{className:`${i} text-status-error`,children:n.error})]})}function Gv(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 dT(n){const e=new Set;for(const s of n){const i=s.codePointAt(0);(i>127||i<32)&&e.add(`"${i<32?"\\x"+i.toString(16).padStart(2,"0"):s}" U+${i.toString(16).toUpperCase().padStart(4,"0")}`)}return[...e]}function mT({value:n}){const e=E.useRef(null),[s,i]=E.useState(!1);return E.useEffect(()=>{if(!(!e.current||!n))try{aT(e.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:dT(n).join(", ")||"unknown"})]}):h.jsx("div",{className:"bg-white rounded p-1 inline-block max-w-full overflow-hidden",children:h.jsx("svg",{ref:e,className:"max-w-full"})})]}):null}function pT({onClose:n}){const{submitCode:e,lastResult:s,busy:i,wedgeConfig:o,updateWedgeConfig:c,diagnostics:d,diagnosticsOn:p,setDiagnosticsOn:g}=Vm(),[u,m]=E.useState(""),[b,x]=E.useState(!1),v=_=>{_.preventDefault();const S=u.trim();S&&(m(""),e(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(Ro,{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(en,{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:u,onChange:_=>m(Gv(_.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||!u.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(mT,{value:u.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(Ym,{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:p,onChange:_=>g(_.target.checked)}),h.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),p&&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 Vv=/^\{lt:([A-Za-z0-9_]+)\}$/,G1="me";function cR(n){return`{lt:${n}}`}const Yv="lt:station:link-vars:";function sm(n){return`${Yv}${n}`}const im=new Set;function yT(){for(const n of im)n()}let Su,Xc={};function Kv(n){let e=null;try{e=localStorage.getItem(sm(n))}catch{e=null}if(e===Su)return Xc;Su=e;try{const s=e?JSON.parse(e):{};Xc=s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).filter(([,i])=>typeof i=="string")):{}}catch{Xc={}}return Xc}function gT(n,e,s){const i={...Kv(n)};s===null||s===""?delete i[e]:i[e]=s;try{Object.keys(i).length===0?localStorage.removeItem(sm(n)):localStorage.setItem(sm(n),JSON.stringify(i))}catch{}Su=void 0,yT()}function bT(n){im.add(n);const e=s=>{(s.key===null||s.key.startsWith(Yv))&&(Su=void 0,n())};try{window.addEventListener("storage",e)}catch{}return()=>{im.delete(n);try{window.removeEventListener("storage",e)}catch{}}}const xT={};function vT(n){return E.useSyncExternalStore(bT,()=>n?Kv(n):xT)}function _T(n,e,s,i={}){let o;try{o=new URL(n,"http://local")}catch{return n}const c=o.searchParams.get("facets");if(!c)return n;let d;try{const g=JSON.parse(c);if(!g||typeof g!="object"||Array.isArray(g))return n;d=g}catch{return n}let p=!1;for(const[g,u]of Object.entries(d)){if(typeof u!="string")continue;const m=Vv.exec(u);if(!m)continue;const b=i[m[1]]??e[m[1]]??s[m[1]];typeof b=="string"&&b!==""?d[g]=b:delete d[g],p=!0}return p?(Object.keys(d).length===0?o.searchParams.delete("facets"):o.searchParams.set("facets",JSON.stringify(d)),o.pathname+o.search):n}function uR(n){let e;try{e=new URL(n,"http://local")}catch{return[]}const s=e.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=Vv.exec(c);d&&!o.includes(d[1])&&o.push(d[1])}return o}catch{return[]}}function Km(){var v;const{user:n,isSuperAdmin:e,hasRoleType:s}=qt(),i=(n==null?void 0:n.userId)??null,o=e||s("admin"),c=E.useMemo(()=>new Set(((n==null?void 0:n.roles)??[]).map(_=>_.role)),[n]),{data:d}=Ru({enabled:o||c.size>0}),p=vT(i),g=((v=TA())==null?void 0:v.actorId)??i,u=E.useMemo(()=>{var C;const _=[],S=new Set;for(const B of(d==null?void 0:d.roles)??[]){if(!o&&!c.has(B.role))continue;const q=(C=B.properties)==null?void 0:C.link_variables;if(Array.isArray(q))for(const ne of q){const te=ne==null?void 0:ne.name;if(typeof te!="string"||te===""||te===G1||S.has(te))continue;S.add(te);const M=ne.label,z=ne.default;_.push({name:te,...typeof M=="string"&&M!==""?{label:M}:{},...typeof z=="string"&&z!==""?{default:z}:{},fromRole:B.role})}}return _},[d,c,o]),m=E.useMemo(()=>{const _={};for(const S of u)S.default!==void 0&&(_[S.name]=S.default);return _},[u]),b=E.useCallback(_=>_T(_,p,m,g?{[G1]:g}:{}),[p,m,g]),x=E.useCallback((_,S)=>{i&&gT(i,_,S)},[i]);return{declarations:u,values:p,defaults:m,resolveUrl:b,setValue:x}}function wT({open:n,onClose:e,title:s,children:i,maxWidth:o,closeOnBackdrop:c=!0}){return E.useEffect(()=>{if(!n)return;const d=p=>{p.key==="Escape"&&e()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[n,e]),n?lm.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?e: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:e,"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 ST({open:n,onClose:e}){const{declarations:s,values:i,setValue:o}=Km();return h.jsxs(wT,{open:n,onClose:e,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(ET,{declaration:c,value:i[c.name]??"",autoFocus:d===0,onChange:p=>o(c.name,p),onClear:()=>o(c.name,null),onEnter:e},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:e,className:"px-3 py-1.5 text-xs rounded bg-accent text-text-inverse hover:bg-accent-hover transition-colors",children:"OK"})})]})}function ET({declaration:n,value:e,autoFocus:s,onChange:i,onClear:o,onEnter:c}){const d=E.useId(),{data:p}=mk(n.name),g=(p==null?void 0:p.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:e,onChange:u=>i(u.target.value),onKeyDown:u=>{u.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(u=>h.jsx("option",{value:u},u))}),h.jsx("button",{onClick:o,disabled:e==="",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 V1=["escalationId","workflowId"],OT=/^[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",AT="lt:search:facet",Lt={FACET:"facet",COMMAND:"command"};function jT(n,e){return{version:n.version,category:e.category,name:e.name,schemeName:n.name,targetFacet:n.target_facet,encoding:n.encoding,delimiter:n.delimiter,targetLength:n.target_length,patterns:n.patterns??[]}}function Mo(n){return n.encoding==="gtin"||n.encoding==="pattern"?"":n.encoding==="delimited"?`${n.version}${n.delimiter}${n.category}${n.delimiter}`:`${n.version}${n.category}`}function kT(n,e){if(n.encoding==="delimited")return NT(n,e)?{code:e}:{code:`${Mo(n)}${e}`};if(n.encoding==="pattern")return Cv(n.patterns,e)?{code:e}:{error:`${n.name} takes a code matching its patterns`};if(!/^[0-9]+$/.test(e))return{error:`${n.name} takes digits only`};if(n.encoding==="gtin")return{code:e};const s=n.targetLength;return s&&e.length!==s&&e.length!==s+1?{error:`${n.name} takes ${s} digits`}:{code:`${Mo(n)}${e}`}}function NT(n,e){const s=n.delimiter.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^[1-9][0-9]${s}[0-9]${s}.+$`).test(e)}function TT(n,e){return n==="escalationId"||n==="workflowId"?null:gN(n,e)}function CT(n){return n.kind===Lt.FACET?n.facet:n.command.name}function MT(n){return n.kind===Lt.COMMAND?n.command.targetFacet:n.facet==="escalationId"?"Escalation id":n.facet==="workflowId"?"Workflow id":n.facet}function RT(n){return n.kind===Lt.FACET?{kind:Lt.FACET,facet:n.facet}:{kind:Lt.COMMAND,version:n.command.version,category:n.command.category}}function DT(n,e,s){if((n==null?void 0:n.kind)===Lt.FACET&&e.includes(n.facet))return{kind:Lt.FACET,facet:n.facet};if((n==null?void 0:n.kind)===Lt.COMMAND){const i=s.find(o=>o.version===n.version&&o.category===n.category);if(i)return{kind:Lt.COMMAND,command:i}}return e.length>0?{kind:Lt.FACET,facet:e[0]}:s.length>0?{kind:Lt.COMMAND,command:s[0]}:null}function LT(){try{const n=localStorage.getItem(Jv);if(n){const s=JSON.parse(n);if(s.kind===Lt.FACET&&typeof s.facet=="string"||s.kind===Lt.COMMAND&&typeof s.version=="number"&&typeof s.category=="string")return s}const e=localStorage.getItem(AT);return e?{kind:Lt.FACET,facet:e}:null}catch{return null}}function qT(n){try{localStorage.setItem(Jv,JSON.stringify(n))}catch{}}const Y1=5*6e4,PT=n=>({rules:n.map(e=>{var s;return((s=e.data)==null?void 0:s.rules)??null}),loading:n.some(e=>e.isLoading)});function BT(n){const e=Lv({enabled:n,staleTime:Y1}),s=E.useMemo(()=>{var d;return(((d=e.data)==null?void 0:d.schemes)??[]).filter(p=>p.enabled&&p.kind===cN.ACTION).sort((p,g)=>p.version-g.version)},[e.data]),{rules:i,loading:o}=xS({queries:s.map(d=>({queryKey:["scan-schemes",d.version,"actions"],queryFn:()=>ue(`/scan-codes/schemes/${d.version}/actions`),enabled:n,staleTime:Y1})),combine:PT});return{commands:E.useMemo(()=>s.flatMap((d,p)=>(i[p]??[]).filter(g=>g.enabled).sort((g,u)=>g.category.localeCompare(u.category)).map(g=>jT(d,g))),[s,i]),loading:e.isLoading||o}}const UT={escalationId:"opens the item",workflowId:"opens the run"};function zT({mode:n,facets:e,commands:s,onSelect:i,onOpenScanPanel:o}){const[c,d]=E.useState(!1),p=E.useRef(null);E.useEffect(()=>{if(!c)return;const x=_=>{p.current&&!p.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===Lt.COMMAND,u=g?`${n.command.schemeName} · ${n.command.name} — ${Mo(n.command)}<${n.command.targetFacet}>`:`Search by ${n.facet}`,m=$T(s),b=x=>{i(x),d(!1)};return h.jsxs("div",{ref:p,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:u,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:CT(n)}),h.jsx(cm,{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:[e.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(K1,{children:"Find"}),e.map(x=>h.jsx(J1,{label:x,mono:!0,note:UT[x]??"filters the list",active:!g&&n.facet===x,onClick:()=>b({kind:Lt.FACET,facet:x})},x))]}),m.map(({schemeName:x,targetFacet:v,items:_})=>h.jsxs("div",{children:[h.jsxs(K1,{note:v,children:["Run · ",x]}),_.map(S=>h.jsx(J1,{label:S.name,note:Mo(S),noteMono:!0,active:g&&n.command.version===S.version&&n.command.category===S.category,onClick:()=>b({kind:Lt.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(Ro,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Scanner settings and barcode preview"]})]})]})]})}function $T(n){const e=[];for(const s of n){const i=e.find(o=>o.schemeName===s.schemeName);i?i.items.push(s):e.push({schemeName:s.schemeName,targetFacet:s.targetFacet,items:[s]})}return e}function K1({children:n,note:e}){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}),e&&h.jsx("span",{className:"ml-auto font-mono font-normal normal-case tracking-normal shrink-0",children:e})]})}function J1({label:n,note:e,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:e})]})}const IT=6e3;function HT({onOpenScanPanel:n}){const e=ri(),{data:s}=Hn(),i=Fm(),{submitCode:o,busy:c,lastResult:d}=Vm(),{commands:p}=BT(i),[g,u]=E.useState(""),[m,b]=E.useState(!1),[x,v]=E.useState(null),[_,S]=E.useState(null),[C,B]=E.useState(""),[q,ne]=E.useState(null),[te,M]=E.useState(LT),z=E.useRef(null),ae=E.useMemo(()=>{var ce;if(!((ce=s==null?void 0:s.search)!=null&&ce.enabled))return[];const J=(s.search.facets??[]).filter(pe=>!V1.includes(pe));return[...V1,...J]},[s]),F=E.useMemo(()=>DT(te,ae,p),[te,ae,p]),U=(d==null?void 0:d.source)===ra.TOOLBAR&&!d.navigated&&q!==d.at?d:null;E.useEffect(()=>{if(!U)return;const J=setTimeout(()=>ne(U.at),IT);return()=>clearTimeout(J)},[U]);const D=()=>{v(null),S(null),d&&ne(d.at)},Q=J=>{var pe;const ce=RT(J);M(ce),qT(ce),D(),(pe=z.current)==null||pe.focus()},W=(J,ce)=>{const pe=kT(J.command,Gv(ce));if("error"in pe){v(pe.error);return}u(""),o(pe.code,ra.TOOLBAR)},he=async(J,ce)=>{const pe=TT(J,ce);if(pe){u(""),e(pe);return}if(J==="escalationId"&&!OT.test(ce)){v("That is not a valid escalation id");return}b(!0);try{if(J==="escalationId")await ue(`/escalations/${encodeURIComponent(ce)}`),u(""),e(`/escalations/detail/${encodeURIComponent(ce)}`);else{const ge=await ue(`/escalations/by-workflow/${encodeURIComponent(ce)}`),Ce=(ge==null?void 0:ge.escalations)??[];Ce.length===1?(u(""),e(`/escalations/detail/${Ce[0].id}`)):(B(ce),S(Ce))}}catch{v(`No ${J==="escalationId"?"escalation":"workflow"} found for "${ce}"`)}finally{b(!1)}},Ee=()=>{const J=g.trim();!J||m||c||!F||(D(),F.kind===Lt.COMMAND?W(F,J):he(F.facet,J))};if(!F)return null;const Ae=F.kind===Lt.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:[Ae?h.jsx(Ro,{className:"w-3.5 h-3.5 text-accent/65",strokeWidth:1.5}):h.jsx(kS,{className:"w-3.5 h-3.5 text-text-quaternary",strokeWidth:1.5}),Ae&&h.jsx("span",{className:"font-mono text-xs tabular-nums text-text-tertiary select-none","data-testid":"search-command-prefix",children:Mo(F.command)})]}),h.jsx("input",{ref:z,id:"global-search-input",type:"text",value:g,onChange:J=>{u(J.target.value),D()},onKeyDown:J=>{J.key==="Enter"&&Ee(),J.key==="Escape"&&(u(""),D())},placeholder:MT(F),"aria-label":Ae?"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 ${Ae?"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(zT,{mode:F,facets:ae,commands:p,onSelect:Q,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(Ym,{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(J=>h.jsxs(ar,{to:`/escalations/detail/${J.id}`,onClick:()=>{S(null),u("")},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:J.role}),h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),J.status,h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),h.jsx("span",{className:"text-text-tertiary",children:J.type})]},J.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(ar,{to:`/workflows/executions/${encodeURIComponent(C)}`,onClick:()=>{S(null),u("")},className:"block px-3 py-1.5 text-xs text-accent hover:bg-surface-hover",children:"Workflow execution →"})]})]})}function FT(){const{identity:n,remainingSeconds:e}=Mu(),[,s]=E.useState(0);return E.useEffect(()=>{if(!(n!=null&&n.expiresAt))return;const i=setInterval(()=>s(o=>o+1),1e3);return()=>clearInterval(i)},[n]),e()}function GT(n){return n>=60?`${Math.floor(n/60)} min`:`${n} s`}function VT(){const{identity:n}=Mu(),e=FT();return n?h.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-text-secondary whitespace-nowrap min-w-0",title:`Scans act as ${n.displayName}`,"data-testid":"badge-grant-indicator",children:[h.jsx(NS,{className:"w-4 h-4 text-status-success shrink-0",strokeWidth:1.5}),h.jsx("span",{className:"hidden sm:inline",children:"Badged:"}),h.jsx("span",{className:"font-medium text-text-primary truncate max-w-[10rem]",children:n.displayName}),n.expiresAt&&h.jsxs("span",{className:"tabular-nums text-text-tertiary","data-testid":"badge-grant-remaining",children:["· ",GT(e)]})]}):null}function YT(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(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function am(n){var e;return((e=n.title)==null?void 0:e.trim())||YT(n.role)}const Qv="lt:bookmarks",Wc="scan";function KT(){try{const n=localStorage.getItem(Qv);if(!n)return[];const e=JSON.parse(n);return Array.isArray(e)?e:[]}catch{return[]}}function Q1(n){try{localStorage.setItem(Qv,JSON.stringify(n))}catch{}}function JT({onToggleEventFeed:n,onToggleDocs:e,onToggleNav:s}){var Be,zt,Mt,tt;const i=ri(),{user:o,logout:c,isSuperAdmin:d,hasRoleType:p}=qt(),{viewAs:g,realIsBuilder:u}=iv(),{available:m,mine:b}=_k();av();const{connected:x}=zx(),{data:v}=Hn(),{role:_,targets:S,selectable:C,selectRole:B}=Lm(),{declarations:q,values:ne}=Km(),[te,M]=E.useState(!1),{data:z}=Ru(),ae=E.useMemo(()=>{const ye=(z==null?void 0:z.roles)??[],qe=new Set(((o==null?void 0:o.roles)??[]).map(At=>At.role)),yt=d||p("admin");return ye.filter(At=>na(At).length>0&&(yt||qe.has(At.role))).map(At=>({role:At.role,title:am(At),portals:na(At)}))},[z,o,d,p]),{setPanel:F,closePanel:U,open:D,ownerKey:Q}=Um(),W=Fm(),he=tn(),Ee=()=>{D&&Q===Wc?U(Wc):F(h.jsx(pT,{onClose:()=>U(Wc)}),{width:360,key:Wc})},[Ae,H]=E.useState(!1),[J,ce]=E.useState(!1),[pe,ge]=E.useState(jv),[Ce,Ne]=E.useState(KT),Me=E.useRef(null),Xe=(Be=v==null?void 0:v.branding)==null?void 0:Be.appName,pt=(zt=v==null?void 0:v.branding)==null?void 0:zt.themes,Ot=E.useMemo(()=>(Pk(pt??[]),Bk()),[pt]),mt=ye=>{Uk(ye),ge(ye)},_e=()=>{const ye=window.prompt("Bookmark label:");if(!(ye!=null&&ye.trim()))return;const qe=he.pathname+he.search,yt=[...Ce,{label:ye.trim(),url:qe}].sort((At,Ur)=>At.label.localeCompare(Ur.label));Ne(yt),Q1(yt),H(!1)},oe=ye=>{const qe=Ce.filter(yt=>!(yt.label===ye.label&&yt.url===ye.url));Ne(qe),Q1(qe)};return E.useEffect(()=>{if(!Ae)return;const ye=qe=>{Me.current&&!Me.current.contains(qe.target)&&H(!1)};return document.addEventListener("mousedown",ye),()=>document.removeEventListener("mousedown",ye)},[Ae]),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 ${Ae?"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(TS,{className:"w-5 h-5",strokeWidth:1.5})}),h.jsx(ar,{to:"/","aria-label":"Home",className:"shrink-0 hidden lg:block",onClick:ye=>{(ye.ctrlKey||ye.metaKey)&&(ye.preventDefault(),ce(!0))},children:h.jsx(Du,{appName:Xe,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(hx,{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(xd,{className:"w-5 h-5",strokeWidth:2})})]}),(((Mt=v==null?void 0:v.search)==null?void 0:Mt.enabled)||W)&&h.jsx("div",{className:"hidden md:flex flex-1 min-w-0 justify-center px-4 lg:px-8",children:h.jsx(HT,{onOpenScanPanel:W?Ee:void 0})}),h.jsxs("div",{className:"flex items-center gap-5 shrink-0",children:[h.jsx(VT,{}),h.jsxs(ar,{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(vd,{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(ar,{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(vd,{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:Kd,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(en,{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:Me,children:[h.jsxs("button",{onClick:()=>H(ye=>!ye),className:"btn-ghost flex items-center gap-1",children:[h.jsxs("span",{className:"relative",children:[h.jsx(CS,{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"})})]}),Ae&&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(ar,{to:"/credentials",onClick:()=>H(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),((tt=v==null?void 0:v.auth)==null?void 0:tt.oauthServer)&&h.jsx(ar,{to:"/connected-apps",onClick:()=>H(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Connected apps"}),W&&h.jsx("button",{onClick:()=>{H(!1),Ee()},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"}),u&&h.jsx("button",{onClick:()=>{H(!1),e==null||e()},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),Kd()},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:Ot.map(ye=>h.jsx("button",{type:"button",onClick:()=>mt(ye.id),title:ye.label,"aria-label":`${ye.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${pe===ye.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:ye.swatch}},ye.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),B(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(ye=>{var At;const qe=(At=z==null?void 0:z.roles)==null?void 0:At.find(Ur=>Ur.role===ye),yt=ye===_;return h.jsxs("button",{type:"button",onClick:()=>{H(!1),B(ye),i(yv(ye,na(qe)))},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${yt?"text-accent":"text-text-secondary"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${yt?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:am({role:ye,title:qe==null?void 0:qe.title})})]},ye)})]})]}),ae.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:ae.map(ye=>h.jsxs("div",{children:[ae.length>1&&h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:ye.role,children:ye.title}),ye.portals.map(qe=>{const yt=Dm(ye.role,qe.key),At=he.pathname===yt;return h.jsxs("button",{type:"button",onClick:()=>{H(!1),i(yt)},className:`flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded hover:bg-surface-hover ${At?"text-accent":"text-text-secondary"}`,"data-testid":`menu-portal-${ye.role}-${qe.key}`,children:[h.jsx(_d,{className:"w-3.5 h-3.5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate",children:qe.label})]},qe.key)})]},ye.role))})]}),q.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),M(!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(ne).length>0?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:Object.keys(ne).length>0?Object.entries(ne).map(([ye,qe])=>`${ye} = ${qe}`).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:[Ce.map(ye=>h.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[h.jsx(ar,{to:ye.url,onClick:()=>H(!1),title:ye.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:ye.label}),h.jsx("button",{type:"button",onClick:()=>oe(ye),title:`Remove "${ye.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(en,{className:"w-3 h-3"})})]},`${ye.label}::${ye.url}`)),h.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),h.jsxs("button",{type:"button",onClick:_e,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(MS,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),J&&h.jsx(qk,{onClose:()=>ce(!1)}),h.jsx(ST,{open:te,onClose:()=>M(!1)})]})}function Jm({open:n,children:e}){const[s,i]=E.useState(n);return E.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?e:null})})}function om(n){return({isActive:e})=>{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 ${e?i:o}`:`${s} gap-3 px-4 py-2 text-sm ${e?i:o}`}}function QT(){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 XT({group:n,collapsed:e}){const{pathname:s}=tn(),i=n.matchPaths.some(p=>s.startsWith(p)),[o,c]=E.useState(i),d=o||i;return e?h.jsx(h.Fragment,{children:n.items.map(p=>h.jsx(As,{to:p.to,className:om(!0),title:p.label,children:p.icon&&h.jsx(p.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},p.to))}):h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>c(p=>!p),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(Jm,{open:d,children:n.items.map(p=>h.jsxs(As,{to:p.to,end:p.end,className:QT(),children:[p.icon&&h.jsx(p.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:p.label})]},p.to))})]})}function WT(n){return n.kind==="group"}function ZT({entry:n,collapsed:e}){const{pathname:s,search:i}=tn(),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,p]=n.to.split("?"),g=s===d&&i===`?${p}`,u=om(e)({isActive:g});return h.jsxs(As,{to:n.to,className:u,title:e?n.label:void 0,children:[c,!e&&h.jsx("span",{children:n.label})]})}return h.jsxs(As,{to:n.to,end:n.end,className:om(e),title:e?n.label:void 0,children:[c,!e&&h.jsx("span",{children:n.label})]})}function qr({heading:n,entries:e}){const{collapsed:s}=Pm();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}),e.map(i=>WT(i)?h.jsx(XT,{group:i,collapsed:s},i.label):h.jsx(ZT,{entry:i,collapsed:s},i.to))]})}function eC({aiEnabled:n=!1,isBuilder:e=!1,isOps:s=!1,viewAs:i=null,canSeePaceBoard:o=!1,showLines:c=!1}){const d=[{to:"/pace",label:"Pace Board",icon:RS},{to:"/trends",label:"Trend Board",icon:DS}],p=c?[{to:"/lines",label:"Lines",icon:LS}]:[];if(!e&&(!s||i==="engineer"||i==="operator"))return o?h.jsx(qr,{heading:"Monitor",entries:d}):null;if(!e)return h.jsx(qr,{heading:"Monitor",entries:[...o?d:[],...p]});const g=[...o?d:[],...p,{to:"/topics",label:"Event Topics",icon:dx},{to:"/agents",label:n?"Agents":"Automations",icon:qS},{to:"/capabilities",label:"Capabilities",icon:PS}];return h.jsx(qr,{heading:"Monitor",entries:g})}function tC(){return Pe({queryKey:["me","preferences"],queryFn:()=>ue("/me/preferences"),staleTime:6e4})}function nC(){const n=Le();return ze({mutationFn:e=>ue("/me/preferences",{method:"PATCH",body:JSON.stringify(e)}),onSuccess:e=>{n.setQueryData(["me","preferences"],e)}})}const xs={TABLE:"table",RICH:"rich",TIMELINE:"timeline"},X1={COMPACT:"compact",CARDS:"cards"},pd={AVAILABLE:"/escalations/available",ALL:"/escalations"},sa={AVAILABLE:"available",CLAIMED:"claimed",RESOLVED:"resolved",CANCELLED:"cancelled",EXPIRED:"expired"},rC={[sa.RESOLVED]:"resolved",[sa.CANCELLED]:"cancelled",[sa.EXPIRED]:"expired"};function sC(n){const e=n===sa.CLAIMED;return{available:n===sa.AVAILABLE,claimed:e,apiStatus:e?"pending":rC[n]}}function iC(n){return n===xs.TABLE||n===xs.RICH||n===xs.TIMELINE}function aC(n){return n===X1.COMPACT||n===X1.CARDS}function oC(n,e=""){const s=n.get("priority"),i=n.get("view"),o=n.get("layout");return{statusFilter:n.get("status")||e,role:n.get("role")||void 0,type:n.get("type")||void 0,subtype:n.get("subtype")||void 0,priority:s?parseInt(s,10):void 0,search:n.get("search")||void 0,facets:pN(n),view:iC(i)?i:null,layout:aC(o)?o:null}}function lC(n){let e;try{e=new URL(n,"http://local")}catch{return null}if(e.pathname!==pd.AVAILABLE&&e.pathname!==pd.ALL)return null;const s=e.pathname===pd.AVAILABLE?sa.AVAILABLE:"";return oC(e.searchParams,s)}function fR(n){var e;return n.role||(((e=n.facets.roles)==null?void 0:e.length)===1?n.facets.roles[0]:null)}function hR(n,e){return n===xs.TIMELINE?xs.TIMELINE:e&&(!n||n===xs.RICH)?xs.RICH:xs.TABLE}function cC(n,e){const s=(n==null?void 0:n.pinnedViews)??[],i=new Set((n==null?void 0:n.hiddenRolePins)??[]),o=new Set(s.map(p=>p.label)),c=[...s],d=new Set;for(const{role:p,pins:g}of e)for(const u of g)o.has(u.label)||i.has(u.label)||d.has(u.label)||(d.add(u.label),c.push({...u,id:`role:${p}:${u.label}`,fromRole:p}));return c}function uC(n){const e=lC(n);if(!e)return null;const{available:s,claimed:i,apiStatus:o}=sC(e.statusFilter);return{available:s,params:{...e.facets,role:e.role,type:e.type,subtype:e.subtype,priority:e.priority,status:o,...i?{claimed:!0}:{},search:e.search}}}function fC(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function hC(){var U;const{collapsed:n}=Pm(),{user:e}=qt(),s=tC(),i=nC(),o=E.useMemo(()=>new Set(((e==null?void 0:e.roles)??[]).map(D=>D.role)),[e]),{data:c}=Ru({enabled:o.size>0}),d=nn("SUMMARY");Ns(Cm(),()=>{d([["escalations"]])});const p=(U=s.data)==null?void 0:U.preferences,g=E.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:u}=Km(),m=E.useMemo(()=>cC(p,g),[p,g]),b=E.useMemo(()=>new Map(m.map(D=>[D.id,D.url])),[m]),x=E.useMemo(()=>m.map(D=>({...D,url:u(D.url)})),[m,u]),v=E.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(D=>[D.role,am(D)])),[c]),_=E.useMemo(()=>x.filter(D=>!D.fromRole),[x]),S=E.useMemo(()=>new Set(((c==null?void 0:c.roles)??[]).filter(D=>o.has(D.role)&&ik(D)).map(D=>D.role)),[c,o]),C=E.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(D=>S.has(D.role)||g.some(Q=>Q.role===D.role)).map(D=>({role:D.role,title:v.get(D.role)??D.role,portals:S.has(D.role)?na(D):[],pins:x.filter(Q=>Q.fromRole===D.role)})).filter(D=>D.portals.length>0||D.pins.length>0),[c,g,S,v,x]),B=(p==null?void 0:p.pinnedViews)??[],q=E.useRef(null),ne=D=>i.mutate({pinnedViews:D}),te=D=>ne(B.filter(Q=>Q.id!==D)),M=D=>ne([...B,{id:fC(),label:D.label,url:b.get(D.id)??D.url,badge:D.badge}]),z=D=>i.mutate({hiddenRolePins:[...(p==null?void 0:p.hiddenRolePins)??[],D]}),ae=(D,Q)=>{if(D===Q)return;const W=[...B],[he]=W.splice(D,1);W.splice(Q,0,he),ne(W)};if(x.length===0&&S.size===0)return null;const F="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:F,children:"Pinned"}),_.map(D=>{const Q=B.findIndex(W=>W.id===D.id);return h.jsx(W1,{pin:D,collapsed:n,draggable:Q!==-1,onDragStart:()=>{q.current=Q},onDropOn:()=>{q.current!==null&&Q!==-1&&ae(q.current,Q),q.current=null},onRemove:()=>te(D.id)},D.id)}),C.map(D=>h.jsxs("div",{children:[!n&&h.jsx("p",{className:F,title:`${D.title} — pins from the ${D.role} role`,"data-testid":"pin-group-label",children:D.title}),D.portals.map(Q=>h.jsx(dC,{role:D.role,portal:Q,collapsed:n},Q.key)),D.pins.map(Q=>h.jsx(W1,{pin:Q,collapsed:n,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>M(Q),onHide:()=>z(Q.label)},Q.id))]},D.role))]})}function dC({role:n,portal:e,collapsed:s}){const i=Dm(n,e.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}-${e.key}`;return s?h.jsx(As,{to:i,className:`${o} justify-center w-10 h-10 mx-auto`,title:e.label,"data-testid":c,children:h.jsx(_d,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs(As,{to:i,title:e.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(_d,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:e.label})]})}function W1({pin:n,collapsed:e,draggable:s,onDragStart:i,onDropOn:o,onRemove:c,onPromote:d,onHide:p}){const{pathname:g,search:u}=tn(),[m,b=""]=n.url.split("?"),x=g===m&&u===(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 e?h.jsx(As,{to:n.url,className:`${v} ${_} justify-center w-10 h-10 mx-auto`,title:n.label,children:h.jsx(qg,{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(As,{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(qg,{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(mC,{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(mx,{className:"w-3 h-3"})}),p&&h.jsx("button",{onClick:p,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(BS,{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(en,{className:"w-3 h-3"})})]})]})}function mC({url:n}){var d;const e=E.useMemo(()=>uC(n),[n]),s={limit:1,staleTime:15e3},i=vv({...(e==null?void 0:e.params)??{},...s,enabled:!!e&&e.available}),o=xv({...(e==null?void 0:e.params)??{},...s,enabled:!!e&&!e.available});if(!e)return null;const c=e.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 pC(){var c;const{data:n}=Hn(),e=(c=n==null?void 0:n.features)==null?void 0:c.graphWorkflows,s=e===!0||e!==!1&&nv(),i=[{to:"/workflows/registry",label:"Registry",icon:Pg},{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:wd},{to:"/workflows/executions",label:"Executions",icon:Bg}],o=s?[{kind:"group",label:"Procedural",icon:US,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:i},{kind:"group",label:"Graph",icon:um,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:Pg,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:wd},{to:"/mcp/executions",label:"Executions",icon:Bg}]}]:i;return h.jsx(qr,{heading:"Orchestrate",entries:o})}function dR(){return Pe({queryKey:["activeWorkers"],queryFn:async()=>(await ue("/workflows/workers")).workers})}function mR(){return Pe({queryKey:["discoveredWorkflows"],queryFn:async()=>(await ue("/workflows/discovered")).workflows})}function pR(){return Pe({queryKey:["workflowConfigs"],queryFn:async()=>(await ue("/workflows/config")).workflows})}function Xv(){return Pe({queryKey:["invocableWorkflows"],queryFn:async()=>(await ue("/workflows/invocable")).workflows})}function yR(n){return Object.fromEntries(n.filter(e=>!e.missing).map(e=>[e.as??e.key,e.data]))}function gR(n,e){return Pe({queryKey:["workflows",n,"input-lookups"],queryFn:()=>ue(`/workflows/${encodeURIComponent(n)}/input-lookups`),enabled:!!n&&e,staleTime:0,refetchOnWindowFocus:!1})}function bR(){return Pe({queryKey:["cronStatus"],queryFn:async()=>(await ue("/workflows/cron/status")).schedules})}function xR(n){return Pe({queryKey:["workflowExecution",n],queryFn:()=>ue(`/workflow-states/${n}/execution`),enabled:!!n})}function vR(n,e){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:()=>ue(`/workflow-states/jobs?${s}`),enabled:(e==null?void 0:e.enabled)??!0})}function _R(){const n=Le();return ze({mutationFn:e=>ue(`/workflows/${e}/terminate`,{method:"POST"}),onSuccess:(e,s)=>{n.invalidateQueries({queryKey:["workflowExecution",s],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function wR(){const n=Le();return ze({mutationFn:({workflow_type:e,...s})=>ue(`/workflows/${encodeURIComponent(e)}/config`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function SR(){const n=Le();return ze({mutationFn:e=>ue(`/workflows/${encodeURIComponent(e)}/config`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function ER(){const n=Le();return ze({mutationFn:({workflowType:e,data:s,metadata:i,execute_as:o})=>ue(`/workflows/${e}/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 yC(){const{data:n}=Xv();return n!=null&&n.length?h.jsx(qr,{heading:"Tools",entries:[{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:wd}]}):null}const gC=[{to:"/mcp/queries",label:"Designer",icon:zS},{to:"/mcp/servers",label:"Servers & Tools",icon:$S}];function bC(){return h.jsx(qr,{heading:"Design",entries:gC})}const xC=[{to:"/files",label:"Files",icon:IS},{to:"/knowledge",label:"Knowledge Base",icon:px}];function vC(){return h.jsx(qr,{heading:"Storage",entries:xC})}function _C({isBuilder:n=!1,isOps:e=!1}){var d;const{data:s}=Hn(),i=((d=s==null?void 0:s.features)==null?void 0:d.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:HS},...n||e?[{to:"/admin/roles",label:"Roles",icon:vd},{to:"/admin/personas",label:"Personas",icon:FS},{to:"/admin/scan-codes",label:"Scan Codes",icon:Ro},{to:"/admin/labels/history",label:"Label History",icon:GS}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:VS},{to:"/admin/streams",label:"Messages",icon:px},...i?[{to:"/admin/maintenance",label:"DB Maintenance",icon:YS}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(qr,{heading:"Identity & Access",entries:o}),n&&rv()&&h.jsx(qr,{heading:"Infrastructure",entries:c})]})}function Wv({aiEnabled:n,isBuilder:e,isOps:s,viewAs:i,canSeePaceBoard:o,showLines:c}){return h.jsxs(h.Fragment,{children:[h.jsx(eC,{aiEnabled:n,isBuilder:e,isOps:s,viewAs:i,canSeePaceBoard:o,showLines:c}),h.jsx(hC,{}),!e&&h.jsx(yC,{}),e&&h.jsx(pC,{}),e&&n&&h.jsx(bC,{}),e&&h.jsx(vC,{}),(e||s)&&h.jsx(_C,{isBuilder:e,isOps:s})]})}function wC({open:n,onClose:e,...s}){const i=tn();return E.useEffect(()=>{e()},[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:e,"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:e,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(en,{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(fk,{children:h.jsx(Wv,{...s})})})]})]})}const Zv="lt_event_feed_patterns";function SC(n,e){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(e).get("role");return d?`lt.events.system.escalation.${ov(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 EC(){try{const n=localStorage.getItem(Zv);return n?JSON.parse(n):[]}catch{return[]}}function yd(n){try{localStorage.setItem(Zv,JSON.stringify(n))}catch{}}function OC(){const{pathname:n,search:e}=tn(),[s,i]=E.useState(EC),o=E.useMemo(()=>SC(n,e),[n,e]),c=E.useMemo(()=>{const u=new Set([o,...s]);return Array.from(u)},[o,s]),d=E.useCallback(u=>{const m=u.startsWith("lt.events.")?u:`lt.events.${u}`;i(b=>{if(b.includes(m))return b;const x=[...b,m];return yd(x),x})},[]),p=E.useCallback(u=>{i(m=>{const b=m.filter(x=>x!==u);return yd(b),b})},[]),g=E.useCallback(()=>{i([]),yd([])},[]);return{patterns:c,pagePattern:o,userPatterns:s,addPattern:d,removePattern:p,clearUserPatterns:g}}function AC({children:n,className:e=""}){return h.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${e}`,children:n})}const gd=280,Z1="cubic-bezier(0.4, 0, 0.2, 1)",Zc=40;function jC(n){if(!n)return"scale(0.92)";const e=window.innerWidth,s=window.innerHeight,i=e-Zc*2,o=s-Zc*2,c=n.width/i,d=n.height/o,p=n.left+n.width/2-(Zc+i/2),g=n.top+n.height/2-(Zc+o/2);return`translate(${p}px, ${g}px) scale(${c}, ${d})`}function e_({open:n,onClose:e,sourceRef:s,children:i}){const[o,c]=E.useState(null),d=E.useRef(null),p=E.useRef(!1);E.useEffect(()=>{var x,v;n&&!p.current?(d.current=((x=s==null?void 0:s.current)==null?void 0:x.getBoundingClientRect())??null,c("entering")):!n&&p.current&&o==="open"&&(d.current=((v=s==null?void 0:s.current)==null?void 0:v.getBoundingClientRect())??null,c("exiting")),p.current=n},[n,s,o]),E.useEffect(()=>{if(o!=="entering")return;const x=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(x)},[o]),E.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),E.useEffect(()=>{if(!o)return;const x=v=>{v.key==="Escape"&&e()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[o,e]);const g=E.useCallback(x=>{x.propertyName==="transform"&&o==="exiting"&&c(null)},[o]);if(E.useEffect(()=>{if(o!=="exiting")return;const x=setTimeout(()=>c(null),gd+50);return()=>clearTimeout(x)},[o]),!o)return null;const u=o==="entering"||o==="exiting",m=u?jC(d.current):"none",b=u?0:1;return lm.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${gd}ms ${Z1}, opacity ${gd}ms ${Z1}`,transform:m,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:i}),document.body)}function kC({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 NC({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 TC({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 CC({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 MC({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 RC({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 DC(n){const e=n.trim().split(`
|
|
57
|
-
`);if(e.length<2)return n;const s=p=>p.split("|").map(g=>g.trim()).filter(Boolean),i=s(e[0]),o=e.slice(2),c=i.map(p=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${p}</th>`).join(""),d=o.map(p=>`<tr class="border-t border-surface-border">${s(p).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 eu(n){return n.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function
|
|
53
|
+
${p.stack}`),d.reject(u)):d.resolve(m))}});return g.requestSubject=e,this.protocol.publish(e,s,{reply:c,headers:i.headers}),d}else{const c=new jx(this.protocol.muxSubscriptions,e,i,o);this.protocol.request(c);try{this.publish(e,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${c.token}`,headers:i.headers})}catch(p){c.cancel(p)}const d=Promise.race([c.timer,c.deferred]);return d.catch(()=>{c.cancel()}),d}}flush(){return this.isClosed()?Promise.reject(be.errorForCode(fe.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(be.errorForCode(fe.ConnectionClosed)):this.isDraining()?Promise.reject(be.errorForCode(fe.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const e=this.protocol.getServer();return e?e.listen:""}status(){const e=new Ut;return e.iterClosed.then(()=>{const s=this.listeners.indexOf(e);this.listeners.splice(s,1)}),this.listeners.push(e),e}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(e={}){const s=new nO(this,e);if(e.checkAPI!==!1)try{await s.getAccountInfo()}catch(i){const o=i;throw o.code===fe.NoResponders&&(o.code=fe.JetStreamNotEnabled),o}return s}jetstream(e={}){return new xm(this,e)}getServerVersion(){const e=this.info;return e?ni(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw be.errorForCode(fe.Disconnect);const e=Date.now();return await this.flush(),Date.now()-e}get features(){return this.protocol.features}get services(){return this._services||(this._services=new aO(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(be.errorForCode(fe.ConnectionClosed)):this.isDraining()?Promise.reject(be.errorForCode(fe.ConnectionDraining)):this.protocol.reconnect()}}class aO{constructor(e){j(this,"nc");this.nc=e}add(e){try{return new Lo(this.nc,e).start()}catch(s){return Promise.reject(s)}}client(e,s){return new U2(this.nc,e,s)}}class oO{constructor(e,s,i){j(this,"bucket");j(this,"sm");j(this,"prefixLen");this.bucket=e,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(bu)||"PUT"}get length(){const e=this.sm.header.get(Zt.MessageSizeHdr)||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class lO{constructor(e,s,i){j(this,"bucket");j(this,"key");j(this,"sm");this.bucket=e,this.key=s,this.sm=i}get value(){return this.sm.data}get created(){return new Date(mm(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var e;return((e=this.sm.headers)==null?void 0:e.get(bu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const e=((s=this.sm.headers)==null?void 0:s.get(Zt.MessageSizeHdr))||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Px extends XE{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=Lr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,i);const c=this.info;c.config.name=js.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=Et.StartSequence,c.config.opt_start_seq=s;const d={};d.stream_name=this.info.stream,d.config=c.config;const p=`${c.api.prefix}.CONSUMER.CREATE.${c.stream}`;this.js._request(p,d,{retries:-1}).then(g=>{const u=g,m=this.sub.info;m.last=u,this.info.config=u.config,this.info.name=u.name}).catch(g=>{const u=new be(`unable to recreate ordered consumer ${c.stream} at seq ${s}`,fe.RequestError,g);this.sub.callback(u,{})})}_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(mm(s))}_setupHbMonitoring(s,i=0){const o={cancelAfter:0,maxOut:2};i&&(o.cancelAfter=i);const c=this.sub,d=p=>{var m,b,x,v;const g=CE(409,`${$n.IdleHeartbeatMissed}: ${p}`,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 ym(s,d,o)}_checkHbOrderConsumer(s){const i=s.headers.get(Zt.ConsumerStalledHdr);i!==""&&this.js.nc.publish(i);const o=parseInt(s.headers.get(Zt.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 cO extends Px{constructor(e,s,i){super(e,s,i)}pull(e={batch:1}){const{stream:s,config:i,name:o}=this.sub.info,c=i.durable_name??o,d={};if(d.batch=e.batch||1,d.no_wait=e.no_wait||!1,(e.max_bytes??0)>0){const u=this.js.nc.features.get(Ye.JS_PULL_MAX_BYTES);if(!u.ok)throw new Error(`max_bytes is only supported on servers ${u.min} or better`);d.max_bytes=e.max_bytes}let p=0;e.expires&&e.expires>0&&(p=e.expires,d.expires=ht(p));let g=0;if(e.idle_heartbeat&&e.idle_heartbeat>0&&(g=e.idle_heartbeat,d.idle_heartbeat=ht(g)),g&&p===0)throw new Error("idle_heartbeat requires expires");if(g>p)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),p&&g&&(this.monitor?this.monitor._change(g,p):this._setupHbMonitoring(g,p));const u=this.info.api,m=`${u.prefix}.CONSUMER.MSG.NEXT.${s}.${c}`,b=this.sub.subject;u.nc.publish(m,u.jc.encode(d),{reply:b})}}}function uO(n,e){return n?hO(e):fO(e)}function fO(n){return(e,s)=>e?[e,null]:(e=Zi(s),e?[e,null]:[null,To(s,n)])}function hO(n){return(e,s)=>{if(e)return[e,null];const i=Zi(s);return i!==null?[Bx(i),null]:[null,To(s,n)]}}function Bx(n){if(n!==null)switch(n.code){case fe.JetStream404NoMessages:case fe.JetStream408RequestTimeout:return null;case fe.JetStream409:return ME(n)?n:null;default:return n}return null}function dO(n){n&&n.ack()}function mO(n){const e=n.split(".");if(e.length===9&&e.splice(2,0,"_",""),e.length<11||e[0]!=="$JS"||e[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=e[2]==="_"?"":e[2],s.account_hash=e[3],s.stream=e[4],s.consumer=e[5],s.deliveryCount=parseInt(e[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(e[7],10),s.deliverySequence=parseInt(e[8],10),s.timestampNanos=parseInt(e[9],10),s.pending=parseInt(e[10],10),s}class pO{constructor(e,s){j(this,"msg");j(this,"di");j(this,"didAck");j(this,"timeout");this.msg=e,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=mO(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(e){this.didAck||(this.didAck=!this.isWIP(e),this.msg.respond(e))}isWIP(e){return e.length===4&&e[0]===oo[0]&&e[1]===oo[1]&&e[2]===oo[2]&&e[3]===oo[3]}async ackAck(e){var i;e=e||{},e.timeout=e.timeout||this.timeout;const s=dt();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),p=new jx(c.muxSubscriptions,this.msg.reply,{timeout:e.timeout},d);c.request(p);try{c.publish(this.msg.reply,xb,{reply:`${c.muxSubscriptions.baseInbox}${p.token}`})}catch(g){p.cancel(g)}try{await Promise.race([p.timer,p.deferred]),s.resolve(!0)}catch(g){p.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(xb)}nak(e){let s=J2;e&&(s=Ad().encode(`-NAK ${JSON.stringify({delay:ht(e)})}`)),this.doAck(s)}working(){this.doAck(oo)}next(e,s={batch:1}){const i={};i.batch=s.batch||1,i.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(i.expires=ht(s.expires));const o=er().encode(i),c=oa.concat(Q2,W2,o),d=e?{reply:e}:void 0;this.msg.respond(c,d)}term(e=""){let s=X2;(e==null?void 0:e.length)>0&&(s=Ad().encode(`+TERM ${e}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const yO="1.30.3",gO="nats.ws";class bO{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=yO,this.lang=gO,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=dt(),this.closedNotification=dt()}async connect(e,s){const i=dt();if(s.tls)return i.reject(new be("tls",fe.InvalidOption)),i;this.options=s;const o=e.src;if(s.wsFactory){const{socket:c,encrypted:d}=await s.wsFactory(e.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=oa.concat(...this.yields),p=r2(d);if(p!==""){const g=C2.exec(p);if(!g){s.debug&&console.error("!!!",oc(d)),i.reject(new Error("unexpected response from server"));return}try{const u=JSON.parse(g[1]);N2(u,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),i.resolve()}catch(u){i.reject(u);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,p=new be(d.message,fe.Unknown,new Error(d.error));i.reject(p)},i}disconnect(){this._closed(void 0,!0)}async _closed(e,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=e,!e)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await la(100);this.done=!0;try{this.socket.close(e?1002:1e3,e?e.message:void 0)}catch{}s&&this.closedNotification.resolve(e)}}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 e=this.yields;this.yields=[];for(let s=0;s<e.length;s++)this.options.debug&&console.info(`> ${oc(e[s])}`),yield e[s];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=dt())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.isDiscarded())try{this.socket.send(e.buffer),this.options.debug&&console.info(`< ${oc(e)}`);return}catch(s){this.options.debug&&console.error(`!!! ${oc(e)}: ${s}`)}}close(e){return this._closed(e,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var e;this.done=!0;try{(e=this.socket)==null||e.close()}catch{}}}function xO(n,e){/^(.*:\/\/)(.*)/.test(n)||(typeof e=="boolean"?n=`${e===!0?"https":"http"}://${n}`:n=`https://${n}`);let i=new URL(n);const o=i.protocol.toLowerCase();o==="ws:"&&(e=!1),o==="wss:"&&(e=!0),o!=="https:"&&o!=="http"&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2"),i=new URL(`http://${n}`));let c,d;const p=i.hostname,g=i.pathname,u=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||e===!0?"443":"80",c=e===!0?"wss:":"ws:";break}return`${c}//${p}:${d}${g}${u}`}function vO(n={}){return WE({defaultPort:443,urlParseFn:xO,factory:()=>new bO}),vm.connect(n)}const _O=null,wO=null,Wt="lt.events";function Ux(n,e){const s=n.split("."),i=e.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 ca=E.createContext({connected:!1,subscribe:()=>()=>{}});function zx(){const{connected:n}=E.useContext(ca);return{connected:n}}function An(n,e){const{subscribe:s}=E.useContext(ca),i=E.useRef(e);i.current=e,E.useEffect(()=>s(n,c=>i.current(c)),[s,n])}function Ns(n,e){const{subscribe:s}=E.useContext(ca),i=E.useRef(e);i.current=e;const o=n.join(","),c=E.useMemo(()=>o.split(",").filter(Boolean),[o]);E.useEffect(()=>{const d=g=>i.current(g),p=c.map(g=>s(g,d));return()=>p.forEach(g=>g())},[s,c])}const $x=E.createContext({connected:!1,unavailable:!1,subscribe:()=>()=>{}});function SO(){const{connected:n,unavailable:e}=E.useContext($x);return{connected:n,unavailable:e}}const EO=Ad();function OO({children:n,url:e,token:s,resolveCredentials:i,policy:o=bo,onReconnect:c,sessionKey:d}){const p=E.useRef(null),[g,u]=E.useState(!1),[m,b]=E.useState(!1),[x,v]=E.useState(!1),_=E.useRef({url:e,token:s,resolveCredentials:i,policy:o,onReconnect:c});_.current={url:e,token:s,resolveCredentials:i,policy:o,onReconnect:c};const S=E.useRef(new Map),C=E.useRef(new Map),B=E.useCallback((te,M)=>{(async()=>{for await(const z of M)try{if(!Ux(z.subject,te))continue;const ae=JSON.parse(EO.decode(z.data)),F=S.current.get(te);if(!F)continue;for(const U of F)try{U(ae)}catch{}}catch{}})()},[]),q=E.useCallback(te=>{var z;const M=p.current;if(!(!M||(z=M.isClosed)!=null&&z.call(M)||C.current.has(te)))try{const ae=M.subscribe(te);C.current.set(te,ae),B(te,ae)}catch{}},[B]),ne=E.useCallback((te,M)=>{const z=S.current;return z.has(te)||z.set(te,new Set),z.get(te).add(M),q(te),()=>{const ae=z.get(te);if(ae&&(ae.delete(M),ae.size===0)){z.delete(te);const F=C.current.get(te);if(F){C.current.delete(te);try{F.unsubscribe()}catch{}}}}},[q]);return E.useEffect(()=>{let te=!1,M=!1,z=!1,ae=!1,F=0,U,D;v(!1);const Q=()=>typeof document<"u"&&document.visibilityState==="hidden",W=async()=>{const{url:J,token:ce,resolveCredentials:pe}=_.current;if(pe)return pe();const ge=J||_O;return ge?{kind:"ok",url:ge,token:ce||wO||null}:{kind:"unavailable"}},he=(J=vE(F++,_.current.policy))=>{te||M||(U=setTimeout(Ae,J))},Ee=J=>{J.closed().then(()=>{p.current===J&&(p.current=null,C.current.clear(),u(!1),he(Jg(_.current.policy)))})};async function Ae(){if(U=void 0,!(te||M||z||p.current)&&!Q()){z=!0;try{const J=await W();if(te)return;if(J.kind==="session-ended"){M=!0,v(!0);return}if(J.kind==="unavailable"){he();return}const ce=await vO({servers:J.url,token:J.token??void 0,reconnect:!1});if(te){ce.close().catch(()=>{});return}p.current=ce,F=0,u(!0),C.current.clear();for(const pe of S.current.keys())q(pe);ae&&(D=setTimeout(()=>{var pe,ge;return(ge=(pe=_.current).onReconnect)==null?void 0:ge.call(pe)},Jg(_.current.policy))),ae=!0,Ee(ce)}catch{te||he()}finally{z=!1}}}const H=()=>{te||M||z||p.current||Q()||(U&&clearTimeout(U),F=0,Ae())};return document.addEventListener("visibilitychange",H),window.addEventListener("online",H),Ae(),()=>{te=!0,U&&clearTimeout(U),D&&clearTimeout(D),document.removeEventListener("visibilitychange",H),window.removeEventListener("online",H);for(const J of C.current.values())try{J.unsubscribe()}catch{}C.current.clear(),p.current&&(p.current.close().catch(()=>{}),p.current=null),u(!1)}},[q,d]),E.useEffect(()=>{if(g||x){b(!1);return}const te=setTimeout(()=>b(!0),o.noticeAfterMs);return()=>clearTimeout(te)},[g,x,o.noticeAfterMs]),h.jsx($x.Provider,{value:{connected:g,unavailable:m,subscribe:ne},children:h.jsx(ca.Provider,{value:{connected:g,subscribe:ne},children:n})})}const ur=Object.create(null);ur.open="0";ur.close="1";ur.ping="2";ur.pong="3";ur.message="4";ur.upgrade="5";ur.noop="6";const au=Object.create(null);Object.keys(ur).forEach(n=>{au[ur[n]]=n});const zd={type:"error",data:"parser error"},Ix=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Hx=typeof ArrayBuffer=="function",Fx=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,_m=({type:n,data:e},s,i)=>Ix&&e instanceof Blob?s?i(e):_b(e,i):Hx&&(e instanceof ArrayBuffer||Fx(e))?s?i(e):_b(new Blob([e]),i):i(ur[n]+(e||"")),_b=(n,e)=>{const s=new FileReader;return s.onload=function(){const i=s.result.split(",")[1];e("b"+(i||""))},s.readAsDataURL(n)};function wb(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let od;function AO(n,e){if(Ix&&n.data instanceof Blob)return n.data.arrayBuffer().then(wb).then(e);if(Hx&&(n.data instanceof ArrayBuffer||Fx(n.data)))return e(wb(n.data));_m(n,!1,s=>{od||(od=new TextEncoder),e(od.encode(s))})}const Sb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_o=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<Sb.length;n++)_o[Sb.charCodeAt(n)]=n;const jO=n=>{let e=n.length*.75,s=n.length,i,o=0,c,d,p,g;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const u=new ArrayBuffer(e),m=new Uint8Array(u);for(i=0;i<s;i+=4)c=_o[n.charCodeAt(i)],d=_o[n.charCodeAt(i+1)],p=_o[n.charCodeAt(i+2)],g=_o[n.charCodeAt(i+3)],m[o++]=c<<2|d>>4,m[o++]=(d&15)<<4|p>>2,m[o++]=(p&3)<<6|g&63;return u},kO=typeof ArrayBuffer=="function",wm=(n,e)=>{if(typeof n!="string")return{type:"message",data:Gx(n,e)};const s=n.charAt(0);return s==="b"?{type:"message",data:NO(n.substring(1),e)}:au[s]?n.length>1?{type:au[s],data:n.substring(1)}:{type:au[s]}:zd},NO=(n,e)=>{if(kO){const s=jO(n);return Gx(s,e)}else return{base64:!0,data:n}},Gx=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},Vx="",TO=(n,e)=>{const s=n.length,i=new Array(s);let o=0;n.forEach((c,d)=>{_m(c,!1,p=>{i[d]=p,++o===s&&e(i.join(Vx))})})},CO=(n,e)=>{const s=n.split(Vx),i=[];for(let o=0;o<s.length;o++){const c=wm(s[o],e);if(i.push(c),c.type==="error")break}return i};function MO(){return new TransformStream({transform(n,e){AO(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),e.enqueue(o),e.enqueue(s)})}})}let ld;function fc(n){return n.reduce((e,s)=>e+s.length,0)}function hc(n,e){if(n[0].length===e)return n.shift();const s=new Uint8Array(e);let i=0;for(let o=0;o<e;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 RO(n,e){ld||(ld=new TextDecoder);const s=[];let i=0,o=-1,c=!1;return new TransformStream({transform(d,p){for(s.push(d);;){if(i===0){if(fc(s)<1)break;const g=hc(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(fc(s)<2)break;const g=hc(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),i=3}else if(i===2){if(fc(s)<8)break;const g=hc(s,8),u=new DataView(g.buffer,g.byteOffset,g.length),m=u.getUint32(0);if(m>Math.pow(2,21)-1){p.enqueue(zd);break}o=m*Math.pow(2,32)+u.getUint32(4),i=3}else{if(fc(s)<o)break;const g=hc(s,o);p.enqueue(wm(c?g:ld.decode(g),e)),i=0}if(o===0||o>n){p.enqueue(zd);break}}}})}const Yx=4;function Ct(n){if(n)return DO(n)}function DO(n){for(var e in Ct.prototype)n[e]=Ct.prototype[e];return n}Ct.prototype.on=Ct.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};Ct.prototype.once=function(n,e){function s(){this.off(n,s),e.apply(this,arguments)}return s.fn=e,this.on(n,s),this};Ct.prototype.off=Ct.prototype.removeListener=Ct.prototype.removeAllListeners=Ct.prototype.removeEventListener=function(n,e){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===e||i.fn===e){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+n],this};Ct.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),s=this._callbacks["$"+n],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,o=s.length;i<o;++i)s[i].apply(this,e)}return this};Ct.prototype.emitReserved=Ct.prototype.emit;Ct.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};Ct.prototype.hasListeners=function(n){return!!this.listeners(n).length};const Tu=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,s)=>s(e,0),In=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),LO="arraybuffer";function Kx(n,...e){return e.reduce((s,i)=>(n.hasOwnProperty(i)&&(s[i]=n[i]),s),{})}const qO=In.setTimeout,PO=In.clearTimeout;function Cu(n,e){e.useNativeTimers?(n.setTimeoutFn=qO.bind(In),n.clearTimeoutFn=PO.bind(In)):(n.setTimeoutFn=In.setTimeout.bind(In),n.clearTimeoutFn=In.clearTimeout.bind(In))}const BO=1.33;function UO(n){return typeof n=="string"?zO(n):Math.ceil((n.byteLength||n.size)*BO)}function zO(n){let e=0,s=0;for(let i=0,o=n.length;i<o;i++)e=n.charCodeAt(i),e<128?s+=1:e<2048?s+=2:e<55296||e>=57344?s+=3:(i++,s+=4);return s}function Jx(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function $O(n){let e="";for(let s in n)n.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(n[s]));return e}function IO(n){let e={},s=n.split("&");for(let i=0,o=s.length;i<o;i++){let c=s[i].split("=");e[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return e}class HO extends Error{constructor(e,s,i){super(e),this.description=s,this.context=i,this.type="TransportError"}}class Sm extends Ct{constructor(e){super(),this.writable=!1,Cu(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,s,i){return super.emitReserved("error",new HO(e,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(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const s=wm(e,this.socket.binaryType);this.onPacket(s)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,s={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_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(e){const s=$O(e);return s.length?"?"+s:""}}class FO extends Sm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const s=()=>{this.readyState="paused",e()};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(e){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)};CO(e,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,TO(e,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Jx()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(e,s)}}let Qx=!1;try{Qx=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const GO=Qx;function VO(){}class YO extends FO{constructor(e){if(super(e),typeof location<"u"){const s=location.protocol==="https:";let i=location.port;i||(i=s?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,s){const i=this.request({method:"POST",data:e});i.on("success",s),i.on("error",(o,c)=>{this.onError("xhr post error",o,c)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=e}}class cr extends Ct{constructor(e,s,i){super(),this.createRequest=e,Cu(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 e;const s=Kx(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{}(e=this._opts.cookieJar)===null||e===void 0||e.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=cr.requestsCount++,cr.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=VO,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete cr.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}cr.requestsCount=0;cr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Eb);else if(typeof addEventListener=="function"){const n="onpagehide"in In?"pagehide":"unload";addEventListener(n,Eb,!1)}}function Eb(){for(let n in cr.requests)cr.requests.hasOwnProperty(n)&&cr.requests[n].abort()}const KO=(function(){const n=Xx({xdomain:!1});return n&&n.responseType!==null})();class JO extends YO{constructor(e){super(e);const s=e&&e.forceBase64;this.supportsBinary=KO&&!s}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new cr(Xx,this.uri(),e)}}function Xx(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||GO))return new XMLHttpRequest}catch{}if(!e)try{return new In[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Wx=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class QO extends Sm{get name(){return"websocket"}doOpen(){const e=this.uri(),s=this.opts.protocols,i=Wx?{}:Kx(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(e,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=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let s=0;s<e.length;s++){const i=e[s],o=s===e.length-1;_m(i,this.supportsBinary,c=>{try{this.doWrite(i,c)}catch{}o&&Tu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Jx()),this.supportsBinary||(s.b64=1),this.createUri(e,s)}}const cd=In.WebSocket||In.MozWebSocket;class XO extends QO{createSocket(e,s,i){return Wx?new cd(e,s,i):s?new cd(e,s):new cd(e)}doWrite(e,s){this.ws.send(s)}}class WO extends Sm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const s=RO(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(s).getReader(),o=MO();o.readable.pipeTo(e.writable),this._writer=o.writable.getWriter();const c=()=>{i.read().then(({done:p,value:g})=>{p||(this.onPacket(g),c())}).catch(p=>{})};c();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let s=0;s<e.length;s++){const i=e[s],o=s===e.length-1;this._writer.write(i).then(()=>{o&&Tu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const ZO={websocket:XO,webtransport:WO,polling:JO},eA=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,tA=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function $d(n){if(n.length>8e3)throw"URI too long";const e=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=eA.exec(n||""),c={},d=14;for(;d--;)c[tA[d]]=o[d]||"";return s!=-1&&i!=-1&&(c.source=e,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=nA(c,c.path),c.queryKey=rA(c,c.query),c}function nA(n,e){const s=/\/{2,9}/g,i=e.replace(s,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function rA(n,e){const s={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,o,c){o&&(s[o]=c)}),s}const Id=typeof addEventListener=="function"&&typeof removeEventListener=="function",ou=[];Id&&addEventListener("offline",()=>{ou.forEach(n=>n())},!1);class Os extends Ct{constructor(e,s){if(super(),this.binaryType=LO,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(s=e,e=null),e){const i=$d(e);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=$d(s.host).host);Cu(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=IO(this.opts.query)),Id&&(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"})},ou.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const s=Object.assign({},this.opts.query);s.EIO=Yx,s.transport=e,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[e]);return new this._transportsByName[e](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Os.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(e);s.open(),this.setTransport(s)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.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",Os.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.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=e.data,this._onError(s);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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 e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.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+=UO(o)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Tu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,s,i){return this._sendPacket("message",e,s,i),this}send(e,s,i){return this._sendPacket("message",e,s,i),this}_sendPacket(e,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:e,data:s,options:i};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),o&&this.once("flush",o),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),e()},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():e()}):this.upgrading?i():e()),this}_onError(e){if(Os.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,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(),Id&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=ou.indexOf(this._offlineEventListener);i!==-1&&ou.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,s),this.writeBuffer=[],this._prevBufferLen=0}}}Os.protocol=Yx;class sA extends Os{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let s=this.createTransport(e),i=!1;Os.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;Os.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 p(){d("transport closed")}function g(){d("socket closed")}function u(b){s&&b.name!==s.name&&c()}const m=()=>{s.removeListener("open",o),s.removeListener("error",d),s.removeListener("close",p),this.off("close",g),this.off("upgrading",u)};s.once("open",o),s.once("error",d),s.once("close",p),this.once("close",g),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const s=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&s.push(e[i]);return s}}let iA=class extends sA{constructor(e,s={}){const i=typeof e=="object"?e:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(o=>ZO[o]).filter(o=>!!o)),super(e,i)}};function aA(n,e="",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=$d(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+e,i.href=i.protocol+"://"+c+(s&&s.port===i.port?"":":"+i.port),i}const oA=typeof ArrayBuffer=="function",lA=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Zx=Object.prototype.toString,cA=typeof Blob=="function"||typeof Blob<"u"&&Zx.call(Blob)==="[object BlobConstructor]",uA=typeof File=="function"||typeof File<"u"&&Zx.call(File)==="[object FileConstructor]";function Em(n){return oA&&(n instanceof ArrayBuffer||lA(n))||cA&&n instanceof Blob||uA&&n instanceof File}function lu(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let s=0,i=n.length;s<i;s++)if(lu(n[s]))return!0;return!1}if(Em(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return lu(n.toJSON(),!0);for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&lu(n[s]))return!0;return!1}function fA(n){const e=[],s=n.data,i=n;return i.data=Hd(s,e),i.attachments=e.length,{packet:i,buffers:e}}function Hd(n,e){if(!n)return n;if(Em(n)){const s={_placeholder:!0,num:e.length};return e.push(n),s}else if(Array.isArray(n)){const s=new Array(n.length);for(let i=0;i<n.length;i++)s[i]=Hd(n[i],e);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]=Hd(n[i],e));return s}return n}function hA(n,e){return n.data=Fd(n.data,e),delete n.attachments,n}function Fd(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let s=0;s<n.length;s++)n[s]=Fd(n[s],e);else if(typeof n=="object")for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]=Fd(n[s],e));return n}const dA=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ve;(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"})(Ve||(Ve={}));class mA{constructor(e){this.replacer=e}encode(e){return(e.type===Ve.EVENT||e.type===Ve.ACK)&&lu(e)?this.encodeAsBinary({type:e.type===Ve.EVENT?Ve.BINARY_EVENT:Ve.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let s=""+e.type;return(e.type===Ve.BINARY_EVENT||e.type===Ve.BINARY_ACK)&&(s+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(s+=e.nsp+","),e.id!=null&&(s+=e.id),e.data!=null&&(s+=JSON.stringify(e.data,this.replacer)),s}encodeAsBinary(e){const s=fA(e),i=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(i),o}}class Om extends Ct{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}:e)}add(e){let s;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(e);const i=s.type===Ve.BINARY_EVENT;i||s.type===Ve.BINARY_ACK?(s.type=i?Ve.EVENT:Ve.ACK,this.reconstructor=new pA(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(Em(e)||e.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(e),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: "+e)}decodeString(e){let s=0;const i={type:Number(e.charAt(0))};if(Ve[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===Ve.BINARY_EVENT||i.type===Ve.BINARY_ACK){const c=s+1;for(;e.charAt(++s)!=="-"&&s!=e.length;);const d=e.substring(c,s);if(d!=Number(d)||e.charAt(s)!=="-")throw new Error("Illegal attachments");const p=Number(d);if(!yA(p)||p<0)throw new Error("Illegal attachments");if(p>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=p}if(e.charAt(s+1)==="/"){const c=s+1;for(;++s&&!(e.charAt(s)===","||s===e.length););i.nsp=e.substring(c,s)}else i.nsp="/";const o=e.charAt(s+1);if(o!==""&&Number(o)==o){const c=s+1;for(;++s;){const d=e.charAt(s);if(d==null||Number(d)!=d){--s;break}if(s===e.length)break}i.id=Number(e.substring(c,s+1))}if(e.charAt(++s)){const c=this.tryParse(e.substr(s));if(Om.isPayloadValid(i.type,c))i.data=c;else throw new Error("invalid payload")}return i}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,s){switch(e){case Ve.CONNECT:return Ob(s);case Ve.DISCONNECT:return s===void 0;case Ve.CONNECT_ERROR:return typeof s=="string"||Ob(s);case Ve.EVENT:case Ve.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&dA.indexOf(s[0])===-1);case Ve.ACK:case Ve.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class pA{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const s=hA(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const yA=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};function Ob(n){return Object.prototype.toString.call(n)==="[object Object]"}const gA=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Om,Encoder:mA,get PacketType(){return Ve}},Symbol.toStringTag,{value:"Module"}));function Wn(n,e,s){return n.on(e,s),function(){n.off(e,s)}}const bA=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ev extends Ct{constructor(e,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=e,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 e=this.io;this.subs=[Wn(e,"open",this.onopen.bind(this)),Wn(e,"packet",this.onpacket.bind(this)),Wn(e,"error",this.onerror.bind(this)),Wn(e,"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(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...s){var i,o,c;if(bA.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(s.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const d={type:Ve.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 p=(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&&!p||(g?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(e,s){var i;const o=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(o===void 0){this.acks[e]=s;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===e&&this.sendBuffer.splice(p,1);s.call(this,new Error("operation has timed out"))},o),d=(...p)=>{this.io.clearTimeoutFn(c),s.apply(this,p)};d.withError=!0,this.acks[e]=d}emitWithAck(e,...s){return new Promise((i,o)=>{const c=(d,p)=>d?o(d):i(p);c.withError=!0,s.push(c),this.emit(e,...s)})}_addToQueue(e){let s;typeof e[e.length-1]=="function"&&(s=e.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.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(e=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!e||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ve.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){const i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ve.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 Ve.EVENT:case Ve.BINARY_EVENT:this.onevent(e);break;case Ve.ACK:case Ve.BINARY_ACK:this.onack(e);break;case Ve.DISCONNECT:this.ondisconnect();break;case Ve.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){const s=e.data||[];e.id!=null&&s.push(this.ack(e.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const i of s)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const s=this;let i=!1;return function(...o){i||(i=!0,s.packet({type:Ve.ACK,id:e,data:o}))}}onack(e){const s=this.acks[e.id];typeof s=="function"&&(delete this.acks[e.id],s.withError&&e.data.unshift(null),s.apply(this,e.data))}onconnect(e,s){this.id=e,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ve.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const s=this._anyListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const i of s)i.apply(this,e.data)}}}function ua(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}ua.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),s=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-s:n+s}return Math.min(n,this.max)|0};ua.prototype.reset=function(){this.attempts=0};ua.prototype.setMin=function(n){this.ms=n};ua.prototype.setMax=function(n){this.max=n};ua.prototype.setJitter=function(n){this.jitter=n};class Gd extends Ct{constructor(e,s){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(s=e,e=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Cu(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 ua({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=e;const o=s.parser||gA;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var s;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(s=this.backoff)===null||s===void 0||s.setMin(e),this)}randomizationFactor(e){var s;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(s=this.backoff)===null||s===void 0||s.setJitter(e),this)}reconnectionDelayMax(e){var s;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(s=this.backoff)===null||s===void 0||s.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new iA(this.uri,this.opts);const s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const o=Wn(s,"open",function(){i.onopen(),e&&e()}),c=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),e?e(p):this.maybeReconnectOnOpen()},d=Wn(s,"error",c);if(this._timeout!==!1){const p=this._timeout,g=this.setTimeoutFn(()=>{o(),c(new Error("timeout")),s.close()},p);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(d),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Wn(e,"ping",this.onping.bind(this)),Wn(e,"data",this.ondata.bind(this)),Wn(e,"error",this.onerror.bind(this)),Wn(e,"close",this.onclose.bind(this)),Wn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(s){this.onclose("parse error",s)}}ondecoded(e){Tu(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,s){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new ev(this,e,s),this.nsps[e]=i),i}_destroy(e){const s=Object.keys(this.nsps);for(const i of s)if(this.nsps[i].active)return;this._close()}_packet(e){const s=this.encoder.encode(e);for(let i=0;i<s.length;i++)this.engine.write(s[i],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,s){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=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(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(o=>{o?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",o)):e.onreconnect()}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const lo={};function cu(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const s=aA(n,e.path||"/socket.io"),i=s.source,o=s.id,c=s.path,d=lo[o]&&c in lo[o].nsps,p=e.forceNew||e["force new connection"]||e.multiplex===!1||d;let g;return p?g=new Gd(i,e):(lo[o]||(lo[o]=new Gd(i,e)),g=lo[o]),s.query&&!e.query&&(e.query=s.queryKey),g.socket(s.path,e)}Object.assign(cu,{Manager:Gd,Socket:ev,io:cu,connect:cu});const xA=E.createContext({connected:!1,subscribe:()=>()=>{}});function vA({children:n}){const{isAuthenticated:e}=qt(),s=E.useRef(null),[i,o]=E.useState(!1),c=E.useRef(new Map),d=E.useCallback((g,u)=>{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(u),()=>{var v;const x=m.get(g);x&&(x.delete(u),x.size===0&&(m.delete(g),(v=s.current)==null||v.emit("lt.unsubscribe",g)))}},[]),p=E.useCallback((g,u)=>{for(const[m,b]of c.current)if(Ux(g,m))for(const x of b)try{x(u)}catch{}},[]);return E.useEffect(()=>{if(!e)return;const g=cu({path:`${Yt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,auth:u=>{const m=Ed();u(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 u of c.current.keys())g.emit("lt.subscribe",u)}),g.on("disconnect",u=>{console.log("[lt-socketio] disconnected:",u),o(!1)}),g.on("connect_error",u=>{console.warn("[lt-socketio] connect error:",u.message),o(!1)}),g.onAny((u,m)=>{if(u.startsWith("lt."))try{const b=typeof m=="string"?JSON.parse(m):m;p(u,b)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),s.current=null,o(!1)}},[p,e]),h.jsx(xA.Provider,{value:{connected:i,subscribe:d},children:h.jsx(ca.Provider,{value:{connected:i,subscribe:d},children:n})})}function _A({children:n}){const{isAuthenticated:e}=qt(),s=qe(),[i,o]=E.useState(null),[c,d]=E.useState({url:null,policy:Qg(null)});E.useEffect(()=>{let u=!1;async function m(){var b;try{console.log("[lt-transport] detecting event transport...");const x=await hm(),v=(b=x==null?void 0:x.events)==null?void 0:b.transport;console.log("[lt-transport] server reports:",v),u||(v==="nats"&&d({url:x.events.natsWsUrl??null,policy:Qg(x.events.reconnect)}),o(v==="nats"?"nats":"socketio"))}catch(x){console.warn("[lt-transport] settings fetch error, falling back to socketio",x),u||o("socketio")}}return m(),()=>{u=!0}},[e]);const p=E.useCallback(()=>xE(c.url),[c.url]),g=E.useCallback(()=>{s.invalidateQueries({refetchType:"active"})},[s]);return i==="nats"?h.jsx(OO,{resolveCredentials:p,policy:c.policy,onReconnect:g,sessionKey:e,children:n}):i==="socketio"?h.jsx(vA,{children:n}):h.jsx(h.Fragment,{children:n})}const Am="lt_view_as",jm="lt_ai_override",Vd="lt_graph_enabled",Yd="lt_infrastructure_enabled",km="lt_scan_override";function tv(){try{const n=localStorage.getItem(jm);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function wA(n){try{localStorage.setItem(jm,String(n))}catch{}}function SA(){try{localStorage.removeItem(jm)}catch{}}function Nm(){try{const n=localStorage.getItem(Am);if(n==="admin"||n==="engineer"||n==="operator")return n}catch{}return null}function EA(n){try{localStorage.setItem(Am,n)}catch{}window.location.reload()}function Kd(){try{localStorage.removeItem(Am)}catch{}window.location.reload()}function nv(){try{return localStorage.getItem(Vd)==="true"}catch{return!1}}function OA(n){try{n?localStorage.setItem(Vd,"true"):localStorage.removeItem(Vd)}catch{}}function rv(){try{return localStorage.getItem(Yd)==="true"}catch{return!1}}function AA(n){try{n?localStorage.setItem(Yd,"true"):localStorage.removeItem(Yd)}catch{}}function sv(){try{const n=localStorage.getItem(km);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function jA(n){try{localStorage.setItem(km,String(n))}catch{}}function kA(){try{localStorage.removeItem(km)}catch{}}const NA="credential-issuer";function iv(){const{isSuperAdmin:n,hasRoleType:e,hasRole:s}=qt(),i=Nm(),o=n||s("engineer"),c=e("admin"),d=n||e("admin"),p=i?!1:o,g=i?i==="admin"||i==="engineer":c,u=i?i==="admin":d,m=u,b=i?!1:n||s(NA);return{isBuilder:p,isOps:g,canBulk:u,canAdminister:m,canIssueCredentials:b,viewAs:i,realIsBuilder:o}}function av(){var u;const{isSuperAdmin:n,hasRoleType:e,hasRole:s}=qt(),{data:i}=Hn(),o=((u=i==null?void 0:i.features)==null?void 0:u.publicPaceBoard)!==!1,c=n?"superadmin":e("admin")?"admin":s("engineer")?"engineer":"operator",d=Nm(),p=d==="admin"||d==="engineer"||d==="operator"?d:null,g=p??c;return{tier:g,realTier:c,viewAs:p,canSeePaceBoard:o||g==="superadmin"||g==="admin",canSeeWorkflows:g==="superadmin"||g==="engineer",showTaskQueueCards:g==="operator"&&!o}}const Tm=E.createContext(null);function Mu(){const n=E.useContext(Tm);if(!n)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return n}function TA(){var n;return((n=E.useContext(Tm))==null?void 0:n.identity)??null}function CA({children:n}){const[e,s]=E.useState(null),i=E.useRef(e);i.current=e,E.useEffect(()=>{if(!(e!=null&&e.expiresAt))return;const m=new Date(e.expiresAt).getTime()-Date.now();if(m<=0){s(null);return}const b=setTimeout(()=>s(null),m);return()=>clearTimeout(b)},[e]);const o=E.useCallback(m=>{var x;if(!m.actingToken||!m.actor)return null;const b=((x=i.current)==null?void 0:x.actingToken)??null;return s({actingToken:m.actingToken,actorId:m.actor.id,displayName:m.actor.displayName,expiresAt:m.expiresAt??null,subjectScoped:m.grantScope==="subject"}),b},[]),c=E.useCallback(()=>s(null),[]),d=E.useCallback((m,b)=>{const x=i.current;b===0&&(x==null?void 0:x.actingToken)===m&&s(null)},[]),p=E.useCallback((m,b)=>{const x=i.current;if(!x||x.actingToken!==m||!b.acting)return;const{consumed:v,remaining:_,bound:S}=b.acting;(v&&_===0||S&&b.clearSubject)&&s(null)},[]);E.useEffect(()=>(Gg(()=>{var m;return((m=i.current)==null?void 0:m.actingToken)??null}),Yg(c),Vg(d),()=>{Gg(null),Yg(null),Vg(null)}),[c,d]);const g=E.useCallback(()=>{var b;const m=(b=i.current)==null?void 0:b.expiresAt;return m?Math.max(0,Math.floor((new Date(m).getTime()-Date.now())/1e3)):0},[]),u=E.useMemo(()=>({identity:e,prime:o,clear:c,settle:p,remainingSeconds:g}),[e,o,c,p,g]);return h.jsx(Tm.Provider,{value:u,children:n})}function MA(){const{user:n}=qt(),{identity:e}=Mu(),s=n==null?void 0:n.userId,i=e==null?void 0:e.actorId,o=E.useCallback(c=>!!c&&(c===i||c===s),[i,s]);return{viewerId:i??s,isViewer:o}}function ov(n){return(n??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function fr(n={}){const e=n.role?ov(n.role):"*",s=n.id??"*",i=n.verb??">";return`${Wt}.system.escalation.${e}.${s}.${i}`}function Jd(n){return n.verbs.map(e=>fr({role:n.role,verb:e}))}function Cm(n){const{user:e,isSuperAdmin:s,hasRoleType:i}=qt(),o=s||i("admin"),c=((e==null?void 0:e.roles)??[]).map(p=>p.role).sort().join(","),d=(n??[]).join(",");return E.useMemo(()=>{const p=d?d.split(","):null;return o||!c?p?Jd({verbs:p}):[fr({})]:c.split(",").flatMap(g=>p?Jd({role:g,verbs:p}):[fr({role:g})])},[o,c,d])}const Qd="/escalations/detail/";function RA(n){return n.startsWith(Qd)&&n.slice(Qd.length).split("/")[0]||void 0}function DA(){const{isViewer:n}=MA(),e=ri(),s=tn(),i=E.useRef(s.pathname);i.current=s.pathname;const o=E.useRef(n);o.current=n;const c=E.useCallback(d=>{var b,x,v;if((d==null?void 0:d.assignedAtCreation)!==!0)return;const p=(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,u=(v=d==null?void 0:d.data)==null?void 0:v.parent_id;if(!p||!o.current(g)||!u||u!==RA(i.current))return;const m=`${Qd}${p}`;i.current!==m&&e(m)},[e]);Ns(Cm(["claimed"]),c)}const lv=6048e5,LA=864e5,Ab=6e4,jb=525600,kb=43200,Nb=1440,Tb=Symbol.for("constructDateFrom");function Br(n,e){return typeof n=="function"?n(e):n&&typeof n=="object"&&Tb in n?n[Tb](e):n instanceof Date?new n.constructor(e):new Date(e)}function kn(n,e){return Br(e||n,n)}let qA={};function qo(){return qA}function Co(n,e){var p,g,u,m;const s=qo(),i=(e==null?void 0:e.weekStartsOn)??((g=(p=e==null?void 0:e.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((m=(u=s.locale)==null?void 0:u.options)==null?void 0:m.weekStartsOn)??0,o=kn(n,e==null?void 0:e.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 xu(n,e){return Co(n,{...e,weekStartsOn:1})}function cv(n,e){const s=kn(n,e==null?void 0:e.in),i=s.getFullYear(),o=Br(s,0);o.setFullYear(i+1,0,4),o.setHours(0,0,0,0);const c=xu(o),d=Br(s,0);d.setFullYear(i,0,4),d.setHours(0,0,0,0);const p=xu(d);return s.getTime()>=c.getTime()?i+1:s.getTime()>=p.getTime()?i:i-1}function vu(n){const e=kn(n),s=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return s.setUTCFullYear(e.getFullYear()),+n-+s}function uv(n,...e){const s=Br.bind(null,n||e.find(i=>typeof i=="object"));return e.map(s)}function Cb(n,e){const s=kn(n,e==null?void 0:e.in);return s.setHours(0,0,0,0),s}function PA(n,e,s){const[i,o]=uv(s==null?void 0:s.in,n,e),c=Cb(i),d=Cb(o),p=+c-vu(c),g=+d-vu(d);return Math.round((p-g)/LA)}function BA(n,e){const s=cv(n,e),i=Br(n,0);return i.setFullYear(s,0,4),i.setHours(0,0,0,0),xu(i)}function UA(n,e){const s=+kn(n)-+kn(e);return s<0?-1:s>0?1:s}function zA(n){return Br(n,Date.now())}function $A(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function IA(n){return!(!$A(n)&&typeof n!="number"||isNaN(+kn(n)))}function HA(n){return e=>{const i=(n?Math[n]:Math.trunc)(e);return i===0?0:i}}function FA(n,e){const s=kn(n,e==null?void 0:e.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const GA={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"}},VA=(n,e,s)=>{let i;const o=GA[n];return typeof o=="string"?i=o:e===1?i=o.one:i=o.other.replace("{{count}}",e.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+i:i+" ago":i};function ud(n){return(e={})=>{const s=e.width?String(e.width):n.defaultWidth;return n.formats[s]||n.formats[n.defaultWidth]}}const YA={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},KA={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},JA={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},QA={date:ud({formats:YA,defaultWidth:"full"}),time:ud({formats:KA,defaultWidth:"full"}),dateTime:ud({formats:JA,defaultWidth:"full"})},XA={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},WA=(n,e,s,i)=>XA[n];function co(n){return(e,s)=>{const i=s!=null&&s.context?String(s.context):"standalone";let o;if(i==="formatting"&&n.formattingValues){const d=n.defaultFormattingWidth||n.defaultWidth,p=s!=null&&s.width?String(s.width):d;o=n.formattingValues[p]||n.formattingValues[d]}else{const d=n.defaultWidth,p=s!=null&&s.width?String(s.width):n.defaultWidth;o=n.values[p]||n.values[d]}const c=n.argumentCallback?n.argumentCallback(e):e;return o[c]}}const ZA={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},ej={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},tj={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"]},nj={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"]},rj={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"}},sj={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"}},ij=(n,e)=>{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"},aj={ordinalNumber:ij,era:co({values:ZA,defaultWidth:"wide"}),quarter:co({values:ej,defaultWidth:"wide",argumentCallback:n=>n-1}),month:co({values:tj,defaultWidth:"wide"}),day:co({values:nj,defaultWidth:"wide"}),dayPeriod:co({values:rj,defaultWidth:"wide",formattingValues:sj,defaultFormattingWidth:"wide"})};function uo(n){return(e,s={})=>{const i=s.width,o=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],c=e.match(o);if(!c)return null;const d=c[0],p=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],g=Array.isArray(p)?lj(p,b=>b.test(d)):oj(p,b=>b.test(d));let u;u=n.valueCallback?n.valueCallback(g):g,u=s.valueCallback?s.valueCallback(u):u;const m=e.slice(d.length);return{value:u,rest:m}}}function oj(n,e){for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&e(n[s]))return s}function lj(n,e){for(let s=0;s<n.length;s++)if(e(n[s]))return s}function cj(n){return(e,s={})=>{const i=e.match(n.matchPattern);if(!i)return null;const o=i[0],c=e.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 p=e.slice(o.length);return{value:d,rest:p}}}const uj=/^(\d+)(th|st|nd|rd)?/i,fj=/\d+/i,hj={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},dj={any:[/^b/i,/^(a|c)/i]},mj={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},pj={any:[/1/i,/2/i,/3/i,/4/i]},yj={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},gj={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]},bj={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},xj={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]},vj={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},_j={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}},wj={ordinalNumber:cj({matchPattern:uj,parsePattern:fj,valueCallback:n=>parseInt(n,10)}),era:uo({matchPatterns:hj,defaultMatchWidth:"wide",parsePatterns:dj,defaultParseWidth:"any"}),quarter:uo({matchPatterns:mj,defaultMatchWidth:"wide",parsePatterns:pj,defaultParseWidth:"any",valueCallback:n=>n+1}),month:uo({matchPatterns:yj,defaultMatchWidth:"wide",parsePatterns:gj,defaultParseWidth:"any"}),day:uo({matchPatterns:bj,defaultMatchWidth:"wide",parsePatterns:xj,defaultParseWidth:"any"}),dayPeriod:uo({matchPatterns:vj,defaultMatchWidth:"any",parsePatterns:_j,defaultParseWidth:"any"})},fv={code:"en-US",formatDistance:VA,formatLong:QA,formatRelative:WA,localize:aj,match:wj,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Sj(n,e){const s=kn(n,e==null?void 0:e.in);return PA(s,FA(s))+1}function Ej(n,e){const s=kn(n,e==null?void 0:e.in),i=+xu(s)-+BA(s);return Math.round(i/lv)+1}function hv(n,e){var m,b,x,v;const s=kn(n,e==null?void 0:e.in),i=s.getFullYear(),o=qo(),c=(e==null?void 0:e.firstWeekContainsDate)??((b=(m=e==null?void 0:e.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((e==null?void 0:e.in)||n,0);d.setFullYear(i+1,0,c),d.setHours(0,0,0,0);const p=Co(d,e),g=Br((e==null?void 0:e.in)||n,0);g.setFullYear(i,0,c),g.setHours(0,0,0,0);const u=Co(g,e);return+s>=+p?i+1:+s>=+u?i:i-1}function Oj(n,e){var p,g,u,m;const s=qo(),i=(e==null?void 0:e.firstWeekContainsDate)??((g=(p=e==null?void 0:e.locale)==null?void 0:p.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((m=(u=s.locale)==null?void 0:u.options)==null?void 0:m.firstWeekContainsDate)??1,o=hv(n,e),c=Br((e==null?void 0:e.in)||n,0);return c.setFullYear(o,0,i),c.setHours(0,0,0,0),Co(c,e)}function Aj(n,e){const s=kn(n,e==null?void 0:e.in),i=+Co(s,e)-+Oj(s,e);return Math.round(i/lv)+1}function et(n,e){const s=n<0?"-":"",i=Math.abs(n).toString().padStart(e,"0");return s+i}const ys={y(n,e){const s=n.getFullYear(),i=s>0?s:1-s;return et(e==="yy"?i%100:i,e.length)},M(n,e){const s=n.getMonth();return e==="M"?String(s+1):et(s+1,2)},d(n,e){return et(n.getDate(),e.length)},a(n,e){const s=n.getHours()/12>=1?"pm":"am";switch(e){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,e){return et(n.getHours()%12||12,e.length)},H(n,e){return et(n.getHours(),e.length)},m(n,e){return et(n.getMinutes(),e.length)},s(n,e){return et(n.getSeconds(),e.length)},S(n,e){const s=e.length,i=n.getMilliseconds(),o=Math.trunc(i*Math.pow(10,s-3));return et(o,e.length)}},Fi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Mb={G:function(n,e,s){const i=n.getFullYear()>0?1:0;switch(e){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,e,s){if(e==="yo"){const i=n.getFullYear(),o=i>0?i:1-i;return s.ordinalNumber(o,{unit:"year"})}return ys.y(n,e)},Y:function(n,e,s,i){const o=hv(n,i),c=o>0?o:1-o;if(e==="YY"){const d=c%100;return et(d,2)}return e==="Yo"?s.ordinalNumber(c,{unit:"year"}):et(c,e.length)},R:function(n,e){const s=cv(n);return et(s,e.length)},u:function(n,e){const s=n.getFullYear();return et(s,e.length)},Q:function(n,e,s){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return et(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,e,s){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return et(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,e,s){const i=n.getMonth();switch(e){case"M":case"MM":return ys.M(n,e);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,e,s){const i=n.getMonth();switch(e){case"L":return String(i+1);case"LL":return et(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,e,s,i){const o=Aj(n,i);return e==="wo"?s.ordinalNumber(o,{unit:"week"}):et(o,e.length)},I:function(n,e,s){const i=Ej(n);return e==="Io"?s.ordinalNumber(i,{unit:"week"}):et(i,e.length)},d:function(n,e,s){return e==="do"?s.ordinalNumber(n.getDate(),{unit:"date"}):ys.d(n,e)},D:function(n,e,s){const i=Sj(n);return e==="Do"?s.ordinalNumber(i,{unit:"dayOfYear"}):et(i,e.length)},E:function(n,e,s){const i=n.getDay();switch(e){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,e,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(c);case"ee":return et(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,e,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(c);case"cc":return et(c,e.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,e,s){const i=n.getDay(),o=i===0?7:i;switch(e){case"i":return String(o);case"ii":return et(o,e.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,e,s){const o=n.getHours()/12>=1?"pm":"am";switch(e){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,e,s){const i=n.getHours();let o;switch(i===12?o=Fi.noon:i===0?o=Fi.midnight:o=i/12>=1?"pm":"am",e){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,e,s){const i=n.getHours();let o;switch(i>=17?o=Fi.evening:i>=12?o=Fi.afternoon:i>=4?o=Fi.morning:o=Fi.night,e){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,e,s){if(e==="ho"){let i=n.getHours()%12;return i===0&&(i=12),s.ordinalNumber(i,{unit:"hour"})}return ys.h(n,e)},H:function(n,e,s){return e==="Ho"?s.ordinalNumber(n.getHours(),{unit:"hour"}):ys.H(n,e)},K:function(n,e,s){const i=n.getHours()%12;return e==="Ko"?s.ordinalNumber(i,{unit:"hour"}):et(i,e.length)},k:function(n,e,s){let i=n.getHours();return i===0&&(i=24),e==="ko"?s.ordinalNumber(i,{unit:"hour"}):et(i,e.length)},m:function(n,e,s){return e==="mo"?s.ordinalNumber(n.getMinutes(),{unit:"minute"}):ys.m(n,e)},s:function(n,e,s){return e==="so"?s.ordinalNumber(n.getSeconds(),{unit:"second"}):ys.s(n,e)},S:function(n,e){return ys.S(n,e)},X:function(n,e,s){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return Db(i);case"XXXX":case"XX":return ei(i);case"XXXXX":case"XXX":default:return ei(i,":")}},x:function(n,e,s){const i=n.getTimezoneOffset();switch(e){case"x":return Db(i);case"xxxx":case"xx":return ei(i);case"xxxxx":case"xxx":default:return ei(i,":")}},O:function(n,e,s){const i=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Rb(i,":");case"OOOO":default:return"GMT"+ei(i,":")}},z:function(n,e,s){const i=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Rb(i,":");case"zzzz":default:return"GMT"+ei(i,":")}},t:function(n,e,s){const i=Math.trunc(+n/1e3);return et(i,e.length)},T:function(n,e,s){return et(+n,e.length)}};function Rb(n,e=""){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)+e+et(c,2)}function Db(n,e){return n%60===0?(n>0?"-":"+")+et(Math.abs(n)/60,2):ei(n,e)}function ei(n,e=""){const s=n>0?"-":"+",i=Math.abs(n),o=et(Math.trunc(i/60),2),c=et(i%60,2);return s+o+e+c}const Lb=(n,e)=>{switch(n){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},dv=(n,e)=>{switch(n){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},jj=(n,e)=>{const s=n.match(/(P+)(p+)?/)||[],i=s[1],o=s[2];if(!o)return Lb(n,e);let c;switch(i){case"P":c=e.dateTime({width:"short"});break;case"PP":c=e.dateTime({width:"medium"});break;case"PPP":c=e.dateTime({width:"long"});break;case"PPPP":default:c=e.dateTime({width:"full"});break}return c.replace("{{date}}",Lb(i,e)).replace("{{time}}",dv(o,e))},kj={p:dv,P:jj},Nj=/^D+$/,Tj=/^Y+$/,Cj=["D","DD","YY","YYYY"];function Mj(n){return Nj.test(n)}function Rj(n){return Tj.test(n)}function Dj(n,e,s){const i=Lj(n,e,s);if(console.warn(i),Cj.includes(n))throw new RangeError(i)}function Lj(n,e,s){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${i} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const qj=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Pj=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bj=/^'([^]*?)'?$/,Uj=/''/g,zj=/[a-zA-Z]/;function $j(n,e,s){var m,b,x,v;const i=qo(),o=i.locale??fv,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,p=kn(n,s==null?void 0:s.in);if(!IA(p))throw new RangeError("Invalid time value");let g=e.match(Pj).map(_=>{const S=_[0];if(S==="p"||S==="P"){const C=kj[S];return C(_,o.formatLong)}return _}).join("").match(qj).map(_=>{if(_==="''")return{isToken:!1,value:"'"};const S=_[0];if(S==="'")return{isToken:!1,value:Ij(_)};if(Mb[S])return{isToken:!0,value:_};if(S.match(zj))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:_}});o.localize.preprocessor&&(g=o.localize.preprocessor(p,g));const u={firstWeekContainsDate:c,weekStartsOn:d,locale:o};return g.map(_=>{if(!_.isToken)return _.value;const S=_.value;(Rj(S)||Mj(S))&&Dj(S,e,String(n));const C=Mb[S[0]];return C(p,S,o.localize,u)}).join("")}function Ij(n){const e=n.match(Bj);return e?e[1].replace(Uj,"'"):n}function Hj(n,e,s){const i=qo(),o=(s==null?void 0:s.locale)??i.locale??fv,c=UA(n,e);if(isNaN(c))throw new RangeError("Invalid time value");const d=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:c}),[p,g]=uv(s==null?void 0:s.in,...c>0?[e,n]:[n,e]),u=HA((s==null?void 0:s.roundingMethod)??"round"),m=g.getTime()-p.getTime(),b=m/Ab,x=vu(g)-vu(p),v=(m-x)/Ab,_=s==null?void 0:s.unit;let S;if(_?S=_:b<1?S="second":b<60?S="minute":b<Nb?S="hour":v<kb?S="day":v<jb?S="month":S="year",S==="second"){const C=u(m/1e3);return o.formatDistance("xSeconds",C,d)}else if(S==="minute"){const C=u(b);return o.formatDistance("xMinutes",C,d)}else if(S==="hour"){const C=u(b/60);return o.formatDistance("xHours",C,d)}else if(S==="day"){const C=u(v/Nb);return o.formatDistance("xDays",C,d)}else if(S==="month"){const C=u(v/kb);return C===12&&_!=="month"?o.formatDistance("xYears",1,d):o.formatDistance("xMonths",C,d)}else{const C=u(v/jb);return o.formatDistance("xYears",C,d)}}function Fj(n,e){return Hj(n,zA(n),e)}let _u=null;function Gj(n){_u=n||null}function Vj(){return _u}function Yj(n,e,s){const i=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...s?{second:"2-digit"}:{},hour12:!0}).formatToParts(n);return Object.fromEntries(i.map(o=>[o.type,o.value]))}function Mm(n,e=!1){const s=typeof n=="string"?new Date(n):n;if(Number.isNaN(s.getTime()))return String(n);if(!_u)return $j(s,e?"MMM d, yyyy h:mm:ss a":"MMM d, yyyy h:mm a");const i=Yj(s,_u,e),o=`${i.hour}:${i.minute}${e?`:${i.second}`:""}`;return`${i.month} ${i.day}, ${i.year} ${o} ${i.dayPeriod}`}function mv(n){const e=n??[];return e.length>0&&e.every(s=>s.type==="member"&&s.write_scope==="none")}function H5(n,e,s){return!e||!mv(n)?!0:!!s&&!s.subjectScoped}const Rm={staleTime:5*6e4,refetchOnWindowFocus:!1};function F5(n={},e={}){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)),Le({queryKey:["users",n],queryFn:()=>ue(`/users?${s}`),enabled:e.enabled??!0,...Rm})}const qb=200;async function Kj(n){const e=[];for(let s=0;s<n.length;s+=qb){const i=await ue("/users/names",{method:"POST",body:JSON.stringify({ids:n.slice(s,s+qb)})});e.push(...i.users??[])}return e}let Xd=[],Wd=new Map,Zd=!1;function Jj(){const n=Xd,e=Wd;Xd=[],Wd=new Map,Zd=!1,Kj(n).then(s=>{const i=new Map(s.map(o=>[o.id,o]));for(const[o,c]of e)c.resolve(i.get(o)??null)}).catch(s=>{for(const i of e.values())i.reject(s)})}function Qj(n){return new Promise((e,s)=>{Xd.push(n),Wd.set(n,{resolve:e,reject:s}),Zd||(Zd=!0,setTimeout(Jj,0))})}function G5(n){return Le({queryKey:["user-name",n],queryFn:()=>Qj(n),enabled:!!n,...Rm})}function Xj(n){return Le({queryKey:["users",n,"roles"],queryFn:async()=>(await ue(`/users/${n}/roles`)).roles??[],enabled:!!n,...Rm})}function V5(){const n=qe();return ze({mutationFn:e=>ue("/users",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function Y5(){const n=qe();return ze({mutationFn:({id:e,...s})=>ue(`/users/${e}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function K5(){const n=qe();return ze({mutationFn:({id:e,ops:s})=>ue(`/users/${e}/properties`,{method:"PATCH",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function J5(){return Le({queryKey:["users","system-property-keys"],queryFn:()=>ue("/users/system-property-keys")})}function Q5(){const n=qe();return ze({mutationFn:e=>ue(`/users/${e}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function X5(){const n=qe();return ze({mutationFn:({userId:e,role:s,type:i,read_scope:o,write_scope:c})=>ue(`/users/${e}/roles`,{method:"POST",body:JSON.stringify({role:s,type:i,read_scope:o,write_scope:c})}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function W5(){const n=qe();return ze({mutationFn:({userId:e,role:s})=>ue(`/users/${e}/roles/${encodeURIComponent(s)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}const Z5={MAX_PORTALS:12,MAX_ROWS:4,MAX_COLS:6,MAX_COUNTS:8};function Wj(){return Le({queryKey:["roles"],queryFn:()=>ue("/roles")})}function Ru(n){return Le({queryKey:["roles","details"],queryFn:()=>ue("/roles/details"),enabled:(n==null?void 0:n.enabled)??!0})}function eM(n,e,s=!0){return Le({queryKey:["roles",n,"schema",e??"latest"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/schema${e!=null?`?version=${e}`:""}`),enabled:s&&!!n})}function tM(n){return Le({queryKey:["roles",n,"schema-versions"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/schema/versions`),enabled:!!n})}function nM(n,e,s=!0){return Le({queryKey:["roles",n,"list-schema",e??"latest"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/list-schema${e!=null?`?version=${e}`:""}`),enabled:s&&!!n})}function rM(n){return Le({queryKey:["roles",n,"list-schema-versions"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/list-schema/versions`),enabled:!!n})}function sM(){const n=qe();return ze({mutationFn:e=>ue("/roles",{method:"POST",body:JSON.stringify({role:e})}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function iM(){const n=qe();return ze({mutationFn:({role:e,...s})=>ue(`/roles/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:e,...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===e?{...o,...s}:o)}),{previous:i}},onError:(e,s,i)=>{i!=null&&i.previous&&n.setQueryData(["roles","details"],i.previous)},onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function aM(){const n=qe();return ze({mutationFn:e=>ue(`/roles/${encodeURIComponent(e)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}const pv="lt:station:kiosk-role:";function em(n){return`${pv}${n}`}const tm=new Set;function Zj(){for(const n of tm)n()}function ek(n){try{return localStorage.getItem(em(n))}catch{return null}}function tk(n,e){try{e===null?localStorage.removeItem(em(n)):localStorage.setItem(em(n),e)}catch{}Zj()}function nk(n){tm.add(n);const e=s=>{(s.key===null||s.key.startsWith(pv))&&n()};try{window.addEventListener("storage",e)}catch{}return()=>{tm.delete(n);try{window.removeEventListener("storage",e)}catch{}}}function rk(n){return E.useSyncExternalStore(nk,()=>n?ek(n):null)}const wu="/portal";function sk(n){return n===wu||n.startsWith(`${wu}/`)}function Dm(n,e){const s=`${wu}/${encodeURIComponent(n)}`;return e?`${s}/${encodeURIComponent(e)}`:s}function na(n){return Array.isArray(n==null?void 0:n.portals)?n.portals:[]}function ik(n){return na(n).length>0}function oM(n,e){const s=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"portal",i=new Set(e);if(!i.has(s))return s;let o=2;for(;i.has(`${s}-${o}`);)o+=1;return`${s}-${o}`}function yv(n,e){return e.length>0?Dm(n,e[0].key):`/escalations/available?role=${encodeURIComponent(n)}&status=available`}function Lm(){const{user:n}=qt(),e=(n==null?void 0:n.userId)??null,{data:s}=Xj(e),{data:i}=Ru(),o=rk(e),c=E.useCallback(d=>{e&&tk(e,d)},[e]);return E.useMemo(()=>{const d={kiosk:!1,role:null,homePath:null,targets:[],selectable:!1,selectRole:c},p=s??[];if(p.length===0||p.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)},u=v=>{var _,S;return((S=(_=g(v))==null?void 0:_.properties)==null?void 0:S.kiosk)===!0},m=p.map(v=>v.role).filter(u),b=v=>({kiosk:!0,role:v,homePath:yv(v,na(g(v))),targets:m,selectable:m.length>=2,selectRole:c});if(p.length===1)return m.length===1?b(m[0]):d;if(!mv(p)||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 ak="/escalations/available",ok=["/escalations",wu,"/scan","/login"];function lk(n,e=""){if(n===ak){const s=new URLSearchParams(e);if(!s.get("role")&&!s.get("facets"))return!1}return ok.some(s=>n===s||n.startsWith(`${s}/`)||n.startsWith(`${s}?`))}const qm=E.createContext(null),fd="lt_sidebar_collapsed",gv="(max-width: 1023px)";function ck(){try{return window.matchMedia(gv).matches}catch{return!1}}function uk({children:n}){const[e,s]=E.useState(()=>{if(ck())return!0;try{return localStorage.getItem(fd)==="true"}catch{return!1}});E.useEffect(()=>{let o;try{o=window.matchMedia(gv)}catch{return}const c=d=>{if(d.matches)s(!0);else try{s(localStorage.getItem(fd)==="true")}catch{s(!1)}};return o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[]);const i=E.useCallback(()=>{s(o=>{const c=!o;try{localStorage.setItem(fd,String(c))}catch{}return c})},[]);return h.jsx(qm.Provider,{value:{collapsed:e,toggle:i},children:n})}function fk({children:n}){return h.jsx(qm.Provider,{value:{collapsed:!1,toggle:()=>{}},children:n})}function Pm(){const n=E.useContext(qm);if(!n)throw new Error("useSidebar must be used within SidebarProvider");return n}const Pb=380,Bm=E.createContext(null);function hk({children:n}){const[e,s]=E.useState({node:null,width:Pb,open:!1,ownerKey:null}),i=tn(),o=E.useRef(i.pathname),c=E.useCallback((p,g)=>{s({node:p,width:(g==null?void 0:g.width)??Pb,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),d=E.useCallback(p=>{s(g=>typeof p=="string"&&g.ownerKey!==p?g:{...g,open:!1})},[]);return E.useEffect(()=>{i.pathname!==o.current&&(o.current=i.pathname,s(p=>p.open||p.node?{...p,node:null,open:!1,ownerKey:null}:p))},[i.pathname]),h.jsx(Bm.Provider,{value:{...e,setPanel:c,closePanel:d},children:n})}function Um(){const n=E.useContext(Bm);if(!n)throw new Error("useShellPanel must be used within ShellPanelProvider");return n}function lM(){return E.useContext(Bm)}function dk({open:n,width:e=380,children:s,className:i=""}){const[o,c]=E.useState(n);return E.useEffect(()=>{n&&c(!0)},[n]),h.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${i}`,style:{width:n?e:0,maxWidth:"50%"},onTransitionEnd:d=>{!n&&d.propertyName==="width"&&c(!1)},children:h.jsx("div",{style:{width:e},className:"h-full",children:o?s:null})})}function cM({label:n,children:e}){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:e})]})}function uM({views:n,activeId:e,onViewChange:s,onClose:i,headerActions:o,stickyClassName:c,labelInline:d}){const p=n.find(g=>g.id===e)??n[0];return p?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 u=g.icon,m=g.id===p.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(u,{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:p.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(en,{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:p.label}),h.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${d?"pt-4 pb-8":"pb-5 pt-1"}`,children:p.content})]})}):null}function bv(n,e){var s,i,o,c,d;e.facets&&Object.keys(e.facets).length&&n.set("facets",JSON.stringify(e.facets)),(s=e.block)!=null&&s.length&&n.set("block",JSON.stringify(e.block)),(i=e.range)!=null&&i.length&&n.set("range",JSON.stringify(e.range)),(o=e.exists)!=null&&o.length&&n.set("exists",JSON.stringify(e.exists)),(c=e.roles)!=null&&c.length&&n.set("roles",JSON.stringify(e.roles)),(d=e.orderBy)!=null&&d.length&&n.set("orderBy",JSON.stringify(e.orderBy)),e.available!==void 0&&n.set("available",String(e.available)),e.jeopardy===!0&&n.set("jeopardy","1"),e.include&&n.set("include",e.include),e.groupBy&&n.set("groupBy",e.groupBy)}function fM(n,e,s){const i=n??"24h",o=e&&Object.keys(e).length?JSON.stringify(e):null;return Le({queryKey:["stationMetrics",i,o],queryFn:()=>ue(`/escalations/station-metrics?period=${i}${o?`&facets=${encodeURIComponent(o)}`:""}`),staleTime:5e3,enabled:(s==null?void 0:s.enabled)??!0})}function hM(n){const e=n?`?period=${n}`:"";return Le({queryKey:["escalationStats",n],queryFn:()=>ue(`/escalations/stats${e}`)})}function dM(){return Le({queryKey:["escalationTypes"],queryFn:()=>ue("/escalations/types")})}function mM(n=!0){return Le({queryKey:["escalationFacetKeys"],queryFn:()=>ue("/escalations/facet-keys"),enabled:n,staleTime:6e4})}function mk(n){return Le({queryKey:["escalationFacetValues",n],queryFn:()=>ue(`/escalations/facet-values?key=${encodeURIComponent(n)}`),enabled:!!n,staleTime:6e4})}function pk(n){const e=new URLSearchParams;return n.status&&e.set("status",n.status),n.role&&e.set("role",n.role),n.type&&e.set("type",n.type),n.subtype&&e.set("subtype",n.subtype),n.assigned_to&&e.set("assigned_to",n.assigned_to),n.parent_id&&e.set("parent_id",n.parent_id),n.claimed&&e.set("claimed","true"),n.priority&&e.set("priority",String(n.priority)),n.limit&&e.set("limit",String(n.limit)),n.offset!==void 0&&e.set("offset",String(n.offset)),n.sort_by&&e.set("sort_by",n.sort_by),n.order&&e.set("order",n.order),n.search&&e.set("search",n.search),bv(e,n),e}function yk(n){return{queryKey:["escalations",n],queryFn:()=>ue(`/escalations?${pk(n)}`)}}function xv(n){const{enabled:e=!0,staleTime:s,...i}=n;return Le({...yk(i),enabled:e,...s!==void 0?{staleTime:s}:{}})}function vv(n){const{enabled:e=!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),bv(o,i),Le({queryKey:["escalations","available",i],queryFn:()=>ue(`/escalations/available?${o}`),enabled:e,...s!==void 0?{staleTime:s}:{}})}function pM(n){return Le({queryKey:["escalations","by-workflow",n],queryFn:()=>ue(`/escalations/by-workflow/${n}`),enabled:!!n})}function yM(n){return Le({queryKey:["escalations",n],queryFn:()=>ue(`/escalations/${n}`),enabled:!!n})}function gM(n,e){return Le({queryKey:["escalations",n,"lookups"],queryFn:()=>ue(`/escalations/${n}/lookups`),enabled:!!n&&e,staleTime:0,refetchOnWindowFocus:!1})}const gk=n=>["escalations",n,"files"];function bM(n,e){return Le({queryKey:gk(n),queryFn:()=>ue(`/escalations/${n}/files`),enabled:!!n&&e,placeholderData:s=>s,staleTime:0,refetchOnWindowFocus:!1})}function xM(){const n=qe();return ze({mutationFn:({id:e,durationMinutes:s})=>ue(`/escalations/${e}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function vM(){const n=qe();return ze({mutationFn:e=>ue(`/escalations/${e}/release`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function _M(){const n=qe();return ze({mutationFn:({id:e,resolverPayload:s})=>ue(`/escalations/${e}/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"]})}})}const wM={NEEDS_BADGE:"needs_badge",ROLE_REFUSED:"role_refused"};function SM(){const n=qe();return ze({mutationFn:({id:e,...s})=>ue(`/escalations/${e}/roster-action`,{method:"POST",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]}),n.invalidateQueries({queryKey:["escalationStats"]})}})}function EM(){const n=qe();return ze({mutationFn:({id:e,field:s,code:i})=>ue(`/escalations/${e}/roster-scan`,{method:"POST",body:JSON.stringify({field:s,code:i})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]}),n.invalidateQueries({queryKey:["escalationStats"]})}})}function OM(){const n=qe();return ze({mutationFn:({id:e,itemKey:s,payload:i})=>ue(`/escalations/${e}/accumulate`,{method:"POST",body:JSON.stringify({itemKey:s,...i?{payload:i}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function AM(){const n=qe();return ze({mutationFn:({id:e,itemKey:s})=>ue(`/escalations/${e}/remove-item`,{method:"POST",body:JSON.stringify({itemKey:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function jM(){const n=qe();return ze({mutationFn:({id:e,targetRole:s})=>ue(`/escalations/${e}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function kM(){const n=qe();return ze({mutationFn:({ids:e,priority:s})=>ue("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:e,priority:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function NM(){const n=qe();return ze({mutationFn:({ids:e,durationMinutes:s})=>ue("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:e,durationMinutes:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function TM(){const n=qe();return ze({mutationFn:({ids:e,targetUserId:s,durationMinutes:i,reassign:o})=>ue("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:e,targetUserId:s,durationMinutes:i,...o?{reassign:!0}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function CM(){const n=qe();return ze({mutationFn:({ids:e})=>ue("/escalations/bulk-unassign",{method:"POST",body:JSON.stringify({ids:e})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function MM(){const n=qe();return ze({mutationFn:({ids:e,hint:s})=>ue("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:e,...s?{hint:s}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function RM(){const n=qe();return ze({mutationFn:e=>ue(`/escalations/${e}/cancel`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function DM(){const n=qe();return ze({mutationFn:({ids:e})=>ue("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:e})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function zm(n){const e=[],s=n.type.split(".");switch(s[0]==="system"?s[1]:s[0]){case"task":e.push(["tasks"]),e.push(["jobs"]),e.push(["processes"]),n.workflowId&&(e.push(["workflowExecution",n.workflowId]),e.push(["workflowState",n.workflowId]),e.push(["mcpQueryExecution",n.workflowId])),n.originId&&e.push(["processes",n.originId]);break;case"escalation":e.push(["escalations"]),e.push(["escalationStats"]),e.push(["stationMetrics"]),n.workflowId&&e.push(["workflowExecution",n.workflowId]);break;case"workflow":e.push(["jobs"]),e.push(["tasks"]),e.push(["processes"]),n.workflowId&&(e.push(["workflowExecution",n.workflowId]),e.push(["workflowState",n.workflowId]),e.push(["mcpQueryExecution",n.workflowId]),e.push(["mcpQueryResult",n.workflowId]),e.push(["builderResult",n.workflowId]));break;case"activity":n.workflowId&&e.push(["mcpRunExecution",n.workflowId]),e.push(["mcpRuns"]);break;case"milestone":n.workflowId&&(e.push(["workflowExecution",n.workflowId]),e.push(["mcpQueryExecution",n.workflowId])),e.push(["tasks"]);break;case"knowledge":e.push(["knowledge"]);break;case"file":e.push(["files"]);break;case"agent":e.push(["agents"]);break;default:e.push(["jobs"]),e.push(["tasks"]);break}return e}const bk={DETAIL:{coalesceMs:300,minIntervalMs:2e3},LIST:{coalesceMs:500,minIntervalMs:3e3},SUMMARY:{coalesceMs:1e3,minIntervalMs:1e4}},LM=300,Bb={DETAIL:0,LIST:1,SUMMARY:2};function xk(n){const e=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 e)_===m&&b.push(v);for(const v of b)e.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 p(m){if(s[m])return;const{coalesceMs:b,minIntervalMs:x}=bk[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),_=e.get(v);(_===void 0||Bb[m]<Bb[_])&&e.set(v,m)}p(m)}const u=()=>{typeof document>"u"||document.visibilityState==="visible"&&o&&(o=!1,n.refetchQueries({type:"active",stale:!0}))};return typeof document<"u"&&document.addEventListener("visibilitychange",u),{request:g,dispose(){for(const m of Object.keys(s)){const b=s[m];b&&clearTimeout(b),delete s[m]}e.clear(),typeof document<"u"&&document.removeEventListener("visibilitychange",u)}}}const Ub=new WeakMap;function vk(n){let e=Ub.get(n);return e||(e=xk(n),Ub.set(n,e)),e}function nn(n){const e=qe();return E.useCallback(s=>{vk(e).request(n,s)},[e,n])}function $m(n){return n?[`${Wt}.system.workflow.>`,`${Wt}.system.activity.>`,`${Wt}.system.milestone.>`,`${Wt}.system.task.>`,`${Wt}.system.escalation.>`]:[]}function qM(){const n=nn("LIST");An(`${Wt}.system.task.>`,()=>{n([["jobs"]])}),An(`${Wt}.system.workflow.>`,()=>{n([["jobs"]])})}function PM(n){const e=nn("DETAIL");Ns($m(n),s=>{var p;if(!n||!(s.workflowId===n||((p=s.workflowId)==null?void 0:p.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],d=zm(s);c==="escalation"&&d.push(["escalations","by-workflow",n]),e(d)})}function BM(n){const e=nn("DETAIL");Ns($m(n),s=>{var p;if(!n||!(s.workflowId===n||((p=s.workflowId)==null?void 0:p.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],d=zm(s);c==="escalation"&&d.push(["escalations","by-workflow",n]),e(d)})}function UM(n){const e=nn("DETAIL");Ns($m(n),s=>{var c;if(!n||!(s.workflowId===n||((c=s.workflowId)==null?void 0:c.includes(n))))return;const o=zm(s);o.push(["workflowSets"]),o.push(["yamlWorkflows"]),e(o)})}function zM(n){const e=nn("DETAIL"),s=E.useCallback(i=>{n&&(i.originId!==n&&i.workflowId!==n||e([["processes",n]]))},[n,e]);An(`${Wt}.system.task.>`,s),An(`${Wt}.system.workflow.>`,s),An(`${Wt}.system.escalation.>`,s)}function $M(){const n=nn("SUMMARY");An(fr({}),()=>{n([["escalationStats"]])})}function IM(){const n=nn("SUMMARY");An(fr({}),()=>{n([["stationMetrics"]])})}function HM(){const n=nn("SUMMARY");An(fr({}),()=>{n([["escAggregate"],["escTimeline"]])})}function FM(n){const e=nn("LIST"),s=(n==null?void 0:n.role)??null,i=((n==null?void 0:n.verbs)??[]).join(","),o=E.useMemo(()=>{const c=i?i.split(","):null;return c?Jd({role:s,verbs:c}):[fr({role:s})]},[s,i]);Ns(o,()=>{e([["escalations"]])})}const _k=[["escalations","related"],["escalations","related-rows"]];function GM(n){const e=nn("LIST"),s=[...new Set(n)].sort().join(","),i=E.useMemo(()=>s?s.split(",").map(o=>fr({role:o})):[],[s]);Ns(i,()=>{e(_k)})}function VM(n){const e=nn("DETAIL");An(fr(n?{id:n}:{id:"__none__"}),s=>{!n||s.escalationId!==n||e([["escalations",n]])})}function YM(){const n=nn("LIST");An(`${Wt}.system.agent.>`,()=>{n([["agents"]])})}function KM(){const n=nn("LIST");An(`${Wt}.system.task.>`,()=>{n([["processes"]])}),An(`${Wt}.system.workflow.>`,()=>{n([["processes"]])})}function wk(){const{user:n}=qt(),e=n==null?void 0:n.userId,s=nn("SUMMARY");Ns(Cm(),()=>{s([["escalations"]])});const{data:i}=vv({limit:1}),{data:o}=xv({assigned_to:e,status:"pending",limit:1});return{available:(i==null?void 0:i.total)??0,mine:(o==null?void 0:o.total)??0}}function Du({size:n="sm",hideLabel:e=!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(${Yt}/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(${Yt}/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",p=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(${Yt}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${p} ${e?"opacity-0":""}`,children:i})]})}const Sk="system.surfaces.dashboard",Ek=`${Wt}.${Sk}`;function _v(n=!0){return Le({queryKey:["announcements"],queryFn:()=>ue("/announcements"),enabled:n,staleTime:3e4})}function Ok(){const n=qe();return ze({mutationFn:e=>ue("/announcements",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function Ak(){const n=qe();return ze({mutationFn:e=>ue(`/announcements/${encodeURIComponent(e)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function JM(n){return n.toLocaleString()}function QM(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 jk(n){const e=new Date(n);return e.getTime()>Date.now()?"just now":Fj(e,{addSuffix:!0})}function XM(n){const e=Date.now()-new Date(n).getTime();if(e<0)return"now";const s=Math.floor(e/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 WM(n){return n<=0?"Expired":Im(n)}function kk(n){return n==null?"--":Im(n)}function ZM(n){return n?Mm(n):"--"}function Im(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 e=Math.floor(n/1e3),s=Math.floor(e/86400),i=Math.floor(e%86400/3600),o=Math.floor(e%3600/60),c=e%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 eR(n,e){const s=new Date(n).getTime(),i=e?new Date(e).getTime():Date.now();return Im(i-s)}function wv({options:n,children:e,className:s=""}){const[i,o]=E.useState(!1),[c,d]=E.useState(null),[p,g]=E.useState(null),u=E.useRef(null),m=E.useRef(void 0),b=E.useRef(void 0),x=220,v=E.useCallback(()=>{if(!u.current)return;const B=u.current.getBoundingClientRect(),q=window.innerWidth-x-8,ne=Math.max(8,Math.min(B.left,q));g({top:B.bottom+4,left:ne})},[]),_=E.useCallback(async(B,q)=>{try{await navigator.clipboard.writeText(B),d(q),clearTimeout(m.current),m.current=setTimeout(()=>d(null),1200)}catch{}},[]),S=E.useCallback(()=>{clearTimeout(b.current),v(),o(!0)},[v]),C=E.useCallback(()=>{b.current=setTimeout(()=>o(!1),150)},[]);return E.useEffect(()=>()=>{clearTimeout(m.current),clearTimeout(b.current)},[]),h.jsxs("span",{ref:u,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:S,onMouseLeave:C,children:[e,i&&p&&lm.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:p.top,left:p.left},onMouseEnter:S,onMouseLeave:C,children:n.map(B=>h.jsxs("button",{onClick:q=>{q.stopPropagation(),_(B.value,B.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:B.label}),h.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===B.label?"✓":B.value})]},B.label))}),document.body)]})}function Nk(n,e){const s=new Date(n);switch(e){case"relative":return jk(n);case"datetime":return Mm(s);case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:Vj()??void 0})}}function Tk(n){const e=new Date(n);return[{label:"ms",value:String(e.getTime())},{label:"utc",value:e.toISOString()},{label:"local",value:Mm(e,!0)}]}function Sv({date:n,format:e="relative",className:s=""}){const[,i]=E.useState(0);E.useEffect(()=>{if(e!=="relative")return;const c=setInterval(()=>i(d=>d+1),3e4);return()=>clearInterval(c)},[e]);const o=E.useMemo(()=>Tk(n),[n]);return h.jsx(wv,{options:o,children:h.jsx("time",{dateTime:n,className:`text-xs text-text-tertiary ${s}`,children:Nk(n,e)})})}function Ck({values:n,options:e,onChange:s,addLabel:i,emptyText:o,ariaLabel:c}){const d=e.filter(p=>!n.includes(p));return h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.map(p=>h.jsxs("button",{type:"button",onClick:()=>s(n.filter(g=>g!==p)),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 ${p}`,children:[p,h.jsx(en,{className:"w-3 h-3",strokeWidth:1.5})]},p)),n.length===0&&o&&h.jsx("span",{className:"text-2xs text-text-tertiary italic",children:o}),d.length>0&&h.jsxs("select",{value:"",onChange:p=>p.target.value&&s([...n,p.target.value]),className:"select font-mono","aria-label":c??i,children:[h.jsx("option",{value:"",children:i}),d.map(p=>h.jsx("option",{value:p,children:p},p))]})]})}const Mk=[{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 Rk(){const{data:n}=_v(),{data:e}=Wj(),s=Ok(),i=Ak(),[o,c]=E.useState(""),[d,p]=E.useState(""),[g,u]=E.useState(1440),[m,b]=E.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(""),p(""),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:_=>p(_.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:_=>u(Number(_.target.value)),className:"select text-xs w-full",children:Mk.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(Ck,{values:m,options:(e==null?void 0:e.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(en,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]},_.id))})]})]})}const Dk=[{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"}],Lk=["operator","engineer","admin","superadmin"];function zb(n){return Lk.indexOf(n)}function qk(n,e){return zb(n)>=zb(e)}function Pk({onClose:n}){var Ne,Me,Xe,pt,Ot,mt,_e;const{isSuperAdmin:e,hasRoleType:s,hasRole:i}=qt(),{data:o}=Hn(),c=Nm(),d=!!((Ne=o==null?void 0:o.ai)!=null&&Ne.enabled),p=tv(),g=p!==null?p:d,[u,m]=E.useState(g),b=(Me=o==null?void 0:o.features)==null?void 0:Me.graphWorkflows,x=b==null,[v,_]=E.useState(b===!0||x&&nv()),S=e||i("engineer"),[C,B]=E.useState(rv()),q=!!((Xe=o==null?void 0:o.features)!=null&&Xe.scanCodes),ne=sv(),[te,M]=E.useState(ne!==null?ne:q),z=e?"superadmin":s("admin")?"admin":i("engineer")?"engineer":"operator",ae=((pt=o==null?void 0:o.branding)==null?void 0:pt.appName)??"LongTail",F=(Ot=o==null?void 0:o.environment)==null?void 0:Ot.longTailVersion,U=(mt=o==null?void 0:o.environment)==null?void 0:mt.hotmeshVersion,D=(_e=o==null?void 0:o.environment)==null?void 0:_e.nodeEnv;E.useEffect(()=>{const oe=Be=>{Be.key==="Escape"&&n()};return document.addEventListener("keydown",oe),()=>document.removeEventListener("keydown",oe)},[n]);const Q=Dk.filter(oe=>qk(z,oe.minTier)),W=Q.length>1,he=z!=="operator",Ee=[...W?[{id:"viewas",label:"View As",icon:OS}]:[],{id:"features",label:"Features",icon:AS},...he?[{id:"alerts",label:"Alerts",icon:jS}]:[]],[Ae,H]=E.useState(Ee[0].id),J=oe=>{oe===null?Kd():EA(oe)},ce=()=>{const oe=!u;m(oe),oe===d?SA():wA(oe),window.location.reload()},pe=()=>{const oe=!v;_(oe),OA(oe),window.location.reload()},ge=()=>{const oe=!C;B(oe),AA(oe),window.location.reload()},Ce=()=>{const oe=!te;M(oe),oe===q?kA():jA(oe),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:oe=>oe.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(en,{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(${Yt}/logo512.png)`}}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:ae}),F&&h.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",F,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"}),Ee.length>1&&h.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:Ee.map(oe=>{const Be=Ae===oe.id;return h.jsxs("button",{role:"tab","aria-selected":Be,onClick:()=>H(oe.id),title:oe.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${Be?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[h.jsx(oe.icon,{className:"w-5 h-5",strokeWidth:1.5,...Be?{fill:"currentColor",fillOpacity:.15}:{}}),h.jsx("span",{className:"text-2xs font-medium",children:oe.label})]},oe.id)})}),Ae==="viewas"&&W&&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"}),Q.map(oe=>{const Be=c===oe.id,zt=oe.id===null?`Your view · ${z}`:oe.label;return h.jsxs("button",{onClick:()=>J(oe.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 ${Be?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:Be&&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 ${Be?"text-accent":"text-text-primary group-hover:text-accent"}`,children:zt}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:oe.description})]})]},String(oe.id))})]}),Ae==="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:ce,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:u?"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 ${u?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${u?"translate-x-4":"translate-x-0"}`})})]}),x&&h.jsxs("button",{onClick:pe,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:ge,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:Ce,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:te?"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 ${te?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${te?"translate-x-4":"translate-x-0"}`})})]})]}),Ae==="alerts"&&he&&h.jsx(Rk,{}),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 Ev=[{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"}],$b="blue",Ov="lt.theme";let Av=[];function Bk(n){const e=new Set(Ev.map(i=>i.id)),s=new Set;Av=n.filter(i=>!(i!=null&&i.id)||e.has(i.id)||s.has(i.id)?!1:(s.add(i.id),!0))}function Uk(){return[...Ev,...Av]}function jv(){try{return localStorage.getItem(Ov)||$b}catch{return $b}}function kv(n){document.documentElement.dataset.theme=n}function zk(n){try{localStorage.setItem(Ov,n)}catch{}kv(n)}const $k=[8,12,13,14];function Nv(n){if(!/^[0-9]+$/.test(n)||!$k.includes(n.length))return!1;const e=n.split("").map(Number),s=e.pop();let i=0;for(let o=e.length-1,c=3;o>=0;o--,c=c===3?1:3)i+=e[o]*c;return(10-i%10)%10===s}function Ik(n){return n.padStart(14,"0")}const Hk="0",Fk="0",nm=64;function tR(n,e){const s=n.trim();if(!s)return{ok:!1,failure:{reason:"empty",detail:"empty scan code"}};const i=Gk(s,e);return i.ok?i:Tv(s,e,!1)??i}function Gk(n,e){if(/^[0-9]+$/.test(n)){const c=e.find(p=>p.encoding==="fixed"&&p.version===Number(n.slice(0,2)));if(!((c==null?void 0:c.enabled)&&Vk(n,c))){const p=Tv(n,e,!0);if(p)return p;const g=Yk(n,e);if(g)return g}}const s=n.slice(0,2),i=Number(s);if(!/^[0-9]{2}$/.test(s)||i<10||i>99)return{ok:!1,failure:{reason:"unknown_version",detail:`code must start with a two-digit scheme 10-99, got "${s}"`}};const o=e.find(c=>c.version===i);return o?o.enabled?o.encoding==="gtin"?vs(o,"reads manufacturer barcodes, which carry no scheme prefix"):o.encoding==="pattern"?vs(o,"reads codes by its declared patterns, which carry no scheme prefix"):o.encoding==="delimited"?Jk(n,i,o):Qk(n,i,o):{ok:!1,failure:{reason:"scheme_disabled",detail:`scan scheme ${i} ("${o.name}") is disabled`}}:{ok:!1,failure:{reason:"unknown_version",detail:`no scan scheme configured for version ${i}`}}}function Vk(n,e){const s=3+(e.target_length??0);return n.length===s||n.length===s+1}function Yk(n,e){if(!Nv(n))return null;const s=e.find(i=>i.encoding==="gtin"&&i.enabled)??e.find(i=>i.encoding==="gtin");return s?s.enabled?{ok:!0,parsed:{version:s.version,category:Hk,target:Ik(n),raw:n},scheme:s}:{ok:!1,failure:{reason:"scheme_disabled",detail:`scan scheme ${s.version} ("${s.name}") is disabled`}}:null}function Tv(n,e,s){const i=e.filter(c=>c.encoding==="pattern"&&(!s||c.precedes_gtin)).filter(c=>Cv(c.patterns??[],n)).sort((c,d)=>c.version-d.version),o=i.find(c=>c.enabled)??i[0];return o?o.enabled?{ok:!0,parsed:{version:o.version,category:Fk,target:n},scheme:o}:{ok:!1,failure:{reason:"scheme_disabled",detail:`scan scheme ${o.version} ("${o.name}") is disabled`}}:null}function Cv(n,e){return e.length>nm?!1:n.some(s=>{var i;return(i=Kk(s))==null?void 0:i.test(e)})}const hd=new Map;function Kk(n){if(hd.has(n))return hd.get(n);let e;try{e=new RegExp(`^(?:${Mv(n)})$`)}catch{e=null}return hd.set(n,e),e}function Mv(n){let e=n.startsWith("^")?n.slice(1):n;return e.endsWith("$")&&!e.endsWith("\\$")&&(e=e.slice(0,-1)),e}function Jk(n,e,s){const i=s.delimiter;if(n[2]!==i)return vs(s,`expected "${i}" after the two-digit scheme`);const o=n.slice(3,4);if(!/^[0-9]$/.test(o))return vs(s,"category must be a single digit");if(n[4]!==i)return vs(s,`expected "${i}" after the category`);const c=n.slice(5);return c?{ok:!0,parsed:{version:e,category:o,target:c},scheme:s}:vs(s,"target is empty")}function Qk(n,e,s){const i=s.target_length??0,o=3+i;if(!/^[0-9]+$/.test(n))return vs(s,"fixed encoding accepts digits only");if(n.length!==o&&n.length!==o+1)return vs(s,`expected ${o} digits (or ${o+1} with check digit), got ${n.length}`);const c=n.slice(2,3),d=n.slice(3,3+i);return{ok:!0,parsed:{version:e,category:c,target:d},scheme:s}}function vs(n,e){return{ok:!1,failure:{reason:"malformed",detail:`scheme ${n.version} ("${n.name}"): ${e}`}}}const uu={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},Rv="lt_scan_wedge_config";function Dv(){try{const n=localStorage.getItem(Rv);return n?{...uu,...JSON.parse(n)}:uu}catch{return uu}}function Xk(n){const e={...Dv(),...n};return localStorage.setItem(Rv,JSON.stringify(e)),e}const Hm=[{pattern:/(?:^|[^0-9])([1-9][0-9]:[0-9]:[a-zA-Z0-9._-]+)$/,scannerPaced:!1},{pattern:/(?:^|[^0-9])([1-9][0-9]{7,})$/,scannerPaced:!0}];function Wk(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Zk(n){try{return new RegExp(`(?:^|[^A-Za-z0-9])((?:${Mv(n)}))$`)}catch{return null}}function eN(n){const e=[];for(const s of n.filter(i=>i.enabled))if(s.encoding==="delimited"){const i=Wk(s.delimiter);e.push({pattern:new RegExp(`(?:^|[^0-9])(${s.version}${i}[0-9]${i}[a-zA-Z0-9._-]+)$`),scannerPaced:!1})}else if(s.encoding==="fixed"){const i=1+(s.target_length??0);e.push({pattern:new RegExp(`(?:^|[^0-9])(${s.version}[0-9]{${i},${i+1}})$`),scannerPaced:!0})}else if(s.encoding==="gtin")e.push({pattern:/(?:^|[^0-9])([0-9]{8}|[0-9]{12,14})$/,scannerPaced:!0,accept:Nv});else if(s.encoding==="pattern")for(const i of s.patterns??[]){const o=Zk(i);o&&e.push({pattern:o,scannerPaced:!0,maxTail:nm+1,accept:c=>c.length<=nm})}return e.length?e:Hm}function tN(n,e=Hm){var i;let s=null;for(const o of e){const d=(i=(o.maxTail?n.slice(-o.maxTail):n).match(o.pattern))==null?void 0:i[1];!d||o.accept&&!o.accept(d)||(!s||d.length>s.code.length)&&(s={code:d,shape:o})}return s}const nN=new Set(["Shift","CapsLock"]),dc={suppress:!1,emit:null};function rN(n=uu,e=Hm){let s={buffer:"",times:[],lastKeyMs:0};function i(u){const m=s.times.slice(-u.length);return m.length<2?!1:(m[m.length-1]-m[0])/(m.length-1)<=n.autoFireMaxAvgKeyMs}function o(){const u=tN(s.buffer,e);return!u||u.code.length<n.minLength||u.shape.scannerPaced&&!i(u.code)?null:u.code}function c(){s={buffer:"",times:[],lastKeyMs:0}}function d(u){const{key:m,timeMs:b,hasModifier:x,isRepeat:v}=u;if(nN.has(m))return dc;if(n.terminators.includes(m)){const q=o();return c(),q?{suppress:!0,emit:q,consumedLength:q.length}:dc}if(x||v||m.length!==1)return c(),dc;const _=b-s.lastKeyMs,S=s.lastKeyMs>0&&_<=n.maxKeyGapMs,C=(S?s.buffer+m:m).slice(-128),B=(S?[...s.times,b]:[b]).slice(-128);return s={buffer:C,times:B,lastKeyMs:b},dc}function p(){return{buffer:s.buffer}}function g(){const u=o();return!u||!i(u)?null:{code:u,consumedLength:u.length}}return{step:d,reset:c,snapshot:p,pendingAutoFire:g}}function sN(){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 iN(n,e,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,e):n.value=e;try{n.setSelectionRange(s,s)}catch{}n.dispatchEvent(new Event("input",{bubbles:!0}))}function Ib(n){if(n<=0)return;const e=sN();if(!e)return;const s=e.selectionStart??e.value.length,i=Math.max(0,s-n);iN(e,e.value.slice(0,i)+e.value.slice(s),i)}const ra={KEYBOARD_WEDGE:"keyboard-wedge",MANUAL:"manual",TOOLBAR:"toolbar",FOLLOW:"follow"},aN="data-lt-scan-capture",oN="off";function lN(n){return n instanceof Element&&!!n.closest(`[${aN}="${oN}"]`)}function cN({active:n,wedgeConfig:e,tailShapes:s,diagnosticsOn:i,onScan:o,onDiag:c}){const d=E.useRef({diagnosticsOn:i,onScan:o,onDiag:c});d.current={diagnosticsOn:i,onScan:o,onDiag:c};const p=E.useRef(0),g=E.useRef(0);E.useEffect(()=>{if(!n)return;const u=rN(e,s);let m=null;const b=()=>{m&&(clearTimeout(m),m=null)},x=(S,C,B)=>{C&&Ib(C),d.current.diagnosticsOn&&(console.debug("[scan]",B),d.current.onDiag({seq:++p.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:B})),d.current.onScan(S)},v=()=>{b(),u.pendingAutoFire()&&(m=setTimeout(()=>{m=null;const S=u.pendingAutoFire();S&&(u.reset(),x(S.code,S.consumedLength,`capture → ${S.code} (quiet period — no suffix)`))},e.autoFireQuietMs))},_=S=>{if(lN(S.target)){u.reset(),b();return}const C=u.snapshot().buffer,{suppress:B,emit:q,consumedLength:ne}=u.step({key:S.key,timeMs:S.timeStamp,hasModifier:S.ctrlKey||S.metaKey||S.altKey,isRepeat:S.repeat});if(B&&(S.preventDefault(),S.stopPropagation()),d.current.diagnosticsOn){const te=u.snapshot().buffer,M=e.terminators.includes(S.key),z=q?`capture → ${q}`:M?`terminator — no code tail in "${C.slice(-24)}"`:te===C?C?"neutral (chord key)":"ignored":te===""?"reset (edit/chord/non-printable)":te.length<=1&&C.length>1?"gap — new episode":"accumulate",ae=g.current?Math.round(S.timeStamp-g.current):0,F={seq:++p.current,key:S.key,code:S.code!==S.key?S.code:"",deltaMs:ae,buffer:te.slice(-24),note:z};console.debug("[scan]",F.key,F.code,`${F.deltaMs}ms`,F.note),d.current.onDiag(F)}g.current=S.timeStamp,q?(b(),ne&&Ib(ne),d.current.onScan(q)):v()};return window.addEventListener("keydown",_,{capture:!0}),()=>{b(),window.removeEventListener("keydown",_,{capture:!0})}},[n,e,s])}const ke={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",NO_OPEN_CONTAINER:"no_open_container",HELD:"held",REFUSED:"refused",SUBJECT_STALE:"subject_stale"},mc={SHOW_DETAIL:"show-detail",SHOW_LIST:"show-list",CLAIM:"claim",CLAIM_SHOW_DETAIL:"claim-show-detail",RELEASE:"release",RESOLVE:"resolve",ESCALATE:"escalate",CANCEL:"cancel",ACCUMULATE:"accumulate",PRESENT:"present",HOLD:"hold",FILL:"fill"},uN={ACTION:"action",IDENTITY:"identity"};function fN(n,e){return ue("/scan-codes/execute",{method:"POST",body:JSON.stringify({code:n,...e!=null&&e.actingToken?{actingToken:e.actingToken}:{},...e!=null&&e.previousActingToken?{previousActingToken:e.previousActingToken}:{},...e!=null&&e.subject?{subject:e.subject}:{},...e!=null&&e.stationRole?{stationRole:e.stationRole}:{}})})}function nR(n){return ue("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(n)})}function Lv(n){return Le({queryKey:["scan-schemes"],queryFn:()=>ue("/scan-codes/schemes"),...n})}function rR(n){return Le({queryKey:["scan-schemes",n],queryFn:()=>ue(`/scan-codes/schemes/${n}`),enabled:n!=null})}function sR(){const n=qe();return ze({mutationFn:e=>ue(`/scan-codes/schemes/${e.version}`,{method:"PUT",body:JSON.stringify(e)}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function iR(){const n=qe();return ze({mutationFn:e=>ue(`/scan-codes/schemes/${e}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function aR(){const n=qe();return ze({mutationFn:e=>ue(`/scan-codes/schemes/${e.scheme_version}/actions/${e.category}`,{method:"PUT",body:JSON.stringify(e)}),onSuccess:(e,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}function oR(){const n=qe();return ze({mutationFn:e=>ue(`/scan-codes/schemes/${e.scheme_version}/actions/${e.category}`,{method:"DELETE"}),onSuccess:(e,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}const hN=3e4;function dN(n,e=Date.now()){if(!(!n||Date.parse(n.expiresAt)<=e))return{code:n.code,escalationId:n.escalationId}}function Hb(n,e,s=Date.now()){if(e.outcome===ke.HELD&&e.subject){const i=Math.max(0,Date.parse(e.subject.expiresAt)-s);return{...e.subject,ttlMs:i}}return e.clearSubject||!n?null:e.outcome===ke.EXECUTED&&e.progress&&e.progress.remaining>0?{...n,expiresAt:new Date(s+n.ttlMs).toISOString()}:n}function Fb(n){return n.outcome===ke.NOT_PRIMED&&n.replayable===!0}function mN(n,e=Date.now()){return n&&e-n.at<=hN?n:null}const pN=[ke.HELD,ke.REFUSED,ke.SUBJECT_STALE],Gi=n=>{if(n)try{return JSON.parse(n)}catch{return}},ti=n=>n==null||Array.isArray(n)&&n.length===0||typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).length===0;function yN(n){const e={},s=Gi(n.get("facets"));ti(s)||(e.facets=s);const i=Gi(n.get("block"));ti(i)||(e.block=i);const o=Gi(n.get("range"));ti(o)||(e.range=o);const c=Gi(n.get("exists"));ti(c)||(e.exists=c);const d=Gi(n.get("roles"));ti(d)||(e.roles=d);const p=Gi(n.get("orderBy"));ti(p)||(e.orderBy=p),n.get("available")!=null&&(e.available=n.get("available")==="true");const g=n.get("jeopardy");return(g==="1"||g==="true")&&(e.jeopardy=!0),e}function lR(n,e){const s=(i,o)=>ti(o)?n.delete(i):n.set(i,JSON.stringify(o));s("facets",e.facets),s("block",e.block),s("range",e.range),s("exists",e.exists),s("roles",e.roles),s("orderBy",e.orderBy),e.available==null?n.delete("available"):n.set("available",String(e.available)),e.jeopardy===!0?n.set("jeopardy","1"):n.delete("jeopardy")}const rm=`&status=all&view=table&orderBy=${encodeURIComponent(JSON.stringify([{field:"created_at",direction:"desc"}]))}`;function qv(n,e){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 e?`/escalations/available?role=${encodeURIComponent(e)}&facets=${i}${rm}`:`/escalations/available?facets=${i}${rm}`}function gN(n,e,s){const i=encodeURIComponent(JSON.stringify({[n]:[e]}));return`/escalations/available?${s?`role=${encodeURIComponent(s)}&`:""}facets=${i}${rm}`}function bN(n,e,s){return qv({[n]:e},s)}function cR(n){var e,s,i;return Object.keys(n.facets??{}).length+(((e=n.block)==null?void 0:e.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 Fm(){var s;const{data:n}=Hn(),e=sv();return e!==null?e:!!((s=n==null?void 0:n.features)!=null&&s.scanCodes)}const Gm=E.createContext(null);function Vm(){const n=E.useContext(Gm);if(!n)throw new Error("useScanInput must be used within ScanInputProvider");return n}function uR(){return E.useContext(Gm)}const xN="scanPendingAction",vN="scanChoices",dd="/scan/station";function _N({children:n}){const{user:e}=qt(),s=Fm(),i=ri(),o=tn(),{identity:c,prime:d,clear:p,settle:g}=Mu(),[u,m]=E.useState(null),[b,x]=E.useState(null),[v,_]=E.useState(null),{data:S}=Lv({enabled:!!e&&s,staleTime:6e4}),C=E.useRef(null);C.current=Lm().role;const B=E.useMemo(()=>eN((S==null?void 0:S.schemes)??[]),[S]),[q,ne]=E.useState(!1),[te,M]=E.useState(()=>Dv()),[z,ae]=E.useState([]),[F,U]=E.useState(!1),D=E.useCallback(_e=>{var zt;const{outcome:oe}=_e;if(oe===ke.CONFIRM_REQUIRED&&_e.pendingAction)return i(`/escalations/detail/${_e.pendingAction.escalationId}`,{state:{[xN]:_e.pendingAction}}),!0;const Be=oe===ke.EXECUTED&&!!H.current;if(pN.includes(oe)||Fb(_e)||Be)return ce.current!==dd&&i(dd),!0;if(oe===ke.EXECUTED&&_e.escalation){const Mt=[mc.SHOW_DETAIL,mc.CLAIM_SHOW_DETAIL,mc.CLAIM,mc.ESCALATE];return _e.verb&&Mt.includes(_e.verb)?(i(`/escalations/detail/${_e.escalation.id}`),!0):!1}if(oe===ke.MATCHED_LIST&&_e.listQuery){const{targetFacet:Mt,target:tt,targetMatch:ye,roles:Pe}=_e.listQuery;return i(ye==="member"?gN(Mt,tt,(Pe==null?void 0:Pe[0])??null):qv({[Mt]:tt},(Pe==null?void 0:Pe[0])??null)),!0}return oe===ke.CHOICES&&_e.choices?(i(dd,{state:{[vN]:_e}}),!0):oe===ke.NO_MATCH_FALLBACK&&((zt=_e.fallback)!=null&&zt.route)?(i(_e.fallback.route),!0):!1},[i]),Q=E.useRef(null);Q.current=(c==null?void 0:c.actingToken)??null;const W=E.useRef(null),he=E.useRef([]),Ee=E.useCallback(_e=>(he.current=[_e,...he.current],()=>{he.current=he.current.filter(oe=>oe!==_e)}),[]),Ae=E.useRef(null);Ae.current=b;const H=E.useRef(void 0),J=E.useRef(null);J.current=v;const ce=E.useRef(o.pathname);ce.current=o.pathname,E.useEffect(()=>{if(!b)return;const _e=Date.parse(b.expiresAt)-Date.now();if(_e<=0){x(null);return}const oe=setTimeout(()=>x(null),_e);return()=>clearTimeout(oe)},[b]);const pe=E.useCallback(async(_e,oe,Be,zt=!1)=>{ne(!0);const Mt=Date.now();try{H.current=dN(Ae.current);const tt=await fN(_e,{actingToken:Be??void 0,previousActingToken:W.current??void 0,subject:H.current,stationRole:C.current??void 0});if(Be&&g(Be,tt),x(Pe=>Hb(Pe,tt)),tt.outcome===ke.IDENTITY_PRIMED){W.current=d(tt);const Pe=mN(J.current);if(_(null),Pe&&tt.actingToken)return m({code:_e,source:oe,at:Mt,response:tt,error:null,navigated:!1}),pe(Pe.code,oe,tt.actingToken)}else Fb(tt)?_({code:_e,at:Mt}):_(null);tt.outcome===ke.NOT_PRIMED&&Be&&p();const ye=zt||D(tt);return m({code:_e,source:oe,at:Mt,response:tt,error:null,navigated:ye}),tt}catch(tt){return m({code:_e,source:oe,at:Mt,response:null,error:tt.message,navigated:!1}),null}finally{ne(!1)}},[D,d,p,g]),ge=E.useCallback(async(_e,oe=ra.MANUAL)=>{for(const Be of he.current)if(Be(_e))return;await pe(_e,oe,Q.current)},[pe]),Ce=E.useCallback(async _e=>{const oe=await pe(_e,ra.FOLLOW,Q.current,!0);return(oe==null?void 0:oe.outcome)===ke.HELD},[pe]),Ne=E.useCallback(()=>x(null),[]),Me=E.useCallback(_e=>{x(oe=>Hb(oe,_e))},[]),Xe=E.useCallback(()=>_(null),[]),pt=E.useRef(ge);pt.current=ge,cN({active:!!e&&s,wedgeConfig:te,tailShapes:B,diagnosticsOn:F,onScan:_e=>void pt.current(_e,ra.KEYBOARD_WEDGE),onDiag:_e=>ae(oe=>[...oe.slice(-29),_e])});const Ot=E.useCallback(_e=>{M(Xk(_e))},[]),mt=E.useMemo(()=>({submitCode:ge,pushCodeInterceptor:Ee,lastResult:u,subject:b,dropSubject:Ne,adoptResponse:Me,followCode:Ce,pendingScan:v,dropPendingScan:Xe,busy:q,wedgeConfig:te,updateWedgeConfig:Ot,diagnostics:z,diagnosticsOn:F,setDiagnosticsOn:U}),[ge,Ee,u,b,Ne,Me,Ce,v,Xe,q,te,Ot,z,F]);return h.jsx(Gm.Provider,{value:mt,children:n})}var pc={},fo={},yc={},Gb;function Nn(){if(Gb)return yc;Gb=1,Object.defineProperty(yc,"__esModule",{value:!0});function n(s,i){if(!(s instanceof i))throw new TypeError("Cannot call a class as a function")}var e=function s(i,o){n(this,s),this.data=i,this.text=o.text||i,this.options=o};return yc.default=e,yc}var Vb;function wN(){if(Vb)return fo;Vb=1,Object.defineProperty(fo,"__esModule",{value:!0}),fo.CODE39=void 0;var n=(function(){function S(C,B){for(var q=0;q<B.length;q++){var ne=B[q];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(C,ne.key,ne)}}return function(C,B,q){return B&&S(C.prototype,B),q&&S(C,q),C}})(),e=Nn(),s=i(e);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 p=(function(S){d(C,S);function C(B,q){return o(this,C),B=B.toUpperCase(),q.mod43&&(B+=x(_(B))),c(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,B,q))}return n(C,[{key:"encode",value:function(){for(var q=m("*"),ne=0;ne<this.data.length;ne++)q+=m(this.data[ne])+"0";return q+=m("*"),{data:q,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","-","."," ","$","/","+","%","*"],u=[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 u[S].toString(2)}function x(S){return g[S]}function v(S){return g.indexOf(S)}function _(S){for(var C=0,B=0;B<S.length;B++)C+=v(S[B]);return C=C%43,C}return fo.CODE39=p,fo}var Qn={},gc={},bc={},vt={},Yb;function Po(){if(Yb)return vt;Yb=1,Object.defineProperty(vt,"__esModule",{value:!0});var n;function e(g,u,m){return u in g?Object.defineProperty(g,u,{value:m,enumerable:!0,configurable:!0,writable:!0}):g[u]=m,g}var s=vt.SET_A=0,i=vt.SET_B=1,o=vt.SET_C=2;vt.SHIFT=98;var c=vt.START_A=103,d=vt.START_B=104,p=vt.START_C=105;return vt.MODULO=103,vt.STOP=106,vt.FNC1=207,vt.SET_BY_CODE=(n={},e(n,c,s),e(n,d,i),e(n,p,o),n),vt.SWAP={101:s,100:i,99:o},vt.A_START_CHAR="Ð",vt.B_START_CHAR="Ñ",vt.C_START_CHAR="Ò",vt.A_CHARS="[\0-_È-Ï]",vt.B_CHARS="[ -È-Ï]",vt.C_CHARS="(Ï*[0-9]{2}Ï*)",vt.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],vt}var Kb;function Lu(){if(Kb)return bc;Kb=1,Object.defineProperty(bc,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=Nn(),s=o(e),i=Po();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);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 B=i.SWAP[C];B!==void 0?S=m.next(x,v+1,B):((_===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 q=m.getBar(C),ne=C*v;return{result:q+S.result,checksum:ne+S.checksum}}}]),m})(s.default);return bc.default=g,bc}var xc={},Jb;function SN(){if(Jb)return xc;Jb=1,Object.defineProperty(xc,"__esModule",{value:!0});var n=Po(),e=function(p){return p.match(new RegExp("^"+n.A_CHARS+"*"))[0].length},s=function(p){return p.match(new RegExp("^"+n.B_CHARS+"*"))[0].length},i=function(p){return p.match(new RegExp("^"+n.C_CHARS+"*"))[0]};function o(d,p){var g=p?n.A_CHARS:n.B_CHARS,u=d.match(new RegExp("^("+g+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(u)return u[1]+"Ì"+c(d.substring(u[1].length));var m=d.match(new RegExp("^"+g+"+"))[0];return m.length===d.length?d:m+String.fromCharCode(p?205:206)+o(d.substring(m.length),!p)}function c(d){var p=i(d),g=p.length;if(g===d.length)return d;d=d.substring(g);var u=e(d)>=s(d);return p+String.fromCharCode(u?206:205)+o(d,u)}return xc.default=function(d){var p=void 0,g=i(d).length;if(g>=2)p=n.C_START_CHAR+c(d);else{var u=e(d)>s(d);p=(u?n.A_START_CHAR:n.B_START_CHAR)+o(d,u)}return p.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(m,b){return"Ë"+b})},xc}var Qb;function EN(){if(Qb)return gc;Qb=1,Object.defineProperty(gc,"__esModule",{value:!0});var n=Lu(),e=o(n),s=SN(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);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})(e.default);return gc.default=g,gc}var vc={},Xb;function ON(){if(Xb)return vc;Xb=1,Object.defineProperty(vc,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=Lu(),s=o(e),i=Po();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);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 vc.default=g,vc}var _c={},Wb;function AN(){if(Wb)return _c;Wb=1,Object.defineProperty(_c,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=Lu(),s=o(e),i=Po();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);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 _c.default=g,_c}var wc={},Zb;function jN(){if(Zb)return wc;Zb=1,Object.defineProperty(wc,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=Lu(),s=o(e),i=Po();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);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 wc.default=g,wc}var e1;function kN(){if(e1)return Qn;e1=1,Object.defineProperty(Qn,"__esModule",{value:!0}),Qn.CODE128C=Qn.CODE128B=Qn.CODE128A=Qn.CODE128=void 0;var n=EN(),e=g(n),s=ON(),i=g(s),o=AN(),c=g(o),d=jN(),p=g(d);function g(u){return u&&u.__esModule?u:{default:u}}return Qn.CODE128=e.default,Qn.CODE128A=i.default,Qn.CODE128B=c.default,Qn.CODE128C=p.default,Qn}var Jt={},Sc={},Rr={},t1;function Bo(){return t1||(t1=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.SIDE_BIN="101",Rr.MIDDLE_BIN="01010",Rr.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"]},Rr.EAN2_STRUCTURE=["LL","LG","GL","GG"],Rr.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],Rr.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),Rr}var Ec={},Oc={},n1;function Uo(){if(n1)return Oc;n1=1,Object.defineProperty(Oc,"__esModule",{value:!0});var n=Bo(),e=function(i,o,c){var d=i.split("").map(function(g,u){return n.BINARIES[o[u]]}).map(function(g,u){return g?g[i[u]]:""});if(c){var p=i.length-1;d=d.map(function(g,u){return u<p?g+c:g})}return d.join("")};return Oc.default=e,Oc}var r1;function Pv(){if(r1)return Ec;r1=1,Object.defineProperty(Ec,"__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}})(),e=Bo(),s=Uo(),i=d(s),o=Nn(),c=d(o);function d(b){return b&&b.__esModule?b:{default:b}}function p(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 u(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){u(x,b);function x(v,_){p(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:e.SIDE_BIN,options:S},{data:this.leftEncode(),text:this.leftText(),options:_},{data:e.MIDDLE_BIN,options:S},{data:this.rightEncode(),text:this.rightText(),options:_},{data:e.SIDE_BIN,options:S}]}},{key:"encodeFlat",value:function(){var _=[e.SIDE_BIN,this.leftEncode(),e.MIDDLE_BIN,this.rightEncode(),e.SIDE_BIN];return{data:_.join(""),text:this.text}}}]),x})(c.default);return Ec.default=m,Ec}var s1;function NN(){if(s1)return Sc;s1=1,Object.defineProperty(Sc,"__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}})(),e=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 B=S.get;return B===void 0?void 0:B.call(_)}},s=Bo(),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 p(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 u=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+=u(v));var S=p(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]===u(this.data)}},{key:"leftText",value:function(){return e(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 e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftEncode",this).call(this,_,S)}},{key:"rightText",value:function(){return e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var _=this.data.substr(7,6);return e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightEncode",this).call(this,_,"RRRRRR")}},{key:"encodeGuarded",value:function(){var _=e(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 Sc.default=m,Sc}var Ac={},i1;function TN(){if(i1)return Ac;i1=1,Object.defineProperty(Ac,"__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}})(),e=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 p(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},u=(function(m){p(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 e(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 e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,v,"LLLL")}},{key:"rightText",value:function(){return e(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 e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,v,"RRRR")}}]),b})(i.default);return Ac.default=u,Ac}var jc={},a1;function CN(){if(a1)return jc;a1=1,Object.defineProperty(jc,"__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}})(),e=Bo(),s=Uo(),i=d(s),o=Nn(),c=d(o);function d(x){return x&&x.__esModule?x:{default:x}}function p(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 u(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,B){return B%2?S+C*9:S+C*3},0);return _%10},b=(function(x){u(v,x);function v(_,S){return p(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=e.EAN5_STRUCTURE[m(this.data)];return{data:"1011"+(0,i.default)(this.data,S,"01"),text:this.text}}}]),v})(c.default);return jc.default=b,jc}var kc={},o1;function MN(){if(o1)return kc;o1=1,Object.defineProperty(kc,"__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}})(),e=Bo(),s=Uo(),i=d(s),o=Nn(),c=d(o);function d(b){return b&&b.__esModule?b:{default:b}}function p(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 u(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){u(x,b);function x(v,_){return p(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 _=e.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,i.default)(this.data,_,"01"),text:this.text}}}]),x})(c.default);return kc.default=m,kc}var ho={},l1;function Bv(){if(l1)return ho;l1=1,Object.defineProperty(ho,"__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}})();ho.checksum=m;var e=Uo(),s=c(e),i=Nn(),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 p(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 u=(function(b){g(x,b);function x(v,_){d(this,x),v.search(/^[0-9]{11}$/)!==-1&&(v+=m(v));var S=p(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 ho.default=u,ho}var Nc={},c1;function RN(){if(c1)return Nc;c1=1,Object.defineProperty(Nc,"__esModule",{value:!0});var n=(function(){function _(S,C){for(var B=0;B<C.length;B++){var q=C[B];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(S,q.key,q)}}return function(S,C,B){return C&&_(S.prototype,C),B&&_(S,B),S}})(),e=Uo(),s=d(e),i=Nn(),o=d(i),c=Bv();function d(_){return _&&_.__esModule?_:{default:_}}function p(_,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 u(_,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(_){u(S,_);function S(C,B){p(this,S);var q=g(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,C,B));if(q.isValid=!1,C.search(/^[0-9]{6}$/)!==-1)q.middleDigits=C,q.upcA=v(C,"0"),q.text=B.text||""+q.upcA[0]+C+q.upcA[q.upcA.length-1],q.isValid=!0;else if(C.search(/^[01][0-9]{7}$/)!==-1)if(q.middleDigits=C.substring(1,C.length-1),q.upcA=v(q.middleDigits,C[0]),q.upcA[q.upcA.length-1]===C[C.length-1])q.isValid=!0;else return g(q);else return g(q);return q.displayValue=B.displayValue,B.fontSize>B.width*10?q.fontSize=B.width*10:q.fontSize=B.fontSize,q.guardHeight=B.height+q.fontSize/2+B.textMargin,q}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 B="";return B+="101",B+=this.encodeMiddleDigits(),B+="010101",{data:B,text:this.text}}},{key:"guardedEncoding",value:function(){var B=[];return this.displayValue&&B.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),B.push({data:"101",options:{height:this.guardHeight}}),B.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),B.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&B.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),B}},{key:"encodeMiddleDigits",value:function(){var B=this.upcA[0],q=this.upcA[this.upcA.length-1],ne=b[parseInt(q)][parseInt(B)];return(0,s.default)(this.middleDigits,ne)}}]),S})(o.default);function v(_,S){for(var C=parseInt(_[_.length-1]),B=m[C],q="",ne=0,te=0;te<B.length;te++){var M=B[te];M==="X"?q+=_[ne++]:q+=M}return q=""+S+q,""+q+(0,c.checksum)(q)}return Nc.default=x,Nc}var u1;function DN(){if(u1)return Jt;u1=1,Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.UPCE=Jt.UPC=Jt.EAN2=Jt.EAN5=Jt.EAN8=Jt.EAN13=void 0;var n=NN(),e=x(n),s=TN(),i=x(s),o=CN(),c=x(o),d=MN(),p=x(d),g=Bv(),u=x(g),m=RN(),b=x(m);function x(v){return v&&v.__esModule?v:{default:v}}return Jt.EAN13=e.default,Jt.EAN8=i.default,Jt.EAN5=c.default,Jt.EAN2=p.default,Jt.UPC=u.default,Jt.UPCE=b.default,Jt}var Ws={},Tc={},Vi={},f1;function LN(){return f1||(f1=1,Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.START_BIN="1010",Vi.END_BIN="11101",Vi.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Vi}var h1;function Uv(){if(h1)return Tc;h1=1,Object.defineProperty(Tc,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=LN(),s=Nn(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);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:e.START_BIN+v+e.END_BIN,text:this.text}}},{key:"encodePair",value:function(x){var v=e.BINARIES[x[1]];return e.BINARIES[x[0]].split("").map(function(_,S){return(_==="1"?"111":"1")+(v[S]==="1"?"000":"0")}).join("")}}]),m})(i.default);return Tc.default=g,Tc}var Cc={},d1;function qN(){if(d1)return Cc;d1=1,Object.defineProperty(Cc,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=Uv(),s=i(e);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function c(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function d(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var p=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(u){d(m,u);function m(b,x){return o(this,m),b.search(/^[0-9]{13}$/)!==-1&&(b+=p(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]===p(this.data)}}]),m})(s.default);return Cc.default=g,Cc}var m1;function PN(){if(m1)return Ws;m1=1,Object.defineProperty(Ws,"__esModule",{value:!0}),Ws.ITF14=Ws.ITF=void 0;var n=Uv(),e=o(n),s=qN(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Ws.ITF=e.default,Ws.ITF14=i.default,Ws}var vn={},Mc={},p1;function zo(){if(p1)return Mc;p1=1,Object.defineProperty(Mc,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=Nn(),s=i(e);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function c(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function d(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var p=(function(u){d(m,u);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(u,m){for(var b=0;b<m;b++)u="0"+u;return u}return Mc.default=p,Mc}var Rc={},mo={},y1;function qu(){if(y1)return mo;y1=1,Object.defineProperty(mo,"__esModule",{value:!0}),mo.mod10=n,mo.mod11=e;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 e(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 mo}var g1;function BN(){if(g1)return Rc;g1=1,Object.defineProperty(Rc,"__esModule",{value:!0});var n=zo(),e=i(n),s=qu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m+(0,s.mod10)(m),b))}return u})(e.default);return Rc.default=p,Rc}var Dc={},b1;function UN(){if(b1)return Dc;b1=1,Object.defineProperty(Dc,"__esModule",{value:!0});var n=zo(),e=i(n),s=qu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m+(0,s.mod11)(m),b))}return u})(e.default);return Dc.default=p,Dc}var Lc={},x1;function zN(){if(x1)return Lc;x1=1,Object.defineProperty(Lc,"__esModule",{value:!0});var n=zo(),e=i(n),s=qu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),m+=(0,s.mod10)(m),m+=(0,s.mod10)(m),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return u})(e.default);return Lc.default=p,Lc}var qc={},v1;function $N(){if(v1)return qc;v1=1,Object.defineProperty(qc,"__esModule",{value:!0});var n=zo(),e=i(n),s=qu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),m+=(0,s.mod11)(m),m+=(0,s.mod10)(m),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return u})(e.default);return qc.default=p,qc}var _1;function IN(){if(_1)return vn;_1=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.MSI1110=vn.MSI1010=vn.MSI11=vn.MSI10=vn.MSI=void 0;var n=zo(),e=m(n),s=BN(),i=m(s),o=UN(),c=m(o),d=zN(),p=m(d),g=$N(),u=m(g);function m(b){return b&&b.__esModule?b:{default:b}}return vn.MSI=e.default,vn.MSI10=i.default,vn.MSI11=c.default,vn.MSI1010=p.default,vn.MSI1110=u.default,vn}var po={},w1;function HN(){if(w1)return po;w1=1,Object.defineProperty(po,"__esModule",{value:!0}),po.pharmacode=void 0;var n=(function(){function g(u,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(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),e=Nn(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){o(this,u);var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b));return x.number=parseInt(m,10),x}return n(u,[{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}}]),u})(s.default);return po.pharmacode=p,po}var yo={},S1;function FN(){if(S1)return yo;S1=1,Object.defineProperty(yo,"__esModule",{value:!0}),yo.codabar=void 0;var n=(function(){function g(u,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(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),e=Nn(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){o(this,u),m.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(m="A"+m+"A");var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m.toUpperCase(),b));return x.text=x.options.text||x.text.replace(/[A-D]/g,""),x}return n(u,[{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"}}}]),u})(s.default);return yo.codabar=p,yo}var Zs={},Pc={},Yi={},E1;function GN(){return E1||(E1=1,Object.defineProperty(Yi,"__esModule",{value:!0}),Yi.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","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],Yi.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"],Yi.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"]}),Yi}var O1;function zv(){if(O1)return Pc;O1=1,Object.defineProperty(Pc,"__esModule",{value:!0});var n=(function(){function u(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&&u(m.prototype,b),x&&u(m,x),m}})(),e=GN(),s=Nn(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);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 e.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 e.BINARIES[m.symbolValue(x)]}},{key:"getSymbol",value:function(x){return e.SYMBOLS[x]}},{key:"symbolValue",value:function(x){return e.SYMBOLS.indexOf(x)}},{key:"checksum",value:function(x,v){var _=x.slice().reverse().reduce(function(S,C,B){var q=B%v+1;return S+m.symbolValue(C)*q},0);return m.getSymbol(_%47)}}]),m})(i.default);return Pc.default=g,Pc}var Bc={},A1;function VN(){if(A1)return Bc;A1=1,Object.defineProperty(Bc,"__esModule",{value:!0});var n=(function(){function g(u,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(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),e=zv(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return n(u,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),u})(s.default);return Bc.default=p,Bc}var j1;function YN(){if(j1)return Zs;j1=1,Object.defineProperty(Zs,"__esModule",{value:!0}),Zs.CODE93FullASCII=Zs.CODE93=void 0;var n=zv(),e=o(n),s=VN(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Zs.CODE93=e.default,Zs.CODE93FullASCII=i.default,Zs}var go={},k1;function KN(){if(k1)return go;k1=1,Object.defineProperty(go,"__esModule",{value:!0}),go.GenericBarcode=void 0;var n=(function(){function g(u,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(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),e=Nn(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return n(u,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),u})(s.default);return go.GenericBarcode=p,go}var N1;function JN(){if(N1)return pc;N1=1,Object.defineProperty(pc,"__esModule",{value:!0});var n=wN(),e=kN(),s=DN(),i=PN(),o=IN(),c=HN(),d=FN(),p=YN(),g=KN();return pc.default={CODE39:n.CODE39,CODE128:e.CODE128,CODE128A:e.CODE128A,CODE128B:e.CODE128B,CODE128C:e.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:p.CODE93,CODE93FullASCII:p.CODE93FullASCII,GenericBarcode:g.GenericBarcode},pc}var Uc={},T1;function Pu(){if(T1)return Uc;T1=1,Object.defineProperty(Uc,"__esModule",{value:!0});var n=Object.assign||function(e){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e};return Uc.default=function(e,s){return n({},e,s)},Uc}var zc={},C1;function QN(){if(C1)return zc;C1=1,Object.defineProperty(zc,"__esModule",{value:!0}),zc.default=n;function n(e){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(e),s}return zc}var $c={},M1;function XN(){if(M1)return $c;M1=1,Object.defineProperty($c,"__esModule",{value:!0}),$c.default=n;function n(e){return e.marginTop=e.marginTop||e.margin,e.marginBottom=e.marginBottom||e.margin,e.marginRight=e.marginRight||e.margin,e.marginLeft=e.marginLeft||e.margin,e}return $c}var Ic={},Hc={},Fc={},R1;function $v(){if(R1)return Fc;R1=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.default=n;function n(e){var s=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var i in s)s.hasOwnProperty(i)&&(i=s[i],typeof e[i]=="string"&&(e[i]=parseInt(e[i],10)));return typeof e.displayValue=="string"&&(e.displayValue=e.displayValue!="false"),e}return Fc}var Gc={},D1;function Iv(){if(D1)return Gc;D1=1,Object.defineProperty(Gc,"__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 Gc.default=n,Gc}var L1;function WN(){if(L1)return Hc;L1=1,Object.defineProperty(Hc,"__esModule",{value:!0});var n=$v(),e=o(n),s=Iv(),i=o(s);function o(d){return d&&d.__esModule?d:{default:d}}function c(d){var p={};for(var g in i.default)i.default.hasOwnProperty(g)&&(d.hasAttribute("jsbarcode-"+g.toLowerCase())&&(p[g]=d.getAttribute("jsbarcode-"+g.toLowerCase())),d.hasAttribute("data-"+g.toLowerCase())&&(p[g]=d.getAttribute("data-"+g.toLowerCase())));return p.value=d.getAttribute("jsbarcode-value")||d.getAttribute("data-value"),p=(0,e.default)(p),p}return Hc.default=c,Hc}var Vc={},Yc={},_n={},q1;function Hv(){if(q1)return _n;q1=1,Object.defineProperty(_n,"__esModule",{value:!0}),_n.getTotalWidthOfEncodings=_n.calculateEncodingAttributes=_n.getBarcodePadding=_n.getEncodingHeight=_n.getMaximumHeightOfEncodings=void 0;var n=Pu(),e=s(n);function s(u){return u&&u.__esModule?u:{default:u}}function i(u,m){return m.height+(m.displayValue&&u.text.length>0?m.fontSize+m.textMargin:0)+m.marginTop+m.marginBottom}function o(u,m,b){if(b.displayValue&&m<u){if(b.textAlign=="center")return Math.floor((u-m)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(u-m)}return 0}function c(u,m,b){for(var x=0;x<u.length;x++){var v=u[x],_=(0,e.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(u){for(var m=0,b=0;b<u.length;b++)m+=u[b].width;return m}function p(u){for(var m=0,b=0;b<u.length;b++)u[b].height>m&&(m=u[b].height);return m}function g(u,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(u);if(!v)return 0;var _=v.width;return _}return _n.getMaximumHeightOfEncodings=p,_n.getEncodingHeight=i,_n.getBarcodePadding=o,_n.calculateEncodingAttributes=c,_n.getTotalWidthOfEncodings=d,_n}var P1;function ZN(){if(P1)return Yc;P1=1,Object.defineProperty(Yc,"__esModule",{value:!0});var n=(function(){function p(g,u){for(var m=0;m<u.length;m++){var b=u[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}return function(g,u,m){return u&&p(g.prototype,u),m&&p(g,m),g}})(),e=Pu(),s=o(e),i=Hv();function o(p){return p&&p.__esModule?p:{default:p}}function c(p,g){if(!(p instanceof g))throw new TypeError("Cannot call a class as a function")}var d=(function(){function p(g,u,m){c(this,p),this.canvas=g,this.encodings=u,this.options=m}return n(p,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var u=0;u<this.encodings.length;u++){var m=(0,s.default)(this.options,this.encodings[u].options);this.drawCanvasBarcode(m,this.encodings[u]),this.drawCanvasText(m,this.encodings[u]),this.moveCanvasDrawing(this.encodings[u])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var u=this.canvas.getContext("2d");u.save(),(0,i.calculateEncodingAttributes)(this.encodings,this.options,u);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,u.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(u.fillStyle=this.options.background,u.fillRect(0,0,this.canvas.width,this.canvas.height)),u.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(u,m){var b=this.canvas.getContext("2d"),x=m.data,v;u.textPosition=="top"?v=u.marginTop+u.fontSize+u.textMargin:v=u.marginTop,b.fillStyle=u.lineColor;for(var _=0;_<x.length;_++){var S=_*u.width+m.barcodePadding;x[_]==="1"?b.fillRect(S,v,u.width,u.height):x[_]&&b.fillRect(S,v,u.width,u.height*x[_])}}},{key:"drawCanvasText",value:function(u,m){var b=this.canvas.getContext("2d"),x=u.fontOptions+" "+u.fontSize+"px "+u.font;if(u.displayValue){var v,_;u.textPosition=="top"?_=u.marginTop+u.fontSize-u.textMargin:_=u.height+u.textMargin+u.marginTop+u.fontSize,b.font=x,u.textAlign=="left"||m.barcodePadding>0?(v=0,b.textAlign="left"):u.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(u){var m=this.canvas.getContext("2d");m.translate(u.width,0)}},{key:"restoreCanvas",value:function(){var u=this.canvas.getContext("2d");u.restore()}}]),p})();return Yc.default=d,Yc}var Kc={},B1;function eT(){if(B1)return Kc;B1=1,Object.defineProperty(Kc,"__esModule",{value:!0});var n=(function(){function g(u,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(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),e=Pu(),s=o(e),i=Hv();function o(g){return g&&g.__esModule?g:{default:g}}function c(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}var d="http://www.w3.org/2000/svg",p=(function(){function g(u,m,b){c(this,g),this.svg=u,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,B=0;B<v.length;B++)C=B*b.width+x.barcodePadding,v[B]==="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 Kc.default=p,Kc}var Jc={},U1;function tT(){if(U1)return Jc;U1=1,Object.defineProperty(Jc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var d=0;d<c.length;d++){var p=c[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(o,p.key,p)}}return function(o,c,d){return c&&i(o.prototype,c),d&&i(o,d),o}})();function e(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o,c,d){e(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 Jc.default=s,Jc}var z1;function nT(){if(z1)return Vc;z1=1,Object.defineProperty(Vc,"__esModule",{value:!0});var n=ZN(),e=d(n),s=eT(),i=d(s),o=tT(),c=d(o);function d(p){return p&&p.__esModule?p:{default:p}}return Vc.default={CanvasRenderer:e.default,SVGRenderer:i.default,ObjectRenderer:c.default},Vc}var Ki={},$1;function Fv(){if($1)return Ki;$1=1,Object.defineProperty(Ki,"__esModule",{value:!0});function n(d,p){if(!(d instanceof p))throw new TypeError("Cannot call a class as a function")}function e(d,p){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:d}function s(d,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);d.prototype=Object.create(p&&p.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(d,p):d.__proto__=p)}var i=(function(d){s(p,d);function p(g,u){n(this,p);var m=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return m.name="InvalidInputException",m.symbology=g,m.input=u,m.message='"'+m.input+'" is not a valid input for '+m.symbology,m}return p})(Error),o=(function(d){s(p,d);function p(){n(this,p);var g=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="InvalidElementException",g.message="Not supported type to render on",g}return p})(Error),c=(function(d){s(p,d);function p(){n(this,p);var g=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="NoElementException",g.message="No element to render on.",g}return p})(Error);return Ki.InvalidInputException=i,Ki.InvalidElementException=o,Ki.NoElementException=c,Ki}var I1;function rT(){if(I1)return Ic;I1=1,Object.defineProperty(Ic,"__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},e=WN(),s=d(e),i=nT(),o=d(i),c=Fv();function d(m){return m&&m.__esModule?m:{default:m}}function p(m){if(typeof m=="string")return g(m);if(Array.isArray(m)){for(var b=[],x=0;x<m.length;x++)b.push(p(m[x]));return b}else{if(typeof HTMLCanvasElement<"u"&&m instanceof HTMLImageElement)return u(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(p(b[v]));return x}}function u(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 Ic.default=p,Ic}var Qc={},H1;function sT(){if(H1)return Qc;H1=1,Object.defineProperty(Qc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var d=0;d<c.length;d++){var p=c[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(o,p.key,p)}}return function(o,c,d){return c&&i(o.prototype,c),d&&i(o,d),o}})();function e(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o){e(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(p){return this.handleCatch(p),this.api}}}]),i})();return Qc.default=s,Qc}var md,F1;function iT(){if(F1)return md;F1=1;var n=JN(),e=B(n),s=Pu(),i=B(s),o=QN(),c=B(o),d=XN(),p=B(d),g=rT(),u=B(g),m=$v(),b=B(m),x=sT(),v=B(x),_=Fv(),S=Iv(),C=B(S);function B(U){return U&&U.__esModule?U:{default:U}}var q=function(){},ne=function(D,Q,W){var he=new q;if(typeof D>"u")throw Error("No element to render on was provided.");return he._renderProperties=(0,u.default)(D),he._encodings=[],he._options=C.default,he._errorHandler=new v.default(he),typeof Q<"u"&&(W=W||{},W.format||(W.format=ae()),he.options(W)[W.format](Q,W).render()),he};ne.getModule=function(U){return e.default[U]};for(var te in e.default)e.default.hasOwnProperty(te)&&M(e.default,te);function M(U,D){q.prototype[D]=q.prototype[D.toUpperCase()]=q.prototype[D.toLowerCase()]=function(Q,W){var he=this;return he._errorHandler.wrapBarcodeCall(function(){W.text=typeof W.text>"u"?void 0:""+W.text;var Ee=(0,i.default)(he._options,W);Ee=(0,b.default)(Ee);var Ae=U[D],H=z(Q,Ae,Ee);return he._encodings.push(H),he})}}function z(U,D,Q){U=""+U;var W=new D(U,Q);if(!W.valid())throw new _.InvalidInputException(W.constructor.name,U);var he=W.encode();he=(0,c.default)(he);for(var Ee=0;Ee<he.length;Ee++)he[Ee].options=(0,i.default)(Q,he[Ee].options);return he}function ae(){return e.default.CODE128?"CODE128":Object.keys(e.default)[0]}q.prototype.options=function(U){return this._options=(0,i.default)(this._options,U),this},q.prototype.blank=function(U){var D=new Array(U+1).join("0");return this._encodings.push({data:D}),this},q.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 Q=(0,i.default)(this._options,U.options);Q.format=="auto"&&(Q.format=ae()),this._errorHandler.wrapBarcodeCall(function(){var W=Q.value,he=e.default[Q.format.toUpperCase()],Ee=z(W,he,Q);F(U,Ee,Q)})}}},q.prototype.render=function(){if(!this._renderProperties)throw new _.NoElementException;if(Array.isArray(this._renderProperties))for(var U=0;U<this._renderProperties.length;U++)F(this._renderProperties[U],this._encodings,this._options);else F(this._renderProperties,this._encodings,this._options);return this},q.prototype._defaults=C.default;function F(U,D,Q){D=(0,c.default)(D);for(var W=0;W<D.length;W++)D[W].options=(0,i.default)(Q,D[W].options),(0,p.default)(D[W].options);(0,p.default)(Q);var he=U.renderer,Ee=new he(U.element,D,Q);Ee.render(),U.afterRender&&U.afterRender()}return typeof window<"u"&&(window.JsBarcode=ne),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(U,D){var Q=[];return jQuery(this).each(function(){Q.push(this)}),ne(Q,U,D)}),md=ne,md}var aT=iT();const oT=bS(aT),lT={[ke.EXECUTED]:"Executed",[ke.MATCHED_LIST]:"Matched list",[ke.CONFIRM_REQUIRED]:"Awaiting confirmation",[ke.NO_MATCH_FALLBACK]:"No match",[ke.UNCONFIGURED]:"Not configured",[ke.INVALID_CODE]:"Invalid code",[ke.FORBIDDEN]:"Not permitted",[ke.CONFLICT]:"Conflict",[ke.IDENTITY_PRIMED]:"Identity primed",[ke.IDENTITY_UNKNOWN]:"Badge not recognized",[ke.NOT_PRIMED]:"Badge required",[ke.CHOICES]:"Choices presented",[ke.NO_OPEN_CONTAINER]:"Container closing, scan again",[ke.HELD]:"Holding",[ke.REFUSED]:"Not placed",[ke.SUBJECT_STALE]:"Scan it again"},cT={[ke.EXECUTED]:"text-status-success",[ke.MATCHED_LIST]:"text-status-success",[ke.CONFIRM_REQUIRED]:"text-status-warning",[ke.NO_MATCH_FALLBACK]:"text-text-secondary",[ke.UNCONFIGURED]:"text-status-warning",[ke.INVALID_CODE]:"text-status-error",[ke.FORBIDDEN]:"text-status-error",[ke.CONFLICT]:"text-status-warning",[ke.IDENTITY_PRIMED]:"text-status-success",[ke.IDENTITY_UNKNOWN]:"text-status-warning",[ke.NOT_PRIMED]:"text-status-warning",[ke.CHOICES]:"text-status-success",[ke.NO_OPEN_CONTAINER]:"text-status-warning",[ke.HELD]:"text-status-success",[ke.REFUSED]:"text-status-error",[ke.SUBJECT_STALE]:"text-status-warning"};function uT(n){return n.outcome===ke.IDENTITY_PRIMED&&n.actor?`Hi ${n.actor.displayName}`:`${lT[n.outcome]}${n.rule?` — ${n.rule.name}`:""}`}function fT(n){var e,s,i,o,c,d,p;return n.outcome===ke.NO_MATCH_FALLBACK?((e=n.fallback)==null?void 0:e.markdown)??null:n.outcome===ke.IDENTITY_UNKNOWN?((s=n.fallback)==null?void 0:s.markdown)??null:n.outcome===ke.NOT_PRIMED?((i=n.notPrimed)==null?void 0:i.markdown)??null:n.outcome===ke.NO_OPEN_CONTAINER?((o=n.fallback)==null?void 0:o.markdown)??null:n.outcome===ke.REFUSED?((c=n.refusal)==null?void 0:c.markdown)??n.error??null:n.outcome===ke.HELD?((p=(d=n.subject)==null?void 0:d.expect)==null?void 0:p.prompt)??null:n.outcome===ke.SUBJECT_STALE?n.error??null:null}function gs(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 hT({content:n,compact:e,inherit:s}){const i=[],o=/^```(\w*)\n([\s\S]*?)^```$/gm;let c=0,d;for(;(d=o.exec(n))!==null;)d.index>c&&i.push({type:"text",text:n.slice(c,d.index)}),i.push({type:"code",lang:d[1],code:d[2].replace(/\n$/,"")}),c=d.index+d[0].length;c<n.length&&i.push({type:"text",text:n.slice(c)});const p=s?{text:"",heading:"",list:"",code:"text-[0.85em]",tone:""}:e?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs",tone:"text-text-secondary"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs",tone:"text-text-secondary"},g=[];for(const u of i){if(u.type==="code"){const m=u.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");g.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${p.code} font-mono text-text-secondary leading-relaxed">${m}</code></pre>`);continue}g.push(...dT(u.text,p))}return h.jsx("div",{className:s?void 0:"prose-sm",dangerouslySetInnerHTML:{__html:g.join(`
|
|
55
|
+
`)}})}function dT(n,e){const s=n.split(`
|
|
56
|
+
`),i=[];let o=!1,c=!1,d=[];for(const p of s){const g=p.trim();if(g.startsWith("|")&&g.endsWith("|")){const u=g.slice(1,-1).split("|").map(m=>m.trim());if(u.every(m=>/^[-:]+$/.test(m)))continue;c||(c=!0,d=[]),d.push(u);continue}if(c){c=!1;const[u,...m]=d;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of u)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${gs(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">${gs(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="${e.heading} font-semibold text-text-primary mt-3 mb-1">${gs(g.slice(4))}</h4>`);continue}if(g.startsWith("## ")){o&&(i.push("</ul>"),o=!1),i.push(`<h3 class="${e.heading} font-semibold text-text-primary mt-3 mb-1">${gs(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="${e.list} ${e.tone} flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${gs(g.slice(2))}</span></li>`);continue}o&&(i.push("</ul>"),o=!1),i.push(`<p class="${e.text} ${e.tone} my-1">${gs(g)}</p>`)}if(c&&d.length){const[p,...g]=d;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const u of p)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${gs(u)}</th>`);i.push("</tr></thead><tbody>");for(const u of g){i.push("<tr>");for(const m of u)i.push(`<td class="py-1 px-2 border-b border-border/50">${gs(m)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>")}return o&&i.push("</ul>"),i}function Ym({result:n,compact:e=!1}){const{response:s}=n,i=e?"text-xs":"text-sm",o=s?fT(s):null,c=s!=null&&s.error&&s.error!==o?s.error:null;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 ${cT[s.outcome]}`,children:uT(s)}),c&&h.jsx("div",{className:"text-xs text-text-tertiary mt-0.5",children:c}),o&&h.jsx("div",{className:"text-xs text-text-secondary mt-1.5",children:h.jsx(hT,{content:o,compact:!0})})]}):h.jsx("div",{className:`${i} text-status-error`,children:n.error})]})}function Gv(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 mT(n){const e=new Set;for(const s of n){const i=s.codePointAt(0);(i>127||i<32)&&e.add(`"${i<32?"\\x"+i.toString(16).padStart(2,"0"):s}" U+${i.toString(16).toUpperCase().padStart(4,"0")}`)}return[...e]}function pT({value:n}){const e=E.useRef(null),[s,i]=E.useState(!1);return E.useEffect(()=>{if(!(!e.current||!n))try{oT(e.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:mT(n).join(", ")||"unknown"})]}):h.jsx("div",{className:"bg-white rounded p-1 inline-block max-w-full overflow-hidden",children:h.jsx("svg",{ref:e,className:"max-w-full"})})]}):null}function yT({onClose:n}){const{submitCode:e,lastResult:s,busy:i,wedgeConfig:o,updateWedgeConfig:c,diagnostics:d,diagnosticsOn:p,setDiagnosticsOn:g}=Vm(),[u,m]=E.useState(""),[b,x]=E.useState(!1),v=_=>{_.preventDefault();const S=u.trim();S&&(m(""),e(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(Ro,{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(en,{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:u,onChange:_=>m(Gv(_.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||!u.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(pT,{value:u.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(Ym,{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:p,onChange:_=>g(_.target.checked)}),h.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),p&&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 Vv=/^\{lt:([A-Za-z0-9_]+)\}$/,G1="me";function fR(n){return`{lt:${n}}`}const Yv="lt:station:link-vars:";function sm(n){return`${Yv}${n}`}const im=new Set;function gT(){for(const n of im)n()}let Su,Xc={};function Kv(n){let e=null;try{e=localStorage.getItem(sm(n))}catch{e=null}if(e===Su)return Xc;Su=e;try{const s=e?JSON.parse(e):{};Xc=s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).filter(([,i])=>typeof i=="string")):{}}catch{Xc={}}return Xc}function bT(n,e,s){const i={...Kv(n)};s===null||s===""?delete i[e]:i[e]=s;try{Object.keys(i).length===0?localStorage.removeItem(sm(n)):localStorage.setItem(sm(n),JSON.stringify(i))}catch{}Su=void 0,gT()}function xT(n){im.add(n);const e=s=>{(s.key===null||s.key.startsWith(Yv))&&(Su=void 0,n())};try{window.addEventListener("storage",e)}catch{}return()=>{im.delete(n);try{window.removeEventListener("storage",e)}catch{}}}const vT={};function _T(n){return E.useSyncExternalStore(xT,()=>n?Kv(n):vT)}function wT(n,e,s,i={}){let o;try{o=new URL(n,"http://local")}catch{return n}const c=o.searchParams.get("facets");if(!c)return n;let d;try{const g=JSON.parse(c);if(!g||typeof g!="object"||Array.isArray(g))return n;d=g}catch{return n}let p=!1;for(const[g,u]of Object.entries(d)){if(typeof u!="string")continue;const m=Vv.exec(u);if(!m)continue;const b=i[m[1]]??e[m[1]]??s[m[1]];typeof b=="string"&&b!==""?d[g]=b:delete d[g],p=!0}return p?(Object.keys(d).length===0?o.searchParams.delete("facets"):o.searchParams.set("facets",JSON.stringify(d)),o.pathname+o.search):n}function hR(n){let e;try{e=new URL(n,"http://local")}catch{return[]}const s=e.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=Vv.exec(c);d&&!o.includes(d[1])&&o.push(d[1])}return o}catch{return[]}}function Km(){var v;const{user:n,isSuperAdmin:e,hasRoleType:s}=qt(),i=(n==null?void 0:n.userId)??null,o=e||s("admin"),c=E.useMemo(()=>new Set(((n==null?void 0:n.roles)??[]).map(_=>_.role)),[n]),{data:d}=Ru({enabled:o||c.size>0}),p=_T(i),g=((v=TA())==null?void 0:v.actorId)??i,u=E.useMemo(()=>{var C;const _=[],S=new Set;for(const B of(d==null?void 0:d.roles)??[]){if(!o&&!c.has(B.role))continue;const q=(C=B.properties)==null?void 0:C.link_variables;if(Array.isArray(q))for(const ne of q){const te=ne==null?void 0:ne.name;if(typeof te!="string"||te===""||te===G1||S.has(te))continue;S.add(te);const M=ne.label,z=ne.default;_.push({name:te,...typeof M=="string"&&M!==""?{label:M}:{},...typeof z=="string"&&z!==""?{default:z}:{},fromRole:B.role})}}return _},[d,c,o]),m=E.useMemo(()=>{const _={};for(const S of u)S.default!==void 0&&(_[S.name]=S.default);return _},[u]),b=E.useCallback(_=>wT(_,p,m,g?{[G1]:g}:{}),[p,m,g]),x=E.useCallback((_,S)=>{i&&bT(i,_,S)},[i]);return{declarations:u,values:p,defaults:m,resolveUrl:b,setValue:x}}function ST({open:n,onClose:e,title:s,children:i,maxWidth:o,closeOnBackdrop:c=!0}){return E.useEffect(()=>{if(!n)return;const d=p=>{p.key==="Escape"&&e()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[n,e]),n?lm.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?e: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:e,"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 ET({open:n,onClose:e}){const{declarations:s,values:i,setValue:o}=Km();return h.jsxs(ST,{open:n,onClose:e,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(OT,{declaration:c,value:i[c.name]??"",autoFocus:d===0,onChange:p=>o(c.name,p),onClear:()=>o(c.name,null),onEnter:e},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:e,className:"px-3 py-1.5 text-xs rounded bg-accent text-text-inverse hover:bg-accent-hover transition-colors",children:"OK"})})]})}function OT({declaration:n,value:e,autoFocus:s,onChange:i,onClear:o,onEnter:c}){const d=E.useId(),{data:p}=mk(n.name),g=(p==null?void 0:p.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:e,onChange:u=>i(u.target.value),onKeyDown:u=>{u.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(u=>h.jsx("option",{value:u},u))}),h.jsx("button",{onClick:o,disabled:e==="",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 V1=["escalationId","workflowId"],AT=/^[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",jT="lt:search:facet",Lt={FACET:"facet",COMMAND:"command"};function kT(n,e){return{version:n.version,category:e.category,name:e.name,schemeName:n.name,targetFacet:n.target_facet,encoding:n.encoding,delimiter:n.delimiter,targetLength:n.target_length,patterns:n.patterns??[]}}function Mo(n){return n.encoding==="gtin"||n.encoding==="pattern"?"":n.encoding==="delimited"?`${n.version}${n.delimiter}${n.category}${n.delimiter}`:`${n.version}${n.category}`}function NT(n,e){if(n.encoding==="delimited")return TT(n,e)?{code:e}:{code:`${Mo(n)}${e}`};if(n.encoding==="pattern")return Cv(n.patterns,e)?{code:e}:{error:`${n.name} takes a code matching its patterns`};if(!/^[0-9]+$/.test(e))return{error:`${n.name} takes digits only`};if(n.encoding==="gtin")return{code:e};const s=n.targetLength;return s&&e.length!==s&&e.length!==s+1?{error:`${n.name} takes ${s} digits`}:{code:`${Mo(n)}${e}`}}function TT(n,e){const s=n.delimiter.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^[1-9][0-9]${s}[0-9]${s}.+$`).test(e)}function CT(n,e){return n==="escalationId"||n==="workflowId"?null:bN(n,e)}function MT(n){return n.kind===Lt.FACET?n.facet:n.command.name}function RT(n){return n.kind===Lt.COMMAND?n.command.targetFacet:n.facet==="escalationId"?"Escalation id":n.facet==="workflowId"?"Workflow id":n.facet}function DT(n){return n.kind===Lt.FACET?{kind:Lt.FACET,facet:n.facet}:{kind:Lt.COMMAND,version:n.command.version,category:n.command.category}}function LT(n,e,s){if((n==null?void 0:n.kind)===Lt.FACET&&e.includes(n.facet))return{kind:Lt.FACET,facet:n.facet};if((n==null?void 0:n.kind)===Lt.COMMAND){const i=s.find(o=>o.version===n.version&&o.category===n.category);if(i)return{kind:Lt.COMMAND,command:i}}return e.length>0?{kind:Lt.FACET,facet:e[0]}:s.length>0?{kind:Lt.COMMAND,command:s[0]}:null}function qT(){try{const n=localStorage.getItem(Jv);if(n){const s=JSON.parse(n);if(s.kind===Lt.FACET&&typeof s.facet=="string"||s.kind===Lt.COMMAND&&typeof s.version=="number"&&typeof s.category=="string")return s}const e=localStorage.getItem(jT);return e?{kind:Lt.FACET,facet:e}:null}catch{return null}}function PT(n){try{localStorage.setItem(Jv,JSON.stringify(n))}catch{}}const Y1=5*6e4,BT=n=>({rules:n.map(e=>{var s;return((s=e.data)==null?void 0:s.rules)??null}),loading:n.some(e=>e.isLoading)});function UT(n){const e=Lv({enabled:n,staleTime:Y1}),s=E.useMemo(()=>{var d;return(((d=e.data)==null?void 0:d.schemes)??[]).filter(p=>p.enabled&&p.kind===uN.ACTION).sort((p,g)=>p.version-g.version)},[e.data]),{rules:i,loading:o}=xS({queries:s.map(d=>({queryKey:["scan-schemes",d.version,"actions"],queryFn:()=>ue(`/scan-codes/schemes/${d.version}/actions`),enabled:n,staleTime:Y1})),combine:BT});return{commands:E.useMemo(()=>s.flatMap((d,p)=>(i[p]??[]).filter(g=>g.enabled).sort((g,u)=>g.category.localeCompare(u.category)).map(g=>kT(d,g))),[s,i]),loading:e.isLoading||o}}const zT={escalationId:"opens the item",workflowId:"opens the run"};function $T({mode:n,facets:e,commands:s,onSelect:i,onOpenScanPanel:o}){const[c,d]=E.useState(!1),p=E.useRef(null);E.useEffect(()=>{if(!c)return;const x=_=>{p.current&&!p.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===Lt.COMMAND,u=g?`${n.command.schemeName} · ${n.command.name} — ${Mo(n.command)}<${n.command.targetFacet}>`:`Search by ${n.facet}`,m=IT(s),b=x=>{i(x),d(!1)};return h.jsxs("div",{ref:p,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:u,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:MT(n)}),h.jsx(cm,{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:[e.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(K1,{children:"Find"}),e.map(x=>h.jsx(J1,{label:x,mono:!0,note:zT[x]??"filters the list",active:!g&&n.facet===x,onClick:()=>b({kind:Lt.FACET,facet:x})},x))]}),m.map(({schemeName:x,targetFacet:v,items:_})=>h.jsxs("div",{children:[h.jsxs(K1,{note:v,children:["Run · ",x]}),_.map(S=>h.jsx(J1,{label:S.name,note:Mo(S),noteMono:!0,active:g&&n.command.version===S.version&&n.command.category===S.category,onClick:()=>b({kind:Lt.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(Ro,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Scanner settings and barcode preview"]})]})]})]})}function IT(n){const e=[];for(const s of n){const i=e.find(o=>o.schemeName===s.schemeName);i?i.items.push(s):e.push({schemeName:s.schemeName,targetFacet:s.targetFacet,items:[s]})}return e}function K1({children:n,note:e}){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}),e&&h.jsx("span",{className:"ml-auto font-mono font-normal normal-case tracking-normal shrink-0",children:e})]})}function J1({label:n,note:e,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:e})]})}const HT=6e3;function FT({onOpenScanPanel:n}){const e=ri(),{data:s}=Hn(),i=Fm(),{submitCode:o,busy:c,lastResult:d}=Vm(),{commands:p}=UT(i),[g,u]=E.useState(""),[m,b]=E.useState(!1),[x,v]=E.useState(null),[_,S]=E.useState(null),[C,B]=E.useState(""),[q,ne]=E.useState(null),[te,M]=E.useState(qT),z=E.useRef(null),ae=E.useMemo(()=>{var ce;if(!((ce=s==null?void 0:s.search)!=null&&ce.enabled))return[];const J=(s.search.facets??[]).filter(pe=>!V1.includes(pe));return[...V1,...J]},[s]),F=E.useMemo(()=>LT(te,ae,p),[te,ae,p]),U=(d==null?void 0:d.source)===ra.TOOLBAR&&!d.navigated&&q!==d.at?d:null;E.useEffect(()=>{if(!U)return;const J=setTimeout(()=>ne(U.at),HT);return()=>clearTimeout(J)},[U]);const D=()=>{v(null),S(null),d&&ne(d.at)},Q=J=>{var pe;const ce=DT(J);M(ce),PT(ce),D(),(pe=z.current)==null||pe.focus()},W=(J,ce)=>{const pe=NT(J.command,Gv(ce));if("error"in pe){v(pe.error);return}u(""),o(pe.code,ra.TOOLBAR)},he=async(J,ce)=>{const pe=CT(J,ce);if(pe){u(""),e(pe);return}if(J==="escalationId"&&!AT.test(ce)){v("That is not a valid escalation id");return}b(!0);try{if(J==="escalationId")await ue(`/escalations/${encodeURIComponent(ce)}`),u(""),e(`/escalations/detail/${encodeURIComponent(ce)}`);else{const ge=await ue(`/escalations/by-workflow/${encodeURIComponent(ce)}`),Ce=(ge==null?void 0:ge.escalations)??[];Ce.length===1?(u(""),e(`/escalations/detail/${Ce[0].id}`)):(B(ce),S(Ce))}}catch{v(`No ${J==="escalationId"?"escalation":"workflow"} found for "${ce}"`)}finally{b(!1)}},Ee=()=>{const J=g.trim();!J||m||c||!F||(D(),F.kind===Lt.COMMAND?W(F,J):he(F.facet,J))};if(!F)return null;const Ae=F.kind===Lt.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:[Ae?h.jsx(Ro,{className:"w-3.5 h-3.5 text-accent/65",strokeWidth:1.5}):h.jsx(kS,{className:"w-3.5 h-3.5 text-text-quaternary",strokeWidth:1.5}),Ae&&h.jsx("span",{className:"font-mono text-xs tabular-nums text-text-tertiary select-none","data-testid":"search-command-prefix",children:Mo(F.command)})]}),h.jsx("input",{ref:z,id:"global-search-input",type:"text",value:g,onChange:J=>{u(J.target.value),D()},onKeyDown:J=>{J.key==="Enter"&&Ee(),J.key==="Escape"&&(u(""),D())},placeholder:RT(F),"aria-label":Ae?"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 ${Ae?"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($T,{mode:F,facets:ae,commands:p,onSelect:Q,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(Ym,{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(J=>h.jsxs(ar,{to:`/escalations/detail/${J.id}`,onClick:()=>{S(null),u("")},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:J.role}),h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),J.status,h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),h.jsx("span",{className:"text-text-tertiary",children:J.type})]},J.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(ar,{to:`/workflows/executions/${encodeURIComponent(C)}`,onClick:()=>{S(null),u("")},className:"block px-3 py-1.5 text-xs text-accent hover:bg-surface-hover",children:"Workflow execution →"})]})]})}function GT(){const{identity:n,remainingSeconds:e}=Mu(),[,s]=E.useState(0);return E.useEffect(()=>{if(!(n!=null&&n.expiresAt))return;const i=setInterval(()=>s(o=>o+1),1e3);return()=>clearInterval(i)},[n]),e()}function VT(n){return n>=60?`${Math.floor(n/60)} min`:`${n} s`}function YT(){const{identity:n}=Mu(),e=GT();return n?h.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-text-secondary whitespace-nowrap min-w-0",title:`Scans act as ${n.displayName}`,"data-testid":"badge-grant-indicator",children:[h.jsx(NS,{className:"w-4 h-4 text-status-success shrink-0",strokeWidth:1.5}),h.jsx("span",{className:"hidden sm:inline",children:"Badged:"}),h.jsx("span",{className:"font-medium text-text-primary truncate max-w-[10rem]",children:n.displayName}),n.expiresAt&&h.jsxs("span",{className:"tabular-nums text-text-tertiary","data-testid":"badge-grant-remaining",children:["· ",VT(e)]})]}):null}function KT(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(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function am(n){var e;return((e=n.title)==null?void 0:e.trim())||KT(n.role)}const Qv="lt:bookmarks",Wc="scan";function JT(){try{const n=localStorage.getItem(Qv);if(!n)return[];const e=JSON.parse(n);return Array.isArray(e)?e:[]}catch{return[]}}function Q1(n){try{localStorage.setItem(Qv,JSON.stringify(n))}catch{}}function QT({onToggleEventFeed:n,onToggleDocs:e,onToggleNav:s}){var Be,zt,Mt,tt;const i=ri(),{user:o,logout:c,isSuperAdmin:d,hasRoleType:p}=qt(),{viewAs:g,realIsBuilder:u}=iv(),{available:m,mine:b}=wk();av();const{connected:x}=zx(),{data:v}=Hn(),{role:_,targets:S,selectable:C,selectRole:B}=Lm(),{declarations:q,values:ne}=Km(),[te,M]=E.useState(!1),{data:z}=Ru(),ae=E.useMemo(()=>{const ye=(z==null?void 0:z.roles)??[],Pe=new Set(((o==null?void 0:o.roles)??[]).map(At=>At.role)),yt=d||p("admin");return ye.filter(At=>na(At).length>0&&(yt||Pe.has(At.role))).map(At=>({role:At.role,title:am(At),portals:na(At)}))},[z,o,d,p]),{setPanel:F,closePanel:U,open:D,ownerKey:Q}=Um(),W=Fm(),he=tn(),Ee=()=>{D&&Q===Wc?U(Wc):F(h.jsx(yT,{onClose:()=>U(Wc)}),{width:360,key:Wc})},[Ae,H]=E.useState(!1),[J,ce]=E.useState(!1),[pe,ge]=E.useState(jv),[Ce,Ne]=E.useState(JT),Me=E.useRef(null),Xe=(Be=v==null?void 0:v.branding)==null?void 0:Be.appName,pt=(zt=v==null?void 0:v.branding)==null?void 0:zt.themes,Ot=E.useMemo(()=>(Bk(pt??[]),Uk()),[pt]),mt=ye=>{zk(ye),ge(ye)},_e=()=>{const ye=window.prompt("Bookmark label:");if(!(ye!=null&&ye.trim()))return;const Pe=he.pathname+he.search,yt=[...Ce,{label:ye.trim(),url:Pe}].sort((At,Ur)=>At.label.localeCompare(Ur.label));Ne(yt),Q1(yt),H(!1)},oe=ye=>{const Pe=Ce.filter(yt=>!(yt.label===ye.label&&yt.url===ye.url));Ne(Pe),Q1(Pe)};return E.useEffect(()=>{if(!Ae)return;const ye=Pe=>{Me.current&&!Me.current.contains(Pe.target)&&H(!1)};return document.addEventListener("mousedown",ye),()=>document.removeEventListener("mousedown",ye)},[Ae]),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 ${Ae?"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(TS,{className:"w-5 h-5",strokeWidth:1.5})}),h.jsx(ar,{to:"/","aria-label":"Home",className:"shrink-0 hidden lg:block",onClick:ye=>{(ye.ctrlKey||ye.metaKey)&&(ye.preventDefault(),ce(!0))},children:h.jsx(Du,{appName:Xe,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(hx,{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(xd,{className:"w-5 h-5",strokeWidth:2})})]}),(((Mt=v==null?void 0:v.search)==null?void 0:Mt.enabled)||W)&&h.jsx("div",{className:"hidden md:flex flex-1 min-w-0 justify-center px-4 lg:px-8",children:h.jsx(FT,{onOpenScanPanel:W?Ee:void 0})}),h.jsxs("div",{className:"flex items-center gap-5 shrink-0",children:[h.jsx(YT,{}),h.jsxs(ar,{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(vd,{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(ar,{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(vd,{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:Kd,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(en,{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:Me,children:[h.jsxs("button",{onClick:()=>H(ye=>!ye),className:"btn-ghost flex items-center gap-1",children:[h.jsxs("span",{className:"relative",children:[h.jsx(CS,{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"})})]}),Ae&&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(ar,{to:"/credentials",onClick:()=>H(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),((tt=v==null?void 0:v.auth)==null?void 0:tt.oauthServer)&&h.jsx(ar,{to:"/connected-apps",onClick:()=>H(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Connected apps"}),W&&h.jsx("button",{onClick:()=>{H(!1),Ee()},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"}),u&&h.jsx("button",{onClick:()=>{H(!1),e==null||e()},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),Kd()},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:Ot.map(ye=>h.jsx("button",{type:"button",onClick:()=>mt(ye.id),title:ye.label,"aria-label":`${ye.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${pe===ye.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:ye.swatch}},ye.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),B(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(ye=>{var At;const Pe=(At=z==null?void 0:z.roles)==null?void 0:At.find(Ur=>Ur.role===ye),yt=ye===_;return h.jsxs("button",{type:"button",onClick:()=>{H(!1),B(ye),i(yv(ye,na(Pe)))},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${yt?"text-accent":"text-text-secondary"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${yt?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:am({role:ye,title:Pe==null?void 0:Pe.title})})]},ye)})]})]}),ae.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:ae.map(ye=>h.jsxs("div",{children:[ae.length>1&&h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:ye.role,children:ye.title}),ye.portals.map(Pe=>{const yt=Dm(ye.role,Pe.key),At=he.pathname===yt;return h.jsxs("button",{type:"button",onClick:()=>{H(!1),i(yt)},className:`flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded hover:bg-surface-hover ${At?"text-accent":"text-text-secondary"}`,"data-testid":`menu-portal-${ye.role}-${Pe.key}`,children:[h.jsx(_d,{className:"w-3.5 h-3.5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate",children:Pe.label})]},Pe.key)})]},ye.role))})]}),q.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),M(!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(ne).length>0?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:Object.keys(ne).length>0?Object.entries(ne).map(([ye,Pe])=>`${ye} = ${Pe}`).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:[Ce.map(ye=>h.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[h.jsx(ar,{to:ye.url,onClick:()=>H(!1),title:ye.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:ye.label}),h.jsx("button",{type:"button",onClick:()=>oe(ye),title:`Remove "${ye.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(en,{className:"w-3 h-3"})})]},`${ye.label}::${ye.url}`)),h.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),h.jsxs("button",{type:"button",onClick:_e,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(MS,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),J&&h.jsx(Pk,{onClose:()=>ce(!1)}),h.jsx(ET,{open:te,onClose:()=>M(!1)})]})}function Jm({open:n,children:e}){const[s,i]=E.useState(n);return E.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?e:null})})}function om(n){return({isActive:e})=>{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 ${e?i:o}`:`${s} gap-3 px-4 py-2 text-sm ${e?i:o}`}}function XT(){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 WT({group:n,collapsed:e}){const{pathname:s}=tn(),i=n.matchPaths.some(p=>s.startsWith(p)),[o,c]=E.useState(i),d=o||i;return e?h.jsx(h.Fragment,{children:n.items.map(p=>h.jsx(As,{to:p.to,className:om(!0),title:p.label,children:p.icon&&h.jsx(p.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},p.to))}):h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>c(p=>!p),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(Jm,{open:d,children:n.items.map(p=>h.jsxs(As,{to:p.to,end:p.end,className:XT(),children:[p.icon&&h.jsx(p.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:p.label})]},p.to))})]})}function ZT(n){return n.kind==="group"}function eC({entry:n,collapsed:e}){const{pathname:s,search:i}=tn(),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,p]=n.to.split("?"),g=s===d&&i===`?${p}`,u=om(e)({isActive:g});return h.jsxs(As,{to:n.to,className:u,title:e?n.label:void 0,children:[c,!e&&h.jsx("span",{children:n.label})]})}return h.jsxs(As,{to:n.to,end:n.end,className:om(e),title:e?n.label:void 0,children:[c,!e&&h.jsx("span",{children:n.label})]})}function qr({heading:n,entries:e}){const{collapsed:s}=Pm();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}),e.map(i=>ZT(i)?h.jsx(WT,{group:i,collapsed:s},i.label):h.jsx(eC,{entry:i,collapsed:s},i.to))]})}function tC({aiEnabled:n=!1,isBuilder:e=!1,isOps:s=!1,viewAs:i=null,canSeePaceBoard:o=!1,showLines:c=!1}){const d=[{to:"/pace",label:"Pace Board",icon:RS},{to:"/trends",label:"Trend Board",icon:DS}],p=c?[{to:"/lines",label:"Lines",icon:LS}]:[];if(!e&&(!s||i==="engineer"||i==="operator"))return o?h.jsx(qr,{heading:"Monitor",entries:d}):null;if(!e)return h.jsx(qr,{heading:"Monitor",entries:[...o?d:[],...p]});const g=[...o?d:[],...p,{to:"/topics",label:"Event Topics",icon:dx},{to:"/agents",label:n?"Agents":"Automations",icon:qS},{to:"/capabilities",label:"Capabilities",icon:PS}];return h.jsx(qr,{heading:"Monitor",entries:g})}function nC(){return Le({queryKey:["me","preferences"],queryFn:()=>ue("/me/preferences"),staleTime:6e4})}function rC(){const n=qe();return ze({mutationFn:e=>ue("/me/preferences",{method:"PATCH",body:JSON.stringify(e)}),onSuccess:e=>{n.setQueryData(["me","preferences"],e)}})}const xs={TABLE:"table",RICH:"rich",TIMELINE:"timeline"},X1={COMPACT:"compact",CARDS:"cards"},pd={AVAILABLE:"/escalations/available",ALL:"/escalations"},sa={AVAILABLE:"available",CLAIMED:"claimed",RESOLVED:"resolved",CANCELLED:"cancelled",EXPIRED:"expired"},sC={[sa.RESOLVED]:"resolved",[sa.CANCELLED]:"cancelled",[sa.EXPIRED]:"expired"};function iC(n){const e=n===sa.CLAIMED;return{available:n===sa.AVAILABLE,claimed:e,apiStatus:e?"pending":sC[n]}}function aC(n){return n===xs.TABLE||n===xs.RICH||n===xs.TIMELINE}function oC(n){return n===X1.COMPACT||n===X1.CARDS}function lC(n,e=""){const s=n.get("priority"),i=n.get("view"),o=n.get("layout");return{statusFilter:n.get("status")||e,role:n.get("role")||void 0,type:n.get("type")||void 0,subtype:n.get("subtype")||void 0,priority:s?parseInt(s,10):void 0,search:n.get("search")||void 0,facets:yN(n),view:aC(i)?i:null,layout:oC(o)?o:null}}function cC(n){let e;try{e=new URL(n,"http://local")}catch{return null}if(e.pathname!==pd.AVAILABLE&&e.pathname!==pd.ALL)return null;const s=e.pathname===pd.AVAILABLE?sa.AVAILABLE:"";return lC(e.searchParams,s)}function dR(n){var e;return n.role||(((e=n.facets.roles)==null?void 0:e.length)===1?n.facets.roles[0]:null)}function mR(n,e){return n===xs.TIMELINE?xs.TIMELINE:e&&(!n||n===xs.RICH)?xs.RICH:xs.TABLE}function uC(n,e){const s=(n==null?void 0:n.pinnedViews)??[],i=new Set((n==null?void 0:n.hiddenRolePins)??[]),o=new Set(s.map(p=>p.label)),c=[...s],d=new Set;for(const{role:p,pins:g}of e)for(const u of g)o.has(u.label)||i.has(u.label)||d.has(u.label)||(d.add(u.label),c.push({...u,id:`role:${p}:${u.label}`,fromRole:p}));return c}function fC(n){const e=cC(n);if(!e)return null;const{available:s,claimed:i,apiStatus:o}=iC(e.statusFilter);return{available:s,params:{...e.facets,role:e.role,type:e.type,subtype:e.subtype,priority:e.priority,status:o,...i?{claimed:!0}:{},search:e.search}}}function hC(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function dC(){var U;const{collapsed:n}=Pm(),{user:e}=qt(),s=nC(),i=rC(),o=E.useMemo(()=>new Set(((e==null?void 0:e.roles)??[]).map(D=>D.role)),[e]),{data:c}=Ru({enabled:o.size>0}),d=nn("SUMMARY");Ns(Cm(),()=>{d([["escalations"]])});const p=(U=s.data)==null?void 0:U.preferences,g=E.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:u}=Km(),m=E.useMemo(()=>uC(p,g),[p,g]),b=E.useMemo(()=>new Map(m.map(D=>[D.id,D.url])),[m]),x=E.useMemo(()=>m.map(D=>({...D,url:u(D.url)})),[m,u]),v=E.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(D=>[D.role,am(D)])),[c]),_=E.useMemo(()=>x.filter(D=>!D.fromRole),[x]),S=E.useMemo(()=>new Set(((c==null?void 0:c.roles)??[]).filter(D=>o.has(D.role)&&ik(D)).map(D=>D.role)),[c,o]),C=E.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(D=>S.has(D.role)||g.some(Q=>Q.role===D.role)).map(D=>({role:D.role,title:v.get(D.role)??D.role,portals:S.has(D.role)?na(D):[],pins:x.filter(Q=>Q.fromRole===D.role)})).filter(D=>D.portals.length>0||D.pins.length>0),[c,g,S,v,x]),B=(p==null?void 0:p.pinnedViews)??[],q=E.useRef(null),ne=D=>i.mutate({pinnedViews:D}),te=D=>ne(B.filter(Q=>Q.id!==D)),M=D=>ne([...B,{id:hC(),label:D.label,url:b.get(D.id)??D.url,badge:D.badge}]),z=D=>i.mutate({hiddenRolePins:[...(p==null?void 0:p.hiddenRolePins)??[],D]}),ae=(D,Q)=>{if(D===Q)return;const W=[...B],[he]=W.splice(D,1);W.splice(Q,0,he),ne(W)};if(x.length===0&&S.size===0)return null;const F="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:F,children:"Pinned"}),_.map(D=>{const Q=B.findIndex(W=>W.id===D.id);return h.jsx(W1,{pin:D,collapsed:n,draggable:Q!==-1,onDragStart:()=>{q.current=Q},onDropOn:()=>{q.current!==null&&Q!==-1&&ae(q.current,Q),q.current=null},onRemove:()=>te(D.id)},D.id)}),C.map(D=>h.jsxs("div",{children:[!n&&h.jsx("p",{className:F,title:`${D.title} — pins from the ${D.role} role`,"data-testid":"pin-group-label",children:D.title}),D.portals.map(Q=>h.jsx(mC,{role:D.role,portal:Q,collapsed:n},Q.key)),D.pins.map(Q=>h.jsx(W1,{pin:Q,collapsed:n,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>M(Q),onHide:()=>z(Q.label)},Q.id))]},D.role))]})}function mC({role:n,portal:e,collapsed:s}){const i=Dm(n,e.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}-${e.key}`;return s?h.jsx(As,{to:i,className:`${o} justify-center w-10 h-10 mx-auto`,title:e.label,"data-testid":c,children:h.jsx(_d,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs(As,{to:i,title:e.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(_d,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:e.label})]})}function W1({pin:n,collapsed:e,draggable:s,onDragStart:i,onDropOn:o,onRemove:c,onPromote:d,onHide:p}){const{pathname:g,search:u}=tn(),[m,b=""]=n.url.split("?"),x=g===m&&u===(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 e?h.jsx(As,{to:n.url,className:`${v} ${_} justify-center w-10 h-10 mx-auto`,title:n.label,children:h.jsx(qg,{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(As,{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(qg,{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(pC,{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(mx,{className:"w-3 h-3"})}),p&&h.jsx("button",{onClick:p,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(BS,{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(en,{className:"w-3 h-3"})})]})]})}function pC({url:n}){var d;const e=E.useMemo(()=>fC(n),[n]),s={limit:1,staleTime:15e3},i=vv({...(e==null?void 0:e.params)??{},...s,enabled:!!e&&e.available}),o=xv({...(e==null?void 0:e.params)??{},...s,enabled:!!e&&!e.available});if(!e)return null;const c=e.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 yC(){var c;const{data:n}=Hn(),e=(c=n==null?void 0:n.features)==null?void 0:c.graphWorkflows,s=e===!0||e!==!1&&nv(),i=[{to:"/workflows/registry",label:"Registry",icon:Pg},{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:wd},{to:"/workflows/executions",label:"Executions",icon:Bg}],o=s?[{kind:"group",label:"Procedural",icon:US,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:i},{kind:"group",label:"Graph",icon:um,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:Pg,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:wd},{to:"/mcp/executions",label:"Executions",icon:Bg}]}]:i;return h.jsx(qr,{heading:"Orchestrate",entries:o})}function pR(){return Le({queryKey:["activeWorkers"],queryFn:async()=>(await ue("/workflows/workers")).workers})}function yR(){return Le({queryKey:["discoveredWorkflows"],queryFn:async()=>(await ue("/workflows/discovered")).workflows})}function gR(){return Le({queryKey:["workflowConfigs"],queryFn:async()=>(await ue("/workflows/config")).workflows})}function Xv(){return Le({queryKey:["invocableWorkflows"],queryFn:async()=>(await ue("/workflows/invocable")).workflows})}function bR(n){return Object.fromEntries(n.filter(e=>!e.missing).map(e=>[e.as??e.key,e.data]))}function xR(n,e){return Le({queryKey:["workflows",n,"input-lookups"],queryFn:()=>ue(`/workflows/${encodeURIComponent(n)}/input-lookups`),enabled:!!n&&e,staleTime:0,refetchOnWindowFocus:!1})}function vR(){return Le({queryKey:["cronStatus"],queryFn:async()=>(await ue("/workflows/cron/status")).schedules})}function _R(n){return Le({queryKey:["workflowExecution",n],queryFn:()=>ue(`/workflow-states/${n}/execution`),enabled:!!n})}function wR(n,e){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),Le({queryKey:["jobs",n],queryFn:()=>ue(`/workflow-states/jobs?${s}`),enabled:(e==null?void 0:e.enabled)??!0})}function SR(){const n=qe();return ze({mutationFn:e=>ue(`/workflows/${e}/terminate`,{method:"POST"}),onSuccess:(e,s)=>{n.invalidateQueries({queryKey:["workflowExecution",s],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function ER(){const n=qe();return ze({mutationFn:({workflow_type:e,...s})=>ue(`/workflows/${encodeURIComponent(e)}/config`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function OR(){const n=qe();return ze({mutationFn:e=>ue(`/workflows/${encodeURIComponent(e)}/config`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function AR(){const n=qe();return ze({mutationFn:({workflowType:e,data:s,metadata:i,execute_as:o})=>ue(`/workflows/${e}/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 gC(){const{data:n}=Xv();return n!=null&&n.length?h.jsx(qr,{heading:"Tools",entries:[{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:wd}]}):null}const bC=[{to:"/mcp/queries",label:"Designer",icon:zS},{to:"/mcp/servers",label:"Servers & Tools",icon:$S}];function xC(){return h.jsx(qr,{heading:"Design",entries:bC})}const vC=[{to:"/files",label:"Files",icon:IS},{to:"/knowledge",label:"Knowledge Base",icon:px}];function _C(){return h.jsx(qr,{heading:"Storage",entries:vC})}function wC({isBuilder:n=!1,isOps:e=!1}){var d;const{data:s}=Hn(),i=((d=s==null?void 0:s.features)==null?void 0:d.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:HS},...n||e?[{to:"/admin/roles",label:"Roles",icon:vd},{to:"/admin/personas",label:"Personas",icon:FS},{to:"/admin/scan-codes",label:"Scan Codes",icon:Ro},{to:"/admin/labels/history",label:"Label History",icon:GS}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:VS},{to:"/admin/streams",label:"Messages",icon:px},...i?[{to:"/admin/maintenance",label:"DB Maintenance",icon:YS}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(qr,{heading:"Identity & Access",entries:o}),n&&rv()&&h.jsx(qr,{heading:"Infrastructure",entries:c})]})}function Wv({aiEnabled:n,isBuilder:e,isOps:s,viewAs:i,canSeePaceBoard:o,showLines:c}){return h.jsxs(h.Fragment,{children:[h.jsx(tC,{aiEnabled:n,isBuilder:e,isOps:s,viewAs:i,canSeePaceBoard:o,showLines:c}),h.jsx(dC,{}),!e&&h.jsx(gC,{}),e&&h.jsx(yC,{}),e&&n&&h.jsx(xC,{}),e&&h.jsx(_C,{}),(e||s)&&h.jsx(wC,{isBuilder:e,isOps:s})]})}function SC({open:n,onClose:e,...s}){const i=tn();return E.useEffect(()=>{e()},[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:e,"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:e,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(en,{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(fk,{children:h.jsx(Wv,{...s})})})]})]})}const Zv="lt_event_feed_patterns";function EC(n,e){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(e).get("role");return d?`lt.events.system.escalation.${ov(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 OC(){try{const n=localStorage.getItem(Zv);return n?JSON.parse(n):[]}catch{return[]}}function yd(n){try{localStorage.setItem(Zv,JSON.stringify(n))}catch{}}function AC(){const{pathname:n,search:e}=tn(),[s,i]=E.useState(OC),o=E.useMemo(()=>EC(n,e),[n,e]),c=E.useMemo(()=>{const u=new Set([o,...s]);return Array.from(u)},[o,s]),d=E.useCallback(u=>{const m=u.startsWith("lt.events.")?u:`lt.events.${u}`;i(b=>{if(b.includes(m))return b;const x=[...b,m];return yd(x),x})},[]),p=E.useCallback(u=>{i(m=>{const b=m.filter(x=>x!==u);return yd(b),b})},[]),g=E.useCallback(()=>{i([]),yd([])},[]);return{patterns:c,pagePattern:o,userPatterns:s,addPattern:d,removePattern:p,clearUserPatterns:g}}function jC({children:n,className:e=""}){return h.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${e}`,children:n})}const gd=280,Z1="cubic-bezier(0.4, 0, 0.2, 1)",Zc=40;function kC(n){if(!n)return"scale(0.92)";const e=window.innerWidth,s=window.innerHeight,i=e-Zc*2,o=s-Zc*2,c=n.width/i,d=n.height/o,p=n.left+n.width/2-(Zc+i/2),g=n.top+n.height/2-(Zc+o/2);return`translate(${p}px, ${g}px) scale(${c}, ${d})`}function e_({open:n,onClose:e,sourceRef:s,children:i}){const[o,c]=E.useState(null),d=E.useRef(null),p=E.useRef(!1);E.useEffect(()=>{var x,v;n&&!p.current?(d.current=((x=s==null?void 0:s.current)==null?void 0:x.getBoundingClientRect())??null,c("entering")):!n&&p.current&&o==="open"&&(d.current=((v=s==null?void 0:s.current)==null?void 0:v.getBoundingClientRect())??null,c("exiting")),p.current=n},[n,s,o]),E.useEffect(()=>{if(o!=="entering")return;const x=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(x)},[o]),E.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),E.useEffect(()=>{if(!o)return;const x=v=>{v.key==="Escape"&&e()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[o,e]);const g=E.useCallback(x=>{x.propertyName==="transform"&&o==="exiting"&&c(null)},[o]);if(E.useEffect(()=>{if(o!=="exiting")return;const x=setTimeout(()=>c(null),gd+50);return()=>clearTimeout(x)},[o]),!o)return null;const u=o==="entering"||o==="exiting",m=u?kC(d.current):"none",b=u?0:1;return lm.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${gd}ms ${Z1}, opacity ${gd}ms ${Z1}`,transform:m,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:i}),document.body)}function NC({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 TC({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 CC({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 MC({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 RC({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 DC({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 LC(n){const e=n.trim().split(`
|
|
57
|
+
`);if(e.length<2)return n;const s=p=>p.split("|").map(g=>g.trim()).filter(Boolean),i=s(e[0]),o=e.slice(2),c=i.map(p=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${p}</th>`).join(""),d=o.map(p=>`<tr class="border-t border-surface-border">${s(p).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 eu(n){return n.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function qC(n){const e=[];let s=n.replace(/```(\w*)\n([\s\S]*?)```/g,(g,u,m)=>{const b=e.length;return e.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,u,m,b)=>LC(`${u}
|
|
58
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,u)=>`<h4 id="${eu(u)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${u}</h4>`).replace(/^### (.+)$/gm,(g,u)=>`<h3 id="${eu(u)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${u}</h3>`).replace(/^## (.+)$/gm,(g,u)=>`<h2 id="${eu(u)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${u}</h2>`).replace(/^# (.+)$/gm,(g,u)=>`<h1 id="${eu(u)}" class="text-lg font-bold text-text-primary mb-3">${u}</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 u=g.replace(/^> /gm,"").trim(),m=/⚠️|warning|caution/i.test(u),b=/note:|ℹ️|info/i.test(u);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">${u}</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,u)=>e[parseInt(u,10)]);const d="text-xs leading-relaxed text-text-secondary mb-2",p=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const u=g.trim();if(!u)return"";const m=[];let b=u,x;for(;(x=p.exec(b))!==null;){const v=x.index+x[0].length;m.push(b.slice(0,v)),b=b.slice(v).replace(/^<br\/>/,"").trim(),p.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 qC=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function PC(n){return qC.test(n)}function Bu({content:n,className:e,onClick:s}){const i=E.useMemo(()=>LC(n),[n]);return h.jsx("div",{className:e,onClick:s,dangerouslySetInnerHTML:{__html:i}})}function Eu({data:n,depth:e=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:e>0,[c,d]=E.useState(o),[p,g]=E.useState(s);if(s!==void 0&&s!==p&&(g(s),d(s%2===0&&e>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((u,m)=>h.jsxs("div",{children:[h.jsx(Eu,{data:u,depth:e+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 u=Object.entries(n);return u.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:u.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(Eu,{data:b,depth:e+1,generation:s}),x<u.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 Ao({data:n,depth:e=0}){if(n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return n.length>40&&PC(n)?h.jsx(Bu,{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(Ao,{data:s,depth:e+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:e>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(Ao,{data:o,depth:e+1})}):h.jsx(Ao,{data:o,depth:e+1})]},i)})})}return h.jsx("span",{children:String(n)})}function ex({mode:n,setMode:e,isCollapsed:s,onToggleCollapse:i,onCopy:o,copied:c,onFullscreen:d,onClose:p,large:g}){const u=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(RC,{className:u}):h.jsx(MC,{className:u})}),h.jsx("button",{onClick:()=>e(n==="json"?"tree":"json"),className:m,title:n==="json"?"Outline view":"JSON view",children:n==="json"?h.jsx(kC,{className:u}):h.jsx(NC,{className:u})}),h.jsx("button",{onClick:o,className:m,title:"Copy to clipboard",children:c?h.jsx(CC,{className:`${u} text-status-success`}):h.jsx(TC,{className:u})}),d&&h.jsx("button",{onClick:d,className:m,title:"Fullscreen",children:h.jsx(yx,{className:u})}),p&&h.jsx("button",{onClick:p,className:m,title:"Close (Esc)",children:h.jsx(gx,{className:u})})]})}function BC({data:n,label:e,variant:s,defaultCollapsed:i=!1,defaultMode:o}){const c=E.useRef(null),[d,p]=E.useState(o??"json"),[g,u]=E.useState(!1),[m,b]=E.useState(!1),[x,v]=E.useState(i?0:1),[_,S]=E.useState(1),C=x%2===0,B=_%2===0,q=E.useCallback(()=>v(D=>D+1),[]),ne=E.useCallback(()=>S(D=>D+1),[]);let te=n;if(typeof n=="string")try{te=JSON.parse(n)}catch{}const M=async()=>{const D=typeof n=="string"?n:JSON.stringify(te,null,2);await navigator.clipboard.writeText(D),u(!0),setTimeout(()=>u(!1),2e3)},z=E.useCallback(()=>{S(1),b(!0)},[]),ae=s==="panel",F=ae?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",U=ae?"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:F,children:[e&&h.jsx(AC,{children:e}),h.jsxs("div",{ref:c,className:"relative",children:[h.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:h.jsx(ex,{mode:d,setMode:p,isCollapsed:C,onToggleCollapse:q,onCopy:M,copied:g,onFullscreen:z})}),h.jsx("div",{className:U,children:d==="json"?h.jsx(Eu,{data:te,generation:x}):h.jsx(Ao,{data:te})})]}),h.jsxs(e_,{open:m,onClose:()=>b(!1),sourceRef:c,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx(ex,{mode:d,setMode:p,isCollapsed:B,onToggleCollapse:ne,onCopy:M,copied:g,onClose:()=>b(!1),large:!0})}),h.jsx("div",{className:"font-mono text-sm leading-relaxed",children:d==="json"?h.jsx(Eu,{data:te,generation:_}):h.jsx(Ao,{data:te})})]})]})}const UC=100,tx=500;let zC=0;const t_={"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 n_(n){const e=n.split(".");return e[0]==="system"&&e.length>=3?`${e[1]}.${e[e.length-1]}`:n}function nx({event:n,forceExpanded:e=!1}){var x,v;const[s,i]=E.useState(e),o=t_[n_(n.type)]||"text-text-tertiary";E.useEffect(()=>{i(e)},[e]);const c=e,d=c?"text-xs":"text-2xs",p=c?"text-xs":"text-2xs",g=c?"text-xs":"text-2xs",u=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:`${p} 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:`${u} 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(Jm,{open:s,children:h.jsx("div",{className:b,children:h.jsx(BC,{data:n.data})})})]})}function $C({open:n,onToggle:e,configOpen:s,onToggleConfig:i}){const[o,c]=E.useState([]),[d,p]=E.useState(!1),[g,u]=E.useState(""),m=E.useRef(null),b=E.useRef(new Map),{subscribe:x}=E.useContext(ca),{connected:v}=zx(),{patterns:_,pagePattern:S,userPatterns:C,addPattern:B,removePattern:q}=OC(),ne=E.useCallback(z=>{const ae=String(z.type||"unknown");if(ae.startsWith("mesh."))return;const F=`${ae}:${z.timestamp||""}:${z.escalationId||z.workflowId||z.taskId||""}`,U=Date.now(),D=b.current.get(F);if(!(D&&U-D<tx)){if(b.current.set(F,U),b.current.size>200)for(const[Q,W]of b.current)U-W>tx*2&&b.current.delete(Q);c(Q=>[{id:++zC,type:ae,timestamp:z.timestamp||new Date().toISOString(),data:z},...Q].slice(0,UC))}},[]),te=E.useRef(ne);te.current=ne;const M=n||d||s;return E.useEffect(()=>{if(!M)return;const z=_.map(ae=>x(ae,F=>te.current(F)));return()=>z.forEach(ae=>ae())},[x,_.join(","),M]),E.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:e,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(cm,{className:"w-3 h-3 text-text-tertiary"}):h.jsx(bx,{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 ${t_[n_(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:z=>{z.stopPropagation(),v||window.location.reload()},children:h.jsx(dx,{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:z=>{z.stopPropagation(),i()},children:h.jsx(KS,{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:z=>{z.stopPropagation(),p(!0)},children:h.jsx(yx,{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:z=>{z.stopPropagation(),c([])},children:h.jsx(JS,{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(z=>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:[z.replace("lt.events.",""),h.jsx("button",{onClick:()=>q(z),className:"text-text-quaternary hover:text-status-error",children:h.jsx(en,{className:"w-2 h-2"})})]},z))]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",value:g,onChange:z=>u(z.target.value),onKeyDown:z=>{z.key==="Enter"&&g.trim()&&(B(g.trim()),u(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),h.jsxs("button",{onClick:()=>{g.trim()&&(B(g.trim()),u(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[h.jsx(mx,{className:"w-2.5 h-2.5"})," Add"]})]})]}),h.jsx(Jm,{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(z=>h.jsx(nx,{event:z},z.id))})}),h.jsxs(e_,{open:d,onClose:()=>p(!1),sourceRef:m,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx("button",{onClick:()=>p(!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(gx,{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(z=>h.jsx(nx,{event:z,forceExpanded:!0},z.id))]})]})}function IC(){return Pe({queryKey:["docs"],queryFn:()=>ue("/docs"),staleTime:5*6e4})}function HC(n){return Pe({queryKey:["docs",n],queryFn:()=>ue(`/docs/read?path=${encodeURIComponent(n)}`),enabled:!!n,staleTime:5*6e4})}function FC(){const[n,e]=E.useState([]),[s,i]=E.useState([]),[o,c]=E.useState(null),d=E.useRef(o),p=E.useRef(n),g=E.useRef(s);d.current=o,p.current=n,g.current=s;const u=E.useCallback((_,S)=>{var B;const C=d.current;if(C){const q=((B=S==null?void 0:S.current)==null?void 0:B.scrollTop)??0;e([...p.current,{...C,scrollTop:q}])}i([]),c({path:_,scrollTop:0})},[]),m=E.useCallback(_=>{var q;const S=p.current;if(S.length===0)return;const C=S[S.length-1],B=d.current;if(B){const ne=((q=_==null?void 0:_.current)==null?void 0:q.scrollTop)??0;i([...g.current,{...B,scrollTop:ne}])}e(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{_!=null&&_.current&&(_.current.scrollTop=C.scrollTop)})},[]),b=E.useCallback(_=>{var q;const S=g.current;if(S.length===0)return;const C=S[S.length-1],B=d.current;if(B){const ne=((q=_==null?void 0:_.current)==null?void 0:q.scrollTop)??0;e([...p.current,{...B,scrollTop:ne}])}i(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{_!=null&&_.current&&(_.current.scrollTop=C.scrollTop)})},[]),x=E.useCallback(_=>{var B,q;const S=d.current;if(!S)return;const C=((B=_==null?void 0:_.current)==null?void 0:B.scrollTop)??0;e([...p.current,{...S,scrollTop:C}]),i([]),c({...S,scrollTop:((q=_==null?void 0:_.current)==null?void 0:q.scrollTop)??0})},[]),v=E.useCallback(()=>{e([]),i([]),c(null)},[]);return{current:o,backStack:n,forwardStack:s,navigate:u,goBack:m,goForward:b,pushScrollPosition:x,reset:v}}function GC(n,e){const[s,i]=n.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const d=((e?e.replace(/[^/]+$/,""):"")+o).split("/"),p=[];for(const g of d)g===".."?p.pop():g&&g!=="."&&p.push(g);o=p.join("/")}return{path:o,anchor:i}}function VC(n){if(!n.startsWith("#docs"))return null;const e=n.slice(1).split(":"),s=e[1]||"README.md",i=e[2]||void 0;return{path:s,anchor:i}}function YC(n){return!n||n==="README.md"?"#docs":`#docs:${n}`}function KC({content:n,currentPath:e,onNavigate:s,onAnchorClick:i}){const o=c=>{var u;const d=c.target,p=d.closest("[data-anchor]");if(p){c.preventDefault(),i();const m=p.dataset.anchor,b=(u=p.closest(".docs-content"))==null?void 0:u.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}=GC(g.dataset.docLink,e);s(m,b);return}};return h.jsx(Bu,{content:n,className:"docs-content",onClick:o})}function JC(n){const e=[],s=new Map;for(const i of n){const o=i.path.split("/");if(o.length===1){e.push(i);continue}let c=s;for(let d=0;d<o.length-1;d++){const p=o[d];c.has(p)||c.set(p,{label:p,children:[],subdirs:new Map});const g=c.get(p);d===o.length-2?g.children.push(i):c=g.subdirs}}return{topLevel:e,dirs:s}}function QC({docs:n,selected:e,onSelect:s}){const{topLevel:i,dirs:o}=JC(n),c=p=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${e===p?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function d(p,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(QS,{className:"w-3 h-3",strokeWidth:1.5}),p.label]}),h.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...p.subdirs.values()].map(u=>d(u)),p.children.map(u=>h.jsx("button",{className:c(u.path),onClick:()=>s(u.path),children:u.title},u.path))]})]},p.label)}return h.jsxs("div",{className:"space-y-0.5",children:[i.map(p=>h.jsx("button",{className:c(p.path),onClick:()=>s(p.path),children:p.title},p.path)),[...o.values()].map(p=>d(p))]})}function XC({open:n,onClose:e}){var ae,F,U;const[s,i]=E.useState(!1),{data:o}=IC(),c=FC(),{data:d,isLoading:p}=HC(((ae=c.current)==null?void 0:ae.path)??null),g=E.useRef(null),[u,m]=E.useState(null);E.useEffect(()=>{u&&(d!=null&&d.content)&&g.current&&requestAnimationFrame(()=>{var Q;const D=(Q=g.current)==null?void 0:Q.querySelector(`#${CSS.escape(u)}`);D==null||D.scrollIntoView({behavior:"smooth",block:"start"}),m(null)})},[u,d]);const b=E.useCallback(()=>{var W;const D=VC(window.location.hash),Q=(D==null?void 0:D.path)??"README.md";((W=c.current)==null?void 0:W.path)!==Q&&c.navigate(Q,g),D!=null&&D.anchor&&m(D.anchor)},[c]),x=E.useRef(!0);E.useEffect(()=>{if(!n||!c.current)return;if(x.current){x.current=!1;return}const D=YC(c.current.path);window.location.hash!==D&&window.history.replaceState(null,"",window.location.pathname+window.location.search+D)},[n,(F=c.current)==null?void 0:F.path]),E.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=E.useCallback((D,Q)=>{Q&&m(Q),c.navigate(D,g)},[c]),_=E.useCallback(D=>{c.navigate(D,g)},[c]),S=E.useCallback(()=>{c.goBack(g)},[c]),C=E.useCallback(()=>{c.goForward(g)},[c]),B=E.useCallback(()=>{c.pushScrollPosition(g)},[c]);if(E.useEffect(()=>{if(n){x.current=!0,b();const D=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(D)}},[n]),!(n||s))return null;const ne=()=>{i(!1),setTimeout(()=>{e(),c.reset()},200)},te=((U=c.current)==null?void 0:U.path)??null,M=c.backStack.length>0,z=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:ne}),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:!M,className:`p-0.5 transition-colors ${M?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:h.jsx(hx,{className:"w-4 h-4"})}),h.jsx("button",{onClick:C,disabled:!z,className:`p-0.5 transition-colors ${z?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:h.jsx(xd,{className:"w-4 h-4"})}),h.jsx(XS,{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:ne,className:"p-1 text-text-tertiary hover:text-text-primary",children:h.jsx(en,{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(QC,{docs:o.docs,selected:te,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:te?p?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(KC,{content:d.content,currentPath:te,onNavigate:v,onAnchorClick:B}):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(xd,{className:"w-5 h-5 mb-2"}),h.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function WC(n){if(n.includes("/escalations"))return["escalation","human-queue"]}const rx=2e3;function ZC(n){const s=n.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
|
|
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,u)=>`<h4 id="${eu(u)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${u}</h4>`).replace(/^### (.+)$/gm,(g,u)=>`<h3 id="${eu(u)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${u}</h3>`).replace(/^## (.+)$/gm,(g,u)=>`<h2 id="${eu(u)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${u}</h2>`).replace(/^# (.+)$/gm,(g,u)=>`<h1 id="${eu(u)}" class="text-lg font-bold text-text-primary mb-3">${u}</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 u=g.replace(/^> /gm,"").trim(),m=/⚠️|warning|caution/i.test(u),b=/note:|ℹ️|info/i.test(u);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">${u}</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,u)=>e[parseInt(u,10)]);const d="text-xs leading-relaxed text-text-secondary mb-2",p=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const u=g.trim();if(!u)return"";const m=[];let b=u,x;for(;(x=p.exec(b))!==null;){const v=x.index+x[0].length;m.push(b.slice(0,v)),b=b.slice(v).replace(/^<br\/>/,"").trim(),p.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 PC=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function BC(n){return PC.test(n)}function Bu({content:n,className:e,onClick:s}){const i=E.useMemo(()=>qC(n),[n]);return h.jsx("div",{className:e,onClick:s,dangerouslySetInnerHTML:{__html:i}})}function Eu({data:n,depth:e=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:e>0,[c,d]=E.useState(o),[p,g]=E.useState(s);if(s!==void 0&&s!==p&&(g(s),d(s%2===0&&e>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((u,m)=>h.jsxs("div",{children:[h.jsx(Eu,{data:u,depth:e+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 u=Object.entries(n);return u.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:u.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(Eu,{data:b,depth:e+1,generation:s}),x<u.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 Ao({data:n,depth:e=0}){if(n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return n.length>40&&BC(n)?h.jsx(Bu,{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(Ao,{data:s,depth:e+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:e>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(Ao,{data:o,depth:e+1})}):h.jsx(Ao,{data:o,depth:e+1})]},i)})})}return h.jsx("span",{children:String(n)})}function ex({mode:n,setMode:e,isCollapsed:s,onToggleCollapse:i,onCopy:o,copied:c,onFullscreen:d,onClose:p,large:g}){const u=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(DC,{className:u}):h.jsx(RC,{className:u})}),h.jsx("button",{onClick:()=>e(n==="json"?"tree":"json"),className:m,title:n==="json"?"Outline view":"JSON view",children:n==="json"?h.jsx(NC,{className:u}):h.jsx(TC,{className:u})}),h.jsx("button",{onClick:o,className:m,title:"Copy to clipboard",children:c?h.jsx(MC,{className:`${u} text-status-success`}):h.jsx(CC,{className:u})}),d&&h.jsx("button",{onClick:d,className:m,title:"Fullscreen",children:h.jsx(yx,{className:u})}),p&&h.jsx("button",{onClick:p,className:m,title:"Close (Esc)",children:h.jsx(gx,{className:u})})]})}function UC({data:n,label:e,variant:s,defaultCollapsed:i=!1,defaultMode:o}){const c=E.useRef(null),[d,p]=E.useState(o??"json"),[g,u]=E.useState(!1),[m,b]=E.useState(!1),[x,v]=E.useState(i?0:1),[_,S]=E.useState(1),C=x%2===0,B=_%2===0,q=E.useCallback(()=>v(D=>D+1),[]),ne=E.useCallback(()=>S(D=>D+1),[]);let te=n;if(typeof n=="string")try{te=JSON.parse(n)}catch{}const M=async()=>{const D=typeof n=="string"?n:JSON.stringify(te,null,2);await navigator.clipboard.writeText(D),u(!0),setTimeout(()=>u(!1),2e3)},z=E.useCallback(()=>{S(1),b(!0)},[]),ae=s==="panel",F=ae?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",U=ae?"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:F,children:[e&&h.jsx(jC,{children:e}),h.jsxs("div",{ref:c,className:"relative",children:[h.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:h.jsx(ex,{mode:d,setMode:p,isCollapsed:C,onToggleCollapse:q,onCopy:M,copied:g,onFullscreen:z})}),h.jsx("div",{className:U,children:d==="json"?h.jsx(Eu,{data:te,generation:x}):h.jsx(Ao,{data:te})})]}),h.jsxs(e_,{open:m,onClose:()=>b(!1),sourceRef:c,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx(ex,{mode:d,setMode:p,isCollapsed:B,onToggleCollapse:ne,onCopy:M,copied:g,onClose:()=>b(!1),large:!0})}),h.jsx("div",{className:"font-mono text-sm leading-relaxed",children:d==="json"?h.jsx(Eu,{data:te,generation:_}):h.jsx(Ao,{data:te})})]})]})}const zC=100,tx=500;let $C=0;const t_={"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 n_(n){const e=n.split(".");return e[0]==="system"&&e.length>=3?`${e[1]}.${e[e.length-1]}`:n}function nx({event:n,forceExpanded:e=!1}){var x,v;const[s,i]=E.useState(e),o=t_[n_(n.type)]||"text-text-tertiary";E.useEffect(()=>{i(e)},[e]);const c=e,d=c?"text-xs":"text-2xs",p=c?"text-xs":"text-2xs",g=c?"text-xs":"text-2xs",u=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:`${p} 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:`${u} 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(Jm,{open:s,children:h.jsx("div",{className:b,children:h.jsx(UC,{data:n.data})})})]})}function IC({open:n,onToggle:e,configOpen:s,onToggleConfig:i}){const[o,c]=E.useState([]),[d,p]=E.useState(!1),[g,u]=E.useState(""),m=E.useRef(null),b=E.useRef(new Map),{subscribe:x}=E.useContext(ca),{connected:v}=zx(),{patterns:_,pagePattern:S,userPatterns:C,addPattern:B,removePattern:q}=AC(),ne=E.useCallback(z=>{const ae=String(z.type||"unknown");if(ae.startsWith("mesh."))return;const F=`${ae}:${z.timestamp||""}:${z.escalationId||z.workflowId||z.taskId||""}`,U=Date.now(),D=b.current.get(F);if(!(D&&U-D<tx)){if(b.current.set(F,U),b.current.size>200)for(const[Q,W]of b.current)U-W>tx*2&&b.current.delete(Q);c(Q=>[{id:++$C,type:ae,timestamp:z.timestamp||new Date().toISOString(),data:z},...Q].slice(0,zC))}},[]),te=E.useRef(ne);te.current=ne;const M=n||d||s;return E.useEffect(()=>{if(!M)return;const z=_.map(ae=>x(ae,F=>te.current(F)));return()=>z.forEach(ae=>ae())},[x,_.join(","),M]),E.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:e,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(cm,{className:"w-3 h-3 text-text-tertiary"}):h.jsx(bx,{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 ${t_[n_(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:z=>{z.stopPropagation(),v||window.location.reload()},children:h.jsx(dx,{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:z=>{z.stopPropagation(),i()},children:h.jsx(KS,{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:z=>{z.stopPropagation(),p(!0)},children:h.jsx(yx,{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:z=>{z.stopPropagation(),c([])},children:h.jsx(JS,{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(z=>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:[z.replace("lt.events.",""),h.jsx("button",{onClick:()=>q(z),className:"text-text-quaternary hover:text-status-error",children:h.jsx(en,{className:"w-2 h-2"})})]},z))]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",value:g,onChange:z=>u(z.target.value),onKeyDown:z=>{z.key==="Enter"&&g.trim()&&(B(g.trim()),u(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),h.jsxs("button",{onClick:()=>{g.trim()&&(B(g.trim()),u(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[h.jsx(mx,{className:"w-2.5 h-2.5"})," Add"]})]})]}),h.jsx(Jm,{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(z=>h.jsx(nx,{event:z},z.id))})}),h.jsxs(e_,{open:d,onClose:()=>p(!1),sourceRef:m,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx("button",{onClick:()=>p(!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(gx,{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(z=>h.jsx(nx,{event:z,forceExpanded:!0},z.id))]})]})}function HC(){return Le({queryKey:["docs"],queryFn:()=>ue("/docs"),staleTime:5*6e4})}function FC(n){return Le({queryKey:["docs",n],queryFn:()=>ue(`/docs/read?path=${encodeURIComponent(n)}`),enabled:!!n,staleTime:5*6e4})}function GC(){const[n,e]=E.useState([]),[s,i]=E.useState([]),[o,c]=E.useState(null),d=E.useRef(o),p=E.useRef(n),g=E.useRef(s);d.current=o,p.current=n,g.current=s;const u=E.useCallback((_,S)=>{var B;const C=d.current;if(C){const q=((B=S==null?void 0:S.current)==null?void 0:B.scrollTop)??0;e([...p.current,{...C,scrollTop:q}])}i([]),c({path:_,scrollTop:0})},[]),m=E.useCallback(_=>{var q;const S=p.current;if(S.length===0)return;const C=S[S.length-1],B=d.current;if(B){const ne=((q=_==null?void 0:_.current)==null?void 0:q.scrollTop)??0;i([...g.current,{...B,scrollTop:ne}])}e(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{_!=null&&_.current&&(_.current.scrollTop=C.scrollTop)})},[]),b=E.useCallback(_=>{var q;const S=g.current;if(S.length===0)return;const C=S[S.length-1],B=d.current;if(B){const ne=((q=_==null?void 0:_.current)==null?void 0:q.scrollTop)??0;e([...p.current,{...B,scrollTop:ne}])}i(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{_!=null&&_.current&&(_.current.scrollTop=C.scrollTop)})},[]),x=E.useCallback(_=>{var B,q;const S=d.current;if(!S)return;const C=((B=_==null?void 0:_.current)==null?void 0:B.scrollTop)??0;e([...p.current,{...S,scrollTop:C}]),i([]),c({...S,scrollTop:((q=_==null?void 0:_.current)==null?void 0:q.scrollTop)??0})},[]),v=E.useCallback(()=>{e([]),i([]),c(null)},[]);return{current:o,backStack:n,forwardStack:s,navigate:u,goBack:m,goForward:b,pushScrollPosition:x,reset:v}}function VC(n,e){const[s,i]=n.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const d=((e?e.replace(/[^/]+$/,""):"")+o).split("/"),p=[];for(const g of d)g===".."?p.pop():g&&g!=="."&&p.push(g);o=p.join("/")}return{path:o,anchor:i}}function YC(n){if(!n.startsWith("#docs"))return null;const e=n.slice(1).split(":"),s=e[1]||"README.md",i=e[2]||void 0;return{path:s,anchor:i}}function KC(n){return!n||n==="README.md"?"#docs":`#docs:${n}`}function JC({content:n,currentPath:e,onNavigate:s,onAnchorClick:i}){const o=c=>{var u;const d=c.target,p=d.closest("[data-anchor]");if(p){c.preventDefault(),i();const m=p.dataset.anchor,b=(u=p.closest(".docs-content"))==null?void 0:u.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}=VC(g.dataset.docLink,e);s(m,b);return}};return h.jsx(Bu,{content:n,className:"docs-content",onClick:o})}function QC(n){const e=[],s=new Map;for(const i of n){const o=i.path.split("/");if(o.length===1){e.push(i);continue}let c=s;for(let d=0;d<o.length-1;d++){const p=o[d];c.has(p)||c.set(p,{label:p,children:[],subdirs:new Map});const g=c.get(p);d===o.length-2?g.children.push(i):c=g.subdirs}}return{topLevel:e,dirs:s}}function XC({docs:n,selected:e,onSelect:s}){const{topLevel:i,dirs:o}=QC(n),c=p=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${e===p?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function d(p,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(QS,{className:"w-3 h-3",strokeWidth:1.5}),p.label]}),h.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...p.subdirs.values()].map(u=>d(u)),p.children.map(u=>h.jsx("button",{className:c(u.path),onClick:()=>s(u.path),children:u.title},u.path))]})]},p.label)}return h.jsxs("div",{className:"space-y-0.5",children:[i.map(p=>h.jsx("button",{className:c(p.path),onClick:()=>s(p.path),children:p.title},p.path)),[...o.values()].map(p=>d(p))]})}function WC({open:n,onClose:e}){var ae,F,U;const[s,i]=E.useState(!1),{data:o}=HC(),c=GC(),{data:d,isLoading:p}=FC(((ae=c.current)==null?void 0:ae.path)??null),g=E.useRef(null),[u,m]=E.useState(null);E.useEffect(()=>{u&&(d!=null&&d.content)&&g.current&&requestAnimationFrame(()=>{var Q;const D=(Q=g.current)==null?void 0:Q.querySelector(`#${CSS.escape(u)}`);D==null||D.scrollIntoView({behavior:"smooth",block:"start"}),m(null)})},[u,d]);const b=E.useCallback(()=>{var W;const D=YC(window.location.hash),Q=(D==null?void 0:D.path)??"README.md";((W=c.current)==null?void 0:W.path)!==Q&&c.navigate(Q,g),D!=null&&D.anchor&&m(D.anchor)},[c]),x=E.useRef(!0);E.useEffect(()=>{if(!n||!c.current)return;if(x.current){x.current=!1;return}const D=KC(c.current.path);window.location.hash!==D&&window.history.replaceState(null,"",window.location.pathname+window.location.search+D)},[n,(F=c.current)==null?void 0:F.path]),E.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=E.useCallback((D,Q)=>{Q&&m(Q),c.navigate(D,g)},[c]),_=E.useCallback(D=>{c.navigate(D,g)},[c]),S=E.useCallback(()=>{c.goBack(g)},[c]),C=E.useCallback(()=>{c.goForward(g)},[c]),B=E.useCallback(()=>{c.pushScrollPosition(g)},[c]);if(E.useEffect(()=>{if(n){x.current=!0,b();const D=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(D)}},[n]),!(n||s))return null;const ne=()=>{i(!1),setTimeout(()=>{e(),c.reset()},200)},te=((U=c.current)==null?void 0:U.path)??null,M=c.backStack.length>0,z=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:ne}),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:!M,className:`p-0.5 transition-colors ${M?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:h.jsx(hx,{className:"w-4 h-4"})}),h.jsx("button",{onClick:C,disabled:!z,className:`p-0.5 transition-colors ${z?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:h.jsx(xd,{className:"w-4 h-4"})}),h.jsx(XS,{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:ne,className:"p-1 text-text-tertiary hover:text-text-primary",children:h.jsx(en,{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(XC,{docs:o.docs,selected:te,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:te?p?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(JC,{content:d.content,currentPath:te,onNavigate:v,onAnchorClick:B}):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(xd,{className:"w-5 h-5 mb-2"}),h.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function ZC(n){if(n.includes("/escalations"))return["escalation","human-queue"]}const rx=2e3;function e3(n){const s=n.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
|
|
60
60
|
${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
|
|
61
61
|
`)}
|
|
62
62
|
[End prior conversation]
|
|
63
63
|
|
|
64
|
-
`}function
|
|
65
|
-
... (truncated)`});const ae=`${ZC(o.concat(ne))}${B}`;try{const D=(await ue("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ae,tags:M.suggestedTags,context:M,wait:!1,direct:!0})})).workflow_id;p(D),c(Q=>Q.map(W=>W.id===te.id?{...W,workflowId:D}:W)),m.current&&clearInterval(m.current),m.current=setInterval(async()=>{var Q;try{const W=await ue(`/workflows/${D}/result`),he=(Q=W==null?void 0:W.result)==null?void 0:Q.data;if(he){m.current&&clearInterval(m.current),m.current=null,p(null);const Ee=e3(he);let Ae;try{Ae=(await ue(`/workflow-states/${D}/execution`)).duration_ms}catch{}c(H=>H.map(J=>J.id===te.id?{...J,content:Ee,timestamp:new Date().toISOString(),pending:!1,durationMs:Ae}:J))}}catch{}},3e3)}catch{c(U=>U.map(D=>D.id===te.id?{...D,content:"Failed to submit query. Please try again.",pending:!1}:D))}},[o,b]),C=E.useCallback(async B=>{const q=o.find(M=>M.id===B);if(!(q!=null&&q.workflowId)||q.compilationStatus==="compiling"||q.compilationStatus==="done")return;const ne=o.indexOf(q),te=o.slice(0,ne).reverse().find(M=>M.role==="user");if(te){c(M=>M.map(z=>z.id===B?{...z,compilationStatus:"compiling"}:z));try{const M=await ue("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:te.content,summary:q.content})}),z=await ue("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:q.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:M.tool_name,description:M.description,tags:M.tags,app_id:""})});await ue(`/yaml-workflows/${z.id}/deploy`,{method:"POST"}),c(ae=>ae.map(F=>F.id===B?{...F,compilationStatus:"done"}:F))}catch(M){const z=M instanceof Error?M.message:"Compilation failed";c(ae=>ae.map(F=>F.id===B?{...F,compilationStatus:"error",compilationError:z}:F))}}},[o]);return h.jsx(r_.Provider,{value:{helpOpen:s,setHelpOpen:i,toggleHelp:x,messages:o,sendMessage:S,pageContext:b,setPageContext:v,activeWorkflowId:d,clearMessages:_,compileMessage:C},children:n})}function s_(){const n=E.useContext(r_);if(!n)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return n}function n3(){const{helpOpen:n,toggleHelp:e}=s_();return h.jsx("button",{onClick:e,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(en,{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(${Yt}/logo512.png)`}})})}function r3({ms:n,className:e=""}){const s=jk(n),i=E.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 ${e}`,children:"--"}):h.jsx(wv,{options:i,children:h.jsx("span",{className:`text-xs text-text-tertiary ${e}`,children:s})})}const s3=["sm","md","lg","full"],sx={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"},ix={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function i3({which:n}){const e="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:e,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:e,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:e,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:e,strokeWidth:"1.5"})})}}function a3({msg:n}){const[e,s]=E.useState(0);E.useEffect(()=>{const d=new Date(n.timestamp).getTime(),p=()=>s(Math.floor((Date.now()-d)/1e3));p();const g=setInterval(p,1e3);return()=>clearInterval(g)},[n.timestamp]);const i=Math.floor(e/60),o=e%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(ar,{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(um,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function o3({msg:n,compileMessage:e}){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(r3,{ms:n.durationMs,className:"!text-2xs text-text-muted/50"})]}),n.workflowId&&h.jsx(ar,{to:`/workflows/executions/${n.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx(um,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&n.workflowId&&!n.pending&&h.jsx("button",{onClick:()=>e(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(WS,{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 l3(){const{helpOpen:n,setHelpOpen:e,messages:s,sendMessage:i,pageContext:o,activeWorkflowId:c,clearMessages:d,compileMessage:p}=s_(),[g,u]=E.useState(""),[m,b]=E.useState("md"),[x,v]=E.useState(!0),_=E.useRef(null),S=E.useRef(null);if(E.useEffect(()=>{_.current&&(_.current.scrollTop=_.current.scrollHeight)},[s]),E.useEffect(()=>{n&&S.current&&S.current.focus()},[n]),E.useEffect(()=>{if(!n)return;const M=z=>{z.key==="Escape"&&(m==="full"?b("lg"):m==="lg"?b("md"):m==="md"?b("sm"):e(!1))};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[n,m,e]),!n)return null;const C=()=>{const M=g.trim();!M||c||(i(M),u(""),S.current&&(S.current.style.height="auto"))},B=M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),C())},q=m==="full",ne=o.page.replace(/-/g," "),te=q?{}:{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 ${q?sx.full:`right-6 ${sx[m]}`} ${x?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:te,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:ne})]}),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:s3.map(M=>h.jsx("button",{onClick:()=>b(M),className:`p-1 rounded transition-colors ${M===m?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":M===m,"aria-label":ix[M],title:ix[M],children:h.jsx(i3,{which:M})},M))}),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(ZS,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>e(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(en,{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(M=>h.jsxs("div",{className:`text-xs leading-relaxed ${M.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 ${M.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:M.pending?h.jsx(a3,{msg:M}):M.role==="assistant"?h.jsx(Bu,{content:M.content}):M.content}),!M.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(o3,{msg:M,compileMessage:p})})]},M.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:M=>{u(M.target.value);const z=M.target;z.style.height="auto",z.style.height=`${Math.min(z.scrollHeight,120)}px`},onKeyDown:B,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(eE,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const c3=6e3,u3="scan";function f3(){const{lastResult:n}=Vm(),{open:e,ownerKey:s}=Um(),[i,o]=E.useState(null);return E.useEffect(()=>{if(!n)return;const c=setTimeout(()=>o(n.at),c3);return()=>clearTimeout(c)},[n]),!n||n.navigated||i===n.at||e&&s===u3||n.source===ra.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(Ro,{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(Ym,{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(en,{className:"w-3.5 h-3.5"})})]})})}const i_="lt-announcement-dismissed:",h3="Live updates unavailable. Reconnecting… Refresh if this persists.";function d3(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function m3(n){try{return localStorage.getItem(`${i_}${n}`)==="1"}catch{return!1}}function p3(){const{isAuthenticated:n,userRoleNames:e}=qt(),{data:s}=_v(n),i=Le(),[o,c]=E.useState(null),[d,p]=E.useState(0),{unavailable:g}=SO();An(Sk,()=>{i.invalidateQueries({queryKey:["announcements"]})});const u=Date.now(),m=((s==null?void 0:s.announcements)??[]).filter(x=>!m3(x.id)&&new Date(x.expires_at).getTime()>u&&(x.roles.length===0||x.roles.some(v=>e.includes(v))));if(E.useEffect(()=>{const x=((s==null?void 0:s.announcements)??[]).map(_=>new Date(_.expires_at).getTime()-Date.now()).filter(_=>_>0);if(x.length===0)return;const v=setTimeout(()=>p(_=>_+1),Math.min(...x)+250);return()=>clearTimeout(v)},[s,d]),m.length===0&&!g)return null;const b=x=>{try{localStorage.setItem(`${i_}${x}`,"1")}catch{}p(v=>v+1)};return h.jsxs("div",{"data-testid":"announcement-banner",className:"relative z-40",children:[g&&h.jsx("div",{"data-testid":"live-updates-notice",role:"status",className:"border-b border-status-warning/25 bg-status-warning/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-status-warning",children:"Notice"}),h.jsx("span",{className:"truncate text-xs text-text-primary",children:h3})]})}),m.map(x=>{const v=o===x.id,_=x.title??x.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(v?null:x.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?h.jsx(bx,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}):h.jsx(cm,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{type:"button",onClick:()=>b(x.id),className:"icon-link",title:"Dismiss","aria-label":`Dismiss ${_}`,children:h.jsx(en,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]}),v&&h.jsx("div",{className:"px-4 pb-3 text-sm text-text-secondary max-w-measure",children:h.jsx(Bu,{content:d3(x.body)})})]},x.id)})]})}function y3(){var ae,F;const{isBuilder:n,isOps:e,viewAs:s}=iv(),{canSeePaceBoard:i}=av();DA();const{data:o}=Hn();Gj((ae=o==null?void 0:o.display)==null?void 0:ae.timeZone);const c=tv(),d=c!==null?c:!!((F=o==null?void 0:o.ai)!=null&&F.enabled),p=!!(o!=null&&o.machines),{collapsed:g,toggle:u}=Pm(),[m,b]=E.useState(!1),[x,v]=E.useState(!1),[_,S]=E.useState(!1),[C,B]=E.useState(()=>window.location.hash.startsWith("#docs")),q=tn(),ne=E.useRef(null),{kiosk:te,homePath:M}=Lm(),z=te||sk(q.pathname);return E.useEffect(()=>{const U=ne.current;U&&(U.classList.remove("animate-page-in"),U.offsetWidth,U.classList.add("animate-page-in"))},[q.pathname]),E.useEffect(()=>{const U=()=>{window.location.hash.startsWith("#docs")&&B(!0)};return window.addEventListener("hashchange",U),()=>window.removeEventListener("hashchange",U)},[]),te&&M&&!lk(q.pathname,q.search)?h.jsx(un,{to:M,replace:!0}):h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(JT,{onToggleEventFeed:()=>b(U=>!U),onToggleDocs:()=>B(U=>!U),onToggleNav:z?void 0:()=>v(U=>!U)}),h.jsx(p3,{}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!z&&h.jsxs("aside",{className:`${g?"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(Wv,{aiEnabled:d,isBuilder:n,isOps:e,viewAs:s,canSeePaceBoard:i,showLines:p})}),h.jsx("button",{onClick:u,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${g?"flex justify-center":"flex items-center px-7"}`,"aria-label":g?"Expand sidebar":"Collapse sidebar",children:g?h.jsx(tE,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(nE,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!g&&(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:ne,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:h.jsx(_s,{})})}),h.jsx(g3,{})]}),!z&&h.jsx(wC,{open:x,onClose:()=>v(!1),aiEnabled:d,isBuilder:n,isOps:e,viewAs:s,canSeePaceBoard:i,showLines:p}),h.jsx($C,{open:m,onToggle:()=>b(U=>!U),configOpen:_,onToggleConfig:()=>S(U=>!U)}),h.jsx(XC,{open:C,onClose:()=>{B(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),d&&h.jsx(n3,{}),d&&h.jsx(l3,{}),h.jsx(f3,{})]})}function g3(){const{node:n,width:e,open:s}=Um();return h.jsx(dk,{open:s,width:e,className:"border-l border-surface-border bg-surface-raised",children:n})}function b3(){const{isAuthenticated:n}=qt(),e=tn();return n?h.jsx(uk,{children:h.jsx(hk,{children:h.jsx(t3,{children:h.jsx(CA,{children:h.jsx(vN,{children:h.jsx(y3,{})})})})})}):h.jsx(un,{to:"/login",state:{from:e.pathname},replace:!0})}function a_({provider:n,className:e="w-5 h-5"}){switch(n){case"google":return h.jsxs("svg",{className:e,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:e,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:e,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:e,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:e,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 x3(){return ue("/auth/oauth/providers")}async function v3(n,e){const s=e?`?label=${encodeURIComponent(e)}`:"";return ue(`/auth/oauth/connections/${n}${s}`,{method:"DELETE"})}function OR(){return Pe({queryKey:["oauth-connections"],queryFn:()=>ue("/auth/oauth/connections")})}function AR(){const n=Le();return ze({mutationFn:({provider:e,label:s})=>v3(e,s),onSuccess:()=>{n.invalidateQueries({queryKey:["oauth-connections"]})}})}function _3(){var ae;const{login:n,isAuthenticated:e}=qt(),s=ri(),i=tn(),o=new URLSearchParams(i.search),c=o.get("token"),d=o.get("error"),p=((ae=i.state)==null?void 0:ae.from)??o.get("returnTo")??"/",g=E.useRef(!1);c&&!g.current&&(g.current=!0,n(c,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[u,m]=E.useState(""),[b,x]=E.useState(""),[v,_]=E.useState(d||""),[S,C]=E.useState(!1),[B,q]=E.useState(!!c),[ne,te]=E.useState([]),M=E.useRef(!1);if(E.useEffect(()=>{c||M.current||(M.current=!0,(async()=>{var F,U,D,Q;try{const W=await hm().catch(()=>null);if(!((F=W==null?void 0:W.auth)!=null&&F.sso))return;const he=await fetch(`${Yt}/api/auth/sso`,{method:"POST"});if(!he.ok){_("Host authentication required — please log in to your organization first");return}const Ee=await he.json();Ee.token&&((U=W.auth)!=null&&U.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",W.auth.ssoLogoutUrl),q(!0),n(Ee.token,void 0,{displayName:(D=Ee.user)==null?void 0:D.display_name,username:(Q=Ee.user)==null?void 0:Q.external_id}))}catch{}})())},[]),E.useEffect(()=>{c||x3().then(te).catch(()=>{})},[]),E.useEffect(()=>{if(!B)return;const F=setTimeout(()=>s(p,{replace:!0}),1500);return()=>clearTimeout(F)},[B]),e&&!B)return h.jsx(un,{to:p,replace:!0});const z=async F=>{var U,D;if(F.preventDefault(),_(""),!u.trim()||!b){_("Username and password are required");return}C(!0);try{const Q=await fetch(`${Yt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:u.trim(),password:b})}),W=await Q.json();if(!Q.ok){_(W.error||"Login failed");return}q(!0),n(W.token,{username:u.trim(),password:b},{displayName:(U=W.user)==null?void 0:U.display_name,username:(D=W.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 ${B?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(Du,{size:"lg",hideLabel:B})}),h.jsxs("form",{onSubmit:z,className:`space-y-5 transition-opacity duration-300 ${B?"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:u,onChange:F=>m(F.target.value),className:"input",placeholder:"Enter your username",autoFocus:!B,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:F=>x(F.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||B,children:S?"Signing in...":"Sign In"}),ne.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:ne.filter(F=>F.provider!=="anthropic").map(F=>h.jsxs("a",{href:`${Yt}/api/auth/oauth/${F.provider}?returnTo=${encodeURIComponent(p)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx(a_,{provider:F.provider}),"Sign in with ",F.name]},F.provider))})]})]})]})})}function ax(){const{isAuthenticated:n}=qt(),e=ri(),s=tn(),i=new URLSearchParams(s.search),o=i.get("state")||"";E.useEffect(()=>{n||e(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[n]);const[c,d]=E.useState(""),[p,g]=E.useState(i.get("label")||"default"),[u,m]=E.useState(""),[b,x]=E.useState(!1),v=c.trim().startsWith("sk-ant-oat"),_=c.trim().startsWith("sk-ant-api"),S=C=>{C.preventDefault();const B=c.trim();if(!B){m("A token or API key is required");return}if(!B.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 q=`${Yt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(B)}&state=${encodeURIComponent(o)}`;window.location.href=q};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(Du,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx(a_,{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:p,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").'})]}),u&&h.jsx("p",{className:"text-sm text-status-error",children:u}),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 w3({items:n,columns:e=1}){if(n.length===0)return null;const s=e>=2&&n.length>1?"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr] @dict-pairs:grid-cols-[max-content_1fr_max-content_1fr]":"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr]";return h.jsx("div",{className:"@container",children:h.jsx("dl",{className:`grid ${s} items-baseline gap-x-6 @dict-pairs:gap-x-8 gap-y-1.5`,children:n.map(({key:i,label:o,value:c})=>h.jsxs(E.Fragment,{children:[h.jsx("dt",{className:"text-2xs font-semibold uppercase tracking-wide text-text-secondary mt-2 first:mt-0 @dict-inline:mt-0",children:o}),h.jsx("dd",{className:"text-sm text-text-primary break-words whitespace-pre-wrap min-w-0","data-field-key":i,children:S3(c)})]},i))})})}function S3(n){return n==null||n===""?"—":typeof n=="boolean"?n?"Yes":"No":typeof n=="object"?JSON.stringify(n):String(n)}function E3(n){return Pe({queryKey:["oauth-client",n],queryFn:()=>ue(`/oauth/clients/${encodeURIComponent(n)}`),enabled:!!n,retry:!1})}function O3(n){return Pe({queryKey:["oauth-presets"],queryFn:()=>ue("/oauth/presets"),enabled:n})}function A3(){return ze({mutationFn:n=>ue(n.preset?"/oauth/authorize":"/oauth/deny",{method:"POST",body:JSON.stringify(n.preset?{...n.request,preset:n.preset}:n.request)})})}function jR(){return Pe({queryKey:["oauth-grants"],queryFn:()=>ue("/oauth/grants")})}function kR(){const n=Le();return ze({mutationFn:e=>ue(`/oauth/grants/${encodeURIComponent(e)}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["oauth-grants"]})})}const j3=["client_id","redirect_uri","code_challenge","code_challenge_method","response_type","state","scope","resource"],bd={read_only:{action:"Allow read-only",effect:"Reads what you can read and runs workflows marked read-safe."},just_me:{action:"Allow as me",effect:"Acts with your full rights: claims, resolves, invokes, and administers wherever you may."}};function k3(n){const e=new URLSearchParams(n),s=j3.map(o=>[o,e.get(o)??void 0]),i=Object.fromEntries(s);return!i.client_id||!i.redirect_uri||!i.code_challenge?null:i}function N3(n){try{return new URL(n).host}catch{return n}}function T3(){var b,x,v;const{isAuthenticated:n,user:e}=qt(),s=ri(),i=tn(),o=E.useMemo(()=>k3(i.search),[i.search]);E.useEffect(()=>{n||s(`/login?returnTo=${encodeURIComponent(i.pathname+i.search)}`,{replace:!0})},[n]);const c=E3(n&&o?o.client_id:null),d=O3(n&&!!o),p=A3(),g=_=>{o&&p.mutate({request:o,preset:_},{onSuccess:({redirect:S})=>window.location.assign(S)})};if(!n)return null;const u=!o||c.isError,m=((b=c.data)==null?void 0:b.client_name)||"An app";return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-lg p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(Du,{size:"lg"})}),u?h.jsxs("div",{role:"alert",children:[h.jsx("h2",{className:"heading-3 mb-3",children:"Sign-in link not valid"}),h.jsx("p",{className:"text-sm text-text-secondary",children:"Start the connection again from the app."})]}):h.jsxs(h.Fragment,{children:[h.jsxs("h2",{className:"heading-2 mb-2",children:["Connect ",m]}),h.jsxs("p",{className:"text-sm text-text-secondary mb-6",children:["Pick how much ",m," may do as you. Disconnect it any time under Connected apps."]}),h.jsx("div",{className:"mb-8",children:h.jsx(w3,{items:[{key:"app",label:"App",value:m},{key:"account",label:"Account",value:(e==null?void 0:e.displayName)||(e==null?void 0:e.username)||(e==null?void 0:e.userId)||null},{key:"returns-to",label:"Returns to",value:N3(o.redirect_uri)},{key:"deployment",label:"Deployment",value:window.location.host}]})}),h.jsx("dl",{className:"space-y-3 mb-8",children:(((x=d.data)==null?void 0:x.presets)??[]).map(_=>h.jsxs("div",{children:[h.jsx("dt",{className:"text-sm font-medium text-text-primary",children:bd[_].action}),h.jsx("dd",{className:"text-sm text-text-secondary",children:bd[_].effect})]},_))}),p.isError&&h.jsx("p",{className:"text-sm text-status-error mb-4",role:"alert",children:p.error.message}),h.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[(((v=d.data)==null?void 0:v.presets)??[]).map(_=>h.jsx("button",{type:"button",className:_==="read_only"?"btn-primary":"btn-secondary",disabled:p.isPending||c.isLoading,onClick:()=>g(_),children:bd[_].action},_)),h.jsx("button",{type:"button",className:"btn-ghost",disabled:p.isPending,onClick:()=>g(null),children:"Deny"})]})]})]})})}function Ji({roleTypes:n,roleNames:e,redirectTo:s="/"}){const{isSuperAdmin:i,hasRole:o,hasRoleType:c}=qt();return i?h.jsx(_s,{}):n&&n.some(d=>c(d))?h.jsx(_s,{}):e&&e.some(d=>o(d))?h.jsx(_s,{}):h.jsx(un,{to:s,replace:!0})}function C3(){const{data:n,isSuccess:e}=Xv();return e&&n.length===0?h.jsx(un,{to:"/",replace:!0}):h.jsx(_s,{})}function M3({redirectTo:n="/"}){var i;const{data:e,isLoading:s}=Hn();return s||!e?null:(i=e.ai)!=null&&i.enabled?h.jsx(_s,{}):h.jsx(un,{to:n,replace:!0})}function R3({flag:n,redirectTo:e="/"}){var o;const{data:s,isLoading:i}=Hn();return i||!s?null:((o=s.features)==null?void 0:o[n])===!1?h.jsx(un,{to:e,replace:!0}):h.jsx(_s,{})}function D3({redirectTo:n="/"}){const{data:e,isLoading:s}=Hn();return s||!e?null:e.machines?h.jsx(_s,{}):h.jsx(un,{to:n,replace:!0})}const L3=E.lazy(()=>Oe(()=>import("./ProcessesListPage-93SMj1Fd.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}))),q3=E.lazy(()=>Oe(()=>import("./ProcessDetailPage-0xS9EdHe.js"),__vite__mapDeps([17,1,2,18,13,19,16,10,4,20,21]),import.meta.url).then(n=>({default:n.ProcessDetailPage}))),P3=E.lazy(()=>Oe(()=>import("./McpOverview-Shcf9QhZ.js"),__vite__mapDeps([22,1,23,24,25,26,14,13,27,4]),import.meta.url).then(n=>({default:n.McpOverview}))),B3=E.lazy(()=>Oe(()=>import("./McpRunsPage-DqhHfD5G.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}))),U3=E.lazy(()=>Oe(()=>import("./McpRunDetailPage-BJKkM9-3.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}))),z3=E.lazy(()=>Oe(()=>import("./McpQueryPage-ck-o5m8A.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}))),$3=E.lazy(()=>Oe(()=>import("./McpQueryDetailPage-D8kmjy2v.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}))),I3=E.lazy(()=>Oe(()=>import("./EscalationsOverview-DS-nK0qV.js"),__vite__mapDeps([50,1,14,13,27,4]),import.meta.url).then(n=>({default:n.EscalationsOverview}))),H3=E.lazy(()=>Oe(()=>import("./AvailableEscalationsPage-UB03VTJx.js"),__vite__mapDeps([51,1,4,52,13,53,54,5,55,56,57,21,58,19,7,8,9,59,11,60,12,61,20,16,62,3,31,63,64]),import.meta.url).then(n=>({default:n.AvailableEscalationsPage}))),F3=E.lazy(()=>Oe(()=>import("./OperatorDashboard-CIH1cxjQ.js"),__vite__mapDeps([65,1,3,4,5,6,52,7,8,9,11,31,59,57,21,13,58,19,60,12,61,20,16,62,55,15]),import.meta.url).then(n=>({default:n.OperatorDashboard}))),G3=E.lazy(()=>Oe(()=>import("./index-FiNThtNU.js"),__vite__mapDeps([66,1,67,13,68,4,57,21,58,19,54,16,53,5,14,15,20,62,37,69]),import.meta.url).then(n=>({default:n.EscalationDetailPage}))),V3=E.lazy(()=>Oe(()=>import("./WorkflowsOverview-Bj4MJIE-.js"),__vite__mapDeps([70,1,14,13,27,4]),import.meta.url).then(n=>({default:n.WorkflowsOverview}))),Y3=E.lazy(()=>Oe(()=>import("./index-C5osluV3.js"),__vite__mapDeps([71,1,14,13,12,16,67,68,4,57,21,58,19,54,72,46,47]),import.meta.url).then(n=>({default:n.StartWorkflowPage}))),K3=E.lazy(()=>Oe(()=>import("./index-C5osluV3.js"),__vite__mapDeps([71,1,14,13,12,16,67,68,4,57,21,58,19,54,72,46,47]),import.meta.url).then(n=>({default:n.DurableInvokePage}))),J3=E.lazy(()=>Oe(()=>import("./WorkflowsDashboard-CIPEt3et.js"),__vite__mapDeps([73,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"})}))),Q3=E.lazy(()=>Oe(()=>import("./WorkflowsDashboard-CIPEt3et.js"),__vite__mapDeps([73,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"})}))),X3=E.lazy(()=>Oe(()=>import("./YamlWorkflowsPage-F2yyyoiB.js"),__vite__mapDeps([74,1,25,3,4,14,13,12,8,48,72,19]),import.meta.url).then(n=>({default:n.YamlWorkflowsPage}))),W3=E.lazy(()=>Oe(()=>import("./GraphInvokePage-6SCDyQcK.js"),__vite__mapDeps([75,1,25,14,13,43,45,46,47,44,4,48,72]),import.meta.url).then(n=>({default:n.GraphInvokePage}))),Z3=E.lazy(()=>Oe(()=>import("./YamlWorkflowDetailPage-DMEk5k9-.js"),__vite__mapDeps([76,1,25,19,72,13,4]),import.meta.url).then(n=>({default:n.YamlWorkflowDetailPage}))),e5=E.lazy(()=>Oe(()=>import("./TasksListPage-DG8hvO8G.js"),__vite__mapDeps([77,1,2,3,4,7,8,9,19,61,49,11,12,13,14,16]),import.meta.url).then(n=>({default:n.TasksListPage}))),t5=E.lazy(()=>Oe(()=>import("./TaskDetailPage-D6VOsA1f.js"),__vite__mapDeps([78,1,2,19,61,14,13,4]),import.meta.url).then(n=>({default:n.TaskDetailPage}))),ox=E.lazy(()=>Oe(()=>import("./WorkflowExecutionPage-BTocv8or.js"),__vite__mapDeps([79,1,34,12,13,35,19,4,36,2,14,33,15,37]),import.meta.url).then(n=>({default:n.WorkflowExecutionPage}))),n5=E.lazy(()=>Oe(()=>import("./AdminDashboard-BafKaq50.js"),__vite__mapDeps([80,1,2,23,18,13,4]),import.meta.url).then(n=>({default:n.AdminDashboard}))),r5=E.lazy(()=>Oe(()=>import("./index-D6K_IgCz.js"),__vite__mapDeps([81,1,7,8,9,12,13,31,3,4,14,82,16]),import.meta.url).then(n=>({default:n.WorkersPage}))),s5=E.lazy(()=>Oe(()=>import("./index-Dk2KKo0z.js"),__vite__mapDeps([83,1,12,13,84,20,16,14,4,46,47,72,67,68,57,21,58,19,54]),import.meta.url).then(n=>({default:n.WorkflowConfigsPage}))),lx=E.lazy(()=>Oe(()=>import("./index-Dk2KKo0z.js"),__vite__mapDeps([83,1,12,13,84,20,16,14,4,46,47,72,67,68,57,21,58,19,54]),import.meta.url).then(n=>({default:n.WorkflowConfigDetailPage}))),i5=E.lazy(()=>Oe(()=>import("./index-BxbQmeqh.js"),__vite__mapDeps([85,1,23,8,84,14,13,12,11,3,4,86,45,46,47,48,44,31,19]),import.meta.url).then(n=>({default:n.McpServersPage}))),cx=E.lazy(()=>Oe(()=>import("./index-BEMdD58x.js"),__vite__mapDeps([87,1,23,14,13,41,4]),import.meta.url).then(n=>({default:n.McpServerDetailPage}))),a5=E.lazy(()=>Oe(()=>import("./index-D7L_VoBD.js"),__vite__mapDeps([88,1,3,4,7,8,9,11,12,13,84,31,14,20,47,49,63,64,89,90,33]),import.meta.url).then(n=>({default:n.UsersPage}))),o5=E.lazy(()=>Oe(()=>import("./RolesPage-DqhHSvaw.js"),__vite__mapDeps([91,1,12,13,14,20,4]),import.meta.url).then(n=>({default:n.RolesPage}))),l5=E.lazy(()=>Oe(()=>import("./RoleDetailPage-DlUOJWSB.js"),__vite__mapDeps([92,1,93,84,13,4]),import.meta.url).then(n=>({default:n.RoleDetailPage}))),c5=E.lazy(()=>Oe(()=>import("./PersonasPage-D7ryA8Vc.js"),__vite__mapDeps([94,1,89,12,13,14,20,4,5]),import.meta.url).then(n=>({default:n.PersonasPage}))),u5=E.lazy(()=>Oe(()=>import("./PersonaDetailPage-DjvfyIph.js"),__vite__mapDeps([95,1,89,20,13,90,93,84,4]),import.meta.url).then(n=>({default:n.PersonaDetailPage}))),f5=E.lazy(()=>Oe(()=>import("./EscalationSchemaPage-CfZSVOSD.js"),__vite__mapDeps([96,1,67,13,68,4,57,21,58,19,54,16]),import.meta.url).then(n=>({default:n.EscalationSchemaPage}))),h5=E.lazy(()=>Oe(()=>import("./PortalPage-D3ybr0mo.js"),__vite__mapDeps([97,1,9,56,13,57,21,58,19,4,7,8,59,11,60,12,61,20,16,62]),import.meta.url).then(n=>({default:n.PortalPage}))),d5=E.lazy(()=>Oe(()=>import("./EscalationListSchemaPage-BotlwlX3.js"),__vite__mapDeps([98,1,13,4]),import.meta.url).then(n=>({default:n.EscalationListSchemaPage}))),m5=E.lazy(()=>Oe(()=>import("./ScanCodesPage-B2S9DR2f.js"),__vite__mapDeps([99,1,100,14,13,4]),import.meta.url).then(n=>({default:n.ScanCodesPage}))),p5=E.lazy(()=>Oe(()=>import("./LabelJobsPage-BO50zXT5.js"),__vite__mapDeps([101,1,14,13,7,8,9,21,63,4]),import.meta.url).then(n=>({default:n.LabelJobsPage}))),y5=E.lazy(()=>Oe(()=>import("./ScanSchemeDetailPage-gpxKN-pL.js"),__vite__mapDeps([102,1,14,13,84,100,4,64,63]),import.meta.url).then(n=>({default:n.ScanSchemeDetailPage}))),g5=E.lazy(()=>Oe(()=>import("./ScanStationPage-B-UTgXsG.js"),__vite__mapDeps([103,1,13,69,57,21,68,4]),import.meta.url).then(n=>({default:n.ScanStationPage}))),b5=E.lazy(()=>Oe(()=>import("./index-BuCEhhnl.js"),__vite__mapDeps([104,1,14,13,54,4]),import.meta.url).then(n=>({default:n.MaintenancePage}))),ux=E.lazy(()=>Oe(()=>import("./OperationsPage-D6B9Vv__.js").then(n=>n.O),__vite__mapDeps([105,1,60,13,4,14,9]),import.meta.url).then(n=>({default:n.OperationsPage}))),x5=E.lazy(()=>Oe(()=>import("./index-DlJkZ12b.js"),__vite__mapDeps([106,1,18,13,12,3,4,29,26,42,82,7,8,9,31]),import.meta.url).then(n=>({default:n.ControlPlanePage}))),v5=E.lazy(()=>Oe(()=>import("./index-D-FYj9jT.js"),__vite__mapDeps([107,1,36,13,3,4,29,26,6,7,8,9,11,12,14,15]),import.meta.url).then(n=>({default:n.StreamMessagesPage}))),_5=E.lazy(()=>Oe(()=>import("./CredentialsPage-BtCGBJrT.js"),__vite__mapDeps([108,1,14,13,49,84,4]),import.meta.url).then(n=>({default:n.CredentialsPage}))),w5=E.lazy(()=>Oe(()=>import("./ConnectedAppsPage-B3S5gVWw.js"),__vite__mapDeps([109,1,14,13,49,84,4]),import.meta.url).then(n=>({default:n.ConnectedAppsPage}))),S5=E.lazy(()=>Oe(()=>import("./index-D9RAN9sA.js"),__vite__mapDeps([110,1,4,14,13,12,15,6,8,111,49]),import.meta.url).then(n=>({default:n.FilesPage}))),E5=E.lazy(()=>Oe(()=>import("./index-DUYAGxwc.js"),__vite__mapDeps([112,1,14,13,12,15,11,8,111,49,113,41,4]),import.meta.url).then(n=>({default:n.KnowledgePage}))),O5=E.lazy(()=>Oe(()=>import("./LinesPage-RbWTaQRh.js"),__vite__mapDeps([114,1,115,7,8,9,12,13,11,14,5,3,4]),import.meta.url).then(n=>({default:n.LinesPage}))),A5=E.lazy(()=>Oe(()=>import("./LinePage-NYxJQ-ex.js"),__vite__mapDeps([116,1,115,14,13,60,4,12]),import.meta.url).then(n=>({default:n.LinePage}))),j5=E.lazy(()=>Oe(()=>import("./HomePage-BEc-XdKj.js"),__vite__mapDeps([117,1,24,26,20,13,16,15,105,60,4,14,9,52]),import.meta.url).then(n=>({default:n.HomePage}))),k5=E.lazy(()=>Oe(()=>import("./AgentsPage-DjQaio0O.js"),__vite__mapDeps([118,1,119,3,4,6,7,8,9,11,12,13,14,15]),import.meta.url).then(n=>({default:n.AgentsPage}))),N5=E.lazy(()=>Oe(()=>import("./AgentDetailPage-CEvz5rJr.js"),__vite__mapDeps([120,1,119,121,13,16,4]),import.meta.url).then(n=>({default:n.AgentDetailPage}))),fx=E.lazy(()=>Oe(()=>import("./AgentConfigPage-CFHf31DT.js"),__vite__mapDeps([122,1,119,121,13,14,113,45,46,47,25,123,124,16,4]),import.meta.url).then(n=>({default:n.AgentConfigPage}))),T5=E.lazy(()=>Oe(()=>import("./CapabilitiesPage-BIzDl-ZT.js"),__vite__mapDeps([125,1,123,86,23,45,46,47,13,48,4,44,14,12]),import.meta.url).then(n=>({default:n.CapabilitiesPage}))),C5=E.lazy(()=>Oe(()=>import("./TopicsPage-D8dW6J65.js"),__vite__mapDeps([126,1,124,14,13,12,4]),import.meta.url).then(n=>({default:n.TopicsPage}))),M5=E.lazy(()=>Oe(()=>import("./TopicDetailPage-QzkinTfN.js"),__vite__mapDeps([127,1,124,15,13,4]),import.meta.url).then(n=>({default:n.TopicDetailPage})));function R5(){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(E.Suspense,{fallback:h.jsx(R5,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:n})})}const o_=new vS({defaultOptions:{queries:{staleTime:1e4,retry:(n,e)=>e instanceof Error&&e.message==="Session expired"?!1:n<1}}});window.addEventListener("auth:unauthorized",()=>{o_.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=window.__LT_BASE__||"",e=`${n}/login`;if(window.location.pathname!==e){const s=window.location.pathname+window.location.search,i=n&&s.startsWith(n)?s.slice(n.length)||"/":s;window.location.href=`${e}?returnTo=${encodeURIComponent(i)}`}});const D5=SS([{path:"/login",element:h.jsx(_3,{})},{path:"/connect/anthropic",element:h.jsx(ax,{})},{path:"/connect/:provider",element:h.jsx(ax,{})},{path:"/oauth/consent",element:h.jsx(T3,{})},{path:"/",element:h.jsx(b3,{}),children:[{index:!0,element:h.jsx(we,{children:h.jsx(j5,{})})},{path:"processes/all",element:h.jsx(we,{children:h.jsx(L3,{})})},{path:"processes/detail/:originId",element:h.jsx(we,{children:h.jsx(q3,{})})},{path:"credentials",element:h.jsx(we,{children:h.jsx(_5,{})})},{path:"connected-apps",element:h.jsx(we,{children:h.jsx(w5,{})})},{path:"connections",element:h.jsx(un,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(we,{children:h.jsx(I3,{})})},{path:"escalations/available",element:h.jsx(we,{children:h.jsx(H3,{})})},{path:"escalations/queue",element:h.jsx(we,{children:h.jsx(F3,{})})},{path:"escalations/detail/:id",element:h.jsx(we,{children:h.jsx(G3,{})})},{path:"portal/:role/:portal?",element:h.jsx(we,{children:h.jsx(h5,{})})},{path:"scan/station",element:h.jsx(we,{children:h.jsx(g5,{})})},{path:"capabilities",element:h.jsx(we,{children:h.jsx(T5,{})})},{element:h.jsx(Ji,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"agents",element:h.jsx(we,{children:h.jsx(k5,{})})},{path:"agents/new",element:h.jsx(we,{children:h.jsx(fx,{})})},{path:"agents/:id",element:h.jsx(we,{children:h.jsx(N5,{})})},{path:"agents/:id/edit",element:h.jsx(we,{children:h.jsx(fx,{})})},{path:"topics",element:h.jsx(we,{children:h.jsx(C5,{})})},{path:"topics/:topic",element:h.jsx(we,{children:h.jsx(M5,{})})}]},{element:h.jsx(C3,{}),children:[{path:"workflows/start",element:h.jsx(we,{children:h.jsx(Y3,{})})},{path:"workflows/durable/invoke",element:h.jsx(we,{children:h.jsx(K3,{})})}]},{element:h.jsx(Ji,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(we,{children:h.jsx(V3,{})})},{path:"workflows/executions",element:h.jsx(we,{children:h.jsx(Q3,{})})},{path:"workflows/durable/executions",element:h.jsx(we,{children:h.jsx(J3,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(we,{children:h.jsx(ox,{})})},{path:"workflows/tasks",element:h.jsx(we,{children:h.jsx(e5,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(we,{children:h.jsx(t5,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(we,{children:h.jsx(ox,{})})},{path:"workflows/cron",element:h.jsx(un,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(we,{children:h.jsx(r5,{})})},{path:"workflows/registry",element:h.jsx(we,{children:h.jsx(s5,{})})},{path:"workflows/registry/new",element:h.jsx(we,{children:h.jsx(lx,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(we,{children:h.jsx(lx,{})})}]},{element:h.jsx(Ji,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(we,{children:h.jsx(X3,{})})},{path:"mcp/workflows/invoke",element:h.jsx(we,{children:h.jsx(W3,{})})},{path:"mcp/workflows/:id",element:h.jsx(we,{children:h.jsx(Z3,{})})},{path:"mcp/executions",element:h.jsx(we,{children:h.jsx(B3,{})})},{path:"mcp/executions/:jobId",element:h.jsx(we,{children:h.jsx(U3,{})})},{path:"files",element:h.jsx(we,{children:h.jsx(S5,{})})},{path:"knowledge",element:h.jsx(we,{children:h.jsx(E5,{})})},{element:h.jsx(M3,{}),children:[{path:"mcp",element:h.jsx(we,{children:h.jsx(P3,{})})},{path:"mcp/queries",element:h.jsx(we,{children:h.jsx(z3,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(we,{children:h.jsx($3,{})})},{path:"mcp/tools",element:h.jsx(un,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(we,{children:h.jsx(i5,{})})},{path:"mcp/servers/new",element:h.jsx(we,{children:h.jsx(cx,{})})},{path:"mcp/servers/:serverId",element:h.jsx(we,{children:h.jsx(cx,{})})}]}]},{path:"pace",element:h.jsx(we,{children:h.jsx(ux,{})})},{path:"trends",element:h.jsx(we,{children:h.jsx(ux,{})})},{path:"operations",element:h.jsx(un,{to:"/pace",replace:!0})},{element:h.jsx(Ji,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{element:h.jsx(D3,{}),children:[{path:"lines",element:h.jsx(we,{children:h.jsx(O5,{})})},{path:"lines/:siteId/:lineId",element:h.jsx(we,{children:h.jsx(A5,{})})}]}]},{element:h.jsx(Ji,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(we,{children:h.jsx(n5,{})})},{path:"admin/users",element:h.jsx(we,{children:h.jsx(a5,{})})},{path:"admin/escalation-chains",element:h.jsx(un,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(we,{children:h.jsx(o5,{})})},{path:"admin/roles/:role",element:h.jsx(we,{children:h.jsx(l5,{})})},{path:"admin/roles/:role/schema",element:h.jsx(we,{children:h.jsx(f5,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(we,{children:h.jsx(d5,{})})},{path:"admin/scan-codes",element:h.jsx(we,{children:h.jsx(m5,{})})},{path:"admin/scan-codes/:version",element:h.jsx(we,{children:h.jsx(y5,{})})},{path:"admin/labels/history",element:h.jsx(we,{children:h.jsx(p5,{})})},{path:"admin/personas",element:h.jsx(we,{children:h.jsx(c5,{})})},{path:"admin/personas/:key",element:h.jsx(we,{children:h.jsx(u5,{})})}]},{element:h.jsx(Ji,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx(un,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(R3,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(we,{children:h.jsx(b5,{})})}]},{path:"admin/controlplane",element:h.jsx(we,{children:h.jsx(x5,{})})},{path:"admin/streams",element:h.jsx(we,{children:h.jsx(v5,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function L5(){return h.jsx(_S,{client:o_,children:h.jsx(gE,{children:h.jsx(_A,{children:h.jsx(ES,{router:D5})})})})}kv(jv());const Qm=document.createElement("link");Qm.rel="stylesheet";Qm.href=`${Yt}/api/settings/custom.css`;document.head.appendChild(Qm);oE.createRoot(document.getElementById("root")).render(h.jsx(E.StrictMode,{children:h.jsx(L5,{})}));export{Ru as $,cN as A,IM as B,Jm as C,r3 as D,pN as E,e_ as F,aR as G,dM as H,oR as I,BC as J,Um as K,tC as L,wT as M,Wt as N,nC as O,lM as P,fC as Q,iv as R,AC as S,Lm as T,AM as U,jM as V,kM as W,NM as X,TM as Y,MM as Z,Wj as _,pR as a,oM as a$,hM as a0,qt as a1,am as a2,oC as a3,Z5 as a4,hR as a5,Im as a6,sa as a7,xs as a8,bM as a9,vR as aA,gR as aB,yR as aC,Xv as aD,bR as aE,mR as aF,wv as aG,LM as aH,_R as aI,dR as aJ,SR as aK,wR as aL,G5 as aM,V5 as aN,Q5 as aO,X5 as aP,Y5 as aQ,K5 as aR,J5 as aS,rM as aT,iM as aU,sM as aV,cR as aW,W5 as aX,Dm as aY,aM as aZ,lC as a_,tM as aa,xv as ab,YT as ac,bN as ad,mc as ae,SM as af,EM as ag,Bu as ah,gN as ai,fT as aj,lR as ak,ZM as al,Mu as am,Fm as an,Xj as ao,MA as ap,pM as aq,FM as ar,yM as as,wM as at,OM as au,CM as av,mv as aw,I5 as ax,Fg as ay,H5 as az,BM as b,eM as b0,JM as b1,Ns as b2,Ao as b3,ER as b4,zx as b5,w3 as b6,YM as b7,Yt as b8,Ed as b9,sR as bA,iR as bB,rR as bC,tR as bD,FT as bE,Vm as bF,Ak as bG,xN as bH,ke as bI,Jd as bJ,eR as bK,yv as bL,uM as bM,zM as bN,ST as bO,OR as bP,AR as bQ,a_ as bR,jR as bS,kR as bT,Vj as bU,OC as bV,Cm as bW,av as bX,GM as bY,F5 as ba,sC as bb,fR as bc,vv as bd,X1 as be,qv as bf,HM as bg,Mm as bh,$M as bi,XM as bj,$j as bk,QM as bl,z5 as bm,aN as bn,iN as bo,yk as bp,_M as bq,vM as br,fr as bs,ov as bt,KM as bu,na as bv,nM as bw,nR as bx,Yk as by,Tk as bz,Hn as c,WM as d,RM as e,jk as f,Sv as g,dk as h,cM as i,nn as j,An as k,DM as l,ue as m,xR as n,qM as o,PM as p,mM as q,gM as r,xM as s,UM as t,VM as u,fM as v,Km as w,uR as x,tv as y,Lv as z};
|
|
67
|
-
//# sourceMappingURL=index-
|
|
64
|
+
`}function t3(n){const e=n.summary,s=n.title;if(e){const i=e.search(/\n\s*\{[\s\S]*"title"\s*:/);return i>0?e.slice(0,i).trim():e}return s||(typeof n=="string"?n:"Query completed.")}const r_=E.createContext(null);function n3({children:n}){const e=tn(),[s,i]=E.useState(!1),[o,c]=E.useState([]),[d,p]=E.useState(null),[g,u]=E.useState({}),m=E.useRef(null),b={page:e.pathname.split("/").filter(Boolean).join("-")||"home",route:e.pathname,params:{},...g,suggestedTags:g.suggestedTags??ZC(e.pathname)};E.useEffect(()=>()=>{m.current&&clearInterval(m.current)},[]);const x=E.useCallback(()=>i(B=>!B),[]),v=E.useCallback(B=>{u(B)},[]),_=E.useCallback(()=>{c([]),p(null)},[]),S=E.useCallback(async B=>{var F;const q=new Date().toISOString(),ne={id:`user-${Date.now()}`,role:"user",content:B,timestamp:q},te={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:q,pending:!0};c(U=>[...U,ne,te]);const M={...b};(F=M.entities)!=null&&F.yamlContent&&M.entities.yamlContent.length>rx&&(M.entities={...M.entities,yamlContent:M.entities.yamlContent.slice(0,rx)+`
|
|
65
|
+
... (truncated)`});const ae=`${e3(o.concat(ne))}${B}`;try{const D=(await ue("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ae,tags:M.suggestedTags,context:M,wait:!1,direct:!0})})).workflow_id;p(D),c(Q=>Q.map(W=>W.id===te.id?{...W,workflowId:D}:W)),m.current&&clearInterval(m.current),m.current=setInterval(async()=>{var Q;try{const W=await ue(`/workflows/${D}/result`),he=(Q=W==null?void 0:W.result)==null?void 0:Q.data;if(he){m.current&&clearInterval(m.current),m.current=null,p(null);const Ee=t3(he);let Ae;try{Ae=(await ue(`/workflow-states/${D}/execution`)).duration_ms}catch{}c(H=>H.map(J=>J.id===te.id?{...J,content:Ee,timestamp:new Date().toISOString(),pending:!1,durationMs:Ae}:J))}}catch{}},3e3)}catch{c(U=>U.map(D=>D.id===te.id?{...D,content:"Failed to submit query. Please try again.",pending:!1}:D))}},[o,b]),C=E.useCallback(async B=>{const q=o.find(M=>M.id===B);if(!(q!=null&&q.workflowId)||q.compilationStatus==="compiling"||q.compilationStatus==="done")return;const ne=o.indexOf(q),te=o.slice(0,ne).reverse().find(M=>M.role==="user");if(te){c(M=>M.map(z=>z.id===B?{...z,compilationStatus:"compiling"}:z));try{const M=await ue("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:te.content,summary:q.content})}),z=await ue("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:q.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:M.tool_name,description:M.description,tags:M.tags,app_id:""})});await ue(`/yaml-workflows/${z.id}/deploy`,{method:"POST"}),c(ae=>ae.map(F=>F.id===B?{...F,compilationStatus:"done"}:F))}catch(M){const z=M instanceof Error?M.message:"Compilation failed";c(ae=>ae.map(F=>F.id===B?{...F,compilationStatus:"error",compilationError:z}:F))}}},[o]);return h.jsx(r_.Provider,{value:{helpOpen:s,setHelpOpen:i,toggleHelp:x,messages:o,sendMessage:S,pageContext:b,setPageContext:v,activeWorkflowId:d,clearMessages:_,compileMessage:C},children:n})}function s_(){const n=E.useContext(r_);if(!n)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return n}function r3(){const{helpOpen:n,toggleHelp:e}=s_();return h.jsx("button",{onClick:e,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(en,{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(${Yt}/logo512.png)`}})})}function s3({ms:n,className:e=""}){const s=kk(n),i=E.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 ${e}`,children:"--"}):h.jsx(wv,{options:i,children:h.jsx("span",{className:`text-xs text-text-tertiary ${e}`,children:s})})}const i3=["sm","md","lg","full"],sx={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"},ix={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function a3({which:n}){const e="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:e,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:e,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:e,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:e,strokeWidth:"1.5"})})}}function o3({msg:n}){const[e,s]=E.useState(0);E.useEffect(()=>{const d=new Date(n.timestamp).getTime(),p=()=>s(Math.floor((Date.now()-d)/1e3));p();const g=setInterval(p,1e3);return()=>clearInterval(g)},[n.timestamp]);const i=Math.floor(e/60),o=e%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(ar,{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(um,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function l3({msg:n,compileMessage:e}){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(s3,{ms:n.durationMs,className:"!text-2xs text-text-muted/50"})]}),n.workflowId&&h.jsx(ar,{to:`/workflows/executions/${n.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx(um,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&n.workflowId&&!n.pending&&h.jsx("button",{onClick:()=>e(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(WS,{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 c3(){const{helpOpen:n,setHelpOpen:e,messages:s,sendMessage:i,pageContext:o,activeWorkflowId:c,clearMessages:d,compileMessage:p}=s_(),[g,u]=E.useState(""),[m,b]=E.useState("md"),[x,v]=E.useState(!0),_=E.useRef(null),S=E.useRef(null);if(E.useEffect(()=>{_.current&&(_.current.scrollTop=_.current.scrollHeight)},[s]),E.useEffect(()=>{n&&S.current&&S.current.focus()},[n]),E.useEffect(()=>{if(!n)return;const M=z=>{z.key==="Escape"&&(m==="full"?b("lg"):m==="lg"?b("md"):m==="md"?b("sm"):e(!1))};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[n,m,e]),!n)return null;const C=()=>{const M=g.trim();!M||c||(i(M),u(""),S.current&&(S.current.style.height="auto"))},B=M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),C())},q=m==="full",ne=o.page.replace(/-/g," "),te=q?{}:{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 ${q?sx.full:`right-6 ${sx[m]}`} ${x?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:te,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:ne})]}),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:i3.map(M=>h.jsx("button",{onClick:()=>b(M),className:`p-1 rounded transition-colors ${M===m?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":M===m,"aria-label":ix[M],title:ix[M],children:h.jsx(a3,{which:M})},M))}),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(ZS,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>e(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(en,{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(M=>h.jsxs("div",{className:`text-xs leading-relaxed ${M.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 ${M.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:M.pending?h.jsx(o3,{msg:M}):M.role==="assistant"?h.jsx(Bu,{content:M.content}):M.content}),!M.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(l3,{msg:M,compileMessage:p})})]},M.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:M=>{u(M.target.value);const z=M.target;z.style.height="auto",z.style.height=`${Math.min(z.scrollHeight,120)}px`},onKeyDown:B,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(eE,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const u3=6e3,f3="scan";function h3(){const{lastResult:n}=Vm(),{open:e,ownerKey:s}=Um(),[i,o]=E.useState(null);return E.useEffect(()=>{if(!n)return;const c=setTimeout(()=>o(n.at),u3);return()=>clearTimeout(c)},[n]),!n||n.navigated||i===n.at||e&&s===f3||n.source===ra.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(Ro,{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(Ym,{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(en,{className:"w-3.5 h-3.5"})})]})})}const i_="lt-announcement-dismissed:",d3="Live updates unavailable. Reconnecting… Refresh if this persists.";function m3(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function p3(n){try{return localStorage.getItem(`${i_}${n}`)==="1"}catch{return!1}}function y3(){const{isAuthenticated:n,userRoleNames:e}=qt(),{data:s}=_v(n),i=qe(),[o,c]=E.useState(null),[d,p]=E.useState(0),{unavailable:g}=SO();An(Ek,()=>{i.invalidateQueries({queryKey:["announcements"]})});const u=Date.now(),m=((s==null?void 0:s.announcements)??[]).filter(x=>!p3(x.id)&&new Date(x.expires_at).getTime()>u&&(x.roles.length===0||x.roles.some(v=>e.includes(v))));if(E.useEffect(()=>{const x=((s==null?void 0:s.announcements)??[]).map(_=>new Date(_.expires_at).getTime()-Date.now()).filter(_=>_>0);if(x.length===0)return;const v=setTimeout(()=>p(_=>_+1),Math.min(...x)+250);return()=>clearTimeout(v)},[s,d]),m.length===0&&!g)return null;const b=x=>{try{localStorage.setItem(`${i_}${x}`,"1")}catch{}p(v=>v+1)};return h.jsxs("div",{"data-testid":"announcement-banner",className:"relative z-40",children:[g&&h.jsx("div",{"data-testid":"live-updates-notice",role:"status",className:"border-b border-status-warning/25 bg-status-warning/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-status-warning",children:"Notice"}),h.jsx("span",{className:"truncate text-xs text-text-primary",children:d3})]})}),m.map(x=>{const v=o===x.id,_=x.title??x.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(v?null:x.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?h.jsx(bx,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}):h.jsx(cm,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{type:"button",onClick:()=>b(x.id),className:"icon-link",title:"Dismiss","aria-label":`Dismiss ${_}`,children:h.jsx(en,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]}),v&&h.jsx("div",{className:"px-4 pb-3 text-sm text-text-secondary max-w-measure",children:h.jsx(Bu,{content:m3(x.body)})})]},x.id)})]})}function g3(){var ae,F;const{isBuilder:n,isOps:e,viewAs:s}=iv(),{canSeePaceBoard:i}=av();DA();const{data:o}=Hn();Gj((ae=o==null?void 0:o.display)==null?void 0:ae.timeZone);const c=tv(),d=c!==null?c:!!((F=o==null?void 0:o.ai)!=null&&F.enabled),p=!!(o!=null&&o.machines),{collapsed:g,toggle:u}=Pm(),[m,b]=E.useState(!1),[x,v]=E.useState(!1),[_,S]=E.useState(!1),[C,B]=E.useState(()=>window.location.hash.startsWith("#docs")),q=tn(),ne=E.useRef(null),{kiosk:te,homePath:M}=Lm(),z=te||sk(q.pathname);return E.useEffect(()=>{const U=ne.current;U&&(U.classList.remove("animate-page-in"),U.offsetWidth,U.classList.add("animate-page-in"))},[q.pathname]),E.useEffect(()=>{const U=()=>{window.location.hash.startsWith("#docs")&&B(!0)};return window.addEventListener("hashchange",U),()=>window.removeEventListener("hashchange",U)},[]),te&&M&&!lk(q.pathname,q.search)?h.jsx(un,{to:M,replace:!0}):h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(QT,{onToggleEventFeed:()=>b(U=>!U),onToggleDocs:()=>B(U=>!U),onToggleNav:z?void 0:()=>v(U=>!U)}),h.jsx(y3,{}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!z&&h.jsxs("aside",{className:`${g?"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(Wv,{aiEnabled:d,isBuilder:n,isOps:e,viewAs:s,canSeePaceBoard:i,showLines:p})}),h.jsx("button",{onClick:u,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${g?"flex justify-center":"flex items-center px-7"}`,"aria-label":g?"Expand sidebar":"Collapse sidebar",children:g?h.jsx(tE,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(nE,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!g&&(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:ne,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:h.jsx(_s,{})})}),h.jsx(b3,{})]}),!z&&h.jsx(SC,{open:x,onClose:()=>v(!1),aiEnabled:d,isBuilder:n,isOps:e,viewAs:s,canSeePaceBoard:i,showLines:p}),h.jsx(IC,{open:m,onToggle:()=>b(U=>!U),configOpen:_,onToggleConfig:()=>S(U=>!U)}),h.jsx(WC,{open:C,onClose:()=>{B(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),d&&h.jsx(r3,{}),d&&h.jsx(c3,{}),h.jsx(h3,{})]})}function b3(){const{node:n,width:e,open:s}=Um();return h.jsx(dk,{open:s,width:e,className:"border-l border-surface-border bg-surface-raised",children:n})}function x3(){const{isAuthenticated:n}=qt(),e=tn();return n?h.jsx(uk,{children:h.jsx(hk,{children:h.jsx(n3,{children:h.jsx(CA,{children:h.jsx(_N,{children:h.jsx(g3,{})})})})})}):h.jsx(un,{to:"/login",state:{from:e.pathname},replace:!0})}function a_({provider:n,className:e="w-5 h-5"}){switch(n){case"google":return h.jsxs("svg",{className:e,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:e,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:e,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:e,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:e,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 v3(){return ue("/auth/oauth/providers")}async function _3(n,e){const s=e?`?label=${encodeURIComponent(e)}`:"";return ue(`/auth/oauth/connections/${n}${s}`,{method:"DELETE"})}function jR(){return Le({queryKey:["oauth-connections"],queryFn:()=>ue("/auth/oauth/connections")})}function kR(){const n=qe();return ze({mutationFn:({provider:e,label:s})=>_3(e,s),onSuccess:()=>{n.invalidateQueries({queryKey:["oauth-connections"]})}})}function w3(){var ae;const{login:n,isAuthenticated:e}=qt(),s=ri(),i=tn(),o=new URLSearchParams(i.search),c=o.get("token"),d=o.get("error"),p=((ae=i.state)==null?void 0:ae.from)??o.get("returnTo")??"/",g=E.useRef(!1);c&&!g.current&&(g.current=!0,n(c,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[u,m]=E.useState(""),[b,x]=E.useState(""),[v,_]=E.useState(d||""),[S,C]=E.useState(!1),[B,q]=E.useState(!!c),[ne,te]=E.useState([]),M=E.useRef(!1);if(E.useEffect(()=>{c||M.current||(M.current=!0,(async()=>{var F,U,D,Q;try{const W=await hm().catch(()=>null);if(!((F=W==null?void 0:W.auth)!=null&&F.sso))return;const he=await fetch(`${Yt}/api/auth/sso`,{method:"POST"});if(!he.ok){_("Host authentication required — please log in to your organization first");return}const Ee=await he.json();Ee.token&&((U=W.auth)!=null&&U.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",W.auth.ssoLogoutUrl),q(!0),n(Ee.token,void 0,{displayName:(D=Ee.user)==null?void 0:D.display_name,username:(Q=Ee.user)==null?void 0:Q.external_id}))}catch{}})())},[]),E.useEffect(()=>{c||v3().then(te).catch(()=>{})},[]),E.useEffect(()=>{if(!B)return;const F=setTimeout(()=>s(p,{replace:!0}),1500);return()=>clearTimeout(F)},[B]),e&&!B)return h.jsx(un,{to:p,replace:!0});const z=async F=>{var U,D;if(F.preventDefault(),_(""),!u.trim()||!b){_("Username and password are required");return}C(!0);try{const Q=await fetch(`${Yt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:u.trim(),password:b})}),W=await Q.json();if(!Q.ok){_(W.error||"Login failed");return}q(!0),n(W.token,{username:u.trim(),password:b},{displayName:(U=W.user)==null?void 0:U.display_name,username:(D=W.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 ${B?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(Du,{size:"lg",hideLabel:B})}),h.jsxs("form",{onSubmit:z,className:`space-y-5 transition-opacity duration-300 ${B?"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:u,onChange:F=>m(F.target.value),className:"input",placeholder:"Enter your username",autoFocus:!B,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:F=>x(F.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||B,children:S?"Signing in...":"Sign In"}),ne.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:ne.filter(F=>F.provider!=="anthropic").map(F=>h.jsxs("a",{href:`${Yt}/api/auth/oauth/${F.provider}?returnTo=${encodeURIComponent(p)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx(a_,{provider:F.provider}),"Sign in with ",F.name]},F.provider))})]})]})]})})}function ax(){const{isAuthenticated:n}=qt(),e=ri(),s=tn(),i=new URLSearchParams(s.search),o=i.get("state")||"";E.useEffect(()=>{n||e(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[n]);const[c,d]=E.useState(""),[p,g]=E.useState(i.get("label")||"default"),[u,m]=E.useState(""),[b,x]=E.useState(!1),v=c.trim().startsWith("sk-ant-oat"),_=c.trim().startsWith("sk-ant-api"),S=C=>{C.preventDefault();const B=c.trim();if(!B){m("A token or API key is required");return}if(!B.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 q=`${Yt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(B)}&state=${encodeURIComponent(o)}`;window.location.href=q};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(Du,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx(a_,{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:p,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").'})]}),u&&h.jsx("p",{className:"text-sm text-status-error",children:u}),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 S3({items:n,columns:e=1}){if(n.length===0)return null;const s=e>=2&&n.length>1?"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr] @dict-pairs:grid-cols-[max-content_1fr_max-content_1fr]":"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr]";return h.jsx("div",{className:"@container",children:h.jsx("dl",{className:`grid ${s} items-baseline gap-x-6 @dict-pairs:gap-x-8 gap-y-1.5`,children:n.map(({key:i,label:o,value:c})=>h.jsxs(E.Fragment,{children:[h.jsx("dt",{className:"text-2xs font-semibold uppercase tracking-wide text-text-secondary mt-2 first:mt-0 @dict-inline:mt-0",children:o}),h.jsx("dd",{className:"text-sm text-text-primary break-words whitespace-pre-wrap min-w-0","data-field-key":i,children:E3(c)})]},i))})})}function E3(n){return n==null||n===""?"—":typeof n=="boolean"?n?"Yes":"No":typeof n=="object"?JSON.stringify(n):String(n)}function O3(n){return Le({queryKey:["oauth-client",n],queryFn:()=>ue(`/oauth/clients/${encodeURIComponent(n)}`),enabled:!!n,retry:!1})}function A3(n){return Le({queryKey:["oauth-presets"],queryFn:()=>ue("/oauth/presets"),enabled:n})}function j3(){return ze({mutationFn:n=>ue(n.preset?"/oauth/authorize":"/oauth/deny",{method:"POST",body:JSON.stringify(n.preset?{...n.request,preset:n.preset}:n.request)})})}function NR(){return Le({queryKey:["oauth-grants"],queryFn:()=>ue("/oauth/grants")})}function TR(){const n=qe();return ze({mutationFn:e=>ue(`/oauth/grants/${encodeURIComponent(e)}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["oauth-grants"]})})}const k3=["client_id","redirect_uri","code_challenge","code_challenge_method","response_type","state","scope","resource"],bd={read_only:{action:"Allow read-only",effect:"Reads what you can read and runs workflows marked read-safe."},just_me:{action:"Allow as me",effect:"Acts with your full rights: claims, resolves, invokes, and administers wherever you may."}};function N3(n){const e=new URLSearchParams(n),s=k3.map(o=>[o,e.get(o)??void 0]),i=Object.fromEntries(s);return!i.client_id||!i.redirect_uri||!i.code_challenge?null:i}function T3(n){try{return new URL(n).host}catch{return n}}function C3(){var b,x,v;const{isAuthenticated:n,user:e}=qt(),s=ri(),i=tn(),o=E.useMemo(()=>N3(i.search),[i.search]);E.useEffect(()=>{n||s(`/login?returnTo=${encodeURIComponent(i.pathname+i.search)}`,{replace:!0})},[n]);const c=O3(n&&o?o.client_id:null),d=A3(n&&!!o),p=j3(),g=_=>{o&&p.mutate({request:o,preset:_},{onSuccess:({redirect:S})=>window.location.assign(S)})};if(!n)return null;const u=!o||c.isError,m=((b=c.data)==null?void 0:b.client_name)||"An app";return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-lg p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(Du,{size:"lg"})}),u?h.jsxs("div",{role:"alert",children:[h.jsx("h2",{className:"heading-3 mb-3",children:"Sign-in link not valid"}),h.jsx("p",{className:"text-sm text-text-secondary",children:"Start the connection again from the app."})]}):h.jsxs(h.Fragment,{children:[h.jsxs("h2",{className:"heading-2 mb-2",children:["Connect ",m]}),h.jsxs("p",{className:"text-sm text-text-secondary mb-6",children:["Pick how much ",m," may do as you. Disconnect it any time under Connected apps."]}),h.jsx("div",{className:"mb-8",children:h.jsx(S3,{items:[{key:"app",label:"App",value:m},{key:"account",label:"Account",value:(e==null?void 0:e.displayName)||(e==null?void 0:e.username)||(e==null?void 0:e.userId)||null},{key:"returns-to",label:"Returns to",value:T3(o.redirect_uri)},{key:"deployment",label:"Deployment",value:window.location.host}]})}),h.jsx("dl",{className:"space-y-3 mb-8",children:(((x=d.data)==null?void 0:x.presets)??[]).map(_=>h.jsxs("div",{children:[h.jsx("dt",{className:"text-sm font-medium text-text-primary",children:bd[_].action}),h.jsx("dd",{className:"text-sm text-text-secondary",children:bd[_].effect})]},_))}),p.isError&&h.jsx("p",{className:"text-sm text-status-error mb-4",role:"alert",children:p.error.message}),h.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[(((v=d.data)==null?void 0:v.presets)??[]).map(_=>h.jsx("button",{type:"button",className:_==="read_only"?"btn-primary":"btn-secondary",disabled:p.isPending||c.isLoading,onClick:()=>g(_),children:bd[_].action},_)),h.jsx("button",{type:"button",className:"btn-ghost",disabled:p.isPending,onClick:()=>g(null),children:"Deny"})]})]})]})})}function Ji({roleTypes:n,roleNames:e,redirectTo:s="/"}){const{isSuperAdmin:i,hasRole:o,hasRoleType:c}=qt();return i?h.jsx(_s,{}):n&&n.some(d=>c(d))?h.jsx(_s,{}):e&&e.some(d=>o(d))?h.jsx(_s,{}):h.jsx(un,{to:s,replace:!0})}function M3(){const{data:n,isSuccess:e}=Xv();return e&&n.length===0?h.jsx(un,{to:"/",replace:!0}):h.jsx(_s,{})}function R3({redirectTo:n="/"}){var i;const{data:e,isLoading:s}=Hn();return s||!e?null:(i=e.ai)!=null&&i.enabled?h.jsx(_s,{}):h.jsx(un,{to:n,replace:!0})}function D3({flag:n,redirectTo:e="/"}){var o;const{data:s,isLoading:i}=Hn();return i||!s?null:((o=s.features)==null?void 0:o[n])===!1?h.jsx(un,{to:e,replace:!0}):h.jsx(_s,{})}function L3({redirectTo:n="/"}){const{data:e,isLoading:s}=Hn();return s||!e?null:e.machines?h.jsx(_s,{}):h.jsx(un,{to:n,replace:!0})}const q3=E.lazy(()=>Oe(()=>import("./ProcessesListPage-BfJYTU_v.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}))),P3=E.lazy(()=>Oe(()=>import("./ProcessDetailPage-BKu9_wWv.js"),__vite__mapDeps([17,1,2,18,13,19,16,10,4,20,21]),import.meta.url).then(n=>({default:n.ProcessDetailPage}))),B3=E.lazy(()=>Oe(()=>import("./McpOverview-Ce-m2JON.js"),__vite__mapDeps([22,1,23,24,25,26,14,13,27,4]),import.meta.url).then(n=>({default:n.McpOverview}))),U3=E.lazy(()=>Oe(()=>import("./McpRunsPage-CpYLXVPF.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}))),z3=E.lazy(()=>Oe(()=>import("./McpRunDetailPage-MnIe0hwz.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}))),$3=E.lazy(()=>Oe(()=>import("./McpQueryPage-C-lqUPlg.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}))),I3=E.lazy(()=>Oe(()=>import("./McpQueryDetailPage-CtnUqO1v.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}))),H3=E.lazy(()=>Oe(()=>import("./EscalationsOverview-DE6EPkhT.js"),__vite__mapDeps([50,1,14,13,27,4]),import.meta.url).then(n=>({default:n.EscalationsOverview}))),F3=E.lazy(()=>Oe(()=>import("./AvailableEscalationsPage--o6qcz7-.js"),__vite__mapDeps([51,1,4,52,13,53,54,5,55,56,57,21,58,19,7,8,9,59,11,60,12,61,20,16,62,3,31,63,64]),import.meta.url).then(n=>({default:n.AvailableEscalationsPage}))),G3=E.lazy(()=>Oe(()=>import("./OperatorDashboard-Cm9_C0EP.js"),__vite__mapDeps([65,1,3,4,5,6,52,7,8,9,11,31,59,57,21,13,58,19,60,12,61,20,16,62,55,15]),import.meta.url).then(n=>({default:n.OperatorDashboard}))),V3=E.lazy(()=>Oe(()=>import("./index-v4rQ8ctJ.js"),__vite__mapDeps([66,1,67,13,68,4,57,21,58,19,54,16,9,53,5,14,15,20,62,37,69]),import.meta.url).then(n=>({default:n.EscalationDetailPage}))),Y3=E.lazy(()=>Oe(()=>import("./WorkflowsOverview-DNoI9qY8.js"),__vite__mapDeps([70,1,14,13,27,4]),import.meta.url).then(n=>({default:n.WorkflowsOverview}))),K3=E.lazy(()=>Oe(()=>import("./index-C2vRDf96.js"),__vite__mapDeps([71,1,14,13,12,16,67,68,4,57,21,58,19,54,9,72,46,47]),import.meta.url).then(n=>({default:n.StartWorkflowPage}))),J3=E.lazy(()=>Oe(()=>import("./index-C2vRDf96.js"),__vite__mapDeps([71,1,14,13,12,16,67,68,4,57,21,58,19,54,9,72,46,47]),import.meta.url).then(n=>({default:n.DurableInvokePage}))),Q3=E.lazy(()=>Oe(()=>import("./WorkflowsDashboard-m4Co5diK.js"),__vite__mapDeps([73,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"})}))),X3=E.lazy(()=>Oe(()=>import("./WorkflowsDashboard-m4Co5diK.js"),__vite__mapDeps([73,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"})}))),W3=E.lazy(()=>Oe(()=>import("./YamlWorkflowsPage-D1JNwDSg.js"),__vite__mapDeps([74,1,25,3,4,14,13,12,8,48,72,19]),import.meta.url).then(n=>({default:n.YamlWorkflowsPage}))),Z3=E.lazy(()=>Oe(()=>import("./GraphInvokePage--gn48yUD.js"),__vite__mapDeps([75,1,25,14,13,43,45,46,47,44,4,48,72]),import.meta.url).then(n=>({default:n.GraphInvokePage}))),e5=E.lazy(()=>Oe(()=>import("./YamlWorkflowDetailPage-8Vpc4Oxy.js"),__vite__mapDeps([76,1,25,19,72,13,4]),import.meta.url).then(n=>({default:n.YamlWorkflowDetailPage}))),t5=E.lazy(()=>Oe(()=>import("./TasksListPage-DMYQNDIw.js"),__vite__mapDeps([77,1,2,3,4,7,8,9,19,61,49,11,12,13,14,16]),import.meta.url).then(n=>({default:n.TasksListPage}))),n5=E.lazy(()=>Oe(()=>import("./TaskDetailPage-WtVv2z7T.js"),__vite__mapDeps([78,1,2,19,61,14,13,4]),import.meta.url).then(n=>({default:n.TaskDetailPage}))),ox=E.lazy(()=>Oe(()=>import("./WorkflowExecutionPage-BeffqV13.js"),__vite__mapDeps([79,1,34,12,13,35,19,4,36,2,14,33,15,37]),import.meta.url).then(n=>({default:n.WorkflowExecutionPage}))),r5=E.lazy(()=>Oe(()=>import("./AdminDashboard-C25co77C.js"),__vite__mapDeps([80,1,2,23,18,13,4]),import.meta.url).then(n=>({default:n.AdminDashboard}))),s5=E.lazy(()=>Oe(()=>import("./index-Dq1zjilj.js"),__vite__mapDeps([81,1,7,8,9,12,13,31,3,4,14,82,16]),import.meta.url).then(n=>({default:n.WorkersPage}))),i5=E.lazy(()=>Oe(()=>import("./index-BD4O-ISx.js"),__vite__mapDeps([83,1,12,13,84,20,16,14,4,46,47,72,67,68,57,21,58,19,54,9]),import.meta.url).then(n=>({default:n.WorkflowConfigsPage}))),lx=E.lazy(()=>Oe(()=>import("./index-BD4O-ISx.js"),__vite__mapDeps([83,1,12,13,84,20,16,14,4,46,47,72,67,68,57,21,58,19,54,9]),import.meta.url).then(n=>({default:n.WorkflowConfigDetailPage}))),a5=E.lazy(()=>Oe(()=>import("./index-qEd4FVmN.js"),__vite__mapDeps([85,1,23,8,84,14,13,12,11,3,4,86,45,46,47,48,44,31,19]),import.meta.url).then(n=>({default:n.McpServersPage}))),cx=E.lazy(()=>Oe(()=>import("./index-Dz4LSzA2.js"),__vite__mapDeps([87,1,23,14,13,41,4]),import.meta.url).then(n=>({default:n.McpServerDetailPage}))),o5=E.lazy(()=>Oe(()=>import("./index-g1MmARVR.js"),__vite__mapDeps([88,1,3,4,7,8,9,11,12,13,84,31,14,20,47,49,63,64,89,90,33]),import.meta.url).then(n=>({default:n.UsersPage}))),l5=E.lazy(()=>Oe(()=>import("./RolesPage-CwxHOkqF.js"),__vite__mapDeps([91,1,12,13,14,20,4]),import.meta.url).then(n=>({default:n.RolesPage}))),c5=E.lazy(()=>Oe(()=>import("./RoleDetailPage-vGeth3ve.js"),__vite__mapDeps([92,1,93,84,13,4]),import.meta.url).then(n=>({default:n.RoleDetailPage}))),u5=E.lazy(()=>Oe(()=>import("./PersonasPage-ba1KeInW.js"),__vite__mapDeps([94,1,89,12,13,14,20,4,5]),import.meta.url).then(n=>({default:n.PersonasPage}))),f5=E.lazy(()=>Oe(()=>import("./PersonaDetailPage-CvstNkh3.js"),__vite__mapDeps([95,1,89,20,13,90,93,84,4]),import.meta.url).then(n=>({default:n.PersonaDetailPage}))),h5=E.lazy(()=>Oe(()=>import("./EscalationSchemaPage-BZHZfJiQ.js"),__vite__mapDeps([96,1,67,13,68,4,57,21,58,19,54,16,9]),import.meta.url).then(n=>({default:n.EscalationSchemaPage}))),d5=E.lazy(()=>Oe(()=>import("./PortalPage-GDgG88TM.js"),__vite__mapDeps([97,1,9,56,13,57,21,58,19,4,7,8,59,11,60,12,61,20,16,62]),import.meta.url).then(n=>({default:n.PortalPage}))),m5=E.lazy(()=>Oe(()=>import("./EscalationListSchemaPage-DDKcrVbb.js"),__vite__mapDeps([98,1,13,4]),import.meta.url).then(n=>({default:n.EscalationListSchemaPage}))),p5=E.lazy(()=>Oe(()=>import("./ScanCodesPage-Cptbe7h8.js"),__vite__mapDeps([99,1,100,14,13,4]),import.meta.url).then(n=>({default:n.ScanCodesPage}))),y5=E.lazy(()=>Oe(()=>import("./LabelJobsPage-C8LSts4O.js"),__vite__mapDeps([101,1,14,13,7,8,9,21,63,4]),import.meta.url).then(n=>({default:n.LabelJobsPage}))),g5=E.lazy(()=>Oe(()=>import("./ScanSchemeDetailPage-DquNJ7Or.js"),__vite__mapDeps([102,1,14,13,84,100,4,64,63]),import.meta.url).then(n=>({default:n.ScanSchemeDetailPage}))),b5=E.lazy(()=>Oe(()=>import("./ScanStationPage-DaRfGGa8.js"),__vite__mapDeps([103,1,13,69,57,21,68,4]),import.meta.url).then(n=>({default:n.ScanStationPage}))),x5=E.lazy(()=>Oe(()=>import("./index-CnBUFCV7.js"),__vite__mapDeps([104,1,14,13,54,4]),import.meta.url).then(n=>({default:n.MaintenancePage}))),ux=E.lazy(()=>Oe(()=>import("./OperationsPage-xe6bAwaq.js").then(n=>n.O),__vite__mapDeps([105,1,60,13,4,14,9]),import.meta.url).then(n=>({default:n.OperationsPage}))),v5=E.lazy(()=>Oe(()=>import("./index-CdXPbBgs.js"),__vite__mapDeps([106,1,18,13,12,3,4,29,26,42,82,7,8,9,31]),import.meta.url).then(n=>({default:n.ControlPlanePage}))),_5=E.lazy(()=>Oe(()=>import("./index-D_TSx-k_.js"),__vite__mapDeps([107,1,36,13,3,4,29,26,6,7,8,9,11,12,14,15]),import.meta.url).then(n=>({default:n.StreamMessagesPage}))),w5=E.lazy(()=>Oe(()=>import("./CredentialsPage-CW3_dbm2.js"),__vite__mapDeps([108,1,14,13,49,84,4]),import.meta.url).then(n=>({default:n.CredentialsPage}))),S5=E.lazy(()=>Oe(()=>import("./ConnectedAppsPage-LLiiH3da.js"),__vite__mapDeps([109,1,14,13,49,84,4]),import.meta.url).then(n=>({default:n.ConnectedAppsPage}))),E5=E.lazy(()=>Oe(()=>import("./index-BL8XOMHT.js"),__vite__mapDeps([110,1,4,14,13,12,15,6,8,111,49]),import.meta.url).then(n=>({default:n.FilesPage}))),O5=E.lazy(()=>Oe(()=>import("./index-CNgyKRQ8.js"),__vite__mapDeps([112,1,14,13,12,15,11,8,111,49,113,41,4]),import.meta.url).then(n=>({default:n.KnowledgePage}))),A5=E.lazy(()=>Oe(()=>import("./LinesPage-CJprjG39.js"),__vite__mapDeps([114,1,115,7,8,9,12,13,11,14,5,3,4]),import.meta.url).then(n=>({default:n.LinesPage}))),j5=E.lazy(()=>Oe(()=>import("./LinePage-CS7uUv00.js"),__vite__mapDeps([116,1,115,14,13,60,4,12]),import.meta.url).then(n=>({default:n.LinePage}))),k5=E.lazy(()=>Oe(()=>import("./HomePage-IR_jgBE8.js"),__vite__mapDeps([117,1,24,26,20,13,16,15,105,60,4,14,9,52]),import.meta.url).then(n=>({default:n.HomePage}))),N5=E.lazy(()=>Oe(()=>import("./AgentsPage-ByHU42SO.js"),__vite__mapDeps([118,1,119,3,4,6,7,8,9,11,12,13,14,15]),import.meta.url).then(n=>({default:n.AgentsPage}))),T5=E.lazy(()=>Oe(()=>import("./AgentDetailPage-ByaepsB5.js"),__vite__mapDeps([120,1,119,121,13,16,4]),import.meta.url).then(n=>({default:n.AgentDetailPage}))),fx=E.lazy(()=>Oe(()=>import("./AgentConfigPage-CsCpI15j.js"),__vite__mapDeps([122,1,119,121,13,14,113,45,46,47,25,123,124,16,4]),import.meta.url).then(n=>({default:n.AgentConfigPage}))),C5=E.lazy(()=>Oe(()=>import("./CapabilitiesPage-BekfKHlk.js"),__vite__mapDeps([125,1,123,86,23,45,46,47,13,48,4,44,14,12]),import.meta.url).then(n=>({default:n.CapabilitiesPage}))),M5=E.lazy(()=>Oe(()=>import("./TopicsPage-BtD8jTU7.js"),__vite__mapDeps([126,1,124,14,13,12,4]),import.meta.url).then(n=>({default:n.TopicsPage}))),R5=E.lazy(()=>Oe(()=>import("./TopicDetailPage-CodBRylU.js"),__vite__mapDeps([127,1,124,15,13,4]),import.meta.url).then(n=>({default:n.TopicDetailPage})));function D5(){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(E.Suspense,{fallback:h.jsx(D5,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:n})})}const o_=new vS({defaultOptions:{queries:{staleTime:1e4,retry:(n,e)=>e instanceof Error&&e.message==="Session expired"?!1:n<1}}});window.addEventListener("auth:unauthorized",()=>{o_.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=window.__LT_BASE__||"",e=`${n}/login`;if(window.location.pathname!==e){const s=window.location.pathname+window.location.search,i=n&&s.startsWith(n)?s.slice(n.length)||"/":s;window.location.href=`${e}?returnTo=${encodeURIComponent(i)}`}});const L5=SS([{path:"/login",element:h.jsx(w3,{})},{path:"/connect/anthropic",element:h.jsx(ax,{})},{path:"/connect/:provider",element:h.jsx(ax,{})},{path:"/oauth/consent",element:h.jsx(C3,{})},{path:"/",element:h.jsx(x3,{}),children:[{index:!0,element:h.jsx(we,{children:h.jsx(k5,{})})},{path:"processes/all",element:h.jsx(we,{children:h.jsx(q3,{})})},{path:"processes/detail/:originId",element:h.jsx(we,{children:h.jsx(P3,{})})},{path:"credentials",element:h.jsx(we,{children:h.jsx(w5,{})})},{path:"connected-apps",element:h.jsx(we,{children:h.jsx(S5,{})})},{path:"connections",element:h.jsx(un,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(we,{children:h.jsx(H3,{})})},{path:"escalations/available",element:h.jsx(we,{children:h.jsx(F3,{})})},{path:"escalations/queue",element:h.jsx(we,{children:h.jsx(G3,{})})},{path:"escalations/detail/:id",element:h.jsx(we,{children:h.jsx(V3,{})})},{path:"portal/:role/:portal?",element:h.jsx(we,{children:h.jsx(d5,{})})},{path:"scan/station",element:h.jsx(we,{children:h.jsx(b5,{})})},{path:"capabilities",element:h.jsx(we,{children:h.jsx(C5,{})})},{element:h.jsx(Ji,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"agents",element:h.jsx(we,{children:h.jsx(N5,{})})},{path:"agents/new",element:h.jsx(we,{children:h.jsx(fx,{})})},{path:"agents/:id",element:h.jsx(we,{children:h.jsx(T5,{})})},{path:"agents/:id/edit",element:h.jsx(we,{children:h.jsx(fx,{})})},{path:"topics",element:h.jsx(we,{children:h.jsx(M5,{})})},{path:"topics/:topic",element:h.jsx(we,{children:h.jsx(R5,{})})}]},{element:h.jsx(M3,{}),children:[{path:"workflows/start",element:h.jsx(we,{children:h.jsx(K3,{})})},{path:"workflows/durable/invoke",element:h.jsx(we,{children:h.jsx(J3,{})})}]},{element:h.jsx(Ji,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(we,{children:h.jsx(Y3,{})})},{path:"workflows/executions",element:h.jsx(we,{children:h.jsx(X3,{})})},{path:"workflows/durable/executions",element:h.jsx(we,{children:h.jsx(Q3,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(we,{children:h.jsx(ox,{})})},{path:"workflows/tasks",element:h.jsx(we,{children:h.jsx(t5,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(we,{children:h.jsx(n5,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(we,{children:h.jsx(ox,{})})},{path:"workflows/cron",element:h.jsx(un,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(we,{children:h.jsx(s5,{})})},{path:"workflows/registry",element:h.jsx(we,{children:h.jsx(i5,{})})},{path:"workflows/registry/new",element:h.jsx(we,{children:h.jsx(lx,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(we,{children:h.jsx(lx,{})})}]},{element:h.jsx(Ji,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(we,{children:h.jsx(W3,{})})},{path:"mcp/workflows/invoke",element:h.jsx(we,{children:h.jsx(Z3,{})})},{path:"mcp/workflows/:id",element:h.jsx(we,{children:h.jsx(e5,{})})},{path:"mcp/executions",element:h.jsx(we,{children:h.jsx(U3,{})})},{path:"mcp/executions/:jobId",element:h.jsx(we,{children:h.jsx(z3,{})})},{path:"files",element:h.jsx(we,{children:h.jsx(E5,{})})},{path:"knowledge",element:h.jsx(we,{children:h.jsx(O5,{})})},{element:h.jsx(R3,{}),children:[{path:"mcp",element:h.jsx(we,{children:h.jsx(B3,{})})},{path:"mcp/queries",element:h.jsx(we,{children:h.jsx($3,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(we,{children:h.jsx(I3,{})})},{path:"mcp/tools",element:h.jsx(un,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(we,{children:h.jsx(a5,{})})},{path:"mcp/servers/new",element:h.jsx(we,{children:h.jsx(cx,{})})},{path:"mcp/servers/:serverId",element:h.jsx(we,{children:h.jsx(cx,{})})}]}]},{path:"pace",element:h.jsx(we,{children:h.jsx(ux,{})})},{path:"trends",element:h.jsx(we,{children:h.jsx(ux,{})})},{path:"operations",element:h.jsx(un,{to:"/pace",replace:!0})},{element:h.jsx(Ji,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{element:h.jsx(L3,{}),children:[{path:"lines",element:h.jsx(we,{children:h.jsx(A5,{})})},{path:"lines/:siteId/:lineId",element:h.jsx(we,{children:h.jsx(j5,{})})}]}]},{element:h.jsx(Ji,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(we,{children:h.jsx(r5,{})})},{path:"admin/users",element:h.jsx(we,{children:h.jsx(o5,{})})},{path:"admin/escalation-chains",element:h.jsx(un,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(we,{children:h.jsx(l5,{})})},{path:"admin/roles/:role",element:h.jsx(we,{children:h.jsx(c5,{})})},{path:"admin/roles/:role/schema",element:h.jsx(we,{children:h.jsx(h5,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(we,{children:h.jsx(m5,{})})},{path:"admin/scan-codes",element:h.jsx(we,{children:h.jsx(p5,{})})},{path:"admin/scan-codes/:version",element:h.jsx(we,{children:h.jsx(g5,{})})},{path:"admin/labels/history",element:h.jsx(we,{children:h.jsx(y5,{})})},{path:"admin/personas",element:h.jsx(we,{children:h.jsx(u5,{})})},{path:"admin/personas/:key",element:h.jsx(we,{children:h.jsx(f5,{})})}]},{element:h.jsx(Ji,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx(un,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(D3,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(we,{children:h.jsx(x5,{})})}]},{path:"admin/controlplane",element:h.jsx(we,{children:h.jsx(v5,{})})},{path:"admin/streams",element:h.jsx(we,{children:h.jsx(_5,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function q5(){return h.jsx(_S,{client:o_,children:h.jsx(gE,{children:h.jsx(_A,{children:h.jsx(ES,{router:L5})})})})}kv(jv());const Qm=document.createElement("link");Qm.rel="stylesheet";Qm.href=`${Yt}/api/settings/custom.css`;document.head.appendChild(Qm);oE.createRoot(document.getElementById("root")).render(h.jsx(E.StrictMode,{children:h.jsx(q5,{})}));export{Ru as $,uN as A,FM as B,Jm as C,s3 as D,yN as E,e_ as F,lR as G,mM as H,cR as I,UC as J,Um as K,nC as L,ST as M,Wt as N,rC as O,cM as P,hC as Q,iv as R,jC as S,Lm as T,kM as U,NM as V,TM as W,CM as X,MM as Y,DM as Z,Wj as _,gR as a,cC as a$,dM as a0,qt as a1,am as a2,lC as a3,eM as a4,mR as a5,Im as a6,sa as a7,xs as a8,vM as a9,F5 as aA,wR as aB,xR as aC,bR as aD,Xv as aE,vR as aF,yR as aG,wv as aH,PM as aI,SR as aJ,pR as aK,OR as aL,ER as aM,V5 as aN,Y5 as aO,X5 as aP,W5 as aQ,K5 as aR,J5 as aS,Q5 as aT,sM as aU,aM as aV,iM as aW,fR as aX,Z5 as aY,Dm as aZ,oM as a_,nM as aa,xv as ab,KT as ac,xN as ad,mc as ae,OM as af,AM as ag,Bu as ah,bN as ai,hT as aj,uR as ak,tR as al,Mu as am,Fm as an,Xj as ao,MA as ap,yM as aq,VM as ar,gM as as,bM as at,EM as au,jM as av,RM as aw,mv as ax,H5 as ay,Fg as az,zM as b,YM as b$,lM as b0,tM as b1,XM as b2,Ns as b3,Ao as b4,AR as b5,zx as b6,Yt as b7,Oe as b8,gk as b9,sR as bA,Kk as bB,Ck as bC,aR as bD,oR as bE,iR as bF,rR as bG,GT as bH,Vm as bI,jk as bJ,vN as bK,ke as bL,Jd as bM,nR as bN,yv as bO,fM as bP,IM as bQ,ET as bR,jR as bS,kR as bT,a_ as bU,NR as bV,TR as bW,Vj as bX,AC as bY,Cm as bZ,av as b_,S3 as ba,JM as bb,Ed as bc,G5 as bd,iC as be,dR as bf,vv as bg,X1 as bh,qv as bi,GM as bj,Mm as bk,HM as bl,ZM as bm,$j as bn,WM as bo,$5 as bp,oN as bq,aN as br,yk as bs,SM as bt,wM as bu,fr as bv,ov as bw,QM as bx,na as by,rM as bz,Hn as c,eR as d,LM as e,kk as f,Sv as g,dk as h,uM as i,nn as j,An as k,qM as l,ue as m,_R as n,BM as o,UM as p,pM as q,xM as r,_M as s,$M as t,KM as u,hM as v,Km as w,hR as x,tv as y,Lv as z};
|
|
67
|
+
//# sourceMappingURL=index-Do9Y6Fgt.js.map
|