@hotmeshio/long-tail 0.5.10 → 0.5.12
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/controlplane.d.ts +1 -0
- package/build/api/controlplane.js +1 -0
- package/build/api/diagnostics.d.ts +8 -1
- package/build/api/diagnostics.js +5 -1
- package/build/api/escalations/list.d.ts +2 -0
- package/build/api/escalations/list.js +2 -0
- package/build/api/settings.d.ts +3 -2
- package/build/api/settings.js +13 -2
- package/build/api/workflows/invocation.d.ts +6 -0
- package/build/api/workflows/invocation.js +6 -2
- package/build/modules/features.d.ts +19 -0
- package/build/modules/features.js +16 -0
- package/build/modules/version.d.ts +16 -0
- package/build/modules/version.js +34 -0
- package/build/routes/controlplane.js +1 -0
- package/build/routes/diagnostics.js +32 -11
- package/build/routes/escalations/list.js +2 -0
- package/build/routes/workflows/invocation.js +12 -4
- package/build/sdk/index.d.ts +2 -0
- package/build/services/controlplane/index.js +3 -2
- package/build/services/controlplane/stream-messages-sql.d.ts +4 -3
- package/build/services/controlplane/stream-messages-sql.js +12 -7
- package/build/services/controlplane/types.d.ts +2 -0
- package/build/services/diagnostics/index.d.ts +53 -7
- package/build/services/diagnostics/index.js +124 -36
- package/build/services/diagnostics/patterns.d.ts +13 -3
- package/build/services/diagnostics/patterns.js +25 -14
- package/build/services/escalation/queries.d.ts +2 -0
- package/build/services/escalation/queries.js +84 -2
- package/build/services/escalation/sql.d.ts +7 -0
- package/build/services/escalation/sql.js +50 -1
- package/build/services/task/resolve.d.ts +5 -3
- package/build/services/task/resolve.js +9 -6
- package/build/services/task/sql.d.ts +6 -1
- package/build/services/task/sql.js +7 -1
- package/build/start/adapters.js +3 -0
- package/build/system/mcp-servers/admin/diagnostics.d.ts +11 -4
- package/build/system/mcp-servers/admin/diagnostics.js +34 -22
- package/build/system/mcp-servers/admin/escalations.d.ts +6 -0
- package/build/system/mcp-servers/admin/escalations.js +182 -54
- package/build/system/mcp-servers/admin/index.js +3 -3
- package/build/system/mcp-servers/admin/schemas.d.ts +101 -6
- package/build/system/mcp-servers/admin/schemas.js +43 -6
- package/build/system/mcp-servers/admin/workflows.js +23 -12
- package/build/system/seed/tool-manifests-admin.d.ts +1324 -562
- package/build/system/seed/tool-manifests-admin.js +10 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/auth.d.ts +1 -1
- package/build/types/startup.d.ts +9 -0
- package/dashboard/dist/assets/{AdminDashboard-0LSslIQ7.js → AdminDashboard-LTiYLuzq.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-0LSslIQ7.js.map → AdminDashboard-LTiYLuzq.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-hqBr1540.js → AgentConfigPage-nlOudfpZ.js} +7 -7
- package/dashboard/dist/assets/{AgentConfigPage-hqBr1540.js.map → AgentConfigPage-nlOudfpZ.js.map} +1 -1
- package/dashboard/dist/assets/AgentDetailPage-BSUnDvGp.js +4 -0
- package/dashboard/dist/assets/AgentDetailPage-BSUnDvGp.js.map +1 -0
- package/dashboard/dist/assets/AgentsPage-DpS0cCYe.js +2 -0
- package/dashboard/dist/assets/AgentsPage-DpS0cCYe.js.map +1 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-BEylRqjP.js +2 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-BEylRqjP.js.map +1 -0
- package/dashboard/dist/assets/{BotPicker-fFE4GAaO.js → BotPicker-BhKmq7M7.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-fFE4GAaO.js.map → BotPicker-BhKmq7M7.js.map} +1 -1
- package/dashboard/dist/assets/CapabilitiesPage-DLIleX2L.js +2 -0
- package/dashboard/dist/assets/{CapabilitiesPage-DotZ7iQc.js.map → CapabilitiesPage-DLIleX2L.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-D97SYypF.js → CollapsibleSection-D7SVwNVk.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-D97SYypF.js.map → CollapsibleSection-D7SVwNVk.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-C08U6dlv.js → CredentialsPage-fat5Z2U9.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-C08U6dlv.js.map → CredentialsPage-fat5Z2U9.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-C2TuCl4h.js → CronLabel-OOP4P2mJ.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-C2TuCl4h.js.map → CronLabel-OOP4P2mJ.js.map} +1 -1
- package/dashboard/dist/assets/{CustomDurationPicker-C3zGsESx.js → CustomDurationPicker-COacSAXO.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-C3zGsESx.js.map → CustomDurationPicker-COacSAXO.js.map} +1 -1
- package/dashboard/dist/assets/{DropZone-Dwpgbueb.js → DropZone-Bfw2YLVS.js} +2 -2
- package/dashboard/dist/assets/{DropZone-Dwpgbueb.js.map → DropZone-Bfw2YLVS.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-DF4m0cv_.js → ElapsedCell-CkfCD-m7.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-DF4m0cv_.js.map → ElapsedCell-CkfCD-m7.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-blGOYKtJ.js → EscalationsOverview-BmI8jxlh.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-blGOYKtJ.js.map → EscalationsOverview-BmI8jxlh.js.map} +1 -1
- package/dashboard/dist/assets/EventTable-CeKfFk3m.js +2 -0
- package/dashboard/dist/assets/EventTable-CeKfFk3m.js.map +1 -0
- package/dashboard/dist/assets/{GraphInvokePage-QVAUHmjI.js → GraphInvokePage-BZBPBCSq.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-QVAUHmjI.js.map → GraphInvokePage-BZBPBCSq.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-DvYgvCcO.js → HomePage-dM7U2tl6.js} +2 -2
- package/dashboard/dist/assets/{HomePage-DvYgvCcO.js.map → HomePage-dM7U2tl6.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-D6tQ3ZG2.js → ListToolbar-BJaCzAXS.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-D6tQ3ZG2.js.map → ListToolbar-BJaCzAXS.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-BClbGYb8.js → McpOverview-CvnDG5OB.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-BClbGYb8.js.map → McpOverview-CvnDG5OB.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-DHjfDRdm.js → McpQueryDetailPage-DwmSIcIL.js} +3 -3
- package/dashboard/dist/assets/{McpQueryDetailPage-DHjfDRdm.js.map → McpQueryDetailPage-DwmSIcIL.js.map} +1 -1
- package/dashboard/dist/assets/McpQueryPage-CU6FMEEk.js +2 -0
- package/dashboard/dist/assets/McpQueryPage-CU6FMEEk.js.map +1 -0
- package/dashboard/dist/assets/McpRunDetailPage-8a6lsehv.js +2 -0
- package/dashboard/dist/assets/{McpRunDetailPage-DRbIZMU2.js.map → McpRunDetailPage-8a6lsehv.js.map} +1 -1
- package/dashboard/dist/assets/McpRunsPage-CPMYWgm_.js +2 -0
- package/dashboard/dist/assets/McpRunsPage-CPMYWgm_.js.map +1 -0
- package/dashboard/dist/assets/{NamespacePill-DnJl4Lre.js → NamespacePill-D6btr6e8.js} +2 -2
- package/dashboard/dist/assets/{NamespacePill-DnJl4Lre.js.map → NamespacePill-D6btr6e8.js.map} +1 -1
- package/dashboard/dist/assets/OperatorDashboard-g9o7I925.js +2 -0
- package/dashboard/dist/assets/OperatorDashboard-g9o7I925.js.map +1 -0
- package/dashboard/dist/assets/{PageHeader-Bnt2iQQa.js → PageHeader-Dk2Pe44Q.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-Bnt2iQQa.js.map → PageHeader-Dk2Pe44Q.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-BuKc9MKt.js → PageHeaderWithStats-DJQCZ0FR.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-BuKc9MKt.js.map → PageHeaderWithStats-DJQCZ0FR.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-DjQuNERz.js → ProcessDetailPage-ByyWCs2A.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-DjQuNERz.js.map → ProcessDetailPage-ByyWCs2A.js.map} +1 -1
- package/dashboard/dist/assets/ProcessesListPage-BTsXds4l.js +2 -0
- package/dashboard/dist/assets/ProcessesListPage-BTsXds4l.js.map +1 -0
- package/dashboard/dist/assets/{RolePill-DQTT1s9v.js → RolePill-Du-aNnjR.js} +2 -2
- package/dashboard/dist/assets/{RolePill-DQTT1s9v.js.map → RolePill-Du-aNnjR.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-CFCN_mRF.js → RolesPage-B2Kdf-L9.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-CFCN_mRF.js.map → RolesPage-B2Kdf-L9.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-sBxAvlRf.js → RunAsSelector-BzkZXpSX.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-sBxAvlRf.js.map → RunAsSelector-BzkZXpSX.js.map} +1 -1
- package/dashboard/dist/assets/StreamMessageDetail-B6ch-6SY.js +2 -0
- package/dashboard/dist/assets/StreamMessageDetail-B6ch-6SY.js.map +1 -0
- package/dashboard/dist/assets/SwimlaneTimeline-CjvfUkls.js +2 -0
- package/dashboard/dist/assets/SwimlaneTimeline-CjvfUkls.js.map +1 -0
- package/dashboard/dist/assets/{TagInput-B00uqhjX.js → TagInput-CZSeyesi.js} +2 -2
- package/dashboard/dist/assets/{TagInput-B00uqhjX.js.map → TagInput-CZSeyesi.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-CgFN5uWn.js → TaskDetailPage-BjHU6opi.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-CgFN5uWn.js.map → TaskDetailPage-BjHU6opi.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-CUsofm0X.js → TaskQueuePill-CQrXrSxk.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-CUsofm0X.js.map → TaskQueuePill-CQrXrSxk.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-qj25rRZL.js → TasksListPage-Bem44zd0.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-qj25rRZL.js.map → TasksListPage-Bem44zd0.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-C7LylVjP.js → TimeAgo-CUIYqSt_.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-C7LylVjP.js.map → TimeAgo-CUIYqSt_.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-CrCtoBlo.js → TimestampCell--tnreI1i.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-CrCtoBlo.js.map → TimestampCell--tnreI1i.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-DjvedZSn.js → ToolPill-O09jsTQM.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-DjvedZSn.js.map → ToolPill-O09jsTQM.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-DYGlB-QW.js → ToolTestPanel-OD99H7Pk.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-DYGlB-QW.js.map → ToolTestPanel-OD99H7Pk.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-DLY6X_R6.js → TopicDetailPage-rh_dsTJI.js} +3 -3
- package/dashboard/dist/assets/{TopicDetailPage-DLY6X_R6.js.map → TopicDetailPage-rh_dsTJI.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-C5nOLsLx.js → TopicsPage-CD_40_v-.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-C5nOLsLx.js.map → TopicsPage-CD_40_v-.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-CgUZyiwm.js → UserName-C__c8BN0.js} +2 -2
- package/dashboard/dist/assets/{UserName-CgUZyiwm.js.map → UserName-C__c8BN0.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowExecutionPage-Bw6QdtUO.js +2 -0
- package/dashboard/dist/assets/{WorkflowExecutionPage-CDr5CTM2.js.map → WorkflowExecutionPage-Bw6QdtUO.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowPill-F1oKUzmc.js → WorkflowPill-CS-IsR0U.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill-F1oKUzmc.js.map → WorkflowPill-CS-IsR0U.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowsDashboard-BgI-iOP6.js +2 -0
- package/dashboard/dist/assets/WorkflowsDashboard-BgI-iOP6.js.map +1 -0
- package/dashboard/dist/assets/{WorkflowsOverview-CaMeZwde.js → WorkflowsOverview-BRc0QbA7.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-CaMeZwde.js.map → WorkflowsOverview-BRc0QbA7.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-C3uyCiIX.js → YamlWorkflowDetailPage-DdzspNQR.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-C3uyCiIX.js.map → YamlWorkflowDetailPage-DdzspNQR.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-DRnYgsvA.js → YamlWorkflowsPage-Djw5ZbgQ.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-DRnYgsvA.js.map → YamlWorkflowsPage-Djw5ZbgQ.js.map} +1 -1
- package/dashboard/dist/assets/{agents-HMkTc425.js → agents-xstNkF6c.js} +2 -2
- package/dashboard/dist/assets/{agents-HMkTc425.js.map → agents-xstNkF6c.js.map} +1 -1
- package/dashboard/dist/assets/api-path-u2Jf9QXS.js +2 -0
- package/dashboard/dist/assets/api-path-u2Jf9QXS.js.map +1 -0
- package/dashboard/dist/assets/{bots-CDe2jXNx.js → bots-BztAI0s_.js} +2 -2
- package/dashboard/dist/assets/{bots-CDe2jXNx.js.map → bots-BztAI0s_.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-DhnM7Ztb.js → capabilities-CEDwtxNL.js} +2 -2
- package/dashboard/dist/assets/{capabilities-DhnM7Ztb.js.map → capabilities-CEDwtxNL.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-BwIJ9ZC_.js → controlplane-BlGEsRKe.js} +2 -2
- package/dashboard/dist/assets/{controlplane-BwIJ9ZC_.js.map → controlplane-BlGEsRKe.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-BKqSywVA.js → escalation-columns-nVYVt7Gl.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-BKqSywVA.js.map → escalation-columns-nVYVt7Gl.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-Djk5XKmX.js → escalation-iI4QKlP-.js} +2 -2
- package/dashboard/dist/assets/{escalation-Djk5XKmX.js.map → escalation-iI4QKlP-.js.map} +1 -1
- package/dashboard/dist/assets/{index-BW-fIquS.js → index-B5qsp8lb.js} +2 -2
- package/dashboard/dist/assets/{index-BW-fIquS.js.map → index-B5qsp8lb.js.map} +1 -1
- package/dashboard/dist/assets/{index-DBi9Q9Hw.js → index-B7VC0vjf.js} +2 -2
- package/dashboard/dist/assets/{index-DBi9Q9Hw.js.map → index-B7VC0vjf.js.map} +1 -1
- package/dashboard/dist/assets/{index-CPIYW81T.js → index-BUmnJ4eT.js} +2 -2
- package/dashboard/dist/assets/{index-CPIYW81T.js.map → index-BUmnJ4eT.js.map} +1 -1
- package/dashboard/dist/assets/{index-BNkpns_E.js → index-CAqEy2Db.js} +2 -2
- package/dashboard/dist/assets/{index-BNkpns_E.js.map → index-CAqEy2Db.js.map} +1 -1
- package/dashboard/dist/assets/{index-BYpWOUEe.js → index-CMviPjXQ.js} +2 -2
- package/dashboard/dist/assets/{index-BYpWOUEe.js.map → index-CMviPjXQ.js.map} +1 -1
- package/dashboard/dist/assets/index-CP0JEQhZ.js +6 -0
- package/dashboard/dist/assets/{index-E2hQ8DIi.js.map → index-CP0JEQhZ.js.map} +1 -1
- package/dashboard/dist/assets/index-CUfgt3mV.js +2 -0
- package/dashboard/dist/assets/index-CUfgt3mV.js.map +1 -0
- package/dashboard/dist/assets/index-ClvYSNZd.css +1 -0
- package/dashboard/dist/assets/{index-BFQ2t-p1.js → index-D1xVY4JR.js} +27 -27
- package/dashboard/dist/assets/index-D1xVY4JR.js.map +1 -0
- package/dashboard/dist/assets/{index-rUST2YsO.js → index-DPLy-jwO.js} +2 -2
- package/dashboard/dist/assets/{index-rUST2YsO.js.map → index-DPLy-jwO.js.map} +1 -1
- package/dashboard/dist/assets/{index-DRIJM1L-.js → index-DjJ6VCuc.js} +2 -2
- package/dashboard/dist/assets/{index-DRIJM1L-.js.map → index-DjJ6VCuc.js.map} +1 -1
- package/dashboard/dist/assets/{index-Dhy2PVAw.js → index-Dsi5o7dx.js} +2 -2
- package/dashboard/dist/assets/{index-Dhy2PVAw.js.map → index-Dsi5o7dx.js.map} +1 -1
- package/dashboard/dist/assets/{index-mEQ6kCnt.js → index-DzVYjoex.js} +3 -3
- package/dashboard/dist/assets/{index-mEQ6kCnt.js.map → index-DzVYjoex.js.map} +1 -1
- package/dashboard/dist/assets/index-FuhiJuHL.js +2 -0
- package/dashboard/dist/assets/index-FuhiJuHL.js.map +1 -0
- package/dashboard/dist/assets/{knowledge-jQE3dBVi.js → knowledge-BKg0cr39.js} +2 -2
- package/dashboard/dist/assets/{knowledge-jQE3dBVi.js.map → knowledge-BKg0cr39.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-DtEGfZiz.js → mcp-CVdHpKlz.js} +2 -2
- package/dashboard/dist/assets/{mcp-DtEGfZiz.js.map → mcp-CVdHpKlz.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-CiTLVuDC.js → mcp-query-CYxZcbwQ.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-CiTLVuDC.js.map → mcp-query-CYxZcbwQ.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-ClNdzuUK.js → pipelines-BOEv7P6O.js} +2 -2
- package/dashboard/dist/assets/{pipelines-ClNdzuUK.js.map → pipelines-BOEv7P6O.js.map} +1 -1
- package/dashboard/dist/assets/{roles-BmHbRaPT.js → roles-c5cV2QYQ.js} +2 -2
- package/dashboard/dist/assets/{roles-BmHbRaPT.js.map → roles-c5cV2QYQ.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-BPONxLcq.js → tasks-JV3BjeEF.js} +2 -2
- package/dashboard/dist/assets/{tasks-BPONxLcq.js.map → tasks-JV3BjeEF.js.map} +1 -1
- package/dashboard/dist/assets/{topics-XREPRxwo.js → topics-BDaPnhnQ.js} +2 -2
- package/dashboard/dist/assets/{topics-XREPRxwo.js.map → topics-BDaPnhnQ.js.map} +1 -1
- package/dashboard/dist/assets/useDebouncedValue-BA5S7V54.js +2 -0
- package/dashboard/dist/assets/useDebouncedValue-BA5S7V54.js.map +1 -0
- package/dashboard/dist/assets/{useEventHooks-M7SaEfel.js → useEventHooks-a7Dnh8G4.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-M7SaEfel.js.map → useEventHooks-a7Dnh8G4.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-BQHGkdBv.js → useNamespace-BSwEV0e9.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-BQHGkdBv.js.map → useNamespace-BSwEV0e9.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-B7JtUGSE.js → useYamlActivityEvents-BuqvL-cn.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-B7JtUGSE.js.map → useYamlActivityEvents-BuqvL-cn.js.map} +1 -1
- package/dashboard/dist/assets/{users-BpjSNhQe.js → users-Pn85K_3C.js} +2 -2
- package/dashboard/dist/assets/{users-BpjSNhQe.js.map → users-Pn85K_3C.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-Dj2F0Jrb.js → vendor-icons-D5ycKPA2.js} +114 -109
- package/dashboard/dist/assets/vendor-icons-D5ycKPA2.js.map +1 -0
- package/dashboard/dist/assets/{workflows-k4jE0ECC.js → workflows-DF-9Voyi.js} +2 -2
- package/dashboard/dist/assets/{workflows-k4jE0ECC.js.map → workflows-DF-9Voyi.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-DpviSLEL.js → yaml-workflows-2roKaSSK.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-DpviSLEL.js.map → yaml-workflows-2roKaSSK.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/docs/api/mcp/admin.md +242 -5
- package/docs/mcp.md +102 -0
- package/package.json +1 -1
- package/dashboard/dist/assets/AgentDetailPage-bnXR1ezD.js +0 -4
- package/dashboard/dist/assets/AgentDetailPage-bnXR1ezD.js.map +0 -1
- package/dashboard/dist/assets/AgentsPage-tJIlrnfM.js +0 -2
- package/dashboard/dist/assets/AgentsPage-tJIlrnfM.js.map +0 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-B7gEfcw3.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-B7gEfcw3.js.map +0 -1
- package/dashboard/dist/assets/CapabilitiesPage-DotZ7iQc.js +0 -2
- package/dashboard/dist/assets/EventTable-DzrMH-ux.js +0 -2
- package/dashboard/dist/assets/EventTable-DzrMH-ux.js.map +0 -1
- package/dashboard/dist/assets/McpQueryPage-qtEuMDrd.js +0 -2
- package/dashboard/dist/assets/McpQueryPage-qtEuMDrd.js.map +0 -1
- package/dashboard/dist/assets/McpRunDetailPage-DRbIZMU2.js +0 -2
- package/dashboard/dist/assets/McpRunsPage-CMfwXQ4R.js +0 -2
- package/dashboard/dist/assets/McpRunsPage-CMfwXQ4R.js.map +0 -1
- package/dashboard/dist/assets/OperatorDashboard-Dq2pfV68.js +0 -2
- package/dashboard/dist/assets/OperatorDashboard-Dq2pfV68.js.map +0 -1
- package/dashboard/dist/assets/ProcessesListPage-vJimii8-.js +0 -2
- package/dashboard/dist/assets/ProcessesListPage-vJimii8-.js.map +0 -1
- package/dashboard/dist/assets/SwimlaneTimeline-2Eet4OOL.js +0 -2
- package/dashboard/dist/assets/SwimlaneTimeline-2Eet4OOL.js.map +0 -1
- package/dashboard/dist/assets/WorkflowExecutionPage-CDr5CTM2.js +0 -2
- package/dashboard/dist/assets/WorkflowsDashboard-tCBP0i0Y.js +0 -2
- package/dashboard/dist/assets/WorkflowsDashboard-tCBP0i0Y.js.map +0 -1
- package/dashboard/dist/assets/index-BFQ2t-p1.js.map +0 -1
- package/dashboard/dist/assets/index-Cydgj_Co.js +0 -2
- package/dashboard/dist/assets/index-Cydgj_Co.js.map +0 -1
- package/dashboard/dist/assets/index-DSki_Ub6.css +0 -1
- package/dashboard/dist/assets/index-E2hQ8DIi.js +0 -6
- package/dashboard/dist/assets/index-u08vQUaw.js +0 -2
- package/dashboard/dist/assets/index-u08vQUaw.js.map +0 -1
- package/dashboard/dist/assets/vendor-icons-Dj2F0Jrb.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-
|
|
2
|
-
var _x=Object.defineProperty;var wx=(r,n,s)=>n in r?_x(r,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[n]=s;var v=(r,n,s)=>wx(r,typeof n!="symbol"?n+"":n,s);import{r as Sx,a as T,j as
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-BTsXds4l.js","./vendor-query-B2UbickB.js","./tasks-JV3BjeEF.js","./workflows-DF-9Voyi.js","./useEventHooks-a7Dnh8G4.js","./useFilterParams-x-Dg0Vgz.js","./vendor-react-CXumBFUA.js","./useDebouncedValue-BA5S7V54.js","./api-path-u2Jf9QXS.js","./DataTable-D9yuBv0w.js","./EmptyState-BcsfPq9T.js","./TimestampCell--tnreI1i.js","./StickyPagination-BWhFSr2d.js","./FilterBar-Ck4K4rzu.js","./PageHeader-Dk2Pe44Q.js","./vendor-icons-D5ycKPA2.js","./ListToolbar-BJaCzAXS.js","./WorkflowPill-CS-IsR0U.js","./ProcessDetailPage-ByyWCs2A.js","./PageHeaderWithStats-DJQCZ0FR.js","./StatusBadge-Bl3FXVmF.js","./RolePill-Du-aNnjR.js","./UserName-C__c8BN0.js","./users-Pn85K_3C.js","./McpOverview-CvnDG5OB.js","./mcp-CVdHpKlz.js","./pipelines-BOEv7P6O.js","./yaml-workflows-2roKaSSK.js","./controlplane-BlGEsRKe.js","./StatCard-DlgF0CJC.js","./McpRunsPage-CPMYWgm_.js","./useNamespace-BSwEV0e9.js","./ElapsedCell-CkfCD-m7.js","./RowActions-Dg-Fsm5O.js","./McpRunDetailPage-8a6lsehv.js","./CopyableId-DaT0ZRHg.js","./CollapsibleSection-D7SVwNVk.js","./useCollapsedSections-BU5HULGs.js","./SwimlaneTimeline-CjvfUkls.js","./StreamMessageDetail-B6ch-6SY.js","./EventTable-CeKfFk3m.js","./McpQueryPage-CU6FMEEk.js","./mcp-query-CYxZcbwQ.js","./McpQueryDetailPage-DwmSIcIL.js","./TagInput-CZSeyesi.js","./useYamlActivityEvents-BuqvL-cn.js","./helpers-DzO-OGPe.js","./RunAsSelector-BzkZXpSX.js","./BotPicker-BhKmq7M7.js","./bots-BztAI0s_.js","./ToolPill-O09jsTQM.js","./TimeAgo-CUIYqSt_.js","./EscalationsOverview-BmI8jxlh.js","./AvailableEscalationsPage-BEylRqjP.js","./CustomDurationPicker-COacSAXO.js","./Modal-CSrxpXeM.js","./constants-BHkpVaqx.js","./roles-c5cV2QYQ.js","./escalation-columns-nVYVt7Gl.js","./PriorityBadge-DfQY9St9.js","./escalation-iI4QKlP-.js","./OperatorDashboard-g9o7I925.js","./index-CP0JEQhZ.js","./WorkflowsOverview-BRc0QbA7.js","./index-DzVYjoex.js","./NamespacePill-D6btr6e8.js","./WorkflowsDashboard-BgI-iOP6.js","./YamlWorkflowsPage-Djw5ZbgQ.js","./GraphInvokePage-BZBPBCSq.js","./YamlWorkflowDetailPage-DdzspNQR.js","./TasksListPage-Bem44zd0.js","./TaskDetailPage-BjHU6opi.js","./WorkflowExecutionPage-Bw6QdtUO.js","./AdminDashboard-LTiYLuzq.js","./index-BUmnJ4eT.js","./TaskQueuePill-CQrXrSxk.js","./index-CMviPjXQ.js","./ConfirmDeleteModal-D9_1b4MW.js","./index-B7VC0vjf.js","./ToolTestPanel-OD99H7Pk.js","./index-Dsi5o7dx.js","./index-DPLy-jwO.js","./RolesPage-B2Kdf-L9.js","./index-B5qsp8lb.js","./index-DjJ6VCuc.js","./index-CUfgt3mV.js","./CredentialsPage-fat5Z2U9.js","./index-FuhiJuHL.js","./DropZone-Bfw2YLVS.js","./index-CAqEy2Db.js","./knowledge-BKg0cr39.js","./HomePage-dM7U2tl6.js","./AgentsPage-DpS0cCYe.js","./agents-xstNkF6c.js","./AgentDetailPage-BSUnDvGp.js","./CronLabel-OOP4P2mJ.js","./AgentConfigPage-nlOudfpZ.js","./capabilities-CEDwtxNL.js","./topics-BDaPnhnQ.js","./CapabilitiesPage-DLIleX2L.js","./TopicsPage-CD_40_v-.js","./TopicDetailPage-rh_dsTJI.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var _x=Object.defineProperty;var wx=(r,n,s)=>n in r?_x(r,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[n]=s;var v=(r,n,s)=>wx(r,typeof n!="symbol"?n+"":n,s);import{r as Sx,a as T,j as d,u as $n,b as rn,c as _n,Q as Ex,d as Ax}from"./vendor-query-B2UbickB.js";import{r as jx,L as yr,u as Ws,N as Co,a as cg,b as Un,O as xr,c as ug,d as Ox,R as Tx}from"./vendor-react-CXumBFUA.js";import{I as Ef,R as fg,B as hg,U as Nx,L as Af,a as Cx,Z as kx,S as n0,P as s0,C as Mx,W as Kf,b as Rx,c as Dx,F as zx,d as qx,e as Ux,T as Bx,N as Lx,f as Hx,D as Px,M as dg,g as mg,h as $x,i as Yx,j as Gx,E as Vx,X as $o,k as Fx,l as Jx,m as Ix,n as i0,G as Qx,o as Xx,p as Kx,q as Zx,r as Wx}from"./vendor-icons-D5ycKPA2.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const f of o)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&a(h)}).observe(document,{childList:!0,subtree:!0});function s(o){const f={};return o.integrity&&(f.integrity=o.integrity),o.referrerPolicy&&(f.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?f.credentials="include":o.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(o){if(o.ep)return;o.ep=!0;const f=s(o);fetch(o.href,f)}})();var lf={exports:{}},Ea={},of={exports:{}},cf={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* scheduler.production.js
|
|
5
5
|
*
|
|
@@ -7,7 +7,7 @@ var _x=Object.defineProperty;var wx=(r,n,s)=>n in r?_x(r,n,{enumerable:!0,config
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var
|
|
10
|
+
*/var r0;function ev(){return r0||(r0=1,(function(r){function n($,te){var de=$.length;$.push(te);e:for(;0<de;){var ve=de-1>>>1,be=$[ve];if(0<o(be,te))$[ve]=te,$[de]=be,de=ve;else break e}}function s($){return $.length===0?null:$[0]}function a($){if($.length===0)return null;var te=$[0],de=$.pop();if(de!==te){$[0]=de;e:for(var ve=0,be=$.length,Oe=be>>>1;ve<Oe;){var we=2*(ve+1)-1,Te=$[we],lt=we+1,Pt=$[lt];if(0>o(Te,de))lt<be&&0>o(Pt,Te)?($[ve]=Pt,$[lt]=de,ve=lt):($[ve]=Te,$[we]=de,ve=we);else if(lt<be&&0>o(Pt,de))$[ve]=Pt,$[lt]=de,ve=lt;else break e}}return te}function o($,te){var de=$.sortIndex-te.sortIndex;return de!==0?de:$.id-te.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;r.unstable_now=function(){return f.now()}}else{var h=Date,m=h.now();r.unstable_now=function(){return h.now()-m}}var g=[],y=[],E=1,w=null,O=3,q=!1,M=!1,D=!1,W=!1,se=typeof setTimeout=="function"?setTimeout:null,ee=typeof clearTimeout=="function"?clearTimeout:null,me=typeof setImmediate<"u"?setImmediate:null;function re($){for(var te=s(y);te!==null;){if(te.callback===null)a(y);else if(te.startTime<=$)a(y),te.sortIndex=te.expirationTime,n(g,te);else break;te=s(y)}}function C($){if(D=!1,re($),!M)if(s(g)!==null)M=!0,X||(X=!0,ne());else{var te=s(y);te!==null&&Me(C,te.startTime-$)}}var X=!1,ce=-1,V=5,G=-1;function K(){return W?!0:!(r.unstable_now()-G<V)}function ae(){if(W=!1,X){var $=r.unstable_now();G=$;var te=!0;try{e:{M=!1,D&&(D=!1,ee(ce),ce=-1),q=!0;var de=O;try{t:{for(re($),w=s(g);w!==null&&!(w.expirationTime>$&&K());){var ve=w.callback;if(typeof ve=="function"){w.callback=null,O=w.priorityLevel;var be=ve(w.expirationTime<=$);if($=r.unstable_now(),typeof be=="function"){w.callback=be,re($),te=!0;break t}w===s(g)&&a(g),re($)}else a(g);w=s(g)}if(w!==null)te=!0;else{var Oe=s(y);Oe!==null&&Me(C,Oe.startTime-$),te=!1}}break e}finally{w=null,O=de,q=!1}te=void 0}}finally{te?ne():X=!1}}}var ne;if(typeof me=="function")ne=function(){me(ae)};else if(typeof MessageChannel<"u"){var ke=new MessageChannel,He=ke.port2;ke.port1.onmessage=ae,ne=function(){He.postMessage(null)}}else ne=function(){se(ae,0)};function Me($,te){ce=se(function(){$(r.unstable_now())},te)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function($){$.callback=null},r.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<$?Math.floor(1e3/$):5},r.unstable_getCurrentPriorityLevel=function(){return O},r.unstable_next=function($){switch(O){case 1:case 2:case 3:var te=3;break;default:te=O}var de=O;O=te;try{return $()}finally{O=de}},r.unstable_requestPaint=function(){W=!0},r.unstable_runWithPriority=function($,te){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var de=O;O=$;try{return te()}finally{O=de}},r.unstable_scheduleCallback=function($,te,de){var ve=r.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?ve+de:ve):de=ve,$){case 1:var be=-1;break;case 2:be=250;break;case 5:be=1073741823;break;case 4:be=1e4;break;default:be=5e3}return be=de+be,$={id:E++,callback:te,priorityLevel:$,startTime:de,expirationTime:be,sortIndex:-1},de>ve?($.sortIndex=de,n(y,$),s(g)===null&&$===s(y)&&(D?(ee(ce),ce=-1):D=!0,Me(C,de-ve))):($.sortIndex=be,n(g,$),M||q||(M=!0,X||(X=!0,ne()))),$},r.unstable_shouldYield=K,r.unstable_wrapCallback=function($){var te=O;return function(){var de=O;O=te;try{return $.apply(this,arguments)}finally{O=de}}}})(cf)),cf}var a0;function tv(){return a0||(a0=1,of.exports=ev()),of.exports}/**
|
|
11
11
|
* @license React
|
|
12
12
|
* react-dom-client.production.js
|
|
13
13
|
*
|
|
@@ -15,49 +15,49 @@ var _x=Object.defineProperty;var wx=(r,n,s)=>n in r?_x(r,n,{enumerable:!0,config
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var
|
|
18
|
+
*/var l0;function nv(){if(l0)return Ea;l0=1;var r=tv(),n=Sx(),s=jx();function a(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(f(e)!==e)throw Error(a(188))}function y(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(a(188));return t!==e?null:e}for(var i=e,l=t;;){var c=i.return;if(c===null)break;var u=c.alternate;if(u===null){if(l=c.return,l!==null){i=l;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===i)return g(c),e;if(u===l)return g(c),t;u=u.sibling}throw Error(a(188))}if(i.return!==l.return)i=c,l=u;else{for(var p=!1,b=c.child;b;){if(b===i){p=!0,i=c,l=u;break}if(b===l){p=!0,l=c,i=u;break}b=b.sibling}if(!p){for(b=u.child;b;){if(b===i){p=!0,i=u,l=c;break}if(b===l){p=!0,l=u,i=c;break}b=b.sibling}if(!p)throw Error(a(189))}}if(i.alternate!==l)throw Error(a(190))}if(i.tag!==3)throw Error(a(188));return i.stateNode.current===i?e:t}function E(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=E(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,O=Symbol.for("react.element"),q=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),se=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),me=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function ne(e){return e===null||typeof e!="object"?null:(e=ae&&e[ae]||e["@@iterator"],typeof e=="function"?e:null)}var ke=Symbol.for("react.client.reference");function He(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ke?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case D:return"Fragment";case se:return"Profiler";case W:return"StrictMode";case C:return"Suspense";case X:return"SuspenseList";case G:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case M:return"Portal";case me:return e.displayName||"Context";case ee:return(e._context.displayName||"Context")+".Consumer";case re:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ce:return t=e.displayName||null,t!==null?t:He(e.type)||"Memo";case V:t=e._payload,e=e._init;try{return He(e(t))}catch{}}return null}var Me=Array.isArray,$=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},ve=[],be=-1;function Oe(e){return{current:e}}function we(e){0>be||(e.current=ve[be],ve[be]=null,be--)}function Te(e,t){be++,ve[be]=e.current,e.current=t}var lt=Oe(null),Pt=Oe(null),an=Oe(null),jt=Oe(null);function Ot(e,t){switch(Te(an,t),Te(Pt,e),Te(lt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ap(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ap(t),e=jp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}we(lt),Te(lt,e)}function Se(){we(lt),we(Pt),we(an)}function Tt(e){e.memoizedState!==null&&Te(jt,e);var t=lt.current,i=jp(t,e.type);t!==i&&(Te(Pt,e),Te(lt,i))}function ei(e){Pt.current===e&&(we(lt),we(Pt)),jt.current===e&&(we(jt),va._currentValue=de)}var Ni,ti;function ln(e){if(Ni===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ni=t&&t[1]||"",ti=-1<i.stack.indexOf(`
|
|
19
19
|
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
-
`+
|
|
20
|
+
`+Ni+e+ti}var Ci=!1;function ms(e,t){if(!e||Ci)return"";Ci=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var Q=function(){throw Error()};if(Object.defineProperty(Q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Q,[])}catch(P){var L=P}Reflect.construct(e,[],Q)}else{try{Q.call()}catch(P){L=P}e.call(Q.prototype)}}else{try{throw Error()}catch(P){L=P}(Q=e())&&typeof Q.catch=="function"&&Q.catch(function(){})}}catch(P){if(P&&L&&typeof P.stack=="string")return[P.stack,L.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),p=u[0],b=u[1];if(p&&b){var j=p.split(`
|
|
21
21
|
`),B=b.split(`
|
|
22
|
-
`);for(c=l=0;l<
|
|
23
|
-
`+
|
|
22
|
+
`);for(c=l=0;l<j.length&&!j[l].includes("DetermineComponentFrameRoot");)l++;for(;c<B.length&&!B[c].includes("DetermineComponentFrameRoot");)c++;if(l===j.length||c===B.length)for(l=j.length-1,c=B.length-1;1<=l&&0<=c&&j[l]!==B[c];)c--;for(;1<=l&&0<=c;l--,c--)if(j[l]!==B[c]){if(l!==1||c!==1)do if(l--,c--,0>c||j[l]!==B[c]){var Y=`
|
|
23
|
+
`+j[l].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=l&&0<=c);break}}}finally{Ci=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?ln(i):""}function Ja(e,t){switch(e.tag){case 26:case 27:case 5:return ln(e.type);case 16:return ln("Lazy");case 13:return e.child!==t&&t!==null?ln("Suspense Fallback"):ln("Suspense");case 19:return ln("SuspenseList");case 0:case 15:return ms(e.type,!1);case 11:return ms(e.type.render,!1);case 1:return ms(e.type,!0);case 31:return ln("Activity");default:return""}}function Ia(e){try{var t="",i=null;do t+=Ja(e,i),i=e,e=e.return;while(e);return t}catch(l){return`
|
|
24
24
|
Error generating stack: `+l.message+`
|
|
25
|
-
`+l.stack}}var Nr=Object.prototype.hasOwnProperty,Cr=r.unstable_scheduleCallback,$n=r.unstable_cancelCallback,Ia=r.unstable_shouldYield,Ci=r.unstable_requestPaint,et=r.unstable_now,Io=r.unstable_getCurrentPriorityLevel,Xa=r.unstable_ImmediatePriority,Ka=r.unstable_UserBlockingPriority,ki=r.unstable_NormalPriority,Xo=r.unstable_LowPriority,Za=r.unstable_IdlePriority,Ko=r.log,Wa=r.unstable_setDisableYieldValue,ni=null,ot=null;function $t(e){if(typeof Ko=="function"&&Wa(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(ni,e)}catch{}}var Nt=Math.clz32?Math.clz32:Mi,kr=Math.log,Mr=Math.LN2;function Mi(e){return e>>>=0,e===0?32:31-(kr(e)/Mr|0)|0}var ps=256,Yn=262144,gs=4194304;function wn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function si(e,t,i){var l=e.pendingLanes;if(l===0)return 0;var c=0,u=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?c=wn(l):(p&=b,p!==0?c=wn(p):i||(i=b&~e,i!==0&&(c=wn(i))))):(b=l&~u,b!==0?c=wn(b):p!==0?c=wn(p):i||(i=l&~e,i!==0&&(c=wn(i)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,i=t&-t,u>=i||u===32&&(i&4194048)!==0)?t:c}function ii(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Rr(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ri(){var e=gs;return gs<<=1,(gs&62914560)===0&&(gs=4194304),e}function ys(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function Sn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function bs(e,t,i,l,c,u){var p=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var b=e.entanglements,O=e.expirationTimes,B=e.hiddenUpdates;for(i=p&~i;0<i;){var Y=31-Nt(i),I=1<<Y;b[Y]=0,O[Y]=-1;var L=B[Y];if(L!==null)for(B[Y]=null,Y=0;Y<L.length;Y++){var P=L[Y];P!==null&&(P.lane&=-536870913)}i&=~I}l!==0&&xs(e,l,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(p&~t))}function xs(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Nt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function ri(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var l=31-Nt(i),c=1<<l;c&t|e[l]&t&&(e[l]|=t),i&=~c}}function vs(e,t){var i=t&-t;return i=(i&42)!==0?1:Gn(i),(i&(e.suspendedLanes|t))!==0?0:i}function Gn(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ai(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Dr(){var e=te.p;return e!==0?e:(e=window.event,e===void 0?32:Qp(e.type))}function el(e,t){var i=te.p;try{return te.p=e,t()}finally{te.p=i}}var Mn=Math.random().toString(36).slice(2),Ie="__reactFiber$"+Mn,it="__reactProps$"+Mn,Yt="__reactContainer$"+Mn,li="__reactEvents$"+Mn,zr="__reactListeners$"+Mn,tl="__reactHandles$"+Mn,nl="__reactResources$"+Mn,yt="__reactMarker$"+Mn;function Di(e){delete e[Ie],delete e[it],delete e[li],delete e[zr],delete e[tl]}function x(e){var t=e[Ie];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Yt]||i[Ie]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Mp(e);e!==null;){if(i=e[Ie])return i;e=Mp(e)}return t}e=i,i=e.parentNode}return null}function S(e){if(e=e[Ie]||e[Yt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function A(e){var t=e[nl];return t||(t=e[nl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function N(e){e[yt]=!0}var z=new Set,Q={};function Z(e,t){H(e,t),H(e+"Capture",t)}function H(e,t){for(Q[e]=t,e=0;e<t.length;e++)z.add(t[e])}var J=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]*$"),fe={},Oe={};function Ke(e){return Nr.call(Oe,e)?!0:Nr.call(fe,e)?!1:J.test(e)?Oe[e]=!0:(fe[e]=!0,!1)}function Ct(e,t,i){if(Ke(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function En(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function Vn(e,t,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+l)}}function on(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function my(e,t,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var c=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){i=""+p,u.call(this,p)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(p){i=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Zo(e){if(!e._valueTracker){var t=gh(e)?"checked":"value";e._valueTracker=my(e,t,""+e[t])}}function yh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),l="";return e&&(l=gh(e)?e.checked?"true":"false":e.value),e=l,e!==i?(t.setValue(e),!0):!1}function sl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var py=/[\n"\\]/g;function cn(e){return e.replace(py,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Wo(e,t,i,l,c,u,p,b){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+on(t)):e.value!==""+on(t)&&(e.value=""+on(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?ec(e,p,on(t)):i!=null?ec(e,p,on(i)):l!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+on(b):e.removeAttribute("name")}function bh(e,t,i,l,c,u,p,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||i!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Zo(e);return}i=i!=null?""+on(i):"",t=t!=null?""+on(t):i,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),Zo(e)}function ec(e,t,i){t==="number"&&sl(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function zi(e,t,i,l){if(e=e.options,t){t={};for(var c=0;c<i.length;c++)t["$"+i[c]]=!0;for(i=0;i<e.length;i++)c=t.hasOwnProperty("$"+e[i].value),e[i].selected!==c&&(e[i].selected=c),c&&l&&(e[i].defaultSelected=!0)}else{for(i=""+on(i),t=null,c=0;c<e.length;c++){if(e[c].value===i){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function xh(e,t,i){if(t!=null&&(t=""+on(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+on(i):""}function vh(e,t,i,l){if(t==null){if(l!=null){if(i!=null)throw Error(a(92));if(Me(l)){if(1<l.length)throw Error(a(93));l=l[0]}i=l}i==null&&(i=""),t=i}i=on(t),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Zo(e)}function qi(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var gy=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function _h(e,t,i){var l=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,i):typeof i!="number"||i===0||gy.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function wh(e,t,i){if(t!=null&&typeof t!="object")throw Error(a(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var c in t)l=t[c],t.hasOwnProperty(c)&&i[c]!==l&&_h(e,c,l)}else for(var u in t)t.hasOwnProperty(u)&&_h(e,u,t[u])}function tc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var yy=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"]]),by=/^[\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 il(e){return by.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Fn(){}var nc=null;function sc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ui=null,Bi=null;function Sh(e){var t=S(e);if(t&&(e=t.stateNode)){var i=e[it]||null;e:switch(e=t.stateNode,t.type){case"input":if(Wo(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+cn(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var l=i[t];if(l!==e&&l.form===e.form){var c=l[it]||null;if(!c)throw Error(a(90));Wo(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<i.length;t++)l=i[t],l.form===e.form&&yh(l)}break e;case"textarea":xh(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&zi(e,!!i.multiple,t,!1)}}}var ic=!1;function Eh(e,t,i){if(ic)return e(t,i);ic=!0;try{var l=e(t);return l}finally{if(ic=!1,(Ui!==null||Bi!==null)&&(Vl(),Ui&&(t=Ui,e=Bi,Bi=Ui=null,Sh(t),e)))for(t=0;t<e.length;t++)Sh(e[t])}}function qr(e,t){var i=e.stateNode;if(i===null)return null;var l=i[it]||null;if(l===null)return null;i=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(a(231,t,typeof i));return i}var Jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rc=!1;if(Jn)try{var Ur={};Object.defineProperty(Ur,"passive",{get:function(){rc=!0}}),window.addEventListener("test",Ur,Ur),window.removeEventListener("test",Ur,Ur)}catch{rc=!1}var _s=null,ac=null,rl=null;function Ah(){if(rl)return rl;var e,t=ac,i=t.length,l,c="value"in _s?_s.value:_s.textContent,u=c.length;for(e=0;e<i&&t[e]===c[e];e++);var p=i-e;for(l=1;l<=p&&t[i-l]===c[u-l];l++);return rl=c.slice(e,1<l?1-l:void 0)}function al(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ll(){return!0}function Oh(){return!1}function zt(e){function t(i,l,c,u,p){this._reactName=i,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=p,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(i=e[b],this[b]=i?i(u):u[b]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?ll:Oh,this.isPropagationStopped=Oh,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=ll)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=ll)},persist:function(){},isPersistent:ll}),t}var oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ol=zt(oi),Br=w({},oi,{view:0,detail:0}),xy=zt(Br),lc,oc,Lr,cl=w({},Br,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:uc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Lr&&(Lr&&e.type==="mousemove"?(lc=e.screenX-Lr.screenX,oc=e.screenY-Lr.screenY):oc=lc=0,Lr=e),lc)},movementY:function(e){return"movementY"in e?e.movementY:oc}}),jh=zt(cl),vy=w({},cl,{dataTransfer:0}),_y=zt(vy),wy=w({},Br,{relatedTarget:0}),cc=zt(wy),Sy=w({},oi,{animationName:0,elapsedTime:0,pseudoElement:0}),Ey=zt(Sy),Ay=w({},oi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Oy=zt(Ay),jy=w({},oi,{data:0}),Th=zt(jy),Ty={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ny={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"},Cy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ky(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Cy[e])?!!t[e]:!1}function uc(){return ky}var My=w({},Br,{key:function(e){if(e.key){var t=Ty[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=al(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ny[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:uc,charCode:function(e){return e.type==="keypress"?al(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?al(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ry=zt(My),Dy=w({},cl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Nh=zt(Dy),zy=w({},Br,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:uc}),qy=zt(zy),Uy=w({},oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),By=zt(Uy),Ly=w({},cl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Hy=zt(Ly),Py=w({},oi,{newState:0,oldState:0}),$y=zt(Py),Yy=[9,13,27,32],fc=Jn&&"CompositionEvent"in window,Hr=null;Jn&&"documentMode"in document&&(Hr=document.documentMode);var Gy=Jn&&"TextEvent"in window&&!Hr,Ch=Jn&&(!fc||Hr&&8<Hr&&11>=Hr),kh=" ",Mh=!1;function Rh(e,t){switch(e){case"keyup":return Yy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Li=!1;function Vy(e,t){switch(e){case"compositionend":return Dh(t);case"keypress":return t.which!==32?null:(Mh=!0,kh);case"textInput":return e=t.data,e===kh&&Mh?null:e;default:return null}}function Fy(e,t){if(Li)return e==="compositionend"||!fc&&Rh(e,t)?(e=Ah(),rl=ac=_s=null,Li=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Ch&&t.locale!=="ko"?null:t.data;default:return null}}var Jy={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 zh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Jy[e.type]:t==="textarea"}function qh(e,t,i,l){Ui?Bi?Bi.push(l):Bi=[l]:Ui=l,t=Zl(t,"onChange"),0<t.length&&(i=new ol("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var Pr=null,$r=null;function Qy(e){bp(e,0)}function ul(e){var t=_(e);if(yh(t))return e}function Uh(e,t){if(e==="change")return t}var Bh=!1;if(Jn){var hc;if(Jn){var dc="oninput"in document;if(!dc){var Lh=document.createElement("div");Lh.setAttribute("oninput","return;"),dc=typeof Lh.oninput=="function"}hc=dc}else hc=!1;Bh=hc&&(!document.documentMode||9<document.documentMode)}function Hh(){Pr&&(Pr.detachEvent("onpropertychange",Ph),$r=Pr=null)}function Ph(e){if(e.propertyName==="value"&&ul($r)){var t=[];qh(t,$r,e,sc(e)),Eh(Qy,t)}}function Iy(e,t,i){e==="focusin"?(Hh(),Pr=t,$r=i,Pr.attachEvent("onpropertychange",Ph)):e==="focusout"&&Hh()}function Xy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ul($r)}function Ky(e,t){if(e==="click")return ul(t)}function Zy(e,t){if(e==="input"||e==="change")return ul(t)}function Wy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:Wy;function Yr(e,t){if(Gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var c=i[l];if(!Nr.call(t,c)||!Gt(e[c],t[c]))return!1}return!0}function $h(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Yh(e,t){var i=$h(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=t&&l>=t)return{node:i,offset:t-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=$h(i)}}function Gh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Gh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Vh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=sl(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=sl(e.document)}return t}function mc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var eb=Jn&&"documentMode"in document&&11>=document.documentMode,Hi=null,pc=null,Gr=null,gc=!1;function Fh(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;gc||Hi==null||Hi!==sl(l)||(l=Hi,"selectionStart"in l&&mc(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}),Gr&&Yr(Gr,l)||(Gr=l,l=Zl(pc,"onSelect"),0<l.length&&(t=new ol("onSelect","select",null,t,i),e.push({event:t,listeners:l}),t.target=Hi)))}function ci(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Pi={animationend:ci("Animation","AnimationEnd"),animationiteration:ci("Animation","AnimationIteration"),animationstart:ci("Animation","AnimationStart"),transitionrun:ci("Transition","TransitionRun"),transitionstart:ci("Transition","TransitionStart"),transitioncancel:ci("Transition","TransitionCancel"),transitionend:ci("Transition","TransitionEnd")},yc={},Jh={};Jn&&(Jh=document.createElement("div").style,"AnimationEvent"in window||(delete Pi.animationend.animation,delete Pi.animationiteration.animation,delete Pi.animationstart.animation),"TransitionEvent"in window||delete Pi.transitionend.transition);function ui(e){if(yc[e])return yc[e];if(!Pi[e])return e;var t=Pi[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Jh)return yc[e]=t[i];return e}var Qh=ui("animationend"),Ih=ui("animationiteration"),Xh=ui("animationstart"),tb=ui("transitionrun"),nb=ui("transitionstart"),sb=ui("transitioncancel"),Kh=ui("transitionend"),Zh=new Map,bc="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(" ");bc.push("scrollEnd");function An(e,t){Zh.set(e,t),Z(t,[e])}var fl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},un=[],$i=0,xc=0;function hl(){for(var e=$i,t=xc=$i=0;t<e;){var i=un[t];un[t++]=null;var l=un[t];un[t++]=null;var c=un[t];un[t++]=null;var u=un[t];if(un[t++]=null,l!==null&&c!==null){var p=l.pending;p===null?c.next=c:(c.next=p.next,p.next=c),l.pending=c}u!==0&&Wh(i,c,u)}}function dl(e,t,i,l){un[$i++]=e,un[$i++]=t,un[$i++]=i,un[$i++]=l,xc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function vc(e,t,i,l){return dl(e,t,i,l),ml(e)}function fi(e,t){return dl(e,null,null,t),ml(e)}function Wh(e,t,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var c=!1,u=e.return;u!==null;)u.childLanes|=i,l=u.alternate,l!==null&&(l.childLanes|=i),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-Nt(i),e=u.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=i|536870912),u):null}function ml(e){if(50<ha)throw ha=0,Nu=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Yi={};function ib(e,t,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(e,t,i,l){return new ib(e,t,i,l)}function _c(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qn(e,t){var i=e.alternate;return i===null?(i=Vt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function ed(e,t){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function pl(e,t,i,l,c,u){var p=0;if(l=e,typeof e=="function")_c(e)&&(p=1);else if(typeof e=="string")p=cx(e,i,lt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case G:return e=Vt(31,i,t,c),e.elementType=G,e.lanes=u,e;case D:return hi(i.children,c,u,t);case W:p=8,c|=24;break;case se:return e=Vt(12,i,t,c|2),e.elementType=se,e.lanes=u,e;case C:return e=Vt(13,i,t,c),e.elementType=C,e.lanes=u,e;case X:return e=Vt(19,i,t,c),e.elementType=X,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case me:p=10;break e;case ee:p=9;break e;case re:p=11;break e;case ce:p=14;break e;case V:p=16,l=null;break e}p=29,i=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Vt(p,i,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function hi(e,t,i,l){return e=Vt(7,e,l,t),e.lanes=i,e}function wc(e,t,i){return e=Vt(6,e,null,t),e.lanes=i,e}function td(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function Sc(e,t,i){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var nd=new WeakMap;function fn(e,t){if(typeof e=="object"&&e!==null){var i=nd.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Qa(t)},nd.set(e,t),t)}return{value:e,source:t,stack:Qa(t)}}var Gi=[],Vi=0,gl=null,Vr=0,hn=[],dn=0,ws=null,Rn=1,Dn="";function In(e,t){Gi[Vi++]=Vr,Gi[Vi++]=gl,gl=e,Vr=t}function sd(e,t,i){hn[dn++]=Rn,hn[dn++]=Dn,hn[dn++]=ws,ws=e;var l=Rn;e=Dn;var c=32-Nt(l)-1;l&=~(1<<c),i+=1;var u=32-Nt(t)+c;if(30<u){var p=c-c%5;u=(l&(1<<p)-1).toString(32),l>>=p,c-=p,Rn=1<<32-Nt(t)+c|i<<c|l,Dn=u+e}else Rn=1<<u|i<<c|l,Dn=e}function Ec(e){e.return!==null&&(In(e,1),sd(e,1,0))}function Ac(e){for(;e===gl;)gl=Gi[--Vi],Gi[Vi]=null,Vr=Gi[--Vi],Gi[Vi]=null;for(;e===ws;)ws=hn[--dn],hn[dn]=null,Dn=hn[--dn],hn[dn]=null,Rn=hn[--dn],hn[dn]=null}function id(e,t){hn[dn++]=Rn,hn[dn++]=Dn,hn[dn++]=ws,Rn=t.id,Dn=t.overflow,ws=e}var wt=null,Ze=null,ze=!1,Ss=null,mn=!1,Oc=Error(a(519));function Es(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Fr(fn(t,e)),Oc}function rd(e){var t=e.stateNode,i=e.type,l=e.memoizedProps;switch(t[Ie]=e,t[it]=l,i){case"dialog":Ce("cancel",t),Ce("close",t);break;case"iframe":case"object":case"embed":Ce("load",t);break;case"video":case"audio":for(i=0;i<ma.length;i++)Ce(ma[i],t);break;case"source":Ce("error",t);break;case"img":case"image":case"link":Ce("error",t),Ce("load",t);break;case"details":Ce("toggle",t);break;case"input":Ce("invalid",t),bh(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ce("invalid",t);break;case"textarea":Ce("invalid",t),vh(t,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||l.suppressHydrationWarning===!0||wp(t.textContent,i)?(l.popover!=null&&(Ce("beforetoggle",t),Ce("toggle",t)),l.onScroll!=null&&Ce("scroll",t),l.onScrollEnd!=null&&Ce("scrollend",t),l.onClick!=null&&(t.onclick=Fn),t=!0):t=!1,t||Es(e,!0)}function ad(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:mn=!1;return;case 27:case 3:mn=!0;return;default:wt=wt.return}}function Fi(e){if(e!==wt)return!1;if(!ze)return ad(e),ze=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Gu(e.type,e.memoizedProps)),i=!i),i&&Ze&&Es(e),ad(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=kp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=kp(e)}else t===27?(t=Ze,Bs(e.type)?(e=Iu,Iu=null,Ze=e):Ze=t):Ze=wt?gn(e.stateNode.nextSibling):null;return!0}function di(){Ze=wt=null,ze=!1}function jc(){var e=Ss;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),Ss=null),e}function Fr(e){Ss===null?Ss=[e]:Ss.push(e)}var Tc=je(null),mi=null,Xn=null;function As(e,t,i){Te(Tc,t._currentValue),t._currentValue=i}function Kn(e){e._currentValue=Tc.current,we(Tc)}function Nc(e,t,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===i)break;e=e.return}}function Cc(e,t,i,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var p=c.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=c;for(var O=0;O<t.length;O++)if(b.context===t[O]){u.lanes|=i,b=u.alternate,b!==null&&(b.lanes|=i),Nc(u.return,i,e),l||(p=null);break e}u=b.next}}else if(c.tag===18){if(p=c.return,p===null)throw Error(a(341));p.lanes|=i,u=p.alternate,u!==null&&(u.lanes|=i),Nc(p,i,e),p=null}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===e){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}}function Ji(e,t,i,l){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var p=c.alternate;if(p===null)throw Error(a(387));if(p=p.memoizedProps,p!==null){var b=c.type;Gt(c.pendingProps.value,p.value)||(e!==null?e.push(b):e=[b])}}else if(c===Ot.current){if(p=c.alternate,p===null)throw Error(a(387));p.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(xa):e=[xa])}c=c.return}e!==null&&Cc(t,e,i,l),t.flags|=262144}function yl(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function pi(e){mi=e,Xn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return ld(mi,e)}function bl(e,t){return mi===null&&pi(e),ld(e,t)}function ld(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Xn===null){if(e===null)throw Error(a(308));Xn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xn=Xn.next=t;return i}var rb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},ab=r.unstable_scheduleCallback,lb=r.unstable_NormalPriority,ht={$$typeof:me,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function kc(){return{controller:new rb,data:new Map,refCount:0}}function Jr(e){e.refCount--,e.refCount===0&&ab(lb,function(){e.controller.abort()})}var Qr=null,Mc=0,Qi=0,Ii=null;function ob(e,t){if(Qr===null){var i=Qr=[];Mc=0,Qi=zu(),Ii={status:"pending",value:void 0,then:function(l){i.push(l)}}}return Mc++,t.then(od,od),t}function od(){if(--Mc===0&&Qr!==null){Ii!==null&&(Ii.status="fulfilled");var e=Qr;Qr=null,Qi=0,Ii=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function cb(e,t){var i=[],l={status:"pending",value:null,reason:null,then:function(c){i.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<i.length;c++)(0,i[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<i.length;c++)(0,i[c])(void 0)}),l}var cd=$.S;$.S=function(e,t){Fm=et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ob(e,t),cd!==null&&cd(e,t)};var gi=je(null);function Rc(){var e=gi.current;return e!==null?e:Xe.pooledCache}function xl(e,t){t===null?Te(gi,gi.current):Te(gi,t.pool)}function ud(){var e=Rc();return e===null?null:{parent:ht._currentValue,pool:e}}var Xi=Error(a(460)),Dc=Error(a(474)),vl=Error(a(542)),_l={then:function(){}};function fd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function hd(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Fn,Fn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,md(e),e;default:if(typeof t.status=="string")t.then(Fn,Fn);else{if(e=Xe,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,md(e),e}throw bi=t,Xi}}function yi(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(bi=i,Xi):i}}var bi=null;function dd(){if(bi===null)throw Error(a(459));var e=bi;return bi=null,e}function md(e){if(e===Xi||e===vl)throw Error(a(483))}var Ki=null,Ir=0;function wl(e){var t=Ir;return Ir+=1,Ki===null&&(Ki=[]),hd(Ki,e,t)}function Xr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Sl(e,t){throw t.$$typeof===j?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function pd(e){function t(R,k){if(e){var U=R.deletions;U===null?(R.deletions=[k],R.flags|=16):U.push(k)}}function i(R,k){if(!e)return null;for(;k!==null;)t(R,k),k=k.sibling;return null}function l(R){for(var k=new Map;R!==null;)R.key!==null?k.set(R.key,R):k.set(R.index,R),R=R.sibling;return k}function c(R,k){return R=Qn(R,k),R.index=0,R.sibling=null,R}function u(R,k,U){return R.index=U,e?(U=R.alternate,U!==null?(U=U.index,U<k?(R.flags|=67108866,k):U):(R.flags|=67108866,k)):(R.flags|=1048576,k)}function p(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function b(R,k,U,F){return k===null||k.tag!==6?(k=wc(U,R.mode,F),k.return=R,k):(k=c(k,U),k.return=R,k)}function O(R,k,U,F){var ge=U.type;return ge===D?Y(R,k,U.props.children,F,U.key):k!==null&&(k.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&yi(ge)===k.type)?(k=c(k,U.props),Xr(k,U),k.return=R,k):(k=pl(U.type,U.key,U.props,null,R.mode,F),Xr(k,U),k.return=R,k)}function B(R,k,U,F){return k===null||k.tag!==4||k.stateNode.containerInfo!==U.containerInfo||k.stateNode.implementation!==U.implementation?(k=Sc(U,R.mode,F),k.return=R,k):(k=c(k,U.children||[]),k.return=R,k)}function Y(R,k,U,F,ge){return k===null||k.tag!==7?(k=hi(U,R.mode,F,ge),k.return=R,k):(k=c(k,U),k.return=R,k)}function I(R,k,U){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return k=wc(""+k,R.mode,U),k.return=R,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case q:return U=pl(k.type,k.key,k.props,null,R.mode,U),Xr(U,k),U.return=R,U;case M:return k=Sc(k,R.mode,U),k.return=R,k;case V:return k=yi(k),I(R,k,U)}if(Me(k)||ne(k))return k=hi(k,R.mode,U,null),k.return=R,k;if(typeof k.then=="function")return I(R,wl(k),U);if(k.$$typeof===me)return I(R,bl(R,k),U);Sl(R,k)}return null}function L(R,k,U,F){var ge=k!==null?k.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return ge!==null?null:b(R,k,""+U,F);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case q:return U.key===ge?O(R,k,U,F):null;case M:return U.key===ge?B(R,k,U,F):null;case V:return U=yi(U),L(R,k,U,F)}if(Me(U)||ne(U))return ge!==null?null:Y(R,k,U,F,null);if(typeof U.then=="function")return L(R,k,wl(U),F);if(U.$$typeof===me)return L(R,k,bl(R,U),F);Sl(R,U)}return null}function P(R,k,U,F,ge){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return R=R.get(U)||null,b(k,R,""+F,ge);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case q:return R=R.get(F.key===null?U:F.key)||null,O(k,R,F,ge);case M:return R=R.get(F.key===null?U:F.key)||null,B(k,R,F,ge);case V:return F=yi(F),P(R,k,U,F,ge)}if(Me(F)||ne(F))return R=R.get(U)||null,Y(k,R,F,ge,null);if(typeof F.then=="function")return P(R,k,U,wl(F),ge);if(F.$$typeof===me)return P(R,k,U,bl(k,F),ge);Sl(k,F)}return null}function he(R,k,U,F){for(var ge=null,Be=null,pe=k,Ae=k=0,De=null;pe!==null&&Ae<U.length;Ae++){pe.index>Ae?(De=pe,pe=null):De=pe.sibling;var Le=L(R,pe,U[Ae],F);if(Le===null){pe===null&&(pe=De);break}e&&pe&&Le.alternate===null&&t(R,pe),k=u(Le,k,Ae),Be===null?ge=Le:Be.sibling=Le,Be=Le,pe=De}if(Ae===U.length)return i(R,pe),ze&&In(R,Ae),ge;if(pe===null){for(;Ae<U.length;Ae++)pe=I(R,U[Ae],F),pe!==null&&(k=u(pe,k,Ae),Be===null?ge=pe:Be.sibling=pe,Be=pe);return ze&&In(R,Ae),ge}for(pe=l(pe);Ae<U.length;Ae++)De=P(pe,R,Ae,U[Ae],F),De!==null&&(e&&De.alternate!==null&&pe.delete(De.key===null?Ae:De.key),k=u(De,k,Ae),Be===null?ge=De:Be.sibling=De,Be=De);return e&&pe.forEach(function(Ys){return t(R,Ys)}),ze&&In(R,Ae),ge}function ye(R,k,U,F){if(U==null)throw Error(a(151));for(var ge=null,Be=null,pe=k,Ae=k=0,De=null,Le=U.next();pe!==null&&!Le.done;Ae++,Le=U.next()){pe.index>Ae?(De=pe,pe=null):De=pe.sibling;var Ys=L(R,pe,Le.value,F);if(Ys===null){pe===null&&(pe=De);break}e&&pe&&Ys.alternate===null&&t(R,pe),k=u(Ys,k,Ae),Be===null?ge=Ys:Be.sibling=Ys,Be=Ys,pe=De}if(Le.done)return i(R,pe),ze&&In(R,Ae),ge;if(pe===null){for(;!Le.done;Ae++,Le=U.next())Le=I(R,Le.value,F),Le!==null&&(k=u(Le,k,Ae),Be===null?ge=Le:Be.sibling=Le,Be=Le);return ze&&In(R,Ae),ge}for(pe=l(pe);!Le.done;Ae++,Le=U.next())Le=P(pe,R,Ae,Le.value,F),Le!==null&&(e&&Le.alternate!==null&&pe.delete(Le.key===null?Ae:Le.key),k=u(Le,k,Ae),Be===null?ge=Le:Be.sibling=Le,Be=Le);return e&&pe.forEach(function(vx){return t(R,vx)}),ze&&In(R,Ae),ge}function Qe(R,k,U,F){if(typeof U=="object"&&U!==null&&U.type===D&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case q:e:{for(var ge=U.key;k!==null;){if(k.key===ge){if(ge=U.type,ge===D){if(k.tag===7){i(R,k.sibling),F=c(k,U.props.children),F.return=R,R=F;break e}}else if(k.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&yi(ge)===k.type){i(R,k.sibling),F=c(k,U.props),Xr(F,U),F.return=R,R=F;break e}i(R,k);break}else t(R,k);k=k.sibling}U.type===D?(F=hi(U.props.children,R.mode,F,U.key),F.return=R,R=F):(F=pl(U.type,U.key,U.props,null,R.mode,F),Xr(F,U),F.return=R,R=F)}return p(R);case M:e:{for(ge=U.key;k!==null;){if(k.key===ge)if(k.tag===4&&k.stateNode.containerInfo===U.containerInfo&&k.stateNode.implementation===U.implementation){i(R,k.sibling),F=c(k,U.children||[]),F.return=R,R=F;break e}else{i(R,k);break}else t(R,k);k=k.sibling}F=Sc(U,R.mode,F),F.return=R,R=F}return p(R);case V:return U=yi(U),Qe(R,k,U,F)}if(Me(U))return he(R,k,U,F);if(ne(U)){if(ge=ne(U),typeof ge!="function")throw Error(a(150));return U=ge.call(U),ye(R,k,U,F)}if(typeof U.then=="function")return Qe(R,k,wl(U),F);if(U.$$typeof===me)return Qe(R,k,bl(R,U),F);Sl(R,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,k!==null&&k.tag===6?(i(R,k.sibling),F=c(k,U),F.return=R,R=F):(i(R,k),F=wc(U,R.mode,F),F.return=R,R=F),p(R)):i(R,k)}return function(R,k,U,F){try{Ir=0;var ge=Qe(R,k,U,F);return Ki=null,ge}catch(pe){if(pe===Xi||pe===vl)throw pe;var Be=Vt(29,pe,null,R.mode);return Be.lanes=F,Be.return=R,Be}finally{}}}var xi=pd(!0),gd=pd(!1),Os=!1;function zc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function js(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ts(e,t,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Pe&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=ml(e),Wh(e,null,i),t}return dl(e,l,t,i),ml(e)}function Kr(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}function Uc(e,t){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var c=null,u=null;if(i=i.firstBaseUpdate,i!==null){do{var p={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};u===null?c=u=p:u=u.next=p,i=i.next}while(i!==null);u===null?c=u=t:u=u.next=t}else c=u=t;i={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var Bc=!1;function Zr(){if(Bc){var e=Ii;if(e!==null)throw e}}function Wr(e,t,i,l){Bc=!1;var c=e.updateQueue;Os=!1;var u=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var O=b,B=O.next;O.next=null,p===null?u=B:p.next=B,p=O;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,b=Y.lastBaseUpdate,b!==p&&(b===null?Y.firstBaseUpdate=B:b.next=B,Y.lastBaseUpdate=O))}if(u!==null){var I=c.baseState;p=0,Y=B=O=null,b=u;do{var L=b.lane&-536870913,P=L!==b.lane;if(P?(Re&L)===L:(l&L)===L){L!==0&&L===Qi&&(Bc=!0),Y!==null&&(Y=Y.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var he=e,ye=b;L=t;var Qe=i;switch(ye.tag){case 1:if(he=ye.payload,typeof he=="function"){I=he.call(Qe,I,L);break e}I=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ye.payload,L=typeof he=="function"?he.call(Qe,I,L):he,L==null)break e;I=w({},I,L);break e;case 2:Os=!0}}L=b.callback,L!==null&&(e.flags|=64,P&&(e.flags|=8192),P=c.callbacks,P===null?c.callbacks=[L]:P.push(L))}else P={lane:L,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Y===null?(B=Y=P,O=I):Y=Y.next=P,p|=L;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;P=b,b=P.next,P.next=null,c.lastBaseUpdate=P,c.shared.pending=null}}while(!0);Y===null&&(O=I),c.baseState=O,c.firstBaseUpdate=B,c.lastBaseUpdate=Y,u===null&&(c.shared.lanes=0),Rs|=p,e.lanes=p,e.memoizedState=I}}function yd(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function bd(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)yd(i[e],t)}var Zi=je(null),El=je(0);function xd(e,t){e=as,Te(El,e),Te(Zi,t),as=e|t.baseLanes}function Lc(){Te(El,as),Te(Zi,Zi.current)}function Hc(){as=El.current,we(Zi),we(El)}var Ft=je(null),pn=null;function Ns(e){var t=e.alternate;Te(ct,ct.current&1),Te(Ft,e),pn===null&&(t===null||Zi.current!==null||t.memoizedState!==null)&&(pn=e)}function Pc(e){Te(ct,ct.current),Te(Ft,e),pn===null&&(pn=e)}function vd(e){e.tag===22?(Te(ct,ct.current),Te(Ft,e),pn===null&&(pn=e)):Cs()}function Cs(){Te(ct,ct.current),Te(Ft,Ft.current)}function Jt(e){we(Ft),pn===e&&(pn=null),we(ct)}var ct=je(0);function Al(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Ju(i)||Qu(i)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Zn=0,Ee=null,Fe=null,dt=null,Ol=!1,Wi=!1,vi=!1,jl=0,ea=0,er=null,ub=0;function rt(){throw Error(a(321))}function $c(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Gt(e[i],t[i]))return!1;return!0}function Yc(e,t,i,l,c,u){return Zn=u,Ee=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?sm:iu,vi=!1,u=i(l,c),vi=!1,Wi&&(u=wd(t,i,l,c)),_d(e),u}function _d(e){$.H=sa;var t=Fe!==null&&Fe.next!==null;if(Zn=0,dt=Fe=Ee=null,Ol=!1,ea=0,er=null,t)throw Error(a(300));e===null||mt||(e=e.dependencies,e!==null&&yl(e)&&(mt=!0))}function wd(e,t,i,l){Ee=e;var c=0;do{if(Wi&&(er=null),ea=0,Wi=!1,25<=c)throw Error(a(301));if(c+=1,dt=Fe=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}$.H=im,u=t(i,l)}while(Wi);return u}function fb(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?ta(t):t,e=e.useState()[0],(Fe!==null?Fe.memoizedState:null)!==e&&(Ee.flags|=1024),t}function Gc(){var e=jl!==0;return jl=0,e}function Vc(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Fc(e){if(Ol){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ol=!1}Zn=0,dt=Fe=Ee=null,Wi=!1,ea=jl=0,er=null}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Ee.memoizedState=dt=e:dt=dt.next=e,dt}function ut(){if(Fe===null){var e=Ee.alternate;e=e!==null?e.memoizedState:null}else e=Fe.next;var t=dt===null?Ee.memoizedState:dt.next;if(t!==null)dt=t,Fe=e;else{if(e===null)throw Ee.alternate===null?Error(a(467)):Error(a(310));Fe=e,e={memoizedState:Fe.memoizedState,baseState:Fe.baseState,baseQueue:Fe.baseQueue,queue:Fe.queue,next:null},dt===null?Ee.memoizedState=dt=e:dt=dt.next=e}return dt}function Tl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ta(e){var t=ea;return ea+=1,er===null&&(er=[]),e=hd(er,e,t),t=Ee,(dt===null?t.memoizedState:dt.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?sm:iu),e}function Nl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ta(e);if(e.$$typeof===me)return St(e)}throw Error(a(438,String(e)))}function Jc(e){var t=null,i=Ee.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var l=Ee.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=Tl(),Ee.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),l=0;l<e;l++)i[l]=K;return t.index++,i}function Wn(e,t){return typeof t=="function"?t(e):t}function Cl(e){var t=ut();return Qc(t,Fe,e)}function Qc(e,t,i){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=i;var c=e.baseQueue,u=l.pending;if(u!==null){if(c!==null){var p=c.next;c.next=u.next,u.next=p}t.baseQueue=c=u,l.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var b=p=null,O=null,B=t,Y=!1;do{var I=B.lane&-536870913;if(I!==B.lane?(Re&I)===I:(Zn&I)===I){var L=B.revertLane;if(L===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),I===Qi&&(Y=!0);else if((Zn&L)===L){B=B.next,L===Qi&&(Y=!0);continue}else I={lane:0,revertLane:B.revertLane,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},O===null?(b=O=I,p=u):O=O.next=I,Ee.lanes|=L,Rs|=L;I=B.action,vi&&i(u,I),u=B.hasEagerState?B.eagerState:i(u,I)}else L={lane:I,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},O===null?(b=O=L,p=u):O=O.next=L,Ee.lanes|=I,Rs|=I;B=B.next}while(B!==null&&B!==t);if(O===null?p=u:O.next=b,!Gt(u,e.memoizedState)&&(mt=!0,Y&&(i=Ii,i!==null)))throw i;e.memoizedState=u,e.baseState=p,e.baseQueue=O,l.lastRenderedState=u}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Ic(e){var t=ut(),i=t.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=e;var l=i.dispatch,c=i.pending,u=t.memoizedState;if(c!==null){i.pending=null;var p=c=c.next;do u=e(u,p.action),p=p.next;while(p!==c);Gt(u,t.memoizedState)||(mt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),i.lastRenderedState=u}return[u,l]}function Sd(e,t,i){var l=Ee,c=ut(),u=ze;if(u){if(i===void 0)throw Error(a(407));i=i()}else i=t();var p=!Gt((Fe||c).memoizedState,i);if(p&&(c.memoizedState=i,mt=!0),c=c.queue,Zc(Od.bind(null,l,c,e),[e]),c.getSnapshot!==t||p||dt!==null&&dt.memoizedState.tag&1){if(l.flags|=2048,tr(9,{destroy:void 0},Ad.bind(null,l,c,i,t),null),Xe===null)throw Error(a(349));u||(Zn&127)!==0||Ed(l,t,i)}return i}function Ed(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Ee.updateQueue,t===null?(t=Tl(),Ee.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function Ad(e,t,i,l){t.value=i,t.getSnapshot=l,jd(t)&&Td(e)}function Od(e,t,i){return i(function(){jd(t)&&Td(e)})}function jd(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Gt(e,i)}catch{return!0}}function Td(e){var t=fi(e,2);t!==null&&Ht(t,e,2)}function Xc(e){var t=kt();if(typeof e=="function"){var i=e;if(e=i(),vi){$t(!0);try{i()}finally{$t(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:e},t}function Nd(e,t,i,l){return e.baseState=i,Qc(e,Fe,typeof l=="function"?l:Wn)}function hb(e,t,i,l,c){if(Rl(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){u.listeners.push(p)}};$.T!==null?i(!0):u.isTransition=!1,l(u),i=t.pending,i===null?(u.next=t.pending=u,Cd(t,u)):(u.next=i.next,t.pending=i.next=u)}}function Cd(e,t){var i=t.action,l=t.payload,c=e.state;if(t.isTransition){var u=$.T,p={};$.T=p;try{var b=i(c,l),O=$.S;O!==null&&O(p,b),kd(e,t,b)}catch(B){Kc(e,t,B)}finally{u!==null&&p.types!==null&&(u.types=p.types),$.T=u}}else try{u=i(c,l),kd(e,t,u)}catch(B){Kc(e,t,B)}}function kd(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){Md(e,t,l)},function(l){return Kc(e,t,l)}):Md(e,t,i)}function Md(e,t,i){t.status="fulfilled",t.value=i,Rd(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,Cd(e,i)))}function Kc(e,t,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=i,Rd(t),t=t.next;while(t!==l)}e.action=null}function Rd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Dd(e,t){return t}function zd(e,t){if(ze){var i=Xe.formState;if(i!==null){e:{var l=Ee;if(ze){if(Ze){t:{for(var c=Ze,u=mn;c.nodeType!==8;){if(!u){c=null;break t}if(c=gn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Ze=gn(c.nextSibling),l=c.data==="F!";break e}}Es(l)}l=!1}l&&(t=i[0])}}return i=kt(),i.memoizedState=i.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dd,lastRenderedState:t},i.queue=l,i=em.bind(null,Ee,l),l.dispatch=i,l=Xc(!1),u=su.bind(null,Ee,!1,l.queue),l=kt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,i=hb.bind(null,Ee,c,u,i),c.dispatch=i,l.memoizedState=e,[t,i,!1]}function qd(e){var t=ut();return Ud(t,Fe,e)}function Ud(e,t,i){if(t=Qc(e,t,Dd)[0],e=Cl(Wn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=ta(t)}catch(p){throw p===Xi?vl:p}else l=t;t=ut();var c=t.queue,u=c.dispatch;return i!==t.memoizedState&&(Ee.flags|=2048,tr(9,{destroy:void 0},db.bind(null,c,i),null)),[l,u,e]}function db(e,t){e.action=t}function Bd(e){var t=ut(),i=Fe;if(i!==null)return Ud(t,i,e);ut(),t=t.memoizedState,i=ut();var l=i.queue.dispatch;return i.memoizedState=e,[t,l,!1]}function tr(e,t,i,l){return e={tag:e,create:i,deps:l,inst:t,next:null},t=Ee.updateQueue,t===null&&(t=Tl(),Ee.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,t.lastEffect=e),e}function Ld(){return ut().memoizedState}function kl(e,t,i,l){var c=kt();Ee.flags|=e,c.memoizedState=tr(1|t,{destroy:void 0},i,l===void 0?null:l)}function Ml(e,t,i,l){var c=ut();l=l===void 0?null:l;var u=c.memoizedState.inst;Fe!==null&&l!==null&&$c(l,Fe.memoizedState.deps)?c.memoizedState=tr(t,u,i,l):(Ee.flags|=e,c.memoizedState=tr(1|t,u,i,l))}function Hd(e,t){kl(8390656,8,e,t)}function Zc(e,t){Ml(2048,8,e,t)}function mb(e){Ee.flags|=4;var t=Ee.updateQueue;if(t===null)t=Tl(),Ee.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Pd(e){var t=ut().memoizedState;return mb({ref:t,nextImpl:e}),function(){if((Pe&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function $d(e,t){return Ml(4,2,e,t)}function Yd(e,t){return Ml(4,4,e,t)}function Gd(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Vd(e,t,i){i=i!=null?i.concat([e]):null,Ml(4,4,Gd.bind(null,t,e),i)}function Wc(){}function Fd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;return t!==null&&$c(t,l[1])?l[0]:(i.memoizedState=[e,t],e)}function Jd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;if(t!==null&&$c(t,l[1]))return l[0];if(l=e(),vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l}function eu(e,t,i){return i===void 0||(Zn&1073741824)!==0&&(Re&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Qm(),Ee.lanes|=e,Rs|=e,i)}function Qd(e,t,i,l){return Gt(i,t)?i:Zi.current!==null?(e=eu(e,i,l),Gt(e,t)||(mt=!0),e):(Zn&42)===0||(Zn&1073741824)!==0&&(Re&261930)===0?(mt=!0,e.memoizedState=i):(e=Qm(),Ee.lanes|=e,Rs|=e,t)}function Id(e,t,i,l,c){var u=te.p;te.p=u!==0&&8>u?u:8;var p=$.T,b={};$.T=b,su(e,!1,t,i);try{var O=c(),B=$.S;if(B!==null&&B(b,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var Y=cb(O,l);na(e,t,Y,Xt(e))}else na(e,t,l,Xt(e))}catch(I){na(e,t,{then:function(){},status:"rejected",reason:I},Xt())}finally{te.p=u,p!==null&&b.types!==null&&(p.types=b.types),$.T=p}}function pb(){}function tu(e,t,i,l){if(e.tag!==5)throw Error(a(476));var c=Xd(e).queue;Id(e,c,t,de,i===null?pb:function(){return Kd(e),i(l)})}function Xd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:de},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Kd(e){var t=Xd(e);t.next===null&&(t=e.alternate.memoizedState),na(e,t.next.queue,{},Xt())}function nu(){return St(xa)}function Zd(){return ut().memoizedState}function Wd(){return ut().memoizedState}function gb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Xt();e=js(i);var l=Ts(t,e,i);l!==null&&(Ht(l,t,i),Kr(l,t,i)),t={cache:kc()},e.payload=t;return}t=t.return}}function yb(e,t,i){var l=Xt();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Rl(e)?tm(t,i):(i=vc(e,t,i,l),i!==null&&(Ht(i,e,l),nm(i,t,l)))}function em(e,t,i){var l=Xt();na(e,t,i,l)}function na(e,t,i,l){var c={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Rl(e))tm(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,b=u(p,i);if(c.hasEagerState=!0,c.eagerState=b,Gt(b,p))return dl(e,t,c,0),Xe===null&&hl(),!1}catch{}finally{}if(i=vc(e,t,c,l),i!==null)return Ht(i,e,l),nm(i,t,l),!0}return!1}function su(e,t,i,l){if(l={lane:2,revertLane:zu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Rl(e)){if(t)throw Error(a(479))}else t=vc(e,i,l,2),t!==null&&Ht(t,e,2)}function Rl(e){var t=e.alternate;return e===Ee||t!==null&&t===Ee}function tm(e,t){Wi=Ol=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function nm(e,t,i){if((i&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}var sa={readContext:St,use:Nl,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};sa.useEffectEvent=rt;var sm={readContext:St,use:Nl,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Hd,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,kl(4194308,4,Gd.bind(null,t,e),i)},useLayoutEffect:function(e,t){return kl(4194308,4,e,t)},useInsertionEffect:function(e,t){kl(4,2,e,t)},useMemo:function(e,t){var i=kt();t=t===void 0?null:t;var l=e();if(vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l},useReducer:function(e,t,i){var l=kt();if(i!==void 0){var c=i(t);if(vi){$t(!0);try{i(t)}finally{$t(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=yb.bind(null,Ee,e),[l.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Xc(e);var t=e.queue,i=em.bind(null,Ee,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Wc,useDeferredValue:function(e,t){var i=kt();return eu(i,e,t)},useTransition:function(){var e=Xc(!1);return e=Id.bind(null,Ee,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var l=Ee,c=kt();if(ze){if(i===void 0)throw Error(a(407));i=i()}else{if(i=t(),Xe===null)throw Error(a(349));(Re&127)!==0||Ed(l,t,i)}c.memoizedState=i;var u={value:i,getSnapshot:t};return c.queue=u,Hd(Od.bind(null,l,u,e),[e]),l.flags|=2048,tr(9,{destroy:void 0},Ad.bind(null,l,u,i,t),null),i},useId:function(){var e=kt(),t=Xe.identifierPrefix;if(ze){var i=Dn,l=Rn;i=(l&~(1<<32-Nt(l)-1)).toString(32)+i,t="_"+t+"R_"+i,i=jl++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=ub++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:nu,useFormState:zd,useActionState:zd,useOptimistic:function(e){var t=kt();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=su.bind(null,Ee,!0,i),i.dispatch=t,[e,t]},useMemoCache:Jc,useCacheRefresh:function(){return kt().memoizedState=gb.bind(null,Ee)},useEffectEvent:function(e){var t=kt(),i={impl:e};return t.memoizedState=i,function(){if((Pe&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},iu={readContext:St,use:Nl,useCallback:Fd,useContext:St,useEffect:Zc,useImperativeHandle:Vd,useInsertionEffect:$d,useLayoutEffect:Yd,useMemo:Jd,useReducer:Cl,useRef:Ld,useState:function(){return Cl(Wn)},useDebugValue:Wc,useDeferredValue:function(e,t){var i=ut();return Qd(i,Fe.memoizedState,e,t)},useTransition:function(){var e=Cl(Wn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ta(e),t]},useSyncExternalStore:Sd,useId:Zd,useHostTransitionStatus:nu,useFormState:qd,useActionState:qd,useOptimistic:function(e,t){var i=ut();return Nd(i,Fe,e,t)},useMemoCache:Jc,useCacheRefresh:Wd};iu.useEffectEvent=Pd;var im={readContext:St,use:Nl,useCallback:Fd,useContext:St,useEffect:Zc,useImperativeHandle:Vd,useInsertionEffect:$d,useLayoutEffect:Yd,useMemo:Jd,useReducer:Ic,useRef:Ld,useState:function(){return Ic(Wn)},useDebugValue:Wc,useDeferredValue:function(e,t){var i=ut();return Fe===null?eu(i,e,t):Qd(i,Fe.memoizedState,e,t)},useTransition:function(){var e=Ic(Wn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ta(e),t]},useSyncExternalStore:Sd,useId:Zd,useHostTransitionStatus:nu,useFormState:Bd,useActionState:Bd,useOptimistic:function(e,t){var i=ut();return Fe!==null?Nd(i,Fe,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Jc,useCacheRefresh:Wd};im.useEffectEvent=Pd;function ru(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:w({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var au={enqueueSetState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=js(l);c.payload=t,i!=null&&(c.callback=i),t=Ts(e,c,l),t!==null&&(Ht(t,e,l),Kr(t,e,l))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=js(l);c.tag=1,c.payload=t,i!=null&&(c.callback=i),t=Ts(e,c,l),t!==null&&(Ht(t,e,l),Kr(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Xt(),l=js(i);l.tag=2,t!=null&&(l.callback=t),t=Ts(e,l,i),t!==null&&(Ht(t,e,i),Kr(t,e,i))}};function rm(e,t,i,l,c,u,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,p):t.prototype&&t.prototype.isPureReactComponent?!Yr(i,l)||!Yr(c,u):!0}function am(e,t,i,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,l),t.state!==e&&au.enqueueReplaceState(t,t.state,null)}function _i(e,t){var i=t;if("ref"in t){i={};for(var l in t)l!=="ref"&&(i[l]=t[l])}if(e=e.defaultProps){i===t&&(i=w({},i));for(var c in e)i[c]===void 0&&(i[c]=e[c])}return i}function lm(e){fl(e)}function om(e){console.error(e)}function cm(e){fl(e)}function Dl(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function um(e,t,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function lu(e,t,i){return i=js(i),i.tag=3,i.payload={element:null},i.callback=function(){Dl(e,t)},i}function fm(e){return e=js(e),e.tag=3,e}function hm(e,t,i,l){var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var u=l.value;e.payload=function(){return c(u)},e.callback=function(){um(t,i,l)}}var p=i.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){um(t,i,l),typeof c!="function"&&(Ds===null?Ds=new Set([this]):Ds.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function bb(e,t,i,l,c){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=i.alternate,t!==null&&Ji(t,i,c,!0),i=Ft.current,i!==null){switch(i.tag){case 31:case 13:return pn===null?Fl():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=c,l===_l?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([l]):t.add(l),Mu(e,l,c)),!1;case 22:return i.flags|=65536,l===_l?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([l]):i.add(l)),Mu(e,l,c)),!1}throw Error(a(435,i.tag))}return Mu(e,l,c),Fl(),!1}if(ze)return t=Ft.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==Oc&&(e=Error(a(422),{cause:l}),Fr(fn(e,i)))):(l!==Oc&&(t=Error(a(423),{cause:l}),Fr(fn(t,i))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=fn(l,i),c=lu(e.stateNode,l,c),Uc(e,c),at!==4&&(at=2)),!1;var u=Error(a(520),{cause:l});if(u=fn(u,i),fa===null?fa=[u]:fa.push(u),at!==4&&(at=2),t===null)return!0;l=fn(l,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=c&-c,i.lanes|=e,e=lu(i.stateNode,l,e),Uc(i,e),!1;case 1:if(t=i.type,u=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Ds===null||!Ds.has(u))))return i.flags|=65536,c&=-c,i.lanes|=c,c=fm(c),hm(c,e,i,l),Uc(i,c),!1}i=i.return}while(i!==null);return!1}var ou=Error(a(461)),mt=!1;function Et(e,t,i,l){t.child=e===null?gd(t,null,i,l):xi(t,e.child,i,l)}function dm(e,t,i,l,c){i=i.render;var u=t.ref;if("ref"in l){var p={};for(var b in l)b!=="ref"&&(p[b]=l[b])}else p=l;return pi(t),l=Yc(e,t,i,p,u,c),b=Gc(),e!==null&&!mt?(Vc(e,t,c),es(e,t,c)):(ze&&b&&Ec(t),t.flags|=1,Et(e,t,l,c),t.child)}function mm(e,t,i,l,c){if(e===null){var u=i.type;return typeof u=="function"&&!_c(u)&&u.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=u,pm(e,t,u,l,c)):(e=pl(i.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!gu(e,c)){var p=u.memoizedProps;if(i=i.compare,i=i!==null?i:Yr,i(p,l)&&e.ref===t.ref)return es(e,t,c)}return t.flags|=1,e=Qn(u,l),e.ref=t.ref,e.return=t,t.child=e}function pm(e,t,i,l,c){if(e!==null){var u=e.memoizedProps;if(Yr(u,l)&&e.ref===t.ref)if(mt=!1,t.pendingProps=l=u,gu(e,c))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,es(e,t,c)}return cu(e,t,i,l,c)}function gm(e,t,i,l){var c=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|i:i,e!==null){for(l=t.child=e.child,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~u}else l=0,t.child=null;return ym(e,t,u,i,l)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&xl(t,u!==null?u.cachePool:null),u!==null?xd(t,u):Lc(),vd(t);else return l=t.lanes=536870912,ym(e,t,u!==null?u.baseLanes|i:i,i,l)}else u!==null?(xl(t,u.cachePool),xd(t,u),Cs(),t.memoizedState=null):(e!==null&&xl(t,null),Lc(),Cs());return Et(e,t,c,i),t.child}function ia(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ym(e,t,i,l,c){var u=Rc();return u=u===null?null:{parent:ht._currentValue,pool:u},t.memoizedState={baseLanes:i,cachePool:u},e!==null&&xl(t,null),Lc(),vd(t),e!==null&&Ji(e,t,l,!0),t.childLanes=c,null}function zl(e,t){return t=Ul({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function bm(e,t,i){return xi(t,e.child,null,i),e=zl(t,t.pendingProps),e.flags|=2,Jt(t),t.memoizedState=null,e}function xb(e,t,i){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ze){if(l.mode==="hidden")return e=zl(t,l),t.lanes=536870912,ia(null,e);if(Pc(t),(e=Ze)?(e=Cp(e,mn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ws!==null?{id:Rn,overflow:Dn}:null,retryLane:536870912,hydrationErrors:null},i=td(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Es(t);return t.lanes=536870912,null}return zl(t,l)}var u=e.memoizedState;if(u!==null){var p=u.dehydrated;if(Pc(t),c)if(t.flags&256)t.flags&=-257,t=bm(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(mt||Ji(e,t,i,!1),c=(i&e.childLanes)!==0,mt||c){if(l=Xe,l!==null&&(p=vs(l,i),p!==0&&p!==u.retryLane))throw u.retryLane=p,fi(e,p),Ht(l,e,p),ou;Fl(),t=bm(e,t,i)}else e=u.treeContext,Ze=gn(p.nextSibling),wt=t,ze=!0,Ss=null,mn=!1,e!==null&&id(t,e),t=zl(t,l),t.flags|=4096;return t}return e=Qn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ql(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(a(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function cu(e,t,i,l,c){return pi(t),i=Yc(e,t,i,l,void 0,c),l=Gc(),e!==null&&!mt?(Vc(e,t,c),es(e,t,c)):(ze&&l&&Ec(t),t.flags|=1,Et(e,t,i,c),t.child)}function xm(e,t,i,l,c,u){return pi(t),t.updateQueue=null,i=wd(t,l,i,c),_d(e),l=Gc(),e!==null&&!mt?(Vc(e,t,u),es(e,t,u)):(ze&&l&&Ec(t),t.flags|=1,Et(e,t,i,u),t.child)}function vm(e,t,i,l,c){if(pi(t),t.stateNode===null){var u=Yi,p=i.contextType;typeof p=="object"&&p!==null&&(u=St(p)),u=new i(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=au,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},zc(t),p=i.contextType,u.context=typeof p=="object"&&p!==null?St(p):Yi,u.state=t.memoizedState,p=i.getDerivedStateFromProps,typeof p=="function"&&(ru(t,i,p,l),u.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(p=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),p!==u.state&&au.enqueueReplaceState(u,u.state,null),Wr(t,l,u,c),Zr(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,O=_i(i,b);u.props=O;var B=u.context,Y=i.contextType;p=Yi,typeof Y=="object"&&Y!==null&&(p=St(Y));var I=i.getDerivedStateFromProps;Y=typeof I=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,Y||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||B!==p)&&am(t,u,l,p),Os=!1;var L=t.memoizedState;u.state=L,Wr(t,l,u,c),Zr(),B=t.memoizedState,b||L!==B||Os?(typeof I=="function"&&(ru(t,i,I,l),B=t.memoizedState),(O=Os||rm(t,i,O,l,L,B,p))?(Y||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=B),u.props=l,u.state=B,u.context=p,l=O):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,qc(e,t),p=t.memoizedProps,Y=_i(i,p),u.props=Y,I=t.pendingProps,L=u.context,B=i.contextType,O=Yi,typeof B=="object"&&B!==null&&(O=St(B)),b=i.getDerivedStateFromProps,(B=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(p!==I||L!==O)&&am(t,u,l,O),Os=!1,L=t.memoizedState,u.state=L,Wr(t,l,u,c),Zr();var P=t.memoizedState;p!==I||L!==P||Os||e!==null&&e.dependencies!==null&&yl(e.dependencies)?(typeof b=="function"&&(ru(t,i,b,l),P=t.memoizedState),(Y=Os||rm(t,i,Y,l,L,P,O)||e!==null&&e.dependencies!==null&&yl(e.dependencies))?(B||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,P,O),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,P,O)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),u.props=l,u.state=P,u.context=O,l=Y):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,ql(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=xi(t,e.child,null,c),t.child=xi(t,null,i,c)):Et(e,t,i,c),t.memoizedState=u.state,e=t.child):e=es(e,t,c),e}function _m(e,t,i,l){return di(),t.flags|=256,Et(e,t,i,l),t.child}var uu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fu(e){return{baseLanes:e,cachePool:ud()}}function hu(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=It),e}function wm(e,t,i){var l=t.pendingProps,c=!1,u=(t.flags&128)!==0,p;if((p=u)||(p=e!==null&&e.memoizedState===null?!1:(ct.current&2)!==0),p&&(c=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(ze){if(c?Ns(t):Cs(),(e=Ze)?(e=Cp(e,mn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ws!==null?{id:Rn,overflow:Dn}:null,retryLane:536870912,hydrationErrors:null},i=td(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Es(t);return Qu(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,c?(Cs(),c=t.mode,b=Ul({mode:"hidden",children:b},c),l=hi(l,c,i,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=fu(i),l.childLanes=hu(e,p,i),t.memoizedState=uu,ia(null,l)):(Ns(t),du(t,b))}var O=e.memoizedState;if(O!==null&&(b=O.dehydrated,b!==null)){if(u)t.flags&256?(Ns(t),t.flags&=-257,t=mu(e,t,i)):t.memoizedState!==null?(Cs(),t.child=e.child,t.flags|=128,t=null):(Cs(),b=l.fallback,c=t.mode,l=Ul({mode:"visible",children:l.children},c),b=hi(b,c,i,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,xi(t,e.child,null,i),l=t.child,l.memoizedState=fu(i),l.childLanes=hu(e,p,i),t.memoizedState=uu,t=ia(null,l));else if(Ns(t),Qu(b)){if(p=b.nextSibling&&b.nextSibling.dataset,p)var B=p.dgst;p=B,l=Error(a(419)),l.stack="",l.digest=p,Fr({value:l,source:null,stack:null}),t=mu(e,t,i)}else if(mt||Ji(e,t,i,!1),p=(i&e.childLanes)!==0,mt||p){if(p=Xe,p!==null&&(l=vs(p,i),l!==0&&l!==O.retryLane))throw O.retryLane=l,fi(e,l),Ht(p,e,l),ou;Ju(b)||Fl(),t=mu(e,t,i)}else Ju(b)?(t.flags|=192,t.child=e.child,t=null):(e=O.treeContext,Ze=gn(b.nextSibling),wt=t,ze=!0,Ss=null,mn=!1,e!==null&&id(t,e),t=du(t,l.children),t.flags|=4096);return t}return c?(Cs(),b=l.fallback,c=t.mode,O=e.child,B=O.sibling,l=Qn(O,{mode:"hidden",children:l.children}),l.subtreeFlags=O.subtreeFlags&65011712,B!==null?b=Qn(B,b):(b=hi(b,c,i,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,ia(null,l),l=t.child,b=e.child.memoizedState,b===null?b=fu(i):(c=b.cachePool,c!==null?(O=ht._currentValue,c=c.parent!==O?{parent:O,pool:O}:c):c=ud(),b={baseLanes:b.baseLanes|i,cachePool:c}),l.memoizedState=b,l.childLanes=hu(e,p,i),t.memoizedState=uu,ia(e.child,l)):(Ns(t),i=e.child,e=i.sibling,i=Qn(i,{mode:"visible",children:l.children}),i.return=t,i.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=i,t.memoizedState=null,i)}function du(e,t){return t=Ul({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ul(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function mu(e,t,i){return xi(t,e.child,null,i),e=du(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Sm(e,t,i){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Nc(e.return,t,i)}function pu(e,t,i,l,c,u){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:c,treeForkCount:u}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=i,p.tailMode=c,p.treeForkCount=u)}function Em(e,t,i){var l=t.pendingProps,c=l.revealOrder,u=l.tail;l=l.children;var p=ct.current,b=(p&2)!==0;if(b?(p=p&1|2,t.flags|=128):p&=1,Te(ct,p),Et(e,t,l,i),l=ze?Vr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Sm(e,i,t);else if(e.tag===19)Sm(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(i=t.child,c=null;i!==null;)e=i.alternate,e!==null&&Al(e)===null&&(c=i),i=i.sibling;i=c,i===null?(c=t.child,t.child=null):(c=i.sibling,i.sibling=null),pu(t,!1,c,i,u,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Al(e)===null){t.child=c;break}e=c.sibling,c.sibling=i,i=c,c=e}pu(t,!0,i,null,u,l);break;case"together":pu(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function es(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Rs|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Ji(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,i=Qn(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Qn(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function gu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&yl(e)))}function vb(e,t,i){switch(t.tag){case 3:jt(t,t.stateNode.containerInfo),As(t,ht,e.memoizedState.cache),di();break;case 27:case 5:Tt(t);break;case 4:jt(t,t.stateNode.containerInfo);break;case 10:As(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Pc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Ns(t),t.flags|=128,null):(i&t.child.childLanes)!==0?wm(e,t,i):(Ns(t),e=es(e,t,i),e!==null?e.sibling:null);Ns(t);break;case 19:var c=(e.flags&128)!==0;if(l=(i&t.childLanes)!==0,l||(Ji(e,t,i,!1),l=(i&t.childLanes)!==0),c){if(l)return Em(e,t,i);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),Te(ct,ct.current),l)break;return null;case 22:return t.lanes=0,gm(e,t,i,t.pendingProps);case 24:As(t,ht,e.memoizedState.cache)}return es(e,t,i)}function Am(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!gu(e,i)&&(t.flags&128)===0)return mt=!1,vb(e,t,i);mt=(e.flags&131072)!==0}else mt=!1,ze&&(t.flags&1048576)!==0&&sd(t,Vr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=yi(t.elementType),t.type=e,typeof e=="function")_c(e)?(l=_i(e,l),t.tag=1,t=vm(null,t,e,l,i)):(t.tag=0,t=cu(null,t,e,l,i));else{if(e!=null){var c=e.$$typeof;if(c===re){t.tag=11,t=dm(null,t,e,l,i);break e}else if(c===ce){t.tag=14,t=mm(null,t,e,l,i);break e}}throw t=He(e)||e,Error(a(306,t,""))}}return t;case 0:return cu(e,t,t.type,t.pendingProps,i);case 1:return l=t.type,c=_i(l,t.pendingProps),vm(e,t,l,c,i);case 3:e:{if(jt(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;c=u.element,qc(e,t),Wr(t,l,null,i);var p=t.memoizedState;if(l=p.cache,As(t,ht,l),l!==u.cache&&Cc(t,[ht],i,!0),Zr(),l=p.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=_m(e,t,l,i);break e}else if(l!==c){c=fn(Error(a(424)),t),Fr(c),t=_m(e,t,l,i);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ze=gn(e.firstChild),wt=t,ze=!0,Ss=null,mn=!0,i=gd(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(di(),l===c){t=es(e,t,i);break e}Et(e,t,l,i)}t=t.child}return t;case 26:return ql(e,t),e===null?(i=qp(t.type,null,t.pendingProps,null))?t.memoizedState=i:ze||(i=t.type,e=t.pendingProps,l=Wl(an.current).createElement(i),l[Ie]=t,l[it]=e,At(l,i,e),N(l),t.stateNode=l):t.memoizedState=qp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&ze&&(l=t.stateNode=Rp(t.type,t.pendingProps,an.current),wt=t,mn=!0,c=Ze,Bs(t.type)?(Iu=c,Ze=gn(l.firstChild)):Ze=c),Et(e,t,t.pendingProps.children,i),ql(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ze&&((c=l=Ze)&&(l=Xb(l,t.type,t.pendingProps,mn),l!==null?(t.stateNode=l,wt=t,Ze=gn(l.firstChild),mn=!1,c=!0):c=!1),c||Es(t)),Tt(t),c=t.type,u=t.pendingProps,p=e!==null?e.memoizedProps:null,l=u.children,Gu(c,u)?l=null:p!==null&&Gu(c,p)&&(t.flags|=32),t.memoizedState!==null&&(c=Yc(e,t,fb,null,null,i),xa._currentValue=c),ql(e,t),Et(e,t,l,i),t.child;case 6:return e===null&&ze&&((e=i=Ze)&&(i=Kb(i,t.pendingProps,mn),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||Es(t)),null;case 13:return wm(e,t,i);case 4:return jt(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=xi(t,null,l,i):Et(e,t,l,i),t.child;case 11:return dm(e,t,t.type,t.pendingProps,i);case 7:return Et(e,t,t.pendingProps,i),t.child;case 8:return Et(e,t,t.pendingProps.children,i),t.child;case 12:return Et(e,t,t.pendingProps.children,i),t.child;case 10:return l=t.pendingProps,As(t,t.type,l.value),Et(e,t,l.children,i),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,pi(t),c=St(c),l=l(c),t.flags|=1,Et(e,t,l,i),t.child;case 14:return mm(e,t,t.type,t.pendingProps,i);case 15:return pm(e,t,t.type,t.pendingProps,i);case 19:return Em(e,t,i);case 31:return xb(e,t,i);case 22:return gm(e,t,i,t.pendingProps);case 24:return pi(t),l=St(ht),e===null?(c=Rc(),c===null&&(c=Xe,u=kc(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=i),c=u),t.memoizedState={parent:l,cache:c},zc(t),As(t,ht,c)):((e.lanes&i)!==0&&(qc(e,t),Wr(t,null,null,i),Zr()),c=e.memoizedState,u=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),As(t,ht,l)):(l=u.cache,As(t,ht,l),l!==c.cache&&Cc(t,[ht],i,!0))),Et(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function ts(e){e.flags|=4}function yu(e,t,i,l,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Zm())e.flags|=8192;else throw bi=_l,Dc}else e.flags&=-16777217}function Om(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Pp(t))if(Zm())e.flags|=8192;else throw bi=_l,Dc}function Bl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ri():536870912,e.lanes|=t,rr|=t)}function ra(e,t){if(!ze)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(t)for(var c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags&65011712,l|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=i,t}function _b(e,t,i){var l=t.pendingProps;switch(Ac(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return i=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Kn(ht),Se(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Fi(t)?ts(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,jc())),We(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(ts(t),u!==null?(We(t),Om(t,u)):(We(t),yu(t,c,null,l,i))):u?u!==e.memoizedState?(ts(t),We(t),Om(t,u)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ts(t),We(t),yu(t,c,e,l,i)),null;case 27:if(ei(t),i=an.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}e=lt.current,Fi(t)?rd(t):(e=Rp(c,l,i),t.stateNode=e,ts(t))}return We(t),null;case 5:if(ei(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}if(u=lt.current,Fi(t))rd(t);else{var p=Wl(an.current);switch(u){case 1:u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=p.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?p.createElement("select",{is:l.is}):p.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?p.createElement(c,{is:l.is}):p.createElement(c)}}u[Ie]=t,u[it]=l;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)u.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=u;e:switch(At(u,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ts(t)}}return We(t),yu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=an.current,Fi(t)){if(e=t.stateNode,i=t.memoizedProps,l=null,c=wt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[Ie]=t,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||wp(e.nodeValue,i)),e||Es(t,!0)}else e=Wl(e).createTextNode(l),e[Ie]=t,t.stateNode=e}return We(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(l=Fi(t),i!==null){if(e===null){if(!l)throw Error(a(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Ie]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else i=jc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Jt(t),t):(Jt(t),null);if((t.flags&128)!==0)throw Error(a(558))}return We(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Fi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(a(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(a(317));c[Ie]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),c=!1}else c=jc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Jt(t),t):(Jt(t),null)}return Jt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==c&&(l.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Bl(t,t.updateQueue),We(t),null);case 4:return Se(),e===null&&Lu(t.stateNode.containerInfo),We(t),null;case 10:return Kn(t.type),We(t),null;case 19:if(we(ct),l=t.memoizedState,l===null)return We(t),null;if(c=(t.flags&128)!==0,u=l.rendering,u===null)if(c)ra(l,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Al(e),u!==null){for(t.flags|=128,ra(l,!1),e=u.updateQueue,t.updateQueue=e,Bl(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)ed(i,e),i=i.sibling;return Te(ct,ct.current&1|2),ze&&In(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&et()>Yl&&(t.flags|=128,c=!0,ra(l,!1),t.lanes=4194304)}else{if(!c)if(e=Al(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Bl(t,e),ra(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!ze)return We(t),null}else 2*et()-l.renderingStartTime>Yl&&i!==536870912&&(t.flags|=128,c=!0,ra(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=et(),e.sibling=null,i=ct.current,Te(ct,c?i&1|2:i&1),ze&&In(t,l.treeForkCount),e):(We(t),null);case 22:case 23:return Jt(t),Hc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(i&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),i=t.updateQueue,i!==null&&Bl(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==i&&(t.flags|=2048),e!==null&&we(gi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Kn(ht),We(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function wb(e,t){switch(Ac(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Kn(ht),Se(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ei(t),null;case 31:if(t.memoizedState!==null){if(Jt(t),t.alternate===null)throw Error(a(340));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Jt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return we(ct),null;case 4:return Se(),null;case 10:return Kn(t.type),null;case 22:case 23:return Jt(t),Hc(),e!==null&&we(gi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Kn(ht),null;case 25:return null;default:return null}}function jm(e,t){switch(Ac(t),t.tag){case 3:Kn(ht),Se();break;case 26:case 27:case 5:ei(t);break;case 4:Se();break;case 31:t.memoizedState!==null&&Jt(t);break;case 13:Jt(t);break;case 19:we(ct);break;case 10:Kn(t.type);break;case 22:case 23:Jt(t),Hc(),e!==null&&we(gi);break;case 24:Kn(ht)}}function aa(e,t){try{var i=t.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var c=l.next;i=c;do{if((i.tag&e)===e){l=void 0;var u=i.create,p=i.inst;l=u(),p.destroy=l}i=i.next}while(i!==c)}}catch(b){Ye(t,t.return,b)}}function ks(e,t,i){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var u=c.next;l=u;do{if((l.tag&e)===e){var p=l.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=t;var O=i,B=b;try{B()}catch(Y){Ye(c,O,Y)}}}l=l.next}while(l!==u)}}catch(Y){Ye(t,t.return,Y)}}function Tm(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{bd(t,i)}catch(l){Ye(e,e.return,l)}}}function Nm(e,t,i){i.props=_i(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){Ye(e,t,l)}}function la(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(c){Ye(e,t,c)}}function zn(e,t){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(c){Ye(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(c){Ye(e,t,c)}else i.current=null}function Cm(e){var t=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(c){Ye(e,e.return,c)}}function bu(e,t,i){try{var l=e.stateNode;Gb(l,e.type,i,t),l[it]=t}catch(c){Ye(e,e.return,c)}}function km(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Bs(e.type)||e.tag===4}function xu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||km(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Bs(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function vu(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Fn));else if(l!==4&&(l===27&&Bs(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(vu(e,t,i),e=e.sibling;e!==null;)vu(e,t,i),e=e.sibling}function Ll(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(l!==4&&(l===27&&Bs(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Ll(e,t,i),e=e.sibling;e!==null;)Ll(e,t,i),e=e.sibling}function Mm(e){var t=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);At(t,l,i),t[Ie]=e,t[it]=i}catch(u){Ye(e,e.return,u)}}var ns=!1,pt=!1,_u=!1,Rm=typeof WeakSet=="function"?WeakSet:Set,xt=null;function Sb(e,t){if(e=e.containerInfo,$u=ao,e=Vh(e),mc(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var c=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{i.nodeType,u.nodeType}catch{i=null;break e}var p=0,b=-1,O=-1,B=0,Y=0,I=e,L=null;t:for(;;){for(var P;I!==i||c!==0&&I.nodeType!==3||(b=p+c),I!==u||l!==0&&I.nodeType!==3||(O=p+l),I.nodeType===3&&(p+=I.nodeValue.length),(P=I.firstChild)!==null;)L=I,I=P;for(;;){if(I===e)break t;if(L===i&&++B===c&&(b=p),L===u&&++Y===l&&(O=p),(P=I.nextSibling)!==null)break;I=L,L=I.parentNode}I=P}i=b===-1||O===-1?null:{start:b,end:O}}else i=null}i=i||{start:0,end:0}}else i=null;for(Yu={focusedElem:e,selectionRange:i},ao=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)c=e[i],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,i=t,c=u.memoizedProps,u=u.memoizedState,l=i.stateNode;try{var he=_i(i.type,c);e=l.getSnapshotBeforeUpdate(he,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(ye){Ye(i,i.return,ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Fu(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Fu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,xt=e;break}xt=t.return}}function Dm(e,t,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:is(e,i),l&4&&aa(5,i);break;case 1:if(is(e,i),l&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(p){Ye(i,i.return,p)}else{var c=_i(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){Ye(i,i.return,p)}}l&64&&Tm(i),l&512&&la(i,i.return);break;case 3:if(is(e,i),l&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{bd(e,t)}catch(p){Ye(i,i.return,p)}}break;case 27:t===null&&l&4&&Mm(i);case 26:case 5:is(e,i),t===null&&l&4&&Cm(i),l&512&&la(i,i.return);break;case 12:is(e,i);break;case 31:is(e,i),l&4&&Um(e,i);break;case 13:is(e,i),l&4&&Bm(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Mb.bind(null,i),Zb(e,i))));break;case 22:if(l=i.memoizedState!==null||ns,!l){t=t!==null&&t.memoizedState!==null||pt,c=ns;var u=pt;ns=l,(pt=t)&&!u?rs(e,i,(i.subtreeFlags&8772)!==0):is(e,i),ns=c,pt=u}break;case 30:break;default:is(e,i)}}function zm(e){var t=e.alternate;t!==null&&(e.alternate=null,zm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Di(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var tt=null,qt=!1;function ss(e,t,i){for(i=i.child;i!==null;)qm(e,t,i),i=i.sibling}function qm(e,t,i){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(ni,i)}catch{}switch(i.tag){case 26:pt||zn(i,t),ss(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:pt||zn(i,t);var l=tt,c=qt;Bs(i.type)&&(tt=i.stateNode,qt=!1),ss(e,t,i),ga(i.stateNode),tt=l,qt=c;break;case 5:pt||zn(i,t);case 6:if(l=tt,c=qt,tt=null,ss(e,t,i),tt=l,qt=c,tt!==null)if(qt)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(i.stateNode)}catch(u){Ye(i,t,u)}else try{tt.removeChild(i.stateNode)}catch(u){Ye(i,t,u)}break;case 18:tt!==null&&(qt?(e=tt,Tp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),dr(e)):Tp(tt,i.stateNode));break;case 4:l=tt,c=qt,tt=i.stateNode.containerInfo,qt=!0,ss(e,t,i),tt=l,qt=c;break;case 0:case 11:case 14:case 15:ks(2,i,t),pt||ks(4,i,t),ss(e,t,i);break;case 1:pt||(zn(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"&&Nm(i,t,l)),ss(e,t,i);break;case 21:ss(e,t,i);break;case 22:pt=(l=pt)||i.memoizedState!==null,ss(e,t,i),pt=l;break;default:ss(e,t,i)}}function Um(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{dr(e)}catch(i){Ye(t,t.return,i)}}}function Bm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{dr(e)}catch(i){Ye(t,t.return,i)}}function Eb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Rm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Rm),t;default:throw Error(a(435,e.tag))}}function Hl(e,t){var i=Eb(e);t.forEach(function(l){if(!i.has(l)){i.add(l);var c=Rb.bind(null,e,l);l.then(c,c)}})}function Ut(e,t){var i=t.deletions;if(i!==null)for(var l=0;l<i.length;l++){var c=i[l],u=e,p=t,b=p;e:for(;b!==null;){switch(b.tag){case 27:if(Bs(b.type)){tt=b.stateNode,qt=!1;break e}break;case 5:tt=b.stateNode,qt=!1;break e;case 3:case 4:tt=b.stateNode.containerInfo,qt=!0;break e}b=b.return}if(tt===null)throw Error(a(160));qm(u,p,c),tt=null,qt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Lm(t,e),t=t.sibling}var On=null;function Lm(e,t){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Bt(e),l&4&&(ks(3,e,e.return),aa(3,e),ks(5,e,e.return));break;case 1:Ut(t,e),Bt(e),l&512&&(pt||i===null||zn(i,i.return)),l&64&&ns&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var c=On;if(Ut(t,e),Bt(e),l&512&&(pt||i===null||zn(i,i.return)),l&4){var u=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,c=c.ownerDocument||c;t:switch(l){case"title":u=c.getElementsByTagName("title")[0],(!u||u[yt]||u[Ie]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(l),c.head.insertBefore(u,c.querySelector("head > title"))),At(u,l,i),u[Ie]=e,N(u),l=u;break e;case"link":var p=Lp("link","href",c).get(l+(i.href||""));if(p){for(var b=0;b<p.length;b++)if(u=p[b],u.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&u.getAttribute("rel")===(i.rel==null?null:i.rel)&&u.getAttribute("title")===(i.title==null?null:i.title)&&u.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;case"meta":if(p=Lp("meta","content",c).get(l+(i.content||""))){for(b=0;b<p.length;b++)if(u=p[b],u.getAttribute("content")===(i.content==null?null:""+i.content)&&u.getAttribute("name")===(i.name==null?null:i.name)&&u.getAttribute("property")===(i.property==null?null:i.property)&&u.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&u.getAttribute("charset")===(i.charSet==null?null:i.charSet)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;default:throw Error(a(468,l))}u[Ie]=e,N(u),l=u}e.stateNode=l}else Hp(c,e.type,e.stateNode);else e.stateNode=Bp(c,l,e.memoizedProps);else u!==l?(u===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):u.count--,l===null?Hp(c,e.type,e.stateNode):Bp(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&bu(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ut(t,e),Bt(e),l&512&&(pt||i===null||zn(i,i.return)),i!==null&&l&4&&bu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ut(t,e),Bt(e),l&512&&(pt||i===null||zn(i,i.return)),e.flags&32){c=e.stateNode;try{qi(c,"")}catch(he){Ye(e,e.return,he)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,bu(e,c,i!==null?i.memoizedProps:c)),l&1024&&(_u=!0);break;case 6:if(Ut(t,e),Bt(e),l&4){if(e.stateNode===null)throw Error(a(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(he){Ye(e,e.return,he)}}break;case 3:if(no=null,c=On,On=eo(t.containerInfo),Ut(t,e),On=c,Bt(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{dr(t.containerInfo)}catch(he){Ye(e,e.return,he)}_u&&(_u=!1,Hm(e));break;case 4:l=On,On=eo(e.stateNode.containerInfo),Ut(t,e),Bt(e),On=l;break;case 12:Ut(t,e),Bt(e);break;case 31:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Hl(e,l)));break;case 13:Ut(t,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&($l=et()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Hl(e,l)));break;case 22:c=e.memoizedState!==null;var O=i!==null&&i.memoizedState!==null,B=ns,Y=pt;if(ns=B||c,pt=Y||O,Ut(t,e),pt=Y,ns=B,Bt(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(i===null||O||ns||pt||wi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){O=i=t;try{if(u=O.stateNode,c)p=u.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{b=O.stateNode;var I=O.memoizedProps.style,L=I!=null&&I.hasOwnProperty("display")?I.display:null;b.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(he){Ye(O,O.return,he)}}}else if(t.tag===6){if(i===null){O=t;try{O.stateNode.nodeValue=c?"":O.memoizedProps}catch(he){Ye(O,O.return,he)}}}else if(t.tag===18){if(i===null){O=t;try{var P=O.stateNode;c?Np(P,!0):Np(O.stateNode,!1)}catch(he){Ye(O,O.return,he)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,Hl(e,i))));break;case 19:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Hl(e,l)));break;case 30:break;case 21:break;default:Ut(t,e),Bt(e)}}function Bt(e){var t=e.flags;if(t&2){try{for(var i,l=e.return;l!==null;){if(km(l)){i=l;break}l=l.return}if(i==null)throw Error(a(160));switch(i.tag){case 27:var c=i.stateNode,u=xu(e);Ll(e,u,c);break;case 5:var p=i.stateNode;i.flags&32&&(qi(p,""),i.flags&=-33);var b=xu(e);Ll(e,b,p);break;case 3:case 4:var O=i.stateNode.containerInfo,B=xu(e);vu(e,B,O);break;default:throw Error(a(161))}}catch(Y){Ye(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Hm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Hm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function is(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Dm(e,t.alternate,t),t=t.sibling}function wi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ks(4,t,t.return),wi(t);break;case 1:zn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&Nm(t,t.return,i),wi(t);break;case 27:ga(t.stateNode);case 26:case 5:zn(t,t.return),wi(t);break;case 22:t.memoizedState===null&&wi(t);break;case 30:wi(t);break;default:wi(t)}e=e.sibling}}function rs(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,u=t,p=u.flags;switch(u.tag){case 0:case 11:case 15:rs(c,u,i),aa(4,u);break;case 1:if(rs(c,u,i),l=u,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(B){Ye(l,l.return,B)}if(l=u,c=l.updateQueue,c!==null){var b=l.stateNode;try{var O=c.shared.hiddenCallbacks;if(O!==null)for(c.shared.hiddenCallbacks=null,c=0;c<O.length;c++)yd(O[c],b)}catch(B){Ye(l,l.return,B)}}i&&p&64&&Tm(u),la(u,u.return);break;case 27:Mm(u);case 26:case 5:rs(c,u,i),i&&l===null&&p&4&&Cm(u),la(u,u.return);break;case 12:rs(c,u,i);break;case 31:rs(c,u,i),i&&p&4&&Um(c,u);break;case 13:rs(c,u,i),i&&p&4&&Bm(c,u);break;case 22:u.memoizedState===null&&rs(c,u,i),la(u,u.return);break;case 30:break;default:rs(c,u,i)}t=t.sibling}}function wu(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Jr(i))}function Su(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Jr(e))}function jn(e,t,i,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Pm(e,t,i,l),t=t.sibling}function Pm(e,t,i,l){var c=t.flags;switch(t.tag){case 0:case 11:case 15:jn(e,t,i,l),c&2048&&aa(9,t);break;case 1:jn(e,t,i,l);break;case 3:jn(e,t,i,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Jr(e)));break;case 12:if(c&2048){jn(e,t,i,l),e=t.stateNode;try{var u=t.memoizedProps,p=u.id,b=u.onPostCommit;typeof b=="function"&&b(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){Ye(t,t.return,O)}}else jn(e,t,i,l);break;case 31:jn(e,t,i,l);break;case 13:jn(e,t,i,l);break;case 23:break;case 22:u=t.stateNode,p=t.alternate,t.memoizedState!==null?u._visibility&2?jn(e,t,i,l):oa(e,t):u._visibility&2?jn(e,t,i,l):(u._visibility|=2,nr(e,t,i,l,(t.subtreeFlags&10256)!==0||!1)),c&2048&&wu(p,t);break;case 24:jn(e,t,i,l),c&2048&&Su(t.alternate,t);break;default:jn(e,t,i,l)}}function nr(e,t,i,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,p=t,b=i,O=l,B=p.flags;switch(p.tag){case 0:case 11:case 15:nr(u,p,b,O,c),aa(8,p);break;case 23:break;case 22:var Y=p.stateNode;p.memoizedState!==null?Y._visibility&2?nr(u,p,b,O,c):oa(u,p):(Y._visibility|=2,nr(u,p,b,O,c)),c&&B&2048&&wu(p.alternate,p);break;case 24:nr(u,p,b,O,c),c&&B&2048&&Su(p.alternate,p);break;default:nr(u,p,b,O,c)}t=t.sibling}}function oa(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,l=t,c=l.flags;switch(l.tag){case 22:oa(i,l),c&2048&&wu(l.alternate,l);break;case 24:oa(i,l),c&2048&&Su(l.alternate,l);break;default:oa(i,l)}t=t.sibling}}var ca=8192;function sr(e,t,i){if(e.subtreeFlags&ca)for(e=e.child;e!==null;)$m(e,t,i),e=e.sibling}function $m(e,t,i){switch(e.tag){case 26:sr(e,t,i),e.flags&ca&&e.memoizedState!==null&&ux(i,On,e.memoizedState,e.memoizedProps);break;case 5:sr(e,t,i);break;case 3:case 4:var l=On;On=eo(e.stateNode.containerInfo),sr(e,t,i),On=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=ca,ca=16777216,sr(e,t,i),ca=l):sr(e,t,i));break;default:sr(e,t,i)}}function Ym(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ua(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Vm(l,e)}Ym(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Gm(e),e=e.sibling}function Gm(e){switch(e.tag){case 0:case 11:case 15:ua(e),e.flags&2048&&ks(9,e,e.return);break;case 3:ua(e);break;case 12:ua(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Pl(e)):ua(e);break;default:ua(e)}}function Pl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Vm(l,e)}Ym(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ks(8,t,t.return),Pl(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,Pl(t));break;default:Pl(t)}e=e.sibling}}function Vm(e,t){for(;xt!==null;){var i=xt;switch(i.tag){case 0:case 11:case 15:ks(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Jr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,xt=l;else e:for(i=e;xt!==null;){l=xt;var c=l.sibling,u=l.return;if(zm(l),l===i){xt=null;break e}if(c!==null){c.return=u,xt=c;break e}xt=u}}}var Ab={getCacheForType:function(e){var t=St(ht),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return St(ht).controller.signal}},Ob=typeof WeakMap=="function"?WeakMap:Map,Pe=0,Xe=null,Ne=null,Re=0,$e=0,Qt=null,Ms=!1,ir=!1,Eu=!1,as=0,at=0,Rs=0,Si=0,Au=0,It=0,rr=0,fa=null,Lt=null,Ou=!1,$l=0,Fm=0,Yl=1/0,Gl=null,Ds=null,bt=0,zs=null,ar=null,ls=0,ju=0,Tu=null,Jm=null,ha=0,Nu=null;function Xt(){return(Pe&2)!==0&&Re!==0?Re&-Re:$.T!==null?zu():Dr()}function Qm(){if(It===0)if((Re&536870912)===0||ze){var e=Yn;Yn<<=1,(Yn&3932160)===0&&(Yn=262144),It=e}else It=536870912;return e=Ft.current,e!==null&&(e.flags|=32),It}function Ht(e,t,i){(e===Xe&&($e===2||$e===9)||e.cancelPendingCommit!==null)&&(lr(e,0),qs(e,Re,It,!1)),Sn(e,i),((Pe&2)===0||e!==Xe)&&(e===Xe&&((Pe&2)===0&&(Si|=i),at===4&&qs(e,Re,It,!1)),qn(e))}function Im(e,t,i){if((Pe&6)!==0)throw Error(a(327));var l=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ii(e,t),c=l?Nb(e,t):ku(e,t,!0),u=l;do{if(c===0){ir&&!l&&qs(e,t,0,!1);break}else{if(i=e.current.alternate,u&&!jb(i)){c=ku(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var p=0;else p=e.pendingLanes&-536870913,p=p!==0?p:p&536870912?536870912:0;if(p!==0){t=p;e:{var b=e;c=fa;var O=b.current.memoizedState.isDehydrated;if(O&&(lr(b,p).flags|=256),p=ku(b,p,!1),p!==2){if(Eu&&!O){b.errorRecoveryDisabledLanes|=u,Si|=u,c=4;break e}u=Lt,Lt=c,u!==null&&(Lt===null?Lt=u:Lt.push.apply(Lt,u))}c=p}if(u=!1,c!==2)continue}}if(c===1){lr(e,0),qs(e,t,0,!0);break}e:{switch(l=e,u=c,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:qs(l,t,It,!Ms);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(c=$l+300-et(),10<c)){if(qs(l,t,It,!Ms),si(l,0,!0)!==0)break e;ls=t,l.timeoutHandle=Op(Xm.bind(null,l,i,Lt,Gl,Ou,t,It,Si,rr,Ms,u,"Throttled",-0,0),c);break e}Xm(l,i,Lt,Gl,Ou,t,It,Si,rr,Ms,u,null,-0,0)}}break}while(!0);qn(e)}function Xm(e,t,i,l,c,u,p,b,O,B,Y,I,L,P){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fn},$m(t,u,I);var he=(u&62914560)===u?$l-et():(u&4194048)===u?Fm-et():0;if(he=fx(I,he),he!==null){ls=u,e.cancelPendingCommit=he(ip.bind(null,e,t,u,i,l,c,p,b,O,Y,I,null,L,P)),qs(e,u,p,!B);return}}ip(e,t,u,i,l,c,p,b,O)}function jb(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var c=i[l],u=c.getSnapshot;c=c.value;try{if(!Gt(u(),c))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function qs(e,t,i,l){t&=~Au,t&=~Si,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var u=31-Nt(c),p=1<<u;l[u]=-1,c&=~p}i!==0&&xs(e,i,t)}function Vl(){return(Pe&6)===0?(da(0),!1):!0}function Cu(){if(Ne!==null){if($e===0)var e=Ne.return;else e=Ne,Xn=mi=null,Fc(e),Ki=null,Ir=0,e=Ne;for(;e!==null;)jm(e.alternate,e),e=e.return;Ne=null}}function lr(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Jb(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),ls=0,Cu(),Xe=e,Ne=i=Qn(e.current,null),Re=t,$e=0,Qt=null,Ms=!1,ir=ii(e,t),Eu=!1,rr=It=Au=Si=Rs=at=0,Lt=fa=null,Ou=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-Nt(l),u=1<<c;t|=e[c],l&=~u}return as=t,hl(),i}function Km(e,t){Ee=null,$.H=sa,t===Xi||t===vl?(t=dd(),$e=3):t===Dc?(t=dd(),$e=4):$e=t===ou?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Qt=t,Ne===null&&(at=1,Dl(e,fn(t,e.current)))}function Zm(){var e=Ft.current;return e===null?!0:(Re&4194048)===Re?pn===null:(Re&62914560)===Re||(Re&536870912)!==0?e===pn:!1}function Wm(){var e=$.H;return $.H=sa,e===null?sa:e}function ep(){var e=$.A;return $.A=Ab,e}function Fl(){at=4,Ms||(Re&4194048)!==Re&&Ft.current!==null||(ir=!0),(Rs&134217727)===0&&(Si&134217727)===0||Xe===null||qs(Xe,Re,It,!1)}function ku(e,t,i){var l=Pe;Pe|=2;var c=Wm(),u=ep();(Xe!==e||Re!==t)&&(Gl=null,lr(e,t)),t=!1;var p=at;e:do try{if($e!==0&&Ne!==null){var b=Ne,O=Qt;switch($e){case 8:Cu(),p=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(t=!0);var B=$e;if($e=0,Qt=null,or(e,b,O,B),i&&ir){p=0;break e}break;default:B=$e,$e=0,Qt=null,or(e,b,O,B)}}Tb(),p=at;break}catch(Y){Km(e,Y)}while(!0);return t&&e.shellSuspendCounter++,Xn=mi=null,Pe=l,$.H=c,$.A=u,Ne===null&&(Xe=null,Re=0,hl()),p}function Tb(){for(;Ne!==null;)tp(Ne)}function Nb(e,t){var i=Pe;Pe|=2;var l=Wm(),c=ep();Xe!==e||Re!==t?(Gl=null,Yl=et()+500,lr(e,t)):ir=ii(e,t);e:do try{if($e!==0&&Ne!==null){t=Ne;var u=Qt;t:switch($e){case 1:$e=0,Qt=null,or(e,t,u,1);break;case 2:case 9:if(fd(u)){$e=0,Qt=null,np(t);break}t=function(){$e!==2&&$e!==9||Xe!==e||($e=7),qn(e)},u.then(t,t);break e;case 3:$e=7;break e;case 4:$e=5;break e;case 7:fd(u)?($e=0,Qt=null,np(t)):($e=0,Qt=null,or(e,t,u,7));break;case 5:var p=null;switch(Ne.tag){case 26:p=Ne.memoizedState;case 5:case 27:var b=Ne;if(p?Pp(p):b.stateNode.complete){$e=0,Qt=null;var O=b.sibling;if(O!==null)Ne=O;else{var B=b.return;B!==null?(Ne=B,Jl(B)):Ne=null}break t}}$e=0,Qt=null,or(e,t,u,5);break;case 6:$e=0,Qt=null,or(e,t,u,6);break;case 8:Cu(),at=6;break e;default:throw Error(a(462))}}Cb();break}catch(Y){Km(e,Y)}while(!0);return Xn=mi=null,$.H=l,$.A=c,Pe=i,Ne!==null?0:(Xe=null,Re=0,hl(),at)}function Cb(){for(;Ne!==null&&!Ia();)tp(Ne)}function tp(e){var t=Am(e.alternate,e,as);e.memoizedProps=e.pendingProps,t===null?Jl(e):Ne=t}function np(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=xm(i,t,t.pendingProps,t.type,void 0,Re);break;case 11:t=xm(i,t,t.pendingProps,t.type.render,t.ref,Re);break;case 5:Fc(t);default:jm(i,t),t=Ne=ed(t,as),t=Am(i,t,as)}e.memoizedProps=e.pendingProps,t===null?Jl(e):Ne=t}function or(e,t,i,l){Xn=mi=null,Fc(t),Ki=null,Ir=0;var c=t.return;try{if(bb(e,c,t,i,Re)){at=1,Dl(e,fn(i,e.current)),Ne=null;return}}catch(u){if(c!==null)throw Ne=c,u;at=1,Dl(e,fn(i,e.current)),Ne=null;return}t.flags&32768?(ze||l===1?e=!0:ir||(Re&536870912)!==0?e=!1:(Ms=e=!0,(l===2||l===9||l===3||l===6)&&(l=Ft.current,l!==null&&l.tag===13&&(l.flags|=16384))),sp(t,e)):Jl(t)}function Jl(e){var t=e;do{if((t.flags&32768)!==0){sp(t,Ms);return}e=t.return;var i=_b(t.alternate,t,as);if(i!==null){Ne=i;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);at===0&&(at=5)}function sp(e,t){do{var i=wb(e.alternate,e);if(i!==null){i.flags&=32767,Ne=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=i}while(e!==null);at=6,Ne=null}function ip(e,t,i,l,c,u,p,b,O){e.cancelPendingCommit=null;do Ql();while(bt!==0);if((Pe&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=xc,bs(e,i,u,p,b,O),e===Xe&&(Ne=Xe=null,Re=0),ar=t,zs=e,ls=i,ju=u,Tu=c,Jm=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Db(ki,function(){return cp(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=$.T,$.T=null,c=te.p,te.p=2,p=Pe,Pe|=4;try{Sb(e,t,i)}finally{Pe=p,te.p=c,$.T=l}}bt=1,rp(),ap(),lp()}}function rp(){if(bt===1){bt=0;var e=zs,t=ar,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=Pe;Pe|=4;try{Lm(t,e);var u=Yu,p=Vh(e.containerInfo),b=u.focusedElem,O=u.selectionRange;if(p!==b&&b&&b.ownerDocument&&Gh(b.ownerDocument.documentElement,b)){if(O!==null&&mc(b)){var B=O.start,Y=O.end;if(Y===void 0&&(Y=B),"selectionStart"in b)b.selectionStart=B,b.selectionEnd=Math.min(Y,b.value.length);else{var I=b.ownerDocument||document,L=I&&I.defaultView||window;if(L.getSelection){var P=L.getSelection(),he=b.textContent.length,ye=Math.min(O.start,he),Qe=O.end===void 0?ye:Math.min(O.end,he);!P.extend&&ye>Qe&&(p=Qe,Qe=ye,ye=p);var R=Yh(b,ye),k=Yh(b,Qe);if(R&&k&&(P.rangeCount!==1||P.anchorNode!==R.node||P.anchorOffset!==R.offset||P.focusNode!==k.node||P.focusOffset!==k.offset)){var U=I.createRange();U.setStart(R.node,R.offset),P.removeAllRanges(),ye>Qe?(P.addRange(U),P.extend(k.node,k.offset)):(U.setEnd(k.node,k.offset),P.addRange(U))}}}}for(I=[],P=b;P=P.parentNode;)P.nodeType===1&&I.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<I.length;b++){var F=I[b];F.element.scrollLeft=F.left,F.element.scrollTop=F.top}}ao=!!$u,Yu=$u=null}finally{Pe=c,te.p=l,$.T=i}}e.current=t,bt=2}}function ap(){if(bt===2){bt=0;var e=zs,t=ar,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=Pe;Pe|=4;try{Dm(e,t.alternate,t)}finally{Pe=c,te.p=l,$.T=i}}bt=3}}function lp(){if(bt===4||bt===3){bt=0,Ci();var e=zs,t=ar,i=ls,l=Jm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?bt=5:(bt=0,ar=zs=null,op(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Ds=null),ai(i),t=t.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(ni,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=$.T,c=te.p,te.p=2,$.T=null;try{for(var u=e.onRecoverableError,p=0;p<l.length;p++){var b=l[p];u(b.value,{componentStack:b.stack})}}finally{$.T=t,te.p=c}}(ls&3)!==0&&Ql(),qn(e),c=e.pendingLanes,(i&261930)!==0&&(c&42)!==0?e===Nu?ha++:(ha=0,Nu=e):ha=0,da(0)}}function op(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Jr(t)))}function Ql(){return rp(),ap(),lp(),cp()}function cp(){if(bt!==5)return!1;var e=zs,t=ju;ju=0;var i=ai(ls),l=$.T,c=te.p;try{te.p=32>i?32:i,$.T=null,i=Tu,Tu=null;var u=zs,p=ls;if(bt=0,ar=zs=null,ls=0,(Pe&6)!==0)throw Error(a(331));var b=Pe;if(Pe|=4,Gm(u.current),Pm(u,u.current,p,i),Pe=b,da(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(ni,u)}catch{}return!0}finally{te.p=c,$.T=l,op(e,t)}}function up(e,t,i){t=fn(i,t),t=lu(e.stateNode,t,2),e=Ts(e,t,2),e!==null&&(Sn(e,2),qn(e))}function Ye(e,t,i){if(e.tag===3)up(e,e,i);else for(;t!==null;){if(t.tag===3){up(t,e,i);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ds===null||!Ds.has(l))){e=fn(i,e),i=fm(2),l=Ts(t,i,2),l!==null&&(hm(i,l,t,e),Sn(l,2),qn(l));break}}t=t.return}}function Mu(e,t,i){var l=e.pingCache;if(l===null){l=e.pingCache=new Ob;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(i)||(Eu=!0,c.add(i),e=kb.bind(null,e,t,i),t.then(e,e))}function kb(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Xe===e&&(Re&i)===i&&(at===4||at===3&&(Re&62914560)===Re&&300>et()-$l?(Pe&2)===0&&lr(e,0):Au|=i,rr===Re&&(rr=0)),qn(e)}function fp(e,t){t===0&&(t=Ri()),e=fi(e,t),e!==null&&(Sn(e,t),qn(e))}function Mb(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),fp(e,i)}function Rb(e,t){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(i=c.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(t),fp(e,i)}function Db(e,t){return Cr(e,t)}var Il=null,cr=null,Ru=!1,Xl=!1,Du=!1,Us=0;function qn(e){e!==cr&&e.next===null&&(cr===null?Il=cr=e:cr=cr.next=e),Xl=!0,Ru||(Ru=!0,qb())}function da(e,t){if(!Du&&Xl){Du=!0;do for(var i=!1,l=Il;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var u=0;else{var p=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Nt(42|e)+1)-1,u&=c&~(p&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(i=!0,pp(l,u))}else u=Re,u=si(l,l===Xe?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ii(l,u)||(i=!0,pp(l,u));l=l.next}while(i);Du=!1}}function zb(){hp()}function hp(){Xl=Ru=!1;var e=0;Us!==0&&Fb()&&(e=Us);for(var t=et(),i=null,l=Il;l!==null;){var c=l.next,u=dp(l,t);u===0?(l.next=null,i===null?Il=c:i.next=c,c===null&&(cr=i)):(i=l,(e!==0||(u&3)!==0)&&(Xl=!0)),l=c}bt!==0&&bt!==5||da(e),Us!==0&&(Us=0)}function dp(e,t){for(var i=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var p=31-Nt(u),b=1<<p,O=c[p];O===-1?((b&i)===0||(b&l)!==0)&&(c[p]=Rr(b,t)):O<=t&&(e.expiredLanes|=b),u&=~b}if(t=Xe,i=Re,i=si(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===t&&($e===2||$e===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&$n(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ii(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(l!==null&&$n(l),ai(i)){case 2:case 8:i=Ka;break;case 32:i=ki;break;case 268435456:i=Za;break;default:i=ki}return l=mp.bind(null,e),i=Cr(i,l),e.callbackPriority=t,e.callbackNode=i,t}return l!==null&&l!==null&&$n(l),e.callbackPriority=2,e.callbackNode=null,2}function mp(e,t){if(bt!==0&&bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Ql()&&e.callbackNode!==i)return null;var l=Re;return l=si(e,e===Xe?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Im(e,l,t),dp(e,et()),e.callbackNode!=null&&e.callbackNode===i?mp.bind(null,e):null)}function pp(e,t){if(Ql())return null;Im(e,t,!0)}function qb(){Qb(function(){(Pe&6)!==0?Cr(Xa,zb):hp()})}function zu(){if(Us===0){var e=Qi;e===0&&(e=ps,ps<<=1,(ps&261888)===0&&(ps=256)),Us=e}return Us}function gp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:il(""+e)}function yp(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Ub(e,t,i,l,c){if(t==="submit"&&i&&i.stateNode===c){var u=gp((c[it]||null).action),p=l.submitter;p&&(t=(t=p[it]||null)?gp(t.formAction):p.getAttribute("formAction"),t!==null&&(u=t,p=null));var b=new ol("action","action",null,l,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Us!==0){var O=p?yp(c,p):new FormData(c);tu(i,{pending:!0,data:O,method:c.method,action:u},null,O)}}else typeof u=="function"&&(b.preventDefault(),O=p?yp(c,p):new FormData(c),tu(i,{pending:!0,data:O,method:c.method,action:u},u,O))},currentTarget:c}]})}}for(var qu=0;qu<bc.length;qu++){var Uu=bc[qu],Bb=Uu.toLowerCase(),Lb=Uu[0].toUpperCase()+Uu.slice(1);An(Bb,"on"+Lb)}An(Qh,"onAnimationEnd"),An(Ih,"onAnimationIteration"),An(Xh,"onAnimationStart"),An("dblclick","onDoubleClick"),An("focusin","onFocus"),An("focusout","onBlur"),An(tb,"onTransitionRun"),An(nb,"onTransitionStart"),An(sb,"onTransitionCancel"),An(Kh,"onTransitionEnd"),H("onMouseEnter",["mouseout","mouseover"]),H("onMouseLeave",["mouseout","mouseover"]),H("onPointerEnter",["pointerout","pointerover"]),H("onPointerLeave",["pointerout","pointerover"]),Z("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Z("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Z("onBeforeInput",["compositionend","keypress","textInput","paste"]),Z("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Z("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Z("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ma="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(" "),Hb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ma));function bp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var p=l.length-1;0<=p;p--){var b=l[p],O=b.instance,B=b.currentTarget;if(b=b.listener,O!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){fl(Y)}c.currentTarget=null,u=O}else for(p=0;p<l.length;p++){if(b=l[p],O=b.instance,B=b.currentTarget,b=b.listener,O!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){fl(Y)}c.currentTarget=null,u=O}}}}function Ce(e,t){var i=t[li];i===void 0&&(i=t[li]=new Set);var l=e+"__bubble";i.has(l)||(xp(t,e,2,!1),i.add(l))}function Bu(e,t,i){var l=0;t&&(l|=4),xp(i,e,l,t)}var Kl="_reactListening"+Math.random().toString(36).slice(2);function Lu(e){if(!e[Kl]){e[Kl]=!0,z.forEach(function(i){i!=="selectionchange"&&(Hb.has(i)||Bu(i,!1,e),Bu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Kl]||(t[Kl]=!0,Bu("selectionchange",!1,t))}}function xp(e,t,i,l){switch(Qp(t)){case 2:var c=mx;break;case 8:c=px;break;default:c=ef}i=c.bind(null,t,i,e),c=void 0,!rc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,i,{capture:!0,passive:c}):e.addEventListener(t,i,!0):c!==void 0?e.addEventListener(t,i,{passive:c}):e.addEventListener(t,i,!1)}function Hu(e,t,i,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var b=l.stateNode.containerInfo;if(b===c)break;if(p===4)for(p=l.return;p!==null;){var O=p.tag;if((O===3||O===4)&&p.stateNode.containerInfo===c)return;p=p.return}for(;b!==null;){if(p=x(b),p===null)return;if(O=p.tag,O===5||O===6||O===26||O===27){l=u=p;continue e}b=b.parentNode}}l=l.return}Eh(function(){var B=u,Y=sc(i),I=[];e:{var L=Zh.get(e);if(L!==void 0){var P=ol,he=e;switch(e){case"keypress":if(al(i)===0)break e;case"keydown":case"keyup":P=Ry;break;case"focusin":he="focus",P=cc;break;case"focusout":he="blur",P=cc;break;case"beforeblur":case"afterblur":P=cc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":P=jh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=_y;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=qy;break;case Qh:case Ih:case Xh:P=Ey;break;case Kh:P=By;break;case"scroll":case"scrollend":P=xy;break;case"wheel":P=Hy;break;case"copy":case"cut":case"paste":P=Oy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=Nh;break;case"toggle":case"beforetoggle":P=$y}var ye=(t&4)!==0,Qe=!ye&&(e==="scroll"||e==="scrollend"),R=ye?L!==null?L+"Capture":null:L;ye=[];for(var k=B,U;k!==null;){var F=k;if(U=F.stateNode,F=F.tag,F!==5&&F!==26&&F!==27||U===null||R===null||(F=qr(k,R),F!=null&&ye.push(pa(k,F,U))),Qe)break;k=k.return}0<ye.length&&(L=new P(L,he,null,i,Y),I.push({event:L,listeners:ye}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",P=e==="mouseout"||e==="pointerout",L&&i!==nc&&(he=i.relatedTarget||i.fromElement)&&(x(he)||he[Yt]))break e;if((P||L)&&(L=Y.window===Y?Y:(L=Y.ownerDocument)?L.defaultView||L.parentWindow:window,P?(he=i.relatedTarget||i.toElement,P=B,he=he?x(he):null,he!==null&&(Qe=f(he),ye=he.tag,he!==Qe||ye!==5&&ye!==27&&ye!==6)&&(he=null)):(P=null,he=B),P!==he)){if(ye=jh,F="onMouseLeave",R="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(ye=Nh,F="onPointerLeave",R="onPointerEnter",k="pointer"),Qe=P==null?L:_(P),U=he==null?L:_(he),L=new ye(F,k+"leave",P,i,Y),L.target=Qe,L.relatedTarget=U,F=null,x(Y)===B&&(ye=new ye(R,k+"enter",he,i,Y),ye.target=U,ye.relatedTarget=Qe,F=ye),Qe=F,P&&he)t:{for(ye=Pb,R=P,k=he,U=0,F=R;F;F=ye(F))U++;F=0;for(var ge=k;ge;ge=ye(ge))F++;for(;0<U-F;)R=ye(R),U--;for(;0<F-U;)k=ye(k),F--;for(;U--;){if(R===k||k!==null&&R===k.alternate){ye=R;break t}R=ye(R),k=ye(k)}ye=null}else ye=null;P!==null&&vp(I,L,P,ye,!1),he!==null&&Qe!==null&&vp(I,Qe,he,ye,!0)}}e:{if(L=B?_(B):window,P=L.nodeName&&L.nodeName.toLowerCase(),P==="select"||P==="input"&&L.type==="file")var Be=Uh;else if(zh(L))if(Bh)Be=Zy;else{Be=Xy;var pe=Iy}else P=L.nodeName,!P||P.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?B&&tc(B.elementType)&&(Be=Uh):Be=Ky;if(Be&&(Be=Be(e,B))){qh(I,Be,i,Y);break e}pe&&pe(e,L,B),e==="focusout"&&B&&L.type==="number"&&B.memoizedProps.value!=null&&ec(L,"number",L.value)}switch(pe=B?_(B):window,e){case"focusin":(zh(pe)||pe.contentEditable==="true")&&(Hi=pe,pc=B,Gr=null);break;case"focusout":Gr=pc=Hi=null;break;case"mousedown":gc=!0;break;case"contextmenu":case"mouseup":case"dragend":gc=!1,Fh(I,i,Y);break;case"selectionchange":if(eb)break;case"keydown":case"keyup":Fh(I,i,Y)}var Ae;if(fc)e:{switch(e){case"compositionstart":var De="onCompositionStart";break e;case"compositionend":De="onCompositionEnd";break e;case"compositionupdate":De="onCompositionUpdate";break e}De=void 0}else Li?Rh(e,i)&&(De="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(De="onCompositionStart");De&&(Ch&&i.locale!=="ko"&&(Li||De!=="onCompositionStart"?De==="onCompositionEnd"&&Li&&(Ae=Ah()):(_s=Y,ac="value"in _s?_s.value:_s.textContent,Li=!0)),pe=Zl(B,De),0<pe.length&&(De=new Th(De,e,null,i,Y),I.push({event:De,listeners:pe}),Ae?De.data=Ae:(Ae=Dh(i),Ae!==null&&(De.data=Ae)))),(Ae=Gy?Vy(e,i):Fy(e,i))&&(De=Zl(B,"onBeforeInput"),0<De.length&&(pe=new Th("onBeforeInput","beforeinput",null,i,Y),I.push({event:pe,listeners:De}),pe.data=Ae)),Ub(I,e,B,i,Y)}bp(I,t)})}function pa(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Zl(e,t){for(var i=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=qr(e,i),c!=null&&l.unshift(pa(e,c,u)),c=qr(e,t),c!=null&&l.push(pa(e,c,u))),e.tag===3)return l;e=e.return}return[]}function Pb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function vp(e,t,i,l,c){for(var u=t._reactName,p=[];i!==null&&i!==l;){var b=i,O=b.alternate,B=b.stateNode;if(b=b.tag,O!==null&&O===l)break;b!==5&&b!==26&&b!==27||B===null||(O=B,c?(B=qr(i,u),B!=null&&p.unshift(pa(i,B,O))):c||(B=qr(i,u),B!=null&&p.push(pa(i,B,O)))),i=i.return}p.length!==0&&e.push({event:t,listeners:p})}var $b=/\r\n?/g,Yb=/\u0000|\uFFFD/g;function _p(e){return(typeof e=="string"?e:""+e).replace($b,`
|
|
26
|
-
`).replace(Yb,"")}function wp(e,t){return t=_p(t),_p(e)===t}function Je(e,t,i,l,c,u){switch(i){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||qi(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&qi(e,""+l);break;case"className":En(e,"class",l);break;case"tabIndex":En(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":En(e,i,l);break;case"style":wh(e,l,u);break;case"data":if(t!=="object"){En(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=il(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(i==="formAction"?(t!=="input"&&Je(e,t,"name",c.name,c,null),Je(e,t,"formEncType",c.formEncType,c,null),Je(e,t,"formMethod",c.formMethod,c,null),Je(e,t,"formTarget",c.formTarget,c,null)):(Je(e,t,"encType",c.encType,c,null),Je(e,t,"method",c.method,c,null),Je(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=il(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Fn);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=il(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Ce("beforetoggle",e),Ce("toggle",e),Ct(e,"popover",l);break;case"xlinkActuate":Vn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Vn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Vn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Vn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Vn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Vn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ct(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=yy.get(i)||i,Ct(e,i,l))}}function Pu(e,t,i,l,c,u){switch(i){case"style":wh(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"children":typeof l=="string"?qi(e,l):(typeof l=="number"||typeof l=="bigint")&&qi(e,""+l);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Fn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Q.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(c=i.endsWith("Capture"),t=i.slice(2,c?i.length-7:void 0),u=e[it]||null,u=u!=null?u[i]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof l=="function")){typeof u!="function"&&u!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,l,c);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):Ct(e,i,l)}}}function At(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ce("error",e),Ce("load",e);var l=!1,c=!1,u;for(u in i)if(i.hasOwnProperty(u)){var p=i[u];if(p!=null)switch(u){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Je(e,t,u,p,i,null)}}c&&Je(e,t,"srcSet",i.srcSet,i,null),l&&Je(e,t,"src",i.src,i,null);return;case"input":Ce("invalid",e);var b=u=p=c=null,O=null,B=null;for(l in i)if(i.hasOwnProperty(l)){var Y=i[l];if(Y!=null)switch(l){case"name":c=Y;break;case"type":p=Y;break;case"checked":O=Y;break;case"defaultChecked":B=Y;break;case"value":u=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,t));break;default:Je(e,t,l,Y,i,null)}}bh(e,u,b,O,B,p,c,!1);return;case"select":Ce("invalid",e),l=p=u=null;for(c in i)if(i.hasOwnProperty(c)&&(b=i[c],b!=null))switch(c){case"value":u=b;break;case"defaultValue":p=b;break;case"multiple":l=b;default:Je(e,t,c,b,i,null)}t=u,i=p,e.multiple=!!l,t!=null?zi(e,!!l,t,!1):i!=null&&zi(e,!!l,i,!0);return;case"textarea":Ce("invalid",e),u=c=l=null;for(p in i)if(i.hasOwnProperty(p)&&(b=i[p],b!=null))switch(p){case"value":l=b;break;case"defaultValue":c=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Je(e,t,p,b,i,null)}vh(e,l,c,u);return;case"option":for(O in i)if(i.hasOwnProperty(O)&&(l=i[O],l!=null))switch(O){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Je(e,t,O,l,i,null)}return;case"dialog":Ce("beforetoggle",e),Ce("toggle",e),Ce("cancel",e),Ce("close",e);break;case"iframe":case"object":Ce("load",e);break;case"video":case"audio":for(l=0;l<ma.length;l++)Ce(ma[l],e);break;case"image":Ce("error",e),Ce("load",e);break;case"details":Ce("toggle",e);break;case"embed":case"source":case"link":Ce("error",e),Ce("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(B in i)if(i.hasOwnProperty(B)&&(l=i[B],l!=null))switch(B){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Je(e,t,B,l,i,null)}return;default:if(tc(t)){for(Y in i)i.hasOwnProperty(Y)&&(l=i[Y],l!==void 0&&Pu(e,t,Y,l,i,void 0));return}}for(b in i)i.hasOwnProperty(b)&&(l=i[b],l!=null&&Je(e,t,b,l,i,null))}function Gb(e,t,i,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,p=null,b=null,O=null,B=null,Y=null;for(P in i){var I=i[P];if(i.hasOwnProperty(P)&&I!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":O=I;default:l.hasOwnProperty(P)||Je(e,t,P,null,l,I)}}for(var L in l){var P=l[L];if(I=i[L],l.hasOwnProperty(L)&&(P!=null||I!=null))switch(L){case"type":u=P;break;case"name":c=P;break;case"checked":B=P;break;case"defaultChecked":Y=P;break;case"value":p=P;break;case"defaultValue":b=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(a(137,t));break;default:P!==I&&Je(e,t,L,P,l,I)}}Wo(e,p,b,O,B,Y,u,c);return;case"select":P=p=b=L=null;for(u in i)if(O=i[u],i.hasOwnProperty(u)&&O!=null)switch(u){case"value":break;case"multiple":P=O;default:l.hasOwnProperty(u)||Je(e,t,u,null,l,O)}for(c in l)if(u=l[c],O=i[c],l.hasOwnProperty(c)&&(u!=null||O!=null))switch(c){case"value":L=u;break;case"defaultValue":b=u;break;case"multiple":p=u;default:u!==O&&Je(e,t,c,u,l,O)}t=b,i=p,l=P,L!=null?zi(e,!!i,L,!1):!!l!=!!i&&(t!=null?zi(e,!!i,t,!0):zi(e,!!i,i?[]:"",!1));return;case"textarea":P=L=null;for(b in i)if(c=i[b],i.hasOwnProperty(b)&&c!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Je(e,t,b,null,l,c)}for(p in l)if(c=l[p],u=i[p],l.hasOwnProperty(p)&&(c!=null||u!=null))switch(p){case"value":L=c;break;case"defaultValue":P=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(a(91));break;default:c!==u&&Je(e,t,p,c,l,u)}xh(e,L,P);return;case"option":for(var he in i)if(L=i[he],i.hasOwnProperty(he)&&L!=null&&!l.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:Je(e,t,he,null,l,L)}for(O in l)if(L=l[O],P=i[O],l.hasOwnProperty(O)&&L!==P&&(L!=null||P!=null))switch(O){case"selected":e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Je(e,t,O,L,l,P)}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 ye in i)L=i[ye],i.hasOwnProperty(ye)&&L!=null&&!l.hasOwnProperty(ye)&&Je(e,t,ye,null,l,L);for(B in l)if(L=l[B],P=i[B],l.hasOwnProperty(B)&&L!==P&&(L!=null||P!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(a(137,t));break;default:Je(e,t,B,L,l,P)}return;default:if(tc(t)){for(var Qe in i)L=i[Qe],i.hasOwnProperty(Qe)&&L!==void 0&&!l.hasOwnProperty(Qe)&&Pu(e,t,Qe,void 0,l,L);for(Y in l)L=l[Y],P=i[Y],!l.hasOwnProperty(Y)||L===P||L===void 0&&P===void 0||Pu(e,t,Y,L,l,P);return}}for(var R in i)L=i[R],i.hasOwnProperty(R)&&L!=null&&!l.hasOwnProperty(R)&&Je(e,t,R,null,l,L);for(I in l)L=l[I],P=i[I],!l.hasOwnProperty(I)||L===P||L==null&&P==null||Je(e,t,I,L,l,P)}function Sp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Vb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var c=i[l],u=c.transferSize,p=c.initiatorType,b=c.duration;if(u&&b&&Sp(p)){for(p=0,b=c.responseEnd,l+=1;l<i.length;l++){var O=i[l],B=O.startTime;if(B>b)break;var Y=O.transferSize,I=O.initiatorType;Y&&Sp(I)&&(O=O.responseEnd,p+=Y*(O<b?1:(b-B)/(O-B)))}if(--l,t+=8*(u+p)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var $u=null,Yu=null;function Wl(e){return e.nodeType===9?e:e.ownerDocument}function Ep(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Ap(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Gu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Vu=null;function Fb(){var e=window.event;return e&&e.type==="popstate"?e===Vu?!1:(Vu=e,!0):(Vu=null,!1)}var Op=typeof setTimeout=="function"?setTimeout:void 0,Jb=typeof clearTimeout=="function"?clearTimeout:void 0,jp=typeof Promise=="function"?Promise:void 0,Qb=typeof queueMicrotask=="function"?queueMicrotask:typeof jp<"u"?function(e){return jp.resolve(null).then(e).catch(Ib)}:Op;function Ib(e){setTimeout(function(){throw e})}function Bs(e){return e==="head"}function Tp(e,t){var i=t,l=0;do{var c=i.nextSibling;if(e.removeChild(i),c&&c.nodeType===8)if(i=c.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(c),dr(t);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")ga(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,ga(i);for(var u=i.firstChild;u;){var p=u.nextSibling,b=u.nodeName;u[yt]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||i.removeChild(u),u=p}}else i==="body"&&ga(e.ownerDocument.body);i=c}while(i);dr(t)}function Np(e,t){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function Fu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Fu(i),Di(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Xb(e,t,i,l){for(;e.nodeType===1;){var c=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[yt])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=gn(e.nextSibling),e===null)break}return null}function Kb(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=gn(e.nextSibling),e===null))return null;return e}function Cp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=gn(e.nextSibling),e===null))return null;return e}function Ju(e){return e.data==="$?"||e.data==="$~"}function Qu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Zb(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var l=function(){t(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function gn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Iu=null;function kp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return gn(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function Mp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Rp(e,t,i){switch(t=Wl(i),e){case"html":if(e=t.documentElement,!e)throw Error(a(452));return e;case"head":if(e=t.head,!e)throw Error(a(453));return e;case"body":if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function ga(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Di(e)}var yn=new Map,Dp=new Set;function eo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var os=te.d;te.d={f:Wb,r:ex,D:tx,C:nx,L:sx,m:ix,X:ax,S:rx,M:lx};function Wb(){var e=os.f(),t=Vl();return e||t}function ex(e){var t=S(e);t!==null&&t.tag===5&&t.type==="form"?Kd(t):os.r(e)}var ur=typeof document>"u"?null:document;function zp(e,t,i){var l=ur;if(l&&typeof t=="string"&&t){var c=cn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof i=="string"&&(c+='[crossorigin="'+i+'"]'),Dp.has(c)||(Dp.add(c),e={rel:e,crossOrigin:i,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function tx(e){os.D(e),zp("dns-prefetch",e,null)}function nx(e,t){os.C(e,t),zp("preconnect",e,t)}function sx(e,t,i){os.L(e,t,i);var l=ur;if(l&&e&&t){var c='link[rel="preload"][as="'+cn(t)+'"]';t==="image"&&i&&i.imageSrcSet?(c+='[imagesrcset="'+cn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(c+='[imagesizes="'+cn(i.imageSizes)+'"]')):c+='[href="'+cn(e)+'"]';var u=c;switch(t){case"style":u=fr(e);break;case"script":u=hr(e)}yn.has(u)||(e=w({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),yn.set(u,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(ya(u))||t==="script"&&l.querySelector(ba(u))||(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function ix(e,t){os.m(e,t);var i=ur;if(i&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+cn(l)+'"][href="'+cn(e)+'"]',u=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=hr(e)}if(!yn.has(u)&&(e=w({rel:"modulepreload",href:e},t),yn.set(u,e),i.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(ba(u)))return}l=i.createElement("link"),At(l,"link",e),N(l),i.head.appendChild(l)}}}function rx(e,t,i){os.S(e,t,i);var l=ur;if(l&&e){var c=A(l).hoistableStyles,u=fr(e);t=t||"default";var p=c.get(u);if(!p){var b={loading:0,preload:null};if(p=l.querySelector(ya(u)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},i),(i=yn.get(u))&&Xu(e,i);var O=p=l.createElement("link");N(O),At(O,"link",e),O._p=new Promise(function(B,Y){O.onload=B,O.onerror=Y}),O.addEventListener("load",function(){b.loading|=1}),O.addEventListener("error",function(){b.loading|=2}),b.loading|=4,to(p,t,l)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(u,p)}}}function ax(e,t){os.X(e,t);var i=ur;if(i&&e){var l=A(i).hoistableScripts,c=hr(e),u=l.get(c);u||(u=i.querySelector(ba(c)),u||(e=w({src:e,async:!0},t),(t=yn.get(c))&&Ku(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function lx(e,t){os.M(e,t);var i=ur;if(i&&e){var l=A(i).hoistableScripts,c=hr(e),u=l.get(c);u||(u=i.querySelector(ba(c)),u||(e=w({src:e,async:!0,type:"module"},t),(t=yn.get(c))&&Ku(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function qp(e,t,i,l){var c=(c=an.current)?eo(c):null;if(!c)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=fr(i.href),i=A(c).hoistableStyles,l=i.get(t),l||(l={type:"style",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=fr(i.href);var u=A(c).hoistableStyles,p=u.get(e);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,p),(u=c.querySelector(ya(e)))&&!u._p&&(p.instance=u,p.state.loading=5),yn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},yn.set(e,i),u||ox(c,e,i,p.state))),t&&l===null)throw Error(a(528,""));return p}if(t&&l!==null)throw Error(a(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=hr(i),i=A(c).hoistableScripts,l=i.get(t),l||(l={type:"script",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function fr(e){return'href="'+cn(e)+'"'}function ya(e){return'link[rel="stylesheet"]['+e+"]"}function Up(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function ox(e,t,i,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),At(t,"link",i),N(t),e.head.appendChild(t))}function hr(e){return'[src="'+cn(e)+'"]'}function ba(e){return"script[async]"+e}function Bp(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+cn(i.href)+'"]');if(l)return t.instance=l,N(l),l;var c=w({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),N(l),At(l,"style",c),to(l,i.precedence,e),t.instance=l;case"stylesheet":c=fr(i.href);var u=e.querySelector(ya(c));if(u)return t.state.loading|=4,t.instance=u,N(u),u;l=Up(i),(c=yn.get(c))&&Xu(l,c),u=(e.ownerDocument||e).createElement("link"),N(u);var p=u;return p._p=new Promise(function(b,O){p.onload=b,p.onerror=O}),At(u,"link",l),t.state.loading|=4,to(u,i.precedence,e),t.instance=u;case"script":return u=hr(i.src),(c=e.querySelector(ba(u)))?(t.instance=c,N(c),c):(l=i,(c=yn.get(u))&&(l=w({},i),Ku(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),N(c),At(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(a(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,to(l,i.precedence,e));return t.instance}function to(e,t,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,u=c,p=0;p<l.length;p++){var b=l[p];if(b.dataset.precedence===t)u=b;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function Xu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ku(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var no=null;function Lp(e,t,i){if(no===null){var l=new Map,c=no=new Map;c.set(i,l)}else c=no,l=c.get(i),l||(l=new Map,c.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),c=0;c<i.length;c++){var u=i[c];if(!(u[yt]||u[Ie]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var p=u.getAttribute(t)||"";p=e+p;var b=l.get(p);b?b.push(u):l.set(p,[u])}}return l}function Hp(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function cx(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Pp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ux(e,t,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var c=fr(l.href),u=t.querySelector(ya(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=so.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=u,N(u);return}u=t.ownerDocument||t,l=Up(l),(c=yn.get(c))&&Xu(l,c),u=u.createElement("link"),N(u);var p=u;p._p=new Promise(function(b,O){p.onload=b,p.onerror=O}),At(u,"link",l),i.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=so.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Zu=0;function fx(e,t){return e.stylesheets&&e.count===0&&ro(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&ro(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Zu===0&&(Zu=62500*Vb());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ro(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Zu?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function so(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ro(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var io=null;function ro(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,io=new Map,t.forEach(hx,e),io=null,so.call(e))}function hx(e,t){if(!(t.state.loading&4)){var i=io.get(e);if(i)var l=i.get(null);else{i=new Map,io.set(e,i);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var p=c[u];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(i.set(p.dataset.precedence,p),l=p)}l&&i.set(null,l)}c=t.instance,p=c.getAttribute("data-precedence"),u=i.get(p)||l,u===l&&i.set(null,c),i.set(p,c),this.count++,l=so.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var xa={$$typeof:me,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function dx(e,t,i,l,c,u,p,b,O){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ys(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ys(0),this.hiddenUpdates=ys(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function $p(e,t,i,l,c,u,p,b,O,B,Y,I){return e=new dx(e,t,i,p,O,B,Y,I,b),t=1,u===!0&&(t|=24),u=Vt(3,null,null,t),e.current=u,u.stateNode=e,t=kc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:i,cache:t},zc(u),e}function Yp(e){return e?(e=Yi,e):Yi}function Gp(e,t,i,l,c,u){c=Yp(c),l.context===null?l.context=c:l.pendingContext=c,l=js(t),l.payload={element:i},u=u===void 0?null:u,u!==null&&(l.callback=u),i=Ts(e,l,t),i!==null&&(Ht(i,e,t),Kr(i,e,t))}function Vp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Wu(e,t){Vp(e,t),(e=e.alternate)&&Vp(e,t)}function Fp(e){if(e.tag===13||e.tag===31){var t=fi(e,67108864);t!==null&&Ht(t,e,67108864),Wu(e,67108864)}}function Jp(e){if(e.tag===13||e.tag===31){var t=Xt();t=Gn(t);var i=fi(e,t);i!==null&&Ht(i,e,t),Wu(e,t)}}var ao=!0;function mx(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=2,ef(e,t,i,l)}finally{te.p=u,$.T=c}}function px(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=8,ef(e,t,i,l)}finally{te.p=u,$.T=c}}function ef(e,t,i,l){if(ao){var c=tf(l);if(c===null)Hu(e,t,l,lo,i),Ip(e,l);else if(yx(c,e,t,i,l))l.stopPropagation();else if(Ip(e,l),t&4&&-1<gx.indexOf(e)){for(;c!==null;){var u=S(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var p=wn(u.pendingLanes);if(p!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;p;){var O=1<<31-Nt(p);b.entanglements[1]|=O,p&=~O}qn(u),(Pe&6)===0&&(Yl=et()+500,da(0))}}break;case 31:case 13:b=fi(u,2),b!==null&&Ht(b,u,2),Vl(),Wu(u,2)}if(u=tf(l),u===null&&Hu(e,t,l,lo,i),u===c)break;c=u}c!==null&&l.stopPropagation()}else Hu(e,t,l,null,i)}}function tf(e){return e=sc(e),nf(e)}var lo=null;function nf(e){if(lo=null,e=x(e),e!==null){var t=f(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=h(t),e!==null)return e;e=null}else if(i===31){if(e=d(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return lo=e,null}function Qp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Io()){case Xa:return 2;case Ka:return 8;case ki:case Xo:return 32;case Za:return 268435456;default:return 32}default:return 32}}var sf=!1,Ls=null,Hs=null,Ps=null,va=new Map,_a=new Map,$s=[],gx="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Ip(e,t){switch(e){case"focusin":case"focusout":Ls=null;break;case"dragenter":case"dragleave":Hs=null;break;case"mouseover":case"mouseout":Ps=null;break;case"pointerover":case"pointerout":va.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":_a.delete(t.pointerId)}}function wa(e,t,i,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:i,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=S(t),t!==null&&Fp(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function yx(e,t,i,l,c){switch(t){case"focusin":return Ls=wa(Ls,e,t,i,l,c),!0;case"dragenter":return Hs=wa(Hs,e,t,i,l,c),!0;case"mouseover":return Ps=wa(Ps,e,t,i,l,c),!0;case"pointerover":var u=c.pointerId;return va.set(u,wa(va.get(u)||null,e,t,i,l,c)),!0;case"gotpointercapture":return u=c.pointerId,_a.set(u,wa(_a.get(u)||null,e,t,i,l,c)),!0}return!1}function Xp(e){var t=x(e.target);if(t!==null){var i=f(t);if(i!==null){if(t=i.tag,t===13){if(t=h(i),t!==null){e.blockedOn=t,el(e.priority,function(){Jp(i)});return}}else if(t===31){if(t=d(i),t!==null){e.blockedOn=t,el(e.priority,function(){Jp(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function oo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=tf(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);nc=l,i.target.dispatchEvent(l),nc=null}else return t=S(i),t!==null&&Fp(t),e.blockedOn=i,!1;t.shift()}return!0}function Kp(e,t,i){oo(e)&&i.delete(t)}function bx(){sf=!1,Ls!==null&&oo(Ls)&&(Ls=null),Hs!==null&&oo(Hs)&&(Hs=null),Ps!==null&&oo(Ps)&&(Ps=null),va.forEach(Kp),_a.forEach(Kp)}function co(e,t){e.blockedOn===t&&(e.blockedOn=null,sf||(sf=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,bx)))}var uo=null;function Zp(e){uo!==e&&(uo=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){uo===e&&(uo=null);for(var t=0;t<e.length;t+=3){var i=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(nf(l||i)===null)continue;break}var u=S(i);u!==null&&(e.splice(t,3),t-=3,tu(u,{pending:!0,data:c,method:i.method,action:l},l,c))}}))}function dr(e){function t(O){return co(O,e)}Ls!==null&&co(Ls,e),Hs!==null&&co(Hs,e),Ps!==null&&co(Ps,e),va.forEach(t),_a.forEach(t);for(var i=0;i<$s.length;i++){var l=$s[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<$s.length&&(i=$s[0],i.blockedOn===null);)Xp(i),i.blockedOn===null&&$s.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var c=i[l],u=i[l+1],p=c[it]||null;if(typeof u=="function")p||Zp(i);else if(p){var b=null;if(u&&u.hasAttribute("formAction")){if(c=u,p=u[it]||null)b=p.formAction;else if(nf(c)!==null)continue}else b=p.action;typeof b=="function"?i[l+1]=b:(i.splice(l,3),l-=3),Zp(i)}}}function Wp(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(p){return c=p})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function rf(e){this._internalRoot=e}fo.prototype.render=rf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var i=t.current,l=Xt();Gp(i,l,e,t,null,null)},fo.prototype.unmount=rf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Gp(e.current,2,null,e,null,null),Vl(),t[Yt]=null}};function fo(e){this._internalRoot=e}fo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Dr();e={blockedOn:null,target:e,priority:t};for(var i=0;i<$s.length&&t!==0&&t<$s[i].priority;i++);$s.splice(i,0,e),i===0&&Xp(e)}};var e0=n.version;if(e0!=="19.2.4")throw Error(a(527,e0,"19.2.4"));te.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=y(t),e=e!==null?E(e):null,e=e===null?null:e.stateNode,e};var xx={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ho=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ho.isDisabled&&ho.supportsFiber)try{ni=ho.inject(xx),ot=ho}catch{}}return Sa.createRoot=function(e,t){if(!o(e))throw Error(a(299));var i=!1,l="",c=lm,u=om,p=cm;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=$p(e,1,!1,null,null,i,l,null,c,u,p,Wp),e[Yt]=t.current,Lu(e),new rf(t)},Sa.hydrateRoot=function(e,t,i){if(!o(e))throw Error(a(299));var l=!1,c="",u=lm,p=om,b=cm,O=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(c=i.identifierPrefix),i.onUncaughtError!==void 0&&(u=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(b=i.onRecoverableError),i.formState!==void 0&&(O=i.formState)),t=$p(e,1,!0,t,i??null,l,c,O,u,p,b,Wp),t.context=Yp(null),i=t.current,l=Xt(),l=Gn(l),c=js(l),c.callback=null,Ts(i,c,l),i=l,t.current.lanes=i,Sn(t,i),qn(t),e[Yt]=t.current,Lu(e),new fo(t)},Sa.version="19.2.4",Sa}var l0;function rv(){if(l0)return af.exports;l0=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(n){console.error(n)}}return r(),af.exports=iv(),af.exports}var av=rv();const lv="modulepreload",ov=function(r,n){return new URL(r,n).href},o0={},_e=function(n,s,a){let o=Promise.resolve();if(s&&s.length>0){let h=function(E){return Promise.all(E.map(w=>Promise.resolve(w).then(j=>({status:"fulfilled",value:j}),j=>({status:"rejected",reason:j}))))};const d=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),y=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=h(s.map(E=>{if(E=ov(E,a),E in o0)return;o0[E]=!0;const w=E.endsWith(".css"),j=w?'[rel="stylesheet"]':"";if(!!a)for(let D=d.length-1;D>=0;D--){const W=d[D];if(W.href===E&&(!w||W.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${E}"]${j}`))return;const M=document.createElement("link");if(M.rel=w?"stylesheet":lv,w||(M.as="script"),M.crossOrigin="",M.href=E,y&&M.setAttribute("nonce",y),document.head.appendChild(M),w)return new Promise((D,W)=>{M.addEventListener("load",D),M.addEventListener("error",()=>W(new Error(`Unable to preload CSS for ${E}`)))})}))}function f(h){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=h,window.dispatchEvent(d),!d.defaultPrevented)throw h}return o.then(h=>{for(const d of h||[])d.status==="rejected"&&f(d.reason);return n().catch(f)})};function Kf(r){try{const n=r.split(".");if(n.length!==3)return null;const s=atob(n[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function mg(r){const n=Kf(r);return!n||typeof n.exp!="number"?null:n.exp}function Zf(r,n=0){const s=mg(r);return s===null?!0:Date.now()/1e3>=s-n}const Wt=window.__LT_BASE__??"",Af=`${Wt}/api`;let Fs=null;function mo(r){Fs=r}function pg(){return Fs}async function c0(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:n,password:s}=JSON.parse(r),a=await fetch(`${Af}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:s})});if(!a.ok)return null;const o=await a.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let Gs=null;async function Ve(r,n={}){const s={"Content-Type":"application/json",...n.headers};if(Fs){if(Zf(Fs)){Gs||(Gs=c0().finally(()=>{Gs=null}));const o=await Gs;if(o)Fs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${Fs}`}let a=await fetch(`${Af}${r}`,{...n,headers:s});if(a.status===401&&Fs){Gs||(Gs=c0().finally(()=>{Gs=null}));const o=await Gs;if(o&&(Fs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}})),s.Authorization=`Bearer ${o}`,a=await fetch(`${Af}${r}`,{...n,headers:s})),a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!a.ok){const o=await a.json().catch(()=>({error:a.statusText}));throw new Error(o.message||o.error||a.statusText)}return a.json()}const gg=T.createContext(null),cv=300;function cf(r,n){if(Zf(r))return null;const s=Kf(r);if(!s)return null;const a=n??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(a==null?void 0:a.displayName)??null,username:(a==null?void 0:a.username)??null,roles:s.roles??[]}}function uv({children:r}){const[n,s]=T.useState(()=>{const w=sessionStorage.getItem("lt_token");return w?Zf(w)?(sessionStorage.removeItem("lt_token"),null):(mo(w),cf(w)):null}),a=T.useRef(void 0),o=T.useCallback(w=>{clearTimeout(a.current);const j=mg(w);if(!j)return;const q=(j-cv)*1e3-Date.now();q<=0||(a.current=setTimeout(async()=>{try{const M=Kf(w);if(M!=null&&M.sso){const re=await fetch(`${Wt}/api/auth/sso`,{method:"POST"});if(!re.ok)return;const C=await re.json();C.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:C.token}}));return}const D=sessionStorage.getItem("lt_credentials");if(!D)return;const{username:W,password:se}=JSON.parse(D),ee=await fetch(`${Wt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:W,password:se})});if(!ee.ok)return;const me=await ee.json();me.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:me.token}}))}catch{}},q))},[]),f=T.useCallback((w,j,q)=>{const M={displayName:(q==null?void 0:q.displayName)??null,username:(q==null?void 0:q.username)??(j==null?void 0:j.username)??null},D=cf(w,M);D&&(mo(w),sessionStorage.setItem("lt_token",w),sessionStorage.setItem("lt_user_info",JSON.stringify(M)),j&&sessionStorage.setItem("lt_credentials",JSON.stringify(j)),s(D),o(w))},[o]),h=T.useCallback(()=>{clearTimeout(a.current);const w=sessionStorage.getItem("lt_sso_logout_url");mo(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),w&&(window.location.href=w)},[]);T.useEffect(()=>{const w=()=>h(),j=q=>{var W;const M=(W=q.detail)==null?void 0:W.token;if(!M)return;const D=cf(M);D&&(mo(M),sessionStorage.setItem("lt_token",M),s(D),o(M))};return window.addEventListener("auth:unauthorized",w),window.addEventListener("auth:refreshed",j),()=>{window.removeEventListener("auth:unauthorized",w),window.removeEventListener("auth:refreshed",j)}},[h,o]),T.useEffect(()=>{const w=sessionStorage.getItem("lt_token");return w&&n&&o(w),()=>clearTimeout(a.current)},[]);const d=(n==null?void 0:n.roles.some(w=>w.type==="superadmin"))??!1,g=T.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.role===w))??!1,[n]),y=T.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.type===w))??!1,[n]),E=(n==null?void 0:n.roles.map(w=>w.role))??[];return m.jsx(gg.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:d,login:f,logout:h,hasRole:g,hasRoleType:y,userRoleNames:E},children:r})}function Oi(){const r=T.useContext(gg);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const nn=new Uint8Array(0),ji=new TextEncoder,en=new TextDecoder;function fv(...r){let n=0;for(let o=0;o<r.length;o++)n+=r[o].length;const s=new Uint8Array(n);let a=0;for(let o=0;o<r.length;o++)s.set(r[o],a),a+=r[o].length;return s}function Ra(...r){const n=[];for(let s=0;s<r.length;s++)n.push(ji.encode(r[s]));return n.length===0?nn:n.length===1?n[0]:fv(...n)}function u0(r){return!r||r.length===0?"":en.decode(r)}const f0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",h0=36,hv=0xcfd41b9100000,d0=33,dv=333,m0=22;function mv(r){for(let n=0;n<r.length;n++)r[n]=Math.floor(Math.random()*255)}function pv(r){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(r):mv(r)}class gv{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(m0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*hv),this.inc=Math.floor(Math.random()*(dv-d0)+d0)}setPre(){const n=new Uint8Array(12);pv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=f0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=m0-1;s>=12;s--)this.buf[s]=f0.charCodeAt(n%h0),n=Math.floor(n/h0)}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 Ks=new gv;var us;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(us||(us={}));var br;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(br||(br={}));var ie;(function(r){r.ApiError="BAD API",r.BadAuthentication="BAD_AUTHENTICATION",r.BadCreds="BAD_CREDS",r.BadHeader="BAD_HEADER",r.BadJson="BAD_JSON",r.BadPayload="BAD_PAYLOAD",r.BadSubject="BAD_SUBJECT",r.Cancelled="CANCELLED",r.ConnectionClosed="CONNECTION_CLOSED",r.ConnectionDraining="CONNECTION_DRAINING",r.ConnectionRefused="CONNECTION_REFUSED",r.ConnectionTimeout="CONNECTION_TIMEOUT",r.Disconnect="DISCONNECT",r.InvalidOption="INVALID_OPTION",r.InvalidPayload="INVALID_PAYLOAD",r.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",r.NoResponders="503",r.NotFunction="NOT_FUNC",r.RequestError="REQUEST_ERROR",r.ServerOptionNotAvailable="SERVER_OPT_NA",r.SubClosed="SUB_CLOSED",r.SubDraining="SUB_DRAINING",r.Timeout="TIMEOUT",r.Tls="TLS",r.Unknown="UNKNOWN_ERROR",r.WssRequired="WSS_REQUIRED",r.JetStreamInvalidAck="JESTREAM_INVALID_ACK",r.JetStream404NoMessages="404",r.JetStream408RequestTimeout="408",r.JetStream409MaxAckPendingExceeded="409",r.JetStream409="409",r.JetStreamNotEnabled="503",r.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",r.AuthorizationViolation="AUTHORIZATION_VIOLATION",r.AuthenticationExpired="AUTHENTICATION_EXPIRED",r.ProtocolError="NATS_PROTOCOL_ERR",r.PermissionsViolation="PERMISSIONS_VIOLATION",r.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",r.AccountExpired="ACCOUNT_EXPIRED"})(ie||(ie={}));function yv(r){return typeof r.code=="string"}class yg{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(ie.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ie.BadJson,"Bad JSON"),this.messages.set(ie.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return bv.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const bv=new yg;class ue extends Error{constructor(s,a,o){super(s);v(this,"name");v(this,"message");v(this,"code");v(this,"permissionContext");v(this,"chainedError");v(this,"api_error");this.name="NatsError",this.message=s,this.code=a,this.chainedError=o}static errorForCode(s,a){const o=yg.getMessage(s);return new ue(o,s,a)}isAuthError(){return this.code===ie.AuthenticationExpired||this.code===ie.AuthorizationViolation||this.code===ie.AccountExpired}isAuthTimeout(){return this.code===ie.AuthenticationTimeout}isPermissionError(){return this.code===ie.PermissionsViolation}isProtocolError(){return this.code===ie.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Kt;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(Kt||(Kt={}));var Cn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(Cn||(Cn={}));var Da;(function(r){r.STATS="io.nats.micro.v1.stats_response",r.INFO="io.nats.micro.v1.info_response",r.PING="io.nats.micro.v1.ping_response"})(Da||(Da={}));const ko="Nats-Service-Error",Mo="Nats-Service-Error-Code";class Ro extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Ro.toServiceError(s)!==null}static toServiceError(s){var o,f;const a=((o=s==null?void 0:s.headers)==null?void 0:o.get(Mo))||"";if(a!==""){const h=parseInt(a)||400,d=((f=s==null?void 0:s.headers)==null?void 0:f.get(ko))||"";return new Ro(h,d.length?d:a)}return null}}function fs(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${Ks.next()}`}const Of="127.0.0.1";var Js;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(Js||(Js={}));function Yo(r,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(o){r[o]=a[o]})}return r}function po(r){return en.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Sr(r,n=!0){const s=n?ue.errorForCode(ie.Timeout):null;let a,o;const f=new Promise((h,d)=>{a={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{d(s===null?ue.errorForCode(ie.Timeout):s)},r)});return Object.assign(f,a)}function jr(r=0){let n;const s=new Promise(a=>{const o=setTimeout(()=>{a()},r);n={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,n)}function st(){let r={};const n=new Promise((s,a)=>{r={resolve:s,reject:a}});return Object.assign(n,r)}function bg(r){for(let n=r.length-1;n>0;n--){const s=Math.floor(Math.random()*(n+1));[r[n],r[s]]=[r[s],r[n]]}return r}function xv(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function Wf(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const n=r.length-1;return{backoff(s){return xv(s>n?r[n]:r[s])}}}function nt(r){return r*1e6}function eh(r){return Math.floor(r/1e6)}function p0(r){let a=!0;const o=new Array(r.length);for(let f=0;f<r.length;f++){let h=r.charCodeAt(f);if(h===58||h<33||h>126)throw new ue(`'${r[f]}' is not a valid character for a header key`,ie.BadHeader);a&&97<=h&&h<=122?h-=32:!a&&65<=h&&h<=90&&(h+=32),o[f]=h,a=h==45}return String.fromCharCode(...o)}function hs(r=0,n=""){if(r===0&&n!==""||r>0&&n==="")throw new Error("setting status requires both code and description");return new Qs(r,n)}const uf="NATS/1.0";class Qs{constructor(n=0,s=""){v(this,"_code");v(this,"headers");v(this,"_description");this._code=n,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[s,a]of this.headers){const o=n.values(s);if(a.length!==o.length)return!1;const f=[...a].sort(),h=[...o].sort();for(let d=0;d<f.length;d++)if(f[d]!==h[d])return!1}return!0}return!1}static decode(n){const s=new Qs,o=en.decode(n).split(`\r
|
|
27
|
-
`),f=o[0];if(f!==
|
|
25
|
+
`+l.stack}}var Cr=Object.prototype.hasOwnProperty,kr=r.unstable_scheduleCallback,Yn=r.unstable_cancelCallback,Qa=r.unstable_shouldYield,ki=r.unstable_requestPaint,et=r.unstable_now,Xo=r.unstable_getCurrentPriorityLevel,Xa=r.unstable_ImmediatePriority,Ka=r.unstable_UserBlockingPriority,Mi=r.unstable_NormalPriority,Ko=r.unstable_LowPriority,Za=r.unstable_IdlePriority,Zo=r.log,Wa=r.unstable_setDisableYieldValue,ni=null,ot=null;function $t(e){if(typeof Zo=="function"&&Wa(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(ni,e)}catch{}}var Nt=Math.clz32?Math.clz32:Ri,Mr=Math.log,Rr=Math.LN2;function Ri(e){return e>>>=0,e===0?32:31-(Mr(e)/Rr|0)|0}var ps=256,Gn=262144,gs=4194304;function wn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function si(e,t,i){var l=e.pendingLanes;if(l===0)return 0;var c=0,u=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?c=wn(l):(p&=b,p!==0?c=wn(p):i||(i=b&~e,i!==0&&(c=wn(i))))):(b=l&~u,b!==0?c=wn(b):p!==0?c=wn(p):i||(i=l&~e,i!==0&&(c=wn(i)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,i=t&-t,u>=i||u===32&&(i&4194048)!==0)?t:c}function ii(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Dr(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Di(){var e=gs;return gs<<=1,(gs&62914560)===0&&(gs=4194304),e}function ys(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function Sn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function bs(e,t,i,l,c,u){var p=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var b=e.entanglements,j=e.expirationTimes,B=e.hiddenUpdates;for(i=p&~i;0<i;){var Y=31-Nt(i),Q=1<<Y;b[Y]=0,j[Y]=-1;var L=B[Y];if(L!==null)for(B[Y]=null,Y=0;Y<L.length;Y++){var P=L[Y];P!==null&&(P.lane&=-536870913)}i&=~Q}l!==0&&xs(e,l,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(p&~t))}function xs(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Nt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function ri(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var l=31-Nt(i),c=1<<l;c&t|e[l]&t&&(e[l]|=t),i&=~c}}function vs(e,t){var i=t&-t;return i=(i&42)!==0?1:Vn(i),(i&(e.suspendedLanes|t))!==0?0:i}function Vn(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ai(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function zr(){var e=te.p;return e!==0?e:(e=window.event,e===void 0?32:Qp(e.type))}function el(e,t){var i=te.p;try{return te.p=e,t()}finally{te.p=i}}var Mn=Math.random().toString(36).slice(2),Qe="__reactFiber$"+Mn,it="__reactProps$"+Mn,Yt="__reactContainer$"+Mn,li="__reactEvents$"+Mn,qr="__reactListeners$"+Mn,tl="__reactHandles$"+Mn,nl="__reactResources$"+Mn,yt="__reactMarker$"+Mn;function zi(e){delete e[Qe],delete e[it],delete e[li],delete e[qr],delete e[tl]}function x(e){var t=e[Qe];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Yt]||i[Qe]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Rp(e);e!==null;){if(i=e[Qe])return i;e=Rp(e)}return t}e=i,i=e.parentNode}return null}function S(e){if(e=e[Qe]||e[Yt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function A(e){var t=e[nl];return t||(t=e[nl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function N(e){e[yt]=!0}var z=new Set,I={};function Z(e,t){H(e,t),H(e+"Capture",t)}function H(e,t){for(I[e]=t,e=0;e<t.length;e++)z.add(t[e])}var J=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]*$"),fe={},je={};function Ke(e){return Cr.call(je,e)?!0:Cr.call(fe,e)?!1:J.test(e)?je[e]=!0:(fe[e]=!0,!1)}function Ct(e,t,i){if(Ke(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function En(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function Fn(e,t,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+l)}}function on(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function yh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function my(e,t,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var c=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){i=""+p,u.call(this,p)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(p){i=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Wo(e){if(!e._valueTracker){var t=yh(e)?"checked":"value";e._valueTracker=my(e,t,""+e[t])}}function bh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),l="";return e&&(l=yh(e)?e.checked?"true":"false":e.value),e=l,e!==i?(t.setValue(e),!0):!1}function sl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var py=/[\n"\\]/g;function cn(e){return e.replace(py,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ec(e,t,i,l,c,u,p,b){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+on(t)):e.value!==""+on(t)&&(e.value=""+on(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?tc(e,p,on(t)):i!=null?tc(e,p,on(i)):l!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+on(b):e.removeAttribute("name")}function xh(e,t,i,l,c,u,p,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||i!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Wo(e);return}i=i!=null?""+on(i):"",t=t!=null?""+on(t):i,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),Wo(e)}function tc(e,t,i){t==="number"&&sl(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function qi(e,t,i,l){if(e=e.options,t){t={};for(var c=0;c<i.length;c++)t["$"+i[c]]=!0;for(i=0;i<e.length;i++)c=t.hasOwnProperty("$"+e[i].value),e[i].selected!==c&&(e[i].selected=c),c&&l&&(e[i].defaultSelected=!0)}else{for(i=""+on(i),t=null,c=0;c<e.length;c++){if(e[c].value===i){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function vh(e,t,i){if(t!=null&&(t=""+on(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+on(i):""}function _h(e,t,i,l){if(t==null){if(l!=null){if(i!=null)throw Error(a(92));if(Me(l)){if(1<l.length)throw Error(a(93));l=l[0]}i=l}i==null&&(i=""),t=i}i=on(t),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Wo(e)}function Ui(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var gy=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function wh(e,t,i){var l=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,i):typeof i!="number"||i===0||gy.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function Sh(e,t,i){if(t!=null&&typeof t!="object")throw Error(a(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var c in t)l=t[c],t.hasOwnProperty(c)&&i[c]!==l&&wh(e,c,l)}else for(var u in t)t.hasOwnProperty(u)&&wh(e,u,t[u])}function nc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var yy=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"]]),by=/^[\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 il(e){return by.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Jn(){}var sc=null;function ic(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Bi=null,Li=null;function Eh(e){var t=S(e);if(t&&(e=t.stateNode)){var i=e[it]||null;e:switch(e=t.stateNode,t.type){case"input":if(ec(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+cn(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var l=i[t];if(l!==e&&l.form===e.form){var c=l[it]||null;if(!c)throw Error(a(90));ec(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<i.length;t++)l=i[t],l.form===e.form&&bh(l)}break e;case"textarea":vh(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&qi(e,!!i.multiple,t,!1)}}}var rc=!1;function Ah(e,t,i){if(rc)return e(t,i);rc=!0;try{var l=e(t);return l}finally{if(rc=!1,(Bi!==null||Li!==null)&&(Vl(),Bi&&(t=Bi,e=Li,Li=Bi=null,Eh(t),e)))for(t=0;t<e.length;t++)Eh(e[t])}}function Ur(e,t){var i=e.stateNode;if(i===null)return null;var l=i[it]||null;if(l===null)return null;i=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(a(231,t,typeof i));return i}var In=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ac=!1;if(In)try{var Br={};Object.defineProperty(Br,"passive",{get:function(){ac=!0}}),window.addEventListener("test",Br,Br),window.removeEventListener("test",Br,Br)}catch{ac=!1}var _s=null,lc=null,rl=null;function jh(){if(rl)return rl;var e,t=lc,i=t.length,l,c="value"in _s?_s.value:_s.textContent,u=c.length;for(e=0;e<i&&t[e]===c[e];e++);var p=i-e;for(l=1;l<=p&&t[i-l]===c[u-l];l++);return rl=c.slice(e,1<l?1-l:void 0)}function al(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ll(){return!0}function Oh(){return!1}function zt(e){function t(i,l,c,u,p){this._reactName=i,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=p,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(i=e[b],this[b]=i?i(u):u[b]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?ll:Oh,this.isPropagationStopped=Oh,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=ll)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=ll)},persist:function(){},isPersistent:ll}),t}var oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ol=zt(oi),Lr=w({},oi,{view:0,detail:0}),xy=zt(Lr),oc,cc,Hr,cl=w({},Lr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Hr&&(Hr&&e.type==="mousemove"?(oc=e.screenX-Hr.screenX,cc=e.screenY-Hr.screenY):cc=oc=0,Hr=e),oc)},movementY:function(e){return"movementY"in e?e.movementY:cc}}),Th=zt(cl),vy=w({},cl,{dataTransfer:0}),_y=zt(vy),wy=w({},Lr,{relatedTarget:0}),uc=zt(wy),Sy=w({},oi,{animationName:0,elapsedTime:0,pseudoElement:0}),Ey=zt(Sy),Ay=w({},oi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),jy=zt(Ay),Oy=w({},oi,{data:0}),Nh=zt(Oy),Ty={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ny={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"},Cy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ky(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Cy[e])?!!t[e]:!1}function fc(){return ky}var My=w({},Lr,{key:function(e){if(e.key){var t=Ty[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=al(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ny[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fc,charCode:function(e){return e.type==="keypress"?al(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?al(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ry=zt(My),Dy=w({},cl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ch=zt(Dy),zy=w({},Lr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fc}),qy=zt(zy),Uy=w({},oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),By=zt(Uy),Ly=w({},cl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Hy=zt(Ly),Py=w({},oi,{newState:0,oldState:0}),$y=zt(Py),Yy=[9,13,27,32],hc=In&&"CompositionEvent"in window,Pr=null;In&&"documentMode"in document&&(Pr=document.documentMode);var Gy=In&&"TextEvent"in window&&!Pr,kh=In&&(!hc||Pr&&8<Pr&&11>=Pr),Mh=" ",Rh=!1;function Dh(e,t){switch(e){case"keyup":return Yy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Hi=!1;function Vy(e,t){switch(e){case"compositionend":return zh(t);case"keypress":return t.which!==32?null:(Rh=!0,Mh);case"textInput":return e=t.data,e===Mh&&Rh?null:e;default:return null}}function Fy(e,t){if(Hi)return e==="compositionend"||!hc&&Dh(e,t)?(e=jh(),rl=lc=_s=null,Hi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return kh&&t.locale!=="ko"?null:t.data;default:return null}}var Jy={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 qh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Jy[e.type]:t==="textarea"}function Uh(e,t,i,l){Bi?Li?Li.push(l):Li=[l]:Bi=l,t=Zl(t,"onChange"),0<t.length&&(i=new ol("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var $r=null,Yr=null;function Iy(e){xp(e,0)}function ul(e){var t=_(e);if(bh(t))return e}function Bh(e,t){if(e==="change")return t}var Lh=!1;if(In){var dc;if(In){var mc="oninput"in document;if(!mc){var Hh=document.createElement("div");Hh.setAttribute("oninput","return;"),mc=typeof Hh.oninput=="function"}dc=mc}else dc=!1;Lh=dc&&(!document.documentMode||9<document.documentMode)}function Ph(){$r&&($r.detachEvent("onpropertychange",$h),Yr=$r=null)}function $h(e){if(e.propertyName==="value"&&ul(Yr)){var t=[];Uh(t,Yr,e,ic(e)),Ah(Iy,t)}}function Qy(e,t,i){e==="focusin"?(Ph(),$r=t,Yr=i,$r.attachEvent("onpropertychange",$h)):e==="focusout"&&Ph()}function Xy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ul(Yr)}function Ky(e,t){if(e==="click")return ul(t)}function Zy(e,t){if(e==="input"||e==="change")return ul(t)}function Wy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:Wy;function Gr(e,t){if(Gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var c=i[l];if(!Cr.call(t,c)||!Gt(e[c],t[c]))return!1}return!0}function Yh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Gh(e,t){var i=Yh(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=t&&l>=t)return{node:i,offset:t-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Yh(i)}}function Vh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Vh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Fh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=sl(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=sl(e.document)}return t}function pc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var eb=In&&"documentMode"in document&&11>=document.documentMode,Pi=null,gc=null,Vr=null,yc=!1;function Jh(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;yc||Pi==null||Pi!==sl(l)||(l=Pi,"selectionStart"in l&&pc(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}),Vr&&Gr(Vr,l)||(Vr=l,l=Zl(gc,"onSelect"),0<l.length&&(t=new ol("onSelect","select",null,t,i),e.push({event:t,listeners:l}),t.target=Pi)))}function ci(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var $i={animationend:ci("Animation","AnimationEnd"),animationiteration:ci("Animation","AnimationIteration"),animationstart:ci("Animation","AnimationStart"),transitionrun:ci("Transition","TransitionRun"),transitionstart:ci("Transition","TransitionStart"),transitioncancel:ci("Transition","TransitionCancel"),transitionend:ci("Transition","TransitionEnd")},bc={},Ih={};In&&(Ih=document.createElement("div").style,"AnimationEvent"in window||(delete $i.animationend.animation,delete $i.animationiteration.animation,delete $i.animationstart.animation),"TransitionEvent"in window||delete $i.transitionend.transition);function ui(e){if(bc[e])return bc[e];if(!$i[e])return e;var t=$i[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Ih)return bc[e]=t[i];return e}var Qh=ui("animationend"),Xh=ui("animationiteration"),Kh=ui("animationstart"),tb=ui("transitionrun"),nb=ui("transitionstart"),sb=ui("transitioncancel"),Zh=ui("transitionend"),Wh=new Map,xc="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(" ");xc.push("scrollEnd");function An(e,t){Wh.set(e,t),Z(t,[e])}var fl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},un=[],Yi=0,vc=0;function hl(){for(var e=Yi,t=vc=Yi=0;t<e;){var i=un[t];un[t++]=null;var l=un[t];un[t++]=null;var c=un[t];un[t++]=null;var u=un[t];if(un[t++]=null,l!==null&&c!==null){var p=l.pending;p===null?c.next=c:(c.next=p.next,p.next=c),l.pending=c}u!==0&&ed(i,c,u)}}function dl(e,t,i,l){un[Yi++]=e,un[Yi++]=t,un[Yi++]=i,un[Yi++]=l,vc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function _c(e,t,i,l){return dl(e,t,i,l),ml(e)}function fi(e,t){return dl(e,null,null,t),ml(e)}function ed(e,t,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var c=!1,u=e.return;u!==null;)u.childLanes|=i,l=u.alternate,l!==null&&(l.childLanes|=i),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-Nt(i),e=u.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=i|536870912),u):null}function ml(e){if(50<da)throw da=0,Cu=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Gi={};function ib(e,t,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(e,t,i,l){return new ib(e,t,i,l)}function wc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qn(e,t){var i=e.alternate;return i===null?(i=Vt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function td(e,t){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function pl(e,t,i,l,c,u){var p=0;if(l=e,typeof e=="function")wc(e)&&(p=1);else if(typeof e=="string")p=cx(e,i,lt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case G:return e=Vt(31,i,t,c),e.elementType=G,e.lanes=u,e;case D:return hi(i.children,c,u,t);case W:p=8,c|=24;break;case se:return e=Vt(12,i,t,c|2),e.elementType=se,e.lanes=u,e;case C:return e=Vt(13,i,t,c),e.elementType=C,e.lanes=u,e;case X:return e=Vt(19,i,t,c),e.elementType=X,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case me:p=10;break e;case ee:p=9;break e;case re:p=11;break e;case ce:p=14;break e;case V:p=16,l=null;break e}p=29,i=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Vt(p,i,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function hi(e,t,i,l){return e=Vt(7,e,l,t),e.lanes=i,e}function Sc(e,t,i){return e=Vt(6,e,null,t),e.lanes=i,e}function nd(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function Ec(e,t,i){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var sd=new WeakMap;function fn(e,t){if(typeof e=="object"&&e!==null){var i=sd.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Ia(t)},sd.set(e,t),t)}return{value:e,source:t,stack:Ia(t)}}var Vi=[],Fi=0,gl=null,Fr=0,hn=[],dn=0,ws=null,Rn=1,Dn="";function Xn(e,t){Vi[Fi++]=Fr,Vi[Fi++]=gl,gl=e,Fr=t}function id(e,t,i){hn[dn++]=Rn,hn[dn++]=Dn,hn[dn++]=ws,ws=e;var l=Rn;e=Dn;var c=32-Nt(l)-1;l&=~(1<<c),i+=1;var u=32-Nt(t)+c;if(30<u){var p=c-c%5;u=(l&(1<<p)-1).toString(32),l>>=p,c-=p,Rn=1<<32-Nt(t)+c|i<<c|l,Dn=u+e}else Rn=1<<u|i<<c|l,Dn=e}function Ac(e){e.return!==null&&(Xn(e,1),id(e,1,0))}function jc(e){for(;e===gl;)gl=Vi[--Fi],Vi[Fi]=null,Fr=Vi[--Fi],Vi[Fi]=null;for(;e===ws;)ws=hn[--dn],hn[dn]=null,Dn=hn[--dn],hn[dn]=null,Rn=hn[--dn],hn[dn]=null}function rd(e,t){hn[dn++]=Rn,hn[dn++]=Dn,hn[dn++]=ws,Rn=t.id,Dn=t.overflow,ws=e}var wt=null,Ze=null,ze=!1,Ss=null,mn=!1,Oc=Error(a(519));function Es(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jr(fn(t,e)),Oc}function ad(e){var t=e.stateNode,i=e.type,l=e.memoizedProps;switch(t[Qe]=e,t[it]=l,i){case"dialog":Ce("cancel",t),Ce("close",t);break;case"iframe":case"object":case"embed":Ce("load",t);break;case"video":case"audio":for(i=0;i<pa.length;i++)Ce(pa[i],t);break;case"source":Ce("error",t);break;case"img":case"image":case"link":Ce("error",t),Ce("load",t);break;case"details":Ce("toggle",t);break;case"input":Ce("invalid",t),xh(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ce("invalid",t);break;case"textarea":Ce("invalid",t),_h(t,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||l.suppressHydrationWarning===!0||Sp(t.textContent,i)?(l.popover!=null&&(Ce("beforetoggle",t),Ce("toggle",t)),l.onScroll!=null&&Ce("scroll",t),l.onScrollEnd!=null&&Ce("scrollend",t),l.onClick!=null&&(t.onclick=Jn),t=!0):t=!1,t||Es(e,!0)}function ld(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:mn=!1;return;case 27:case 3:mn=!0;return;default:wt=wt.return}}function Ji(e){if(e!==wt)return!1;if(!ze)return ld(e),ze=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Vu(e.type,e.memoizedProps)),i=!i),i&&Ze&&Es(e),ld(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Mp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Mp(e)}else t===27?(t=Ze,Bs(e.type)?(e=Xu,Xu=null,Ze=e):Ze=t):Ze=wt?gn(e.stateNode.nextSibling):null;return!0}function di(){Ze=wt=null,ze=!1}function Tc(){var e=Ss;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),Ss=null),e}function Jr(e){Ss===null?Ss=[e]:Ss.push(e)}var Nc=Oe(null),mi=null,Kn=null;function As(e,t,i){Te(Nc,t._currentValue),t._currentValue=i}function Zn(e){e._currentValue=Nc.current,we(Nc)}function Cc(e,t,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===i)break;e=e.return}}function kc(e,t,i,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var p=c.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=c;for(var j=0;j<t.length;j++)if(b.context===t[j]){u.lanes|=i,b=u.alternate,b!==null&&(b.lanes|=i),Cc(u.return,i,e),l||(p=null);break e}u=b.next}}else if(c.tag===18){if(p=c.return,p===null)throw Error(a(341));p.lanes|=i,u=p.alternate,u!==null&&(u.lanes|=i),Cc(p,i,e),p=null}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===e){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}}function Ii(e,t,i,l){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var p=c.alternate;if(p===null)throw Error(a(387));if(p=p.memoizedProps,p!==null){var b=c.type;Gt(c.pendingProps.value,p.value)||(e!==null?e.push(b):e=[b])}}else if(c===jt.current){if(p=c.alternate,p===null)throw Error(a(387));p.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(va):e=[va])}c=c.return}e!==null&&kc(t,e,i,l),t.flags|=262144}function yl(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function pi(e){mi=e,Kn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return od(mi,e)}function bl(e,t){return mi===null&&pi(e),od(e,t)}function od(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Kn===null){if(e===null)throw Error(a(308));Kn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Kn=Kn.next=t;return i}var rb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},ab=r.unstable_scheduleCallback,lb=r.unstable_NormalPriority,ht={$$typeof:me,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Mc(){return{controller:new rb,data:new Map,refCount:0}}function Ir(e){e.refCount--,e.refCount===0&&ab(lb,function(){e.controller.abort()})}var Qr=null,Rc=0,Qi=0,Xi=null;function ob(e,t){if(Qr===null){var i=Qr=[];Rc=0,Qi=qu(),Xi={status:"pending",value:void 0,then:function(l){i.push(l)}}}return Rc++,t.then(cd,cd),t}function cd(){if(--Rc===0&&Qr!==null){Xi!==null&&(Xi.status="fulfilled");var e=Qr;Qr=null,Qi=0,Xi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function cb(e,t){var i=[],l={status:"pending",value:null,reason:null,then:function(c){i.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<i.length;c++)(0,i[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<i.length;c++)(0,i[c])(void 0)}),l}var ud=$.S;$.S=function(e,t){Jm=et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ob(e,t),ud!==null&&ud(e,t)};var gi=Oe(null);function Dc(){var e=gi.current;return e!==null?e:Xe.pooledCache}function xl(e,t){t===null?Te(gi,gi.current):Te(gi,t.pool)}function fd(){var e=Dc();return e===null?null:{parent:ht._currentValue,pool:e}}var Ki=Error(a(460)),zc=Error(a(474)),vl=Error(a(542)),_l={then:function(){}};function hd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function dd(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Jn,Jn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,pd(e),e;default:if(typeof t.status=="string")t.then(Jn,Jn);else{if(e=Xe,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,pd(e),e}throw bi=t,Ki}}function yi(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(bi=i,Ki):i}}var bi=null;function md(){if(bi===null)throw Error(a(459));var e=bi;return bi=null,e}function pd(e){if(e===Ki||e===vl)throw Error(a(483))}var Zi=null,Xr=0;function wl(e){var t=Xr;return Xr+=1,Zi===null&&(Zi=[]),dd(Zi,e,t)}function Kr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Sl(e,t){throw t.$$typeof===O?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function gd(e){function t(R,k){if(e){var U=R.deletions;U===null?(R.deletions=[k],R.flags|=16):U.push(k)}}function i(R,k){if(!e)return null;for(;k!==null;)t(R,k),k=k.sibling;return null}function l(R){for(var k=new Map;R!==null;)R.key!==null?k.set(R.key,R):k.set(R.index,R),R=R.sibling;return k}function c(R,k){return R=Qn(R,k),R.index=0,R.sibling=null,R}function u(R,k,U){return R.index=U,e?(U=R.alternate,U!==null?(U=U.index,U<k?(R.flags|=67108866,k):U):(R.flags|=67108866,k)):(R.flags|=1048576,k)}function p(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function b(R,k,U,F){return k===null||k.tag!==6?(k=Sc(U,R.mode,F),k.return=R,k):(k=c(k,U),k.return=R,k)}function j(R,k,U,F){var ge=U.type;return ge===D?Y(R,k,U.props.children,F,U.key):k!==null&&(k.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&yi(ge)===k.type)?(k=c(k,U.props),Kr(k,U),k.return=R,k):(k=pl(U.type,U.key,U.props,null,R.mode,F),Kr(k,U),k.return=R,k)}function B(R,k,U,F){return k===null||k.tag!==4||k.stateNode.containerInfo!==U.containerInfo||k.stateNode.implementation!==U.implementation?(k=Ec(U,R.mode,F),k.return=R,k):(k=c(k,U.children||[]),k.return=R,k)}function Y(R,k,U,F,ge){return k===null||k.tag!==7?(k=hi(U,R.mode,F,ge),k.return=R,k):(k=c(k,U),k.return=R,k)}function Q(R,k,U){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return k=Sc(""+k,R.mode,U),k.return=R,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case q:return U=pl(k.type,k.key,k.props,null,R.mode,U),Kr(U,k),U.return=R,U;case M:return k=Ec(k,R.mode,U),k.return=R,k;case V:return k=yi(k),Q(R,k,U)}if(Me(k)||ne(k))return k=hi(k,R.mode,U,null),k.return=R,k;if(typeof k.then=="function")return Q(R,wl(k),U);if(k.$$typeof===me)return Q(R,bl(R,k),U);Sl(R,k)}return null}function L(R,k,U,F){var ge=k!==null?k.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return ge!==null?null:b(R,k,""+U,F);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case q:return U.key===ge?j(R,k,U,F):null;case M:return U.key===ge?B(R,k,U,F):null;case V:return U=yi(U),L(R,k,U,F)}if(Me(U)||ne(U))return ge!==null?null:Y(R,k,U,F,null);if(typeof U.then=="function")return L(R,k,wl(U),F);if(U.$$typeof===me)return L(R,k,bl(R,U),F);Sl(R,U)}return null}function P(R,k,U,F,ge){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return R=R.get(U)||null,b(k,R,""+F,ge);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case q:return R=R.get(F.key===null?U:F.key)||null,j(k,R,F,ge);case M:return R=R.get(F.key===null?U:F.key)||null,B(k,R,F,ge);case V:return F=yi(F),P(R,k,U,F,ge)}if(Me(F)||ne(F))return R=R.get(U)||null,Y(k,R,F,ge,null);if(typeof F.then=="function")return P(R,k,U,wl(F),ge);if(F.$$typeof===me)return P(R,k,U,bl(k,F),ge);Sl(k,F)}return null}function he(R,k,U,F){for(var ge=null,Be=null,pe=k,Ae=k=0,De=null;pe!==null&&Ae<U.length;Ae++){pe.index>Ae?(De=pe,pe=null):De=pe.sibling;var Le=L(R,pe,U[Ae],F);if(Le===null){pe===null&&(pe=De);break}e&&pe&&Le.alternate===null&&t(R,pe),k=u(Le,k,Ae),Be===null?ge=Le:Be.sibling=Le,Be=Le,pe=De}if(Ae===U.length)return i(R,pe),ze&&Xn(R,Ae),ge;if(pe===null){for(;Ae<U.length;Ae++)pe=Q(R,U[Ae],F),pe!==null&&(k=u(pe,k,Ae),Be===null?ge=pe:Be.sibling=pe,Be=pe);return ze&&Xn(R,Ae),ge}for(pe=l(pe);Ae<U.length;Ae++)De=P(pe,R,Ae,U[Ae],F),De!==null&&(e&&De.alternate!==null&&pe.delete(De.key===null?Ae:De.key),k=u(De,k,Ae),Be===null?ge=De:Be.sibling=De,Be=De);return e&&pe.forEach(function(Ys){return t(R,Ys)}),ze&&Xn(R,Ae),ge}function ye(R,k,U,F){if(U==null)throw Error(a(151));for(var ge=null,Be=null,pe=k,Ae=k=0,De=null,Le=U.next();pe!==null&&!Le.done;Ae++,Le=U.next()){pe.index>Ae?(De=pe,pe=null):De=pe.sibling;var Ys=L(R,pe,Le.value,F);if(Ys===null){pe===null&&(pe=De);break}e&&pe&&Ys.alternate===null&&t(R,pe),k=u(Ys,k,Ae),Be===null?ge=Ys:Be.sibling=Ys,Be=Ys,pe=De}if(Le.done)return i(R,pe),ze&&Xn(R,Ae),ge;if(pe===null){for(;!Le.done;Ae++,Le=U.next())Le=Q(R,Le.value,F),Le!==null&&(k=u(Le,k,Ae),Be===null?ge=Le:Be.sibling=Le,Be=Le);return ze&&Xn(R,Ae),ge}for(pe=l(pe);!Le.done;Ae++,Le=U.next())Le=P(pe,R,Ae,Le.value,F),Le!==null&&(e&&Le.alternate!==null&&pe.delete(Le.key===null?Ae:Le.key),k=u(Le,k,Ae),Be===null?ge=Le:Be.sibling=Le,Be=Le);return e&&pe.forEach(function(vx){return t(R,vx)}),ze&&Xn(R,Ae),ge}function Ie(R,k,U,F){if(typeof U=="object"&&U!==null&&U.type===D&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case q:e:{for(var ge=U.key;k!==null;){if(k.key===ge){if(ge=U.type,ge===D){if(k.tag===7){i(R,k.sibling),F=c(k,U.props.children),F.return=R,R=F;break e}}else if(k.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&yi(ge)===k.type){i(R,k.sibling),F=c(k,U.props),Kr(F,U),F.return=R,R=F;break e}i(R,k);break}else t(R,k);k=k.sibling}U.type===D?(F=hi(U.props.children,R.mode,F,U.key),F.return=R,R=F):(F=pl(U.type,U.key,U.props,null,R.mode,F),Kr(F,U),F.return=R,R=F)}return p(R);case M:e:{for(ge=U.key;k!==null;){if(k.key===ge)if(k.tag===4&&k.stateNode.containerInfo===U.containerInfo&&k.stateNode.implementation===U.implementation){i(R,k.sibling),F=c(k,U.children||[]),F.return=R,R=F;break e}else{i(R,k);break}else t(R,k);k=k.sibling}F=Ec(U,R.mode,F),F.return=R,R=F}return p(R);case V:return U=yi(U),Ie(R,k,U,F)}if(Me(U))return he(R,k,U,F);if(ne(U)){if(ge=ne(U),typeof ge!="function")throw Error(a(150));return U=ge.call(U),ye(R,k,U,F)}if(typeof U.then=="function")return Ie(R,k,wl(U),F);if(U.$$typeof===me)return Ie(R,k,bl(R,U),F);Sl(R,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,k!==null&&k.tag===6?(i(R,k.sibling),F=c(k,U),F.return=R,R=F):(i(R,k),F=Sc(U,R.mode,F),F.return=R,R=F),p(R)):i(R,k)}return function(R,k,U,F){try{Xr=0;var ge=Ie(R,k,U,F);return Zi=null,ge}catch(pe){if(pe===Ki||pe===vl)throw pe;var Be=Vt(29,pe,null,R.mode);return Be.lanes=F,Be.return=R,Be}finally{}}}var xi=gd(!0),yd=gd(!1),js=!1;function qc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Uc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Os(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ts(e,t,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Pe&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=ml(e),ed(e,null,i),t}return dl(e,l,t,i),ml(e)}function Zr(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}function Bc(e,t){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var c=null,u=null;if(i=i.firstBaseUpdate,i!==null){do{var p={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};u===null?c=u=p:u=u.next=p,i=i.next}while(i!==null);u===null?c=u=t:u=u.next=t}else c=u=t;i={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var Lc=!1;function Wr(){if(Lc){var e=Xi;if(e!==null)throw e}}function ea(e,t,i,l){Lc=!1;var c=e.updateQueue;js=!1;var u=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var j=b,B=j.next;j.next=null,p===null?u=B:p.next=B,p=j;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,b=Y.lastBaseUpdate,b!==p&&(b===null?Y.firstBaseUpdate=B:b.next=B,Y.lastBaseUpdate=j))}if(u!==null){var Q=c.baseState;p=0,Y=B=j=null,b=u;do{var L=b.lane&-536870913,P=L!==b.lane;if(P?(Re&L)===L:(l&L)===L){L!==0&&L===Qi&&(Lc=!0),Y!==null&&(Y=Y.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var he=e,ye=b;L=t;var Ie=i;switch(ye.tag){case 1:if(he=ye.payload,typeof he=="function"){Q=he.call(Ie,Q,L);break e}Q=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ye.payload,L=typeof he=="function"?he.call(Ie,Q,L):he,L==null)break e;Q=w({},Q,L);break e;case 2:js=!0}}L=b.callback,L!==null&&(e.flags|=64,P&&(e.flags|=8192),P=c.callbacks,P===null?c.callbacks=[L]:P.push(L))}else P={lane:L,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Y===null?(B=Y=P,j=Q):Y=Y.next=P,p|=L;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;P=b,b=P.next,P.next=null,c.lastBaseUpdate=P,c.shared.pending=null}}while(!0);Y===null&&(j=Q),c.baseState=j,c.firstBaseUpdate=B,c.lastBaseUpdate=Y,u===null&&(c.shared.lanes=0),Rs|=p,e.lanes=p,e.memoizedState=Q}}function bd(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function xd(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)bd(i[e],t)}var Wi=Oe(null),El=Oe(0);function vd(e,t){e=ls,Te(El,e),Te(Wi,t),ls=e|t.baseLanes}function Hc(){Te(El,ls),Te(Wi,Wi.current)}function Pc(){ls=El.current,we(Wi),we(El)}var Ft=Oe(null),pn=null;function Ns(e){var t=e.alternate;Te(ct,ct.current&1),Te(Ft,e),pn===null&&(t===null||Wi.current!==null||t.memoizedState!==null)&&(pn=e)}function $c(e){Te(ct,ct.current),Te(Ft,e),pn===null&&(pn=e)}function _d(e){e.tag===22?(Te(ct,ct.current),Te(Ft,e),pn===null&&(pn=e)):Cs()}function Cs(){Te(ct,ct.current),Te(Ft,Ft.current)}function Jt(e){we(Ft),pn===e&&(pn=null),we(ct)}var ct=Oe(0);function Al(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Iu(i)||Qu(i)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Wn=0,Ee=null,Fe=null,dt=null,jl=!1,er=!1,vi=!1,Ol=0,ta=0,tr=null,ub=0;function rt(){throw Error(a(321))}function Yc(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Gt(e[i],t[i]))return!1;return!0}function Gc(e,t,i,l,c,u){return Wn=u,Ee=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?im:ru,vi=!1,u=i(l,c),vi=!1,er&&(u=Sd(t,i,l,c)),wd(e),u}function wd(e){$.H=ia;var t=Fe!==null&&Fe.next!==null;if(Wn=0,dt=Fe=Ee=null,jl=!1,ta=0,tr=null,t)throw Error(a(300));e===null||mt||(e=e.dependencies,e!==null&&yl(e)&&(mt=!0))}function Sd(e,t,i,l){Ee=e;var c=0;do{if(er&&(tr=null),ta=0,er=!1,25<=c)throw Error(a(301));if(c+=1,dt=Fe=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}$.H=rm,u=t(i,l)}while(er);return u}function fb(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?na(t):t,e=e.useState()[0],(Fe!==null?Fe.memoizedState:null)!==e&&(Ee.flags|=1024),t}function Vc(){var e=Ol!==0;return Ol=0,e}function Fc(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Jc(e){if(jl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}jl=!1}Wn=0,dt=Fe=Ee=null,er=!1,ta=Ol=0,tr=null}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Ee.memoizedState=dt=e:dt=dt.next=e,dt}function ut(){if(Fe===null){var e=Ee.alternate;e=e!==null?e.memoizedState:null}else e=Fe.next;var t=dt===null?Ee.memoizedState:dt.next;if(t!==null)dt=t,Fe=e;else{if(e===null)throw Ee.alternate===null?Error(a(467)):Error(a(310));Fe=e,e={memoizedState:Fe.memoizedState,baseState:Fe.baseState,baseQueue:Fe.baseQueue,queue:Fe.queue,next:null},dt===null?Ee.memoizedState=dt=e:dt=dt.next=e}return dt}function Tl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function na(e){var t=ta;return ta+=1,tr===null&&(tr=[]),e=dd(tr,e,t),t=Ee,(dt===null?t.memoizedState:dt.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?im:ru),e}function Nl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return na(e);if(e.$$typeof===me)return St(e)}throw Error(a(438,String(e)))}function Ic(e){var t=null,i=Ee.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var l=Ee.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=Tl(),Ee.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),l=0;l<e;l++)i[l]=K;return t.index++,i}function es(e,t){return typeof t=="function"?t(e):t}function Cl(e){var t=ut();return Qc(t,Fe,e)}function Qc(e,t,i){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=i;var c=e.baseQueue,u=l.pending;if(u!==null){if(c!==null){var p=c.next;c.next=u.next,u.next=p}t.baseQueue=c=u,l.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var b=p=null,j=null,B=t,Y=!1;do{var Q=B.lane&-536870913;if(Q!==B.lane?(Re&Q)===Q:(Wn&Q)===Q){var L=B.revertLane;if(L===0)j!==null&&(j=j.next={lane:0,revertLane:0,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),Q===Qi&&(Y=!0);else if((Wn&L)===L){B=B.next,L===Qi&&(Y=!0);continue}else Q={lane:0,revertLane:B.revertLane,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},j===null?(b=j=Q,p=u):j=j.next=Q,Ee.lanes|=L,Rs|=L;Q=B.action,vi&&i(u,Q),u=B.hasEagerState?B.eagerState:i(u,Q)}else L={lane:Q,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},j===null?(b=j=L,p=u):j=j.next=L,Ee.lanes|=Q,Rs|=Q;B=B.next}while(B!==null&&B!==t);if(j===null?p=u:j.next=b,!Gt(u,e.memoizedState)&&(mt=!0,Y&&(i=Xi,i!==null)))throw i;e.memoizedState=u,e.baseState=p,e.baseQueue=j,l.lastRenderedState=u}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Xc(e){var t=ut(),i=t.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=e;var l=i.dispatch,c=i.pending,u=t.memoizedState;if(c!==null){i.pending=null;var p=c=c.next;do u=e(u,p.action),p=p.next;while(p!==c);Gt(u,t.memoizedState)||(mt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),i.lastRenderedState=u}return[u,l]}function Ed(e,t,i){var l=Ee,c=ut(),u=ze;if(u){if(i===void 0)throw Error(a(407));i=i()}else i=t();var p=!Gt((Fe||c).memoizedState,i);if(p&&(c.memoizedState=i,mt=!0),c=c.queue,Wc(Od.bind(null,l,c,e),[e]),c.getSnapshot!==t||p||dt!==null&&dt.memoizedState.tag&1){if(l.flags|=2048,nr(9,{destroy:void 0},jd.bind(null,l,c,i,t),null),Xe===null)throw Error(a(349));u||(Wn&127)!==0||Ad(l,t,i)}return i}function Ad(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Ee.updateQueue,t===null?(t=Tl(),Ee.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function jd(e,t,i,l){t.value=i,t.getSnapshot=l,Td(t)&&Nd(e)}function Od(e,t,i){return i(function(){Td(t)&&Nd(e)})}function Td(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Gt(e,i)}catch{return!0}}function Nd(e){var t=fi(e,2);t!==null&&Ht(t,e,2)}function Kc(e){var t=kt();if(typeof e=="function"){var i=e;if(e=i(),vi){$t(!0);try{i()}finally{$t(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:e},t}function Cd(e,t,i,l){return e.baseState=i,Qc(e,Fe,typeof l=="function"?l:es)}function hb(e,t,i,l,c){if(Rl(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){u.listeners.push(p)}};$.T!==null?i(!0):u.isTransition=!1,l(u),i=t.pending,i===null?(u.next=t.pending=u,kd(t,u)):(u.next=i.next,t.pending=i.next=u)}}function kd(e,t){var i=t.action,l=t.payload,c=e.state;if(t.isTransition){var u=$.T,p={};$.T=p;try{var b=i(c,l),j=$.S;j!==null&&j(p,b),Md(e,t,b)}catch(B){Zc(e,t,B)}finally{u!==null&&p.types!==null&&(u.types=p.types),$.T=u}}else try{u=i(c,l),Md(e,t,u)}catch(B){Zc(e,t,B)}}function Md(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){Rd(e,t,l)},function(l){return Zc(e,t,l)}):Rd(e,t,i)}function Rd(e,t,i){t.status="fulfilled",t.value=i,Dd(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,kd(e,i)))}function Zc(e,t,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=i,Dd(t),t=t.next;while(t!==l)}e.action=null}function Dd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function zd(e,t){return t}function qd(e,t){if(ze){var i=Xe.formState;if(i!==null){e:{var l=Ee;if(ze){if(Ze){t:{for(var c=Ze,u=mn;c.nodeType!==8;){if(!u){c=null;break t}if(c=gn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Ze=gn(c.nextSibling),l=c.data==="F!";break e}}Es(l)}l=!1}l&&(t=i[0])}}return i=kt(),i.memoizedState=i.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zd,lastRenderedState:t},i.queue=l,i=tm.bind(null,Ee,l),l.dispatch=i,l=Kc(!1),u=iu.bind(null,Ee,!1,l.queue),l=kt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,i=hb.bind(null,Ee,c,u,i),c.dispatch=i,l.memoizedState=e,[t,i,!1]}function Ud(e){var t=ut();return Bd(t,Fe,e)}function Bd(e,t,i){if(t=Qc(e,t,zd)[0],e=Cl(es)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=na(t)}catch(p){throw p===Ki?vl:p}else l=t;t=ut();var c=t.queue,u=c.dispatch;return i!==t.memoizedState&&(Ee.flags|=2048,nr(9,{destroy:void 0},db.bind(null,c,i),null)),[l,u,e]}function db(e,t){e.action=t}function Ld(e){var t=ut(),i=Fe;if(i!==null)return Bd(t,i,e);ut(),t=t.memoizedState,i=ut();var l=i.queue.dispatch;return i.memoizedState=e,[t,l,!1]}function nr(e,t,i,l){return e={tag:e,create:i,deps:l,inst:t,next:null},t=Ee.updateQueue,t===null&&(t=Tl(),Ee.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,t.lastEffect=e),e}function Hd(){return ut().memoizedState}function kl(e,t,i,l){var c=kt();Ee.flags|=e,c.memoizedState=nr(1|t,{destroy:void 0},i,l===void 0?null:l)}function Ml(e,t,i,l){var c=ut();l=l===void 0?null:l;var u=c.memoizedState.inst;Fe!==null&&l!==null&&Yc(l,Fe.memoizedState.deps)?c.memoizedState=nr(t,u,i,l):(Ee.flags|=e,c.memoizedState=nr(1|t,u,i,l))}function Pd(e,t){kl(8390656,8,e,t)}function Wc(e,t){Ml(2048,8,e,t)}function mb(e){Ee.flags|=4;var t=Ee.updateQueue;if(t===null)t=Tl(),Ee.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function $d(e){var t=ut().memoizedState;return mb({ref:t,nextImpl:e}),function(){if((Pe&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function Yd(e,t){return Ml(4,2,e,t)}function Gd(e,t){return Ml(4,4,e,t)}function Vd(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Fd(e,t,i){i=i!=null?i.concat([e]):null,Ml(4,4,Vd.bind(null,t,e),i)}function eu(){}function Jd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;return t!==null&&Yc(t,l[1])?l[0]:(i.memoizedState=[e,t],e)}function Id(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;if(t!==null&&Yc(t,l[1]))return l[0];if(l=e(),vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l}function tu(e,t,i){return i===void 0||(Wn&1073741824)!==0&&(Re&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Qm(),Ee.lanes|=e,Rs|=e,i)}function Qd(e,t,i,l){return Gt(i,t)?i:Wi.current!==null?(e=tu(e,i,l),Gt(e,t)||(mt=!0),e):(Wn&42)===0||(Wn&1073741824)!==0&&(Re&261930)===0?(mt=!0,e.memoizedState=i):(e=Qm(),Ee.lanes|=e,Rs|=e,t)}function Xd(e,t,i,l,c){var u=te.p;te.p=u!==0&&8>u?u:8;var p=$.T,b={};$.T=b,iu(e,!1,t,i);try{var j=c(),B=$.S;if(B!==null&&B(b,j),j!==null&&typeof j=="object"&&typeof j.then=="function"){var Y=cb(j,l);sa(e,t,Y,Xt(e))}else sa(e,t,l,Xt(e))}catch(Q){sa(e,t,{then:function(){},status:"rejected",reason:Q},Xt())}finally{te.p=u,p!==null&&b.types!==null&&(p.types=b.types),$.T=p}}function pb(){}function nu(e,t,i,l){if(e.tag!==5)throw Error(a(476));var c=Kd(e).queue;Xd(e,c,t,de,i===null?pb:function(){return Zd(e),i(l)})}function Kd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:de},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Zd(e){var t=Kd(e);t.next===null&&(t=e.alternate.memoizedState),sa(e,t.next.queue,{},Xt())}function su(){return St(va)}function Wd(){return ut().memoizedState}function em(){return ut().memoizedState}function gb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Xt();e=Os(i);var l=Ts(t,e,i);l!==null&&(Ht(l,t,i),Zr(l,t,i)),t={cache:Mc()},e.payload=t;return}t=t.return}}function yb(e,t,i){var l=Xt();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Rl(e)?nm(t,i):(i=_c(e,t,i,l),i!==null&&(Ht(i,e,l),sm(i,t,l)))}function tm(e,t,i){var l=Xt();sa(e,t,i,l)}function sa(e,t,i,l){var c={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Rl(e))nm(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,b=u(p,i);if(c.hasEagerState=!0,c.eagerState=b,Gt(b,p))return dl(e,t,c,0),Xe===null&&hl(),!1}catch{}finally{}if(i=_c(e,t,c,l),i!==null)return Ht(i,e,l),sm(i,t,l),!0}return!1}function iu(e,t,i,l){if(l={lane:2,revertLane:qu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Rl(e)){if(t)throw Error(a(479))}else t=_c(e,i,l,2),t!==null&&Ht(t,e,2)}function Rl(e){var t=e.alternate;return e===Ee||t!==null&&t===Ee}function nm(e,t){er=jl=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function sm(e,t,i){if((i&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}var ia={readContext:St,use:Nl,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};ia.useEffectEvent=rt;var im={readContext:St,use:Nl,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Pd,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,kl(4194308,4,Vd.bind(null,t,e),i)},useLayoutEffect:function(e,t){return kl(4194308,4,e,t)},useInsertionEffect:function(e,t){kl(4,2,e,t)},useMemo:function(e,t){var i=kt();t=t===void 0?null:t;var l=e();if(vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l},useReducer:function(e,t,i){var l=kt();if(i!==void 0){var c=i(t);if(vi){$t(!0);try{i(t)}finally{$t(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=yb.bind(null,Ee,e),[l.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Kc(e);var t=e.queue,i=tm.bind(null,Ee,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:eu,useDeferredValue:function(e,t){var i=kt();return tu(i,e,t)},useTransition:function(){var e=Kc(!1);return e=Xd.bind(null,Ee,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var l=Ee,c=kt();if(ze){if(i===void 0)throw Error(a(407));i=i()}else{if(i=t(),Xe===null)throw Error(a(349));(Re&127)!==0||Ad(l,t,i)}c.memoizedState=i;var u={value:i,getSnapshot:t};return c.queue=u,Pd(Od.bind(null,l,u,e),[e]),l.flags|=2048,nr(9,{destroy:void 0},jd.bind(null,l,u,i,t),null),i},useId:function(){var e=kt(),t=Xe.identifierPrefix;if(ze){var i=Dn,l=Rn;i=(l&~(1<<32-Nt(l)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Ol++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=ub++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:su,useFormState:qd,useActionState:qd,useOptimistic:function(e){var t=kt();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=iu.bind(null,Ee,!0,i),i.dispatch=t,[e,t]},useMemoCache:Ic,useCacheRefresh:function(){return kt().memoizedState=gb.bind(null,Ee)},useEffectEvent:function(e){var t=kt(),i={impl:e};return t.memoizedState=i,function(){if((Pe&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},ru={readContext:St,use:Nl,useCallback:Jd,useContext:St,useEffect:Wc,useImperativeHandle:Fd,useInsertionEffect:Yd,useLayoutEffect:Gd,useMemo:Id,useReducer:Cl,useRef:Hd,useState:function(){return Cl(es)},useDebugValue:eu,useDeferredValue:function(e,t){var i=ut();return Qd(i,Fe.memoizedState,e,t)},useTransition:function(){var e=Cl(es)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:na(e),t]},useSyncExternalStore:Ed,useId:Wd,useHostTransitionStatus:su,useFormState:Ud,useActionState:Ud,useOptimistic:function(e,t){var i=ut();return Cd(i,Fe,e,t)},useMemoCache:Ic,useCacheRefresh:em};ru.useEffectEvent=$d;var rm={readContext:St,use:Nl,useCallback:Jd,useContext:St,useEffect:Wc,useImperativeHandle:Fd,useInsertionEffect:Yd,useLayoutEffect:Gd,useMemo:Id,useReducer:Xc,useRef:Hd,useState:function(){return Xc(es)},useDebugValue:eu,useDeferredValue:function(e,t){var i=ut();return Fe===null?tu(i,e,t):Qd(i,Fe.memoizedState,e,t)},useTransition:function(){var e=Xc(es)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:na(e),t]},useSyncExternalStore:Ed,useId:Wd,useHostTransitionStatus:su,useFormState:Ld,useActionState:Ld,useOptimistic:function(e,t){var i=ut();return Fe!==null?Cd(i,Fe,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Ic,useCacheRefresh:em};rm.useEffectEvent=$d;function au(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:w({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var lu={enqueueSetState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.payload=t,i!=null&&(c.callback=i),t=Ts(e,c,l),t!==null&&(Ht(t,e,l),Zr(t,e,l))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.tag=1,c.payload=t,i!=null&&(c.callback=i),t=Ts(e,c,l),t!==null&&(Ht(t,e,l),Zr(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Xt(),l=Os(i);l.tag=2,t!=null&&(l.callback=t),t=Ts(e,l,i),t!==null&&(Ht(t,e,i),Zr(t,e,i))}};function am(e,t,i,l,c,u,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,p):t.prototype&&t.prototype.isPureReactComponent?!Gr(i,l)||!Gr(c,u):!0}function lm(e,t,i,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,l),t.state!==e&&lu.enqueueReplaceState(t,t.state,null)}function _i(e,t){var i=t;if("ref"in t){i={};for(var l in t)l!=="ref"&&(i[l]=t[l])}if(e=e.defaultProps){i===t&&(i=w({},i));for(var c in e)i[c]===void 0&&(i[c]=e[c])}return i}function om(e){fl(e)}function cm(e){console.error(e)}function um(e){fl(e)}function Dl(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function fm(e,t,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function ou(e,t,i){return i=Os(i),i.tag=3,i.payload={element:null},i.callback=function(){Dl(e,t)},i}function hm(e){return e=Os(e),e.tag=3,e}function dm(e,t,i,l){var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var u=l.value;e.payload=function(){return c(u)},e.callback=function(){fm(t,i,l)}}var p=i.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){fm(t,i,l),typeof c!="function"&&(Ds===null?Ds=new Set([this]):Ds.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function bb(e,t,i,l,c){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=i.alternate,t!==null&&Ii(t,i,c,!0),i=Ft.current,i!==null){switch(i.tag){case 31:case 13:return pn===null?Fl():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=c,l===_l?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([l]):t.add(l),Ru(e,l,c)),!1;case 22:return i.flags|=65536,l===_l?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([l]):i.add(l)),Ru(e,l,c)),!1}throw Error(a(435,i.tag))}return Ru(e,l,c),Fl(),!1}if(ze)return t=Ft.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==Oc&&(e=Error(a(422),{cause:l}),Jr(fn(e,i)))):(l!==Oc&&(t=Error(a(423),{cause:l}),Jr(fn(t,i))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=fn(l,i),c=ou(e.stateNode,l,c),Bc(e,c),at!==4&&(at=2)),!1;var u=Error(a(520),{cause:l});if(u=fn(u,i),ha===null?ha=[u]:ha.push(u),at!==4&&(at=2),t===null)return!0;l=fn(l,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=c&-c,i.lanes|=e,e=ou(i.stateNode,l,e),Bc(i,e),!1;case 1:if(t=i.type,u=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Ds===null||!Ds.has(u))))return i.flags|=65536,c&=-c,i.lanes|=c,c=hm(c),dm(c,e,i,l),Bc(i,c),!1}i=i.return}while(i!==null);return!1}var cu=Error(a(461)),mt=!1;function Et(e,t,i,l){t.child=e===null?yd(t,null,i,l):xi(t,e.child,i,l)}function mm(e,t,i,l,c){i=i.render;var u=t.ref;if("ref"in l){var p={};for(var b in l)b!=="ref"&&(p[b]=l[b])}else p=l;return pi(t),l=Gc(e,t,i,p,u,c),b=Vc(),e!==null&&!mt?(Fc(e,t,c),ts(e,t,c)):(ze&&b&&Ac(t),t.flags|=1,Et(e,t,l,c),t.child)}function pm(e,t,i,l,c){if(e===null){var u=i.type;return typeof u=="function"&&!wc(u)&&u.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=u,gm(e,t,u,l,c)):(e=pl(i.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!yu(e,c)){var p=u.memoizedProps;if(i=i.compare,i=i!==null?i:Gr,i(p,l)&&e.ref===t.ref)return ts(e,t,c)}return t.flags|=1,e=Qn(u,l),e.ref=t.ref,e.return=t,t.child=e}function gm(e,t,i,l,c){if(e!==null){var u=e.memoizedProps;if(Gr(u,l)&&e.ref===t.ref)if(mt=!1,t.pendingProps=l=u,yu(e,c))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,ts(e,t,c)}return uu(e,t,i,l,c)}function ym(e,t,i,l){var c=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|i:i,e!==null){for(l=t.child=e.child,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~u}else l=0,t.child=null;return bm(e,t,u,i,l)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&xl(t,u!==null?u.cachePool:null),u!==null?vd(t,u):Hc(),_d(t);else return l=t.lanes=536870912,bm(e,t,u!==null?u.baseLanes|i:i,i,l)}else u!==null?(xl(t,u.cachePool),vd(t,u),Cs(),t.memoizedState=null):(e!==null&&xl(t,null),Hc(),Cs());return Et(e,t,c,i),t.child}function ra(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function bm(e,t,i,l,c){var u=Dc();return u=u===null?null:{parent:ht._currentValue,pool:u},t.memoizedState={baseLanes:i,cachePool:u},e!==null&&xl(t,null),Hc(),_d(t),e!==null&&Ii(e,t,l,!0),t.childLanes=c,null}function zl(e,t){return t=Ul({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function xm(e,t,i){return xi(t,e.child,null,i),e=zl(t,t.pendingProps),e.flags|=2,Jt(t),t.memoizedState=null,e}function xb(e,t,i){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ze){if(l.mode==="hidden")return e=zl(t,l),t.lanes=536870912,ra(null,e);if($c(t),(e=Ze)?(e=kp(e,mn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ws!==null?{id:Rn,overflow:Dn}:null,retryLane:536870912,hydrationErrors:null},i=nd(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Es(t);return t.lanes=536870912,null}return zl(t,l)}var u=e.memoizedState;if(u!==null){var p=u.dehydrated;if($c(t),c)if(t.flags&256)t.flags&=-257,t=xm(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(mt||Ii(e,t,i,!1),c=(i&e.childLanes)!==0,mt||c){if(l=Xe,l!==null&&(p=vs(l,i),p!==0&&p!==u.retryLane))throw u.retryLane=p,fi(e,p),Ht(l,e,p),cu;Fl(),t=xm(e,t,i)}else e=u.treeContext,Ze=gn(p.nextSibling),wt=t,ze=!0,Ss=null,mn=!1,e!==null&&rd(t,e),t=zl(t,l),t.flags|=4096;return t}return e=Qn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ql(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(a(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function uu(e,t,i,l,c){return pi(t),i=Gc(e,t,i,l,void 0,c),l=Vc(),e!==null&&!mt?(Fc(e,t,c),ts(e,t,c)):(ze&&l&&Ac(t),t.flags|=1,Et(e,t,i,c),t.child)}function vm(e,t,i,l,c,u){return pi(t),t.updateQueue=null,i=Sd(t,l,i,c),wd(e),l=Vc(),e!==null&&!mt?(Fc(e,t,u),ts(e,t,u)):(ze&&l&&Ac(t),t.flags|=1,Et(e,t,i,u),t.child)}function _m(e,t,i,l,c){if(pi(t),t.stateNode===null){var u=Gi,p=i.contextType;typeof p=="object"&&p!==null&&(u=St(p)),u=new i(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=lu,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},qc(t),p=i.contextType,u.context=typeof p=="object"&&p!==null?St(p):Gi,u.state=t.memoizedState,p=i.getDerivedStateFromProps,typeof p=="function"&&(au(t,i,p,l),u.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(p=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),p!==u.state&&lu.enqueueReplaceState(u,u.state,null),ea(t,l,u,c),Wr(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,j=_i(i,b);u.props=j;var B=u.context,Y=i.contextType;p=Gi,typeof Y=="object"&&Y!==null&&(p=St(Y));var Q=i.getDerivedStateFromProps;Y=typeof Q=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,Y||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||B!==p)&&lm(t,u,l,p),js=!1;var L=t.memoizedState;u.state=L,ea(t,l,u,c),Wr(),B=t.memoizedState,b||L!==B||js?(typeof Q=="function"&&(au(t,i,Q,l),B=t.memoizedState),(j=js||am(t,i,j,l,L,B,p))?(Y||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=B),u.props=l,u.state=B,u.context=p,l=j):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,Uc(e,t),p=t.memoizedProps,Y=_i(i,p),u.props=Y,Q=t.pendingProps,L=u.context,B=i.contextType,j=Gi,typeof B=="object"&&B!==null&&(j=St(B)),b=i.getDerivedStateFromProps,(B=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(p!==Q||L!==j)&&lm(t,u,l,j),js=!1,L=t.memoizedState,u.state=L,ea(t,l,u,c),Wr();var P=t.memoizedState;p!==Q||L!==P||js||e!==null&&e.dependencies!==null&&yl(e.dependencies)?(typeof b=="function"&&(au(t,i,b,l),P=t.memoizedState),(Y=js||am(t,i,Y,l,L,P,j)||e!==null&&e.dependencies!==null&&yl(e.dependencies))?(B||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,P,j),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,P,j)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),u.props=l,u.state=P,u.context=j,l=Y):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,ql(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=xi(t,e.child,null,c),t.child=xi(t,null,i,c)):Et(e,t,i,c),t.memoizedState=u.state,e=t.child):e=ts(e,t,c),e}function wm(e,t,i,l){return di(),t.flags|=256,Et(e,t,i,l),t.child}var fu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hu(e){return{baseLanes:e,cachePool:fd()}}function du(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=Qt),e}function Sm(e,t,i){var l=t.pendingProps,c=!1,u=(t.flags&128)!==0,p;if((p=u)||(p=e!==null&&e.memoizedState===null?!1:(ct.current&2)!==0),p&&(c=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(ze){if(c?Ns(t):Cs(),(e=Ze)?(e=kp(e,mn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ws!==null?{id:Rn,overflow:Dn}:null,retryLane:536870912,hydrationErrors:null},i=nd(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Es(t);return Qu(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,c?(Cs(),c=t.mode,b=Ul({mode:"hidden",children:b},c),l=hi(l,c,i,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=hu(i),l.childLanes=du(e,p,i),t.memoizedState=fu,ra(null,l)):(Ns(t),mu(t,b))}var j=e.memoizedState;if(j!==null&&(b=j.dehydrated,b!==null)){if(u)t.flags&256?(Ns(t),t.flags&=-257,t=pu(e,t,i)):t.memoizedState!==null?(Cs(),t.child=e.child,t.flags|=128,t=null):(Cs(),b=l.fallback,c=t.mode,l=Ul({mode:"visible",children:l.children},c),b=hi(b,c,i,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,xi(t,e.child,null,i),l=t.child,l.memoizedState=hu(i),l.childLanes=du(e,p,i),t.memoizedState=fu,t=ra(null,l));else if(Ns(t),Qu(b)){if(p=b.nextSibling&&b.nextSibling.dataset,p)var B=p.dgst;p=B,l=Error(a(419)),l.stack="",l.digest=p,Jr({value:l,source:null,stack:null}),t=pu(e,t,i)}else if(mt||Ii(e,t,i,!1),p=(i&e.childLanes)!==0,mt||p){if(p=Xe,p!==null&&(l=vs(p,i),l!==0&&l!==j.retryLane))throw j.retryLane=l,fi(e,l),Ht(p,e,l),cu;Iu(b)||Fl(),t=pu(e,t,i)}else Iu(b)?(t.flags|=192,t.child=e.child,t=null):(e=j.treeContext,Ze=gn(b.nextSibling),wt=t,ze=!0,Ss=null,mn=!1,e!==null&&rd(t,e),t=mu(t,l.children),t.flags|=4096);return t}return c?(Cs(),b=l.fallback,c=t.mode,j=e.child,B=j.sibling,l=Qn(j,{mode:"hidden",children:l.children}),l.subtreeFlags=j.subtreeFlags&65011712,B!==null?b=Qn(B,b):(b=hi(b,c,i,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,ra(null,l),l=t.child,b=e.child.memoizedState,b===null?b=hu(i):(c=b.cachePool,c!==null?(j=ht._currentValue,c=c.parent!==j?{parent:j,pool:j}:c):c=fd(),b={baseLanes:b.baseLanes|i,cachePool:c}),l.memoizedState=b,l.childLanes=du(e,p,i),t.memoizedState=fu,ra(e.child,l)):(Ns(t),i=e.child,e=i.sibling,i=Qn(i,{mode:"visible",children:l.children}),i.return=t,i.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=i,t.memoizedState=null,i)}function mu(e,t){return t=Ul({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ul(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function pu(e,t,i){return xi(t,e.child,null,i),e=mu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Em(e,t,i){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Cc(e.return,t,i)}function gu(e,t,i,l,c,u){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:c,treeForkCount:u}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=i,p.tailMode=c,p.treeForkCount=u)}function Am(e,t,i){var l=t.pendingProps,c=l.revealOrder,u=l.tail;l=l.children;var p=ct.current,b=(p&2)!==0;if(b?(p=p&1|2,t.flags|=128):p&=1,Te(ct,p),Et(e,t,l,i),l=ze?Fr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Em(e,i,t);else if(e.tag===19)Em(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(i=t.child,c=null;i!==null;)e=i.alternate,e!==null&&Al(e)===null&&(c=i),i=i.sibling;i=c,i===null?(c=t.child,t.child=null):(c=i.sibling,i.sibling=null),gu(t,!1,c,i,u,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Al(e)===null){t.child=c;break}e=c.sibling,c.sibling=i,i=c,c=e}gu(t,!0,i,null,u,l);break;case"together":gu(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function ts(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Rs|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Ii(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,i=Qn(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Qn(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function yu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&yl(e)))}function vb(e,t,i){switch(t.tag){case 3:Ot(t,t.stateNode.containerInfo),As(t,ht,e.memoizedState.cache),di();break;case 27:case 5:Tt(t);break;case 4:Ot(t,t.stateNode.containerInfo);break;case 10:As(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,$c(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Ns(t),t.flags|=128,null):(i&t.child.childLanes)!==0?Sm(e,t,i):(Ns(t),e=ts(e,t,i),e!==null?e.sibling:null);Ns(t);break;case 19:var c=(e.flags&128)!==0;if(l=(i&t.childLanes)!==0,l||(Ii(e,t,i,!1),l=(i&t.childLanes)!==0),c){if(l)return Am(e,t,i);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),Te(ct,ct.current),l)break;return null;case 22:return t.lanes=0,ym(e,t,i,t.pendingProps);case 24:As(t,ht,e.memoizedState.cache)}return ts(e,t,i)}function jm(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!yu(e,i)&&(t.flags&128)===0)return mt=!1,vb(e,t,i);mt=(e.flags&131072)!==0}else mt=!1,ze&&(t.flags&1048576)!==0&&id(t,Fr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=yi(t.elementType),t.type=e,typeof e=="function")wc(e)?(l=_i(e,l),t.tag=1,t=_m(null,t,e,l,i)):(t.tag=0,t=uu(null,t,e,l,i));else{if(e!=null){var c=e.$$typeof;if(c===re){t.tag=11,t=mm(null,t,e,l,i);break e}else if(c===ce){t.tag=14,t=pm(null,t,e,l,i);break e}}throw t=He(e)||e,Error(a(306,t,""))}}return t;case 0:return uu(e,t,t.type,t.pendingProps,i);case 1:return l=t.type,c=_i(l,t.pendingProps),_m(e,t,l,c,i);case 3:e:{if(Ot(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;c=u.element,Uc(e,t),ea(t,l,null,i);var p=t.memoizedState;if(l=p.cache,As(t,ht,l),l!==u.cache&&kc(t,[ht],i,!0),Wr(),l=p.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=wm(e,t,l,i);break e}else if(l!==c){c=fn(Error(a(424)),t),Jr(c),t=wm(e,t,l,i);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ze=gn(e.firstChild),wt=t,ze=!0,Ss=null,mn=!0,i=yd(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(di(),l===c){t=ts(e,t,i);break e}Et(e,t,l,i)}t=t.child}return t;case 26:return ql(e,t),e===null?(i=Up(t.type,null,t.pendingProps,null))?t.memoizedState=i:ze||(i=t.type,e=t.pendingProps,l=Wl(an.current).createElement(i),l[Qe]=t,l[it]=e,At(l,i,e),N(l),t.stateNode=l):t.memoizedState=Up(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&ze&&(l=t.stateNode=Dp(t.type,t.pendingProps,an.current),wt=t,mn=!0,c=Ze,Bs(t.type)?(Xu=c,Ze=gn(l.firstChild)):Ze=c),Et(e,t,t.pendingProps.children,i),ql(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ze&&((c=l=Ze)&&(l=Xb(l,t.type,t.pendingProps,mn),l!==null?(t.stateNode=l,wt=t,Ze=gn(l.firstChild),mn=!1,c=!0):c=!1),c||Es(t)),Tt(t),c=t.type,u=t.pendingProps,p=e!==null?e.memoizedProps:null,l=u.children,Vu(c,u)?l=null:p!==null&&Vu(c,p)&&(t.flags|=32),t.memoizedState!==null&&(c=Gc(e,t,fb,null,null,i),va._currentValue=c),ql(e,t),Et(e,t,l,i),t.child;case 6:return e===null&&ze&&((e=i=Ze)&&(i=Kb(i,t.pendingProps,mn),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||Es(t)),null;case 13:return Sm(e,t,i);case 4:return Ot(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=xi(t,null,l,i):Et(e,t,l,i),t.child;case 11:return mm(e,t,t.type,t.pendingProps,i);case 7:return Et(e,t,t.pendingProps,i),t.child;case 8:return Et(e,t,t.pendingProps.children,i),t.child;case 12:return Et(e,t,t.pendingProps.children,i),t.child;case 10:return l=t.pendingProps,As(t,t.type,l.value),Et(e,t,l.children,i),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,pi(t),c=St(c),l=l(c),t.flags|=1,Et(e,t,l,i),t.child;case 14:return pm(e,t,t.type,t.pendingProps,i);case 15:return gm(e,t,t.type,t.pendingProps,i);case 19:return Am(e,t,i);case 31:return xb(e,t,i);case 22:return ym(e,t,i,t.pendingProps);case 24:return pi(t),l=St(ht),e===null?(c=Dc(),c===null&&(c=Xe,u=Mc(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=i),c=u),t.memoizedState={parent:l,cache:c},qc(t),As(t,ht,c)):((e.lanes&i)!==0&&(Uc(e,t),ea(t,null,null,i),Wr()),c=e.memoizedState,u=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),As(t,ht,l)):(l=u.cache,As(t,ht,l),l!==c.cache&&kc(t,[ht],i,!0))),Et(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function ns(e){e.flags|=4}function bu(e,t,i,l,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Wm())e.flags|=8192;else throw bi=_l,zc}else e.flags&=-16777217}function Om(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!$p(t))if(Wm())e.flags|=8192;else throw bi=_l,zc}function Bl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Di():536870912,e.lanes|=t,ar|=t)}function aa(e,t){if(!ze)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(t)for(var c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags&65011712,l|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=i,t}function _b(e,t,i){var l=t.pendingProps;switch(jc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return i=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Zn(ht),Se(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Ji(t)?ns(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Tc())),We(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(ns(t),u!==null?(We(t),Om(t,u)):(We(t),bu(t,c,null,l,i))):u?u!==e.memoizedState?(ns(t),We(t),Om(t,u)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ns(t),We(t),bu(t,c,e,l,i)),null;case 27:if(ei(t),i=an.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ns(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}e=lt.current,Ji(t)?ad(t):(e=Dp(c,l,i),t.stateNode=e,ns(t))}return We(t),null;case 5:if(ei(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ns(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}if(u=lt.current,Ji(t))ad(t);else{var p=Wl(an.current);switch(u){case 1:u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=p.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?p.createElement("select",{is:l.is}):p.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?p.createElement(c,{is:l.is}):p.createElement(c)}}u[Qe]=t,u[it]=l;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)u.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=u;e:switch(At(u,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ns(t)}}return We(t),bu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ns(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=an.current,Ji(t)){if(e=t.stateNode,i=t.memoizedProps,l=null,c=wt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[Qe]=t,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||Sp(e.nodeValue,i)),e||Es(t,!0)}else e=Wl(e).createTextNode(l),e[Qe]=t,t.stateNode=e}return We(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(l=Ji(t),i!==null){if(e===null){if(!l)throw Error(a(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Qe]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else i=Tc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Jt(t),t):(Jt(t),null);if((t.flags&128)!==0)throw Error(a(558))}return We(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Ji(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(a(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(a(317));c[Qe]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),c=!1}else c=Tc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Jt(t),t):(Jt(t),null)}return Jt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==c&&(l.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Bl(t,t.updateQueue),We(t),null);case 4:return Se(),e===null&&Hu(t.stateNode.containerInfo),We(t),null;case 10:return Zn(t.type),We(t),null;case 19:if(we(ct),l=t.memoizedState,l===null)return We(t),null;if(c=(t.flags&128)!==0,u=l.rendering,u===null)if(c)aa(l,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Al(e),u!==null){for(t.flags|=128,aa(l,!1),e=u.updateQueue,t.updateQueue=e,Bl(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)td(i,e),i=i.sibling;return Te(ct,ct.current&1|2),ze&&Xn(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&et()>Yl&&(t.flags|=128,c=!0,aa(l,!1),t.lanes=4194304)}else{if(!c)if(e=Al(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Bl(t,e),aa(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!ze)return We(t),null}else 2*et()-l.renderingStartTime>Yl&&i!==536870912&&(t.flags|=128,c=!0,aa(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=et(),e.sibling=null,i=ct.current,Te(ct,c?i&1|2:i&1),ze&&Xn(t,l.treeForkCount),e):(We(t),null);case 22:case 23:return Jt(t),Pc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(i&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),i=t.updateQueue,i!==null&&Bl(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==i&&(t.flags|=2048),e!==null&&we(gi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Zn(ht),We(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function wb(e,t){switch(jc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Zn(ht),Se(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ei(t),null;case 31:if(t.memoizedState!==null){if(Jt(t),t.alternate===null)throw Error(a(340));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Jt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return we(ct),null;case 4:return Se(),null;case 10:return Zn(t.type),null;case 22:case 23:return Jt(t),Pc(),e!==null&&we(gi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Zn(ht),null;case 25:return null;default:return null}}function Tm(e,t){switch(jc(t),t.tag){case 3:Zn(ht),Se();break;case 26:case 27:case 5:ei(t);break;case 4:Se();break;case 31:t.memoizedState!==null&&Jt(t);break;case 13:Jt(t);break;case 19:we(ct);break;case 10:Zn(t.type);break;case 22:case 23:Jt(t),Pc(),e!==null&&we(gi);break;case 24:Zn(ht)}}function la(e,t){try{var i=t.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var c=l.next;i=c;do{if((i.tag&e)===e){l=void 0;var u=i.create,p=i.inst;l=u(),p.destroy=l}i=i.next}while(i!==c)}}catch(b){Ye(t,t.return,b)}}function ks(e,t,i){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var u=c.next;l=u;do{if((l.tag&e)===e){var p=l.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=t;var j=i,B=b;try{B()}catch(Y){Ye(c,j,Y)}}}l=l.next}while(l!==u)}}catch(Y){Ye(t,t.return,Y)}}function Nm(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{xd(t,i)}catch(l){Ye(e,e.return,l)}}}function Cm(e,t,i){i.props=_i(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){Ye(e,t,l)}}function oa(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(c){Ye(e,t,c)}}function zn(e,t){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(c){Ye(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(c){Ye(e,t,c)}else i.current=null}function km(e){var t=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(c){Ye(e,e.return,c)}}function xu(e,t,i){try{var l=e.stateNode;Gb(l,e.type,i,t),l[it]=t}catch(c){Ye(e,e.return,c)}}function Mm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Bs(e.type)||e.tag===4}function vu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Mm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Bs(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function _u(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Jn));else if(l!==4&&(l===27&&Bs(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(_u(e,t,i),e=e.sibling;e!==null;)_u(e,t,i),e=e.sibling}function Ll(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(l!==4&&(l===27&&Bs(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Ll(e,t,i),e=e.sibling;e!==null;)Ll(e,t,i),e=e.sibling}function Rm(e){var t=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);At(t,l,i),t[Qe]=e,t[it]=i}catch(u){Ye(e,e.return,u)}}var ss=!1,pt=!1,wu=!1,Dm=typeof WeakSet=="function"?WeakSet:Set,xt=null;function Sb(e,t){if(e=e.containerInfo,Yu=ao,e=Fh(e),pc(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var c=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{i.nodeType,u.nodeType}catch{i=null;break e}var p=0,b=-1,j=-1,B=0,Y=0,Q=e,L=null;t:for(;;){for(var P;Q!==i||c!==0&&Q.nodeType!==3||(b=p+c),Q!==u||l!==0&&Q.nodeType!==3||(j=p+l),Q.nodeType===3&&(p+=Q.nodeValue.length),(P=Q.firstChild)!==null;)L=Q,Q=P;for(;;){if(Q===e)break t;if(L===i&&++B===c&&(b=p),L===u&&++Y===l&&(j=p),(P=Q.nextSibling)!==null)break;Q=L,L=Q.parentNode}Q=P}i=b===-1||j===-1?null:{start:b,end:j}}else i=null}i=i||{start:0,end:0}}else i=null;for(Gu={focusedElem:e,selectionRange:i},ao=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)c=e[i],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,i=t,c=u.memoizedProps,u=u.memoizedState,l=i.stateNode;try{var he=_i(i.type,c);e=l.getSnapshotBeforeUpdate(he,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(ye){Ye(i,i.return,ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Ju(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ju(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,xt=e;break}xt=t.return}}function zm(e,t,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:rs(e,i),l&4&&la(5,i);break;case 1:if(rs(e,i),l&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(p){Ye(i,i.return,p)}else{var c=_i(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){Ye(i,i.return,p)}}l&64&&Nm(i),l&512&&oa(i,i.return);break;case 3:if(rs(e,i),l&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{xd(e,t)}catch(p){Ye(i,i.return,p)}}break;case 27:t===null&&l&4&&Rm(i);case 26:case 5:rs(e,i),t===null&&l&4&&km(i),l&512&&oa(i,i.return);break;case 12:rs(e,i);break;case 31:rs(e,i),l&4&&Bm(e,i);break;case 13:rs(e,i),l&4&&Lm(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Mb.bind(null,i),Zb(e,i))));break;case 22:if(l=i.memoizedState!==null||ss,!l){t=t!==null&&t.memoizedState!==null||pt,c=ss;var u=pt;ss=l,(pt=t)&&!u?as(e,i,(i.subtreeFlags&8772)!==0):rs(e,i),ss=c,pt=u}break;case 30:break;default:rs(e,i)}}function qm(e){var t=e.alternate;t!==null&&(e.alternate=null,qm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&zi(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var tt=null,qt=!1;function is(e,t,i){for(i=i.child;i!==null;)Um(e,t,i),i=i.sibling}function Um(e,t,i){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(ni,i)}catch{}switch(i.tag){case 26:pt||zn(i,t),is(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:pt||zn(i,t);var l=tt,c=qt;Bs(i.type)&&(tt=i.stateNode,qt=!1),is(e,t,i),ya(i.stateNode),tt=l,qt=c;break;case 5:pt||zn(i,t);case 6:if(l=tt,c=qt,tt=null,is(e,t,i),tt=l,qt=c,tt!==null)if(qt)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(i.stateNode)}catch(u){Ye(i,t,u)}else try{tt.removeChild(i.stateNode)}catch(u){Ye(i,t,u)}break;case 18:tt!==null&&(qt?(e=tt,Np(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),mr(e)):Np(tt,i.stateNode));break;case 4:l=tt,c=qt,tt=i.stateNode.containerInfo,qt=!0,is(e,t,i),tt=l,qt=c;break;case 0:case 11:case 14:case 15:ks(2,i,t),pt||ks(4,i,t),is(e,t,i);break;case 1:pt||(zn(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"&&Cm(i,t,l)),is(e,t,i);break;case 21:is(e,t,i);break;case 22:pt=(l=pt)||i.memoizedState!==null,is(e,t,i),pt=l;break;default:is(e,t,i)}}function Bm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{mr(e)}catch(i){Ye(t,t.return,i)}}}function Lm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{mr(e)}catch(i){Ye(t,t.return,i)}}function Eb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Dm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Dm),t;default:throw Error(a(435,e.tag))}}function Hl(e,t){var i=Eb(e);t.forEach(function(l){if(!i.has(l)){i.add(l);var c=Rb.bind(null,e,l);l.then(c,c)}})}function Ut(e,t){var i=t.deletions;if(i!==null)for(var l=0;l<i.length;l++){var c=i[l],u=e,p=t,b=p;e:for(;b!==null;){switch(b.tag){case 27:if(Bs(b.type)){tt=b.stateNode,qt=!1;break e}break;case 5:tt=b.stateNode,qt=!1;break e;case 3:case 4:tt=b.stateNode.containerInfo,qt=!0;break e}b=b.return}if(tt===null)throw Error(a(160));Um(u,p,c),tt=null,qt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Hm(t,e),t=t.sibling}var jn=null;function Hm(e,t){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Bt(e),l&4&&(ks(3,e,e.return),la(3,e),ks(5,e,e.return));break;case 1:Ut(t,e),Bt(e),l&512&&(pt||i===null||zn(i,i.return)),l&64&&ss&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var c=jn;if(Ut(t,e),Bt(e),l&512&&(pt||i===null||zn(i,i.return)),l&4){var u=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,c=c.ownerDocument||c;t:switch(l){case"title":u=c.getElementsByTagName("title")[0],(!u||u[yt]||u[Qe]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(l),c.head.insertBefore(u,c.querySelector("head > title"))),At(u,l,i),u[Qe]=e,N(u),l=u;break e;case"link":var p=Hp("link","href",c).get(l+(i.href||""));if(p){for(var b=0;b<p.length;b++)if(u=p[b],u.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&u.getAttribute("rel")===(i.rel==null?null:i.rel)&&u.getAttribute("title")===(i.title==null?null:i.title)&&u.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;case"meta":if(p=Hp("meta","content",c).get(l+(i.content||""))){for(b=0;b<p.length;b++)if(u=p[b],u.getAttribute("content")===(i.content==null?null:""+i.content)&&u.getAttribute("name")===(i.name==null?null:i.name)&&u.getAttribute("property")===(i.property==null?null:i.property)&&u.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&u.getAttribute("charset")===(i.charSet==null?null:i.charSet)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;default:throw Error(a(468,l))}u[Qe]=e,N(u),l=u}e.stateNode=l}else Pp(c,e.type,e.stateNode);else e.stateNode=Lp(c,l,e.memoizedProps);else u!==l?(u===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):u.count--,l===null?Pp(c,e.type,e.stateNode):Lp(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&xu(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ut(t,e),Bt(e),l&512&&(pt||i===null||zn(i,i.return)),i!==null&&l&4&&xu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ut(t,e),Bt(e),l&512&&(pt||i===null||zn(i,i.return)),e.flags&32){c=e.stateNode;try{Ui(c,"")}catch(he){Ye(e,e.return,he)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,xu(e,c,i!==null?i.memoizedProps:c)),l&1024&&(wu=!0);break;case 6:if(Ut(t,e),Bt(e),l&4){if(e.stateNode===null)throw Error(a(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(he){Ye(e,e.return,he)}}break;case 3:if(no=null,c=jn,jn=eo(t.containerInfo),Ut(t,e),jn=c,Bt(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{mr(t.containerInfo)}catch(he){Ye(e,e.return,he)}wu&&(wu=!1,Pm(e));break;case 4:l=jn,jn=eo(e.stateNode.containerInfo),Ut(t,e),Bt(e),jn=l;break;case 12:Ut(t,e),Bt(e);break;case 31:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Hl(e,l)));break;case 13:Ut(t,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&($l=et()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Hl(e,l)));break;case 22:c=e.memoizedState!==null;var j=i!==null&&i.memoizedState!==null,B=ss,Y=pt;if(ss=B||c,pt=Y||j,Ut(t,e),pt=Y,ss=B,Bt(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(i===null||j||ss||pt||wi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){j=i=t;try{if(u=j.stateNode,c)p=u.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{b=j.stateNode;var Q=j.memoizedProps.style,L=Q!=null&&Q.hasOwnProperty("display")?Q.display:null;b.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(he){Ye(j,j.return,he)}}}else if(t.tag===6){if(i===null){j=t;try{j.stateNode.nodeValue=c?"":j.memoizedProps}catch(he){Ye(j,j.return,he)}}}else if(t.tag===18){if(i===null){j=t;try{var P=j.stateNode;c?Cp(P,!0):Cp(j.stateNode,!1)}catch(he){Ye(j,j.return,he)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,Hl(e,i))));break;case 19:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Hl(e,l)));break;case 30:break;case 21:break;default:Ut(t,e),Bt(e)}}function Bt(e){var t=e.flags;if(t&2){try{for(var i,l=e.return;l!==null;){if(Mm(l)){i=l;break}l=l.return}if(i==null)throw Error(a(160));switch(i.tag){case 27:var c=i.stateNode,u=vu(e);Ll(e,u,c);break;case 5:var p=i.stateNode;i.flags&32&&(Ui(p,""),i.flags&=-33);var b=vu(e);Ll(e,b,p);break;case 3:case 4:var j=i.stateNode.containerInfo,B=vu(e);_u(e,B,j);break;default:throw Error(a(161))}}catch(Y){Ye(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Pm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Pm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function rs(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)zm(e,t.alternate,t),t=t.sibling}function wi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ks(4,t,t.return),wi(t);break;case 1:zn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&Cm(t,t.return,i),wi(t);break;case 27:ya(t.stateNode);case 26:case 5:zn(t,t.return),wi(t);break;case 22:t.memoizedState===null&&wi(t);break;case 30:wi(t);break;default:wi(t)}e=e.sibling}}function as(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,u=t,p=u.flags;switch(u.tag){case 0:case 11:case 15:as(c,u,i),la(4,u);break;case 1:if(as(c,u,i),l=u,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(B){Ye(l,l.return,B)}if(l=u,c=l.updateQueue,c!==null){var b=l.stateNode;try{var j=c.shared.hiddenCallbacks;if(j!==null)for(c.shared.hiddenCallbacks=null,c=0;c<j.length;c++)bd(j[c],b)}catch(B){Ye(l,l.return,B)}}i&&p&64&&Nm(u),oa(u,u.return);break;case 27:Rm(u);case 26:case 5:as(c,u,i),i&&l===null&&p&4&&km(u),oa(u,u.return);break;case 12:as(c,u,i);break;case 31:as(c,u,i),i&&p&4&&Bm(c,u);break;case 13:as(c,u,i),i&&p&4&&Lm(c,u);break;case 22:u.memoizedState===null&&as(c,u,i),oa(u,u.return);break;case 30:break;default:as(c,u,i)}t=t.sibling}}function Su(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Ir(i))}function Eu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ir(e))}function On(e,t,i,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)$m(e,t,i,l),t=t.sibling}function $m(e,t,i,l){var c=t.flags;switch(t.tag){case 0:case 11:case 15:On(e,t,i,l),c&2048&&la(9,t);break;case 1:On(e,t,i,l);break;case 3:On(e,t,i,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ir(e)));break;case 12:if(c&2048){On(e,t,i,l),e=t.stateNode;try{var u=t.memoizedProps,p=u.id,b=u.onPostCommit;typeof b=="function"&&b(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(j){Ye(t,t.return,j)}}else On(e,t,i,l);break;case 31:On(e,t,i,l);break;case 13:On(e,t,i,l);break;case 23:break;case 22:u=t.stateNode,p=t.alternate,t.memoizedState!==null?u._visibility&2?On(e,t,i,l):ca(e,t):u._visibility&2?On(e,t,i,l):(u._visibility|=2,sr(e,t,i,l,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Su(p,t);break;case 24:On(e,t,i,l),c&2048&&Eu(t.alternate,t);break;default:On(e,t,i,l)}}function sr(e,t,i,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,p=t,b=i,j=l,B=p.flags;switch(p.tag){case 0:case 11:case 15:sr(u,p,b,j,c),la(8,p);break;case 23:break;case 22:var Y=p.stateNode;p.memoizedState!==null?Y._visibility&2?sr(u,p,b,j,c):ca(u,p):(Y._visibility|=2,sr(u,p,b,j,c)),c&&B&2048&&Su(p.alternate,p);break;case 24:sr(u,p,b,j,c),c&&B&2048&&Eu(p.alternate,p);break;default:sr(u,p,b,j,c)}t=t.sibling}}function ca(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,l=t,c=l.flags;switch(l.tag){case 22:ca(i,l),c&2048&&Su(l.alternate,l);break;case 24:ca(i,l),c&2048&&Eu(l.alternate,l);break;default:ca(i,l)}t=t.sibling}}var ua=8192;function ir(e,t,i){if(e.subtreeFlags&ua)for(e=e.child;e!==null;)Ym(e,t,i),e=e.sibling}function Ym(e,t,i){switch(e.tag){case 26:ir(e,t,i),e.flags&ua&&e.memoizedState!==null&&ux(i,jn,e.memoizedState,e.memoizedProps);break;case 5:ir(e,t,i);break;case 3:case 4:var l=jn;jn=eo(e.stateNode.containerInfo),ir(e,t,i),jn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=ua,ua=16777216,ir(e,t,i),ua=l):ir(e,t,i));break;default:ir(e,t,i)}}function Gm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function fa(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Fm(l,e)}Gm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Vm(e),e=e.sibling}function Vm(e){switch(e.tag){case 0:case 11:case 15:fa(e),e.flags&2048&&ks(9,e,e.return);break;case 3:fa(e);break;case 12:fa(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Pl(e)):fa(e);break;default:fa(e)}}function Pl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Fm(l,e)}Gm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ks(8,t,t.return),Pl(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,Pl(t));break;default:Pl(t)}e=e.sibling}}function Fm(e,t){for(;xt!==null;){var i=xt;switch(i.tag){case 0:case 11:case 15:ks(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Ir(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,xt=l;else e:for(i=e;xt!==null;){l=xt;var c=l.sibling,u=l.return;if(qm(l),l===i){xt=null;break e}if(c!==null){c.return=u,xt=c;break e}xt=u}}}var Ab={getCacheForType:function(e){var t=St(ht),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return St(ht).controller.signal}},jb=typeof WeakMap=="function"?WeakMap:Map,Pe=0,Xe=null,Ne=null,Re=0,$e=0,It=null,Ms=!1,rr=!1,Au=!1,ls=0,at=0,Rs=0,Si=0,ju=0,Qt=0,ar=0,ha=null,Lt=null,Ou=!1,$l=0,Jm=0,Yl=1/0,Gl=null,Ds=null,bt=0,zs=null,lr=null,os=0,Tu=0,Nu=null,Im=null,da=0,Cu=null;function Xt(){return(Pe&2)!==0&&Re!==0?Re&-Re:$.T!==null?qu():zr()}function Qm(){if(Qt===0)if((Re&536870912)===0||ze){var e=Gn;Gn<<=1,(Gn&3932160)===0&&(Gn=262144),Qt=e}else Qt=536870912;return e=Ft.current,e!==null&&(e.flags|=32),Qt}function Ht(e,t,i){(e===Xe&&($e===2||$e===9)||e.cancelPendingCommit!==null)&&(or(e,0),qs(e,Re,Qt,!1)),Sn(e,i),((Pe&2)===0||e!==Xe)&&(e===Xe&&((Pe&2)===0&&(Si|=i),at===4&&qs(e,Re,Qt,!1)),qn(e))}function Xm(e,t,i){if((Pe&6)!==0)throw Error(a(327));var l=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ii(e,t),c=l?Nb(e,t):Mu(e,t,!0),u=l;do{if(c===0){rr&&!l&&qs(e,t,0,!1);break}else{if(i=e.current.alternate,u&&!Ob(i)){c=Mu(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var p=0;else p=e.pendingLanes&-536870913,p=p!==0?p:p&536870912?536870912:0;if(p!==0){t=p;e:{var b=e;c=ha;var j=b.current.memoizedState.isDehydrated;if(j&&(or(b,p).flags|=256),p=Mu(b,p,!1),p!==2){if(Au&&!j){b.errorRecoveryDisabledLanes|=u,Si|=u,c=4;break e}u=Lt,Lt=c,u!==null&&(Lt===null?Lt=u:Lt.push.apply(Lt,u))}c=p}if(u=!1,c!==2)continue}}if(c===1){or(e,0),qs(e,t,0,!0);break}e:{switch(l=e,u=c,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:qs(l,t,Qt,!Ms);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(c=$l+300-et(),10<c)){if(qs(l,t,Qt,!Ms),si(l,0,!0)!==0)break e;os=t,l.timeoutHandle=Op(Km.bind(null,l,i,Lt,Gl,Ou,t,Qt,Si,ar,Ms,u,"Throttled",-0,0),c);break e}Km(l,i,Lt,Gl,Ou,t,Qt,Si,ar,Ms,u,null,-0,0)}}break}while(!0);qn(e)}function Km(e,t,i,l,c,u,p,b,j,B,Y,Q,L,P){if(e.timeoutHandle=-1,Q=t.subtreeFlags,Q&8192||(Q&16785408)===16785408){Q={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Jn},Ym(t,u,Q);var he=(u&62914560)===u?$l-et():(u&4194048)===u?Jm-et():0;if(he=fx(Q,he),he!==null){os=u,e.cancelPendingCommit=he(rp.bind(null,e,t,u,i,l,c,p,b,j,Y,Q,null,L,P)),qs(e,u,p,!B);return}}rp(e,t,u,i,l,c,p,b,j)}function Ob(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var c=i[l],u=c.getSnapshot;c=c.value;try{if(!Gt(u(),c))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function qs(e,t,i,l){t&=~ju,t&=~Si,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var u=31-Nt(c),p=1<<u;l[u]=-1,c&=~p}i!==0&&xs(e,i,t)}function Vl(){return(Pe&6)===0?(ma(0),!1):!0}function ku(){if(Ne!==null){if($e===0)var e=Ne.return;else e=Ne,Kn=mi=null,Jc(e),Zi=null,Xr=0,e=Ne;for(;e!==null;)Tm(e.alternate,e),e=e.return;Ne=null}}function or(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Jb(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),os=0,ku(),Xe=e,Ne=i=Qn(e.current,null),Re=t,$e=0,It=null,Ms=!1,rr=ii(e,t),Au=!1,ar=Qt=ju=Si=Rs=at=0,Lt=ha=null,Ou=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-Nt(l),u=1<<c;t|=e[c],l&=~u}return ls=t,hl(),i}function Zm(e,t){Ee=null,$.H=ia,t===Ki||t===vl?(t=md(),$e=3):t===zc?(t=md(),$e=4):$e=t===cu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,It=t,Ne===null&&(at=1,Dl(e,fn(t,e.current)))}function Wm(){var e=Ft.current;return e===null?!0:(Re&4194048)===Re?pn===null:(Re&62914560)===Re||(Re&536870912)!==0?e===pn:!1}function ep(){var e=$.H;return $.H=ia,e===null?ia:e}function tp(){var e=$.A;return $.A=Ab,e}function Fl(){at=4,Ms||(Re&4194048)!==Re&&Ft.current!==null||(rr=!0),(Rs&134217727)===0&&(Si&134217727)===0||Xe===null||qs(Xe,Re,Qt,!1)}function Mu(e,t,i){var l=Pe;Pe|=2;var c=ep(),u=tp();(Xe!==e||Re!==t)&&(Gl=null,or(e,t)),t=!1;var p=at;e:do try{if($e!==0&&Ne!==null){var b=Ne,j=It;switch($e){case 8:ku(),p=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(t=!0);var B=$e;if($e=0,It=null,cr(e,b,j,B),i&&rr){p=0;break e}break;default:B=$e,$e=0,It=null,cr(e,b,j,B)}}Tb(),p=at;break}catch(Y){Zm(e,Y)}while(!0);return t&&e.shellSuspendCounter++,Kn=mi=null,Pe=l,$.H=c,$.A=u,Ne===null&&(Xe=null,Re=0,hl()),p}function Tb(){for(;Ne!==null;)np(Ne)}function Nb(e,t){var i=Pe;Pe|=2;var l=ep(),c=tp();Xe!==e||Re!==t?(Gl=null,Yl=et()+500,or(e,t)):rr=ii(e,t);e:do try{if($e!==0&&Ne!==null){t=Ne;var u=It;t:switch($e){case 1:$e=0,It=null,cr(e,t,u,1);break;case 2:case 9:if(hd(u)){$e=0,It=null,sp(t);break}t=function(){$e!==2&&$e!==9||Xe!==e||($e=7),qn(e)},u.then(t,t);break e;case 3:$e=7;break e;case 4:$e=5;break e;case 7:hd(u)?($e=0,It=null,sp(t)):($e=0,It=null,cr(e,t,u,7));break;case 5:var p=null;switch(Ne.tag){case 26:p=Ne.memoizedState;case 5:case 27:var b=Ne;if(p?$p(p):b.stateNode.complete){$e=0,It=null;var j=b.sibling;if(j!==null)Ne=j;else{var B=b.return;B!==null?(Ne=B,Jl(B)):Ne=null}break t}}$e=0,It=null,cr(e,t,u,5);break;case 6:$e=0,It=null,cr(e,t,u,6);break;case 8:ku(),at=6;break e;default:throw Error(a(462))}}Cb();break}catch(Y){Zm(e,Y)}while(!0);return Kn=mi=null,$.H=l,$.A=c,Pe=i,Ne!==null?0:(Xe=null,Re=0,hl(),at)}function Cb(){for(;Ne!==null&&!Qa();)np(Ne)}function np(e){var t=jm(e.alternate,e,ls);e.memoizedProps=e.pendingProps,t===null?Jl(e):Ne=t}function sp(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=vm(i,t,t.pendingProps,t.type,void 0,Re);break;case 11:t=vm(i,t,t.pendingProps,t.type.render,t.ref,Re);break;case 5:Jc(t);default:Tm(i,t),t=Ne=td(t,ls),t=jm(i,t,ls)}e.memoizedProps=e.pendingProps,t===null?Jl(e):Ne=t}function cr(e,t,i,l){Kn=mi=null,Jc(t),Zi=null,Xr=0;var c=t.return;try{if(bb(e,c,t,i,Re)){at=1,Dl(e,fn(i,e.current)),Ne=null;return}}catch(u){if(c!==null)throw Ne=c,u;at=1,Dl(e,fn(i,e.current)),Ne=null;return}t.flags&32768?(ze||l===1?e=!0:rr||(Re&536870912)!==0?e=!1:(Ms=e=!0,(l===2||l===9||l===3||l===6)&&(l=Ft.current,l!==null&&l.tag===13&&(l.flags|=16384))),ip(t,e)):Jl(t)}function Jl(e){var t=e;do{if((t.flags&32768)!==0){ip(t,Ms);return}e=t.return;var i=_b(t.alternate,t,ls);if(i!==null){Ne=i;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);at===0&&(at=5)}function ip(e,t){do{var i=wb(e.alternate,e);if(i!==null){i.flags&=32767,Ne=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=i}while(e!==null);at=6,Ne=null}function rp(e,t,i,l,c,u,p,b,j){e.cancelPendingCommit=null;do Il();while(bt!==0);if((Pe&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=vc,bs(e,i,u,p,b,j),e===Xe&&(Ne=Xe=null,Re=0),lr=t,zs=e,os=i,Tu=u,Nu=c,Im=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Db(Mi,function(){return up(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=$.T,$.T=null,c=te.p,te.p=2,p=Pe,Pe|=4;try{Sb(e,t,i)}finally{Pe=p,te.p=c,$.T=l}}bt=1,ap(),lp(),op()}}function ap(){if(bt===1){bt=0;var e=zs,t=lr,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=Pe;Pe|=4;try{Hm(t,e);var u=Gu,p=Fh(e.containerInfo),b=u.focusedElem,j=u.selectionRange;if(p!==b&&b&&b.ownerDocument&&Vh(b.ownerDocument.documentElement,b)){if(j!==null&&pc(b)){var B=j.start,Y=j.end;if(Y===void 0&&(Y=B),"selectionStart"in b)b.selectionStart=B,b.selectionEnd=Math.min(Y,b.value.length);else{var Q=b.ownerDocument||document,L=Q&&Q.defaultView||window;if(L.getSelection){var P=L.getSelection(),he=b.textContent.length,ye=Math.min(j.start,he),Ie=j.end===void 0?ye:Math.min(j.end,he);!P.extend&&ye>Ie&&(p=Ie,Ie=ye,ye=p);var R=Gh(b,ye),k=Gh(b,Ie);if(R&&k&&(P.rangeCount!==1||P.anchorNode!==R.node||P.anchorOffset!==R.offset||P.focusNode!==k.node||P.focusOffset!==k.offset)){var U=Q.createRange();U.setStart(R.node,R.offset),P.removeAllRanges(),ye>Ie?(P.addRange(U),P.extend(k.node,k.offset)):(U.setEnd(k.node,k.offset),P.addRange(U))}}}}for(Q=[],P=b;P=P.parentNode;)P.nodeType===1&&Q.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<Q.length;b++){var F=Q[b];F.element.scrollLeft=F.left,F.element.scrollTop=F.top}}ao=!!Yu,Gu=Yu=null}finally{Pe=c,te.p=l,$.T=i}}e.current=t,bt=2}}function lp(){if(bt===2){bt=0;var e=zs,t=lr,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=Pe;Pe|=4;try{zm(e,t.alternate,t)}finally{Pe=c,te.p=l,$.T=i}}bt=3}}function op(){if(bt===4||bt===3){bt=0,ki();var e=zs,t=lr,i=os,l=Im;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?bt=5:(bt=0,lr=zs=null,cp(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Ds=null),ai(i),t=t.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(ni,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=$.T,c=te.p,te.p=2,$.T=null;try{for(var u=e.onRecoverableError,p=0;p<l.length;p++){var b=l[p];u(b.value,{componentStack:b.stack})}}finally{$.T=t,te.p=c}}(os&3)!==0&&Il(),qn(e),c=e.pendingLanes,(i&261930)!==0&&(c&42)!==0?e===Cu?da++:(da=0,Cu=e):da=0,ma(0)}}function cp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ir(t)))}function Il(){return ap(),lp(),op(),up()}function up(){if(bt!==5)return!1;var e=zs,t=Tu;Tu=0;var i=ai(os),l=$.T,c=te.p;try{te.p=32>i?32:i,$.T=null,i=Nu,Nu=null;var u=zs,p=os;if(bt=0,lr=zs=null,os=0,(Pe&6)!==0)throw Error(a(331));var b=Pe;if(Pe|=4,Vm(u.current),$m(u,u.current,p,i),Pe=b,ma(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(ni,u)}catch{}return!0}finally{te.p=c,$.T=l,cp(e,t)}}function fp(e,t,i){t=fn(i,t),t=ou(e.stateNode,t,2),e=Ts(e,t,2),e!==null&&(Sn(e,2),qn(e))}function Ye(e,t,i){if(e.tag===3)fp(e,e,i);else for(;t!==null;){if(t.tag===3){fp(t,e,i);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ds===null||!Ds.has(l))){e=fn(i,e),i=hm(2),l=Ts(t,i,2),l!==null&&(dm(i,l,t,e),Sn(l,2),qn(l));break}}t=t.return}}function Ru(e,t,i){var l=e.pingCache;if(l===null){l=e.pingCache=new jb;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(i)||(Au=!0,c.add(i),e=kb.bind(null,e,t,i),t.then(e,e))}function kb(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Xe===e&&(Re&i)===i&&(at===4||at===3&&(Re&62914560)===Re&&300>et()-$l?(Pe&2)===0&&or(e,0):ju|=i,ar===Re&&(ar=0)),qn(e)}function hp(e,t){t===0&&(t=Di()),e=fi(e,t),e!==null&&(Sn(e,t),qn(e))}function Mb(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),hp(e,i)}function Rb(e,t){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(i=c.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(t),hp(e,i)}function Db(e,t){return kr(e,t)}var Ql=null,ur=null,Du=!1,Xl=!1,zu=!1,Us=0;function qn(e){e!==ur&&e.next===null&&(ur===null?Ql=ur=e:ur=ur.next=e),Xl=!0,Du||(Du=!0,qb())}function ma(e,t){if(!zu&&Xl){zu=!0;do for(var i=!1,l=Ql;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var u=0;else{var p=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Nt(42|e)+1)-1,u&=c&~(p&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(i=!0,gp(l,u))}else u=Re,u=si(l,l===Xe?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ii(l,u)||(i=!0,gp(l,u));l=l.next}while(i);zu=!1}}function zb(){dp()}function dp(){Xl=Du=!1;var e=0;Us!==0&&Fb()&&(e=Us);for(var t=et(),i=null,l=Ql;l!==null;){var c=l.next,u=mp(l,t);u===0?(l.next=null,i===null?Ql=c:i.next=c,c===null&&(ur=i)):(i=l,(e!==0||(u&3)!==0)&&(Xl=!0)),l=c}bt!==0&&bt!==5||ma(e),Us!==0&&(Us=0)}function mp(e,t){for(var i=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var p=31-Nt(u),b=1<<p,j=c[p];j===-1?((b&i)===0||(b&l)!==0)&&(c[p]=Dr(b,t)):j<=t&&(e.expiredLanes|=b),u&=~b}if(t=Xe,i=Re,i=si(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===t&&($e===2||$e===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Yn(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ii(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(l!==null&&Yn(l),ai(i)){case 2:case 8:i=Ka;break;case 32:i=Mi;break;case 268435456:i=Za;break;default:i=Mi}return l=pp.bind(null,e),i=kr(i,l),e.callbackPriority=t,e.callbackNode=i,t}return l!==null&&l!==null&&Yn(l),e.callbackPriority=2,e.callbackNode=null,2}function pp(e,t){if(bt!==0&&bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Il()&&e.callbackNode!==i)return null;var l=Re;return l=si(e,e===Xe?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Xm(e,l,t),mp(e,et()),e.callbackNode!=null&&e.callbackNode===i?pp.bind(null,e):null)}function gp(e,t){if(Il())return null;Xm(e,t,!0)}function qb(){Ib(function(){(Pe&6)!==0?kr(Xa,zb):dp()})}function qu(){if(Us===0){var e=Qi;e===0&&(e=ps,ps<<=1,(ps&261888)===0&&(ps=256)),Us=e}return Us}function yp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:il(""+e)}function bp(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Ub(e,t,i,l,c){if(t==="submit"&&i&&i.stateNode===c){var u=yp((c[it]||null).action),p=l.submitter;p&&(t=(t=p[it]||null)?yp(t.formAction):p.getAttribute("formAction"),t!==null&&(u=t,p=null));var b=new ol("action","action",null,l,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Us!==0){var j=p?bp(c,p):new FormData(c);nu(i,{pending:!0,data:j,method:c.method,action:u},null,j)}}else typeof u=="function"&&(b.preventDefault(),j=p?bp(c,p):new FormData(c),nu(i,{pending:!0,data:j,method:c.method,action:u},u,j))},currentTarget:c}]})}}for(var Uu=0;Uu<xc.length;Uu++){var Bu=xc[Uu],Bb=Bu.toLowerCase(),Lb=Bu[0].toUpperCase()+Bu.slice(1);An(Bb,"on"+Lb)}An(Qh,"onAnimationEnd"),An(Xh,"onAnimationIteration"),An(Kh,"onAnimationStart"),An("dblclick","onDoubleClick"),An("focusin","onFocus"),An("focusout","onBlur"),An(tb,"onTransitionRun"),An(nb,"onTransitionStart"),An(sb,"onTransitionCancel"),An(Zh,"onTransitionEnd"),H("onMouseEnter",["mouseout","mouseover"]),H("onMouseLeave",["mouseout","mouseover"]),H("onPointerEnter",["pointerout","pointerover"]),H("onPointerLeave",["pointerout","pointerover"]),Z("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Z("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Z("onBeforeInput",["compositionend","keypress","textInput","paste"]),Z("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Z("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Z("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var pa="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(" "),Hb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(pa));function xp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var p=l.length-1;0<=p;p--){var b=l[p],j=b.instance,B=b.currentTarget;if(b=b.listener,j!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){fl(Y)}c.currentTarget=null,u=j}else for(p=0;p<l.length;p++){if(b=l[p],j=b.instance,B=b.currentTarget,b=b.listener,j!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){fl(Y)}c.currentTarget=null,u=j}}}}function Ce(e,t){var i=t[li];i===void 0&&(i=t[li]=new Set);var l=e+"__bubble";i.has(l)||(vp(t,e,2,!1),i.add(l))}function Lu(e,t,i){var l=0;t&&(l|=4),vp(i,e,l,t)}var Kl="_reactListening"+Math.random().toString(36).slice(2);function Hu(e){if(!e[Kl]){e[Kl]=!0,z.forEach(function(i){i!=="selectionchange"&&(Hb.has(i)||Lu(i,!1,e),Lu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Kl]||(t[Kl]=!0,Lu("selectionchange",!1,t))}}function vp(e,t,i,l){switch(Qp(t)){case 2:var c=mx;break;case 8:c=px;break;default:c=tf}i=c.bind(null,t,i,e),c=void 0,!ac||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,i,{capture:!0,passive:c}):e.addEventListener(t,i,!0):c!==void 0?e.addEventListener(t,i,{passive:c}):e.addEventListener(t,i,!1)}function Pu(e,t,i,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var b=l.stateNode.containerInfo;if(b===c)break;if(p===4)for(p=l.return;p!==null;){var j=p.tag;if((j===3||j===4)&&p.stateNode.containerInfo===c)return;p=p.return}for(;b!==null;){if(p=x(b),p===null)return;if(j=p.tag,j===5||j===6||j===26||j===27){l=u=p;continue e}b=b.parentNode}}l=l.return}Ah(function(){var B=u,Y=ic(i),Q=[];e:{var L=Wh.get(e);if(L!==void 0){var P=ol,he=e;switch(e){case"keypress":if(al(i)===0)break e;case"keydown":case"keyup":P=Ry;break;case"focusin":he="focus",P=uc;break;case"focusout":he="blur",P=uc;break;case"beforeblur":case"afterblur":P=uc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":P=Th;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=_y;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=qy;break;case Qh:case Xh:case Kh:P=Ey;break;case Zh:P=By;break;case"scroll":case"scrollend":P=xy;break;case"wheel":P=Hy;break;case"copy":case"cut":case"paste":P=jy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=Ch;break;case"toggle":case"beforetoggle":P=$y}var ye=(t&4)!==0,Ie=!ye&&(e==="scroll"||e==="scrollend"),R=ye?L!==null?L+"Capture":null:L;ye=[];for(var k=B,U;k!==null;){var F=k;if(U=F.stateNode,F=F.tag,F!==5&&F!==26&&F!==27||U===null||R===null||(F=Ur(k,R),F!=null&&ye.push(ga(k,F,U))),Ie)break;k=k.return}0<ye.length&&(L=new P(L,he,null,i,Y),Q.push({event:L,listeners:ye}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",P=e==="mouseout"||e==="pointerout",L&&i!==sc&&(he=i.relatedTarget||i.fromElement)&&(x(he)||he[Yt]))break e;if((P||L)&&(L=Y.window===Y?Y:(L=Y.ownerDocument)?L.defaultView||L.parentWindow:window,P?(he=i.relatedTarget||i.toElement,P=B,he=he?x(he):null,he!==null&&(Ie=f(he),ye=he.tag,he!==Ie||ye!==5&&ye!==27&&ye!==6)&&(he=null)):(P=null,he=B),P!==he)){if(ye=Th,F="onMouseLeave",R="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(ye=Ch,F="onPointerLeave",R="onPointerEnter",k="pointer"),Ie=P==null?L:_(P),U=he==null?L:_(he),L=new ye(F,k+"leave",P,i,Y),L.target=Ie,L.relatedTarget=U,F=null,x(Y)===B&&(ye=new ye(R,k+"enter",he,i,Y),ye.target=U,ye.relatedTarget=Ie,F=ye),Ie=F,P&&he)t:{for(ye=Pb,R=P,k=he,U=0,F=R;F;F=ye(F))U++;F=0;for(var ge=k;ge;ge=ye(ge))F++;for(;0<U-F;)R=ye(R),U--;for(;0<F-U;)k=ye(k),F--;for(;U--;){if(R===k||k!==null&&R===k.alternate){ye=R;break t}R=ye(R),k=ye(k)}ye=null}else ye=null;P!==null&&_p(Q,L,P,ye,!1),he!==null&&Ie!==null&&_p(Q,Ie,he,ye,!0)}}e:{if(L=B?_(B):window,P=L.nodeName&&L.nodeName.toLowerCase(),P==="select"||P==="input"&&L.type==="file")var Be=Bh;else if(qh(L))if(Lh)Be=Zy;else{Be=Xy;var pe=Qy}else P=L.nodeName,!P||P.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?B&&nc(B.elementType)&&(Be=Bh):Be=Ky;if(Be&&(Be=Be(e,B))){Uh(Q,Be,i,Y);break e}pe&&pe(e,L,B),e==="focusout"&&B&&L.type==="number"&&B.memoizedProps.value!=null&&tc(L,"number",L.value)}switch(pe=B?_(B):window,e){case"focusin":(qh(pe)||pe.contentEditable==="true")&&(Pi=pe,gc=B,Vr=null);break;case"focusout":Vr=gc=Pi=null;break;case"mousedown":yc=!0;break;case"contextmenu":case"mouseup":case"dragend":yc=!1,Jh(Q,i,Y);break;case"selectionchange":if(eb)break;case"keydown":case"keyup":Jh(Q,i,Y)}var Ae;if(hc)e:{switch(e){case"compositionstart":var De="onCompositionStart";break e;case"compositionend":De="onCompositionEnd";break e;case"compositionupdate":De="onCompositionUpdate";break e}De=void 0}else Hi?Dh(e,i)&&(De="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(De="onCompositionStart");De&&(kh&&i.locale!=="ko"&&(Hi||De!=="onCompositionStart"?De==="onCompositionEnd"&&Hi&&(Ae=jh()):(_s=Y,lc="value"in _s?_s.value:_s.textContent,Hi=!0)),pe=Zl(B,De),0<pe.length&&(De=new Nh(De,e,null,i,Y),Q.push({event:De,listeners:pe}),Ae?De.data=Ae:(Ae=zh(i),Ae!==null&&(De.data=Ae)))),(Ae=Gy?Vy(e,i):Fy(e,i))&&(De=Zl(B,"onBeforeInput"),0<De.length&&(pe=new Nh("onBeforeInput","beforeinput",null,i,Y),Q.push({event:pe,listeners:De}),pe.data=Ae)),Ub(Q,e,B,i,Y)}xp(Q,t)})}function ga(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Zl(e,t){for(var i=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=Ur(e,i),c!=null&&l.unshift(ga(e,c,u)),c=Ur(e,t),c!=null&&l.push(ga(e,c,u))),e.tag===3)return l;e=e.return}return[]}function Pb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function _p(e,t,i,l,c){for(var u=t._reactName,p=[];i!==null&&i!==l;){var b=i,j=b.alternate,B=b.stateNode;if(b=b.tag,j!==null&&j===l)break;b!==5&&b!==26&&b!==27||B===null||(j=B,c?(B=Ur(i,u),B!=null&&p.unshift(ga(i,B,j))):c||(B=Ur(i,u),B!=null&&p.push(ga(i,B,j)))),i=i.return}p.length!==0&&e.push({event:t,listeners:p})}var $b=/\r\n?/g,Yb=/\u0000|\uFFFD/g;function wp(e){return(typeof e=="string"?e:""+e).replace($b,`
|
|
26
|
+
`).replace(Yb,"")}function Sp(e,t){return t=wp(t),wp(e)===t}function Je(e,t,i,l,c,u){switch(i){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||Ui(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&Ui(e,""+l);break;case"className":En(e,"class",l);break;case"tabIndex":En(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":En(e,i,l);break;case"style":Sh(e,l,u);break;case"data":if(t!=="object"){En(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=il(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(i==="formAction"?(t!=="input"&&Je(e,t,"name",c.name,c,null),Je(e,t,"formEncType",c.formEncType,c,null),Je(e,t,"formMethod",c.formMethod,c,null),Je(e,t,"formTarget",c.formTarget,c,null)):(Je(e,t,"encType",c.encType,c,null),Je(e,t,"method",c.method,c,null),Je(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=il(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Jn);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=il(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Ce("beforetoggle",e),Ce("toggle",e),Ct(e,"popover",l);break;case"xlinkActuate":Fn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Fn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Fn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Fn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Fn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Fn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Fn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Fn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Fn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ct(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=yy.get(i)||i,Ct(e,i,l))}}function $u(e,t,i,l,c,u){switch(i){case"style":Sh(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"children":typeof l=="string"?Ui(e,l):(typeof l=="number"||typeof l=="bigint")&&Ui(e,""+l);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Jn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!I.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(c=i.endsWith("Capture"),t=i.slice(2,c?i.length-7:void 0),u=e[it]||null,u=u!=null?u[i]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof l=="function")){typeof u!="function"&&u!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,l,c);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):Ct(e,i,l)}}}function At(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ce("error",e),Ce("load",e);var l=!1,c=!1,u;for(u in i)if(i.hasOwnProperty(u)){var p=i[u];if(p!=null)switch(u){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Je(e,t,u,p,i,null)}}c&&Je(e,t,"srcSet",i.srcSet,i,null),l&&Je(e,t,"src",i.src,i,null);return;case"input":Ce("invalid",e);var b=u=p=c=null,j=null,B=null;for(l in i)if(i.hasOwnProperty(l)){var Y=i[l];if(Y!=null)switch(l){case"name":c=Y;break;case"type":p=Y;break;case"checked":j=Y;break;case"defaultChecked":B=Y;break;case"value":u=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,t));break;default:Je(e,t,l,Y,i,null)}}xh(e,u,b,j,B,p,c,!1);return;case"select":Ce("invalid",e),l=p=u=null;for(c in i)if(i.hasOwnProperty(c)&&(b=i[c],b!=null))switch(c){case"value":u=b;break;case"defaultValue":p=b;break;case"multiple":l=b;default:Je(e,t,c,b,i,null)}t=u,i=p,e.multiple=!!l,t!=null?qi(e,!!l,t,!1):i!=null&&qi(e,!!l,i,!0);return;case"textarea":Ce("invalid",e),u=c=l=null;for(p in i)if(i.hasOwnProperty(p)&&(b=i[p],b!=null))switch(p){case"value":l=b;break;case"defaultValue":c=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Je(e,t,p,b,i,null)}_h(e,l,c,u);return;case"option":for(j in i)if(i.hasOwnProperty(j)&&(l=i[j],l!=null))switch(j){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Je(e,t,j,l,i,null)}return;case"dialog":Ce("beforetoggle",e),Ce("toggle",e),Ce("cancel",e),Ce("close",e);break;case"iframe":case"object":Ce("load",e);break;case"video":case"audio":for(l=0;l<pa.length;l++)Ce(pa[l],e);break;case"image":Ce("error",e),Ce("load",e);break;case"details":Ce("toggle",e);break;case"embed":case"source":case"link":Ce("error",e),Ce("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(B in i)if(i.hasOwnProperty(B)&&(l=i[B],l!=null))switch(B){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Je(e,t,B,l,i,null)}return;default:if(nc(t)){for(Y in i)i.hasOwnProperty(Y)&&(l=i[Y],l!==void 0&&$u(e,t,Y,l,i,void 0));return}}for(b in i)i.hasOwnProperty(b)&&(l=i[b],l!=null&&Je(e,t,b,l,i,null))}function Gb(e,t,i,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,p=null,b=null,j=null,B=null,Y=null;for(P in i){var Q=i[P];if(i.hasOwnProperty(P)&&Q!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":j=Q;default:l.hasOwnProperty(P)||Je(e,t,P,null,l,Q)}}for(var L in l){var P=l[L];if(Q=i[L],l.hasOwnProperty(L)&&(P!=null||Q!=null))switch(L){case"type":u=P;break;case"name":c=P;break;case"checked":B=P;break;case"defaultChecked":Y=P;break;case"value":p=P;break;case"defaultValue":b=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(a(137,t));break;default:P!==Q&&Je(e,t,L,P,l,Q)}}ec(e,p,b,j,B,Y,u,c);return;case"select":P=p=b=L=null;for(u in i)if(j=i[u],i.hasOwnProperty(u)&&j!=null)switch(u){case"value":break;case"multiple":P=j;default:l.hasOwnProperty(u)||Je(e,t,u,null,l,j)}for(c in l)if(u=l[c],j=i[c],l.hasOwnProperty(c)&&(u!=null||j!=null))switch(c){case"value":L=u;break;case"defaultValue":b=u;break;case"multiple":p=u;default:u!==j&&Je(e,t,c,u,l,j)}t=b,i=p,l=P,L!=null?qi(e,!!i,L,!1):!!l!=!!i&&(t!=null?qi(e,!!i,t,!0):qi(e,!!i,i?[]:"",!1));return;case"textarea":P=L=null;for(b in i)if(c=i[b],i.hasOwnProperty(b)&&c!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Je(e,t,b,null,l,c)}for(p in l)if(c=l[p],u=i[p],l.hasOwnProperty(p)&&(c!=null||u!=null))switch(p){case"value":L=c;break;case"defaultValue":P=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(a(91));break;default:c!==u&&Je(e,t,p,c,l,u)}vh(e,L,P);return;case"option":for(var he in i)if(L=i[he],i.hasOwnProperty(he)&&L!=null&&!l.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:Je(e,t,he,null,l,L)}for(j in l)if(L=l[j],P=i[j],l.hasOwnProperty(j)&&L!==P&&(L!=null||P!=null))switch(j){case"selected":e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Je(e,t,j,L,l,P)}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 ye in i)L=i[ye],i.hasOwnProperty(ye)&&L!=null&&!l.hasOwnProperty(ye)&&Je(e,t,ye,null,l,L);for(B in l)if(L=l[B],P=i[B],l.hasOwnProperty(B)&&L!==P&&(L!=null||P!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(a(137,t));break;default:Je(e,t,B,L,l,P)}return;default:if(nc(t)){for(var Ie in i)L=i[Ie],i.hasOwnProperty(Ie)&&L!==void 0&&!l.hasOwnProperty(Ie)&&$u(e,t,Ie,void 0,l,L);for(Y in l)L=l[Y],P=i[Y],!l.hasOwnProperty(Y)||L===P||L===void 0&&P===void 0||$u(e,t,Y,L,l,P);return}}for(var R in i)L=i[R],i.hasOwnProperty(R)&&L!=null&&!l.hasOwnProperty(R)&&Je(e,t,R,null,l,L);for(Q in l)L=l[Q],P=i[Q],!l.hasOwnProperty(Q)||L===P||L==null&&P==null||Je(e,t,Q,L,l,P)}function Ep(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Vb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var c=i[l],u=c.transferSize,p=c.initiatorType,b=c.duration;if(u&&b&&Ep(p)){for(p=0,b=c.responseEnd,l+=1;l<i.length;l++){var j=i[l],B=j.startTime;if(B>b)break;var Y=j.transferSize,Q=j.initiatorType;Y&&Ep(Q)&&(j=j.responseEnd,p+=Y*(j<b?1:(b-B)/(j-B)))}if(--l,t+=8*(u+p)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Yu=null,Gu=null;function Wl(e){return e.nodeType===9?e:e.ownerDocument}function Ap(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function jp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Vu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Fu=null;function Fb(){var e=window.event;return e&&e.type==="popstate"?e===Fu?!1:(Fu=e,!0):(Fu=null,!1)}var Op=typeof setTimeout=="function"?setTimeout:void 0,Jb=typeof clearTimeout=="function"?clearTimeout:void 0,Tp=typeof Promise=="function"?Promise:void 0,Ib=typeof queueMicrotask=="function"?queueMicrotask:typeof Tp<"u"?function(e){return Tp.resolve(null).then(e).catch(Qb)}:Op;function Qb(e){setTimeout(function(){throw e})}function Bs(e){return e==="head"}function Np(e,t){var i=t,l=0;do{var c=i.nextSibling;if(e.removeChild(i),c&&c.nodeType===8)if(i=c.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(c),mr(t);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")ya(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,ya(i);for(var u=i.firstChild;u;){var p=u.nextSibling,b=u.nodeName;u[yt]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||i.removeChild(u),u=p}}else i==="body"&&ya(e.ownerDocument.body);i=c}while(i);mr(t)}function Cp(e,t){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function Ju(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Ju(i),zi(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Xb(e,t,i,l){for(;e.nodeType===1;){var c=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[yt])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=gn(e.nextSibling),e===null)break}return null}function Kb(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=gn(e.nextSibling),e===null))return null;return e}function kp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=gn(e.nextSibling),e===null))return null;return e}function Iu(e){return e.data==="$?"||e.data==="$~"}function Qu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Zb(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var l=function(){t(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function gn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Xu=null;function Mp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return gn(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function Rp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Dp(e,t,i){switch(t=Wl(i),e){case"html":if(e=t.documentElement,!e)throw Error(a(452));return e;case"head":if(e=t.head,!e)throw Error(a(453));return e;case"body":if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function ya(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);zi(e)}var yn=new Map,zp=new Set;function eo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var cs=te.d;te.d={f:Wb,r:ex,D:tx,C:nx,L:sx,m:ix,X:ax,S:rx,M:lx};function Wb(){var e=cs.f(),t=Vl();return e||t}function ex(e){var t=S(e);t!==null&&t.tag===5&&t.type==="form"?Zd(t):cs.r(e)}var fr=typeof document>"u"?null:document;function qp(e,t,i){var l=fr;if(l&&typeof t=="string"&&t){var c=cn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof i=="string"&&(c+='[crossorigin="'+i+'"]'),zp.has(c)||(zp.add(c),e={rel:e,crossOrigin:i,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function tx(e){cs.D(e),qp("dns-prefetch",e,null)}function nx(e,t){cs.C(e,t),qp("preconnect",e,t)}function sx(e,t,i){cs.L(e,t,i);var l=fr;if(l&&e&&t){var c='link[rel="preload"][as="'+cn(t)+'"]';t==="image"&&i&&i.imageSrcSet?(c+='[imagesrcset="'+cn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(c+='[imagesizes="'+cn(i.imageSizes)+'"]')):c+='[href="'+cn(e)+'"]';var u=c;switch(t){case"style":u=hr(e);break;case"script":u=dr(e)}yn.has(u)||(e=w({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),yn.set(u,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(ba(u))||t==="script"&&l.querySelector(xa(u))||(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function ix(e,t){cs.m(e,t);var i=fr;if(i&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+cn(l)+'"][href="'+cn(e)+'"]',u=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=dr(e)}if(!yn.has(u)&&(e=w({rel:"modulepreload",href:e},t),yn.set(u,e),i.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(xa(u)))return}l=i.createElement("link"),At(l,"link",e),N(l),i.head.appendChild(l)}}}function rx(e,t,i){cs.S(e,t,i);var l=fr;if(l&&e){var c=A(l).hoistableStyles,u=hr(e);t=t||"default";var p=c.get(u);if(!p){var b={loading:0,preload:null};if(p=l.querySelector(ba(u)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},i),(i=yn.get(u))&&Ku(e,i);var j=p=l.createElement("link");N(j),At(j,"link",e),j._p=new Promise(function(B,Y){j.onload=B,j.onerror=Y}),j.addEventListener("load",function(){b.loading|=1}),j.addEventListener("error",function(){b.loading|=2}),b.loading|=4,to(p,t,l)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(u,p)}}}function ax(e,t){cs.X(e,t);var i=fr;if(i&&e){var l=A(i).hoistableScripts,c=dr(e),u=l.get(c);u||(u=i.querySelector(xa(c)),u||(e=w({src:e,async:!0},t),(t=yn.get(c))&&Zu(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function lx(e,t){cs.M(e,t);var i=fr;if(i&&e){var l=A(i).hoistableScripts,c=dr(e),u=l.get(c);u||(u=i.querySelector(xa(c)),u||(e=w({src:e,async:!0,type:"module"},t),(t=yn.get(c))&&Zu(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function Up(e,t,i,l){var c=(c=an.current)?eo(c):null;if(!c)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=hr(i.href),i=A(c).hoistableStyles,l=i.get(t),l||(l={type:"style",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=hr(i.href);var u=A(c).hoistableStyles,p=u.get(e);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,p),(u=c.querySelector(ba(e)))&&!u._p&&(p.instance=u,p.state.loading=5),yn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},yn.set(e,i),u||ox(c,e,i,p.state))),t&&l===null)throw Error(a(528,""));return p}if(t&&l!==null)throw Error(a(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=dr(i),i=A(c).hoistableScripts,l=i.get(t),l||(l={type:"script",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function hr(e){return'href="'+cn(e)+'"'}function ba(e){return'link[rel="stylesheet"]['+e+"]"}function Bp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function ox(e,t,i,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),At(t,"link",i),N(t),e.head.appendChild(t))}function dr(e){return'[src="'+cn(e)+'"]'}function xa(e){return"script[async]"+e}function Lp(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+cn(i.href)+'"]');if(l)return t.instance=l,N(l),l;var c=w({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),N(l),At(l,"style",c),to(l,i.precedence,e),t.instance=l;case"stylesheet":c=hr(i.href);var u=e.querySelector(ba(c));if(u)return t.state.loading|=4,t.instance=u,N(u),u;l=Bp(i),(c=yn.get(c))&&Ku(l,c),u=(e.ownerDocument||e).createElement("link"),N(u);var p=u;return p._p=new Promise(function(b,j){p.onload=b,p.onerror=j}),At(u,"link",l),t.state.loading|=4,to(u,i.precedence,e),t.instance=u;case"script":return u=dr(i.src),(c=e.querySelector(xa(u)))?(t.instance=c,N(c),c):(l=i,(c=yn.get(u))&&(l=w({},i),Zu(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),N(c),At(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(a(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,to(l,i.precedence,e));return t.instance}function to(e,t,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,u=c,p=0;p<l.length;p++){var b=l[p];if(b.dataset.precedence===t)u=b;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function Ku(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Zu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var no=null;function Hp(e,t,i){if(no===null){var l=new Map,c=no=new Map;c.set(i,l)}else c=no,l=c.get(i),l||(l=new Map,c.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),c=0;c<i.length;c++){var u=i[c];if(!(u[yt]||u[Qe]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var p=u.getAttribute(t)||"";p=e+p;var b=l.get(p);b?b.push(u):l.set(p,[u])}}return l}function Pp(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function cx(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function $p(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ux(e,t,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var c=hr(l.href),u=t.querySelector(ba(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=so.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=u,N(u);return}u=t.ownerDocument||t,l=Bp(l),(c=yn.get(c))&&Ku(l,c),u=u.createElement("link"),N(u);var p=u;p._p=new Promise(function(b,j){p.onload=b,p.onerror=j}),At(u,"link",l),i.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=so.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Wu=0;function fx(e,t){return e.stylesheets&&e.count===0&&ro(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&ro(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Wu===0&&(Wu=62500*Vb());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ro(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Wu?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function so(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ro(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var io=null;function ro(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,io=new Map,t.forEach(hx,e),io=null,so.call(e))}function hx(e,t){if(!(t.state.loading&4)){var i=io.get(e);if(i)var l=i.get(null);else{i=new Map,io.set(e,i);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var p=c[u];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(i.set(p.dataset.precedence,p),l=p)}l&&i.set(null,l)}c=t.instance,p=c.getAttribute("data-precedence"),u=i.get(p)||l,u===l&&i.set(null,c),i.set(p,c),this.count++,l=so.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var va={$$typeof:me,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function dx(e,t,i,l,c,u,p,b,j){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ys(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ys(0),this.hiddenUpdates=ys(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=j,this.incompleteTransitions=new Map}function Yp(e,t,i,l,c,u,p,b,j,B,Y,Q){return e=new dx(e,t,i,p,j,B,Y,Q,b),t=1,u===!0&&(t|=24),u=Vt(3,null,null,t),e.current=u,u.stateNode=e,t=Mc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:i,cache:t},qc(u),e}function Gp(e){return e?(e=Gi,e):Gi}function Vp(e,t,i,l,c,u){c=Gp(c),l.context===null?l.context=c:l.pendingContext=c,l=Os(t),l.payload={element:i},u=u===void 0?null:u,u!==null&&(l.callback=u),i=Ts(e,l,t),i!==null&&(Ht(i,e,t),Zr(i,e,t))}function Fp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function ef(e,t){Fp(e,t),(e=e.alternate)&&Fp(e,t)}function Jp(e){if(e.tag===13||e.tag===31){var t=fi(e,67108864);t!==null&&Ht(t,e,67108864),ef(e,67108864)}}function Ip(e){if(e.tag===13||e.tag===31){var t=Xt();t=Vn(t);var i=fi(e,t);i!==null&&Ht(i,e,t),ef(e,t)}}var ao=!0;function mx(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=2,tf(e,t,i,l)}finally{te.p=u,$.T=c}}function px(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=8,tf(e,t,i,l)}finally{te.p=u,$.T=c}}function tf(e,t,i,l){if(ao){var c=nf(l);if(c===null)Pu(e,t,l,lo,i),Xp(e,l);else if(yx(c,e,t,i,l))l.stopPropagation();else if(Xp(e,l),t&4&&-1<gx.indexOf(e)){for(;c!==null;){var u=S(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var p=wn(u.pendingLanes);if(p!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;p;){var j=1<<31-Nt(p);b.entanglements[1]|=j,p&=~j}qn(u),(Pe&6)===0&&(Yl=et()+500,ma(0))}}break;case 31:case 13:b=fi(u,2),b!==null&&Ht(b,u,2),Vl(),ef(u,2)}if(u=nf(l),u===null&&Pu(e,t,l,lo,i),u===c)break;c=u}c!==null&&l.stopPropagation()}else Pu(e,t,l,null,i)}}function nf(e){return e=ic(e),sf(e)}var lo=null;function sf(e){if(lo=null,e=x(e),e!==null){var t=f(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=h(t),e!==null)return e;e=null}else if(i===31){if(e=m(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return lo=e,null}function Qp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Xo()){case Xa:return 2;case Ka:return 8;case Mi:case Ko:return 32;case Za:return 268435456;default:return 32}default:return 32}}var rf=!1,Ls=null,Hs=null,Ps=null,_a=new Map,wa=new Map,$s=[],gx="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Xp(e,t){switch(e){case"focusin":case"focusout":Ls=null;break;case"dragenter":case"dragleave":Hs=null;break;case"mouseover":case"mouseout":Ps=null;break;case"pointerover":case"pointerout":_a.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":wa.delete(t.pointerId)}}function Sa(e,t,i,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:i,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=S(t),t!==null&&Jp(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function yx(e,t,i,l,c){switch(t){case"focusin":return Ls=Sa(Ls,e,t,i,l,c),!0;case"dragenter":return Hs=Sa(Hs,e,t,i,l,c),!0;case"mouseover":return Ps=Sa(Ps,e,t,i,l,c),!0;case"pointerover":var u=c.pointerId;return _a.set(u,Sa(_a.get(u)||null,e,t,i,l,c)),!0;case"gotpointercapture":return u=c.pointerId,wa.set(u,Sa(wa.get(u)||null,e,t,i,l,c)),!0}return!1}function Kp(e){var t=x(e.target);if(t!==null){var i=f(t);if(i!==null){if(t=i.tag,t===13){if(t=h(i),t!==null){e.blockedOn=t,el(e.priority,function(){Ip(i)});return}}else if(t===31){if(t=m(i),t!==null){e.blockedOn=t,el(e.priority,function(){Ip(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function oo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=nf(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);sc=l,i.target.dispatchEvent(l),sc=null}else return t=S(i),t!==null&&Jp(t),e.blockedOn=i,!1;t.shift()}return!0}function Zp(e,t,i){oo(e)&&i.delete(t)}function bx(){rf=!1,Ls!==null&&oo(Ls)&&(Ls=null),Hs!==null&&oo(Hs)&&(Hs=null),Ps!==null&&oo(Ps)&&(Ps=null),_a.forEach(Zp),wa.forEach(Zp)}function co(e,t){e.blockedOn===t&&(e.blockedOn=null,rf||(rf=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,bx)))}var uo=null;function Wp(e){uo!==e&&(uo=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){uo===e&&(uo=null);for(var t=0;t<e.length;t+=3){var i=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(sf(l||i)===null)continue;break}var u=S(i);u!==null&&(e.splice(t,3),t-=3,nu(u,{pending:!0,data:c,method:i.method,action:l},l,c))}}))}function mr(e){function t(j){return co(j,e)}Ls!==null&&co(Ls,e),Hs!==null&&co(Hs,e),Ps!==null&&co(Ps,e),_a.forEach(t),wa.forEach(t);for(var i=0;i<$s.length;i++){var l=$s[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<$s.length&&(i=$s[0],i.blockedOn===null);)Kp(i),i.blockedOn===null&&$s.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var c=i[l],u=i[l+1],p=c[it]||null;if(typeof u=="function")p||Wp(i);else if(p){var b=null;if(u&&u.hasAttribute("formAction")){if(c=u,p=u[it]||null)b=p.formAction;else if(sf(c)!==null)continue}else b=p.action;typeof b=="function"?i[l+1]=b:(i.splice(l,3),l-=3),Wp(i)}}}function e0(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(p){return c=p})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function af(e){this._internalRoot=e}fo.prototype.render=af.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var i=t.current,l=Xt();Vp(i,l,e,t,null,null)},fo.prototype.unmount=af.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Vp(e.current,2,null,e,null,null),Vl(),t[Yt]=null}};function fo(e){this._internalRoot=e}fo.prototype.unstable_scheduleHydration=function(e){if(e){var t=zr();e={blockedOn:null,target:e,priority:t};for(var i=0;i<$s.length&&t!==0&&t<$s[i].priority;i++);$s.splice(i,0,e),i===0&&Kp(e)}};var t0=n.version;if(t0!=="19.2.4")throw Error(a(527,t0,"19.2.4"));te.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=y(t),e=e!==null?E(e):null,e=e===null?null:e.stateNode,e};var xx={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ho=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ho.isDisabled&&ho.supportsFiber)try{ni=ho.inject(xx),ot=ho}catch{}}return Ea.createRoot=function(e,t){if(!o(e))throw Error(a(299));var i=!1,l="",c=om,u=cm,p=um;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=Yp(e,1,!1,null,null,i,l,null,c,u,p,e0),e[Yt]=t.current,Hu(e),new af(t)},Ea.hydrateRoot=function(e,t,i){if(!o(e))throw Error(a(299));var l=!1,c="",u=om,p=cm,b=um,j=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(c=i.identifierPrefix),i.onUncaughtError!==void 0&&(u=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(b=i.onRecoverableError),i.formState!==void 0&&(j=i.formState)),t=Yp(e,1,!0,t,i??null,l,c,j,u,p,b,e0),t.context=Gp(null),i=t.current,l=Xt(),l=Vn(l),c=Os(l),c.callback=null,Ts(i,c,l),i=l,t.current.lanes=i,Sn(t,i),qn(t),e[Yt]=t.current,Hu(e),new fo(t)},Ea.version="19.2.4",Ea}var o0;function sv(){if(o0)return lf.exports;o0=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(n){console.error(n)}}return r(),lf.exports=nv(),lf.exports}var iv=sv();const rv="modulepreload",av=function(r,n){return new URL(r,n).href},c0={},_e=function(n,s,a){let o=Promise.resolve();if(s&&s.length>0){let h=function(E){return Promise.all(E.map(w=>Promise.resolve(w).then(O=>({status:"fulfilled",value:O}),O=>({status:"rejected",reason:O}))))};const m=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),y=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=h(s.map(E=>{if(E=av(E,a),E in c0)return;c0[E]=!0;const w=E.endsWith(".css"),O=w?'[rel="stylesheet"]':"";if(!!a)for(let D=m.length-1;D>=0;D--){const W=m[D];if(W.href===E&&(!w||W.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${E}"]${O}`))return;const M=document.createElement("link");if(M.rel=w?"stylesheet":rv,w||(M.as="script"),M.crossOrigin="",M.href=E,y&&M.setAttribute("nonce",y),document.head.appendChild(M),w)return new Promise((D,W)=>{M.addEventListener("load",D),M.addEventListener("error",()=>W(new Error(`Unable to preload CSS for ${E}`)))})}))}function f(h){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=h,window.dispatchEvent(m),!m.defaultPrevented)throw h}return o.then(h=>{for(const m of h||[])m.status==="rejected"&&f(m.reason);return n().catch(f)})};function Zf(r){try{const n=r.split(".");if(n.length!==3)return null;const s=atob(n[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function pg(r){const n=Zf(r);return!n||typeof n.exp!="number"?null:n.exp}function Wf(r,n=0){const s=pg(r);return s===null?!0:Date.now()/1e3>=s-n}const Wt=window.__LT_BASE__??"",jf=`${Wt}/api`;let Fs=null;function mo(r){Fs=r}function gg(){return Fs}async function u0(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:n,password:s}=JSON.parse(r),a=await fetch(`${jf}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:s})});if(!a.ok)return null;const o=await a.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let Gs=null;async function Ve(r,n={}){const s={"Content-Type":"application/json",...n.headers};if(Fs){if(Wf(Fs)){Gs||(Gs=u0().finally(()=>{Gs=null}));const o=await Gs;if(o)Fs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${Fs}`}let a=await fetch(`${jf}${r}`,{...n,headers:s});if(a.status===401&&Fs){Gs||(Gs=u0().finally(()=>{Gs=null}));const o=await Gs;if(o&&(Fs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}})),s.Authorization=`Bearer ${o}`,a=await fetch(`${jf}${r}`,{...n,headers:s})),a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!a.ok){const o=await a.json().catch(()=>({error:a.statusText}));throw new Error(o.message||o.error||a.statusText)}return a.json()}const yg=T.createContext(null),lv=300;function uf(r,n){if(Wf(r))return null;const s=Zf(r);if(!s)return null;const a=n??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(a==null?void 0:a.displayName)??null,username:(a==null?void 0:a.username)??null,roles:s.roles??[]}}function ov({children:r}){const[n,s]=T.useState(()=>{const w=sessionStorage.getItem("lt_token");return w?Wf(w)?(sessionStorage.removeItem("lt_token"),null):(mo(w),uf(w)):null}),a=T.useRef(void 0),o=T.useCallback(w=>{clearTimeout(a.current);const O=pg(w);if(!O)return;const q=(O-lv)*1e3-Date.now();q<=0||(a.current=setTimeout(async()=>{try{const M=Zf(w);if(M!=null&&M.sso){const re=await fetch(`${Wt}/api/auth/sso`,{method:"POST"});if(!re.ok)return;const C=await re.json();C.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:C.token}}));return}const D=sessionStorage.getItem("lt_credentials");if(!D)return;const{username:W,password:se}=JSON.parse(D),ee=await fetch(`${Wt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:W,password:se})});if(!ee.ok)return;const me=await ee.json();me.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:me.token}}))}catch{}},q))},[]),f=T.useCallback((w,O,q)=>{const M={displayName:(q==null?void 0:q.displayName)??null,username:(q==null?void 0:q.username)??(O==null?void 0:O.username)??null},D=uf(w,M);D&&(mo(w),sessionStorage.setItem("lt_token",w),sessionStorage.setItem("lt_user_info",JSON.stringify(M)),O&&sessionStorage.setItem("lt_credentials",JSON.stringify(O)),s(D),o(w))},[o]),h=T.useCallback(()=>{clearTimeout(a.current);const w=sessionStorage.getItem("lt_sso_logout_url");mo(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),w&&(window.location.href=w)},[]);T.useEffect(()=>{const w=()=>h(),O=q=>{var W;const M=(W=q.detail)==null?void 0:W.token;if(!M)return;const D=uf(M);D&&(mo(M),sessionStorage.setItem("lt_token",M),s(D),o(M))};return window.addEventListener("auth:unauthorized",w),window.addEventListener("auth:refreshed",O),()=>{window.removeEventListener("auth:unauthorized",w),window.removeEventListener("auth:refreshed",O)}},[h,o]),T.useEffect(()=>{const w=sessionStorage.getItem("lt_token");return w&&n&&o(w),()=>clearTimeout(a.current)},[]);const m=(n==null?void 0:n.roles.some(w=>w.type==="superadmin"))??!1,g=T.useCallback(w=>(n==null?void 0:n.roles.some(O=>O.role===w))??!1,[n]),y=T.useCallback(w=>(n==null?void 0:n.roles.some(O=>O.type===w))??!1,[n]),E=(n==null?void 0:n.roles.map(w=>w.role))??[];return d.jsx(yg.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:m,login:f,logout:h,hasRole:g,hasRoleType:y,userRoleNames:E},children:r})}function Oi(){const r=T.useContext(yg);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const nn=new Uint8Array(0),Ti=new TextEncoder,en=new TextDecoder;function cv(...r){let n=0;for(let o=0;o<r.length;o++)n+=r[o].length;const s=new Uint8Array(n);let a=0;for(let o=0;o<r.length;o++)s.set(r[o],a),a+=r[o].length;return s}function Ra(...r){const n=[];for(let s=0;s<r.length;s++)n.push(Ti.encode(r[s]));return n.length===0?nn:n.length===1?n[0]:cv(...n)}function f0(r){return!r||r.length===0?"":en.decode(r)}const h0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",d0=36,uv=0xcfd41b9100000,m0=33,fv=333,p0=22;function hv(r){for(let n=0;n<r.length;n++)r[n]=Math.floor(Math.random()*255)}function dv(r){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(r):hv(r)}class mv{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(p0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*uv),this.inc=Math.floor(Math.random()*(fv-m0)+m0)}setPre(){const n=new Uint8Array(12);dv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=h0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=p0-1;s>=12;s--)this.buf[s]=h0.charCodeAt(n%d0),n=Math.floor(n/d0)}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 Ks=new mv;var us;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(us||(us={}));var vr;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(vr||(vr={}));var ie;(function(r){r.ApiError="BAD API",r.BadAuthentication="BAD_AUTHENTICATION",r.BadCreds="BAD_CREDS",r.BadHeader="BAD_HEADER",r.BadJson="BAD_JSON",r.BadPayload="BAD_PAYLOAD",r.BadSubject="BAD_SUBJECT",r.Cancelled="CANCELLED",r.ConnectionClosed="CONNECTION_CLOSED",r.ConnectionDraining="CONNECTION_DRAINING",r.ConnectionRefused="CONNECTION_REFUSED",r.ConnectionTimeout="CONNECTION_TIMEOUT",r.Disconnect="DISCONNECT",r.InvalidOption="INVALID_OPTION",r.InvalidPayload="INVALID_PAYLOAD",r.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",r.NoResponders="503",r.NotFunction="NOT_FUNC",r.RequestError="REQUEST_ERROR",r.ServerOptionNotAvailable="SERVER_OPT_NA",r.SubClosed="SUB_CLOSED",r.SubDraining="SUB_DRAINING",r.Timeout="TIMEOUT",r.Tls="TLS",r.Unknown="UNKNOWN_ERROR",r.WssRequired="WSS_REQUIRED",r.JetStreamInvalidAck="JESTREAM_INVALID_ACK",r.JetStream404NoMessages="404",r.JetStream408RequestTimeout="408",r.JetStream409MaxAckPendingExceeded="409",r.JetStream409="409",r.JetStreamNotEnabled="503",r.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",r.AuthorizationViolation="AUTHORIZATION_VIOLATION",r.AuthenticationExpired="AUTHENTICATION_EXPIRED",r.ProtocolError="NATS_PROTOCOL_ERR",r.PermissionsViolation="PERMISSIONS_VIOLATION",r.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",r.AccountExpired="ACCOUNT_EXPIRED"})(ie||(ie={}));function pv(r){return typeof r.code=="string"}class bg{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(ie.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ie.BadJson,"Bad JSON"),this.messages.set(ie.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return gv.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const gv=new bg;class ue extends Error{constructor(s,a,o){super(s);v(this,"name");v(this,"message");v(this,"code");v(this,"permissionContext");v(this,"chainedError");v(this,"api_error");this.name="NatsError",this.message=s,this.code=a,this.chainedError=o}static errorForCode(s,a){const o=bg.getMessage(s);return new ue(o,s,a)}isAuthError(){return this.code===ie.AuthenticationExpired||this.code===ie.AuthorizationViolation||this.code===ie.AccountExpired}isAuthTimeout(){return this.code===ie.AuthenticationTimeout}isPermissionError(){return this.code===ie.PermissionsViolation}isProtocolError(){return this.code===ie.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Kt;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(Kt||(Kt={}));var Cn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(Cn||(Cn={}));var Da;(function(r){r.STATS="io.nats.micro.v1.stats_response",r.INFO="io.nats.micro.v1.info_response",r.PING="io.nats.micro.v1.ping_response"})(Da||(Da={}));const ko="Nats-Service-Error",Mo="Nats-Service-Error-Code";class Ro extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Ro.toServiceError(s)!==null}static toServiceError(s){var o,f;const a=((o=s==null?void 0:s.headers)==null?void 0:o.get(Mo))||"";if(a!==""){const h=parseInt(a)||400,m=((f=s==null?void 0:s.headers)==null?void 0:f.get(ko))||"";return new Ro(h,m.length?m:a)}return null}}function fs(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${Ks.next()}`}const Of="127.0.0.1";var Js;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(Js||(Js={}));function Yo(r,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(o){r[o]=a[o]})}return r}function po(r){return en.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Ar(r,n=!0){const s=n?ue.errorForCode(ie.Timeout):null;let a,o;const f=new Promise((h,m)=>{a={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{m(s===null?ue.errorForCode(ie.Timeout):s)},r)});return Object.assign(f,a)}function Tr(r=0){let n;const s=new Promise(a=>{const o=setTimeout(()=>{a()},r);n={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,n)}function st(){let r={};const n=new Promise((s,a)=>{r={resolve:s,reject:a}});return Object.assign(n,r)}function xg(r){for(let n=r.length-1;n>0;n--){const s=Math.floor(Math.random()*(n+1));[r[n],r[s]]=[r[s],r[n]]}return r}function yv(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function eh(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const n=r.length-1;return{backoff(s){return yv(s>n?r[n]:r[s])}}}function nt(r){return r*1e6}function th(r){return Math.floor(r/1e6)}function g0(r){let a=!0;const o=new Array(r.length);for(let f=0;f<r.length;f++){let h=r.charCodeAt(f);if(h===58||h<33||h>126)throw new ue(`'${r[f]}' is not a valid character for a header key`,ie.BadHeader);a&&97<=h&&h<=122?h-=32:!a&&65<=h&&h<=90&&(h+=32),o[f]=h,a=h==45}return String.fromCharCode(...o)}function hs(r=0,n=""){if(r===0&&n!==""||r>0&&n==="")throw new Error("setting status requires both code and description");return new Is(r,n)}const ff="NATS/1.0";class Is{constructor(n=0,s=""){v(this,"_code");v(this,"headers");v(this,"_description");this._code=n,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[s,a]of this.headers){const o=n.values(s);if(a.length!==o.length)return!1;const f=[...a].sort(),h=[...o].sort();for(let m=0;m<f.length;m++)if(f[m]!==h[m])return!1}return!0}return!1}static decode(n){const s=new Is,o=en.decode(n).split(`\r
|
|
27
|
+
`),f=o[0];if(f!==ff){let h=f.replace(ff,"").trim();if(h.length>0){s._code=parseInt(h,10),isNaN(s._code)&&(s._code=0);const m=s._code.toString();h=h.replace(m,""),s._description=h.trim()}}return o.length>=1&&o.slice(1).map(h=>{if(h){const m=h.indexOf(":");if(m>-1){const g=h.slice(0,m),y=h.slice(m+1).trim();s.append(g,y)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let n=ff;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[s,a]of this.headers)for(let o=0;o<a.length;o++)n=`${n}\r
|
|
28
28
|
${s}: ${a[o]}`;return`${n}\r
|
|
29
29
|
\r
|
|
30
|
-
`}encode(){return
|
|
30
|
+
`}encode(){return Ti.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new ue("invalid header value - \\r and \\n are not allowed.",ie.BadHeader);return n.trim()}keys(){const n=[];for(const s of this.headers.keys())n.push(s);return n}findKeys(n,s=Kt.Exact){const a=this.keys();switch(s){case Kt.Exact:return a.filter(o=>o===n);case Kt.CanonicalMIME:return n=g0(n),a.filter(o=>o===n);default:{const o=n.toLowerCase();return a.filter(f=>o===f.toLowerCase())}}}get(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(n,s=Kt.Exact){return this.findKeys(n,s).length>0}set(n,s,a=Kt.Exact){this.delete(n,a),this.append(n,s,a)}append(n,s,a=Kt.Exact){const o=g0(n);a===Kt.CanonicalMIME&&(n=o);const f=this.findKeys(n,a);n=f.length>0?f[0]:n;const h=Is.validHeaderValue(s);let m=this.headers.get(n);m||(m=[],this.headers.set(n,m)),m.push(h)}values(n,s=Kt.Exact){const a=[];return this.findKeys(n,s).forEach(f=>{const h=this.headers.get(f);h&&a.push(...h)}),a}delete(n,s=Kt.Exact){this.findKeys(n,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const n={};return this.keys().forEach(s=>{n[s]=this.values(s)}),n}get code(){return this._code}get description(){return this._description}static fromRecord(n){const s=new Is;for(const a in n)s.headers.set(a,n[a]);return s}}function Tf(){return{encode(r){return Ti.encode(r)},decode(r){return en.decode(r)}}}function kn(r){return{encode(n){try{return n===void 0&&(n=null),Ti.encode(JSON.stringify(n))}catch(s){throw ue.errorForCode(ie.BadJson,s)}},decode(n){try{return JSON.parse(en.decode(n),r)}catch(s){throw ue.errorForCode(ie.BadJson,s)}}}}function vg(r){var n;return r&&r.data.length===0&&((n=r.headers)==null?void 0:n.code)===503?ue.errorForCode(ie.NoResponders):null}class nh{constructor(n,s,a){v(this,"_headers");v(this,"_msg");v(this,"_rdata");v(this,"_reply");v(this,"_subject");v(this,"publisher");this._msg=n,this._rdata=s,this.publisher=a}get subject(){return this._subject?this._subject:(this._subject=en.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=en.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const n=this._rdata.subarray(0,this._msg.hdr);this._headers=Is.decode(n)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(n=nn,s){return this.reply?(this.publisher.publish(this.reply,n,s),!0):!1}size(){var o;const n=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,a=this._msg.size===-1?0:this._msg.size;return n+s+a}json(n){return kn(n).decode(this.data)}string(){return en.decode(this.data)}requestInfo(){var s;const n=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return n?JSON.parse(n,function(a,o){return(a==="start"||a==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}v(nh,"jc");function _r(r){return Go("durable",r)}function Mt(r){return Go("stream",r)}function Go(r,n=""){if(n==="")throw Error(`${r} name required`);return[".","*",">","/","\\"," "," ",`
|
|
31
31
|
`,"\r"].forEach(a=>{if(n.indexOf(a)!==-1){switch(a){case`
|
|
32
|
-
`:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${a}'`)}}),""}function Na(r,n=""){if(n==="")throw Error(`${r} name required`);const s=vv(n);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function vv(r=""){if(r==="")throw Error("name required");const n=/^[-\w]+$/g;if(r.match(n)===null){for(const a of r.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Tf(r){if(r.data.length>0)return!1;const n=r.headers;return n?n.code>=100&&n.code<200:!1}function Nf(r){var n;return Tf(r)&&((n=r.headers)==null?void 0:n.description)==="Idle Heartbeat"}function _v(r,n,s){const a=hs(r,n),o={hdr:1,sid:0,size:0},f=new th(o,nn,{});return f._headers=a,f._subject=s,f}function vr(r){if(r.data.length!==0)return null;const n=r.headers;return n?vg(n.code,n.description):null}var xn;(function(r){r.MaxBatchExceeded="exceeded maxrequestbatch of",r.MaxExpiresExceeded="exceeded maxrequestexpires of",r.MaxBytesExceeded="exceeded maxrequestmaxbytes of",r.MaxMessageSizeExceeded="message size exceeds maxbytes",r.PushConsumer="consumer is push based",r.MaxWaitingExceeded="exceeded maxwaiting",r.IdleHeartbeatMissed="idle heartbeats missed",r.ConsumerDeleted="consumer deleted"})(xn||(xn={}));function wv(r){return r.code!==ie.JetStream409?!1:[xn.MaxBatchExceeded,xn.MaxExpiresExceeded,xn.MaxBytesExceeded,xn.MaxMessageSizeExceeded,xn.PushConsumer,xn.IdleHeartbeatMissed,xn.ConsumerDeleted].find(s=>r.message.indexOf(s)!==-1)!==void 0}function vg(r,n=""){if(r<300)return null;switch(n=n.toLowerCase(),r){case 404:return new ue(n,ie.JetStream404NoMessages);case 408:return new ue(n,ie.JetStream408RequestTimeout);case 409:{const s=n.startsWith(xn.IdleHeartbeatMissed)?ie.JetStreamIdleHeartBeat:ie.JetStream409;return new ue(n,s)}case 503:return ue.errorForCode(ie.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=ie.Unknown),new ue(n,`${r}`)}}class _t{constructor(){v(this,"inflight");v(this,"processed");v(this,"received");v(this,"noIterator");v(this,"iterClosed");v(this,"done");v(this,"signal");v(this,"yields");v(this,"filtered");v(this,"pendingFiltered");v(this,"ingestionFilterFn");v(this,"protocolFilterFn");v(this,"dispatchedFn");v(this,"ctx");v(this,"_data");v(this,"err");v(this,"time");v(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=st(),this.yields=[],this.iterClosed=st(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:s,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};s&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new ue("unsupported iterator",ie.ApiError);if(this.yielding)throw new ue("already yielding",ie.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let s=0;s<n.length;s++){if(typeof n[s]=="function"){const o=n[s];try{o()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const o=Date.now();yield n[s],this.time=Date.now()-o,this.dispatchedFn&&n[s]&&this.dispatchedFn(n[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class nh{constructor(n,s,a={maxOut:2}){v(this,"interval");v(this,"maxOut");v(this,"cancelAfter");v(this,"timer");v(this,"autoCancelTimer");v(this,"last");v(this,"missed");v(this,"count");v(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,s=0,a=2){this.interval=n,this.maxOut=a,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var Cf;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(Cf||(Cf={}));var Ba;(function(r){r.Old="old",r.New="new"})(Ba||(Ba={}));var kf;(function(r){r.File="file",r.Memory="memory"})(kf||(kf={}));var ft;(function(r){r.All="all",r.Last="last",r.New="new",r.StartSequence="by_start_sequence",r.StartTime="by_start_time",r.LastPerSubject="last_per_subject"})(ft||(ft={}));var vt;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(vt||(vt={}));var Er;(function(r){r.Instant="instant",r.Original="original"})(Er||(Er={}));var Zs;(function(r){r.None="none",r.S2="s2"})(Zs||(Zs={}));var Do;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(Do||(Do={}));function Sv(r,n={}){return Object.assign({name:r,deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Er.Instant},n)}var g0;(function(r){r.API="api_audit",r.StreamAction="stream_action",r.ConsumerAction="consumer_action",r.SnapshotCreate="snapshot_create",r.SnapshotComplete="snapshot_complete",r.RestoreCreate="restore_create",r.RestoreComplete="restore_complete",r.MaxDeliver="max_deliver",r.Terminated="terminated",r.Ack="consumer_ack",r.StreamLeaderElected="stream_leader_elected",r.StreamQuorumLost="stream_quorum_lost",r.ConsumerLeaderElected="consumer_leader_elected",r.ConsumerQuorumLost="consumer_quorum_lost"})(g0||(g0={}));var Dt;(function(r){r.StreamSourceHdr="Nats-Stream-Source",r.LastConsumerSeqHdr="Nats-Last-Consumer",r.LastStreamSeqHdr="Nats-Last-Stream",r.ConsumerStalledHdr="Nats-Consumer-Stalled",r.MessageSizeHdr="Nats-Msg-Size",r.RollupHdr="Nats-Rollup",r.RollupValueSubject="sub",r.RollupValueAll="all",r.PendingMessagesHdr="Nats-Pending-Messages",r.PendingBytesHdr="Nats-Pending-Bytes"})(Dt||(Dt={}));var Tn;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(Tn||(Tn={}));var yr;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(yr||(yr={}));var y0;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(y0||(y0={}));const Zt="KV_";class Ev{constructor(n){v(this,"config");v(this,"ordered");v(this,"mack");v(this,"stream");v(this,"callbackFn");v(this,"max");v(this,"qname");v(this,"isBind");v(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=Sv("",n||{})}getOpts(){var s;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((s=n.config.filter_subjects)==null||s.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?vt.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return xr(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=ft.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=ft.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=ft.All,this}deliverLastPerSubject(){return this.config.deliver_policy=ft.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=ft.Last,this}deliverNew(){return this.config.deliver_policy=ft.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=vt.None,this}ackAll(){return this.config.ack_policy=vt.All,this}ackExplicit(){return this.config.ack_policy=vt.Explicit,this}ackWait(n){return this.config.ack_wait=nt(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=Er.Instant,this}replayOriginal(){return this.config.replay_policy=Er.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=nt(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,s){return this.stream=n,this.config.durable_name=s,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=nt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=nt(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function Is(r){return new Ev(r)}function b0(r){return typeof r.getOpts=="function"}class Av{static encode(n){if(typeof n=="string")return btoa(n);const s=Array.from(n);return btoa(String.fromCharCode(...s))}static decode(n,s=!1){const a=atob(n);return s?Uint8Array.from(a,o=>o.charCodeAt(0)):a}}class _r{static encode(n){return _r.toB64URLEncoding(Av.encode(n))}static decode(n,s=!1){return _r.decode(_r.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class Ar{constructor(){v(this,"buffers");v(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let s=0;for(let f=0;f<n.length;f++)s+=n[f].length;const a=new Uint8Array(s);let o=0;for(let f=0;f<n.length;f++)a.set(n[f],o),o+=n[f].length;return a}static fromAscii(n){return n||(n=""),ji.encode(n)}static toAscii(n){return en.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let s=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],s),s+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const o=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,o}}return new Uint8Array(0)}fill(n,...s){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<s.length;a++)s[a]&&s[a].length&&(this.buffers.push(s[a]),this.byteLength+=s[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function Ov(r,n){return n.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(a){if(a!=="default"&&!(a in r)){var o=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(r)}var jv=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Ea=jv.performance||{};Ea.now||Ea.mozNow||Ea.msNow||Ea.oNow||Ea.webkitNow;var x0={versions:{}},Tv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Nv(r){if(r.__esModule)return r;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(s){var a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return r[s]}})}),n}var ff,Vo={exports:{}},v0={},_0=Nv(Ov({__proto__:null,default:v0},[v0]));ff=Vo,(function(){var r="input is invalid type",n=typeof window=="object",s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&x0.versions&&x0.versions.node;o?s=Tv:a&&(s=self);var f=!s.JS_SHA256_NO_COMMON_JS&&ff.exports,h=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],y=[24,16,8,0],E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],w=["hex","array","digest","arrayBuffer"],j=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(C){return Object.prototype.toString.call(C)==="[object Array]"}),!h||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(C){return typeof C=="object"&&C.buffer&&C.buffer.constructor===ArrayBuffer});var q=function(C,X){return function(ce){return new ee(X,!0).update(ce)[C]()}},M=function(C){var X=q("hex",C);o&&(X=D(X,C)),X.create=function(){return new ee(C)},X.update=function(G){return X.create().update(G)};for(var ce=0;ce<w.length;++ce){var V=w[ce];X[V]=q(V,C)}return X},D=function(C,X){var ce,V=_0,G=_0.Buffer,K=X?"sha224":"sha256";return ce=G.from&&!s.JS_SHA256_NO_BUFFER_FROM?G.from:function(ae){return new G(ae)},function(ae){if(typeof ae=="string")return V.createHash(K).update(ae,"utf8").digest("hex");if(ae==null)throw new Error(r);return ae.constructor===ArrayBuffer&&(ae=new Uint8Array(ae)),Array.isArray(ae)||ArrayBuffer.isView(ae)||ae.constructor===G?V.createHash(K).update(ce(ae)).digest("hex"):C(ae)}},W=function(C,X){return function(ce,V){return new me(ce,X,!0).update(V)[C]()}},se=function(C){var X=W("hex",C);X.create=function(G){return new me(G,C)},X.update=function(G,K){return X.create(G).update(K)};for(var ce=0;ce<w.length;++ce){var V=w[ce];X[V]=W(V,C)}return X};function ee(C,X){X?(j[0]=j[16]=j[1]=j[2]=j[3]=j[4]=j[5]=j[6]=j[7]=j[8]=j[9]=j[10]=j[11]=j[12]=j[13]=j[14]=j[15]=0,this.blocks=j):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],C?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=C}function me(C,X,ce){var V,G=typeof C;if(G==="string"){var K,ae=[],ne=C.length,ke=0;for(V=0;V<ne;++V)(K=C.charCodeAt(V))<128?ae[ke++]=K:K<2048?(ae[ke++]=192|K>>>6,ae[ke++]=128|63&K):K<55296||K>=57344?(ae[ke++]=224|K>>>12,ae[ke++]=128|K>>>6&63,ae[ke++]=128|63&K):(K=65536+((1023&K)<<10|1023&C.charCodeAt(++V)),ae[ke++]=240|K>>>18,ae[ke++]=128|K>>>12&63,ae[ke++]=128|K>>>6&63,ae[ke++]=128|63&K);C=ae}else{if(G!=="object")throw new Error(r);if(C===null)throw new Error(r);if(h&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||h&&ArrayBuffer.isView(C)))throw new Error(r)}C.length>64&&(C=new ee(X,!0).update(C).array());var He=[],Me=[];for(V=0;V<64;++V){var $=C[V]||0;He[V]=92^$,Me[V]=54^$}ee.call(this,X,ce),this.update(Me),this.oKeyPad=He,this.inner=!0,this.sharedMemory=ce}ee.prototype.update=function(C){if(!this.finalized){var X,ce=typeof C;if(ce!=="string"){if(ce!=="object")throw new Error(r);if(C===null)throw new Error(r);if(h&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||h&&ArrayBuffer.isView(C)))throw new Error(r);X=!0}for(var V,G,K=0,ae=C.length,ne=this.blocks;K<ae;){if(this.hashed&&(this.hashed=!1,ne[0]=this.block,this.block=ne[16]=ne[1]=ne[2]=ne[3]=ne[4]=ne[5]=ne[6]=ne[7]=ne[8]=ne[9]=ne[10]=ne[11]=ne[12]=ne[13]=ne[14]=ne[15]=0),X)for(G=this.start;K<ae&&G<64;++K)ne[G>>>2]|=C[K]<<y[3&G++];else for(G=this.start;K<ae&&G<64;++K)(V=C.charCodeAt(K))<128?ne[G>>>2]|=V<<y[3&G++]:V<2048?(ne[G>>>2]|=(192|V>>>6)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]):V<55296||V>=57344?(ne[G>>>2]|=(224|V>>>12)<<y[3&G++],ne[G>>>2]|=(128|V>>>6&63)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]):(V=65536+((1023&V)<<10|1023&C.charCodeAt(++K)),ne[G>>>2]|=(240|V>>>18)<<y[3&G++],ne[G>>>2]|=(128|V>>>12&63)<<y[3&G++],ne[G>>>2]|=(128|V>>>6&63)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]);this.lastByteIndex=G,this.bytes+=G-this.start,G>=64?(this.block=ne[16],this.start=G-64,this.hash(),this.hashed=!0):this.start=G}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},ee.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var C=this.blocks,X=this.lastByteIndex;C[16]=this.block,C[X>>>2]|=g[3&X],this.block=C[16],X>=56&&(this.hashed||this.hash(),C[0]=this.block,C[16]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=0),C[14]=this.hBytes<<3|this.bytes>>>29,C[15]=this.bytes<<3,this.hash()}},ee.prototype.hash=function(){var C,X,ce,V,G,K,ae,ne,ke,He=this.h0,Me=this.h1,$=this.h2,te=this.h3,de=this.h4,ve=this.h5,be=this.h6,je=this.h7,we=this.blocks;for(C=16;C<64;++C)X=((G=we[C-15])>>>7|G<<25)^(G>>>18|G<<14)^G>>>3,ce=((G=we[C-2])>>>17|G<<15)^(G>>>19|G<<13)^G>>>10,we[C]=we[C-16]+X+we[C-7]+ce|0;for(ke=Me&$,C=0;C<64;C+=4)this.first?(this.is224?(K=300032,je=(G=we[0]-1413257819)-150054599|0,te=G+24177077|0):(K=704751109,je=(G=we[0]-210244248)-1521486534|0,te=G+143694565|0),this.first=!1):(X=(He>>>2|He<<30)^(He>>>13|He<<19)^(He>>>22|He<<10),V=(K=He&Me)^He&$^ke,je=te+(G=je+(ce=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&ve^~de&be)+E[C]+we[C])|0,te=G+(X+V)|0),X=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),V=(ae=te&He)^te&Me^K,be=$+(G=be+(ce=(je>>>6|je<<26)^(je>>>11|je<<21)^(je>>>25|je<<7))+(je&de^~je&ve)+E[C+1]+we[C+1])|0,X=(($=G+(X+V)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),V=(ne=$&te)^$&He^ae,ve=Me+(G=ve+(ce=(be>>>6|be<<26)^(be>>>11|be<<21)^(be>>>25|be<<7))+(be&je^~be&de)+E[C+2]+we[C+2])|0,X=((Me=G+(X+V)|0)>>>2|Me<<30)^(Me>>>13|Me<<19)^(Me>>>22|Me<<10),V=(ke=Me&$)^Me&te^ne,de=He+(G=de+(ce=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&be^~ve&je)+E[C+3]+we[C+3])|0,He=G+(X+V)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+He|0,this.h1=this.h1+Me|0,this.h2=this.h2+$|0,this.h3=this.h3+te|0,this.h4=this.h4+de|0,this.h5=this.h5+ve|0,this.h6=this.h6+be|0,this.h7=this.h7+je|0},ee.prototype.hex=function(){this.finalize();var C=this.h0,X=this.h1,ce=this.h2,V=this.h3,G=this.h4,K=this.h5,ae=this.h6,ne=this.h7,ke=d[C>>>28&15]+d[C>>>24&15]+d[C>>>20&15]+d[C>>>16&15]+d[C>>>12&15]+d[C>>>8&15]+d[C>>>4&15]+d[15&C]+d[X>>>28&15]+d[X>>>24&15]+d[X>>>20&15]+d[X>>>16&15]+d[X>>>12&15]+d[X>>>8&15]+d[X>>>4&15]+d[15&X]+d[ce>>>28&15]+d[ce>>>24&15]+d[ce>>>20&15]+d[ce>>>16&15]+d[ce>>>12&15]+d[ce>>>8&15]+d[ce>>>4&15]+d[15&ce]+d[V>>>28&15]+d[V>>>24&15]+d[V>>>20&15]+d[V>>>16&15]+d[V>>>12&15]+d[V>>>8&15]+d[V>>>4&15]+d[15&V]+d[G>>>28&15]+d[G>>>24&15]+d[G>>>20&15]+d[G>>>16&15]+d[G>>>12&15]+d[G>>>8&15]+d[G>>>4&15]+d[15&G]+d[K>>>28&15]+d[K>>>24&15]+d[K>>>20&15]+d[K>>>16&15]+d[K>>>12&15]+d[K>>>8&15]+d[K>>>4&15]+d[15&K]+d[ae>>>28&15]+d[ae>>>24&15]+d[ae>>>20&15]+d[ae>>>16&15]+d[ae>>>12&15]+d[ae>>>8&15]+d[ae>>>4&15]+d[15&ae];return this.is224||(ke+=d[ne>>>28&15]+d[ne>>>24&15]+d[ne>>>20&15]+d[ne>>>16&15]+d[ne>>>12&15]+d[ne>>>8&15]+d[ne>>>4&15]+d[15&ne]),ke},ee.prototype.toString=ee.prototype.hex,ee.prototype.digest=function(){this.finalize();var C=this.h0,X=this.h1,ce=this.h2,V=this.h3,G=this.h4,K=this.h5,ae=this.h6,ne=this.h7,ke=[C>>>24&255,C>>>16&255,C>>>8&255,255&C,X>>>24&255,X>>>16&255,X>>>8&255,255&X,ce>>>24&255,ce>>>16&255,ce>>>8&255,255&ce,V>>>24&255,V>>>16&255,V>>>8&255,255&V,G>>>24&255,G>>>16&255,G>>>8&255,255&G,K>>>24&255,K>>>16&255,K>>>8&255,255&K,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae];return this.is224||ke.push(ne>>>24&255,ne>>>16&255,ne>>>8&255,255&ne),ke},ee.prototype.array=ee.prototype.digest,ee.prototype.arrayBuffer=function(){this.finalize();var C=new ArrayBuffer(this.is224?28:32),X=new DataView(C);return X.setUint32(0,this.h0),X.setUint32(4,this.h1),X.setUint32(8,this.h2),X.setUint32(12,this.h3),X.setUint32(16,this.h4),X.setUint32(20,this.h5),X.setUint32(24,this.h6),this.is224||X.setUint32(28,this.h7),C},me.prototype=new ee,me.prototype.finalize=function(){if(ee.prototype.finalize.call(this),this.inner){this.inner=!1;var C=this.array();ee.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(C),ee.prototype.finalize.call(this)}};var re=M();re.sha256=re,re.sha224=M(!0),re.sha256.hmac=se(),re.sha224.hmac=se(!0),f?ff.exports=re:(s.sha256=re.sha256,s.sha224=re.sha224)})();Vo.exports;Vo.exports.sha224;var w0=Vo.exports.sha256;function Mf(r){return zv(r)}function Cv(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const s=/^[0-9A-F]+$/.test(r),a=/^[0-9a-f]+$/.test(r);return s||a?r.length%2===0:!1}function kv(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function Mv(r){return Cv(r)?"hex":kv(r)?"b64":""}function Rv(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(r.length/2);for(let s=0;s<r.length;s+=2)n[s/2]=parseInt(r.substring(s,s+2),16);return n}function Dv(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const n=atob(r);return Uint8Array.from(n,s=>s.charCodeAt(0))}function zv(r){switch(Mv(r)){case"hex":return Rv(r);case"b64":return Dv(r)}return null}function qv(r,n){const s=typeof r=="string"?Mf(r):r,a=typeof n=="string"?Mf(n):n;if(s===null||a===null||s.length!==a.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==a[o])return!1;return!0}class _g{constructor(n,s,a=!0){v(this,"token");v(this,"received");v(this,"ctx");v(this,"requestSubject");v(this,"mux");this.mux=n,this.requestSubject=s,this.received=0,this.token=Ks.next(),a&&(this.ctx=new Error)}}class Uv extends _g{constructor(s,a,o={maxWait:1e3}){super(s,a);v(this,"callback");v(this,"done");v(this,"timer");v(this,"max");v(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,a){s?(this.ctx&&(s.stack+=`
|
|
32
|
+
`:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${a}'`)}}),""}function Ca(r,n=""){if(n==="")throw Error(`${r} name required`);const s=bv(n);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function bv(r=""){if(r==="")throw Error("name required");const n=/^[-\w]+$/g;if(r.match(n)===null){for(const a of r.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Nf(r){if(r.data.length>0)return!1;const n=r.headers;return n?n.code>=100&&n.code<200:!1}function Cf(r){var n;return Nf(r)&&((n=r.headers)==null?void 0:n.description)==="Idle Heartbeat"}function xv(r,n,s){const a=hs(r,n),o={hdr:1,sid:0,size:0},f=new nh(o,nn,{});return f._headers=a,f._subject=s,f}function wr(r){if(r.data.length!==0)return null;const n=r.headers;return n?_g(n.code,n.description):null}var xn;(function(r){r.MaxBatchExceeded="exceeded maxrequestbatch of",r.MaxExpiresExceeded="exceeded maxrequestexpires of",r.MaxBytesExceeded="exceeded maxrequestmaxbytes of",r.MaxMessageSizeExceeded="message size exceeds maxbytes",r.PushConsumer="consumer is push based",r.MaxWaitingExceeded="exceeded maxwaiting",r.IdleHeartbeatMissed="idle heartbeats missed",r.ConsumerDeleted="consumer deleted"})(xn||(xn={}));function vv(r){return r.code!==ie.JetStream409?!1:[xn.MaxBatchExceeded,xn.MaxExpiresExceeded,xn.MaxBytesExceeded,xn.MaxMessageSizeExceeded,xn.PushConsumer,xn.IdleHeartbeatMissed,xn.ConsumerDeleted].find(s=>r.message.indexOf(s)!==-1)!==void 0}function _g(r,n=""){if(r<300)return null;switch(n=n.toLowerCase(),r){case 404:return new ue(n,ie.JetStream404NoMessages);case 408:return new ue(n,ie.JetStream408RequestTimeout);case 409:{const s=n.startsWith(xn.IdleHeartbeatMissed)?ie.JetStreamIdleHeartBeat:ie.JetStream409;return new ue(n,s)}case 503:return ue.errorForCode(ie.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=ie.Unknown),new ue(n,`${r}`)}}class _t{constructor(){v(this,"inflight");v(this,"processed");v(this,"received");v(this,"noIterator");v(this,"iterClosed");v(this,"done");v(this,"signal");v(this,"yields");v(this,"filtered");v(this,"pendingFiltered");v(this,"ingestionFilterFn");v(this,"protocolFilterFn");v(this,"dispatchedFn");v(this,"ctx");v(this,"_data");v(this,"err");v(this,"time");v(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=st(),this.yields=[],this.iterClosed=st(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:s,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};s&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new ue("unsupported iterator",ie.ApiError);if(this.yielding)throw new ue("already yielding",ie.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let s=0;s<n.length;s++){if(typeof n[s]=="function"){const o=n[s];try{o()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const o=Date.now();yield n[s],this.time=Date.now()-o,this.dispatchedFn&&n[s]&&this.dispatchedFn(n[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class sh{constructor(n,s,a={maxOut:2}){v(this,"interval");v(this,"maxOut");v(this,"cancelAfter");v(this,"timer");v(this,"autoCancelTimer");v(this,"last");v(this,"missed");v(this,"count");v(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,s=0,a=2){this.interval=n,this.maxOut=a,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var kf;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(kf||(kf={}));var Ba;(function(r){r.Old="old",r.New="new"})(Ba||(Ba={}));var Mf;(function(r){r.File="file",r.Memory="memory"})(Mf||(Mf={}));var ft;(function(r){r.All="all",r.Last="last",r.New="new",r.StartSequence="by_start_sequence",r.StartTime="by_start_time",r.LastPerSubject="last_per_subject"})(ft||(ft={}));var vt;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(vt||(vt={}));var jr;(function(r){r.Instant="instant",r.Original="original"})(jr||(jr={}));var Zs;(function(r){r.None="none",r.S2="s2"})(Zs||(Zs={}));var Do;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(Do||(Do={}));function _v(r,n={}){return Object.assign({name:r,deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:jr.Instant},n)}var y0;(function(r){r.API="api_audit",r.StreamAction="stream_action",r.ConsumerAction="consumer_action",r.SnapshotCreate="snapshot_create",r.SnapshotComplete="snapshot_complete",r.RestoreCreate="restore_create",r.RestoreComplete="restore_complete",r.MaxDeliver="max_deliver",r.Terminated="terminated",r.Ack="consumer_ack",r.StreamLeaderElected="stream_leader_elected",r.StreamQuorumLost="stream_quorum_lost",r.ConsumerLeaderElected="consumer_leader_elected",r.ConsumerQuorumLost="consumer_quorum_lost"})(y0||(y0={}));var Dt;(function(r){r.StreamSourceHdr="Nats-Stream-Source",r.LastConsumerSeqHdr="Nats-Last-Consumer",r.LastStreamSeqHdr="Nats-Last-Stream",r.ConsumerStalledHdr="Nats-Consumer-Stalled",r.MessageSizeHdr="Nats-Msg-Size",r.RollupHdr="Nats-Rollup",r.RollupValueSubject="sub",r.RollupValueAll="all",r.PendingMessagesHdr="Nats-Pending-Messages",r.PendingBytesHdr="Nats-Pending-Bytes"})(Dt||(Dt={}));var Tn;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(Tn||(Tn={}));var br;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(br||(br={}));var b0;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(b0||(b0={}));const Zt="KV_";class wv{constructor(n){v(this,"config");v(this,"ordered");v(this,"mack");v(this,"stream");v(this,"callbackFn");v(this,"max");v(this,"qname");v(this,"isBind");v(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=_v("",n||{})}getOpts(){var s;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((s=n.config.filter_subjects)==null||s.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?vt.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return _r(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=ft.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=ft.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=ft.All,this}deliverLastPerSubject(){return this.config.deliver_policy=ft.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=ft.Last,this}deliverNew(){return this.config.deliver_policy=ft.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=vt.None,this}ackAll(){return this.config.ack_policy=vt.All,this}ackExplicit(){return this.config.ack_policy=vt.Explicit,this}ackWait(n){return this.config.ack_wait=nt(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=jr.Instant,this}replayOriginal(){return this.config.replay_policy=jr.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=nt(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,s){return this.stream=n,this.config.durable_name=s,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=nt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=nt(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function Qs(r){return new wv(r)}function x0(r){return typeof r.getOpts=="function"}class Sv{static encode(n){if(typeof n=="string")return btoa(n);const s=Array.from(n);return btoa(String.fromCharCode(...s))}static decode(n,s=!1){const a=atob(n);return s?Uint8Array.from(a,o=>o.charCodeAt(0)):a}}class Sr{static encode(n){return Sr.toB64URLEncoding(Sv.encode(n))}static decode(n,s=!1){return Sr.decode(Sr.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class Or{constructor(){v(this,"buffers");v(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let s=0;for(let f=0;f<n.length;f++)s+=n[f].length;const a=new Uint8Array(s);let o=0;for(let f=0;f<n.length;f++)a.set(n[f],o),o+=n[f].length;return a}static fromAscii(n){return n||(n=""),Ti.encode(n)}static toAscii(n){return en.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let s=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],s),s+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const o=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,o}}return new Uint8Array(0)}fill(n,...s){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<s.length;a++)s[a]&&s[a].length&&(this.buffers.push(s[a]),this.byteLength+=s[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function Ev(r,n){return n.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(a){if(a!=="default"&&!(a in r)){var o=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(r)}var Av=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Aa=Av.performance||{};Aa.now||Aa.mozNow||Aa.msNow||Aa.oNow||Aa.webkitNow;var v0={versions:{}},jv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ov(r){if(r.__esModule)return r;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(s){var a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return r[s]}})}),n}var hf,Vo={exports:{}},_0={},w0=Ov(Ev({__proto__:null,default:_0},[_0]));hf=Vo,(function(){var r="input is invalid type",n=typeof window=="object",s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&v0.versions&&v0.versions.node;o?s=jv:a&&(s=self);var f=!s.JS_SHA256_NO_COMMON_JS&&hf.exports,h=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",m="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],y=[24,16,8,0],E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],w=["hex","array","digest","arrayBuffer"],O=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(C){return Object.prototype.toString.call(C)==="[object Array]"}),!h||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(C){return typeof C=="object"&&C.buffer&&C.buffer.constructor===ArrayBuffer});var q=function(C,X){return function(ce){return new ee(X,!0).update(ce)[C]()}},M=function(C){var X=q("hex",C);o&&(X=D(X,C)),X.create=function(){return new ee(C)},X.update=function(G){return X.create().update(G)};for(var ce=0;ce<w.length;++ce){var V=w[ce];X[V]=q(V,C)}return X},D=function(C,X){var ce,V=w0,G=w0.Buffer,K=X?"sha224":"sha256";return ce=G.from&&!s.JS_SHA256_NO_BUFFER_FROM?G.from:function(ae){return new G(ae)},function(ae){if(typeof ae=="string")return V.createHash(K).update(ae,"utf8").digest("hex");if(ae==null)throw new Error(r);return ae.constructor===ArrayBuffer&&(ae=new Uint8Array(ae)),Array.isArray(ae)||ArrayBuffer.isView(ae)||ae.constructor===G?V.createHash(K).update(ce(ae)).digest("hex"):C(ae)}},W=function(C,X){return function(ce,V){return new me(ce,X,!0).update(V)[C]()}},se=function(C){var X=W("hex",C);X.create=function(G){return new me(G,C)},X.update=function(G,K){return X.create(G).update(K)};for(var ce=0;ce<w.length;++ce){var V=w[ce];X[V]=W(V,C)}return X};function ee(C,X){X?(O[0]=O[16]=O[1]=O[2]=O[3]=O[4]=O[5]=O[6]=O[7]=O[8]=O[9]=O[10]=O[11]=O[12]=O[13]=O[14]=O[15]=0,this.blocks=O):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],C?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=C}function me(C,X,ce){var V,G=typeof C;if(G==="string"){var K,ae=[],ne=C.length,ke=0;for(V=0;V<ne;++V)(K=C.charCodeAt(V))<128?ae[ke++]=K:K<2048?(ae[ke++]=192|K>>>6,ae[ke++]=128|63&K):K<55296||K>=57344?(ae[ke++]=224|K>>>12,ae[ke++]=128|K>>>6&63,ae[ke++]=128|63&K):(K=65536+((1023&K)<<10|1023&C.charCodeAt(++V)),ae[ke++]=240|K>>>18,ae[ke++]=128|K>>>12&63,ae[ke++]=128|K>>>6&63,ae[ke++]=128|63&K);C=ae}else{if(G!=="object")throw new Error(r);if(C===null)throw new Error(r);if(h&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||h&&ArrayBuffer.isView(C)))throw new Error(r)}C.length>64&&(C=new ee(X,!0).update(C).array());var He=[],Me=[];for(V=0;V<64;++V){var $=C[V]||0;He[V]=92^$,Me[V]=54^$}ee.call(this,X,ce),this.update(Me),this.oKeyPad=He,this.inner=!0,this.sharedMemory=ce}ee.prototype.update=function(C){if(!this.finalized){var X,ce=typeof C;if(ce!=="string"){if(ce!=="object")throw new Error(r);if(C===null)throw new Error(r);if(h&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||h&&ArrayBuffer.isView(C)))throw new Error(r);X=!0}for(var V,G,K=0,ae=C.length,ne=this.blocks;K<ae;){if(this.hashed&&(this.hashed=!1,ne[0]=this.block,this.block=ne[16]=ne[1]=ne[2]=ne[3]=ne[4]=ne[5]=ne[6]=ne[7]=ne[8]=ne[9]=ne[10]=ne[11]=ne[12]=ne[13]=ne[14]=ne[15]=0),X)for(G=this.start;K<ae&&G<64;++K)ne[G>>>2]|=C[K]<<y[3&G++];else for(G=this.start;K<ae&&G<64;++K)(V=C.charCodeAt(K))<128?ne[G>>>2]|=V<<y[3&G++]:V<2048?(ne[G>>>2]|=(192|V>>>6)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]):V<55296||V>=57344?(ne[G>>>2]|=(224|V>>>12)<<y[3&G++],ne[G>>>2]|=(128|V>>>6&63)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]):(V=65536+((1023&V)<<10|1023&C.charCodeAt(++K)),ne[G>>>2]|=(240|V>>>18)<<y[3&G++],ne[G>>>2]|=(128|V>>>12&63)<<y[3&G++],ne[G>>>2]|=(128|V>>>6&63)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]);this.lastByteIndex=G,this.bytes+=G-this.start,G>=64?(this.block=ne[16],this.start=G-64,this.hash(),this.hashed=!0):this.start=G}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},ee.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var C=this.blocks,X=this.lastByteIndex;C[16]=this.block,C[X>>>2]|=g[3&X],this.block=C[16],X>=56&&(this.hashed||this.hash(),C[0]=this.block,C[16]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=0),C[14]=this.hBytes<<3|this.bytes>>>29,C[15]=this.bytes<<3,this.hash()}},ee.prototype.hash=function(){var C,X,ce,V,G,K,ae,ne,ke,He=this.h0,Me=this.h1,$=this.h2,te=this.h3,de=this.h4,ve=this.h5,be=this.h6,Oe=this.h7,we=this.blocks;for(C=16;C<64;++C)X=((G=we[C-15])>>>7|G<<25)^(G>>>18|G<<14)^G>>>3,ce=((G=we[C-2])>>>17|G<<15)^(G>>>19|G<<13)^G>>>10,we[C]=we[C-16]+X+we[C-7]+ce|0;for(ke=Me&$,C=0;C<64;C+=4)this.first?(this.is224?(K=300032,Oe=(G=we[0]-1413257819)-150054599|0,te=G+24177077|0):(K=704751109,Oe=(G=we[0]-210244248)-1521486534|0,te=G+143694565|0),this.first=!1):(X=(He>>>2|He<<30)^(He>>>13|He<<19)^(He>>>22|He<<10),V=(K=He&Me)^He&$^ke,Oe=te+(G=Oe+(ce=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&ve^~de&be)+E[C]+we[C])|0,te=G+(X+V)|0),X=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),V=(ae=te&He)^te&Me^K,be=$+(G=be+(ce=(Oe>>>6|Oe<<26)^(Oe>>>11|Oe<<21)^(Oe>>>25|Oe<<7))+(Oe&de^~Oe&ve)+E[C+1]+we[C+1])|0,X=(($=G+(X+V)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),V=(ne=$&te)^$&He^ae,ve=Me+(G=ve+(ce=(be>>>6|be<<26)^(be>>>11|be<<21)^(be>>>25|be<<7))+(be&Oe^~be&de)+E[C+2]+we[C+2])|0,X=((Me=G+(X+V)|0)>>>2|Me<<30)^(Me>>>13|Me<<19)^(Me>>>22|Me<<10),V=(ke=Me&$)^Me&te^ne,de=He+(G=de+(ce=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&be^~ve&Oe)+E[C+3]+we[C+3])|0,He=G+(X+V)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+He|0,this.h1=this.h1+Me|0,this.h2=this.h2+$|0,this.h3=this.h3+te|0,this.h4=this.h4+de|0,this.h5=this.h5+ve|0,this.h6=this.h6+be|0,this.h7=this.h7+Oe|0},ee.prototype.hex=function(){this.finalize();var C=this.h0,X=this.h1,ce=this.h2,V=this.h3,G=this.h4,K=this.h5,ae=this.h6,ne=this.h7,ke=m[C>>>28&15]+m[C>>>24&15]+m[C>>>20&15]+m[C>>>16&15]+m[C>>>12&15]+m[C>>>8&15]+m[C>>>4&15]+m[15&C]+m[X>>>28&15]+m[X>>>24&15]+m[X>>>20&15]+m[X>>>16&15]+m[X>>>12&15]+m[X>>>8&15]+m[X>>>4&15]+m[15&X]+m[ce>>>28&15]+m[ce>>>24&15]+m[ce>>>20&15]+m[ce>>>16&15]+m[ce>>>12&15]+m[ce>>>8&15]+m[ce>>>4&15]+m[15&ce]+m[V>>>28&15]+m[V>>>24&15]+m[V>>>20&15]+m[V>>>16&15]+m[V>>>12&15]+m[V>>>8&15]+m[V>>>4&15]+m[15&V]+m[G>>>28&15]+m[G>>>24&15]+m[G>>>20&15]+m[G>>>16&15]+m[G>>>12&15]+m[G>>>8&15]+m[G>>>4&15]+m[15&G]+m[K>>>28&15]+m[K>>>24&15]+m[K>>>20&15]+m[K>>>16&15]+m[K>>>12&15]+m[K>>>8&15]+m[K>>>4&15]+m[15&K]+m[ae>>>28&15]+m[ae>>>24&15]+m[ae>>>20&15]+m[ae>>>16&15]+m[ae>>>12&15]+m[ae>>>8&15]+m[ae>>>4&15]+m[15&ae];return this.is224||(ke+=m[ne>>>28&15]+m[ne>>>24&15]+m[ne>>>20&15]+m[ne>>>16&15]+m[ne>>>12&15]+m[ne>>>8&15]+m[ne>>>4&15]+m[15&ne]),ke},ee.prototype.toString=ee.prototype.hex,ee.prototype.digest=function(){this.finalize();var C=this.h0,X=this.h1,ce=this.h2,V=this.h3,G=this.h4,K=this.h5,ae=this.h6,ne=this.h7,ke=[C>>>24&255,C>>>16&255,C>>>8&255,255&C,X>>>24&255,X>>>16&255,X>>>8&255,255&X,ce>>>24&255,ce>>>16&255,ce>>>8&255,255&ce,V>>>24&255,V>>>16&255,V>>>8&255,255&V,G>>>24&255,G>>>16&255,G>>>8&255,255&G,K>>>24&255,K>>>16&255,K>>>8&255,255&K,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae];return this.is224||ke.push(ne>>>24&255,ne>>>16&255,ne>>>8&255,255&ne),ke},ee.prototype.array=ee.prototype.digest,ee.prototype.arrayBuffer=function(){this.finalize();var C=new ArrayBuffer(this.is224?28:32),X=new DataView(C);return X.setUint32(0,this.h0),X.setUint32(4,this.h1),X.setUint32(8,this.h2),X.setUint32(12,this.h3),X.setUint32(16,this.h4),X.setUint32(20,this.h5),X.setUint32(24,this.h6),this.is224||X.setUint32(28,this.h7),C},me.prototype=new ee,me.prototype.finalize=function(){if(ee.prototype.finalize.call(this),this.inner){this.inner=!1;var C=this.array();ee.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(C),ee.prototype.finalize.call(this)}};var re=M();re.sha256=re,re.sha224=M(!0),re.sha256.hmac=se(),re.sha224.hmac=se(!0),f?hf.exports=re:(s.sha256=re.sha256,s.sha224=re.sha224)})();Vo.exports;Vo.exports.sha224;var S0=Vo.exports.sha256;function Rf(r){return Rv(r)}function Tv(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const s=/^[0-9A-F]+$/.test(r),a=/^[0-9a-f]+$/.test(r);return s||a?r.length%2===0:!1}function Nv(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function Cv(r){return Tv(r)?"hex":Nv(r)?"b64":""}function kv(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(r.length/2);for(let s=0;s<r.length;s+=2)n[s/2]=parseInt(r.substring(s,s+2),16);return n}function Mv(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const n=atob(r);return Uint8Array.from(n,s=>s.charCodeAt(0))}function Rv(r){switch(Cv(r)){case"hex":return kv(r);case"b64":return Mv(r)}return null}function Dv(r,n){const s=typeof r=="string"?Rf(r):r,a=typeof n=="string"?Rf(n):n;if(s===null||a===null||s.length!==a.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==a[o])return!1;return!0}class wg{constructor(n,s,a=!0){v(this,"token");v(this,"received");v(this,"ctx");v(this,"requestSubject");v(this,"mux");this.mux=n,this.requestSubject=s,this.received=0,this.token=Ks.next(),a&&(this.ctx=new Error)}}class zv extends wg{constructor(s,a,o={maxWait:1e3}){super(s,a);v(this,"callback");v(this,"done");v(this,"timer");v(this,"max");v(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,a){s?(this.ctx&&(s.stack+=`
|
|
33
33
|
|
|
34
|
-
${this.ctx.stack}`),this.cancel(s)):(this.callback(null,a),this.opts.strategy===Cn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Cn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Cn.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class
|
|
34
|
+
${this.ctx.stack}`),this.cancel(s)):(this.callback(null,a),this.opts.strategy===Cn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Cn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Cn.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class Sg extends wg{constructor(s,a,o={timeout:1e3},f=!0){super(s,a,f);v(this,"deferred");v(this,"timer");this.deferred=st(),this.timer=Ar(o.timeout,f)}resolver(s,a){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
|
|
35
35
|
|
|
36
|
-
${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||ue.errorForCode(ie.Cancelled))}}const
|
|
37
|
-
`,qo=Ar.fromAscii(Eo),Gv=new Uint8Array(qo)[0],Vv=new Uint8Array(qo)[1];function Fv(r){for(let n=0;n<r.length;n++){const s=n+1;if(r.byteLength>s&&r[n]===Gv&&r[s]===Vv)return s+1}return 0}function Jv(r){const n=Fv(r);if(n>0){const a=new Uint8Array(r).slice(0,n);return en.decode(a)}return""}const Qv=4,Eg=48,Iv=65,Xv=97;function Kv(r,n,s,a){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((h,d)=>{o[d]=h}),o[12]=r,o[13]=n,o[14]=s,o[15]=a,o}function zf(r){return Zv(r)!==void 0}function Zv(r){for(let n=0;n<r.length;n++)switch(r[n]){case".":return Ag(r);case":":return Wv(r)}}function Ag(r){const n=new Uint8Array(4);for(let s=0;s<4;s++){if(r.length===0)return;if(s>0){if(r[0]!==".")return;r=r.substring(1)}const{n:a,c:o,ok:f}=e1(r);if(!f||a>255)return;r=r.substring(o),n[s]=a}return Kv(n[0],n[1],n[2],n[3])}function Wv(r){const n=new Uint8Array(16);let s=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(s=0,r=r.substring(2),r.length===0))return n;let a=0;for(;a<16;){const{n:o,c:f,ok:h}=t1(r);if(!h||o>65535)return;if(f<r.length&&r[f]==="."){if(s<0&&a!=12||a+4>16)return;const d=Ag(r);if(d===void 0)return;n[a]=d[12],n[a+1]=d[13],n[a+2]=d[14],n[a+3]=d[15],r="",a+=Qv;break}if(n[a]=o>>8,n[a+1]=o,a+=2,r=r.substring(f),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(s>=0)return;if(s=a,r=r.substring(1),r.length===0)break}}if(r.length===0){if(a<16){if(s<0)return;const o=16-a;for(let f=a-1;f>=s;f--)n[f+o]=n[f];for(let f=s+o-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function e1(r){let n=0,s=0;for(n=0;n<r.length&&48<=r.charCodeAt(n)&&r.charCodeAt(n)<=57;n++)if(s=s*10+(r.charCodeAt(n)-Eg),s>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:s,c:n,ok:!0}}function t1(r){let n=0,s=0;for(s=0;s<r.length;s++){if(48<=r.charCodeAt(s)&&r.charCodeAt(s)<=57)n*=16,n+=r.charCodeAt(s)-Eg;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)n*=16,n+=r.charCodeAt(s)-Xv+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)n*=16,n+=r.charCodeAt(s)-Iv+10;else break;if(n>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n,c:s,ok:!0}}function n1(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function qf(r){return!n1(r)}function s1(r){const n="::FFFF:",s=r.toUpperCase().indexOf(n);if(s!==-1&&r.indexOf(".")!==-1){let a=r.substring(s+n.length);return a=a.replace("[",""),a.replace("]","")}return r}function i1(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=s1(r),qf(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const n=qf(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),s=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=s===80?"https":"http",o=new URL(`${a}://${r}`);o.port=`${s}`;let f=o.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:o.host,hostname:f,port:s}}class za{constructor(n,s=!1){v(this,"src");v(this,"listen");v(this,"hostname");v(this,"port");v(this,"didConnect");v(this,"reconnects");v(this,"lastConnect");v(this,"gossiped");v(this,"tlsName");v(this,"resolves");this.src=n,this.tlsName="";const a=i1(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const s=[];if(zf(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const o of a){const f=this.port===80?"https":"http",h=new URL(`${f}://${qf(o)?"["+o+"]":o}`);h.port=`${this.port}`;const d=new za(h.host,!1);d.tlsName=this.hostname,s.push(d)}}return n.randomize&&bg(s),this.resolves=s,s}}class r1{constructor(n=[],s={}){v(this,"firstSelect");v(this,"servers");v(this,"currentServer");v(this,"tlsName");v(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const a=hf();n&&(n.forEach(o=>{o=a?a(o):o,this.servers.push(new za(o))}),this.randomize&&(this.servers=bg(this.servers))),this.servers.length===0&&this.addServer(`${Of}:${Sg()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();zf(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,s=!1){const a=hf();n=a?a(n):n;const o=new za(n,s);zf(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const s=this.servers.indexOf(n);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,s){const a=[];let o=[];const f=hf(),h=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(g=>{g=f?f(g,s):g;const y=new za(g,!0);h.set(g,y)});const d=[];return this.servers.forEach((g,y)=>{const E=g.listen;g.gossiped&&this.currentServer.listen!==E&&h.get(E)===void 0&&d.push(y),h.delete(E)}),d.reverse(),d.forEach(g=>{const y=this.servers.splice(g,1);o=o.concat(y[0].listen)}),h.forEach((g,y)=>{this.servers.push(g),a.push(y)}),{added:a,deleted:o}}}class a1{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${fs(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const s=n.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,s){if(s&&s.permissionContext){if(n)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const o=this.all().find(f=>f.requestSubject===a.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const o=this.get(a);o&&(n===null&&s.headers&&(n=xg(s)),o.resolver(n,s))}}}close(){const n=ue.errorForCode(ie.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class l1{constructor(n,s,a){v(this,"ph");v(this,"interval");v(this,"maxOut");v(this,"timer");v(this,"pendings");this.ph=n,this.interval=s,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:br.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=st();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class o1 extends Error{constructor(n){super(n),this.name="AssertionError"}}function c1(r,n="Assertion failed."){if(!r)throw new o1(n)}const S0=32*1024,df=2**32-2;function go(r,n,s=0){const a=n.byteLength-s;return r.byteLength>a&&(r=r.subarray(0,a)),n.set(r,s),r.byteLength}class mf{constructor(n){v(this,"_buf");v(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const s=this._buf.byteLength;return n<=this.capacity-s?(this._reslice(s+n),s):-1}_reslice(n){c1(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const s=go(this._buf.subarray(this._off),n);return this._off+=s,s}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(ji.encode(n))}write(n){const s=this._grow(n.byteLength);return go(n,this._buf,s)}_grow(n){const s=this.length;s===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const o=this.capacity;if(n<=Math.floor(o/2)-s)go(this._buf.subarray(this._off),this._buf);else{if(o+n>df)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*o+n,df));go(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(s+n,df)),s}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const s=this._grow(n);this._reslice(s)}readFrom(n){let s=0;const a=new Uint8Array(S0);for(;;){const o=this.capacity-this.length<S0,f=o?a:new Uint8Array(this._buf.buffer,this.length),h=n.read(f);if(h===null)return s;o?this.write(f.subarray(0,h)):this._reslice(this.length+h),s+=h}}}var Rt;(function(r){r[r.OK=0]="OK",r[r.ERR=1]="ERR",r[r.MSG=2]="MSG",r[r.INFO=3]="INFO",r[r.PING=4]="PING",r[r.PONG=5]="PONG"})(Rt||(Rt={}));function E0(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const u1=48;class A0{constructor(n){v(this,"dispatcher");v(this,"state");v(this,"as");v(this,"drop");v(this,"hdr");v(this,"ma");v(this,"argBuf");v(this,"msgBuf");this.dispatcher=n,this.state=le.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let s;for(s=0;s<n.length;s++){const a=n[s];switch(this.state){case le.OP_START:switch(a){case oe.M:case oe.m:this.state=le.OP_M,this.hdr=-1,this.ma=E0();break;case oe.H:case oe.h:this.state=le.OP_H,this.hdr=0,this.ma=E0();break;case oe.P:case oe.p:this.state=le.OP_P;break;case oe.PLUS:this.state=le.OP_PLUS;break;case oe.MINUS:this.state=le.OP_MINUS;break;case oe.I:case oe.i:this.state=le.OP_I;break;default:throw this.fail(n.subarray(s))}break;case le.OP_H:switch(a){case oe.M:case oe.m:this.state=le.OP_M;break;default:throw this.fail(n.subarray(s))}break;case le.OP_M:switch(a){case oe.S:case oe.s:this.state=le.OP_MS;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MS:switch(a){case oe.G:case oe.g:this.state=le.OP_MSG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_MSG_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.MSG_ARG,this.as=s}break;case le.MSG_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{const o=this.argBuf?this.argBuf.bytes():n.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=le.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case le.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const f=n.length-s;f<o&&(o=f),o>0?(this.msgBuf.write(n.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(a)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:n.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END);break;case le.MSG_END:switch(a){case oe.NL:this.drop=0,this.as=s+1,this.state=le.OP_START;break;default:continue}break;case le.OP_PLUS:switch(a){case oe.O:case oe.o:this.state=le.OP_PLUS_O;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_O:switch(a){case oe.K:case oe.k:this.state=le.OP_PLUS_OK;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_OK:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.OK}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_MINUS:switch(a){case oe.E:case oe.e:this.state=le.OP_MINUS_E;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_E:switch(a){case oe.R:case oe.r:this.state=le.OP_MINUS_ER;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ER:switch(a){case oe.R:case oe.r:this.state=le.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.MINUS_ERR_ARG,this.as=s}break;case le.MINUS_ERR_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case le.OP_P:switch(a){case oe.I:case oe.i:this.state=le.OP_PI;break;case oe.O:case oe.o:this.state=le.OP_PO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PO:switch(a){case oe.N:case oe.n:this.state=le.OP_PON;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PON:switch(a){case oe.G:case oe.g:this.state=le.OP_PONG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PONG:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.PONG}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_PI:switch(a){case oe.N:case oe.n:this.state=le.OP_PIN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PIN:switch(a){case oe.G:case oe.g:this.state=le.OP_PING;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PING:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.PING}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_I:switch(a){case oe.N:case oe.n:this.state=le.OP_IN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_IN:switch(a){case oe.F:case oe.f:this.state=le.OP_INF;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INF:switch(a){case oe.O:case oe.o:this.state=le.OP_INFO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_INFO_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.INFO_ARG,this.as=s}break;case le.INFO_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(s))}}(this.state===le.MSG_ARG||this.state===le.MINUS_ERR_ARG||this.state===le.INFO_ARG)&&!this.argBuf&&(this.argBuf=new mf(n.subarray(this.as,s-this.drop))),this.state===le.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new mf(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+s);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new mf(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case oe.SPACE:case oe.TAB:case oe.CR:case oe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${en.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case oe.SPACE:case oe.TAB:case oe.CR:case oe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let s=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;s=s*10+(n[a]-u1)}return s}}var le;(function(r){r[r.OP_START=0]="OP_START",r[r.OP_PLUS=1]="OP_PLUS",r[r.OP_PLUS_O=2]="OP_PLUS_O",r[r.OP_PLUS_OK=3]="OP_PLUS_OK",r[r.OP_MINUS=4]="OP_MINUS",r[r.OP_MINUS_E=5]="OP_MINUS_E",r[r.OP_MINUS_ER=6]="OP_MINUS_ER",r[r.OP_MINUS_ERR=7]="OP_MINUS_ERR",r[r.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",r[r.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",r[r.OP_M=10]="OP_M",r[r.OP_MS=11]="OP_MS",r[r.OP_MSG=12]="OP_MSG",r[r.OP_MSG_SPC=13]="OP_MSG_SPC",r[r.MSG_ARG=14]="MSG_ARG",r[r.MSG_PAYLOAD=15]="MSG_PAYLOAD",r[r.MSG_END=16]="MSG_END",r[r.OP_H=17]="OP_H",r[r.OP_P=18]="OP_P",r[r.OP_PI=19]="OP_PI",r[r.OP_PIN=20]="OP_PIN",r[r.OP_PING=21]="OP_PING",r[r.OP_PO=22]="OP_PO",r[r.OP_PON=23]="OP_PON",r[r.OP_PONG=24]="OP_PONG",r[r.OP_I=25]="OP_I",r[r.OP_IN=26]="OP_IN",r[r.OP_INF=27]="OP_INF",r[r.OP_INFO=28]="OP_INFO",r[r.OP_INFO_SPC=29]="OP_INFO_SPC",r[r.INFO_ARG=30]="INFO_ARG"})(le||(le={}));var oe;(function(r){r[r.CR=13]="CR",r[r.E=69]="E",r[r.e=101]="e",r[r.F=70]="F",r[r.f=102]="f",r[r.G=71]="G",r[r.g=103]="g",r[r.H=72]="H",r[r.h=104]="h",r[r.I=73]="I",r[r.i=105]="i",r[r.K=75]="K",r[r.k=107]="k",r[r.M=77]="M",r[r.m=109]="m",r[r.MINUS=45]="MINUS",r[r.N=78]="N",r[r.n=110]="n",r[r.NL=10]="NL",r[r.O=79]="O",r[r.o=111]="o",r[r.P=80]="P",r[r.p=112]="p",r[r.PLUS=43]="PLUS",r[r.R=82]="R",r[r.r=114]="r",r[r.S=83]="S",r[r.s=115]="s",r[r.SPACE=32]="SPACE",r[r.TAB=9]="TAB"})(oe||(oe={}));(function(r){var n=function(x,S){this.hi=x|0,this.lo=S|0},s=function(x){var S,_=new Float64Array(16);if(x)for(S=0;S<x.length;S++)_[S]=x[S];return _},a=function(){throw new Error("no PRNG")},o=new Uint8Array(16),f=new Uint8Array(32);f[0]=9;var h=s(),d=s([1]),g=s([56129,1]),y=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),E=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),j=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),q=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function M(x,S){return x<<S|x>>>32-S}function D(x,S){var _=x[S+3]&255;return _=_<<8|x[S+2]&255,_=_<<8|x[S+1]&255,_<<8|x[S+0]&255}function W(x,S){var _=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],A=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new n(_,A)}function se(x,S,_){var A;for(A=0;A<4;A++)x[S+A]=_&255,_>>>=8}function ee(x,S,_){x[S]=_.hi>>24&255,x[S+1]=_.hi>>16&255,x[S+2]=_.hi>>8&255,x[S+3]=_.hi&255,x[S+4]=_.lo>>24&255,x[S+5]=_.lo>>16&255,x[S+6]=_.lo>>8&255,x[S+7]=_.lo&255}function me(x,S,_,A,N){var z,Q=0;for(z=0;z<N;z++)Q|=x[S+z]^_[A+z];return(1&Q-1>>>8)-1}function re(x,S,_,A){return me(x,S,_,A,16)}function C(x,S,_,A){return me(x,S,_,A,32)}function X(x,S,_,A,N){var z=new Uint32Array(16),Q=new Uint32Array(16),Z=new Uint32Array(16),H=new Uint32Array(4),J,fe,Oe;for(J=0;J<4;J++)Q[5*J]=D(A,4*J),Q[1+J]=D(_,4*J),Q[6+J]=D(S,4*J),Q[11+J]=D(_,16+4*J);for(J=0;J<16;J++)Z[J]=Q[J];for(J=0;J<20;J++){for(fe=0;fe<4;fe++){for(Oe=0;Oe<4;Oe++)H[Oe]=Q[(5*fe+4*Oe)%16];for(H[1]^=M(H[0]+H[3]|0,7),H[2]^=M(H[1]+H[0]|0,9),H[3]^=M(H[2]+H[1]|0,13),H[0]^=M(H[3]+H[2]|0,18),Oe=0;Oe<4;Oe++)z[4*fe+(fe+Oe)%4]=H[Oe]}for(Oe=0;Oe<16;Oe++)Q[Oe]=z[Oe]}if(N){for(J=0;J<16;J++)Q[J]=Q[J]+Z[J]|0;for(J=0;J<4;J++)Q[5*J]=Q[5*J]-D(A,4*J)|0,Q[6+J]=Q[6+J]-D(S,4*J)|0;for(J=0;J<4;J++)se(x,4*J,Q[5*J]),se(x,16+4*J,Q[6+J])}else for(J=0;J<16;J++)se(x,4*J,Q[J]+Z[J]|0)}function ce(x,S,_,A){return X(x,S,_,A,!1),0}function V(x,S,_,A){return X(x,S,_,A,!0),0}var G=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function K(x,S,_,A,N,z,Q){var Z=new Uint8Array(16),H=new Uint8Array(64),J,fe;if(!N)return 0;for(fe=0;fe<16;fe++)Z[fe]=0;for(fe=0;fe<8;fe++)Z[fe]=z[fe];for(;N>=64;){for(ce(H,Z,Q,G),fe=0;fe<64;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];for(J=1,fe=8;fe<16;fe++)J=J+(Z[fe]&255)|0,Z[fe]=J&255,J>>>=8;N-=64,S+=64,_&&(A+=64)}if(N>0)for(ce(H,Z,Q,G),fe=0;fe<N;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];return 0}function ae(x,S,_,A,N){return K(x,S,null,0,_,A,N)}function ne(x,S,_,A,N){var z=new Uint8Array(32);return V(z,A,N,G),ae(x,S,_,A.subarray(16),z)}function ke(x,S,_,A,N,z,Q){var Z=new Uint8Array(32);return V(Z,z,Q,G),K(x,S,_,A,N,z.subarray(16),Z)}function He(x,S){var _,A=0;for(_=0;_<17;_++)A=A+(x[_]+S[_]|0)|0,x[_]=A&255,A>>>=8}var Me=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function $(x,S,_,A,N,z){var Q,Z,H,J,fe=new Uint32Array(17),Oe=new Uint32Array(17),Ke=new Uint32Array(17),Ct=new Uint32Array(17),En=new Uint32Array(17);for(H=0;H<17;H++)Oe[H]=Ke[H]=0;for(H=0;H<16;H++)Oe[H]=z[H];for(Oe[3]&=15,Oe[4]&=252,Oe[7]&=15,Oe[8]&=252,Oe[11]&=15,Oe[12]&=252,Oe[15]&=15;N>0;){for(H=0;H<17;H++)Ct[H]=0;for(H=0;H<16&&H<N;++H)Ct[H]=_[A+H];for(Ct[H]=1,A+=H,N-=H,He(Ke,Ct),Z=0;Z<17;Z++)for(fe[Z]=0,H=0;H<17;H++)fe[Z]=fe[Z]+Ke[H]*(H<=Z?Oe[Z-H]:320*Oe[Z+17-H]|0)|0|0;for(Z=0;Z<17;Z++)Ke[Z]=fe[Z];for(J=0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;for(J=J+Ke[16]|0,Ke[16]=J&3,J=5*(J>>>2)|0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;J=J+Ke[16]|0,Ke[16]=J}for(H=0;H<17;H++)En[H]=Ke[H];for(He(Ke,Me),Q=-(Ke[16]>>>7)|0,H=0;H<17;H++)Ke[H]^=Q&(En[H]^Ke[H]);for(H=0;H<16;H++)Ct[H]=z[H+16];for(Ct[16]=0,He(Ke,Ct),H=0;H<16;H++)x[S+H]=Ke[H];return 0}function te(x,S,_,A,N,z){var Q=new Uint8Array(16);return $(Q,0,_,A,N,z),re(x,S,Q,0)}function de(x,S,_,A,N){var z;if(_<32)return-1;for(ke(x,0,S,0,_,A,N),$(x,16,x,32,_-32,x),z=0;z<16;z++)x[z]=0;return 0}function ve(x,S,_,A,N){var z,Q=new Uint8Array(32);if(_<32||(ne(Q,0,32,A,N),te(S,16,S,32,_-32,Q)!==0))return-1;for(ke(x,0,S,0,_,A,N),z=0;z<32;z++)x[z]=0;return 0}function be(x,S){var _;for(_=0;_<16;_++)x[_]=S[_]|0}function je(x){var S,_;for(_=0;_<16;_++)x[_]+=65536,S=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=S-1+37*(S-1)*(_===15?1:0),x[_]-=S*65536}function we(x,S,_){for(var A,N=~(_-1),z=0;z<16;z++)A=N&(x[z]^S[z]),x[z]^=A,S[z]^=A}function Te(x,S){var _,A,N,z=s(),Q=s();for(_=0;_<16;_++)Q[_]=S[_];for(je(Q),je(Q),je(Q),A=0;A<2;A++){for(z[0]=Q[0]-65517,_=1;_<15;_++)z[_]=Q[_]-65535-(z[_-1]>>16&1),z[_-1]&=65535;z[15]=Q[15]-32767-(z[14]>>16&1),N=z[15]>>16&1,z[14]&=65535,we(Q,z,1-N)}for(_=0;_<16;_++)x[2*_]=Q[_]&255,x[2*_+1]=Q[_]>>8}function lt(x,S){var _=new Uint8Array(32),A=new Uint8Array(32);return Te(_,x),Te(A,S),C(_,0,A,0)}function Pt(x){var S=new Uint8Array(32);return Te(S,x),S[0]&1}function an(x,S){var _;for(_=0;_<16;_++)x[_]=S[2*_]+(S[2*_+1]<<8);x[15]&=32767}function Ot(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]+_[A]|0}function jt(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]-_[A]|0}function Se(x,S,_){var A,N,z=new Float64Array(31);for(A=0;A<31;A++)z[A]=0;for(A=0;A<16;A++)for(N=0;N<16;N++)z[A+N]+=S[A]*_[N];for(A=0;A<15;A++)z[A]+=38*z[A+16];for(A=0;A<16;A++)x[A]=z[A];je(x),je(x)}function Tt(x,S){Se(x,S,S)}function ei(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=253;A>=0;A--)Tt(_,_),A!==2&&A!==4&&Se(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function Ti(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=250;A>=0;A--)Tt(_,_),A!==1&&Se(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function ti(x,S,_){var A=new Uint8Array(32),N=new Float64Array(80),z,Q,Z=s(),H=s(),J=s(),fe=s(),Oe=s(),Ke=s();for(Q=0;Q<31;Q++)A[Q]=S[Q];for(A[31]=S[31]&127|64,A[0]&=248,an(N,_),Q=0;Q<16;Q++)H[Q]=N[Q],fe[Q]=Z[Q]=J[Q]=0;for(Z[0]=fe[0]=1,Q=254;Q>=0;--Q)z=A[Q>>>3]>>>(Q&7)&1,we(Z,H,z),we(J,fe,z),Ot(Oe,Z,J),jt(Z,Z,J),Ot(J,H,fe),jt(H,H,fe),Tt(fe,Oe),Tt(Ke,Z),Se(Z,J,Z),Se(J,H,Oe),Ot(Oe,Z,J),jt(Z,Z,J),Tt(H,Z),jt(J,fe,Ke),Se(Z,J,g),Ot(Z,Z,fe),Se(J,J,Z),Se(Z,fe,Ke),Se(fe,H,N),Tt(H,Oe),we(Z,H,z),we(J,fe,z);for(Q=0;Q<16;Q++)N[Q+16]=Z[Q],N[Q+32]=J[Q],N[Q+48]=H[Q],N[Q+64]=fe[Q];var Ct=N.subarray(32),En=N.subarray(16);return ei(Ct,Ct),Se(En,En,Ct),Te(x,En),0}function ln(x,S){return ti(x,S,f)}function Ni(x,S){return a(S,32),ln(x,S)}function ms(x,S,_){var A=new Uint8Array(32);return ti(A,_,S),V(x,o,A,G)}var Ja=de,Qa=ve;function Nr(x,S,_,A,N,z){var Q=new Uint8Array(32);return ms(Q,N,z),Ja(x,S,_,A,Q)}function Cr(x,S,_,A,N,z){var Q=new Uint8Array(32);return ms(Q,N,z),Qa(x,S,_,A,Q)}function $n(){var x=0,S=0,_=0,A=0,N=65535,z,Q,Z;for(Z=0;Z<arguments.length;Z++)z=arguments[Z].lo,Q=arguments[Z].hi,x+=z&N,S+=z>>>16,_+=Q&N,A+=Q>>>16;return S+=x>>>16,_+=S>>>16,A+=_>>>16,new n(_&N|A<<16,x&N|S<<16)}function Ia(x,S){return new n(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function Ci(){var x=0,S=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,S^=arguments[_].hi;return new n(S,x)}function et(x,S){var _,A,N=32-S;return S<32?(_=x.hi>>>S|x.lo<<N,A=x.lo>>>S|x.hi<<N):S<64&&(_=x.lo>>>S|x.hi<<N,A=x.hi>>>S|x.lo<<N),new n(_,A)}function Io(x,S,_){var A=x.hi&S.hi^~x.hi&_.hi,N=x.lo&S.lo^~x.lo&_.lo;return new n(A,N)}function Xa(x,S,_){var A=x.hi&S.hi^x.hi&_.hi^S.hi&_.hi,N=x.lo&S.lo^x.lo&_.lo^S.lo&_.lo;return new n(A,N)}function Ka(x){return Ci(et(x,28),et(x,34),et(x,39))}function ki(x){return Ci(et(x,14),et(x,18),et(x,41))}function Xo(x){return Ci(et(x,1),et(x,8),Ia(x,7))}function Za(x){return Ci(et(x,19),et(x,61),Ia(x,6))}var Ko=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function Wa(x,S,_){var A=[],N=[],z=[],Q=[],Z,H,J;for(H=0;H<8;H++)A[H]=z[H]=W(x,8*H);for(var fe=0;_>=128;){for(H=0;H<16;H++)Q[H]=W(S,8*H+fe);for(H=0;H<80;H++){for(J=0;J<8;J++)N[J]=z[J];for(Z=$n(z[7],ki(z[4]),Io(z[4],z[5],z[6]),Ko[H],Q[H%16]),N[7]=$n(Z,Ka(z[0]),Xa(z[0],z[1],z[2])),N[3]=$n(N[3],Z),J=0;J<8;J++)z[(J+1)%8]=N[J];if(H%16===15)for(J=0;J<16;J++)Q[J]=$n(Q[J],Q[(J+9)%16],Xo(Q[(J+1)%16]),Za(Q[(J+14)%16]))}for(H=0;H<8;H++)z[H]=$n(z[H],A[H]),A[H]=z[H];fe+=128,_-=128}for(H=0;H<8;H++)ee(x,8*H,A[H]);return _}var ni=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 ot(x,S,_){var A=new Uint8Array(64),N=new Uint8Array(256),z,Q=_;for(z=0;z<64;z++)A[z]=ni[z];for(Wa(A,S,_),_%=128,z=0;z<256;z++)N[z]=0;for(z=0;z<_;z++)N[z]=S[Q-_+z];for(N[_]=128,_=256-128*(_<112?1:0),N[_-9]=0,ee(N,_-8,new n(Q/536870912|0,Q<<3)),Wa(A,N,_),z=0;z<64;z++)x[z]=A[z];return 0}function $t(x,S){var _=s(),A=s(),N=s(),z=s(),Q=s(),Z=s(),H=s(),J=s(),fe=s();jt(_,x[1],x[0]),jt(fe,S[1],S[0]),Se(_,_,fe),Ot(A,x[0],x[1]),Ot(fe,S[0],S[1]),Se(A,A,fe),Se(N,x[3],S[3]),Se(N,N,E),Se(z,x[2],S[2]),Ot(z,z,z),jt(Q,A,_),jt(Z,z,N),Ot(H,z,N),Ot(J,A,_),Se(x[0],Q,Z),Se(x[1],J,H),Se(x[2],H,Z),Se(x[3],Q,J)}function Nt(x,S,_){var A;for(A=0;A<4;A++)we(x[A],S[A],_)}function kr(x,S){var _=s(),A=s(),N=s();ei(N,S[2]),Se(_,S[0],N),Se(A,S[1],N),Te(x,A),x[31]^=Pt(_)<<7}function Mr(x,S,_){var A,N;for(be(x[0],h),be(x[1],d),be(x[2],d),be(x[3],h),N=255;N>=0;--N)A=_[N/8|0]>>(N&7)&1,Nt(x,S,A),$t(S,x),$t(x,x),Nt(x,S,A)}function Mi(x,S){var _=[s(),s(),s(),s()];be(_[0],w),be(_[1],j),be(_[2],d),Se(_[3],w,j),Mr(x,_,S)}function ps(x,S,_){var A=new Uint8Array(64),N=[s(),s(),s(),s()],z;for(_||a(S,32),ot(A,S,32),A[0]&=248,A[31]&=127,A[31]|=64,Mi(N,A),kr(x,N),z=0;z<32;z++)S[z+32]=x[z];return 0}var Yn=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 gs(x,S){var _,A,N,z;for(A=63;A>=32;--A){for(_=0,N=A-32,z=A-12;N<z;++N)S[N]+=_-16*S[A]*Yn[N-(A-32)],_=Math.floor((S[N]+128)/256),S[N]-=_*256;S[N]+=_,S[A]=0}for(_=0,N=0;N<32;N++)S[N]+=_-(S[31]>>4)*Yn[N],_=S[N]>>8,S[N]&=255;for(N=0;N<32;N++)S[N]-=_*Yn[N];for(A=0;A<32;A++)S[A+1]+=S[A]>>8,x[A]=S[A]&255}function wn(x){var S=new Float64Array(64),_;for(_=0;_<64;_++)S[_]=x[_];for(_=0;_<64;_++)x[_]=0;gs(x,S)}function si(x,S,_,A){var N=new Uint8Array(64),z=new Uint8Array(64),Q=new Uint8Array(64),Z,H,J=new Float64Array(64),fe=[s(),s(),s(),s()];ot(N,A,32),N[0]&=248,N[31]&=127,N[31]|=64;var Oe=_+64;for(Z=0;Z<_;Z++)x[64+Z]=S[Z];for(Z=0;Z<32;Z++)x[32+Z]=N[32+Z];for(ot(Q,x.subarray(32),_+32),wn(Q),Mi(fe,Q),kr(x,fe),Z=32;Z<64;Z++)x[Z]=A[Z];for(ot(z,x,_+64),wn(z),Z=0;Z<64;Z++)J[Z]=0;for(Z=0;Z<32;Z++)J[Z]=Q[Z];for(Z=0;Z<32;Z++)for(H=0;H<32;H++)J[Z+H]+=z[Z]*N[H];return gs(x.subarray(32),J),Oe}function ii(x,S){var _=s(),A=s(),N=s(),z=s(),Q=s(),Z=s(),H=s();return be(x[2],d),an(x[1],S),Tt(N,x[1]),Se(z,N,y),jt(N,N,x[2]),Ot(z,x[2],z),Tt(Q,z),Tt(Z,Q),Se(H,Z,Q),Se(_,H,N),Se(_,_,z),Ti(_,_),Se(_,_,N),Se(_,_,z),Se(_,_,z),Se(x[0],_,z),Tt(A,x[0]),Se(A,A,z),lt(A,N)&&Se(x[0],x[0],q),Tt(A,x[0]),Se(A,A,z),lt(A,N)?-1:(Pt(x[0])===S[31]>>7&&jt(x[0],h,x[0]),Se(x[3],x[0],x[1]),0)}function Rr(x,S,_,A){var N,z=new Uint8Array(32),Q=new Uint8Array(64),Z=[s(),s(),s(),s()],H=[s(),s(),s(),s()];if(_<64||ii(H,A))return-1;for(N=0;N<_;N++)x[N]=S[N];for(N=0;N<32;N++)x[N+32]=A[N];if(ot(Q,x,_),wn(Q),Mr(Z,H,Q),Mi(H,S.subarray(32)),$t(Z,H),kr(z,Z),_-=64,C(S,0,z,0)){for(N=0;N<_;N++)x[N]=0;return-1}for(N=0;N<_;N++)x[N]=S[N+64];return _}var Ri=32,ys=24,Sn=32,bs=16,xs=32,ri=32,vs=32,Gn=32,ai=32,Dr=ys,el=Sn,Mn=bs,Ie=64,it=32,Yt=64,li=32,zr=64;r.lowlevel={crypto_core_hsalsa20:V,crypto_stream_xor:ke,crypto_stream:ne,crypto_stream_salsa20_xor:K,crypto_stream_salsa20:ae,crypto_onetimeauth:$,crypto_onetimeauth_verify:te,crypto_verify_16:re,crypto_verify_32:C,crypto_secretbox:de,crypto_secretbox_open:ve,crypto_scalarmult:ti,crypto_scalarmult_base:ln,crypto_box_beforenm:ms,crypto_box_afternm:Ja,crypto_box:Nr,crypto_box_open:Cr,crypto_box_keypair:Ni,crypto_hash:ot,crypto_sign:si,crypto_sign_keypair:ps,crypto_sign_open:Rr,crypto_secretbox_KEYBYTES:Ri,crypto_secretbox_NONCEBYTES:ys,crypto_secretbox_ZEROBYTES:Sn,crypto_secretbox_BOXZEROBYTES:bs,crypto_scalarmult_BYTES:xs,crypto_scalarmult_SCALARBYTES:ri,crypto_box_PUBLICKEYBYTES:vs,crypto_box_SECRETKEYBYTES:Gn,crypto_box_BEFORENMBYTES:ai,crypto_box_NONCEBYTES:Dr,crypto_box_ZEROBYTES:el,crypto_box_BOXZEROBYTES:Mn,crypto_sign_BYTES:Ie,crypto_sign_PUBLICKEYBYTES:it,crypto_sign_SECRETKEYBYTES:Yt,crypto_sign_SEEDBYTES:li,crypto_hash_BYTES:zr,gf:s,D:y,L:Yn,pack25519:Te,unpack25519:an,M:Se,A:Ot,S:Tt,Z:jt,pow2523:Ti,add:$t,set25519:be,modL:gs,scalarmult:Mr,scalarbase:Mi};function tl(x,S){if(x.length!==Ri)throw new Error("bad key size");if(S.length!==ys)throw new Error("bad nonce size")}function nl(x,S){if(x.length!==vs)throw new Error("bad public key size");if(S.length!==Gn)throw new Error("bad secret key size")}function yt(){for(var x=0;x<arguments.length;x++)if(!(arguments[x]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Di(x){for(var S=0;S<x.length;S++)x[S]=0}r.randomBytes=function(x){var S=new Uint8Array(x);return a(S,x),S},r.secretbox=function(x,S,_){yt(x,S,_),tl(_,S);for(var A=new Uint8Array(Sn+x.length),N=new Uint8Array(A.length),z=0;z<x.length;z++)A[z+Sn]=x[z];return de(N,A,A.length,S,_),N.subarray(bs)},r.secretbox.open=function(x,S,_){yt(x,S,_),tl(_,S);for(var A=new Uint8Array(bs+x.length),N=new Uint8Array(A.length),z=0;z<x.length;z++)A[z+bs]=x[z];return A.length<32||ve(N,A,A.length,S,_)!==0?null:N.subarray(Sn)},r.secretbox.keyLength=Ri,r.secretbox.nonceLength=ys,r.secretbox.overheadLength=bs,r.scalarMult=function(x,S){if(yt(x,S),x.length!==ri)throw new Error("bad n size");if(S.length!==xs)throw new Error("bad p size");var _=new Uint8Array(xs);return ti(_,x,S),_},r.scalarMult.base=function(x){if(yt(x),x.length!==ri)throw new Error("bad n size");var S=new Uint8Array(xs);return ln(S,x),S},r.scalarMult.scalarLength=ri,r.scalarMult.groupElementLength=xs,r.box=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox(x,S,N)},r.box.before=function(x,S){yt(x,S),nl(x,S);var _=new Uint8Array(ai);return ms(_,x,S),_},r.box.after=r.secretbox,r.box.open=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox.open(x,S,N)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var x=new Uint8Array(vs),S=new Uint8Array(Gn);return Ni(x,S),{publicKey:x,secretKey:S}},r.box.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Gn)throw new Error("bad secret key size");var S=new Uint8Array(vs);return ln(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},r.box.publicKeyLength=vs,r.box.secretKeyLength=Gn,r.box.sharedKeyLength=ai,r.box.nonceLength=Dr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(x,S){if(yt(x,S),S.length!==Yt)throw new Error("bad secret key size");var _=new Uint8Array(Ie+x.length);return si(_,x,x.length,S),_},r.sign.open=function(x,S){if(yt(x,S),S.length!==it)throw new Error("bad public key size");var _=new Uint8Array(x.length),A=Rr(_,x,x.length,S);if(A<0)return null;for(var N=new Uint8Array(A),z=0;z<N.length;z++)N[z]=_[z];return N},r.sign.detached=function(x,S){for(var _=r.sign(x,S),A=new Uint8Array(Ie),N=0;N<A.length;N++)A[N]=_[N];return A},r.sign.detached.verify=function(x,S,_){if(yt(x,S,_),S.length!==Ie)throw new Error("bad signature size");if(_.length!==it)throw new Error("bad public key size");var A=new Uint8Array(Ie+x.length),N=new Uint8Array(Ie+x.length),z;for(z=0;z<Ie;z++)A[z]=S[z];for(z=0;z<x.length;z++)A[z+Ie]=x[z];return Rr(N,A,A.length,_)>=0},r.sign.keyPair=function(){var x=new Uint8Array(it),S=new Uint8Array(Yt);return ps(x,S),{publicKey:x,secretKey:S}},r.sign.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Yt)throw new Error("bad secret key size");for(var S=new Uint8Array(it),_=0;_<S.length;_++)S[_]=x[32+_];return{publicKey:S,secretKey:new Uint8Array(x)}},r.sign.keyPair.fromSeed=function(x){if(yt(x),x.length!==li)throw new Error("bad seed size");for(var S=new Uint8Array(it),_=new Uint8Array(Yt),A=0;A<32;A++)_[A]=x[A];return ps(S,_,!0),{publicKey:S,secretKey:_}},r.sign.publicKeyLength=it,r.sign.secretKeyLength=Yt,r.sign.seedLength=li,r.sign.signatureLength=Ie,r.hash=function(x){yt(x);var S=new Uint8Array(zr);return ot(S,x,x.length),S},r.hash.hashLength=zr,r.verify=function(x,S){return yt(x,S),x.length===0||S.length===0||x.length!==S.length?!1:me(x,0,S,0,x.length)===0},r.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var S=65536;r.setPRNG(function(_,A){var N,z=new Uint8Array(A);for(N=0;N<A;N+=S)x.getRandomValues(z.subarray(N,N+Math.min(A-N,S)));for(N=0;N<A;N++)_[N]=z[N];Di(z)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&r.setPRNG(function(_,A){var N,z=x.randomBytes(A);for(N=0;N<A;N++)_[N]=z[N];Di(z)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const yo=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;yo.sign.keyPair.fromSeed,yo.sign.detached,yo.sign.detached.verify,yo.randomBytes;var O0;(function(r){r.InvalidPrefixByte="nkeys: invalid prefix byte",r.InvalidKey="nkeys: invalid key",r.InvalidPublicKey="nkeys: invalid public key",r.InvalidSeedLen="nkeys: invalid seed length",r.InvalidSeed="nkeys: invalid seed",r.InvalidEncoding="nkeys: invalid encoded key",r.InvalidSignature="nkeys: signature verification failed",r.CannotSign="nkeys: cannot sign, no private key available",r.PublicKeyOnly="nkeys: no seed or private key available",r.InvalidChecksum="nkeys: invalid checksum",r.SerializationError="nkeys: serialization error",r.ApiError="nkeys: api error",r.ClearedPair="nkeys: pair is cleared"})(O0||(O0={}));var j0;(function(r){r[r.Seed=144]="Seed",r[r.Private=120]="Private",r[r.Operator=112]="Operator",r[r.Server=104]="Server",r[r.Cluster=16]="Cluster",r[r.Account=0]="Account",r[r.User=160]="User"})(j0||(j0={}));function f1(r){return n=>{let s={};return r.forEach(a=>{const o=a(n)||{};s=Object.assign(s,o)}),s}}function h1(){return()=>{}}function d1(r,n){return()=>{const s=typeof r=="function"?r():r,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function m1(r){return()=>({auth_token:typeof r=="function"?r():r})}const Og=120*1e3,p1=2,jg=2*1e3;function g1(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Og,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:jg,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function y1(r){const n=[];return typeof r.authenticator=="function"&&n.push(r.authenticator),Array.isArray(r.authenticator)&&n.push(...r.authenticator),r.token&&n.push(m1(r.token)),r.user&&n.push(d1(r.user,r.pass)),n.length===0?h1():f1(n)}function b1(r){const n=`${Of}:${Sg()}`;if(r=r||{servers:[n]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new ue("port and servers options are mutually exclusive",ie.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${Of}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[n]);const s=Yo(g1(),r);if(s.authenticator=y1(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new ue(`${a} option should be a function`,ie.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let a=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),s.reconnectTimeWait+a}),s.inboxPrefix)try{fs(s.inboxPrefix)}catch(a){throw new ue(a.message,ie.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Df()=="function"),s.resolve&&typeof Df()!="function")throw new ue("'resolve' is not supported on this client",ie.InvalidOption);return s}function x1(r,n){const{proto:s,tls_required:a,tls_available:o}=r;if((s===void 0||s<1)&&n.noEcho)throw new ue("noEcho",ie.ServerOptionNotAvailable);const f=a||o||!1;if(n.tls&&!f)throw new ue("tls",ie.ServerOptionNotAvailable)}const v1=1024*32,_1=/^INFO\s+([^\r\n]+)\r\n/i,w1=Ra(`PONG\r
|
|
38
|
-
`),
|
|
39
|
-
`);class S1{constructor(n,s,a){v(this,"echo");v(this,"no_responders");v(this,"protocol");v(this,"verbose");v(this,"pedantic");v(this,"jwt");v(this,"nkey");v(this,"sig");v(this,"user");v(this,"pass");v(this,"auth_token");v(this,"tls_required");v(this,"name");v(this,"lang");v(this,"version");v(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};Yo(this,o)}}class Tg extends _t{constructor(s,a,o={}){var h;super();v(this,"sid");v(this,"queue");v(this,"draining");v(this,"max");v(this,"subject");v(this,"drained");v(this,"protocol");v(this,"timer");v(this,"info");v(this,"cleanupFn");v(this,"closed");v(this,"requestSubject");Yo(this,o),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=st();const f=!((h=s.options)!=null&&h.noAsyncTraces);o.timeout&&(this.timer=Sr(o.timeout,f),this.timer.then(()=>{this.timer=void 0}).catch(d=>{this.stop(d),this.noIterator&&this.callback(d,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const a=this.callback,o=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),f=s.protocolFilterFn?s.protocolFilterFn:()=>!0,h=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(d,g)=>{const{ingest:y}=o(g);y&&f(g)&&(a(d,g),h(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,a){this.cancelTimeout(),s?this.stop(s):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isClosed()?Promise.reject(ue.errorForCode(ie.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(st()).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 E1{constructor(){v(this,"mux");v(this,"subs");v(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const s=n.permissionContext,a=this.all();let o;if(s.operation==="subscription"&&(o=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(o=a.find(f=>f.requestSubject===s.subject)),o)return o.callback(n,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Uo{constructor(n,s){v(this,"connected");v(this,"connectedOnce");v(this,"infoReceived");v(this,"info");v(this,"muxSubscriptions");v(this,"options");v(this,"outbound");v(this,"pongs");v(this,"subscriptions");v(this,"transport");v(this,"noMorePublishing");v(this,"connectError");v(this,"publisher");v(this,"_closed");v(this,"closed");v(this,"listeners");v(this,"heartbeats");v(this,"parser");v(this,"outMsgs");v(this,"inMsgs");v(this,"outBytes");v(this,"inBytes");v(this,"pendingLimit");v(this,"lastError");v(this,"abortReconnect");v(this,"whyClosed");v(this,"servers");v(this,"server");v(this,"features");v(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=v1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new E1,this.muxSubscriptions=new a1,this.outbound=new Ar,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new Hv({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new r1(a,{randomize:!n.noRandomize}),this.closed=st(),this.parser=new A0(this),this.heartbeats=new l1(this,this.options.pingInterval||Og,this.options.maxPingOut||p1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=ue.errorForCode(ie.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new A0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(s=>{s.push(n)})}status(){const n=new _t;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=st();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=s=>{n.reject(s)},this.transport=Yv(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:br.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:br.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:us.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:us.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===ie.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(n)}async dial(n){const s=this.prepare();let a;try{a=Sr(this.options.timeout||2e4);const o=this.transport.connect(n,this.options);await Promise.race([o,a]),(async()=>{try{for await(const f of this.transport)this.parser.parse(f)}catch(f){console.log("reader closed",f)}})().then()}catch(o){s.reject(o)}try{await Promise.race([a,s]),a&&a.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(o){throw a&&a.cancel(),await this.transport.close(o),o}}async _doDial(n){const{resolve:s}=this.options,a=await n.resolve({fn:Df(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const f of a)try{o=null,this.dispatchStatus({type:br.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(h){o=h}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():jg;let a=s;const o=this.selectServer();if(!o||this.abortReconnect)throw n||(this.lastError?this.lastError:ue.errorForCode(ie.ConnectionRefused));const f=Date.now();if(o.lastConnect===0||o.lastConnect+s<=f){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(h){if(n=h,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const d=this.options.maxReconnectAttempts||0;d!==-1&&o.reconnects>=d&&this.servers.removeCurrentServer()}}else a=Math.min(a,o.lastConnect+s-f),await jr(a)}}static async connect(n,s){const a=new Uo(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new ue(n,ie.PermissionsViolation),o=n.match(/(Publish|Subscription) to "(\S+)"/);if(o){a.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const f=n.match(/using queue "(\S+)"/);f&&(a.permissionContext.queue=f[1])}return a}else return s.indexOf("authorization violation")!==-1?new ue(n,ie.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new ue(n,ie.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new ue(n,ie.AccountExpired):s.indexOf("authentication timeout")!==-1?new ue(n,ie.AuthenticationTimeout):new ue(n,ie.ProtocolError)}processMsg(n,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new th(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=u0(n),a=Uo.toError(s),o={type:us.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){o.permissionContext=a.permissionContext;const h=this.subscriptions.getMux();f=(h==null?void 0:h.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(f,a),f&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(w1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(u0(n));this.info=s;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Ai(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:h}=this.transport;try{const d=new S1({version:f,lang:h},this.options,s.nonce);s.headers&&(d.headers=!0,d.no_responders=!0);const g=JSON.stringify(d);this.transport.send(Ra(`CONNECT ${g}${Eo}`)),this.transport.send(T0)}catch(d){this._close(d)}}a&&this.dispatchStatus({type:us.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:us.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case Rt.MSG:{const{msg:s,data:a}=n;this.processMsg(s,a);break}case Rt.OK:break;case Rt.ERR:this.processError(n.data);break;case Rt.PING:this.processPing();break;case Rt.PONG:this.processPong();break;case Rt.INFO:this.processInfo(n.data);break}}sendCommand(n,...s){const a=this.outbound.length();let o;typeof n=="string"?o=Ra(n):o=n,this.outbound.fill(o,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=nn,a){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=ji.encode(s);else throw ue.errorForCode(ie.BadPayload);let f=o.length;a=a||{},a.reply=a.reply||"";let h=nn,d=0;if(a.headers){if(this.info&&!this.info.headers)throw new ue("headers",ie.ServerOptionNotAvailable);h=a.headers.encode(),d=h.length,f=o.length+d}if(this.info&&f>this.info.max_payload)throw ue.errorForCode(ie.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let g;a.headers?(a.reply?g=`HPUB ${n} ${a.reply} ${d} ${f}\r
|
|
40
|
-
`:g=`HPUB ${n} ${
|
|
36
|
+
${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||ue.errorForCode(ie.Cancelled))}}const qv="$JS.API";function Uv(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),Yo({apiPrefix:qv,timeout:5e3},r)}class Ya{constructor(n,s){v(this,"nc");v(this,"opts");v(this,"prefix");v(this,"timeout");v(this,"jc");this.nc=n,this.opts=Uv(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=kn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,s=null,a){a=a||{},a.timeout=this.timeout;let o=nn;s&&(o=this.jc.encode(s));let{retries:f}=a;f=f||1,f=f===-1?Number.MAX_SAFE_INTEGER:f;const h=eh();for(let m=0;m<f;m++)try{const g=await this.nc.request(n,o,a);return this.parseJsResponse(g)}catch(g){const y=g;if((y.code==="503"||y.code===ie.Timeout)&&m+1<f)await Tr(h.backoff(m));else throw g}}async findStream(n){const s={subject:n},o=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const s=this.jc.decode(n.data),a=s;if(a.error){const o=_g(a.error.code,a.error.description);if(o!==null)throw o.api_error=a.error,o}return s}}class ka{constructor(n,s,a,o){v(this,"err");v(this,"offset");v(this,"pageInfo");v(this,"subject");v(this,"jsm");v(this,"filter");v(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=a,this.offset=0,this.pageInfo={},this.filter=s,this.payload=o||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const s=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=s;const a=this.countResponse(s);return a===0?[]:(this.offset+=a,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(n){var s,a,o;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=n.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((a=n.consumers)==null?void 0:a.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((o=n.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const s of n)yield s;n=await this.next()}}}function Ai(r=""){const n=r.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${r}' is not a semver value`)}function Df(r,n){return r.major<n.major?-1:r.major>n.major?1:r.minor<n.minor?-1:r.minor>n.minor?1:r.micro<n.micro?-1:r.micro>n.micro?1:0}var Ue;(function(r){r.JS_KV="js_kv",r.JS_OBJECTSTORE="js_objectstore",r.JS_PULL_MAX_BYTES="js_pull_max_bytes",r.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",r.JS_ALLOW_DIRECT="js_allow_direct",r.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",r.JS_SIMPLIFICATION="js_simplification",r.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",r.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",r.JS_STREAM_FIRST_SEQ="js_stream_first_seq",r.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",r.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",r.JS_STREAM_COMPRESSION="js_stream_compression",r.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",r.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Ue||(Ue={}));class Bv{constructor(n){v(this,"server");v(this,"features");v(this,"disabled");this.features=new Map,this.disabled=[],this.update(n)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(n){this.disabled.push(n),this.update(this.server)}isDisabled(n){return this.disabled.indexOf(n)!==-1}update(n){typeof n=="string"&&(n=Ai(n)),this.server=n,this.set(Ue.JS_KV,"2.6.2"),this.set(Ue.JS_OBJECTSTORE,"2.6.3"),this.set(Ue.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ue.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ue.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ue.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ue.JS_SIMPLIFICATION,"2.9.4"),this.set(Ue.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ue.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ue.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ue.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ue.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ue.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ue.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ue.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(n,s){this.features.set(n,{min:s,ok:Df(this.server,Ai(s))>=0})}get(n){return this.features.get(n)||{min:"unknown",ok:!1}}supports(n){var s;return((s=this.get(n))==null?void 0:s.ok)||!1}require(n){return typeof n=="string"&&(n=Ai(n)),Df(this.server,n)>=0}}class zo extends Ya{constructor(n,s){super(n,s)}async add(n,s,a=Do.Create){if(Mt(n),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const o={};o.config=s,o.stream_name=n,o.action=a,o.config.durable_name&&_r(o.config.durable_name);const f=this.nc;let{min:h,ok:m}=f.features.get(Ue.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!m)throw new Error(`consumer 'name' requires server ${h}`);if(g)try{Go("name",g)}catch(O){const q=O.message,M=q.indexOf("cannot contain");throw M!==-1?new Error(`consumer 'name' ${q.substring(M)}`):O}let y,E="";if(Array.isArray(s.filter_subjects)){const{min:O,ok:q}=f.features.get(Ue.JS_MULTIPLE_CONSUMER_FILTER);if(!q)throw new Error(`consumer 'filter_subjects' requires server ${O}`);m=!1}if(s.metadata){const{min:O,ok:q}=f.features.get(Ue.JS_STREAM_CONSUMER_METADATA);if(!q)throw new Error(`consumer 'metadata' requires server ${O}`)}if(m&&(E=s.name??s.durable_name??""),E!==""){let O=s.filter_subject??void 0;O===">"&&(O=void 0),y=O!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${E}.${O}`:`${this.prefix}.CONSUMER.CREATE.${n}.${E}`}else y=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(y,o)}async update(n,s,a){const o=await this.info(n,s),f=a;return this.add(n,Object.assign(o.config,f),Do.Update)}async info(n,s){return Mt(n),_r(s),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${s}`)}async delete(n,s){return Mt(n),_r(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${s}`)).success}list(n){Mt(n);const s=o=>o.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new ka(a,s,this)}pause(n,s,a){const o=`${this.prefix}.CONSUMER.PAUSE.${n}.${s}`,f={pause_until:a.toISOString()};return this._request(o,f)}resume(n,s){return this.pause(n,s,new Date(0))}}function pr(r,n,s=!1){if(s===!0&&!r)throw ue.errorForCode(ie.ApiError,new Error(`${n} is not a function`));if(r&&typeof r!="function")throw ue.errorForCode(ie.ApiError,new Error(`${n} is not a function`))}class Lv extends _t{constructor(s,a,o){super();v(this,"sub");v(this,"adapter");v(this,"subIterDone");pr(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&pr(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(pr(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(pr(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(pr(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&pr(o.cleanupFn,"cleanupFn");let f=(E,w)=>{this.callback(E,w)};if(o.callback){const E=o.callback;f=(w,O)=>{const[q,M]=this.adapter(w,O);if(q){E(q,null);return}const{ingest:D}=this.ingestionFilterFn?this.ingestionFilterFn(M,this):{ingest:!0};D&&(!this.protocolFilterFn||this.protocolFilterFn(M))&&(E(q,M),this.dispatchedFn&&M&&this.dispatchedFn(M))}}const{max:h,queue:m,timeout:g}=o,y={queue:m,timeout:g,callback:f};h&&h>0&&(y.max=h),this.sub=s.subscribe(a,y),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=st(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async E=>{await E.closed,this.stop()})(this.sub).then().catch()}unsubscribe(s){this.sub.unsubscribe(s)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(s,a){this.sub.cancelTimeout();const[o,f]=this.adapter(s,a);o&&this.stop(o),f&&this.push(f)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let tn;function Hv(r){tn=r}function Eg(){return tn!==void 0&&tn.defaultPort!==void 0?tn.defaultPort:4222}function df(){return tn!==void 0&&tn.urlParseFn?tn.urlParseFn:void 0}function Pv(){if(!tn||typeof tn.factory!="function")throw new Error("transport fn is not set");return tn.factory()}function zf(){return tn!==void 0&&tn.dnsResolveFn?tn.dnsResolveFn:void 0}const Eo=`\r
|
|
37
|
+
`,qo=Or.fromAscii(Eo),$v=new Uint8Array(qo)[0],Yv=new Uint8Array(qo)[1];function Gv(r){for(let n=0;n<r.length;n++){const s=n+1;if(r.byteLength>s&&r[n]===$v&&r[s]===Yv)return s+1}return 0}function Vv(r){const n=Gv(r);if(n>0){const a=new Uint8Array(r).slice(0,n);return en.decode(a)}return""}const Fv=4,Ag=48,Jv=65,Iv=97;function Qv(r,n,s,a){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((h,m)=>{o[m]=h}),o[12]=r,o[13]=n,o[14]=s,o[15]=a,o}function qf(r){return Xv(r)!==void 0}function Xv(r){for(let n=0;n<r.length;n++)switch(r[n]){case".":return jg(r);case":":return Kv(r)}}function jg(r){const n=new Uint8Array(4);for(let s=0;s<4;s++){if(r.length===0)return;if(s>0){if(r[0]!==".")return;r=r.substring(1)}const{n:a,c:o,ok:f}=Zv(r);if(!f||a>255)return;r=r.substring(o),n[s]=a}return Qv(n[0],n[1],n[2],n[3])}function Kv(r){const n=new Uint8Array(16);let s=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(s=0,r=r.substring(2),r.length===0))return n;let a=0;for(;a<16;){const{n:o,c:f,ok:h}=Wv(r);if(!h||o>65535)return;if(f<r.length&&r[f]==="."){if(s<0&&a!=12||a+4>16)return;const m=jg(r);if(m===void 0)return;n[a]=m[12],n[a+1]=m[13],n[a+2]=m[14],n[a+3]=m[15],r="",a+=Fv;break}if(n[a]=o>>8,n[a+1]=o,a+=2,r=r.substring(f),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(s>=0)return;if(s=a,r=r.substring(1),r.length===0)break}}if(r.length===0){if(a<16){if(s<0)return;const o=16-a;for(let f=a-1;f>=s;f--)n[f+o]=n[f];for(let f=s+o-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function Zv(r){let n=0,s=0;for(n=0;n<r.length&&48<=r.charCodeAt(n)&&r.charCodeAt(n)<=57;n++)if(s=s*10+(r.charCodeAt(n)-Ag),s>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:s,c:n,ok:!0}}function Wv(r){let n=0,s=0;for(s=0;s<r.length;s++){if(48<=r.charCodeAt(s)&&r.charCodeAt(s)<=57)n*=16,n+=r.charCodeAt(s)-Ag;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)n*=16,n+=r.charCodeAt(s)-Iv+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)n*=16,n+=r.charCodeAt(s)-Jv+10;else break;if(n>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n,c:s,ok:!0}}function e1(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function Uf(r){return!e1(r)}function t1(r){const n="::FFFF:",s=r.toUpperCase().indexOf(n);if(s!==-1&&r.indexOf(".")!==-1){let a=r.substring(s+n.length);return a=a.replace("[",""),a.replace("]","")}return r}function n1(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=t1(r),Uf(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const n=Uf(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),s=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=s===80?"https":"http",o=new URL(`${a}://${r}`);o.port=`${s}`;let f=o.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:o.host,hostname:f,port:s}}class za{constructor(n,s=!1){v(this,"src");v(this,"listen");v(this,"hostname");v(this,"port");v(this,"didConnect");v(this,"reconnects");v(this,"lastConnect");v(this,"gossiped");v(this,"tlsName");v(this,"resolves");this.src=n,this.tlsName="";const a=n1(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const s=[];if(qf(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const o of a){const f=this.port===80?"https":"http",h=new URL(`${f}://${Uf(o)?"["+o+"]":o}`);h.port=`${this.port}`;const m=new za(h.host,!1);m.tlsName=this.hostname,s.push(m)}}return n.randomize&&xg(s),this.resolves=s,s}}class s1{constructor(n=[],s={}){v(this,"firstSelect");v(this,"servers");v(this,"currentServer");v(this,"tlsName");v(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const a=df();n&&(n.forEach(o=>{o=a?a(o):o,this.servers.push(new za(o))}),this.randomize&&(this.servers=xg(this.servers))),this.servers.length===0&&this.addServer(`${Of}:${Eg()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();qf(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,s=!1){const a=df();n=a?a(n):n;const o=new za(n,s);qf(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const s=this.servers.indexOf(n);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,s){const a=[];let o=[];const f=df(),h=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(g=>{g=f?f(g,s):g;const y=new za(g,!0);h.set(g,y)});const m=[];return this.servers.forEach((g,y)=>{const E=g.listen;g.gossiped&&this.currentServer.listen!==E&&h.get(E)===void 0&&m.push(y),h.delete(E)}),m.reverse(),m.forEach(g=>{const y=this.servers.splice(g,1);o=o.concat(y[0].listen)}),h.forEach((g,y)=>{this.servers.push(g),a.push(y)}),{added:a,deleted:o}}}class i1{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${fs(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const s=n.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,s){if(s&&s.permissionContext){if(n)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const o=this.all().find(f=>f.requestSubject===a.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const o=this.get(a);o&&(n===null&&s.headers&&(n=vg(s)),o.resolver(n,s))}}}close(){const n=ue.errorForCode(ie.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class r1{constructor(n,s,a){v(this,"ph");v(this,"interval");v(this,"maxOut");v(this,"timer");v(this,"pendings");this.ph=n,this.interval=s,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:vr.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=st();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class a1 extends Error{constructor(n){super(n),this.name="AssertionError"}}function l1(r,n="Assertion failed."){if(!r)throw new a1(n)}const E0=32*1024,mf=2**32-2;function go(r,n,s=0){const a=n.byteLength-s;return r.byteLength>a&&(r=r.subarray(0,a)),n.set(r,s),r.byteLength}class pf{constructor(n){v(this,"_buf");v(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const s=this._buf.byteLength;return n<=this.capacity-s?(this._reslice(s+n),s):-1}_reslice(n){l1(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const s=go(this._buf.subarray(this._off),n);return this._off+=s,s}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(Ti.encode(n))}write(n){const s=this._grow(n.byteLength);return go(n,this._buf,s)}_grow(n){const s=this.length;s===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const o=this.capacity;if(n<=Math.floor(o/2)-s)go(this._buf.subarray(this._off),this._buf);else{if(o+n>mf)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*o+n,mf));go(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(s+n,mf)),s}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const s=this._grow(n);this._reslice(s)}readFrom(n){let s=0;const a=new Uint8Array(E0);for(;;){const o=this.capacity-this.length<E0,f=o?a:new Uint8Array(this._buf.buffer,this.length),h=n.read(f);if(h===null)return s;o?this.write(f.subarray(0,h)):this._reslice(this.length+h),s+=h}}}var Rt;(function(r){r[r.OK=0]="OK",r[r.ERR=1]="ERR",r[r.MSG=2]="MSG",r[r.INFO=3]="INFO",r[r.PING=4]="PING",r[r.PONG=5]="PONG"})(Rt||(Rt={}));function A0(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const o1=48;class j0{constructor(n){v(this,"dispatcher");v(this,"state");v(this,"as");v(this,"drop");v(this,"hdr");v(this,"ma");v(this,"argBuf");v(this,"msgBuf");this.dispatcher=n,this.state=le.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let s;for(s=0;s<n.length;s++){const a=n[s];switch(this.state){case le.OP_START:switch(a){case oe.M:case oe.m:this.state=le.OP_M,this.hdr=-1,this.ma=A0();break;case oe.H:case oe.h:this.state=le.OP_H,this.hdr=0,this.ma=A0();break;case oe.P:case oe.p:this.state=le.OP_P;break;case oe.PLUS:this.state=le.OP_PLUS;break;case oe.MINUS:this.state=le.OP_MINUS;break;case oe.I:case oe.i:this.state=le.OP_I;break;default:throw this.fail(n.subarray(s))}break;case le.OP_H:switch(a){case oe.M:case oe.m:this.state=le.OP_M;break;default:throw this.fail(n.subarray(s))}break;case le.OP_M:switch(a){case oe.S:case oe.s:this.state=le.OP_MS;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MS:switch(a){case oe.G:case oe.g:this.state=le.OP_MSG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_MSG_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.MSG_ARG,this.as=s}break;case le.MSG_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{const o=this.argBuf?this.argBuf.bytes():n.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=le.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case le.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const f=n.length-s;f<o&&(o=f),o>0?(this.msgBuf.write(n.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(a)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:n.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END);break;case le.MSG_END:switch(a){case oe.NL:this.drop=0,this.as=s+1,this.state=le.OP_START;break;default:continue}break;case le.OP_PLUS:switch(a){case oe.O:case oe.o:this.state=le.OP_PLUS_O;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_O:switch(a){case oe.K:case oe.k:this.state=le.OP_PLUS_OK;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_OK:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.OK}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_MINUS:switch(a){case oe.E:case oe.e:this.state=le.OP_MINUS_E;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_E:switch(a){case oe.R:case oe.r:this.state=le.OP_MINUS_ER;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ER:switch(a){case oe.R:case oe.r:this.state=le.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.MINUS_ERR_ARG,this.as=s}break;case le.MINUS_ERR_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case le.OP_P:switch(a){case oe.I:case oe.i:this.state=le.OP_PI;break;case oe.O:case oe.o:this.state=le.OP_PO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PO:switch(a){case oe.N:case oe.n:this.state=le.OP_PON;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PON:switch(a){case oe.G:case oe.g:this.state=le.OP_PONG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PONG:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.PONG}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_PI:switch(a){case oe.N:case oe.n:this.state=le.OP_PIN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PIN:switch(a){case oe.G:case oe.g:this.state=le.OP_PING;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PING:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.PING}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_I:switch(a){case oe.N:case oe.n:this.state=le.OP_IN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_IN:switch(a){case oe.F:case oe.f:this.state=le.OP_INF;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INF:switch(a){case oe.O:case oe.o:this.state=le.OP_INFO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_INFO_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.INFO_ARG,this.as=s}break;case le.INFO_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(s))}}(this.state===le.MSG_ARG||this.state===le.MINUS_ERR_ARG||this.state===le.INFO_ARG)&&!this.argBuf&&(this.argBuf=new pf(n.subarray(this.as,s-this.drop))),this.state===le.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new pf(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+s);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new pf(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case oe.SPACE:case oe.TAB:case oe.CR:case oe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${en.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case oe.SPACE:case oe.TAB:case oe.CR:case oe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let s=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;s=s*10+(n[a]-o1)}return s}}var le;(function(r){r[r.OP_START=0]="OP_START",r[r.OP_PLUS=1]="OP_PLUS",r[r.OP_PLUS_O=2]="OP_PLUS_O",r[r.OP_PLUS_OK=3]="OP_PLUS_OK",r[r.OP_MINUS=4]="OP_MINUS",r[r.OP_MINUS_E=5]="OP_MINUS_E",r[r.OP_MINUS_ER=6]="OP_MINUS_ER",r[r.OP_MINUS_ERR=7]="OP_MINUS_ERR",r[r.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",r[r.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",r[r.OP_M=10]="OP_M",r[r.OP_MS=11]="OP_MS",r[r.OP_MSG=12]="OP_MSG",r[r.OP_MSG_SPC=13]="OP_MSG_SPC",r[r.MSG_ARG=14]="MSG_ARG",r[r.MSG_PAYLOAD=15]="MSG_PAYLOAD",r[r.MSG_END=16]="MSG_END",r[r.OP_H=17]="OP_H",r[r.OP_P=18]="OP_P",r[r.OP_PI=19]="OP_PI",r[r.OP_PIN=20]="OP_PIN",r[r.OP_PING=21]="OP_PING",r[r.OP_PO=22]="OP_PO",r[r.OP_PON=23]="OP_PON",r[r.OP_PONG=24]="OP_PONG",r[r.OP_I=25]="OP_I",r[r.OP_IN=26]="OP_IN",r[r.OP_INF=27]="OP_INF",r[r.OP_INFO=28]="OP_INFO",r[r.OP_INFO_SPC=29]="OP_INFO_SPC",r[r.INFO_ARG=30]="INFO_ARG"})(le||(le={}));var oe;(function(r){r[r.CR=13]="CR",r[r.E=69]="E",r[r.e=101]="e",r[r.F=70]="F",r[r.f=102]="f",r[r.G=71]="G",r[r.g=103]="g",r[r.H=72]="H",r[r.h=104]="h",r[r.I=73]="I",r[r.i=105]="i",r[r.K=75]="K",r[r.k=107]="k",r[r.M=77]="M",r[r.m=109]="m",r[r.MINUS=45]="MINUS",r[r.N=78]="N",r[r.n=110]="n",r[r.NL=10]="NL",r[r.O=79]="O",r[r.o=111]="o",r[r.P=80]="P",r[r.p=112]="p",r[r.PLUS=43]="PLUS",r[r.R=82]="R",r[r.r=114]="r",r[r.S=83]="S",r[r.s=115]="s",r[r.SPACE=32]="SPACE",r[r.TAB=9]="TAB"})(oe||(oe={}));(function(r){var n=function(x,S){this.hi=x|0,this.lo=S|0},s=function(x){var S,_=new Float64Array(16);if(x)for(S=0;S<x.length;S++)_[S]=x[S];return _},a=function(){throw new Error("no PRNG")},o=new Uint8Array(16),f=new Uint8Array(32);f[0]=9;var h=s(),m=s([1]),g=s([56129,1]),y=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),E=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),O=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),q=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function M(x,S){return x<<S|x>>>32-S}function D(x,S){var _=x[S+3]&255;return _=_<<8|x[S+2]&255,_=_<<8|x[S+1]&255,_<<8|x[S+0]&255}function W(x,S){var _=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],A=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new n(_,A)}function se(x,S,_){var A;for(A=0;A<4;A++)x[S+A]=_&255,_>>>=8}function ee(x,S,_){x[S]=_.hi>>24&255,x[S+1]=_.hi>>16&255,x[S+2]=_.hi>>8&255,x[S+3]=_.hi&255,x[S+4]=_.lo>>24&255,x[S+5]=_.lo>>16&255,x[S+6]=_.lo>>8&255,x[S+7]=_.lo&255}function me(x,S,_,A,N){var z,I=0;for(z=0;z<N;z++)I|=x[S+z]^_[A+z];return(1&I-1>>>8)-1}function re(x,S,_,A){return me(x,S,_,A,16)}function C(x,S,_,A){return me(x,S,_,A,32)}function X(x,S,_,A,N){var z=new Uint32Array(16),I=new Uint32Array(16),Z=new Uint32Array(16),H=new Uint32Array(4),J,fe,je;for(J=0;J<4;J++)I[5*J]=D(A,4*J),I[1+J]=D(_,4*J),I[6+J]=D(S,4*J),I[11+J]=D(_,16+4*J);for(J=0;J<16;J++)Z[J]=I[J];for(J=0;J<20;J++){for(fe=0;fe<4;fe++){for(je=0;je<4;je++)H[je]=I[(5*fe+4*je)%16];for(H[1]^=M(H[0]+H[3]|0,7),H[2]^=M(H[1]+H[0]|0,9),H[3]^=M(H[2]+H[1]|0,13),H[0]^=M(H[3]+H[2]|0,18),je=0;je<4;je++)z[4*fe+(fe+je)%4]=H[je]}for(je=0;je<16;je++)I[je]=z[je]}if(N){for(J=0;J<16;J++)I[J]=I[J]+Z[J]|0;for(J=0;J<4;J++)I[5*J]=I[5*J]-D(A,4*J)|0,I[6+J]=I[6+J]-D(S,4*J)|0;for(J=0;J<4;J++)se(x,4*J,I[5*J]),se(x,16+4*J,I[6+J])}else for(J=0;J<16;J++)se(x,4*J,I[J]+Z[J]|0)}function ce(x,S,_,A){return X(x,S,_,A,!1),0}function V(x,S,_,A){return X(x,S,_,A,!0),0}var G=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function K(x,S,_,A,N,z,I){var Z=new Uint8Array(16),H=new Uint8Array(64),J,fe;if(!N)return 0;for(fe=0;fe<16;fe++)Z[fe]=0;for(fe=0;fe<8;fe++)Z[fe]=z[fe];for(;N>=64;){for(ce(H,Z,I,G),fe=0;fe<64;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];for(J=1,fe=8;fe<16;fe++)J=J+(Z[fe]&255)|0,Z[fe]=J&255,J>>>=8;N-=64,S+=64,_&&(A+=64)}if(N>0)for(ce(H,Z,I,G),fe=0;fe<N;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];return 0}function ae(x,S,_,A,N){return K(x,S,null,0,_,A,N)}function ne(x,S,_,A,N){var z=new Uint8Array(32);return V(z,A,N,G),ae(x,S,_,A.subarray(16),z)}function ke(x,S,_,A,N,z,I){var Z=new Uint8Array(32);return V(Z,z,I,G),K(x,S,_,A,N,z.subarray(16),Z)}function He(x,S){var _,A=0;for(_=0;_<17;_++)A=A+(x[_]+S[_]|0)|0,x[_]=A&255,A>>>=8}var Me=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function $(x,S,_,A,N,z){var I,Z,H,J,fe=new Uint32Array(17),je=new Uint32Array(17),Ke=new Uint32Array(17),Ct=new Uint32Array(17),En=new Uint32Array(17);for(H=0;H<17;H++)je[H]=Ke[H]=0;for(H=0;H<16;H++)je[H]=z[H];for(je[3]&=15,je[4]&=252,je[7]&=15,je[8]&=252,je[11]&=15,je[12]&=252,je[15]&=15;N>0;){for(H=0;H<17;H++)Ct[H]=0;for(H=0;H<16&&H<N;++H)Ct[H]=_[A+H];for(Ct[H]=1,A+=H,N-=H,He(Ke,Ct),Z=0;Z<17;Z++)for(fe[Z]=0,H=0;H<17;H++)fe[Z]=fe[Z]+Ke[H]*(H<=Z?je[Z-H]:320*je[Z+17-H]|0)|0|0;for(Z=0;Z<17;Z++)Ke[Z]=fe[Z];for(J=0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;for(J=J+Ke[16]|0,Ke[16]=J&3,J=5*(J>>>2)|0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;J=J+Ke[16]|0,Ke[16]=J}for(H=0;H<17;H++)En[H]=Ke[H];for(He(Ke,Me),I=-(Ke[16]>>>7)|0,H=0;H<17;H++)Ke[H]^=I&(En[H]^Ke[H]);for(H=0;H<16;H++)Ct[H]=z[H+16];for(Ct[16]=0,He(Ke,Ct),H=0;H<16;H++)x[S+H]=Ke[H];return 0}function te(x,S,_,A,N,z){var I=new Uint8Array(16);return $(I,0,_,A,N,z),re(x,S,I,0)}function de(x,S,_,A,N){var z;if(_<32)return-1;for(ke(x,0,S,0,_,A,N),$(x,16,x,32,_-32,x),z=0;z<16;z++)x[z]=0;return 0}function ve(x,S,_,A,N){var z,I=new Uint8Array(32);if(_<32||(ne(I,0,32,A,N),te(S,16,S,32,_-32,I)!==0))return-1;for(ke(x,0,S,0,_,A,N),z=0;z<32;z++)x[z]=0;return 0}function be(x,S){var _;for(_=0;_<16;_++)x[_]=S[_]|0}function Oe(x){var S,_;for(_=0;_<16;_++)x[_]+=65536,S=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=S-1+37*(S-1)*(_===15?1:0),x[_]-=S*65536}function we(x,S,_){for(var A,N=~(_-1),z=0;z<16;z++)A=N&(x[z]^S[z]),x[z]^=A,S[z]^=A}function Te(x,S){var _,A,N,z=s(),I=s();for(_=0;_<16;_++)I[_]=S[_];for(Oe(I),Oe(I),Oe(I),A=0;A<2;A++){for(z[0]=I[0]-65517,_=1;_<15;_++)z[_]=I[_]-65535-(z[_-1]>>16&1),z[_-1]&=65535;z[15]=I[15]-32767-(z[14]>>16&1),N=z[15]>>16&1,z[14]&=65535,we(I,z,1-N)}for(_=0;_<16;_++)x[2*_]=I[_]&255,x[2*_+1]=I[_]>>8}function lt(x,S){var _=new Uint8Array(32),A=new Uint8Array(32);return Te(_,x),Te(A,S),C(_,0,A,0)}function Pt(x){var S=new Uint8Array(32);return Te(S,x),S[0]&1}function an(x,S){var _;for(_=0;_<16;_++)x[_]=S[2*_]+(S[2*_+1]<<8);x[15]&=32767}function jt(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]+_[A]|0}function Ot(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]-_[A]|0}function Se(x,S,_){var A,N,z=new Float64Array(31);for(A=0;A<31;A++)z[A]=0;for(A=0;A<16;A++)for(N=0;N<16;N++)z[A+N]+=S[A]*_[N];for(A=0;A<15;A++)z[A]+=38*z[A+16];for(A=0;A<16;A++)x[A]=z[A];Oe(x),Oe(x)}function Tt(x,S){Se(x,S,S)}function ei(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=253;A>=0;A--)Tt(_,_),A!==2&&A!==4&&Se(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function Ni(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=250;A>=0;A--)Tt(_,_),A!==1&&Se(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function ti(x,S,_){var A=new Uint8Array(32),N=new Float64Array(80),z,I,Z=s(),H=s(),J=s(),fe=s(),je=s(),Ke=s();for(I=0;I<31;I++)A[I]=S[I];for(A[31]=S[31]&127|64,A[0]&=248,an(N,_),I=0;I<16;I++)H[I]=N[I],fe[I]=Z[I]=J[I]=0;for(Z[0]=fe[0]=1,I=254;I>=0;--I)z=A[I>>>3]>>>(I&7)&1,we(Z,H,z),we(J,fe,z),jt(je,Z,J),Ot(Z,Z,J),jt(J,H,fe),Ot(H,H,fe),Tt(fe,je),Tt(Ke,Z),Se(Z,J,Z),Se(J,H,je),jt(je,Z,J),Ot(Z,Z,J),Tt(H,Z),Ot(J,fe,Ke),Se(Z,J,g),jt(Z,Z,fe),Se(J,J,Z),Se(Z,fe,Ke),Se(fe,H,N),Tt(H,je),we(Z,H,z),we(J,fe,z);for(I=0;I<16;I++)N[I+16]=Z[I],N[I+32]=J[I],N[I+48]=H[I],N[I+64]=fe[I];var Ct=N.subarray(32),En=N.subarray(16);return ei(Ct,Ct),Se(En,En,Ct),Te(x,En),0}function ln(x,S){return ti(x,S,f)}function Ci(x,S){return a(S,32),ln(x,S)}function ms(x,S,_){var A=new Uint8Array(32);return ti(A,_,S),V(x,o,A,G)}var Ja=de,Ia=ve;function Cr(x,S,_,A,N,z){var I=new Uint8Array(32);return ms(I,N,z),Ja(x,S,_,A,I)}function kr(x,S,_,A,N,z){var I=new Uint8Array(32);return ms(I,N,z),Ia(x,S,_,A,I)}function Yn(){var x=0,S=0,_=0,A=0,N=65535,z,I,Z;for(Z=0;Z<arguments.length;Z++)z=arguments[Z].lo,I=arguments[Z].hi,x+=z&N,S+=z>>>16,_+=I&N,A+=I>>>16;return S+=x>>>16,_+=S>>>16,A+=_>>>16,new n(_&N|A<<16,x&N|S<<16)}function Qa(x,S){return new n(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function ki(){var x=0,S=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,S^=arguments[_].hi;return new n(S,x)}function et(x,S){var _,A,N=32-S;return S<32?(_=x.hi>>>S|x.lo<<N,A=x.lo>>>S|x.hi<<N):S<64&&(_=x.lo>>>S|x.hi<<N,A=x.hi>>>S|x.lo<<N),new n(_,A)}function Xo(x,S,_){var A=x.hi&S.hi^~x.hi&_.hi,N=x.lo&S.lo^~x.lo&_.lo;return new n(A,N)}function Xa(x,S,_){var A=x.hi&S.hi^x.hi&_.hi^S.hi&_.hi,N=x.lo&S.lo^x.lo&_.lo^S.lo&_.lo;return new n(A,N)}function Ka(x){return ki(et(x,28),et(x,34),et(x,39))}function Mi(x){return ki(et(x,14),et(x,18),et(x,41))}function Ko(x){return ki(et(x,1),et(x,8),Qa(x,7))}function Za(x){return ki(et(x,19),et(x,61),Qa(x,6))}var Zo=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function Wa(x,S,_){var A=[],N=[],z=[],I=[],Z,H,J;for(H=0;H<8;H++)A[H]=z[H]=W(x,8*H);for(var fe=0;_>=128;){for(H=0;H<16;H++)I[H]=W(S,8*H+fe);for(H=0;H<80;H++){for(J=0;J<8;J++)N[J]=z[J];for(Z=Yn(z[7],Mi(z[4]),Xo(z[4],z[5],z[6]),Zo[H],I[H%16]),N[7]=Yn(Z,Ka(z[0]),Xa(z[0],z[1],z[2])),N[3]=Yn(N[3],Z),J=0;J<8;J++)z[(J+1)%8]=N[J];if(H%16===15)for(J=0;J<16;J++)I[J]=Yn(I[J],I[(J+9)%16],Ko(I[(J+1)%16]),Za(I[(J+14)%16]))}for(H=0;H<8;H++)z[H]=Yn(z[H],A[H]),A[H]=z[H];fe+=128,_-=128}for(H=0;H<8;H++)ee(x,8*H,A[H]);return _}var ni=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 ot(x,S,_){var A=new Uint8Array(64),N=new Uint8Array(256),z,I=_;for(z=0;z<64;z++)A[z]=ni[z];for(Wa(A,S,_),_%=128,z=0;z<256;z++)N[z]=0;for(z=0;z<_;z++)N[z]=S[I-_+z];for(N[_]=128,_=256-128*(_<112?1:0),N[_-9]=0,ee(N,_-8,new n(I/536870912|0,I<<3)),Wa(A,N,_),z=0;z<64;z++)x[z]=A[z];return 0}function $t(x,S){var _=s(),A=s(),N=s(),z=s(),I=s(),Z=s(),H=s(),J=s(),fe=s();Ot(_,x[1],x[0]),Ot(fe,S[1],S[0]),Se(_,_,fe),jt(A,x[0],x[1]),jt(fe,S[0],S[1]),Se(A,A,fe),Se(N,x[3],S[3]),Se(N,N,E),Se(z,x[2],S[2]),jt(z,z,z),Ot(I,A,_),Ot(Z,z,N),jt(H,z,N),jt(J,A,_),Se(x[0],I,Z),Se(x[1],J,H),Se(x[2],H,Z),Se(x[3],I,J)}function Nt(x,S,_){var A;for(A=0;A<4;A++)we(x[A],S[A],_)}function Mr(x,S){var _=s(),A=s(),N=s();ei(N,S[2]),Se(_,S[0],N),Se(A,S[1],N),Te(x,A),x[31]^=Pt(_)<<7}function Rr(x,S,_){var A,N;for(be(x[0],h),be(x[1],m),be(x[2],m),be(x[3],h),N=255;N>=0;--N)A=_[N/8|0]>>(N&7)&1,Nt(x,S,A),$t(S,x),$t(x,x),Nt(x,S,A)}function Ri(x,S){var _=[s(),s(),s(),s()];be(_[0],w),be(_[1],O),be(_[2],m),Se(_[3],w,O),Rr(x,_,S)}function ps(x,S,_){var A=new Uint8Array(64),N=[s(),s(),s(),s()],z;for(_||a(S,32),ot(A,S,32),A[0]&=248,A[31]&=127,A[31]|=64,Ri(N,A),Mr(x,N),z=0;z<32;z++)S[z+32]=x[z];return 0}var Gn=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 gs(x,S){var _,A,N,z;for(A=63;A>=32;--A){for(_=0,N=A-32,z=A-12;N<z;++N)S[N]+=_-16*S[A]*Gn[N-(A-32)],_=Math.floor((S[N]+128)/256),S[N]-=_*256;S[N]+=_,S[A]=0}for(_=0,N=0;N<32;N++)S[N]+=_-(S[31]>>4)*Gn[N],_=S[N]>>8,S[N]&=255;for(N=0;N<32;N++)S[N]-=_*Gn[N];for(A=0;A<32;A++)S[A+1]+=S[A]>>8,x[A]=S[A]&255}function wn(x){var S=new Float64Array(64),_;for(_=0;_<64;_++)S[_]=x[_];for(_=0;_<64;_++)x[_]=0;gs(x,S)}function si(x,S,_,A){var N=new Uint8Array(64),z=new Uint8Array(64),I=new Uint8Array(64),Z,H,J=new Float64Array(64),fe=[s(),s(),s(),s()];ot(N,A,32),N[0]&=248,N[31]&=127,N[31]|=64;var je=_+64;for(Z=0;Z<_;Z++)x[64+Z]=S[Z];for(Z=0;Z<32;Z++)x[32+Z]=N[32+Z];for(ot(I,x.subarray(32),_+32),wn(I),Ri(fe,I),Mr(x,fe),Z=32;Z<64;Z++)x[Z]=A[Z];for(ot(z,x,_+64),wn(z),Z=0;Z<64;Z++)J[Z]=0;for(Z=0;Z<32;Z++)J[Z]=I[Z];for(Z=0;Z<32;Z++)for(H=0;H<32;H++)J[Z+H]+=z[Z]*N[H];return gs(x.subarray(32),J),je}function ii(x,S){var _=s(),A=s(),N=s(),z=s(),I=s(),Z=s(),H=s();return be(x[2],m),an(x[1],S),Tt(N,x[1]),Se(z,N,y),Ot(N,N,x[2]),jt(z,x[2],z),Tt(I,z),Tt(Z,I),Se(H,Z,I),Se(_,H,N),Se(_,_,z),Ni(_,_),Se(_,_,N),Se(_,_,z),Se(_,_,z),Se(x[0],_,z),Tt(A,x[0]),Se(A,A,z),lt(A,N)&&Se(x[0],x[0],q),Tt(A,x[0]),Se(A,A,z),lt(A,N)?-1:(Pt(x[0])===S[31]>>7&&Ot(x[0],h,x[0]),Se(x[3],x[0],x[1]),0)}function Dr(x,S,_,A){var N,z=new Uint8Array(32),I=new Uint8Array(64),Z=[s(),s(),s(),s()],H=[s(),s(),s(),s()];if(_<64||ii(H,A))return-1;for(N=0;N<_;N++)x[N]=S[N];for(N=0;N<32;N++)x[N+32]=A[N];if(ot(I,x,_),wn(I),Rr(Z,H,I),Ri(H,S.subarray(32)),$t(Z,H),Mr(z,Z),_-=64,C(S,0,z,0)){for(N=0;N<_;N++)x[N]=0;return-1}for(N=0;N<_;N++)x[N]=S[N+64];return _}var Di=32,ys=24,Sn=32,bs=16,xs=32,ri=32,vs=32,Vn=32,ai=32,zr=ys,el=Sn,Mn=bs,Qe=64,it=32,Yt=64,li=32,qr=64;r.lowlevel={crypto_core_hsalsa20:V,crypto_stream_xor:ke,crypto_stream:ne,crypto_stream_salsa20_xor:K,crypto_stream_salsa20:ae,crypto_onetimeauth:$,crypto_onetimeauth_verify:te,crypto_verify_16:re,crypto_verify_32:C,crypto_secretbox:de,crypto_secretbox_open:ve,crypto_scalarmult:ti,crypto_scalarmult_base:ln,crypto_box_beforenm:ms,crypto_box_afternm:Ja,crypto_box:Cr,crypto_box_open:kr,crypto_box_keypair:Ci,crypto_hash:ot,crypto_sign:si,crypto_sign_keypair:ps,crypto_sign_open:Dr,crypto_secretbox_KEYBYTES:Di,crypto_secretbox_NONCEBYTES:ys,crypto_secretbox_ZEROBYTES:Sn,crypto_secretbox_BOXZEROBYTES:bs,crypto_scalarmult_BYTES:xs,crypto_scalarmult_SCALARBYTES:ri,crypto_box_PUBLICKEYBYTES:vs,crypto_box_SECRETKEYBYTES:Vn,crypto_box_BEFORENMBYTES:ai,crypto_box_NONCEBYTES:zr,crypto_box_ZEROBYTES:el,crypto_box_BOXZEROBYTES:Mn,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:it,crypto_sign_SECRETKEYBYTES:Yt,crypto_sign_SEEDBYTES:li,crypto_hash_BYTES:qr,gf:s,D:y,L:Gn,pack25519:Te,unpack25519:an,M:Se,A:jt,S:Tt,Z:Ot,pow2523:Ni,add:$t,set25519:be,modL:gs,scalarmult:Rr,scalarbase:Ri};function tl(x,S){if(x.length!==Di)throw new Error("bad key size");if(S.length!==ys)throw new Error("bad nonce size")}function nl(x,S){if(x.length!==vs)throw new Error("bad public key size");if(S.length!==Vn)throw new Error("bad secret key size")}function yt(){for(var x=0;x<arguments.length;x++)if(!(arguments[x]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function zi(x){for(var S=0;S<x.length;S++)x[S]=0}r.randomBytes=function(x){var S=new Uint8Array(x);return a(S,x),S},r.secretbox=function(x,S,_){yt(x,S,_),tl(_,S);for(var A=new Uint8Array(Sn+x.length),N=new Uint8Array(A.length),z=0;z<x.length;z++)A[z+Sn]=x[z];return de(N,A,A.length,S,_),N.subarray(bs)},r.secretbox.open=function(x,S,_){yt(x,S,_),tl(_,S);for(var A=new Uint8Array(bs+x.length),N=new Uint8Array(A.length),z=0;z<x.length;z++)A[z+bs]=x[z];return A.length<32||ve(N,A,A.length,S,_)!==0?null:N.subarray(Sn)},r.secretbox.keyLength=Di,r.secretbox.nonceLength=ys,r.secretbox.overheadLength=bs,r.scalarMult=function(x,S){if(yt(x,S),x.length!==ri)throw new Error("bad n size");if(S.length!==xs)throw new Error("bad p size");var _=new Uint8Array(xs);return ti(_,x,S),_},r.scalarMult.base=function(x){if(yt(x),x.length!==ri)throw new Error("bad n size");var S=new Uint8Array(xs);return ln(S,x),S},r.scalarMult.scalarLength=ri,r.scalarMult.groupElementLength=xs,r.box=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox(x,S,N)},r.box.before=function(x,S){yt(x,S),nl(x,S);var _=new Uint8Array(ai);return ms(_,x,S),_},r.box.after=r.secretbox,r.box.open=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox.open(x,S,N)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var x=new Uint8Array(vs),S=new Uint8Array(Vn);return Ci(x,S),{publicKey:x,secretKey:S}},r.box.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Vn)throw new Error("bad secret key size");var S=new Uint8Array(vs);return ln(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},r.box.publicKeyLength=vs,r.box.secretKeyLength=Vn,r.box.sharedKeyLength=ai,r.box.nonceLength=zr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(x,S){if(yt(x,S),S.length!==Yt)throw new Error("bad secret key size");var _=new Uint8Array(Qe+x.length);return si(_,x,x.length,S),_},r.sign.open=function(x,S){if(yt(x,S),S.length!==it)throw new Error("bad public key size");var _=new Uint8Array(x.length),A=Dr(_,x,x.length,S);if(A<0)return null;for(var N=new Uint8Array(A),z=0;z<N.length;z++)N[z]=_[z];return N},r.sign.detached=function(x,S){for(var _=r.sign(x,S),A=new Uint8Array(Qe),N=0;N<A.length;N++)A[N]=_[N];return A},r.sign.detached.verify=function(x,S,_){if(yt(x,S,_),S.length!==Qe)throw new Error("bad signature size");if(_.length!==it)throw new Error("bad public key size");var A=new Uint8Array(Qe+x.length),N=new Uint8Array(Qe+x.length),z;for(z=0;z<Qe;z++)A[z]=S[z];for(z=0;z<x.length;z++)A[z+Qe]=x[z];return Dr(N,A,A.length,_)>=0},r.sign.keyPair=function(){var x=new Uint8Array(it),S=new Uint8Array(Yt);return ps(x,S),{publicKey:x,secretKey:S}},r.sign.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Yt)throw new Error("bad secret key size");for(var S=new Uint8Array(it),_=0;_<S.length;_++)S[_]=x[32+_];return{publicKey:S,secretKey:new Uint8Array(x)}},r.sign.keyPair.fromSeed=function(x){if(yt(x),x.length!==li)throw new Error("bad seed size");for(var S=new Uint8Array(it),_=new Uint8Array(Yt),A=0;A<32;A++)_[A]=x[A];return ps(S,_,!0),{publicKey:S,secretKey:_}},r.sign.publicKeyLength=it,r.sign.secretKeyLength=Yt,r.sign.seedLength=li,r.sign.signatureLength=Qe,r.hash=function(x){yt(x);var S=new Uint8Array(qr);return ot(S,x,x.length),S},r.hash.hashLength=qr,r.verify=function(x,S){return yt(x,S),x.length===0||S.length===0||x.length!==S.length?!1:me(x,0,S,0,x.length)===0},r.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var S=65536;r.setPRNG(function(_,A){var N,z=new Uint8Array(A);for(N=0;N<A;N+=S)x.getRandomValues(z.subarray(N,N+Math.min(A-N,S)));for(N=0;N<A;N++)_[N]=z[N];zi(z)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&r.setPRNG(function(_,A){var N,z=x.randomBytes(A);for(N=0;N<A;N++)_[N]=z[N];zi(z)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const yo=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;yo.sign.keyPair.fromSeed,yo.sign.detached,yo.sign.detached.verify,yo.randomBytes;var O0;(function(r){r.InvalidPrefixByte="nkeys: invalid prefix byte",r.InvalidKey="nkeys: invalid key",r.InvalidPublicKey="nkeys: invalid public key",r.InvalidSeedLen="nkeys: invalid seed length",r.InvalidSeed="nkeys: invalid seed",r.InvalidEncoding="nkeys: invalid encoded key",r.InvalidSignature="nkeys: signature verification failed",r.CannotSign="nkeys: cannot sign, no private key available",r.PublicKeyOnly="nkeys: no seed or private key available",r.InvalidChecksum="nkeys: invalid checksum",r.SerializationError="nkeys: serialization error",r.ApiError="nkeys: api error",r.ClearedPair="nkeys: pair is cleared"})(O0||(O0={}));var T0;(function(r){r[r.Seed=144]="Seed",r[r.Private=120]="Private",r[r.Operator=112]="Operator",r[r.Server=104]="Server",r[r.Cluster=16]="Cluster",r[r.Account=0]="Account",r[r.User=160]="User"})(T0||(T0={}));function c1(r){return n=>{let s={};return r.forEach(a=>{const o=a(n)||{};s=Object.assign(s,o)}),s}}function u1(){return()=>{}}function f1(r,n){return()=>{const s=typeof r=="function"?r():r,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function h1(r){return()=>({auth_token:typeof r=="function"?r():r})}const Og=120*1e3,d1=2,Tg=2*1e3;function m1(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Og,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Tg,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function p1(r){const n=[];return typeof r.authenticator=="function"&&n.push(r.authenticator),Array.isArray(r.authenticator)&&n.push(...r.authenticator),r.token&&n.push(h1(r.token)),r.user&&n.push(f1(r.user,r.pass)),n.length===0?u1():c1(n)}function g1(r){const n=`${Of}:${Eg()}`;if(r=r||{servers:[n]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new ue("port and servers options are mutually exclusive",ie.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${Of}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[n]);const s=Yo(m1(),r);if(s.authenticator=p1(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new ue(`${a} option should be a function`,ie.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let a=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),s.reconnectTimeWait+a}),s.inboxPrefix)try{fs(s.inboxPrefix)}catch(a){throw new ue(a.message,ie.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof zf()=="function"),s.resolve&&typeof zf()!="function")throw new ue("'resolve' is not supported on this client",ie.InvalidOption);return s}function y1(r,n){const{proto:s,tls_required:a,tls_available:o}=r;if((s===void 0||s<1)&&n.noEcho)throw new ue("noEcho",ie.ServerOptionNotAvailable);const f=a||o||!1;if(n.tls&&!f)throw new ue("tls",ie.ServerOptionNotAvailable)}const b1=1024*32,x1=/^INFO\s+([^\r\n]+)\r\n/i,v1=Ra(`PONG\r
|
|
38
|
+
`),N0=Ra(`PING\r
|
|
39
|
+
`);class _1{constructor(n,s,a){v(this,"echo");v(this,"no_responders");v(this,"protocol");v(this,"verbose");v(this,"pedantic");v(this,"jwt");v(this,"nkey");v(this,"sig");v(this,"user");v(this,"pass");v(this,"auth_token");v(this,"tls_required");v(this,"name");v(this,"lang");v(this,"version");v(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};Yo(this,o)}}class Ng extends _t{constructor(s,a,o={}){var h;super();v(this,"sid");v(this,"queue");v(this,"draining");v(this,"max");v(this,"subject");v(this,"drained");v(this,"protocol");v(this,"timer");v(this,"info");v(this,"cleanupFn");v(this,"closed");v(this,"requestSubject");Yo(this,o),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=st();const f=!((h=s.options)!=null&&h.noAsyncTraces);o.timeout&&(this.timer=Ar(o.timeout,f),this.timer.then(()=>{this.timer=void 0}).catch(m=>{this.stop(m),this.noIterator&&this.callback(m,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const a=this.callback,o=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),f=s.protocolFilterFn?s.protocolFilterFn:()=>!0,h=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(m,g)=>{const{ingest:y}=o(g);y&&f(g)&&(a(m,g),h(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,a){this.cancelTimeout(),s?this.stop(s):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isClosed()?Promise.reject(ue.errorForCode(ie.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(st()).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 w1{constructor(){v(this,"mux");v(this,"subs");v(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const s=n.permissionContext,a=this.all();let o;if(s.operation==="subscription"&&(o=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(o=a.find(f=>f.requestSubject===s.subject)),o)return o.callback(n,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Uo{constructor(n,s){v(this,"connected");v(this,"connectedOnce");v(this,"infoReceived");v(this,"info");v(this,"muxSubscriptions");v(this,"options");v(this,"outbound");v(this,"pongs");v(this,"subscriptions");v(this,"transport");v(this,"noMorePublishing");v(this,"connectError");v(this,"publisher");v(this,"_closed");v(this,"closed");v(this,"listeners");v(this,"heartbeats");v(this,"parser");v(this,"outMsgs");v(this,"inMsgs");v(this,"outBytes");v(this,"inBytes");v(this,"pendingLimit");v(this,"lastError");v(this,"abortReconnect");v(this,"whyClosed");v(this,"servers");v(this,"server");v(this,"features");v(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=b1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new w1,this.muxSubscriptions=new i1,this.outbound=new Or,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new Bv({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new s1(a,{randomize:!n.noRandomize}),this.closed=st(),this.parser=new j0(this),this.heartbeats=new r1(this,this.options.pingInterval||Og,this.options.maxPingOut||d1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=ue.errorForCode(ie.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new j0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(s=>{s.push(n)})}status(){const n=new _t;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=st();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=s=>{n.reject(s)},this.transport=Pv(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:vr.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:vr.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:us.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:us.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===ie.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(n)}async dial(n){const s=this.prepare();let a;try{a=Ar(this.options.timeout||2e4);const o=this.transport.connect(n,this.options);await Promise.race([o,a]),(async()=>{try{for await(const f of this.transport)this.parser.parse(f)}catch(f){console.log("reader closed",f)}})().then()}catch(o){s.reject(o)}try{await Promise.race([a,s]),a&&a.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(o){throw a&&a.cancel(),await this.transport.close(o),o}}async _doDial(n){const{resolve:s}=this.options,a=await n.resolve({fn:zf(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const f of a)try{o=null,this.dispatchStatus({type:vr.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(h){o=h}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Tg;let a=s;const o=this.selectServer();if(!o||this.abortReconnect)throw n||(this.lastError?this.lastError:ue.errorForCode(ie.ConnectionRefused));const f=Date.now();if(o.lastConnect===0||o.lastConnect+s<=f){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(h){if(n=h,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const m=this.options.maxReconnectAttempts||0;m!==-1&&o.reconnects>=m&&this.servers.removeCurrentServer()}}else a=Math.min(a,o.lastConnect+s-f),await Tr(a)}}static async connect(n,s){const a=new Uo(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new ue(n,ie.PermissionsViolation),o=n.match(/(Publish|Subscription) to "(\S+)"/);if(o){a.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const f=n.match(/using queue "(\S+)"/);f&&(a.permissionContext.queue=f[1])}return a}else return s.indexOf("authorization violation")!==-1?new ue(n,ie.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new ue(n,ie.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new ue(n,ie.AccountExpired):s.indexOf("authentication timeout")!==-1?new ue(n,ie.AuthenticationTimeout):new ue(n,ie.ProtocolError)}processMsg(n,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new nh(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=f0(n),a=Uo.toError(s),o={type:us.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){o.permissionContext=a.permissionContext;const h=this.subscriptions.getMux();f=(h==null?void 0:h.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(f,a),f&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(v1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(f0(n));this.info=s;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Ai(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:h}=this.transport;try{const m=new _1({version:f,lang:h},this.options,s.nonce);s.headers&&(m.headers=!0,m.no_responders=!0);const g=JSON.stringify(m);this.transport.send(Ra(`CONNECT ${g}${Eo}`)),this.transport.send(N0)}catch(m){this._close(m)}}a&&this.dispatchStatus({type:us.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:us.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case Rt.MSG:{const{msg:s,data:a}=n;this.processMsg(s,a);break}case Rt.OK:break;case Rt.ERR:this.processError(n.data);break;case Rt.PING:this.processPing();break;case Rt.PONG:this.processPong();break;case Rt.INFO:this.processInfo(n.data);break}}sendCommand(n,...s){const a=this.outbound.length();let o;typeof n=="string"?o=Ra(n):o=n,this.outbound.fill(o,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=nn,a){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=Ti.encode(s);else throw ue.errorForCode(ie.BadPayload);let f=o.length;a=a||{},a.reply=a.reply||"";let h=nn,m=0;if(a.headers){if(this.info&&!this.info.headers)throw new ue("headers",ie.ServerOptionNotAvailable);h=a.headers.encode(),m=h.length,f=o.length+m}if(this.info&&f>this.info.max_payload)throw ue.errorForCode(ie.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let g;a.headers?(a.reply?g=`HPUB ${n} ${a.reply} ${m} ${f}\r
|
|
40
|
+
`:g=`HPUB ${n} ${m} ${f}\r
|
|
41
41
|
`,this.sendCommand(g,h,o,qo)):(a.reply?g=`PUB ${n} ${a.reply} ${f}\r
|
|
42
42
|
`:g=`PUB ${n} ${f}\r
|
|
43
43
|
`,this.sendCommand(g,o,qo))}request(n){return this.initMux(),this.muxSubscriptions.add(n),n}subscribe(n){return this.subscriptions.add(n),this._subunsub(n),n}_sub(n){n.queue?this.sendCommand(`SUB ${n.subject} ${n.queue} ${n.sid}\r
|
|
44
44
|
`):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
|
|
45
45
|
`)}_subunsub(n){return this._sub(n),n.max&&this.unsubscribe(n,n.max),n}unsubscribe(n,s){this.unsub(n,s),(n.max===void 0||n.received>=n.max)&&this.subscriptions.cancel(n)}unsub(n,s){!n||this.isClosed()||(s?this.sendCommand(`UNSUB ${n.sid} ${s}\r
|
|
46
46
|
`):this.sendCommand(`UNSUB ${n.sid}\r
|
|
47
|
-
`),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=st()),this.pongs.push(n),this.outbound.fill(T0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(s=>{const a=s;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${Eo}`):n.push(`SUB ${a.subject} ${a.sid}${Eo}`)}),n.length&&this.transport.send(Ra(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),s=[];return n.forEach(a=>{s.push(a.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),a=new Tg(this,`${s}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const A1="$SRV";class N0{constructor(n){v(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,s){return this.msg.respond(n,s)}respondError(n,s,a,o){var f,h;return o=o||{},o.headers=o.headers||hs(),(f=o.headers)==null||f.set(Mo,`${n}`),(h=o.headers)==null||h.set(ko,s),this.msg.respond(a,o)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class La{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&j1("service group",s);let o="";if(n instanceof Ga)this.srv=n,o="";else if(n instanceof La){const f=n;this.srv=f.srv,a===""&&f.queue!==""&&(a=f.queue),o=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=a}calcSubject(n,s=""){return s===""?n:n!==""?`${n}.${s}`:s}addEndpoint(n="",s){s=s||{subject:n};const a=typeof s=="function"?{handler:s,subject:n}:s;Na("endpoint",n);let{subject:o,handler:f,metadata:h,queue:d}=a;o=o||n,d=d||this.queue,O1("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:n,subject:o,queue:d,handler:f,metadata:h};return this.srv._addEndpoint(g)}addGroup(n="",s=""){return new La(this,n,s)}}function O1(r,n){if(n==="")throw new Error(`${r} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);const s=n.split(".");s.forEach((a,o)=>{if(a===">"&&o!==s.length-1)throw new Error(`${r} cannot have internal '>': '${n}'`)})}function j1(r,n){if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${r} name cannot contain internal '>': '${n}'`)})}class Ga{constructor(n,s={name:"",version:""}){v(this,"nc");v(this,"_id");v(this,"config");v(this,"handlers");v(this,"internal");v(this,"_stopped");v(this,"_done");v(this,"started");this.nc=n,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),Na("name",this.config.name),Na("queue",this.config.queue),Ai(this.config.version),this._id=Ks.next(),this.internal=[],this._done=st(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,s="",a="",o){const f=o??A1;return s===""&&a===""?`${f}.${n}`:(Na("control subject name",s),a!==""?(Na("control subject id",a),`${f}.${n}.${s}.${a}`):`${f}.${n}.${s}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const s=hs();if(n instanceof Ro){const a=n;s.set(ko,a.message),s.set(Mo,`${a.code}`)}else s.set(ko,n.message),s.set(Mo,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:o,subject:f,handler:h}=n,d=n;d.internal=s,s&&this.internal.push(d),d.stats=new T1(o,f,a),d.queue=a;const g=h?(y,E)=>{if(y){this.close(y);return}const w=Date.now();try{h(y,new N0(E))}catch(j){d.stats.countError(j),E==null||E.respond(nn,{headers:this.errorToHeader(j)})}finally{d.stats.countLatency(w)}}:void 0;return d.sub=this.nc.subscribe(f,{callback:g,queue:a}),d.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(y=>{if(!this._stopped){const E=new Error(`required subscription ${n.subject} errored: ${y.message}`);E.stack=y.stack,this.close(E).catch()}}),d}info(){return{type:Da.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:s,metadata:a,name:o,queue:f}=n;return{subject:s,metadata:a,name:o,queue_group:f}})}async stats(){const n=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(a){s.stats.countError(a)}n.push(s.stats.stats(s.qi))}return{type:Da.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,s){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,s),this._doAddInternalHandler(`${a}-kind`,n,s,this.name),this._doAddInternalHandler(`${a}`,n,s,this.name,this.id)}_doAddInternalHandler(n,s,a,o="",f=""){const h={};h.name=n,h.subject=Ga.controlSubject(s,o,f),h.handler=a,this.setupHandler(h,!0)}start(){const n=kn(),s=(h,d)=>h?(this.close(h),Promise.reject(h)):this.stats().then(g=>(d==null||d.respond(n.encode(g)),Promise.resolve())),a=(h,d)=>h?(this.close(h),Promise.reject(h)):(d==null||d.respond(n.encode(this.info())),Promise.resolve()),o=n.encode(this.ping()),f=(h,d)=>h?(this.close(h).then().catch(),Promise.reject(h)):(d.respond(o),Promise.resolve());return this.addInternalHandler(Js.PING,f),this.addInternalHandler(Js.STATS,s),this.addInternalHandler(Js.INFO,a),this.handlers.forEach(h=>{const{subject:d}=h;typeof d=="string"&&h.handler!==null&&this.setupHandler(h)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:Da.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,s){return new La(this,n,s)}addEndpoint(n,s){return new La(this).addEndpoint(n,s)}_addEndpoint(n){const s=new _t;s.noIterator=typeof n.handler=="function",s.noIterator||(n.handler=(o,f)=>{o?this.stop(o).catch():s.push(new N0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class T1{constructor(n,s,a=""){v(this,"name");v(this,"subject");v(this,"average_processing_time");v(this,"num_requests");v(this,"processing_time");v(this,"num_errors");v(this,"last_error");v(this,"data");v(this,"metadata");v(this,"queue");this.name=n,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=n;s&&(s.time=0,s.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=nt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:d,data:g,queue:y}=this;return{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:d,data:g,queue_group:y}}stats(n){const s=n;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=nt(s.time),this.num_requests=s.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class N1{constructor(n,s={strategy:Cn.JitterTimer,maxWait:2e3},a){v(this,"nc");v(this,"prefix");v(this,"opts");this.nc=n,this.prefix=a,this.opts=s}ping(n="",s=""){return this.q(Js.PING,n,s)}stats(n="",s=""){return this.q(Js.STATS,n,s)}info(n="",s=""){return this.q(Js.INFO,n,s)}async q(n,s="",a=""){const o=new _t,f=kn(),h=Ga.controlSubject(n,s,a,this.prefix),d=await this.nc.requestMany(h,nn,this.opts);return(async()=>{for await(const g of d)try{const y=f.decode(g.data);o.push(y)}catch(y){o.push(()=>{o.stop(y)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function Ng(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function C1(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Ng(),storage:kf.File}}const Bo="KV-Operation",C0="$KV",k1=/^[-/=.\w]+$/,M1=/^[-/=.>*\w]+$/,R1=/^[-\w]+$/;function D1(r){if(r.startsWith(".")||r.endsWith(".")||!k1.test(r))throw new Error(`invalid key: ${r}`)}function z1(r){if(r.startsWith(".")||r.endsWith(".")||!M1.test(r))throw new Error(`invalid key: ${r}`)}function q1(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const n=r.split(".");let s=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":s=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${r}`);s=!0;break}return s}function Ao(r){if(!R1.test(r))throw new Error(`invalid bucket name: ${r}`)}var Un;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(Un||(Un={}));class Ha{constructor(n,s,a){v(this,"js");v(this,"jsm");v(this,"stream");v(this,"bucket");v(this,"direct");v(this,"codec");v(this,"prefix");v(this,"editPrefix");v(this,"useJsPrefix");v(this,"_prefixLen");v(this,"validateKey",D1);v(this,"validateSearchKey",z1);v(this,"hasWildcards",q1);Ao(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=C0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){Ao(s);const o=await n.jetstreamManager(),f=new Ha(s,n,o);return await f.init(a),f}static async bind(n,s,a={}){const o=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};Ao(s);const h=new Ha(s,n,o);return f.config.name=a.streamName??h.bucketName(),Object.assign(h,f),h.stream=f.config.name,h.codec=a.codec||Ng(),h.direct=f.config.allow_direct??!1,h.initializePrefixes(f),h}async init(n={}){const s=Object.assign(C1(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=Cf.Limits,a.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(a.max_bytes=s.max_bytes),a.max_msg_size=s.maxValueSize,a.storage=s.storage;const o=n.placementCluster??"";if(o&&(n.placement={},n.placement.cluster=o,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const w=Object.assign({},n.mirror);w.name.startsWith(Zt)||(w.name=`${Zt}${w.name}`),a.mirror=w,a.mirror_direct=!0}else if(n.sources){const w=n.sources.map(j=>{const q=Object.assign({},j),M=q.name.startsWith(Zt)?q.name.substring(Zt.length):q.name;return q.name.startsWith(Zt)||(q.name=`${Zt}${q.name}`),!j.external&&M!==this.bucket&&(q.subject_transforms=[{src:`$KV.${M}.>`,dest:`$KV.${this.bucket}.>`}]),q});a.sources=w,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);const f=this.js.nc,h=f.getServerVersion(),d=h?Rf(h,Ai("2.7.2"))>=0:!1;a.discard=d?Ba.New:Ba.Old;const{ok:g,min:y}=f.features.get(Ue.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const w=h?`${h.major}.${h.minor}.${h.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${w} - requires ${y}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:g,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=nt(s.ttl)),a.allow_rollup_hdrs=!0;let E;try{E=await this.jsm.streams.info(a.name),!E.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(w){if(w.message==="stream not found")E=await this.jsm.streams.add(a);else throw w}this.initializePrefixes(E)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=n.config;if(s){let a=s.name;if(a.startsWith(Zt)&&(a=a.substring(Zt.length)),s.external&&s.external.api!==""){const o=s.name.substring(Zt.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Zt}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,s=!1){const a=[];return s?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${C0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.encode(a));break}return s.join(".")}decodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.decode(a));break}return s.join(".")}close(){return Promise.resolve()}dataLen(n,s){const a=s&&s.get(Dt.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new K1(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new Z1(this.bucket,s,n)}async create(n,s){var f;let a;try{const h=await this.put(n,s,{previousSeq:0});return Promise.resolve(h)}catch(h){if(a=h,((f=h==null?void 0:h.api_error)==null?void 0:f.err_code)!==10071)return Promise.reject(h)}let o=0;try{const h=await this.get(n);return(h==null?void 0:h.operation)==="DEL"||(h==null?void 0:h.operation)==="PURGE"?(o=h!==null?h.revision:0,this.update(n,s,o)):Promise.reject(a)}catch(h){return Promise.reject(h)}}update(n,s,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,s,{previousSeq:a})}async put(n,s,a={}){var h,d;const o=this.encodeKey(n);this.validateKey(o);const f={};if(a.previousSeq!==void 0){const g=hs();f.headers=g,g.set(Un.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,f)).seq}catch(g){const y=g;return y.isJetStreamError()?(y.message=(h=y.api_error)==null?void 0:h.description,y.code=`${(d=y.api_error)==null?void 0:d.code}`,Promise.reject(y)):Promise.reject(g)}}async get(n,s){const a=this.encodeKey(n);this.validateKey(a);let o={last_by_subj:this.subjectForKey(a)};s&&s.revision>0&&(o={seq:s.revision});let f;try{this.direct?f=await this.jsm.direct.getMessage(this.bucketName(),o):f=await this.jsm.streams.getMessage(this.bucketName(),o);const h=this.smToEntry(f);return h.key!==a?null:h}catch(h){if(h.code===ie.JetStream404NoMessages)return null;throw h}}purge(n,s){return this._deleteOrPurge(n,"PURGE",s)}delete(n,s){return this._deleteOrPurge(n,"DEL",s)}async purgeDeletes(n=1800*1e3){const s=st(),a=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&a.push(g)})().then(),await s,o.stop();const f=Date.now()-n,h=a.map(g=>{const y=this.subjectForKey(g.key);return g.created.getTime()>=f?this.jsm.streams.purge(this.stream,{filter:y,keep:1}):this.jsm.streams.purge(this.stream,{filter:y,keep:0})}),d=await Promise.all(h);return d.unshift({success:!0,purged:0}),d.reduce((g,y)=>(g.purged+=y.purged,g))}async _deleteOrPurge(n,s,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,s,a);const o=await this.keys(n),f=[];for await(const h of o)f.push(this._doDeleteOrPurge(h,s)),f.length===100&&(await Promise.all(f),f.length=0);f.length>0&&await Promise.all(f)}async _doDeleteOrPurge(n,s,a){const o=this.encodeKey(n);this.validateKey(o);const f=hs();f.set(Bo,s),s==="PURGE"&&f.set(Dt.RollupHdr,Dt.RollupValueSubject),a!=null&&a.previousSeq&&f.set(Un.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),nn,{headers:f})}_buildCC(n,s,a={}){let f=(Array.isArray(n)?n:[n]).map(g=>{const y=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(y)}),h=ft.LastPerSubject;s===Tn.AllHistory&&(h=ft.All),s===Tn.UpdatesOnly&&(h=ft.New);let d;return f.length===1&&(d=f[0],f=void 0),Object.assign({deliver_policy:h,ack_policy:vt.None,filter_subjects:f,filter_subject:d,flow_control:!0,idle_heartbeat:nt(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f;f=()=>{a.stop()};let h=0;const d=this._buildCC(s,Tn.AllHistory,o),g=d.filter_subject,y=Is(d);y.bindStream(this.stream),y.orderedConsumer(),y.callback((w,j)=>{if(w){a.stop(w);return}if(j){const q=this.jmToEntry(j);a.push(q),a.received++,(f&&h>0&&a.received>=h||j.info.pending===0)&&(a.push(f),f=void 0)}});const E=await this.js.subscribe(g,y);if(f){const{info:{last:w}}=E,j=w.num_pending+w.delivered.consumer_seq;if(j===0||a.received>=j)try{f()}catch(q){a.stop(q)}finally{f=void 0}else h=j}return a._data=E,a.iterClosed.then(()=>{E.unsubscribe()}),E.closed.then(()=>{a.stop()}).catch(w=>{a.stop(w)}),a}canSetWatcherName(){const s=this.js.nc,{ok:a}=s.features.get(Ue.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f=Tn.LastValue;n.include===Tn.AllHistory?f=Tn.AllHistory:n.include===Tn.UpdatesOnly&&(f=Tn.UpdatesOnly);const h=n.ignoreDeletes===!0;let d=n.initializedFn,g=0;const y=this._buildCC(s,f,o),E=y.filter_subject,w=Is(y);this.canSetWatcherName()&&w.consumerName(Ks.next()),w.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&w.startSequence(n.resumeFromRevision),w.orderedConsumer(),w.callback((q,M)=>{if(q){a.stop(q);return}if(M){const D=this.jmToEntry(M);if(h&&D.operation==="DEL")return;a.push(D),a.received++,d&&(g>0&&a.received>=g||M.info.pending===0)&&(a.push(d),d=void 0)}});const j=await this.js.subscribe(E,w);if(d){const{info:{last:q}}=j,M=q.num_pending+q.delivered.consumer_seq;if(M===0||a.received>=M)try{d()}catch(D){a.stop(D)}finally{d=void 0}else g=M}return a._data=j,a.iterClosed.then(()=>{j.unsubscribe()}),j.closed.then(()=>{a.stop()}).catch(q=>{a.stop(q)}),a}async keys(n=">"){const s=new _t,a=this._buildCC(n,Tn.LastValue,{headers_only:!0}),o=Array.isArray(n)?">":a.filter_subject,f=Is(a);f.bindStream(this.stream),f.orderedConsumer();const h=await this.js.subscribe(o,f);return(async()=>{var g;for await(const y of h){const E=(g=y.headers)==null?void 0:g.get(Bo);if(E!=="DEL"&&E!=="PURGE"){const w=this.decodeKey(y.subject.substring(this.prefixLen));s.push(w)}y.info.pending===0&&h.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),h.info.last.num_pending===0&&h.unsubscribe(),s}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),o=await this.jsm.streams.info(a);return new Cg(o,s)}}class Cg{constructor(n,s=""){v(this,"si");v(this,"cluster");this.si=n,this.cluster=s}get bucket(){return this.si.config.name.startsWith(Zt)?this.si.config.name.substring(Zt.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return eh(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Zs.None:!1}}const sh="OBJ_",k0="SHA-256=";function U1(r){return Ao(r),`${sh}${r}`}function B1(r){return r.startsWith(sh)?r.substring(4):r}class Uf{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return B1(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==Zs.None:!1}}function bo(r){if(r===void 0)return;const{domain:n}=r;if(n===void 0)return r;const s=Object.assign({},r);if(delete s.domain,n==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${n}.API`},s}var bn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(bn||(bn={}));var Bn;(function(r){r.HeartbeatsMissed="heartbeats_missed",r.ConsumerNotFound="consumer_not_found",r.StreamNotFound="stream_not_found",r.ConsumerDeleted="consumer_deleted",r.OrderedConsumerRecreated="ordered_consumer_recreated",r.NoResponders="no_responders"})(Bn||(Bn={}));var wr;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(wr||(wr={}));const M0=Uint8Array.of(43,65,67,75),L1=Uint8Array.of(45,78,65,75),Aa=Uint8Array.of(43,87,80,73),H1=Uint8Array.of(43,78,88,84),P1=Uint8Array.of(43,84,69,82,77),$1=Uint8Array.of(32);function Pa(r,n=5e3){return new r_(r,n)}class pf extends _t{constructor(s,a,o=!1){super();v(this,"consumer");v(this,"opts");v(this,"sub");v(this,"monitor");v(this,"pending");v(this,"inbox");v(this,"refilling");v(this,"pong");v(this,"callback");v(this,"timeout");v(this,"cleanupHandler");v(this,"listeners");v(this,"statusIterator");v(this,"forOrderedConsumer");v(this,"resetHandler");v(this,"abortOnMissingResource");v(this,"bind");v(this,"inBackOff");this.consumer=s;const f=a;this.opts=this.parseOptions(a,o),this.callback=f.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=fs(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=f.abort_on_missing_resource===!0,this.bind=f.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:a,idle_heartbeat:o,threshold_bytes:f,threshold_messages:h}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:d}=this;d&&d.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,y)=>{var w,j,q,M;if(g){this.stop(g);return}if((w=this.monitor)==null||w.work(),y.subject===this.inbox){if(Nf(y))return;const D=(j=y.headers)==null?void 0:j.code,W=((M=(q=y.headers)==null?void 0:q.description)==null?void 0:M.toLowerCase())||"unknown",{msgsLeft:se,bytesLeft:ee}=this.parseDiscard(y.headers);if(se>0||ee>0)this.pending.msgs-=se,this.pending.bytes-=ee,this.pending.requests--,this.notify(wr.Discard,{msgsLeft:se,bytesLeft:ee});else if(D===400){this.stop(new ue(W,`${D}`));return}else if(D===409&&W==="consumer deleted"){if(this.notify(Bn.ConsumerDeleted,`${D} ${W}`),!this.refilling||this.abortOnMissingResource){const me=new ue(W,`${D}`);this.stop(me);return}}else if(D===503){if(this.notify(Bn.NoResponders,`${D} No Responders`),!this.refilling||this.abortOnMissingResource){const me=new ue("no responders",`${D}`);this.stop(me);return}}else this.notify(wr.DebugEvent,`${D} ${W}`)}else this._push(Pa(y,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=y.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=h||a&&this.pending.bytes<=f){const D=this.pullOptions();this.pull(D)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new nh(o,g=>(this.notify(Bn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var y;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const E of g)switch(E.type){case us.Disconnect:(y=this.monitor)==null||y.cancel();break;case us.Reconnect:this.resetPending().then(w=>{var j;w&&((j=this.monitor)==null||j.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const a=typeof s=="function"?s:null;try{a?a():this.callback(s)}catch(o){this.stop(o)}}}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,a=0;const o=Wf([this.opts.expires]);let f=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(h){if(h.message==="stream not found"){if(a++,this.notify(Bn.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(h),!1}else if(h.message==="consumer not found"){if(s++,this.notify(Bn.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(h),!1;if(this.forOrderedConsumer)return!1}else s=0,a=0;this.inBackOff=!0;const d=o.backoff(f),g=jr(d);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),f++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const a=this.consumer.api.nc;this._push(()=>{a.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(wr.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,o=nt(this.opts.idle_heartbeat),f=nt(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:o,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Dt.PendingMessagesHdr);o&&(a.msgsLeft=parseInt(o));const f=s==null?void 0:s.get(Dt.PendingBytesHdr);return f&&(a.bytesLeft=parseInt(f)),a}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,a;(s=this.monitor)==null||s.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var a,o;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,a){const f=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||f;const h=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||h}return o}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class Y1 extends _t{constructor(){super();v(this,"src");v(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const o of a)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}stop(s){var a;this.done||((a=this.src)==null||a.stop(s),super.stop(s),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class Bf{constructor(n,s){v(this,"api");v(this,"_info");v(this,"stream");v(this,"name");this.api=n,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new pf(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const s=new pf(this,n,!1),a=Math.round(s.opts.expires*1.05),o=Sr(a);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(n={expires:3e4}){const s=st(),a=n;a.max_messages=1;const o=new pf(this,a,!1),f=Math.round(o.opts.expires*1.05);f>=6e4&&(async()=>{for await(const d of await o.status())if(d.type===Bn.HeartbeatsMissed&&d.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const d of o){s.resolve(d);break}})().catch(()=>{});const h=Sr(f);return o.closed().then(d=>{d?s.reject(d):s.resolve(null)}).catch(d=>{s.reject(d)}).finally(()=>{h.cancel()}),h.catch(d=>{s.resolve(null),o.close().catch()}),o.trackTimeout(h),s}delete(){const{stream_name:n,name:s}=this._info;return this.api.delete(n,s)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:s,name:a}=this._info;return this.api.info(s,a).then(o=>(this._info=o,this._info))}}class G1{constructor(n,s,a={}){v(this,"api");v(this,"consumerOpts");v(this,"consumer");v(this,"opts");v(this,"cursor");v(this,"stream");v(this,"namePrefix");v(this,"serial");v(this,"currentConsumer");v(this,"userCallback");v(this,"iter");v(this,"type");v(this,"startSeq");v(this,"maxInitialReset");this.api=n,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Ks.next(),typeof a.name_prefix=="string"&&(Go("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=bn.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const s=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:s,deliver_policy:ft.StartSequence,opt_start_seq:n,ack_policy:vt.None,inactive_threshold:nt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||ft.StartSequence,(this.consumerOpts.deliver_policy===ft.LastPerSubject||this.consumerOpts.deliver_policy===ft.New||this.consumerOpts.deliver_policy===ft.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===ft.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=ft.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=nt(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var h,d,g,y,E;Ks.next();const s=this.serial===0;(h=this.consumer)==null||h.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const o=Wf([((d=this.opts)==null?void 0:d.expires)||3e4]);let f;for(let w=0;;w++)try{f=await this.api.add(this.stream,a),(g=this.iter)==null||g.notify(Bn.OrderedConsumerRecreated,f.name);break}catch(j){if(j.message==="stream not found"&&((y=this.iter)==null||y.notify(Bn.StreamNotFound,w),this.type===bn.Fetch||this.opts.abort_on_missing_resource===!0))return(E=this.iter)==null||E.stop(j),Promise.reject(j);if(s&&w>=this.maxInitialReset)throw j;await jr(o.backoff(w+1))}return f}internalHandler(n){return s=>{var o;if(this.serial!==n)return;const a=s.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(o=this.iter)==null||o.push(s)}}async reset(n={max_messages:100,expires:3e4},s){var g,y;s=s||{};const a=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===bn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((y=this.iter)==null?void 0:y.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new Y1),this.consumer=new Bf(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let h=null;this.type===bn.Fetch&&a?h=await this.consumer.fetch(n):this.type===bn.Consume&&(h=await this.consumer.consume(n));const d=h;d.forOrderedConsumer=!0,d.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(d)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(wr.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(n={max_messages:100,expires:3e4}){if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===bn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===bn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=bn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var o;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===bn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((o=this.iter)==null?void 0:o.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=bn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const s=n;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const a=st();return s.callback=f=>{this.userCallback=null,a.resolve(f)},(await this.fetch(s)).iterClosed.then(f=>{f&&a.reject(f),a.resolve(null)}).catch(f=>{a.reject(f)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Lf{constructor(n){v(this,"api");v(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(Ue.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new Bf(this.api,n)}async get(n,s={}){return typeof s=="object"?this.ordered(n,s):(await this.checkVersion(),this.api.info(n,s).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Bf(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new ih(a.nc,a.opts).info(n).then(f=>Promise.resolve(new G1(this.api,n,s))).catch(f=>Promise.reject(f))}}class Fo{constructor(n,s){v(this,"api");v(this,"_info");this.api=n,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new Fo(this.api,n)}else return this}info(n=!1,s){return n?Promise.resolve(this._info):this.api.info(this.name,s).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new Lf(new zo(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Lf(new zo(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,s){return this.api.deleteMessage(this.name,n,s)}}class ih extends Ya{constructor(n,s){super(n,s)}checkStreamConfigVersions(n){const s=this.nc;if(n.metadata){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${o}`)}if(n.first_seq){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${o}`)}if(n.subject_transform){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(n.compression){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${o}`)}if(n.consumer_limits){const{min:o,ok:f}=s.features.get(Ue.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function a(o,f){var d;if((((d=f==null?void 0:f.subject_transforms)==null?void 0:d.length)||0)>0){const{min:g,ok:y}=s.features.get(Ue.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!y)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}n.sources&&n.sources.forEach(o=>{a("stream sources",o)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var o;this.checkStreamConfigVersions(n),Mt(n.name),n.mirror=bo(n.mirror),n.sources=(o=n.sources)==null?void 0:o.map(bo);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return Mt(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,s={}){var d;if(typeof n=="object"){const g=n;n=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),Mt(n);const a=await this.info(n),o=Object.assign(a.config,s);o.mirror=bo(o.mirror),o.sources=(d=o.sources)==null?void 0:d.map(bo);const h=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,o);return this._fixInfo(h),h}async info(n,s){Mt(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let f=await this._request(a,s),{total:h,limit:d}=f,g=f.state.subjects?Object.getOwnPropertyNames(f.state.subjects).length:1;if(h&&h>g){const y=[f],E=s||{};let w=0;for(;h>g;){w++,E.offset=d*w;const q=await this._request(a,E);h=q.total,y.push(q);const M=Object.getOwnPropertyNames(q.state.subjects).length;if(g+=M,M<d)break}let j={};for(let q=0;q<y.length;q++)f=y[q],f.state.subjects&&(j=Object.assign(j,f.state.subjects));f.offset=0,f.total=0,f.limit=0,f.state.subjects=j}return this._fixInfo(f),f}list(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>{const h=f;return h.streams.forEach(d=>{this._fixInfo(d)}),h.streams},o=`${this.prefix}.STREAM.LIST`;return new Ca(o,a,this,s)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,s){if(s){const{keep:o,seq:f}=s;if(typeof o=="number"&&typeof f=="number")throw new Error("can specify one of keep or seq")}return Mt(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,s)}async deleteMessage(n,s,a=!0){Mt(n);const o={seq:s};return a||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,o)).success}async getMessage(n,s){Mt(n);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new kg(o)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var g;const f=a.streams.filter(y=>y.config.name.startsWith(Zt));f.forEach(y=>{this._fixInfo(y)});let h="";return f.length&&(h=((g=this.nc.info)==null?void 0:g.cluster)??""),f.map(y=>new Cg(y,h))},s=`${this.prefix}.STREAM.LIST`;return new Ca(s,n,this)}listObjectStores(){const n=a=>{const f=a.streams.filter(d=>d.config.name.startsWith(sh));return f.forEach(d=>{this._fixInfo(d)}),f.map(d=>new Uf(d))},s=`${this.prefix}.STREAM.LIST`;return new Ca(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,o=`${this.prefix}.STREAM.NAMES`;return new Ca(o,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new Fo(this,s))}}class V1 extends Ya{constructor(n,s){super(n,s)}async getMessage(n,s){Mt(n);let a=s;const{last_by_subj:o}=a;o&&(a=null);const f=a?this.jc.encode(a):nn,h=this.opts.apiPrefix||"$JS.API",d=o?`${h}.DIRECT.GET.${n}.${o}`:`${h}.DIRECT.GET.${n}`,g=await this.nc.request(d,f,{timeout:this.timeout}),y=vr(g);if(y)return Promise.reject(y);const E=new Hf(g);return Promise.resolve(E)}async getBatch(n,s){Mt(n);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const f=JSON.stringify(s,(g,y)=>g==="up_to_time"&&y instanceof Date?y.toISOString():y),h=new _t,d=await this.nc.requestMany(o,f,{strategy:Cn.SentinelMsg});return(async()=>{var w,j,q;let g=!1,y=!1,E;for await(const M of d){if(!g){g=!0;const D=((w=M.headers)==null?void 0:w.code)||0;if(D!==0&&D<200||D>299){E=(j=M.headers)==null?void 0:j.description.toLowerCase();break}if(((q=M.headers)==null?void 0:q.get("Nats-Num-Pending"))===""){y=!0;break}}if(M.data.length===0)break;h.push(new Hf(M))}h.push(()=>{if(y)throw new Error("batch direct get not supported by the server");if(E)throw new Error(`bad request: ${E}`);h.stop()})})(),Promise.resolve(h)}}class Hf{constructor(n){v(this,"data");v(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(yr.Subject)}get seq(){const n=this.header.last(yr.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(yr.TimeStamp)}get stream(){return this.header.last(yr.Stream)}json(n){return kn(n).decode(this.data)}string(){return en.decode(this.data)}}v(Hf,"jc");class F1 extends Ya{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new ih(s,a),this.consumers=new zo(s,a),this.direct=new V1(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new _t;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,o)=>{if(a)throw a;try{const f=this.parseJsResponse(o),h=f.type.split("."),d=h[h.length-1];s.push({kind:d,data:f})}catch(f){s.stop(f)}}}),s}}class kg{constructor(n){v(this,"_header");v(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):nn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Qs.decode(n)}else this._header=hs();return this._header}_parse(n){const s=atob(n),a=s.length,o=new Uint8Array(a);for(let f=0;f<a;f++)o[f]=s.charCodeAt(f);return o}json(n){return kn(n).decode(this.data)}string(){return en.decode(this.data)}}v(kg,"jc");class J1{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new Fo(this.api,s))}}class gf{constructor(n){v(this,"info");v(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Qs.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,s;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function R0(r){const n={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const s=r.headers;n.headers=s.toRecord()}return n}function Q1(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class qa{constructor(n,s,a){v(this,"jsm");v(this,"js");v(this,"stream");v(this,"name");this.name=n,this.jsm=s,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const s=await this.rawInfo(n);return s?new gf(s):null}async list(){const n=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of s){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:s,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const o=this._metaSubject(s);try{const f=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),d=kn().decode(f.data);return d.revision=f.seq,d}catch(f){return f.code==="404"?null:Promise.reject(f)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new Uf(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Uf(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,s,a){var re;const o=this.js.getOptions();a=a||{timeout:o.timeout},a.timeout=a.timeout||o.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:f,previousRevision:h}=a,d=this.js.nc.info,g=(d==null?void 0:d.max_payload)||1024;n=n||{},n.options=n.options||{};let y=((re=n.options)==null?void 0:re.max_chunk_size)||128*1024;y=y>g?g:y,n.options.max_chunk_size=y;const E=await this.info(n.name),{name:w,error:j}=this._checkNotEmpty(n.name);if(j)return Promise.reject(j);const q=Ks.next(),M=this._chunkSubject(q),D=this._metaSubject(w),W=Object.assign({bucket:this.name,nuid:q,size:0,chunks:0},R0(n)),se=st(),ee=[],me=new Ar;try{const C=s?s.getReader():null,X=w0.create();for(;;){const{done:ce,value:V}=C?await C.read():{done:!0,value:void 0};if(ce){if(me.size()>0){const ne=me.drain();X.update(ne),W.chunks++,W.size+=ne.length,ee.push(this.js.publish(M,ne,{timeout:f}))}await Promise.all(ee),ee.length=0,W.mtime=new Date().toISOString();const G=_r.encode(X.digest());W.digest=`${k0}${G}`,W.deleted=!1;const K=hs();typeof h=="number"&&K.set(Un.ExpectedLastSubjectSequenceHdr,`${h}`),K.set(Dt.RollupHdr,Dt.RollupValueSubject);const ae=await this.js.publish(D,kn().encode(W),{headers:K,timeout:f});if(W.revision=ae.seq,E)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${E.nuid}`})}catch{}se.resolve(new gf(W));break}if(V)for(me.fill(V);me.size()>y;){W.chunks++,W.size+=y;const G=me.drain(n.options.max_chunk_size);X.update(G),ee.push(this.js.publish(M,G,{timeout:f}))}}}catch(C){await this.jsm.streams.purge(this.stream,{filter:M}),se.reject(C)}return se}putBlob(n,s,a){function o(f){return new ReadableStream({pull(h){h.enqueue(f),h.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,o(s),a)}put(n,s,a){var o;return(o=n==null?void 0:n.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,s,a)}async getBlob(n){async function s(f){const h=new Ar,d=f.getReader();for(;;){const{done:g,value:y}=await d.read();if(g)return h.drain();y&&y.length&&h.fill(y)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const o=await Promise.all([a.error,s(a.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const w=s.options.link.name||"";if(w==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await qa.create(this.js,s.options.link.bucket):this).get(w)}if(!s.digest.startsWith(k0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=Mf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=st(),f={info:new gf(s),error:o};if(s.size===0)return f.data=Q1(),o.resolve(null),Promise.resolve(f);let h;const d=Is();d.orderedConsumer();const g=w0.create(),y=`$O.${this.name}.C.${s.nuid}`,E=await this.js.subscribe(y,d);return(async()=>{for await(const w of E)w.data.length>0&&(g.update(w.data),h.enqueue(w.data)),w.info.pending===0&&(qv(a,g.digest())?h.close():h.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),E.unsubscribe())})().then(()=>{o.resolve()}).catch(w=>{h.error(w),o.reject(w)}),f.data=new ReadableStream({start(w){h=w},cancel(){E.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof qa))return Promise.reject("bucket required");const a=s,{name:o,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const h={name:o,options:{link:{bucket:a.name}}};return this._put(h,null)}async link(n,s){const{name:a,error:o}=this._checkNotEmpty(n);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const f=await this.rawInfo(n);if(f!==null&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"));const h={bucket:s.bucket,name:s.name},d={name:a,bucket:s.bucket,options:{link:h}};await this.js.publish(this._metaSubject(n),JSON.stringify(d));const g=await this.info(n);return Promise.resolve(g)}async delete(n){const s=await this.rawInfo(n);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const a=kn(),o=hs();return o.set(Dt.RollupHdr,Dt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),a.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(n,s={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??a.name;const{name:o,error:f}=this._checkNotEmpty(s.name);if(f)return Promise.reject(f);if(n!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const h=Object.assign({},a,R0(s)),d=await this.js.publish(this._metaSubject(h.name),JSON.stringify(h));return n!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(d)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let s=!1;const a=new _t,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(a.push(null),s=!0):a.stop(g)}const f=kn(),h=Is();h.orderedConsumer(),n.includeHistory?h.deliverLastPerSubject():(s=!0,h.deliverNew()),h.callback((g,y)=>{var E;if(g){a.stop(g);return}if(y!==null){const w=f.decode(y.data);w.deleted&&n.ignoreDeletes===!0||a.push(w),((E=y.info)==null?void 0:E.pending)===0&&!s&&(s=!0,a.push(null))}});const d=await this.js.subscribe(o,h);return a._data=d,a.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${_r.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=U1(this.name)}catch(o){return Promise.reject(o)}const s=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:s},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=Ba.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);try{await this.jsm.streams.info(a.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,s,a={}){const o=await n.jetstreamManager(),f=new qa(s,o,n);return await f.init(a),Promise.resolve(f)}}class I1{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:o,min:f}=a.nc.features.get(Ue.JS_KV);return o?s.bindOnly?Ha.bind(this.js,n,s):Ha.create(this.js,n,s):Promise.reject(new Error(`kv is only supported on servers ${f} or better`))}os(n,s={}){var h;if(typeof((h=crypto==null?void 0:crypto.subtle)==null?void 0:h.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:o,min:f}=a.nc.features.get(Ue.JS_OBJECTSTORE);return o?qa.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class rh extends Ya{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new zo(s,a),this.streamAPI=new ih(s,a),this.consumers=new Lf(this.consumerAPI),this.streams=new J1(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new I1(this)}async publish(s,a=nn,o){o=o||{},o.expect=o.expect||{};const f=(o==null?void 0:o.headers)||hs();o&&(o.msgID&&f.set(Un.MsgIdHdr,o.msgID),o.expect.lastMsgID&&f.set(Un.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&f.set(Un.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&f.set(Un.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&f.set(Un.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const h=o.timeout||this.timeout,d={};h&&(d.timeout=h),o&&(d.headers=f);let{retries:g,retry_delay:y}=o;g=g||1,y=y||250;let E;for(let j=0;j<g;j++)try{E=await this.nc.request(s,a,d);break}catch(q){if(q.code==="503"&&j+1<g)await jr(y);else throw q}const w=this.parseJsResponse(E);if(w.stream==="")throw ue.errorForCode(ie.JetStreamInvalidAck);return w.duplicate=w.duplicate?w.duplicate:!1,w}async pull(s,a,o=0){Mt(s),xr(a);let f=this.timeout;o>f&&(f=o),o=o<0?0:nt(o);const h={batch:1,no_wait:o===0,expires:o},d=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(h),{noMux:!0,timeout:f}),g=vr(d);if(g)throw g;return Pa(d,this.timeout)}fetch(s,a,o={}){Mt(s),xr(a);let f=null;const h=(o.max_bytes??0)>0;let d=0;const g=h?o.max_bytes:0;let y=null;const E={};if(E.batch=o.batch||1,g){const ee=this.nc.features.get(Ue.JS_PULL_MAX_BYTES);if(!ee.ok)throw new Error(`max_bytes is only supported on servers ${ee.min} or better`);E.max_bytes=g}E.no_wait=o.no_wait||!1,E.no_wait&&E.expires&&(E.expires=0);const w=o.expires||0;if(w&&(E.expires=nt(w)),w===0&&E.no_wait===!1)throw new Error("expires or no_wait is required");const j=o.idle_heartbeat||0;j&&(E.idle_heartbeat=nt(j),o.delay_heartbeat===!0&&(E.idle_heartbeat=nt(j*4)));const q=new _t,M=E.batch;let D=0;q.protocolFilterFn=(ee,me=!1)=>Nf(ee.msg)?(y==null||y.work(),!1):!0,q.dispatchedFn=ee=>{if(ee){if(h&&(d+=ee.data.length),D++,f&&ee.info.pending===0)return;(q.getPending()===1&&ee.info.pending===0||M===D||g>0&&d>=g)&&q.stop()}};const W=fs(this.nc.options.inboxPrefix),se=this.nc.subscribe(W,{max:o.batch,callback:(ee,me)=>{ee===null&&(ee=vr(me)),ee!==null?(f&&(f.cancel(),f=null),yv(ee)?q.stop(Rg(ee)===null?void 0:ee):q.stop(ee)):(y==null||y.work(),q.received++,q.push(Pa(me,this.timeout)))}});return w&&(f=Sr(w),f.catch(()=>{se.isClosed()||(se.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{j&&(y=new nh(j,ee=>(q.push(()=>{q.err=new ue(`${xn.IdleHeartbeatMissed}: ${ee}`,ie.JetStreamIdleHeartBeat)}),!0)))}catch{}await se.closed,f!==null&&(f.cancel(),f=null),y&&y.cancel(),q.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(E),{reply:W}),q}async pullSubscribe(s,a=Is()){const o=await this._processOptions(s,a);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=o.config.ack_policy;if(f===vt.None||f===vt.All)throw new Error("ack policy for pull consumers must be explicit");const h=this._buildTypedSubscriptionOpts(o),d=new W1(this,o.deliver,h);d.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw d.unsubscribe(),g}return d}async subscribe(s,a=Is()){const o=await this._processOptions(s,a);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(o),h=new Mg(this,o.deliver,f);h.info=o;try{await this._maybeCreateConsumer(o)}catch(d){throw h.unsubscribe(),d}return h._maybeSetupHbMonitoring(),h}async _processOptions(s,a=Is()){const o=b0(a)?a.getOpts():a;if(o.isBind=b0(a)?a.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==vt.NotSet&&o.config.ack_policy!==vt.None)throw new ue("ordered consumer: ack_policy can only be set to 'none'",ie.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new ue("ordered consumer: durable_name cannot be set",ie.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new ue("ordered consumer: deliver_subject cannot be set",ie.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new ue("ordered consumer: max_deliver cannot be set",ie.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new ue("ordered consumer: deliver_group cannot be set",ie.ApiError);o.config.deliver_subject=fs(this.nc.options.inboxPrefix),o.config.ack_policy=vt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||nt(5e3),o.config.ack_wait=nt(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===vt.NotSet&&(o.config.ack_policy=vt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const f=await this.consumerAPI.info(o.stream,o.config.durable_name);if(f){if(f.config.filter_subject&&f.config.filter_subject!==s)throw new Error("subject does not match consumer");const h=o.config.deliver_group??"";if(h===""&&f.push_bound===!0)throw new Error("duplicate subscription");const d=f.config.deliver_group??"";if(h!==d)throw d===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${d}'`);o.last=f,o.config=f.config,o.attached=!0,o.config.durable_name||(o.name=f.name)}}catch(f){if(f.code!=="404")throw f}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||fs(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=e_(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=rh.ingestionFn(s.ordered),a.protocolFilterFn=(o,f=!1)=>{const h=o;return Tf(h.msg)?(f||h.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==vt.None&&(a.dispatchedFn=s_),s.callbackFn&&(a.callback=s.callbackFn),a.max=s.max||0,a.queue=s.queue,a}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Er.Instant},s.config);const a=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=a.name,s.config=a.config,s.last=a}static ingestionFn(s){return(a,o)=>{var g;const f=o;if(!a)return{ingest:!1,protocol:!1};const h=a;if(vr(h.msg)||(g=f.monitor)==null||g.work(),Nf(h.msg)){const y=s?f._checkHbOrderConsumer(h.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:y,protocol:!0}}else if(Tf(h.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class ah{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=b1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const o=new ah(n);Uo.connect(o.options,o).then(f=>{o.protocol=f,(async function(){for await(const h of f.status())o.listeners.forEach(d=>{d.push(h)})})(),s(o)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw ue.errorForCode(ie.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw ue.errorForCode(ie.ConnectionDraining);if(n=n||"",n.length===0)throw ue.errorForCode(ie.BadSubject)}publish(n,s,a){this._check(n,!1,!0),this.protocol.publish(n,s,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,s={}){this._check(n,!0,!1);const a=new Tg(this.protocol,n,s);return this.protocol.subscribe(a),a}_resub(n,s,a){this._check(s,!0,!1);const o=n;o.max=a,a&&(o.max=a+o.received),this.protocol.resub(o,s)}requestMany(n,s=nn,a={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(g){return Promise.reject(g)}if(a.strategy=a.strategy||Cn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new ue("timeout",ie.InvalidOption));const f=new _t;function h(g){f.push(()=>{f.stop(g)})}function d(g,y){g||y===null?h(g===null?void 0:g):f.push(y)}if(a.noMux){const g=o?new Error().stack:null;let y=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const E=this.subscribe(fs(this.options.inboxPrefix),{callback:(M,D)=>{var W,se;if(((W=D==null?void 0:D.data)==null?void 0:W.length)===0&&((se=D==null?void 0:D.headers)==null?void 0:se.status)===ie.NoResponders&&(M=ue.errorForCode(ie.NoResponders)),M){g&&(M.stack+=`
|
|
47
|
+
`),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=st()),this.pongs.push(n),this.outbound.fill(N0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(s=>{const a=s;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${Eo}`):n.push(`SUB ${a.subject} ${a.sid}${Eo}`)}),n.length&&this.transport.send(Ra(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),s=[];return n.forEach(a=>{s.push(a.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),a=new Ng(this,`${s}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const S1="$SRV";class C0{constructor(n){v(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,s){return this.msg.respond(n,s)}respondError(n,s,a,o){var f,h;return o=o||{},o.headers=o.headers||hs(),(f=o.headers)==null||f.set(Mo,`${n}`),(h=o.headers)==null||h.set(ko,s),this.msg.respond(a,o)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class La{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&A1("service group",s);let o="";if(n instanceof Ga)this.srv=n,o="";else if(n instanceof La){const f=n;this.srv=f.srv,a===""&&f.queue!==""&&(a=f.queue),o=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=a}calcSubject(n,s=""){return s===""?n:n!==""?`${n}.${s}`:s}addEndpoint(n="",s){s=s||{subject:n};const a=typeof s=="function"?{handler:s,subject:n}:s;Ca("endpoint",n);let{subject:o,handler:f,metadata:h,queue:m}=a;o=o||n,m=m||this.queue,E1("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:n,subject:o,queue:m,handler:f,metadata:h};return this.srv._addEndpoint(g)}addGroup(n="",s=""){return new La(this,n,s)}}function E1(r,n){if(n==="")throw new Error(`${r} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);const s=n.split(".");s.forEach((a,o)=>{if(a===">"&&o!==s.length-1)throw new Error(`${r} cannot have internal '>': '${n}'`)})}function A1(r,n){if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${r} name cannot contain internal '>': '${n}'`)})}class Ga{constructor(n,s={name:"",version:""}){v(this,"nc");v(this,"_id");v(this,"config");v(this,"handlers");v(this,"internal");v(this,"_stopped");v(this,"_done");v(this,"started");this.nc=n,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),Ca("name",this.config.name),Ca("queue",this.config.queue),Ai(this.config.version),this._id=Ks.next(),this.internal=[],this._done=st(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,s="",a="",o){const f=o??S1;return s===""&&a===""?`${f}.${n}`:(Ca("control subject name",s),a!==""?(Ca("control subject id",a),`${f}.${n}.${s}.${a}`):`${f}.${n}.${s}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const s=hs();if(n instanceof Ro){const a=n;s.set(ko,a.message),s.set(Mo,`${a.code}`)}else s.set(ko,n.message),s.set(Mo,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:o,subject:f,handler:h}=n,m=n;m.internal=s,s&&this.internal.push(m),m.stats=new j1(o,f,a),m.queue=a;const g=h?(y,E)=>{if(y){this.close(y);return}const w=Date.now();try{h(y,new C0(E))}catch(O){m.stats.countError(O),E==null||E.respond(nn,{headers:this.errorToHeader(O)})}finally{m.stats.countLatency(w)}}:void 0;return m.sub=this.nc.subscribe(f,{callback:g,queue:a}),m.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(y=>{if(!this._stopped){const E=new Error(`required subscription ${n.subject} errored: ${y.message}`);E.stack=y.stack,this.close(E).catch()}}),m}info(){return{type:Da.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:s,metadata:a,name:o,queue:f}=n;return{subject:s,metadata:a,name:o,queue_group:f}})}async stats(){const n=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(a){s.stats.countError(a)}n.push(s.stats.stats(s.qi))}return{type:Da.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,s){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,s),this._doAddInternalHandler(`${a}-kind`,n,s,this.name),this._doAddInternalHandler(`${a}`,n,s,this.name,this.id)}_doAddInternalHandler(n,s,a,o="",f=""){const h={};h.name=n,h.subject=Ga.controlSubject(s,o,f),h.handler=a,this.setupHandler(h,!0)}start(){const n=kn(),s=(h,m)=>h?(this.close(h),Promise.reject(h)):this.stats().then(g=>(m==null||m.respond(n.encode(g)),Promise.resolve())),a=(h,m)=>h?(this.close(h),Promise.reject(h)):(m==null||m.respond(n.encode(this.info())),Promise.resolve()),o=n.encode(this.ping()),f=(h,m)=>h?(this.close(h).then().catch(),Promise.reject(h)):(m.respond(o),Promise.resolve());return this.addInternalHandler(Js.PING,f),this.addInternalHandler(Js.STATS,s),this.addInternalHandler(Js.INFO,a),this.handlers.forEach(h=>{const{subject:m}=h;typeof m=="string"&&h.handler!==null&&this.setupHandler(h)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:Da.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,s){return new La(this,n,s)}addEndpoint(n,s){return new La(this).addEndpoint(n,s)}_addEndpoint(n){const s=new _t;s.noIterator=typeof n.handler=="function",s.noIterator||(n.handler=(o,f)=>{o?this.stop(o).catch():s.push(new C0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class j1{constructor(n,s,a=""){v(this,"name");v(this,"subject");v(this,"average_processing_time");v(this,"num_requests");v(this,"processing_time");v(this,"num_errors");v(this,"last_error");v(this,"data");v(this,"metadata");v(this,"queue");this.name=n,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=n;s&&(s.time=0,s.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=nt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:m,data:g,queue:y}=this;return{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:m,data:g,queue_group:y}}stats(n){const s=n;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=nt(s.time),this.num_requests=s.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class O1{constructor(n,s={strategy:Cn.JitterTimer,maxWait:2e3},a){v(this,"nc");v(this,"prefix");v(this,"opts");this.nc=n,this.prefix=a,this.opts=s}ping(n="",s=""){return this.q(Js.PING,n,s)}stats(n="",s=""){return this.q(Js.STATS,n,s)}info(n="",s=""){return this.q(Js.INFO,n,s)}async q(n,s="",a=""){const o=new _t,f=kn(),h=Ga.controlSubject(n,s,a,this.prefix),m=await this.nc.requestMany(h,nn,this.opts);return(async()=>{for await(const g of m)try{const y=f.decode(g.data);o.push(y)}catch(y){o.push(()=>{o.stop(y)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function Cg(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function T1(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Cg(),storage:Mf.File}}const Bo="KV-Operation",k0="$KV",N1=/^[-/=.\w]+$/,C1=/^[-/=.>*\w]+$/,k1=/^[-\w]+$/;function M1(r){if(r.startsWith(".")||r.endsWith(".")||!N1.test(r))throw new Error(`invalid key: ${r}`)}function R1(r){if(r.startsWith(".")||r.endsWith(".")||!C1.test(r))throw new Error(`invalid key: ${r}`)}function D1(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const n=r.split(".");let s=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":s=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${r}`);s=!0;break}return s}function Ao(r){if(!k1.test(r))throw new Error(`invalid bucket name: ${r}`)}var Bn;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(Bn||(Bn={}));class Ha{constructor(n,s,a){v(this,"js");v(this,"jsm");v(this,"stream");v(this,"bucket");v(this,"direct");v(this,"codec");v(this,"prefix");v(this,"editPrefix");v(this,"useJsPrefix");v(this,"_prefixLen");v(this,"validateKey",M1);v(this,"validateSearchKey",R1);v(this,"hasWildcards",D1);Ao(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=k0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){Ao(s);const o=await n.jetstreamManager(),f=new Ha(s,n,o);return await f.init(a),f}static async bind(n,s,a={}){const o=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};Ao(s);const h=new Ha(s,n,o);return f.config.name=a.streamName??h.bucketName(),Object.assign(h,f),h.stream=f.config.name,h.codec=a.codec||Cg(),h.direct=f.config.allow_direct??!1,h.initializePrefixes(f),h}async init(n={}){const s=Object.assign(T1(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=kf.Limits,a.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(a.max_bytes=s.max_bytes),a.max_msg_size=s.maxValueSize,a.storage=s.storage;const o=n.placementCluster??"";if(o&&(n.placement={},n.placement.cluster=o,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const w=Object.assign({},n.mirror);w.name.startsWith(Zt)||(w.name=`${Zt}${w.name}`),a.mirror=w,a.mirror_direct=!0}else if(n.sources){const w=n.sources.map(O=>{const q=Object.assign({},O),M=q.name.startsWith(Zt)?q.name.substring(Zt.length):q.name;return q.name.startsWith(Zt)||(q.name=`${Zt}${q.name}`),!O.external&&M!==this.bucket&&(q.subject_transforms=[{src:`$KV.${M}.>`,dest:`$KV.${this.bucket}.>`}]),q});a.sources=w,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);const f=this.js.nc,h=f.getServerVersion(),m=h?Df(h,Ai("2.7.2"))>=0:!1;a.discard=m?Ba.New:Ba.Old;const{ok:g,min:y}=f.features.get(Ue.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const w=h?`${h.major}.${h.minor}.${h.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${w} - requires ${y}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:g,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=nt(s.ttl)),a.allow_rollup_hdrs=!0;let E;try{E=await this.jsm.streams.info(a.name),!E.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(w){if(w.message==="stream not found")E=await this.jsm.streams.add(a);else throw w}this.initializePrefixes(E)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=n.config;if(s){let a=s.name;if(a.startsWith(Zt)&&(a=a.substring(Zt.length)),s.external&&s.external.api!==""){const o=s.name.substring(Zt.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Zt}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,s=!1){const a=[];return s?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${k0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.encode(a));break}return s.join(".")}decodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.decode(a));break}return s.join(".")}close(){return Promise.resolve()}dataLen(n,s){const a=s&&s.get(Dt.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new Q1(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new X1(this.bucket,s,n)}async create(n,s){var f;let a;try{const h=await this.put(n,s,{previousSeq:0});return Promise.resolve(h)}catch(h){if(a=h,((f=h==null?void 0:h.api_error)==null?void 0:f.err_code)!==10071)return Promise.reject(h)}let o=0;try{const h=await this.get(n);return(h==null?void 0:h.operation)==="DEL"||(h==null?void 0:h.operation)==="PURGE"?(o=h!==null?h.revision:0,this.update(n,s,o)):Promise.reject(a)}catch(h){return Promise.reject(h)}}update(n,s,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,s,{previousSeq:a})}async put(n,s,a={}){var h,m;const o=this.encodeKey(n);this.validateKey(o);const f={};if(a.previousSeq!==void 0){const g=hs();f.headers=g,g.set(Bn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,f)).seq}catch(g){const y=g;return y.isJetStreamError()?(y.message=(h=y.api_error)==null?void 0:h.description,y.code=`${(m=y.api_error)==null?void 0:m.code}`,Promise.reject(y)):Promise.reject(g)}}async get(n,s){const a=this.encodeKey(n);this.validateKey(a);let o={last_by_subj:this.subjectForKey(a)};s&&s.revision>0&&(o={seq:s.revision});let f;try{this.direct?f=await this.jsm.direct.getMessage(this.bucketName(),o):f=await this.jsm.streams.getMessage(this.bucketName(),o);const h=this.smToEntry(f);return h.key!==a?null:h}catch(h){if(h.code===ie.JetStream404NoMessages)return null;throw h}}purge(n,s){return this._deleteOrPurge(n,"PURGE",s)}delete(n,s){return this._deleteOrPurge(n,"DEL",s)}async purgeDeletes(n=1800*1e3){const s=st(),a=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&a.push(g)})().then(),await s,o.stop();const f=Date.now()-n,h=a.map(g=>{const y=this.subjectForKey(g.key);return g.created.getTime()>=f?this.jsm.streams.purge(this.stream,{filter:y,keep:1}):this.jsm.streams.purge(this.stream,{filter:y,keep:0})}),m=await Promise.all(h);return m.unshift({success:!0,purged:0}),m.reduce((g,y)=>(g.purged+=y.purged,g))}async _deleteOrPurge(n,s,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,s,a);const o=await this.keys(n),f=[];for await(const h of o)f.push(this._doDeleteOrPurge(h,s)),f.length===100&&(await Promise.all(f),f.length=0);f.length>0&&await Promise.all(f)}async _doDeleteOrPurge(n,s,a){const o=this.encodeKey(n);this.validateKey(o);const f=hs();f.set(Bo,s),s==="PURGE"&&f.set(Dt.RollupHdr,Dt.RollupValueSubject),a!=null&&a.previousSeq&&f.set(Bn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),nn,{headers:f})}_buildCC(n,s,a={}){let f=(Array.isArray(n)?n:[n]).map(g=>{const y=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(y)}),h=ft.LastPerSubject;s===Tn.AllHistory&&(h=ft.All),s===Tn.UpdatesOnly&&(h=ft.New);let m;return f.length===1&&(m=f[0],f=void 0),Object.assign({deliver_policy:h,ack_policy:vt.None,filter_subjects:f,filter_subject:m,flow_control:!0,idle_heartbeat:nt(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f;f=()=>{a.stop()};let h=0;const m=this._buildCC(s,Tn.AllHistory,o),g=m.filter_subject,y=Qs(m);y.bindStream(this.stream),y.orderedConsumer(),y.callback((w,O)=>{if(w){a.stop(w);return}if(O){const q=this.jmToEntry(O);a.push(q),a.received++,(f&&h>0&&a.received>=h||O.info.pending===0)&&(a.push(f),f=void 0)}});const E=await this.js.subscribe(g,y);if(f){const{info:{last:w}}=E,O=w.num_pending+w.delivered.consumer_seq;if(O===0||a.received>=O)try{f()}catch(q){a.stop(q)}finally{f=void 0}else h=O}return a._data=E,a.iterClosed.then(()=>{E.unsubscribe()}),E.closed.then(()=>{a.stop()}).catch(w=>{a.stop(w)}),a}canSetWatcherName(){const s=this.js.nc,{ok:a}=s.features.get(Ue.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f=Tn.LastValue;n.include===Tn.AllHistory?f=Tn.AllHistory:n.include===Tn.UpdatesOnly&&(f=Tn.UpdatesOnly);const h=n.ignoreDeletes===!0;let m=n.initializedFn,g=0;const y=this._buildCC(s,f,o),E=y.filter_subject,w=Qs(y);this.canSetWatcherName()&&w.consumerName(Ks.next()),w.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&w.startSequence(n.resumeFromRevision),w.orderedConsumer(),w.callback((q,M)=>{if(q){a.stop(q);return}if(M){const D=this.jmToEntry(M);if(h&&D.operation==="DEL")return;a.push(D),a.received++,m&&(g>0&&a.received>=g||M.info.pending===0)&&(a.push(m),m=void 0)}});const O=await this.js.subscribe(E,w);if(m){const{info:{last:q}}=O,M=q.num_pending+q.delivered.consumer_seq;if(M===0||a.received>=M)try{m()}catch(D){a.stop(D)}finally{m=void 0}else g=M}return a._data=O,a.iterClosed.then(()=>{O.unsubscribe()}),O.closed.then(()=>{a.stop()}).catch(q=>{a.stop(q)}),a}async keys(n=">"){const s=new _t,a=this._buildCC(n,Tn.LastValue,{headers_only:!0}),o=Array.isArray(n)?">":a.filter_subject,f=Qs(a);f.bindStream(this.stream),f.orderedConsumer();const h=await this.js.subscribe(o,f);return(async()=>{var g;for await(const y of h){const E=(g=y.headers)==null?void 0:g.get(Bo);if(E!=="DEL"&&E!=="PURGE"){const w=this.decodeKey(y.subject.substring(this.prefixLen));s.push(w)}y.info.pending===0&&h.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),h.info.last.num_pending===0&&h.unsubscribe(),s}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),o=await this.jsm.streams.info(a);return new kg(o,s)}}class kg{constructor(n,s=""){v(this,"si");v(this,"cluster");this.si=n,this.cluster=s}get bucket(){return this.si.config.name.startsWith(Zt)?this.si.config.name.substring(Zt.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return th(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Zs.None:!1}}const ih="OBJ_",M0="SHA-256=";function z1(r){return Ao(r),`${ih}${r}`}function q1(r){return r.startsWith(ih)?r.substring(4):r}class Bf{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return q1(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==Zs.None:!1}}function bo(r){if(r===void 0)return;const{domain:n}=r;if(n===void 0)return r;const s=Object.assign({},r);if(delete s.domain,n==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${n}.API`},s}var bn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(bn||(bn={}));var Ln;(function(r){r.HeartbeatsMissed="heartbeats_missed",r.ConsumerNotFound="consumer_not_found",r.StreamNotFound="stream_not_found",r.ConsumerDeleted="consumer_deleted",r.OrderedConsumerRecreated="ordered_consumer_recreated",r.NoResponders="no_responders"})(Ln||(Ln={}));var Er;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(Er||(Er={}));const R0=Uint8Array.of(43,65,67,75),U1=Uint8Array.of(45,78,65,75),ja=Uint8Array.of(43,87,80,73),B1=Uint8Array.of(43,78,88,84),L1=Uint8Array.of(43,84,69,82,77),H1=Uint8Array.of(32);function Pa(r,n=5e3){return new s_(r,n)}class gf extends _t{constructor(s,a,o=!1){super();v(this,"consumer");v(this,"opts");v(this,"sub");v(this,"monitor");v(this,"pending");v(this,"inbox");v(this,"refilling");v(this,"pong");v(this,"callback");v(this,"timeout");v(this,"cleanupHandler");v(this,"listeners");v(this,"statusIterator");v(this,"forOrderedConsumer");v(this,"resetHandler");v(this,"abortOnMissingResource");v(this,"bind");v(this,"inBackOff");this.consumer=s;const f=a;this.opts=this.parseOptions(a,o),this.callback=f.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=fs(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=f.abort_on_missing_resource===!0,this.bind=f.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:a,idle_heartbeat:o,threshold_bytes:f,threshold_messages:h}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:m}=this;m&&m.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,y)=>{var w,O,q,M;if(g){this.stop(g);return}if((w=this.monitor)==null||w.work(),y.subject===this.inbox){if(Cf(y))return;const D=(O=y.headers)==null?void 0:O.code,W=((M=(q=y.headers)==null?void 0:q.description)==null?void 0:M.toLowerCase())||"unknown",{msgsLeft:se,bytesLeft:ee}=this.parseDiscard(y.headers);if(se>0||ee>0)this.pending.msgs-=se,this.pending.bytes-=ee,this.pending.requests--,this.notify(Er.Discard,{msgsLeft:se,bytesLeft:ee});else if(D===400){this.stop(new ue(W,`${D}`));return}else if(D===409&&W==="consumer deleted"){if(this.notify(Ln.ConsumerDeleted,`${D} ${W}`),!this.refilling||this.abortOnMissingResource){const me=new ue(W,`${D}`);this.stop(me);return}}else if(D===503){if(this.notify(Ln.NoResponders,`${D} No Responders`),!this.refilling||this.abortOnMissingResource){const me=new ue("no responders",`${D}`);this.stop(me);return}}else this.notify(Er.DebugEvent,`${D} ${W}`)}else this._push(Pa(y,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=y.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=h||a&&this.pending.bytes<=f){const D=this.pullOptions();this.pull(D)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new sh(o,g=>(this.notify(Ln.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var y;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const E of g)switch(E.type){case us.Disconnect:(y=this.monitor)==null||y.cancel();break;case us.Reconnect:this.resetPending().then(w=>{var O;w&&((O=this.monitor)==null||O.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const a=typeof s=="function"?s:null;try{a?a():this.callback(s)}catch(o){this.stop(o)}}}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,a=0;const o=eh([this.opts.expires]);let f=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(h){if(h.message==="stream not found"){if(a++,this.notify(Ln.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(h),!1}else if(h.message==="consumer not found"){if(s++,this.notify(Ln.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(h),!1;if(this.forOrderedConsumer)return!1}else s=0,a=0;this.inBackOff=!0;const m=o.backoff(f),g=Tr(m);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),f++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const a=this.consumer.api.nc;this._push(()=>{a.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(Er.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,o=nt(this.opts.idle_heartbeat),f=nt(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:o,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Dt.PendingMessagesHdr);o&&(a.msgsLeft=parseInt(o));const f=s==null?void 0:s.get(Dt.PendingBytesHdr);return f&&(a.bytesLeft=parseInt(f)),a}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,a;(s=this.monitor)==null||s.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var a,o;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,a){const f=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||f;const h=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||h}return o}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class P1 extends _t{constructor(){super();v(this,"src");v(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const o of a)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}stop(s){var a;this.done||((a=this.src)==null||a.stop(s),super.stop(s),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class Lf{constructor(n,s){v(this,"api");v(this,"_info");v(this,"stream");v(this,"name");this.api=n,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new gf(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const s=new gf(this,n,!1),a=Math.round(s.opts.expires*1.05),o=Ar(a);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(n={expires:3e4}){const s=st(),a=n;a.max_messages=1;const o=new gf(this,a,!1),f=Math.round(o.opts.expires*1.05);f>=6e4&&(async()=>{for await(const m of await o.status())if(m.type===Ln.HeartbeatsMissed&&m.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const m of o){s.resolve(m);break}})().catch(()=>{});const h=Ar(f);return o.closed().then(m=>{m?s.reject(m):s.resolve(null)}).catch(m=>{s.reject(m)}).finally(()=>{h.cancel()}),h.catch(m=>{s.resolve(null),o.close().catch()}),o.trackTimeout(h),s}delete(){const{stream_name:n,name:s}=this._info;return this.api.delete(n,s)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:s,name:a}=this._info;return this.api.info(s,a).then(o=>(this._info=o,this._info))}}class $1{constructor(n,s,a={}){v(this,"api");v(this,"consumerOpts");v(this,"consumer");v(this,"opts");v(this,"cursor");v(this,"stream");v(this,"namePrefix");v(this,"serial");v(this,"currentConsumer");v(this,"userCallback");v(this,"iter");v(this,"type");v(this,"startSeq");v(this,"maxInitialReset");this.api=n,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Ks.next(),typeof a.name_prefix=="string"&&(Go("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=bn.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const s=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:s,deliver_policy:ft.StartSequence,opt_start_seq:n,ack_policy:vt.None,inactive_threshold:nt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||ft.StartSequence,(this.consumerOpts.deliver_policy===ft.LastPerSubject||this.consumerOpts.deliver_policy===ft.New||this.consumerOpts.deliver_policy===ft.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===ft.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=ft.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=nt(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var h,m,g,y,E;Ks.next();const s=this.serial===0;(h=this.consumer)==null||h.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const o=eh([((m=this.opts)==null?void 0:m.expires)||3e4]);let f;for(let w=0;;w++)try{f=await this.api.add(this.stream,a),(g=this.iter)==null||g.notify(Ln.OrderedConsumerRecreated,f.name);break}catch(O){if(O.message==="stream not found"&&((y=this.iter)==null||y.notify(Ln.StreamNotFound,w),this.type===bn.Fetch||this.opts.abort_on_missing_resource===!0))return(E=this.iter)==null||E.stop(O),Promise.reject(O);if(s&&w>=this.maxInitialReset)throw O;await Tr(o.backoff(w+1))}return f}internalHandler(n){return s=>{var o;if(this.serial!==n)return;const a=s.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(o=this.iter)==null||o.push(s)}}async reset(n={max_messages:100,expires:3e4},s){var g,y;s=s||{};const a=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===bn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((y=this.iter)==null?void 0:y.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new P1),this.consumer=new Lf(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let h=null;this.type===bn.Fetch&&a?h=await this.consumer.fetch(n):this.type===bn.Consume&&(h=await this.consumer.consume(n));const m=h;m.forOrderedConsumer=!0,m.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(m)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(Er.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(n={max_messages:100,expires:3e4}){if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===bn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===bn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=bn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var o;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===bn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((o=this.iter)==null?void 0:o.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=bn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const s=n;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const a=st();return s.callback=f=>{this.userCallback=null,a.resolve(f)},(await this.fetch(s)).iterClosed.then(f=>{f&&a.reject(f),a.resolve(null)}).catch(f=>{a.reject(f)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Hf{constructor(n){v(this,"api");v(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(Ue.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new Lf(this.api,n)}async get(n,s={}){return typeof s=="object"?this.ordered(n,s):(await this.checkVersion(),this.api.info(n,s).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Lf(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new rh(a.nc,a.opts).info(n).then(f=>Promise.resolve(new $1(this.api,n,s))).catch(f=>Promise.reject(f))}}class Fo{constructor(n,s){v(this,"api");v(this,"_info");this.api=n,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new Fo(this.api,n)}else return this}info(n=!1,s){return n?Promise.resolve(this._info):this.api.info(this.name,s).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new Hf(new zo(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Hf(new zo(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,s){return this.api.deleteMessage(this.name,n,s)}}class rh extends Ya{constructor(n,s){super(n,s)}checkStreamConfigVersions(n){const s=this.nc;if(n.metadata){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${o}`)}if(n.first_seq){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${o}`)}if(n.subject_transform){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(n.compression){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${o}`)}if(n.consumer_limits){const{min:o,ok:f}=s.features.get(Ue.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function a(o,f){var m;if((((m=f==null?void 0:f.subject_transforms)==null?void 0:m.length)||0)>0){const{min:g,ok:y}=s.features.get(Ue.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!y)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}n.sources&&n.sources.forEach(o=>{a("stream sources",o)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var o;this.checkStreamConfigVersions(n),Mt(n.name),n.mirror=bo(n.mirror),n.sources=(o=n.sources)==null?void 0:o.map(bo);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return Mt(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,s={}){var m;if(typeof n=="object"){const g=n;n=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),Mt(n);const a=await this.info(n),o=Object.assign(a.config,s);o.mirror=bo(o.mirror),o.sources=(m=o.sources)==null?void 0:m.map(bo);const h=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,o);return this._fixInfo(h),h}async info(n,s){Mt(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let f=await this._request(a,s),{total:h,limit:m}=f,g=f.state.subjects?Object.getOwnPropertyNames(f.state.subjects).length:1;if(h&&h>g){const y=[f],E=s||{};let w=0;for(;h>g;){w++,E.offset=m*w;const q=await this._request(a,E);h=q.total,y.push(q);const M=Object.getOwnPropertyNames(q.state.subjects).length;if(g+=M,M<m)break}let O={};for(let q=0;q<y.length;q++)f=y[q],f.state.subjects&&(O=Object.assign(O,f.state.subjects));f.offset=0,f.total=0,f.limit=0,f.state.subjects=O}return this._fixInfo(f),f}list(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>{const h=f;return h.streams.forEach(m=>{this._fixInfo(m)}),h.streams},o=`${this.prefix}.STREAM.LIST`;return new ka(o,a,this,s)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,s){if(s){const{keep:o,seq:f}=s;if(typeof o=="number"&&typeof f=="number")throw new Error("can specify one of keep or seq")}return Mt(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,s)}async deleteMessage(n,s,a=!0){Mt(n);const o={seq:s};return a||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,o)).success}async getMessage(n,s){Mt(n);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new Mg(o)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var g;const f=a.streams.filter(y=>y.config.name.startsWith(Zt));f.forEach(y=>{this._fixInfo(y)});let h="";return f.length&&(h=((g=this.nc.info)==null?void 0:g.cluster)??""),f.map(y=>new kg(y,h))},s=`${this.prefix}.STREAM.LIST`;return new ka(s,n,this)}listObjectStores(){const n=a=>{const f=a.streams.filter(m=>m.config.name.startsWith(ih));return f.forEach(m=>{this._fixInfo(m)}),f.map(m=>new Bf(m))},s=`${this.prefix}.STREAM.LIST`;return new ka(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,o=`${this.prefix}.STREAM.NAMES`;return new ka(o,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new Fo(this,s))}}class Y1 extends Ya{constructor(n,s){super(n,s)}async getMessage(n,s){Mt(n);let a=s;const{last_by_subj:o}=a;o&&(a=null);const f=a?this.jc.encode(a):nn,h=this.opts.apiPrefix||"$JS.API",m=o?`${h}.DIRECT.GET.${n}.${o}`:`${h}.DIRECT.GET.${n}`,g=await this.nc.request(m,f,{timeout:this.timeout}),y=wr(g);if(y)return Promise.reject(y);const E=new Pf(g);return Promise.resolve(E)}async getBatch(n,s){Mt(n);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const f=JSON.stringify(s,(g,y)=>g==="up_to_time"&&y instanceof Date?y.toISOString():y),h=new _t,m=await this.nc.requestMany(o,f,{strategy:Cn.SentinelMsg});return(async()=>{var w,O,q;let g=!1,y=!1,E;for await(const M of m){if(!g){g=!0;const D=((w=M.headers)==null?void 0:w.code)||0;if(D!==0&&D<200||D>299){E=(O=M.headers)==null?void 0:O.description.toLowerCase();break}if(((q=M.headers)==null?void 0:q.get("Nats-Num-Pending"))===""){y=!0;break}}if(M.data.length===0)break;h.push(new Pf(M))}h.push(()=>{if(y)throw new Error("batch direct get not supported by the server");if(E)throw new Error(`bad request: ${E}`);h.stop()})})(),Promise.resolve(h)}}class Pf{constructor(n){v(this,"data");v(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(br.Subject)}get seq(){const n=this.header.last(br.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(br.TimeStamp)}get stream(){return this.header.last(br.Stream)}json(n){return kn(n).decode(this.data)}string(){return en.decode(this.data)}}v(Pf,"jc");class G1 extends Ya{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new rh(s,a),this.consumers=new zo(s,a),this.direct=new Y1(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new _t;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,o)=>{if(a)throw a;try{const f=this.parseJsResponse(o),h=f.type.split("."),m=h[h.length-1];s.push({kind:m,data:f})}catch(f){s.stop(f)}}}),s}}class Mg{constructor(n){v(this,"_header");v(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):nn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Is.decode(n)}else this._header=hs();return this._header}_parse(n){const s=atob(n),a=s.length,o=new Uint8Array(a);for(let f=0;f<a;f++)o[f]=s.charCodeAt(f);return o}json(n){return kn(n).decode(this.data)}string(){return en.decode(this.data)}}v(Mg,"jc");class V1{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new Fo(this.api,s))}}class yf{constructor(n){v(this,"info");v(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Is.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,s;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function D0(r){const n={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const s=r.headers;n.headers=s.toRecord()}return n}function F1(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class qa{constructor(n,s,a){v(this,"jsm");v(this,"js");v(this,"stream");v(this,"name");this.name=n,this.jsm=s,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const s=await this.rawInfo(n);return s?new yf(s):null}async list(){const n=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of s){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:s,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const o=this._metaSubject(s);try{const f=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),m=kn().decode(f.data);return m.revision=f.seq,m}catch(f){return f.code==="404"?null:Promise.reject(f)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new Bf(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Bf(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,s,a){var re;const o=this.js.getOptions();a=a||{timeout:o.timeout},a.timeout=a.timeout||o.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:f,previousRevision:h}=a,m=this.js.nc.info,g=(m==null?void 0:m.max_payload)||1024;n=n||{},n.options=n.options||{};let y=((re=n.options)==null?void 0:re.max_chunk_size)||128*1024;y=y>g?g:y,n.options.max_chunk_size=y;const E=await this.info(n.name),{name:w,error:O}=this._checkNotEmpty(n.name);if(O)return Promise.reject(O);const q=Ks.next(),M=this._chunkSubject(q),D=this._metaSubject(w),W=Object.assign({bucket:this.name,nuid:q,size:0,chunks:0},D0(n)),se=st(),ee=[],me=new Or;try{const C=s?s.getReader():null,X=S0.create();for(;;){const{done:ce,value:V}=C?await C.read():{done:!0,value:void 0};if(ce){if(me.size()>0){const ne=me.drain();X.update(ne),W.chunks++,W.size+=ne.length,ee.push(this.js.publish(M,ne,{timeout:f}))}await Promise.all(ee),ee.length=0,W.mtime=new Date().toISOString();const G=Sr.encode(X.digest());W.digest=`${M0}${G}`,W.deleted=!1;const K=hs();typeof h=="number"&&K.set(Bn.ExpectedLastSubjectSequenceHdr,`${h}`),K.set(Dt.RollupHdr,Dt.RollupValueSubject);const ae=await this.js.publish(D,kn().encode(W),{headers:K,timeout:f});if(W.revision=ae.seq,E)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${E.nuid}`})}catch{}se.resolve(new yf(W));break}if(V)for(me.fill(V);me.size()>y;){W.chunks++,W.size+=y;const G=me.drain(n.options.max_chunk_size);X.update(G),ee.push(this.js.publish(M,G,{timeout:f}))}}}catch(C){await this.jsm.streams.purge(this.stream,{filter:M}),se.reject(C)}return se}putBlob(n,s,a){function o(f){return new ReadableStream({pull(h){h.enqueue(f),h.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,o(s),a)}put(n,s,a){var o;return(o=n==null?void 0:n.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,s,a)}async getBlob(n){async function s(f){const h=new Or,m=f.getReader();for(;;){const{done:g,value:y}=await m.read();if(g)return h.drain();y&&y.length&&h.fill(y)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const o=await Promise.all([a.error,s(a.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const w=s.options.link.name||"";if(w==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await qa.create(this.js,s.options.link.bucket):this).get(w)}if(!s.digest.startsWith(M0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=Rf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=st(),f={info:new yf(s),error:o};if(s.size===0)return f.data=F1(),o.resolve(null),Promise.resolve(f);let h;const m=Qs();m.orderedConsumer();const g=S0.create(),y=`$O.${this.name}.C.${s.nuid}`,E=await this.js.subscribe(y,m);return(async()=>{for await(const w of E)w.data.length>0&&(g.update(w.data),h.enqueue(w.data)),w.info.pending===0&&(Dv(a,g.digest())?h.close():h.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),E.unsubscribe())})().then(()=>{o.resolve()}).catch(w=>{h.error(w),o.reject(w)}),f.data=new ReadableStream({start(w){h=w},cancel(){E.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof qa))return Promise.reject("bucket required");const a=s,{name:o,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const h={name:o,options:{link:{bucket:a.name}}};return this._put(h,null)}async link(n,s){const{name:a,error:o}=this._checkNotEmpty(n);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const f=await this.rawInfo(n);if(f!==null&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"));const h={bucket:s.bucket,name:s.name},m={name:a,bucket:s.bucket,options:{link:h}};await this.js.publish(this._metaSubject(n),JSON.stringify(m));const g=await this.info(n);return Promise.resolve(g)}async delete(n){const s=await this.rawInfo(n);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const a=kn(),o=hs();return o.set(Dt.RollupHdr,Dt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),a.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(n,s={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??a.name;const{name:o,error:f}=this._checkNotEmpty(s.name);if(f)return Promise.reject(f);if(n!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const h=Object.assign({},a,D0(s)),m=await this.js.publish(this._metaSubject(h.name),JSON.stringify(h));return n!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(m)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let s=!1;const a=new _t,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(a.push(null),s=!0):a.stop(g)}const f=kn(),h=Qs();h.orderedConsumer(),n.includeHistory?h.deliverLastPerSubject():(s=!0,h.deliverNew()),h.callback((g,y)=>{var E;if(g){a.stop(g);return}if(y!==null){const w=f.decode(y.data);w.deleted&&n.ignoreDeletes===!0||a.push(w),((E=y.info)==null?void 0:E.pending)===0&&!s&&(s=!0,a.push(null))}});const m=await this.js.subscribe(o,h);return a._data=m,a.iterClosed.then(()=>{m.unsubscribe()}),m.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${Sr.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=z1(this.name)}catch(o){return Promise.reject(o)}const s=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:s},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=Ba.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);try{await this.jsm.streams.info(a.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,s,a={}){const o=await n.jetstreamManager(),f=new qa(s,o,n);return await f.init(a),Promise.resolve(f)}}class J1{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:o,min:f}=a.nc.features.get(Ue.JS_KV);return o?s.bindOnly?Ha.bind(this.js,n,s):Ha.create(this.js,n,s):Promise.reject(new Error(`kv is only supported on servers ${f} or better`))}os(n,s={}){var h;if(typeof((h=crypto==null?void 0:crypto.subtle)==null?void 0:h.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:o,min:f}=a.nc.features.get(Ue.JS_OBJECTSTORE);return o?qa.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class ah extends Ya{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new zo(s,a),this.streamAPI=new rh(s,a),this.consumers=new Hf(this.consumerAPI),this.streams=new V1(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new J1(this)}async publish(s,a=nn,o){o=o||{},o.expect=o.expect||{};const f=(o==null?void 0:o.headers)||hs();o&&(o.msgID&&f.set(Bn.MsgIdHdr,o.msgID),o.expect.lastMsgID&&f.set(Bn.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&f.set(Bn.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&f.set(Bn.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&f.set(Bn.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const h=o.timeout||this.timeout,m={};h&&(m.timeout=h),o&&(m.headers=f);let{retries:g,retry_delay:y}=o;g=g||1,y=y||250;let E;for(let O=0;O<g;O++)try{E=await this.nc.request(s,a,m);break}catch(q){if(q.code==="503"&&O+1<g)await Tr(y);else throw q}const w=this.parseJsResponse(E);if(w.stream==="")throw ue.errorForCode(ie.JetStreamInvalidAck);return w.duplicate=w.duplicate?w.duplicate:!1,w}async pull(s,a,o=0){Mt(s),_r(a);let f=this.timeout;o>f&&(f=o),o=o<0?0:nt(o);const h={batch:1,no_wait:o===0,expires:o},m=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(h),{noMux:!0,timeout:f}),g=wr(m);if(g)throw g;return Pa(m,this.timeout)}fetch(s,a,o={}){Mt(s),_r(a);let f=null;const h=(o.max_bytes??0)>0;let m=0;const g=h?o.max_bytes:0;let y=null;const E={};if(E.batch=o.batch||1,g){const ee=this.nc.features.get(Ue.JS_PULL_MAX_BYTES);if(!ee.ok)throw new Error(`max_bytes is only supported on servers ${ee.min} or better`);E.max_bytes=g}E.no_wait=o.no_wait||!1,E.no_wait&&E.expires&&(E.expires=0);const w=o.expires||0;if(w&&(E.expires=nt(w)),w===0&&E.no_wait===!1)throw new Error("expires or no_wait is required");const O=o.idle_heartbeat||0;O&&(E.idle_heartbeat=nt(O),o.delay_heartbeat===!0&&(E.idle_heartbeat=nt(O*4)));const q=new _t,M=E.batch;let D=0;q.protocolFilterFn=(ee,me=!1)=>Cf(ee.msg)?(y==null||y.work(),!1):!0,q.dispatchedFn=ee=>{if(ee){if(h&&(m+=ee.data.length),D++,f&&ee.info.pending===0)return;(q.getPending()===1&&ee.info.pending===0||M===D||g>0&&m>=g)&&q.stop()}};const W=fs(this.nc.options.inboxPrefix),se=this.nc.subscribe(W,{max:o.batch,callback:(ee,me)=>{ee===null&&(ee=wr(me)),ee!==null?(f&&(f.cancel(),f=null),pv(ee)?q.stop(Dg(ee)===null?void 0:ee):q.stop(ee)):(y==null||y.work(),q.received++,q.push(Pa(me,this.timeout)))}});return w&&(f=Ar(w),f.catch(()=>{se.isClosed()||(se.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{O&&(y=new sh(O,ee=>(q.push(()=>{q.err=new ue(`${xn.IdleHeartbeatMissed}: ${ee}`,ie.JetStreamIdleHeartBeat)}),!0)))}catch{}await se.closed,f!==null&&(f.cancel(),f=null),y&&y.cancel(),q.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(E),{reply:W}),q}async pullSubscribe(s,a=Qs()){const o=await this._processOptions(s,a);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=o.config.ack_policy;if(f===vt.None||f===vt.All)throw new Error("ack policy for pull consumers must be explicit");const h=this._buildTypedSubscriptionOpts(o),m=new K1(this,o.deliver,h);m.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw m.unsubscribe(),g}return m}async subscribe(s,a=Qs()){const o=await this._processOptions(s,a);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(o),h=new Rg(this,o.deliver,f);h.info=o;try{await this._maybeCreateConsumer(o)}catch(m){throw h.unsubscribe(),m}return h._maybeSetupHbMonitoring(),h}async _processOptions(s,a=Qs()){const o=x0(a)?a.getOpts():a;if(o.isBind=x0(a)?a.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==vt.NotSet&&o.config.ack_policy!==vt.None)throw new ue("ordered consumer: ack_policy can only be set to 'none'",ie.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new ue("ordered consumer: durable_name cannot be set",ie.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new ue("ordered consumer: deliver_subject cannot be set",ie.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new ue("ordered consumer: max_deliver cannot be set",ie.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new ue("ordered consumer: deliver_group cannot be set",ie.ApiError);o.config.deliver_subject=fs(this.nc.options.inboxPrefix),o.config.ack_policy=vt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||nt(5e3),o.config.ack_wait=nt(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===vt.NotSet&&(o.config.ack_policy=vt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const f=await this.consumerAPI.info(o.stream,o.config.durable_name);if(f){if(f.config.filter_subject&&f.config.filter_subject!==s)throw new Error("subject does not match consumer");const h=o.config.deliver_group??"";if(h===""&&f.push_bound===!0)throw new Error("duplicate subscription");const m=f.config.deliver_group??"";if(h!==m)throw m===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${m}'`);o.last=f,o.config=f.config,o.attached=!0,o.config.durable_name||(o.name=f.name)}}catch(f){if(f.code!=="404")throw f}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||fs(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=Z1(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=ah.ingestionFn(s.ordered),a.protocolFilterFn=(o,f=!1)=>{const h=o;return Nf(h.msg)?(f||h.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==vt.None&&(a.dispatchedFn=t_),s.callbackFn&&(a.callback=s.callbackFn),a.max=s.max||0,a.queue=s.queue,a}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:jr.Instant},s.config);const a=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=a.name,s.config=a.config,s.last=a}static ingestionFn(s){return(a,o)=>{var g;const f=o;if(!a)return{ingest:!1,protocol:!1};const h=a;if(wr(h.msg)||(g=f.monitor)==null||g.work(),Cf(h.msg)){const y=s?f._checkHbOrderConsumer(h.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:y,protocol:!0}}else if(Nf(h.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class lh{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=g1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const o=new lh(n);Uo.connect(o.options,o).then(f=>{o.protocol=f,(async function(){for await(const h of f.status())o.listeners.forEach(m=>{m.push(h)})})(),s(o)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw ue.errorForCode(ie.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw ue.errorForCode(ie.ConnectionDraining);if(n=n||"",n.length===0)throw ue.errorForCode(ie.BadSubject)}publish(n,s,a){this._check(n,!1,!0),this.protocol.publish(n,s,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,s={}){this._check(n,!0,!1);const a=new Ng(this.protocol,n,s);return this.protocol.subscribe(a),a}_resub(n,s,a){this._check(s,!0,!1);const o=n;o.max=a,a&&(o.max=a+o.received),this.protocol.resub(o,s)}requestMany(n,s=nn,a={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(g){return Promise.reject(g)}if(a.strategy=a.strategy||Cn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new ue("timeout",ie.InvalidOption));const f=new _t;function h(g){f.push(()=>{f.stop(g)})}function m(g,y){g||y===null?h(g===null?void 0:g):f.push(y)}if(a.noMux){const g=o?new Error().stack:null;let y=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const E=this.subscribe(fs(this.options.inboxPrefix),{callback:(M,D)=>{var W,se;if(((W=D==null?void 0:D.data)==null?void 0:W.length)===0&&((se=D==null?void 0:D.headers)==null?void 0:se.status)===ie.NoResponders&&(M=ue.errorForCode(ie.NoResponders)),M){g&&(M.stack+=`
|
|
48
48
|
|
|
49
|
-
${g}`),w(M);return}
|
|
49
|
+
${g}`),w(M);return}m(null,D),a.strategy===Cn.Count&&(y--,y===0&&w()),a.strategy===Cn.JitterTimer&&(q(),O=setTimeout(()=>{w()},300)),a.strategy===Cn.SentinelMsg&&D&&D.data.length===0&&w()}});E.requestSubject=n,E.closed.then(()=>{h()}).catch(M=>{f.stop(M)});const w=M=>{M&&f.push(()=>{throw M}),q(),E.drain().then(()=>{h()}).catch(D=>{h()})};f.iterClosed.then(()=>{q(),E==null||E.unsubscribe()}).catch(M=>{q(),E==null||E.unsubscribe()});try{this.publish(n,s,{reply:E.getSubject()})}catch(M){w(M)}let O=setTimeout(()=>{w()},a.maxWait);const q=()=>{O&&clearTimeout(O)}}else{const g=a;g.callback=m,f.iterClosed.then(()=>{y.cancel()}).catch(E=>{y.cancel(E)});const y=new zv(this.protocol.muxSubscriptions,n,g);this.protocol.request(y);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${y.token}`,headers:a.headers})}catch(E){y.cancel(E)}}return Promise.resolve(f)}request(n,s,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(f){return Promise.reject(f)}const o=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new ue("timeout",ie.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new ue("reply can only be used with noMux",ie.InvalidOption));if(a.noMux){const f=a.reply?a.reply:fs(this.options.inboxPrefix),h=st(),m=o?new Error:null,g=this.subscribe(f,{max:1,timeout:a.timeout,callback:(y,E)=>{y?(m&&y.code!==ie.Timeout&&(y.stack+=`
|
|
50
50
|
|
|
51
|
-
${
|
|
51
|
+
${m.stack}`),g.unsubscribe(),h.reject(y)):(y=vg(E),y?(m&&(y.stack+=`
|
|
52
52
|
|
|
53
|
-
${d.stack}`),h.reject(y)):h.resolve(E))}});return g.requestSubject=n,this.protocol.publish(n,s,{reply:f,headers:a.headers}),h}else{const f=new wg(this.protocol.muxSubscriptions,n,a,o);this.protocol.request(f);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:a.headers})}catch(d){f.cancel(d)}const h=Promise.race([f.timer,f.deferred]);return h.catch(()=>{f.cancel()}),h}}flush(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new _t;return n.iterClosed.then(()=>{const s=this.listeners.indexOf(n);this.listeners.splice(s,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const s=new F1(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===ie.NoResponders&&(o.code=ie.JetStreamNotEnabled),o}return s}jetstream(n={}){return new rh(this,n)}getServerVersion(){const n=this.info;return n?Ai(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw ue.errorForCode(ie.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new X1(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):this.protocol.reconnect()}}class X1{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new Ga(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new N1(this.nc,n,s)}}class K1{constructor(n,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=n,this.prefixLen=s,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Bo)||"PUT"}get length(){const n=this.sm.header.get(Dt.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Z1{constructor(n,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=n,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(eh(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Bo))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const n=((s=this.sm.headers)==null?void 0:s.get(Dt.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Mg extends Pv{constructor(s,a,o){super(s.nc,a,o);v(this,"js");v(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const a=fs(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=Ks.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=ft.StartSequence,f.config.opt_start_seq=s;const h={};h.stream_name=this.info.stream,h.config=f.config;const d=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(d,h,{retries:-1}).then(g=>{const y=g,E=this.sub.info;E.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new ue(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,ie.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,o;const s=((o=(a=this.info)==null?void 0:a.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(eh(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const f=this.sub,h=d=>{var E,w,j,q;const g=_v(409,`${xn.IdleHeartbeatMissed}: ${d}`,this.sub.subject);if(!((E=this.info)==null?void 0:E.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const M=((j=(w=this.info)==null?void 0:w.ordered_consumer_sequence)==null?void 0:j.stream_seq)||0;return this._resetOrderedConsumer(M+1),(q=this.monitor)==null||q.restart(),!1}return!f.noIterator};this.monitor=new nh(s,h,o)}_checkHbOrderConsumer(s){const a=s.headers.get(Dt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const o=parseInt(s.headers.get(Dt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(o);return s.last=f,f}}class W1 extends Mg{constructor(n,s,a){super(n,s,a)}pull(n={batch:1}){const{stream:s,config:a,name:o}=this.sub.info,f=a.durable_name??o,h={};if(h.batch=n.batch||1,h.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const y=this.js.nc.features.get(Ue.JS_PULL_MAX_BYTES);if(!y.ok)throw new Error(`max_bytes is only supported on servers ${y.min} or better`);h.max_bytes=n.max_bytes}let d=0;n.expires&&n.expires>0&&(d=n.expires,h.expires=nt(d));let g=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(g=n.idle_heartbeat,h.idle_heartbeat=nt(g)),g&&d===0)throw new Error("idle_heartbeat requires expires");if(g>d)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),d&&g&&(this.monitor?this.monitor._change(g,d):this._setupHbMonitoring(g,d));const y=this.info.api,E=`${y.prefix}.CONSUMER.MSG.NEXT.${s}.${f}`,w=this.sub.subject;y.nc.publish(E,y.jc.encode(h),{reply:w})}}}function e_(r,n){return r?n_(n):t_(n)}function t_(r){return(n,s)=>n?[n,null]:(n=vr(s),n?[n,null]:[null,Pa(s,r)])}function n_(r){return(n,s)=>{if(n)return[n,null];const a=vr(s);return a!==null?[Rg(a),null]:[null,Pa(s,r)]}}function Rg(r){if(r!==null)switch(r.code){case ie.JetStream404NoMessages:case ie.JetStream408RequestTimeout:return null;case ie.JetStream409:return wv(r)?r:null;default:return r}return null}function s_(r){r&&r.ack()}function i_(r){const n=r.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=n[2]==="_"?"":n[2],s.account_hash=n[3],s.stream=n[4],s.consumer=n[5],s.deliveryCount=parseInt(n[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(n[7],10),s.deliverySequence=parseInt(n[8],10),s.timestampNanos=parseInt(n[9],10),s.pending=parseInt(n[10],10),s}class r_{constructor(n,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=n,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=i_(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===Aa[0]&&n[1]===Aa[1]&&n[2]===Aa[2]&&n[3]===Aa[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const s=st();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,h=!((a=f.options)!=null&&a.noAsyncTraces),d=new wg(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},h);f.request(d);try{f.publish(this.msg.reply,M0,{reply:`${f.muxSubscriptions.baseInbox}${d.token}`})}catch(g){d.cancel(g)}try{await Promise.race([d.timer,d.deferred]),s.resolve(!0)}catch(g){d.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(M0)}nak(n){let s=L1;n&&(s=jf().encode(`-NAK ${JSON.stringify({delay:nt(n)})}`)),this.doAck(s)}working(){this.doAck(Aa)}next(n,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=nt(s.expires));const o=kn().encode(a),f=Ar.concat(H1,$1,o),h=n?{reply:n}:void 0;this.msg.respond(f,h)}term(n=""){let s=P1;(n==null?void 0:n.length)>0&&(s=jf().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const a_="1.30.3",l_="nats.ws";class o_{constructor(){v(this,"version");v(this,"lang");v(this,"closeError");v(this,"connected");v(this,"done");v(this,"socket");v(this,"options");v(this,"socketClosed");v(this,"encrypted");v(this,"peeked");v(this,"yields");v(this,"signal");v(this,"closedNotification");this.version=a_,this.lang=l_,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(n,s){const a=st();if(s.tls)return a.reject(new ue("tls",ie.InvalidOption)),a;this.options=s;const o=n.src;if(s.wsFactory){const{socket:f,encrypted:h}=await s.wsFactory(n.src,s);this.socket=f,this.encrypted=h}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const h=Ar.concat(...this.yields),d=Jv(h);if(d!==""){const g=_1.exec(d);if(!g){s.debug&&console.error("!!!",po(h)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);x1(y,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(y){a.reject(y);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let h;this.done||(f.wasClean||(h=new Error(f.reason)),this._closed(h))},this.socket.onerror=f=>{if(this.isDiscarded())return;const h=f,d=new ue(h.message,ie.Unknown,new Error(h.error));a.reject(d)},a}disconnect(){this._closed(void 0,!0)}async _closed(n,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await jr(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}s&&this.closedNotification.resolve(n)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const n=this.yields;this.yields=[];for(let s=0;s<n.length;s++)this.options.debug&&console.info(`> ${po(n[s])}`),yield n[s];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${po(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${po(n)}: ${s}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function c_(r,n){/^(.*:\/\/)(.*)/.test(r)||(typeof n=="boolean"?r=`${n===!0?"https":"http"}://${r}`:r=`https://${r}`);let a=new URL(r);const o=a.protocol.toLowerCase();o==="ws:"&&(n=!1),o==="wss:"&&(n=!0),o!=="https:"&&o!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${r}`));let f,h;const d=a.hostname,g=a.pathname,y=a.search||"";switch(o){case"http:":case"ws:":case"nats:":h=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":h=a.port||"443",f="wss:";break;default:h=a.port||n===!0?"443":"80",f=n===!0?"wss:":"ws:";break}return`${f}//${d}:${h}${g}${y}`}function u_(r={}){return $v({defaultPort:443,urlParseFn:c_,factory:()=>new o_}),ah.connect(r)}const f_=null,h_=null,d_="lt.events";function Dg(r,n){const s=r.split("."),a=n.split(".");for(let o=0;o<a.length;o++){const f=a[o];if(f===">")return!0;if(o>=s.length||f!=="*"&&f!==s[o])return!1}return s.length===a.length}const Va=T.createContext({connected:!1,subscribe:()=>()=>{}});function m_(){const{connected:r}=T.useContext(Va);return{connected:r}}function p_(r,n){const{subscribe:s}=T.useContext(Va),a=T.useRef(n);a.current=n,T.useEffect(()=>s(r,f=>a.current(f)),[s,r])}const g_=T.createContext({connected:!1,subscribe:()=>()=>{}}),y_=jf();function b_({children:r,url:n,token:s}){const a=T.useRef(null),o=T.useRef(null),[f,h]=T.useState(!1),d=T.useRef(null),g=T.useRef(new Map),y=T.useCallback((j,q)=>{const M=g.current;return M.has(j)||M.set(j,new Set),M.get(j).add(q),()=>{const D=M.get(j);D&&(D.delete(q),D.size===0&&M.delete(j))}},[]),E=T.useCallback((j,q)=>{for(const[M,D]of g.current)if(Dg(j,M))for(const W of D)try{W(q)}catch{}},[]),w=T.useCallback(async()=>{try{if(a.current)return;const j=n||f_;if(!j){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const q=await u_({servers:j,token:s||h_||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=q,h(!0);const M=q.subscribe("lt.>");o.current=M,(async()=>{for await(const D of M)try{const W=JSON.parse(y_.decode(D.data));E(D.subject,W)}catch{}})(),(async()=>{for await(const D of q.status())D.type==="disconnect"||D.type==="error"?h(!1):D.type==="reconnect"&&h(!0)})()}catch{h(!1),d.current=setTimeout(w,3e3)}},[E]);return T.useEffect(()=>(w(),()=>{d.current&&clearTimeout(d.current),o.current&&o.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),h(!1)}),[w]),m.jsx(g_.Provider,{value:{connected:f,subscribe:y},children:m.jsx(Va.Provider,{value:{connected:f,subscribe:y},children:r})})}const Hn=Object.create(null);Hn.open="0";Hn.close="1";Hn.ping="2";Hn.pong="3";Hn.message="4";Hn.upgrade="5";Hn.noop="6";const Oo=Object.create(null);Object.keys(Hn).forEach(r=>{Oo[Hn[r]]=r});const Pf={type:"error",data:"parser error"},zg=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",qg=typeof ArrayBuffer=="function",Ug=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,lh=({type:r,data:n},s,a)=>zg&&n instanceof Blob?s?a(n):D0(n,a):qg&&(n instanceof ArrayBuffer||Ug(n))?s?a(n):D0(new Blob([n]),a):a(Hn[r]+(n||"")),D0=(r,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(r)};function z0(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let yf;function x_(r,n){if(zg&&r.data instanceof Blob)return r.data.arrayBuffer().then(z0).then(n);if(qg&&(r.data instanceof ArrayBuffer||Ug(r.data)))return n(z0(r.data));lh(r,!1,s=>{yf||(yf=new TextEncoder),n(yf.encode(s))})}const q0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ka=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<q0.length;r++)ka[q0.charCodeAt(r)]=r;const v_=r=>{let n=r.length*.75,s=r.length,a,o=0,f,h,d,g;r[r.length-1]==="="&&(n--,r[r.length-2]==="="&&n--);const y=new ArrayBuffer(n),E=new Uint8Array(y);for(a=0;a<s;a+=4)f=ka[r.charCodeAt(a)],h=ka[r.charCodeAt(a+1)],d=ka[r.charCodeAt(a+2)],g=ka[r.charCodeAt(a+3)],E[o++]=f<<2|h>>4,E[o++]=(h&15)<<4|d>>2,E[o++]=(d&3)<<6|g&63;return y},__=typeof ArrayBuffer=="function",oh=(r,n)=>{if(typeof r!="string")return{type:"message",data:Bg(r,n)};const s=r.charAt(0);return s==="b"?{type:"message",data:w_(r.substring(1),n)}:Oo[s]?r.length>1?{type:Oo[s],data:r.substring(1)}:{type:Oo[s]}:Pf},w_=(r,n)=>{if(__){const s=v_(r);return Bg(s,n)}else return{base64:!0,data:r}},Bg=(r,n)=>{switch(n){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},Lg="",S_=(r,n)=>{const s=r.length,a=new Array(s);let o=0;r.forEach((f,h)=>{lh(f,!1,d=>{a[h]=d,++o===s&&n(a.join(Lg))})})},E_=(r,n)=>{const s=r.split(Lg),a=[];for(let o=0;o<s.length;o++){const f=oh(s[o],n);if(a.push(f),f.type==="error")break}return a};function A_(){return new TransformStream({transform(r,n){x_(r,s=>{const a=s.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}r.data&&typeof r.data!="string"&&(o[0]|=128),n.enqueue(o),n.enqueue(s)})}})}let bf;function xo(r){return r.reduce((n,s)=>n+s.length,0)}function vo(r,n){if(r[0].length===n)return r.shift();const s=new Uint8Array(n);let a=0;for(let o=0;o<n;o++)s[o]=r[0][a++],a===r[0].length&&(r.shift(),a=0);return r.length&&a<r[0].length&&(r[0]=r[0].slice(a)),s}function O_(r,n){bf||(bf=new TextDecoder);const s=[];let a=0,o=-1,f=!1;return new TransformStream({transform(h,d){for(s.push(h);;){if(a===0){if(xo(s)<1)break;const g=vo(s,1);f=(g[0]&128)===128,o=g[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(xo(s)<2)break;const g=vo(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(xo(s)<8)break;const g=vo(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),E=y.getUint32(0);if(E>Math.pow(2,21)-1){d.enqueue(Pf);break}o=E*Math.pow(2,32)+y.getUint32(4),a=3}else{if(xo(s)<o)break;const g=vo(s,o);d.enqueue(oh(f?g:bf.decode(g),n)),a=0}if(o===0||o>r){d.enqueue(Pf);break}}}})}const Hg=4;function gt(r){if(r)return j_(r)}function j_(r){for(var n in gt.prototype)r[n]=gt.prototype[n];return r}gt.prototype.on=gt.prototype.addEventListener=function(r,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(n),this};gt.prototype.once=function(r,n){function s(){this.off(r,s),n.apply(this,arguments)}return s.fn=n,this.on(r,s),this};gt.prototype.off=gt.prototype.removeListener=gt.prototype.removeAllListeners=gt.prototype.removeEventListener=function(r,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+r];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var a,o=0;o<s.length;o++)if(a=s[o],a===n||a.fn===n){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+r],this};gt.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),s=this._callbacks["$"+r],a=1;a<arguments.length;a++)n[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,o=s.length;a<o;++a)s[a].apply(this,n)}return this};gt.prototype.emitReserved=gt.prototype.emit;gt.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};gt.prototype.hasListeners=function(r){return!!this.listeners(r).length};const Jo=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),vn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),T_="arraybuffer";function Pg(r,...n){return n.reduce((s,a)=>(r.hasOwnProperty(a)&&(s[a]=r[a]),s),{})}const N_=vn.setTimeout,C_=vn.clearTimeout;function Qo(r,n){n.useNativeTimers?(r.setTimeoutFn=N_.bind(vn),r.clearTimeoutFn=C_.bind(vn)):(r.setTimeoutFn=vn.setTimeout.bind(vn),r.clearTimeoutFn=vn.clearTimeout.bind(vn))}const k_=1.33;function M_(r){return typeof r=="string"?R_(r):Math.ceil((r.byteLength||r.size)*k_)}function R_(r){let n=0,s=0;for(let a=0,o=r.length;a<o;a++)n=r.charCodeAt(a),n<128?s+=1:n<2048?s+=2:n<55296||n>=57344?s+=3:(a++,s+=4);return s}function $g(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function D_(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function z_(r){let n={},s=r.split("&");for(let a=0,o=s.length;a<o;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class q_ extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class ch extends gt{constructor(n){super(),this.writable=!1,Qo(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,s,a){return super.emitReserved("error",new q_(n,s,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){const s=oh(n,this.socket.binaryType);this.onPacket(s)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,s={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){const s=D_(n);return s.length?"?"+s:""}}class U_ extends ch{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";const s=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||s()})),this.writable||(a++,this.once("drain",function(){--a||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){const s=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};E_(n,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,S_(n,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=$g()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let Yg=!1;try{Yg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const B_=Yg;function L_(){}class H_ extends U_{constructor(n){if(super(n),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||a!==n.port}}doWrite(n,s){const a=this.request({method:"POST",data:n});a.on("success",s),a.on("error",(o,f)=>{this.onError("xhr post error",o,f)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=n}}class Ln extends gt{constructor(n,s,a){super(),this.createRequest=n,Qo(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var n;const s=Pg(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(s);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&a.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(n=this._opts.cookieJar)===null||n===void 0||n.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var o;a.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Ln.requestsCount++,Ln.requests[this._index]=this)}_onError(n){this.emitReserved("error",n,this._xhr),this._cleanup(!0)}_cleanup(n){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=L_,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Ln.requests[this._index],this._xhr=null}}_onLoad(){const n=this._xhr.responseText;n!==null&&(this.emitReserved("data",n),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Ln.requestsCount=0;Ln.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",U0);else if(typeof addEventListener=="function"){const r="onpagehide"in vn?"pagehide":"unload";addEventListener(r,U0,!1)}}function U0(){for(let r in Ln.requests)Ln.requests.hasOwnProperty(r)&&Ln.requests[r].abort()}const P_=(function(){const r=Gg({xdomain:!1});return r&&r.responseType!==null})();class $_ extends H_{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=P_&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Ln(Gg,this.uri(),n)}}function Gg(r){const n=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||B_))return new XMLHttpRequest}catch{}if(!n)try{return new vn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Vg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Y_ extends ch{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=Vg?{}:Pg(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,s,a)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;lh(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}o&&Jo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=$g()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const xf=vn.WebSocket||vn.MozWebSocket;class G_ extends Y_{createSocket(n,s,a){return Vg?new xf(n,s,a):s?new xf(n,s):new xf(n)}doWrite(n,s){this.ws.send(s)}}class V_ extends ch{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{const s=O_(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),o=A_();o.readable.pipeTo(n.writable),this._writer=o.writable.getWriter();const f=()=>{a.read().then(({done:d,value:g})=>{d||(this.onPacket(g),f())}).catch(d=>{})};f();const h={type:"open"};this.query.sid&&(h.data=`{"sid":"${this.query.sid}"}`),this._writer.write(h).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;this._writer.write(a).then(()=>{o&&Jo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const F_={websocket:G_,webtransport:V_,polling:$_},J_=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Q_=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function $f(r){if(r.length>8e3)throw"URI too long";const n=r,s=r.indexOf("["),a=r.indexOf("]");s!=-1&&a!=-1&&(r=r.substring(0,s)+r.substring(s,a).replace(/:/g,";")+r.substring(a,r.length));let o=J_.exec(r||""),f={},h=14;for(;h--;)f[Q_[h]]=o[h]||"";return s!=-1&&a!=-1&&(f.source=n,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=I_(f,f.path),f.queryKey=X_(f,f.query),f}function I_(r,n){const s=/\/{2,9}/g,a=n.replace(s,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&a.splice(0,1),n.slice(-1)=="/"&&a.splice(a.length-1,1),a}function X_(r,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,f){o&&(s[o]=f)}),s}const Yf=typeof addEventListener=="function"&&typeof removeEventListener=="function",jo=[];Yf&&addEventListener("offline",()=>{jo.forEach(r=>r())},!1);class Xs extends gt{constructor(n,s){if(super(),this.binaryType=T_,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,n&&typeof n=="object"&&(s=n,n=null),n){const a=$f(n);s.hostname=a.host,s.secure=a.protocol==="https"||a.protocol==="wss",s.port=a.port,a.query&&(s.query=a.query)}else s.host&&(s.hostname=$f(s.host).host);Qo(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(a=>{const o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=z_(this.opts.query)),Yf&&(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"})},jo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=Hg,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&Xs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Xs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(s+=M_(o)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,Jo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,s,a){return this._sendPacket("message",n,s,a),this}send(n,s,a){return this._sendPacket("message",n,s,a),this}_sendPacket(n,s,a,o){if(typeof s=="function"&&(o=s,s=void 0),typeof a=="function"&&(o=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:n,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),o&&this.once("flush",o),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():n()}):this.upgrading?a():n()),this}_onError(n){if(Xs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Yf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=jo.indexOf(this._offlineEventListener);a!==-1&&jo.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}Xs.protocol=Hg;class K_ extends Xs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;Xs.priorWebsocketSuccess=!1;const o=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",w=>{if(!a)if(w.type==="pong"&&w.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Xs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(E(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const j=new Error("probe error");j.transport=s.name,this.emitReserved("upgradeError",j)}}))};function f(){a||(a=!0,E(),s.close(),s=null)}const h=w=>{const j=new Error("probe error: "+w);j.transport=s.name,f(),this.emitReserved("upgradeError",j)};function d(){h("transport closed")}function g(){h("socket closed")}function y(w){s&&w.name!==s.name&&f()}const E=()=>{s.removeListener("open",o),s.removeListener("error",h),s.removeListener("close",d),this.off("close",g),this.off("upgrading",y)};s.once("open",o),s.once("error",h),s.once("close",d),this.once("close",g),this.once("upgrading",y),this._upgrades.indexOf("webtransport")!==-1&&n!=="webtransport"?this.setTimeoutFn(()=>{a||s.open()},200):s.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){const s=[];for(let a=0;a<n.length;a++)~this.transports.indexOf(n[a])&&s.push(n[a]);return s}}let Z_=class extends K_{constructor(n,s={}){const a=typeof n=="object"?n:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(o=>F_[o]).filter(o=>!!o)),super(n,a)}};function W_(r,n="",s){let a=r;s=s||typeof location<"u"&&location,r==null&&(r=s.protocol+"//"+s.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=s.protocol+r:r=s.host+r),/^(https?|wss?):\/\//.test(r)||(typeof s<"u"?r=s.protocol+"//"+r:r="https://"+r),a=$f(r)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+n,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const ew=typeof ArrayBuffer=="function",tw=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Fg=Object.prototype.toString,nw=typeof Blob=="function"||typeof Blob<"u"&&Fg.call(Blob)==="[object BlobConstructor]",sw=typeof File=="function"||typeof File<"u"&&Fg.call(File)==="[object FileConstructor]";function uh(r){return ew&&(r instanceof ArrayBuffer||tw(r))||nw&&r instanceof Blob||sw&&r instanceof File}function To(r,n){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,a=r.length;s<a;s++)if(To(r[s]))return!0;return!1}if(uh(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return To(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&To(r[s]))return!0;return!1}function iw(r){const n=[],s=r.data,a=r;return a.data=Gf(s,n),a.attachments=n.length,{packet:a,buffers:n}}function Gf(r,n){if(!r)return r;if(uh(r)){const s={_placeholder:!0,num:n.length};return n.push(r),s}else if(Array.isArray(r)){const s=new Array(r.length);for(let a=0;a<r.length;a++)s[a]=Gf(r[a],n);return s}else if(typeof r=="object"&&!(r instanceof Date)){const s={};for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[a]=Gf(r[a],n));return s}return r}function rw(r,n){return r.data=Vf(r.data,n),delete r.attachments,r}function Vf(r,n){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<n.length)return n[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=Vf(r[s],n);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=Vf(r[s],n));return r}const aw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var qe;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(qe||(qe={}));class lw{constructor(n){this.replacer=n}encode(n){return(n.type===qe.EVENT||n.type===qe.ACK)&&To(n)?this.encodeAsBinary({type:n.type===qe.EVENT?qe.BINARY_EVENT:qe.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===qe.BINARY_EVENT||n.type===qe.BINARY_ACK)&&(s+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(s+=n.nsp+","),n.id!=null&&(s+=n.id),n.data!=null&&(s+=JSON.stringify(n.data,this.replacer)),s}encodeAsBinary(n){const s=iw(n),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class fh extends gt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let s;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(n);const a=s.type===qe.BINARY_EVENT;a||s.type===qe.BINARY_ACK?(s.type=a?qe.EVENT:qe.ACK,this.reconstructor=new ow(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(uh(n)||n.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(n),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let s=0;const a={type:Number(n.charAt(0))};if(qe[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===qe.BINARY_EVENT||a.type===qe.BINARY_ACK){const f=s+1;for(;n.charAt(++s)!=="-"&&s!=n.length;);const h=n.substring(f,s);if(h!=Number(h)||n.charAt(s)!=="-")throw new Error("Illegal attachments");const d=Number(h);if(!cw(d)||d<0)throw new Error("Illegal attachments");if(d>this.opts.maxAttachments)throw new Error("too many attachments");a.attachments=d}if(n.charAt(s+1)==="/"){const f=s+1;for(;++s&&!(n.charAt(s)===","||s===n.length););a.nsp=n.substring(f,s)}else a.nsp="/";const o=n.charAt(s+1);if(o!==""&&Number(o)==o){const f=s+1;for(;++s;){const h=n.charAt(s);if(h==null||Number(h)!=h){--s;break}if(s===n.length)break}a.id=Number(n.substring(f,s+1))}if(n.charAt(++s)){const f=this.tryParse(n.substr(s));if(fh.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,s){switch(n){case qe.CONNECT:return B0(s);case qe.DISCONNECT:return s===void 0;case qe.CONNECT_ERROR:return typeof s=="string"||B0(s);case qe.EVENT:case qe.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&aw.indexOf(s[0])===-1);case qe.ACK:case qe.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ow{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){const s=rw(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const cw=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function B0(r){return Object.prototype.toString.call(r)==="[object Object]"}const uw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:fh,Encoder:lw,get PacketType(){return qe}},Symbol.toStringTag,{value:"Module"}));function Nn(r,n,s){return r.on(n,s),function(){r.off(n,s)}}const fw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Jg extends gt{constructor(n,s,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[Nn(n,"open",this.onopen.bind(this)),Nn(n,"packet",this.onpacket.bind(this)),Nn(n,"error",this.onerror.bind(this)),Nn(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...s){var a,o,f;if(fw.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(s.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const h={type:qe.EVENT,data:s};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const E=this.ids++,w=s.pop();this._registerAckCallback(E,w),h.id=E}const d=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!d||(g?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h)),this.flags={},this}_registerAckCallback(n,s){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[n]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let d=0;d<this.sendBuffer.length;d++)this.sendBuffer[d].id===n&&this.sendBuffer.splice(d,1);s.call(this,new Error("operation has timed out"))},o),h=(...d)=>{this.io.clearTimeoutFn(f),s.apply(this,d)};h.withError=!0,this.acks[n]=h}emitWithAck(n,...s){return new Promise((a,o)=>{const f=(h,d)=>h?o(h):a(d);f.withError=!0,s.push(f),this.emit(n,...s)})}_addToQueue(n){let s;typeof n[n.length-1]=="function"&&(s=n.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((o,...f)=>(this._queue[0],o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...f)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!n||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:qe.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(a=>String(a.id)===n)){const a=this.acks[n];delete this.acks[n],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case qe.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case qe.EVENT:case qe.BINARY_EVENT:this.onevent(n);break;case qe.ACK:case qe.BINARY_ACK:this.onack(n);break;case qe.DISCONNECT:this.ondisconnect();break;case qe.CONNECT_ERROR:this.destroy();const a=new Error(n.data.message);a.data=n.data.data,this.emitReserved("connect_error",a);break}}onevent(n){const s=n.data||[];n.id!=null&&s.push(this.ack(n.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const s=this;let a=!1;return function(...o){a||(a=!0,s.packet({type:qe.ACK,id:n,data:o}))}}onack(n){const s=this.acks[n.id];typeof s=="function"&&(delete this.acks[n.id],s.withError&&n.data.unshift(null),s.apply(this,n.data))}onconnect(n,s){this.id=n,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:qe.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,n.data)}}}function Tr(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Tr.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),s=Math.floor(n*this.jitter*r);r=(Math.floor(n*10)&1)==0?r-s:r+s}return Math.min(r,this.max)|0};Tr.prototype.reset=function(){this.attempts=0};Tr.prototype.setMin=function(r){this.ms=r};Tr.prototype.setMax=function(r){this.max=r};Tr.prototype.setJitter=function(r){this.jitter=r};class Ff extends gt{constructor(n,s){var a;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(s=n,n=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Qo(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((a=s.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new Tr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=n;const o=s.parser||uw;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var s;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(s=this.backoff)===null||s===void 0||s.setMin(n),this)}randomizationFactor(n){var s;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(s=this.backoff)===null||s===void 0||s.setJitter(n),this)}reconnectionDelayMax(n){var s;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(s=this.backoff)===null||s===void 0||s.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new Z_(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=Nn(s,"open",function(){a.onopen(),n&&n()}),f=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),n?n(d):this.maybeReconnectOnOpen()},h=Nn(s,"error",f);if(this._timeout!==!1){const d=this._timeout,g=this.setTimeoutFn(()=>{o(),f(new Error("timeout")),s.close()},d);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(h),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push(Nn(n,"ping",this.onping.bind(this)),Nn(n,"data",this.ondata.bind(this)),Nn(n,"error",this.onerror.bind(this)),Nn(n,"close",this.onclose.bind(this)),Nn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(s){this.onclose("parse error",s)}}ondecoded(n){Jo(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,s){let a=this.nsps[n];return a?this._autoConnect&&!a.active&&a.connect():(a=new Jg(this,n,s),this.nsps[n]=a),a}_destroy(n){const s=Object.keys(this.nsps);for(const a of s)if(this.nsps[a].active)return;this._close()}_packet(n){const s=this.encoder.encode(n);for(let a=0;a<s.length;a++)this.engine.write(s[a],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,s){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const n=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(o=>{o?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",o)):n.onreconnect()}))},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}}const Oa={};function No(r,n){typeof r=="object"&&(n=r,r=void 0),n=n||{};const s=W_(r,n.path||"/socket.io"),a=s.source,o=s.id,f=s.path,h=Oa[o]&&f in Oa[o].nsps,d=n.forceNew||n["force new connection"]||n.multiplex===!1||h;let g;return d?g=new Ff(a,n):(Oa[o]||(Oa[o]=new Ff(a,n)),g=Oa[o]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(No,{Manager:Ff,Socket:Jg,io:No,connect:No});const hw=T.createContext({connected:!1,subscribe:()=>()=>{}});function dw({children:r}){const n=T.useRef(null),[s,a]=T.useState(!1),o=T.useRef(new Map),f=T.useCallback((d,g)=>{const y=o.current;return y.has(d)||y.set(d,new Set),y.get(d).add(g),()=>{const E=y.get(d);E&&(E.delete(g),E.size===0&&y.delete(d))}},[]),h=T.useCallback((d,g)=>{for(const[y,E]of o.current)if(Dg(d,y))for(const w of E)try{w(g)}catch{}},[]);return T.useEffect(()=>{const d=pg(),g=No({path:`${Wt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...d?{auth:{token:d}}:{}});return n.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),a(!0)}),g.on("disconnect",y=>{console.log("[lt-socketio] disconnected:",y),a(!1)}),g.on("connect_error",y=>{console.warn("[lt-socketio] connect error:",y.message),a(!1)}),g.onAny((y,E)=>{if(y.startsWith("lt."))try{const w=typeof E=="string"?JSON.parse(E):E;h(y,w)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[h]),m.jsx(hw.Provider,{value:{connected:s,subscribe:f},children:m.jsx(Va.Provider,{value:{connected:s,subscribe:f},children:r})})}function mw({children:r}){const[n,s]=T.useState(null),[a,o]=T.useState({url:null,token:null});return T.useEffect(()=>{let f=!1;async function h(){var d;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Wt}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||s("socketio");return}const y=await g.json(),E=(d=y==null?void 0:y.events)==null?void 0:d.transport;if(console.log("[lt-transport] server reports:",E),!f){if(E==="nats"){let w=y.events.natsWsUrl??null,j=null;const q=pg();if(q)try{const M=await fetch(`${Wt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${q}`}});if(M.ok){const D=await M.json();w=D.natsWsUrl??w,j=D.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}o({url:w,token:j})}s(E==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),f||s("socketio")}}return h(),()=>{f=!0}},[]),n==="nats"?m.jsx(b_,{url:a.url,token:a.token,children:r}):n==="socketio"?m.jsx(dw,{children:r}):m.jsx(m.Fragment,{children:r})}function Qg(){const{isSuperAdmin:r,hasRoleType:n,hasRole:s}=Oi(),a=r||s("engineer"),o=n("admin"),f=r||n("admin");return{isBuilder:a,isOps:o,canBulk:f}}const Jf="lt_ai_override";function pw(){return Ve("/settings")}function Qf(){try{if(localStorage.getItem(Jf)==="off")return!1}catch{}return null}function Ig(){var s;const r=Pn({queryKey:["settings"],queryFn:pw,staleTime:1/0}),n=Qf();return r.data&&n===!1&&((s=r.data.ai)!=null&&s.enabled)?{...r,data:{...r.data,ai:{enabled:!1}}}:r}function gw(){const[r,n]=T.useState(()=>Qf()===!1),s=T.useCallback(()=>{const a=Qf()===!1;try{a?localStorage.removeItem(Jf):localStorage.setItem(Jf,"off")}catch{}n(!a),window.location.reload()},[]);return{aiOverrideActive:r,toggleAIOverride:s}}const Xg=T.createContext(null),L0="lt_sidebar_collapsed";function yw({children:r}){const[n,s]=T.useState(()=>{try{return localStorage.getItem(L0)==="true"}catch{return!1}}),a=T.useCallback(()=>{s(o=>{const f=!o;try{localStorage.setItem(L0,String(f))}catch{}return f})},[]);return m.jsx(Xg.Provider,{value:{collapsed:n,toggle:a},children:r})}function Kg(){const r=T.useContext(Xg);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}function ME(r){const n=r?`?period=${r}`:"";return Pn({queryKey:["escalationStats",r],queryFn:()=>Ve(`/escalations/stats${n}`)})}function RE(){return Pn({queryKey:["escalationTypes"],queryFn:()=>Ve("/escalations/types")})}function bw(r){const{enabled:n=!0,staleTime:s,...a}=r,o=new URLSearchParams;return a.status&&o.set("status",a.status),a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.assigned_to&&o.set("assigned_to",a.assigned_to),a.claimed&&o.set("claimed","true"),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),Pn({queryKey:["escalations",a],queryFn:()=>Ve(`/escalations?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function xw(r){const{enabled:n=!0,staleTime:s,...a}=r,o=new URLSearchParams;return a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),Pn({queryKey:["escalations","available",a],queryFn:()=>Ve(`/escalations/available?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function DE(r){return Pn({queryKey:["escalations","by-workflow",r],queryFn:()=>Ve(`/escalations/by-workflow/${r}`),enabled:!!r})}function zE(r){return Pn({queryKey:["escalations",r],queryFn:()=>Ve(`/escalations/${r}`),enabled:!!r})}function qE(){const r=rn();return _n({mutationFn:({id:n,durationMinutes:s})=>Ve(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function UE(){const r=rn();return _n({mutationFn:n=>Ve(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function BE(){const r=rn();return _n({mutationFn:({id:n,resolverPayload:s})=>Ve(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]}),r.resetQueries({queryKey:["tasks"]}),r.resetQueries({queryKey:["jobs"]})}})}function LE(){const r=rn();return _n({mutationFn:({id:n,targetRole:s})=>Ve(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function HE(){const r=rn();return _n({mutationFn:({ids:n,priority:s})=>Ve("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:n,priority:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function PE(){const r=rn();return _n({mutationFn:({ids:n,durationMinutes:s})=>Ve("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:n,durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function $E(){const r=rn();return _n({mutationFn:({ids:n,targetUserId:s,durationMinutes:a})=>Ve("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:n,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function YE(){const r=rn();return _n({mutationFn:({ids:n,targetRole:s})=>Ve("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:n,targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function GE(){const r=rn();return _n({mutationFn:({ids:n,hint:s})=>Ve("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:n,...s?{hint:s}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function VE(){const r=rn();return _n({mutationFn:n=>Ve(`/escalations/${n}/cancel`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function FE(){const r=rn();return _n({mutationFn:({ids:n})=>Ve("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:n})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function vw(){const{user:r}=Oi(),n=r==null?void 0:r.userId,s=rn(),a=T.useRef(null),o=T.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);p_(`${d_}.system.escalation.>`,o);const{data:f}=xw({limit:1}),{data:h}=bw({assigned_to:n,status:"pending",limit:1});return{available:(f==null?void 0:f.total)??0,mine:(h==null?void 0:h.total)??0}}function hh({size:r="sm",hideLabel:n=!1,className:s=""}){const a=r==="lg",o=a?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",f=a?"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 m.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[m.jsx("img",{src:`${Wt}/logo512.png`,alt:"LongTail",className:`shrink-0 z-0 ${o}`}),m.jsx("span",{className:`z-[1] transition-opacity duration-300 ${f} ${n?"opacity-0":""}`,children:"LongTail"})]})}function _w({onToggleEventFeed:r,onToggleDocs:n}){const{user:s,logout:a}=Oi(),{isBuilder:o}=Qg(),{available:f,mine:h}=vw(),{connected:d}=m_(),{toggleAIOverride:g}=gw(),[y,E]=T.useState(!1),w=T.useRef(null);return T.useEffect(()=>{if(!y)return;const j=q=>{w.current&&!w.current.contains(q.target)&&E(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[y]),m.jsxs("header",{className:"h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between px-5 relative z-30",children:[m.jsx("div",{className:"flex items-center gap-4",children:m.jsx(gr,{to:"/","aria-label":"Home",onClick:j=>{(j.ctrlKey||j.metaKey)&&(j.preventDefault(),g())},children:m.jsx(hh,{})})}),m.jsxs("div",{className:"flex items-center gap-5",children:[m.jsxs(gr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-[11px] transition-colors ${f>0?"text-blue-400 hover:text-blue-300":"text-text-quaternary hover:text-text-secondary"}`,title:"Available escalations",children:[m.jsx(Sf,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"available",f>0&&m.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:f})]}),m.jsxs(gr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-[11px] transition-colors ${h>0?"text-status-warning hover:text-amber-300":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[m.jsx(Sf,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"mine",h>0&&m.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:h})]}),o&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"w-px h-4 bg-surface-border"}),m.jsxs("button",{type:"button",onClick:()=>{d?r==null||r():window.location.reload()},className:`flex items-center gap-1.5 text-[11px] transition-colors ${d?"text-emerald-400 hover:text-emerald-300":"text-text-quaternary hover:text-text-secondary"}`,title:d?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[m.jsx(ug,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]}),m.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 text-[11px] text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[m.jsx(fg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"docs"]})]}),m.jsx("div",{className:"w-px h-4 bg-surface-border"}),s&&m.jsxs("div",{className:"relative",ref:w,children:[m.jsxs("button",{onClick:()=>E(j=>!j),className:"btn-ghost text-xs flex items-center gap-1",children:[m.jsx(Nx,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,m.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),y&&m.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-50",children:[m.jsx(gr,{to:"/credentials",onClick:()=>E(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),m.jsx("button",{onClick:()=>{E(!1),a()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"})]})]})]})]})}function dh({open:r,children:n}){const[s,a]=T.useState(r);return T.useEffect(()=>{r&&a(!0)},[r]),m.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||a(!1)},children:m.jsx("div",{className:"overflow-hidden",children:s?n:null})})}function If(r){return({isActive:n})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${n?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:o}`}}function ww(){return({isActive:r})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${r?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function Sw({group:r,collapsed:n}){const{pathname:s}=Ws(),a=r.matchPaths.some(d=>s.startsWith(d)),[o,f]=T.useState(a),h=o||a;return n?m.jsx(m.Fragment,{children:r.items.map(d=>m.jsx(Co,{to:d.to,className:If(!0),title:d.label,children:d.icon&&m.jsx(d.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},d.to))}):m.jsxs("div",{children:[m.jsxs("button",{onClick:()=>f(d=>!d),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:[m.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),m.jsx("span",{children:r.label})]}),m.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${h?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),m.jsx(dh,{open:h,children:r.items.map(d=>m.jsxs(Co,{to:d.to,end:d.end,className:ww(),children:[d.icon&&m.jsx(d.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),m.jsx("span",{children:d.label})]},d.to))})]})}function Ew(r){return r.kind==="group"}function Aw({entry:r,collapsed:n}){const{pathname:s,search:a}=Ws();if(r.to.includes("?")){const[f,h]=r.to.split("?"),d=s===f&&a===`?${h}`,g=If(n)({isActive:d});return m.jsxs(Co,{to:r.to,className:g,title:n?r.label:void 0,children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&m.jsx("span",{children:r.label})]})}return m.jsxs(Co,{to:r.to,end:r.end,className:If(n),title:n?r.label:void 0,children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&m.jsx("span",{children:r.label})]})}function Or({heading:r,entries:n}){const{collapsed:s}=Kg();return m.jsxs("div",{className:"space-y-1",children:[s?m.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):m.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:r}),n.map(a=>Ew(a)?m.jsx(Sw,{group:a,collapsed:s},a.label):m.jsx(Aw,{entry:a,collapsed:s},a.to))]})}function Ow({aiEnabled:r=!1,isBuilder:n=!1}){if(!n){const a=[{to:"/escalations/queue",label:"My Queue",icon:Sf},{to:"/escalations/available",label:"Available",icon:Ef}];return m.jsx(Or,{heading:"Work",entries:a})}const s=[{to:"/agents",label:r?"Agents":"Automations",icon:Cx},{to:"/topics",label:"Topics",icon:ug},{to:"/capabilities",label:"Capabilities",icon:kx}];return m.jsx(Or,{heading:"React",entries:s})}function jw(){const r=[{kind:"group",label:"Procedural",icon:Mx,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:[{to:"/workflows/registry",label:"Configure",icon:t0},{to:"/workflows/durable/invoke",label:"Invoke",icon:n0},{to:"/workflows/executions",label:"Executions",icon:Ef}]},{kind:"group",label:"Graph",icon:Xf,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:t0,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:n0},{to:"/mcp/executions",label:"Executions",icon:Ef}]}];return m.jsx(Or,{heading:"Orchestrate",entries:r})}const Tw=[{to:"/mcp/queries",label:"Designer",icon:Rx},{to:"/mcp/servers",label:"Servers & Tools",icon:Dx}];function Nw(){return m.jsx(Or,{heading:"Design",entries:Tw})}const Cw=[{to:"/files",label:"Files",icon:zx},{to:"/knowledge",label:"Knowledge",icon:qx}];function kw(){return m.jsx(Or,{heading:"Storage",entries:Cw})}function Mw({isBuilder:r=!1}){const n=[{to:"/admin/users",label:"Accounts",icon:Ux},...r?[{to:"/admin/roles",label:"Roles & Permissions",icon:Bx}]:[]],s=[{kind:"group",label:"Identity & Access",icon:Lx,matchPaths:n.map(a=>a.to),items:n}];return r&&s.push({kind:"group",label:"Infrastructure",icon:Yx,matchPaths:["/admin/controlplane","/admin/streams","/admin/maintenance"],items:[{to:"/admin/controlplane",label:"Routers",icon:Hx},{to:"/admin/streams",label:"Messages",icon:Px},{to:"/admin/maintenance",label:"DB Maintenance",icon:$x}]}),m.jsx(Or,{heading:"Admin",entries:s})}const Zg="lt_event_feed_patterns";function Rw(r){if(r.startsWith("/topics/")){const f=decodeURIComponent(r.replace("/topics/",""));if(f&&!f.includes("/"))return`lt.events.${f}`}const n=r.match(/^\/escalations\/detail\/(.+)/);if(n)return`lt.events.system.escalation.${n[1]}.>`;if(r.startsWith("/escalations"))return"lt.events.system.escalation.>";const s=r.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(r.startsWith("/workflows"))return"lt.events.system.workflow.>";const a=r.match(/^\/agents\/([^/]+)$/);if(a&&a[1]!=="new")return`lt.events.system.agent.${a[1]}.>`;if(r.startsWith("/agents"))return"lt.events.system.agent.>";if(r.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(r.startsWith("/files"))return"lt.events.system.file.>";if(r==="/")return"lt.events.system.>";const o=r.match(/^\/mcp\/executions\/(.+)/);return o?`lt.events.system.*.${o[1]}.>`:(r.startsWith("/mcp"),"lt.events.system.>")}function Dw(){try{const r=localStorage.getItem(Zg);return r?JSON.parse(r):[]}catch{return[]}}function vf(r){try{localStorage.setItem(Zg,JSON.stringify(r))}catch{}}function zw(){const{pathname:r}=Ws(),[n,s]=T.useState(Dw),a=T.useMemo(()=>Rw(r),[r]),o=T.useMemo(()=>{const g=new Set([a,...n]);return Array.from(g)},[a,n]),f=T.useCallback(g=>{const y=g.startsWith("lt.events.")?g:`lt.events.${g}`;s(E=>{if(E.includes(y))return E;const w=[...E,y];return vf(w),w})},[]),h=T.useCallback(g=>{s(y=>{const E=y.filter(w=>w!==g);return vf(E),E})},[]),d=T.useCallback(()=>{s([]),vf([])},[]);return{patterns:o,pagePattern:a,userPatterns:n,addPattern:f,removePattern:h,clearUserPatterns:d}}function qw({children:r,className:n=""}){return m.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:r})}const _f=280,H0="cubic-bezier(0.4, 0, 0.2, 1)",_o=40;function Uw(r){if(!r)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-_o*2,o=s-_o*2,f=r.width/a,h=r.height/o,d=r.left+r.width/2-(_o+a/2),g=r.top+r.height/2-(_o+o/2);return`translate(${d}px, ${g}px) scale(${f}, ${h})`}function Wg({open:r,onClose:n,sourceRef:s,children:a}){const[o,f]=T.useState(null),h=T.useRef(null),d=T.useRef(!1);T.useEffect(()=>{var j,q;r&&!d.current?(h.current=((j=s==null?void 0:s.current)==null?void 0:j.getBoundingClientRect())??null,f("entering")):!r&&d.current&&o==="open"&&(h.current=((q=s==null?void 0:s.current)==null?void 0:q.getBoundingClientRect())??null,f("exiting")),d.current=r},[r,s,o]),T.useEffect(()=>{if(o!=="entering")return;const j=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(j)},[o]),T.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),T.useEffect(()=>{if(!o)return;const j=q=>{q.key==="Escape"&&n()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[o,n]);const g=T.useCallback(j=>{j.propertyName==="transform"&&o==="exiting"&&f(null)},[o]);if(T.useEffect(()=>{if(o!=="exiting")return;const j=setTimeout(()=>f(null),_f+50);return()=>clearTimeout(j)},[o]),!o)return null;const y=o==="entering"||o==="exiting",E=y?Uw(h.current):"none",w=y?0:1;return og.createPortal(m.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${_f}ms ${H0}, opacity ${_f}ms ${H0}`,transform:E,opacity:w,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}function Bw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function Lw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function Hw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.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 Pw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function $w({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.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 Yw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.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 Gw(r){const n=r.trim().split(`
|
|
54
|
-
`);if(n.length<2)return r;const s=
|
|
53
|
+
${m.stack}`),h.reject(y)):h.resolve(E))}});return g.requestSubject=n,this.protocol.publish(n,s,{reply:f,headers:a.headers}),h}else{const f=new Sg(this.protocol.muxSubscriptions,n,a,o);this.protocol.request(f);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:a.headers})}catch(m){f.cancel(m)}const h=Promise.race([f.timer,f.deferred]);return h.catch(()=>{f.cancel()}),h}}flush(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new _t;return n.iterClosed.then(()=>{const s=this.listeners.indexOf(n);this.listeners.splice(s,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const s=new G1(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===ie.NoResponders&&(o.code=ie.JetStreamNotEnabled),o}return s}jetstream(n={}){return new ah(this,n)}getServerVersion(){const n=this.info;return n?Ai(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw ue.errorForCode(ie.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new I1(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):this.protocol.reconnect()}}class I1{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new Ga(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new O1(this.nc,n,s)}}class Q1{constructor(n,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=n,this.prefixLen=s,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Bo)||"PUT"}get length(){const n=this.sm.header.get(Dt.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class X1{constructor(n,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=n,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(th(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Bo))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const n=((s=this.sm.headers)==null?void 0:s.get(Dt.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Rg extends Lv{constructor(s,a,o){super(s.nc,a,o);v(this,"js");v(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const a=fs(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=Ks.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=ft.StartSequence,f.config.opt_start_seq=s;const h={};h.stream_name=this.info.stream,h.config=f.config;const m=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(m,h,{retries:-1}).then(g=>{const y=g,E=this.sub.info;E.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new ue(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,ie.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,o;const s=((o=(a=this.info)==null?void 0:a.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(th(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const f=this.sub,h=m=>{var E,w,O,q;const g=xv(409,`${xn.IdleHeartbeatMissed}: ${m}`,this.sub.subject);if(!((E=this.info)==null?void 0:E.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const M=((O=(w=this.info)==null?void 0:w.ordered_consumer_sequence)==null?void 0:O.stream_seq)||0;return this._resetOrderedConsumer(M+1),(q=this.monitor)==null||q.restart(),!1}return!f.noIterator};this.monitor=new sh(s,h,o)}_checkHbOrderConsumer(s){const a=s.headers.get(Dt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const o=parseInt(s.headers.get(Dt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(o);return s.last=f,f}}class K1 extends Rg{constructor(n,s,a){super(n,s,a)}pull(n={batch:1}){const{stream:s,config:a,name:o}=this.sub.info,f=a.durable_name??o,h={};if(h.batch=n.batch||1,h.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const y=this.js.nc.features.get(Ue.JS_PULL_MAX_BYTES);if(!y.ok)throw new Error(`max_bytes is only supported on servers ${y.min} or better`);h.max_bytes=n.max_bytes}let m=0;n.expires&&n.expires>0&&(m=n.expires,h.expires=nt(m));let g=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(g=n.idle_heartbeat,h.idle_heartbeat=nt(g)),g&&m===0)throw new Error("idle_heartbeat requires expires");if(g>m)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),m&&g&&(this.monitor?this.monitor._change(g,m):this._setupHbMonitoring(g,m));const y=this.info.api,E=`${y.prefix}.CONSUMER.MSG.NEXT.${s}.${f}`,w=this.sub.subject;y.nc.publish(E,y.jc.encode(h),{reply:w})}}}function Z1(r,n){return r?e_(n):W1(n)}function W1(r){return(n,s)=>n?[n,null]:(n=wr(s),n?[n,null]:[null,Pa(s,r)])}function e_(r){return(n,s)=>{if(n)return[n,null];const a=wr(s);return a!==null?[Dg(a),null]:[null,Pa(s,r)]}}function Dg(r){if(r!==null)switch(r.code){case ie.JetStream404NoMessages:case ie.JetStream408RequestTimeout:return null;case ie.JetStream409:return vv(r)?r:null;default:return r}return null}function t_(r){r&&r.ack()}function n_(r){const n=r.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=n[2]==="_"?"":n[2],s.account_hash=n[3],s.stream=n[4],s.consumer=n[5],s.deliveryCount=parseInt(n[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(n[7],10),s.deliverySequence=parseInt(n[8],10),s.timestampNanos=parseInt(n[9],10),s.pending=parseInt(n[10],10),s}class s_{constructor(n,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=n,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=n_(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===ja[0]&&n[1]===ja[1]&&n[2]===ja[2]&&n[3]===ja[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const s=st();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,h=!((a=f.options)!=null&&a.noAsyncTraces),m=new Sg(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},h);f.request(m);try{f.publish(this.msg.reply,R0,{reply:`${f.muxSubscriptions.baseInbox}${m.token}`})}catch(g){m.cancel(g)}try{await Promise.race([m.timer,m.deferred]),s.resolve(!0)}catch(g){m.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(R0)}nak(n){let s=U1;n&&(s=Tf().encode(`-NAK ${JSON.stringify({delay:nt(n)})}`)),this.doAck(s)}working(){this.doAck(ja)}next(n,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=nt(s.expires));const o=kn().encode(a),f=Or.concat(B1,H1,o),h=n?{reply:n}:void 0;this.msg.respond(f,h)}term(n=""){let s=L1;(n==null?void 0:n.length)>0&&(s=Tf().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const i_="1.30.3",r_="nats.ws";class a_{constructor(){v(this,"version");v(this,"lang");v(this,"closeError");v(this,"connected");v(this,"done");v(this,"socket");v(this,"options");v(this,"socketClosed");v(this,"encrypted");v(this,"peeked");v(this,"yields");v(this,"signal");v(this,"closedNotification");this.version=i_,this.lang=r_,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(n,s){const a=st();if(s.tls)return a.reject(new ue("tls",ie.InvalidOption)),a;this.options=s;const o=n.src;if(s.wsFactory){const{socket:f,encrypted:h}=await s.wsFactory(n.src,s);this.socket=f,this.encrypted=h}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const h=Or.concat(...this.yields),m=Vv(h);if(m!==""){const g=x1.exec(m);if(!g){s.debug&&console.error("!!!",po(h)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);y1(y,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(y){a.reject(y);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let h;this.done||(f.wasClean||(h=new Error(f.reason)),this._closed(h))},this.socket.onerror=f=>{if(this.isDiscarded())return;const h=f,m=new ue(h.message,ie.Unknown,new Error(h.error));a.reject(m)},a}disconnect(){this._closed(void 0,!0)}async _closed(n,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Tr(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}s&&this.closedNotification.resolve(n)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const n=this.yields;this.yields=[];for(let s=0;s<n.length;s++)this.options.debug&&console.info(`> ${po(n[s])}`),yield n[s];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${po(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${po(n)}: ${s}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function l_(r,n){/^(.*:\/\/)(.*)/.test(r)||(typeof n=="boolean"?r=`${n===!0?"https":"http"}://${r}`:r=`https://${r}`);let a=new URL(r);const o=a.protocol.toLowerCase();o==="ws:"&&(n=!1),o==="wss:"&&(n=!0),o!=="https:"&&o!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${r}`));let f,h;const m=a.hostname,g=a.pathname,y=a.search||"";switch(o){case"http:":case"ws:":case"nats:":h=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":h=a.port||"443",f="wss:";break;default:h=a.port||n===!0?"443":"80",f=n===!0?"wss:":"ws:";break}return`${f}//${m}:${h}${g}${y}`}function o_(r={}){return Hv({defaultPort:443,urlParseFn:l_,factory:()=>new a_}),lh.connect(r)}const c_=null,u_=null,f_="lt.events";function zg(r,n){const s=r.split("."),a=n.split(".");for(let o=0;o<a.length;o++){const f=a[o];if(f===">")return!0;if(o>=s.length||f!=="*"&&f!==s[o])return!1}return s.length===a.length}const Va=T.createContext({connected:!1,subscribe:()=>()=>{}});function h_(){const{connected:r}=T.useContext(Va);return{connected:r}}function d_(r,n){const{subscribe:s}=T.useContext(Va),a=T.useRef(n);a.current=n,T.useEffect(()=>s(r,f=>a.current(f)),[s,r])}const m_=T.createContext({connected:!1,subscribe:()=>()=>{}}),p_=Tf();function g_({children:r,url:n,token:s}){const a=T.useRef(null),o=T.useRef(null),[f,h]=T.useState(!1),m=T.useRef(null),g=T.useRef(new Map),y=T.useCallback((O,q)=>{const M=g.current;return M.has(O)||M.set(O,new Set),M.get(O).add(q),()=>{const D=M.get(O);D&&(D.delete(q),D.size===0&&M.delete(O))}},[]),E=T.useCallback((O,q)=>{for(const[M,D]of g.current)if(zg(O,M))for(const W of D)try{W(q)}catch{}},[]),w=T.useCallback(async()=>{try{if(a.current)return;const O=n||c_;if(!O){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const q=await o_({servers:O,token:s||u_||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=q,h(!0);const M=q.subscribe("lt.>");o.current=M,(async()=>{for await(const D of M)try{const W=JSON.parse(p_.decode(D.data));E(D.subject,W)}catch{}})(),(async()=>{for await(const D of q.status())D.type==="disconnect"||D.type==="error"?h(!1):D.type==="reconnect"&&h(!0)})()}catch{h(!1),m.current=setTimeout(w,3e3)}},[E]);return T.useEffect(()=>(w(),()=>{m.current&&clearTimeout(m.current),o.current&&o.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),h(!1)}),[w]),d.jsx(m_.Provider,{value:{connected:f,subscribe:y},children:d.jsx(Va.Provider,{value:{connected:f,subscribe:y},children:r})})}const Pn=Object.create(null);Pn.open="0";Pn.close="1";Pn.ping="2";Pn.pong="3";Pn.message="4";Pn.upgrade="5";Pn.noop="6";const jo=Object.create(null);Object.keys(Pn).forEach(r=>{jo[Pn[r]]=r});const $f={type:"error",data:"parser error"},qg=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Ug=typeof ArrayBuffer=="function",Bg=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,oh=({type:r,data:n},s,a)=>qg&&n instanceof Blob?s?a(n):z0(n,a):Ug&&(n instanceof ArrayBuffer||Bg(n))?s?a(n):z0(new Blob([n]),a):a(Pn[r]+(n||"")),z0=(r,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(r)};function q0(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let bf;function y_(r,n){if(qg&&r.data instanceof Blob)return r.data.arrayBuffer().then(q0).then(n);if(Ug&&(r.data instanceof ArrayBuffer||Bg(r.data)))return n(q0(r.data));oh(r,!1,s=>{bf||(bf=new TextEncoder),n(bf.encode(s))})}const U0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ma=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<U0.length;r++)Ma[U0.charCodeAt(r)]=r;const b_=r=>{let n=r.length*.75,s=r.length,a,o=0,f,h,m,g;r[r.length-1]==="="&&(n--,r[r.length-2]==="="&&n--);const y=new ArrayBuffer(n),E=new Uint8Array(y);for(a=0;a<s;a+=4)f=Ma[r.charCodeAt(a)],h=Ma[r.charCodeAt(a+1)],m=Ma[r.charCodeAt(a+2)],g=Ma[r.charCodeAt(a+3)],E[o++]=f<<2|h>>4,E[o++]=(h&15)<<4|m>>2,E[o++]=(m&3)<<6|g&63;return y},x_=typeof ArrayBuffer=="function",ch=(r,n)=>{if(typeof r!="string")return{type:"message",data:Lg(r,n)};const s=r.charAt(0);return s==="b"?{type:"message",data:v_(r.substring(1),n)}:jo[s]?r.length>1?{type:jo[s],data:r.substring(1)}:{type:jo[s]}:$f},v_=(r,n)=>{if(x_){const s=b_(r);return Lg(s,n)}else return{base64:!0,data:r}},Lg=(r,n)=>{switch(n){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},Hg="",__=(r,n)=>{const s=r.length,a=new Array(s);let o=0;r.forEach((f,h)=>{oh(f,!1,m=>{a[h]=m,++o===s&&n(a.join(Hg))})})},w_=(r,n)=>{const s=r.split(Hg),a=[];for(let o=0;o<s.length;o++){const f=ch(s[o],n);if(a.push(f),f.type==="error")break}return a};function S_(){return new TransformStream({transform(r,n){y_(r,s=>{const a=s.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}r.data&&typeof r.data!="string"&&(o[0]|=128),n.enqueue(o),n.enqueue(s)})}})}let xf;function xo(r){return r.reduce((n,s)=>n+s.length,0)}function vo(r,n){if(r[0].length===n)return r.shift();const s=new Uint8Array(n);let a=0;for(let o=0;o<n;o++)s[o]=r[0][a++],a===r[0].length&&(r.shift(),a=0);return r.length&&a<r[0].length&&(r[0]=r[0].slice(a)),s}function E_(r,n){xf||(xf=new TextDecoder);const s=[];let a=0,o=-1,f=!1;return new TransformStream({transform(h,m){for(s.push(h);;){if(a===0){if(xo(s)<1)break;const g=vo(s,1);f=(g[0]&128)===128,o=g[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(xo(s)<2)break;const g=vo(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(xo(s)<8)break;const g=vo(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),E=y.getUint32(0);if(E>Math.pow(2,21)-1){m.enqueue($f);break}o=E*Math.pow(2,32)+y.getUint32(4),a=3}else{if(xo(s)<o)break;const g=vo(s,o);m.enqueue(ch(f?g:xf.decode(g),n)),a=0}if(o===0||o>r){m.enqueue($f);break}}}})}const Pg=4;function gt(r){if(r)return A_(r)}function A_(r){for(var n in gt.prototype)r[n]=gt.prototype[n];return r}gt.prototype.on=gt.prototype.addEventListener=function(r,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(n),this};gt.prototype.once=function(r,n){function s(){this.off(r,s),n.apply(this,arguments)}return s.fn=n,this.on(r,s),this};gt.prototype.off=gt.prototype.removeListener=gt.prototype.removeAllListeners=gt.prototype.removeEventListener=function(r,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+r];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var a,o=0;o<s.length;o++)if(a=s[o],a===n||a.fn===n){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+r],this};gt.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),s=this._callbacks["$"+r],a=1;a<arguments.length;a++)n[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,o=s.length;a<o;++a)s[a].apply(this,n)}return this};gt.prototype.emitReserved=gt.prototype.emit;gt.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};gt.prototype.hasListeners=function(r){return!!this.listeners(r).length};const Jo=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),vn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),j_="arraybuffer";function $g(r,...n){return n.reduce((s,a)=>(r.hasOwnProperty(a)&&(s[a]=r[a]),s),{})}const O_=vn.setTimeout,T_=vn.clearTimeout;function Io(r,n){n.useNativeTimers?(r.setTimeoutFn=O_.bind(vn),r.clearTimeoutFn=T_.bind(vn)):(r.setTimeoutFn=vn.setTimeout.bind(vn),r.clearTimeoutFn=vn.clearTimeout.bind(vn))}const N_=1.33;function C_(r){return typeof r=="string"?k_(r):Math.ceil((r.byteLength||r.size)*N_)}function k_(r){let n=0,s=0;for(let a=0,o=r.length;a<o;a++)n=r.charCodeAt(a),n<128?s+=1:n<2048?s+=2:n<55296||n>=57344?s+=3:(a++,s+=4);return s}function Yg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function M_(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function R_(r){let n={},s=r.split("&");for(let a=0,o=s.length;a<o;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class D_ extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class uh extends gt{constructor(n){super(),this.writable=!1,Io(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,s,a){return super.emitReserved("error",new D_(n,s,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){const s=ch(n,this.socket.binaryType);this.onPacket(s)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,s={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){const s=M_(n);return s.length?"?"+s:""}}class z_ extends uh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";const s=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||s()})),this.writable||(a++,this.once("drain",function(){--a||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){const s=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};w_(n,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,__(n,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Yg()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let Gg=!1;try{Gg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const q_=Gg;function U_(){}class B_ extends z_{constructor(n){if(super(n),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||a!==n.port}}doWrite(n,s){const a=this.request({method:"POST",data:n});a.on("success",s),a.on("error",(o,f)=>{this.onError("xhr post error",o,f)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=n}}class Hn extends gt{constructor(n,s,a){super(),this.createRequest=n,Io(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var n;const s=$g(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(s);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&a.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(n=this._opts.cookieJar)===null||n===void 0||n.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var o;a.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Hn.requestsCount++,Hn.requests[this._index]=this)}_onError(n){this.emitReserved("error",n,this._xhr),this._cleanup(!0)}_cleanup(n){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=U_,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Hn.requests[this._index],this._xhr=null}}_onLoad(){const n=this._xhr.responseText;n!==null&&(this.emitReserved("data",n),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Hn.requestsCount=0;Hn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",B0);else if(typeof addEventListener=="function"){const r="onpagehide"in vn?"pagehide":"unload";addEventListener(r,B0,!1)}}function B0(){for(let r in Hn.requests)Hn.requests.hasOwnProperty(r)&&Hn.requests[r].abort()}const L_=(function(){const r=Vg({xdomain:!1});return r&&r.responseType!==null})();class H_ extends B_{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=L_&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Hn(Vg,this.uri(),n)}}function Vg(r){const n=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||q_))return new XMLHttpRequest}catch{}if(!n)try{return new vn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Fg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class P_ extends uh{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=Fg?{}:$g(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,s,a)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;oh(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}o&&Jo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Yg()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const vf=vn.WebSocket||vn.MozWebSocket;class $_ extends P_{createSocket(n,s,a){return Fg?new vf(n,s,a):s?new vf(n,s):new vf(n)}doWrite(n,s){this.ws.send(s)}}class Y_ extends uh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{const s=E_(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),o=S_();o.readable.pipeTo(n.writable),this._writer=o.writable.getWriter();const f=()=>{a.read().then(({done:m,value:g})=>{m||(this.onPacket(g),f())}).catch(m=>{})};f();const h={type:"open"};this.query.sid&&(h.data=`{"sid":"${this.query.sid}"}`),this._writer.write(h).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;this._writer.write(a).then(()=>{o&&Jo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const G_={websocket:$_,webtransport:Y_,polling:H_},V_=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,F_=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Yf(r){if(r.length>8e3)throw"URI too long";const n=r,s=r.indexOf("["),a=r.indexOf("]");s!=-1&&a!=-1&&(r=r.substring(0,s)+r.substring(s,a).replace(/:/g,";")+r.substring(a,r.length));let o=V_.exec(r||""),f={},h=14;for(;h--;)f[F_[h]]=o[h]||"";return s!=-1&&a!=-1&&(f.source=n,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=J_(f,f.path),f.queryKey=I_(f,f.query),f}function J_(r,n){const s=/\/{2,9}/g,a=n.replace(s,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&a.splice(0,1),n.slice(-1)=="/"&&a.splice(a.length-1,1),a}function I_(r,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,f){o&&(s[o]=f)}),s}const Gf=typeof addEventListener=="function"&&typeof removeEventListener=="function",Oo=[];Gf&&addEventListener("offline",()=>{Oo.forEach(r=>r())},!1);class Xs extends gt{constructor(n,s){if(super(),this.binaryType=j_,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,n&&typeof n=="object"&&(s=n,n=null),n){const a=Yf(n);s.hostname=a.host,s.secure=a.protocol==="https"||a.protocol==="wss",s.port=a.port,a.query&&(s.query=a.query)}else s.host&&(s.hostname=Yf(s.host).host);Io(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(a=>{const o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=R_(this.opts.query)),Gf&&(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"})},Oo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=Pg,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&Xs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Xs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(s+=C_(o)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,Jo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,s,a){return this._sendPacket("message",n,s,a),this}send(n,s,a){return this._sendPacket("message",n,s,a),this}_sendPacket(n,s,a,o){if(typeof s=="function"&&(o=s,s=void 0),typeof a=="function"&&(o=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:n,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),o&&this.once("flush",o),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():n()}):this.upgrading?a():n()),this}_onError(n){if(Xs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Gf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=Oo.indexOf(this._offlineEventListener);a!==-1&&Oo.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}Xs.protocol=Pg;class Q_ extends Xs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;Xs.priorWebsocketSuccess=!1;const o=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",w=>{if(!a)if(w.type==="pong"&&w.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Xs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(E(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const O=new Error("probe error");O.transport=s.name,this.emitReserved("upgradeError",O)}}))};function f(){a||(a=!0,E(),s.close(),s=null)}const h=w=>{const O=new Error("probe error: "+w);O.transport=s.name,f(),this.emitReserved("upgradeError",O)};function m(){h("transport closed")}function g(){h("socket closed")}function y(w){s&&w.name!==s.name&&f()}const E=()=>{s.removeListener("open",o),s.removeListener("error",h),s.removeListener("close",m),this.off("close",g),this.off("upgrading",y)};s.once("open",o),s.once("error",h),s.once("close",m),this.once("close",g),this.once("upgrading",y),this._upgrades.indexOf("webtransport")!==-1&&n!=="webtransport"?this.setTimeoutFn(()=>{a||s.open()},200):s.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){const s=[];for(let a=0;a<n.length;a++)~this.transports.indexOf(n[a])&&s.push(n[a]);return s}}let X_=class extends Q_{constructor(n,s={}){const a=typeof n=="object"?n:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(o=>G_[o]).filter(o=>!!o)),super(n,a)}};function K_(r,n="",s){let a=r;s=s||typeof location<"u"&&location,r==null&&(r=s.protocol+"//"+s.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=s.protocol+r:r=s.host+r),/^(https?|wss?):\/\//.test(r)||(typeof s<"u"?r=s.protocol+"//"+r:r="https://"+r),a=Yf(r)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+n,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const Z_=typeof ArrayBuffer=="function",W_=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Jg=Object.prototype.toString,ew=typeof Blob=="function"||typeof Blob<"u"&&Jg.call(Blob)==="[object BlobConstructor]",tw=typeof File=="function"||typeof File<"u"&&Jg.call(File)==="[object FileConstructor]";function fh(r){return Z_&&(r instanceof ArrayBuffer||W_(r))||ew&&r instanceof Blob||tw&&r instanceof File}function To(r,n){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,a=r.length;s<a;s++)if(To(r[s]))return!0;return!1}if(fh(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return To(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&To(r[s]))return!0;return!1}function nw(r){const n=[],s=r.data,a=r;return a.data=Vf(s,n),a.attachments=n.length,{packet:a,buffers:n}}function Vf(r,n){if(!r)return r;if(fh(r)){const s={_placeholder:!0,num:n.length};return n.push(r),s}else if(Array.isArray(r)){const s=new Array(r.length);for(let a=0;a<r.length;a++)s[a]=Vf(r[a],n);return s}else if(typeof r=="object"&&!(r instanceof Date)){const s={};for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[a]=Vf(r[a],n));return s}return r}function sw(r,n){return r.data=Ff(r.data,n),delete r.attachments,r}function Ff(r,n){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<n.length)return n[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=Ff(r[s],n);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=Ff(r[s],n));return r}const iw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var qe;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(qe||(qe={}));class rw{constructor(n){this.replacer=n}encode(n){return(n.type===qe.EVENT||n.type===qe.ACK)&&To(n)?this.encodeAsBinary({type:n.type===qe.EVENT?qe.BINARY_EVENT:qe.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===qe.BINARY_EVENT||n.type===qe.BINARY_ACK)&&(s+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(s+=n.nsp+","),n.id!=null&&(s+=n.id),n.data!=null&&(s+=JSON.stringify(n.data,this.replacer)),s}encodeAsBinary(n){const s=nw(n),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class hh extends gt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let s;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(n);const a=s.type===qe.BINARY_EVENT;a||s.type===qe.BINARY_ACK?(s.type=a?qe.EVENT:qe.ACK,this.reconstructor=new aw(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(fh(n)||n.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(n),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let s=0;const a={type:Number(n.charAt(0))};if(qe[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===qe.BINARY_EVENT||a.type===qe.BINARY_ACK){const f=s+1;for(;n.charAt(++s)!=="-"&&s!=n.length;);const h=n.substring(f,s);if(h!=Number(h)||n.charAt(s)!=="-")throw new Error("Illegal attachments");const m=Number(h);if(!lw(m)||m<0)throw new Error("Illegal attachments");if(m>this.opts.maxAttachments)throw new Error("too many attachments");a.attachments=m}if(n.charAt(s+1)==="/"){const f=s+1;for(;++s&&!(n.charAt(s)===","||s===n.length););a.nsp=n.substring(f,s)}else a.nsp="/";const o=n.charAt(s+1);if(o!==""&&Number(o)==o){const f=s+1;for(;++s;){const h=n.charAt(s);if(h==null||Number(h)!=h){--s;break}if(s===n.length)break}a.id=Number(n.substring(f,s+1))}if(n.charAt(++s)){const f=this.tryParse(n.substr(s));if(hh.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,s){switch(n){case qe.CONNECT:return L0(s);case qe.DISCONNECT:return s===void 0;case qe.CONNECT_ERROR:return typeof s=="string"||L0(s);case qe.EVENT:case qe.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&iw.indexOf(s[0])===-1);case qe.ACK:case qe.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class aw{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){const s=sw(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const lw=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function L0(r){return Object.prototype.toString.call(r)==="[object Object]"}const ow=Object.freeze(Object.defineProperty({__proto__:null,Decoder:hh,Encoder:rw,get PacketType(){return qe}},Symbol.toStringTag,{value:"Module"}));function Nn(r,n,s){return r.on(n,s),function(){r.off(n,s)}}const cw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ig extends gt{constructor(n,s,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[Nn(n,"open",this.onopen.bind(this)),Nn(n,"packet",this.onpacket.bind(this)),Nn(n,"error",this.onerror.bind(this)),Nn(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...s){var a,o,f;if(cw.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(s.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const h={type:qe.EVENT,data:s};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const E=this.ids++,w=s.pop();this._registerAckCallback(E,w),h.id=E}const m=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!m||(g?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h)),this.flags={},this}_registerAckCallback(n,s){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[n]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let m=0;m<this.sendBuffer.length;m++)this.sendBuffer[m].id===n&&this.sendBuffer.splice(m,1);s.call(this,new Error("operation has timed out"))},o),h=(...m)=>{this.io.clearTimeoutFn(f),s.apply(this,m)};h.withError=!0,this.acks[n]=h}emitWithAck(n,...s){return new Promise((a,o)=>{const f=(h,m)=>h?o(h):a(m);f.withError=!0,s.push(f),this.emit(n,...s)})}_addToQueue(n){let s;typeof n[n.length-1]=="function"&&(s=n.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((o,...f)=>(this._queue[0],o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...f)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!n||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:qe.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(a=>String(a.id)===n)){const a=this.acks[n];delete this.acks[n],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case qe.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case qe.EVENT:case qe.BINARY_EVENT:this.onevent(n);break;case qe.ACK:case qe.BINARY_ACK:this.onack(n);break;case qe.DISCONNECT:this.ondisconnect();break;case qe.CONNECT_ERROR:this.destroy();const a=new Error(n.data.message);a.data=n.data.data,this.emitReserved("connect_error",a);break}}onevent(n){const s=n.data||[];n.id!=null&&s.push(this.ack(n.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const s=this;let a=!1;return function(...o){a||(a=!0,s.packet({type:qe.ACK,id:n,data:o}))}}onack(n){const s=this.acks[n.id];typeof s=="function"&&(delete this.acks[n.id],s.withError&&n.data.unshift(null),s.apply(this,n.data))}onconnect(n,s){this.id=n,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:qe.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,n.data)}}}function Nr(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Nr.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),s=Math.floor(n*this.jitter*r);r=(Math.floor(n*10)&1)==0?r-s:r+s}return Math.min(r,this.max)|0};Nr.prototype.reset=function(){this.attempts=0};Nr.prototype.setMin=function(r){this.ms=r};Nr.prototype.setMax=function(r){this.max=r};Nr.prototype.setJitter=function(r){this.jitter=r};class Jf extends gt{constructor(n,s){var a;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(s=n,n=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Io(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((a=s.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new Nr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=n;const o=s.parser||ow;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var s;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(s=this.backoff)===null||s===void 0||s.setMin(n),this)}randomizationFactor(n){var s;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(s=this.backoff)===null||s===void 0||s.setJitter(n),this)}reconnectionDelayMax(n){var s;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(s=this.backoff)===null||s===void 0||s.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new X_(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=Nn(s,"open",function(){a.onopen(),n&&n()}),f=m=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",m),n?n(m):this.maybeReconnectOnOpen()},h=Nn(s,"error",f);if(this._timeout!==!1){const m=this._timeout,g=this.setTimeoutFn(()=>{o(),f(new Error("timeout")),s.close()},m);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(h),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push(Nn(n,"ping",this.onping.bind(this)),Nn(n,"data",this.ondata.bind(this)),Nn(n,"error",this.onerror.bind(this)),Nn(n,"close",this.onclose.bind(this)),Nn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(s){this.onclose("parse error",s)}}ondecoded(n){Jo(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,s){let a=this.nsps[n];return a?this._autoConnect&&!a.active&&a.connect():(a=new Ig(this,n,s),this.nsps[n]=a),a}_destroy(n){const s=Object.keys(this.nsps);for(const a of s)if(this.nsps[a].active)return;this._close()}_packet(n){const s=this.encoder.encode(n);for(let a=0;a<s.length;a++)this.engine.write(s[a],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,s){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const n=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(o=>{o?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",o)):n.onreconnect()}))},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}}const Oa={};function No(r,n){typeof r=="object"&&(n=r,r=void 0),n=n||{};const s=K_(r,n.path||"/socket.io"),a=s.source,o=s.id,f=s.path,h=Oa[o]&&f in Oa[o].nsps,m=n.forceNew||n["force new connection"]||n.multiplex===!1||h;let g;return m?g=new Jf(a,n):(Oa[o]||(Oa[o]=new Jf(a,n)),g=Oa[o]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(No,{Manager:Jf,Socket:Ig,io:No,connect:No});const uw=T.createContext({connected:!1,subscribe:()=>()=>{}});function fw({children:r}){const n=T.useRef(null),[s,a]=T.useState(!1),o=T.useRef(new Map),f=T.useCallback((m,g)=>{const y=o.current;return y.has(m)||y.set(m,new Set),y.get(m).add(g),()=>{const E=y.get(m);E&&(E.delete(g),E.size===0&&y.delete(m))}},[]),h=T.useCallback((m,g)=>{for(const[y,E]of o.current)if(zg(m,y))for(const w of E)try{w(g)}catch{}},[]);return T.useEffect(()=>{const m=gg(),g=No({path:`${Wt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...m?{auth:{token:m}}:{}});return n.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),a(!0)}),g.on("disconnect",y=>{console.log("[lt-socketio] disconnected:",y),a(!1)}),g.on("connect_error",y=>{console.warn("[lt-socketio] connect error:",y.message),a(!1)}),g.onAny((y,E)=>{if(y.startsWith("lt."))try{const w=typeof E=="string"?JSON.parse(E):E;h(y,w)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[h]),d.jsx(uw.Provider,{value:{connected:s,subscribe:f},children:d.jsx(Va.Provider,{value:{connected:s,subscribe:f},children:r})})}function hw({children:r}){const[n,s]=T.useState(null),[a,o]=T.useState({url:null,token:null});return T.useEffect(()=>{let f=!1;async function h(){var m;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Wt}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||s("socketio");return}const y=await g.json(),E=(m=y==null?void 0:y.events)==null?void 0:m.transport;if(console.log("[lt-transport] server reports:",E),!f){if(E==="nats"){let w=y.events.natsWsUrl??null,O=null;const q=gg();if(q)try{const M=await fetch(`${Wt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${q}`}});if(M.ok){const D=await M.json();w=D.natsWsUrl??w,O=D.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}o({url:w,token:O})}s(E==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),f||s("socketio")}}return h(),()=>{f=!0}},[]),n==="nats"?d.jsx(g_,{url:a.url,token:a.token,children:r}):n==="socketio"?d.jsx(fw,{children:r}):d.jsx(d.Fragment,{children:r})}function Qg(){const{isSuperAdmin:r,hasRoleType:n,hasRole:s}=Oi(),a=r||s("engineer"),o=n("admin"),f=r||n("admin");return{isBuilder:a,isOps:o,canBulk:f}}const If="lt_ai_override";function dw(){return Ve("/settings")}function Qf(){try{if(localStorage.getItem(If)==="off")return!1}catch{}return null}function Qo(){var s;const r=$n({queryKey:["settings"],queryFn:dw,staleTime:1/0}),n=Qf();return r.data&&n===!1&&((s=r.data.ai)!=null&&s.enabled)?{...r,data:{...r.data,ai:{enabled:!1}}}:r}function mw(){const[r,n]=T.useState(()=>Qf()===!1),s=T.useCallback(()=>{const a=Qf()===!1;try{a?localStorage.removeItem(If):localStorage.setItem(If,"off")}catch{}n(!a),window.location.reload()},[]);return{aiOverrideActive:r,toggleAIOverride:s}}const Xg=T.createContext(null),H0="lt_sidebar_collapsed";function pw({children:r}){const[n,s]=T.useState(()=>{try{return localStorage.getItem(H0)==="true"}catch{return!1}}),a=T.useCallback(()=>{s(o=>{const f=!o;try{localStorage.setItem(H0,String(f))}catch{}return f})},[]);return d.jsx(Xg.Provider,{value:{collapsed:n,toggle:a},children:r})}function Kg(){const r=T.useContext(Xg);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}function kE(r){const n=r?`?period=${r}`:"";return $n({queryKey:["escalationStats",r],queryFn:()=>Ve(`/escalations/stats${n}`)})}function ME(){return $n({queryKey:["escalationTypes"],queryFn:()=>Ve("/escalations/types")})}function gw(r){const{enabled:n=!0,staleTime:s,...a}=r,o=new URLSearchParams;return a.status&&o.set("status",a.status),a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.assigned_to&&o.set("assigned_to",a.assigned_to),a.claimed&&o.set("claimed","true"),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),a.search&&o.set("search",a.search),$n({queryKey:["escalations",a],queryFn:()=>Ve(`/escalations?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function yw(r){const{enabled:n=!0,staleTime:s,...a}=r,o=new URLSearchParams;return a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),a.search&&o.set("search",a.search),$n({queryKey:["escalations","available",a],queryFn:()=>Ve(`/escalations/available?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function RE(r){return $n({queryKey:["escalations","by-workflow",r],queryFn:()=>Ve(`/escalations/by-workflow/${r}`),enabled:!!r})}function DE(r){return $n({queryKey:["escalations",r],queryFn:()=>Ve(`/escalations/${r}`),enabled:!!r})}function zE(){const r=rn();return _n({mutationFn:({id:n,durationMinutes:s})=>Ve(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function qE(){const r=rn();return _n({mutationFn:n=>Ve(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function UE(){const r=rn();return _n({mutationFn:({id:n,resolverPayload:s})=>Ve(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]}),r.resetQueries({queryKey:["tasks"]}),r.resetQueries({queryKey:["jobs"]})}})}function BE(){const r=rn();return _n({mutationFn:({id:n,targetRole:s})=>Ve(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function LE(){const r=rn();return _n({mutationFn:({ids:n,priority:s})=>Ve("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:n,priority:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function HE(){const r=rn();return _n({mutationFn:({ids:n,durationMinutes:s})=>Ve("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:n,durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function PE(){const r=rn();return _n({mutationFn:({ids:n,targetUserId:s,durationMinutes:a})=>Ve("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:n,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function $E(){const r=rn();return _n({mutationFn:({ids:n,targetRole:s})=>Ve("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:n,targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function YE(){const r=rn();return _n({mutationFn:({ids:n,hint:s})=>Ve("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:n,...s?{hint:s}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function GE(){const r=rn();return _n({mutationFn:n=>Ve(`/escalations/${n}/cancel`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function VE(){const r=rn();return _n({mutationFn:({ids:n})=>Ve("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:n})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function bw(){const{user:r}=Oi(),n=r==null?void 0:r.userId,s=rn(),a=T.useRef(null),o=T.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);d_(`${f_}.system.escalation.>`,o);const{data:f}=yw({limit:1}),{data:h}=gw({assigned_to:n,status:"pending",limit:1});return{available:(f==null?void 0:f.total)??0,mine:(h==null?void 0:h.total)??0}}function dh({size:r="sm",hideLabel:n=!1,className:s=""}){const a=r==="lg",o=a?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",f=a?"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 d.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[d.jsx("img",{src:`${Wt}/logo512.png`,alt:"LongTail",className:`shrink-0 z-0 ${o}`}),d.jsx("span",{className:`z-[1] transition-opacity duration-300 ${f} ${n?"opacity-0":""}`,children:"LongTail"})]})}function xw({onToggleEventFeed:r,onToggleDocs:n}){const{user:s,logout:a}=Oi(),{isBuilder:o}=Qg(),{available:f,mine:h}=bw(),{connected:m}=h_(),{toggleAIOverride:g}=mw(),[y,E]=T.useState(!1),w=T.useRef(null);return T.useEffect(()=>{if(!y)return;const O=q=>{w.current&&!w.current.contains(q.target)&&E(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[y]),d.jsxs("header",{className:"h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between px-5 relative z-30",children:[d.jsx("div",{className:"flex items-center gap-4",children:d.jsx(yr,{to:"/","aria-label":"Home",onClick:O=>{(O.ctrlKey||O.metaKey)&&(O.preventDefault(),g())},children:d.jsx(dh,{})})}),d.jsxs("div",{className:"flex items-center gap-5",children:[d.jsxs(yr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-[11px] transition-colors ${f>0?"text-blue-400 hover:text-blue-300":"text-text-quaternary hover:text-text-secondary"}`,title:"Available escalations",children:[d.jsx(Ef,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"available",f>0&&d.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:f})]}),d.jsxs(yr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-[11px] transition-colors ${h>0?"text-status-warning hover:text-amber-300":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[d.jsx(Ef,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"mine",h>0&&d.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:h})]}),o&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"w-px h-4 bg-surface-border"}),d.jsxs("button",{type:"button",onClick:()=>{m?r==null||r():window.location.reload()},className:`flex items-center gap-1.5 text-[11px] transition-colors ${m?"text-emerald-400 hover:text-emerald-300":"text-text-quaternary hover:text-text-secondary"}`,title:m?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[d.jsx(fg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]}),d.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 text-[11px] text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[d.jsx(hg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"docs"]})]}),d.jsx("div",{className:"w-px h-4 bg-surface-border"}),s&&d.jsxs("div",{className:"relative",ref:w,children:[d.jsxs("button",{onClick:()=>E(O=>!O),className:"btn-ghost text-xs flex items-center gap-1",children:[d.jsx(Nx,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,d.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),y&&d.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-50",children:[d.jsx(yr,{to:"/credentials",onClick:()=>E(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),d.jsx("button",{onClick:()=>{E(!1),a()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"})]})]})]})]})}function mh({open:r,children:n}){const[s,a]=T.useState(r);return T.useEffect(()=>{r&&a(!0)},[r]),d.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||a(!1)},children:d.jsx("div",{className:"overflow-hidden",children:s?n:null})})}function Xf(r){return({isActive:n})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${n?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:o}`}}function vw(){return({isActive:r})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${r?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function _w({group:r,collapsed:n}){const{pathname:s}=Ws(),a=r.matchPaths.some(m=>s.startsWith(m)),[o,f]=T.useState(a),h=o||a;return n?d.jsx(d.Fragment,{children:r.items.map(m=>d.jsx(Co,{to:m.to,className:Xf(!0),title:m.label,children:m.icon&&d.jsx(m.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},m.to))}):d.jsxs("div",{children:[d.jsxs("button",{onClick:()=>f(m=>!m),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[d.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&d.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),d.jsx("span",{children:r.label})]}),d.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${h?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),d.jsx(mh,{open:h,children:r.items.map(m=>d.jsxs(Co,{to:m.to,end:m.end,className:vw(),children:[m.icon&&d.jsx(m.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),d.jsx("span",{children:m.label})]},m.to))})]})}function ww(r){return r.kind==="group"}function Sw({entry:r,collapsed:n}){const{pathname:s,search:a}=Ws();if(r.to.includes("?")){const[f,h]=r.to.split("?"),m=s===f&&a===`?${h}`,g=Xf(n)({isActive:m});return d.jsxs(Co,{to:r.to,className:g,title:n?r.label:void 0,children:[r.icon&&d.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&d.jsx("span",{children:r.label})]})}return d.jsxs(Co,{to:r.to,end:r.end,className:Xf(n),title:n?r.label:void 0,children:[r.icon&&d.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&d.jsx("span",{children:r.label})]})}function ji({heading:r,entries:n}){const{collapsed:s}=Kg();return d.jsxs("div",{className:"space-y-1",children:[s?d.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):d.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:r}),n.map(a=>ww(a)?d.jsx(_w,{group:a,collapsed:s},a.label):d.jsx(Sw,{entry:a,collapsed:s},a.to))]})}function Ew({aiEnabled:r=!1,isBuilder:n=!1}){if(!n){const a=[{to:"/escalations/queue",label:"My Queue",icon:Ef},{to:"/escalations/available",label:"Available",icon:Af}];return d.jsx(ji,{heading:"Work",entries:a})}const s=[{to:"/agents",label:r?"Agents":"Automations",icon:Cx},{to:"/topics",label:"Topics",icon:fg},{to:"/capabilities",label:"Capabilities",icon:kx}];return d.jsx(ji,{heading:"React",entries:s})}function Aw(){const r=[{kind:"group",label:"Procedural",icon:Mx,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:[{to:"/workflows/registry",label:"Configure",icon:n0},{to:"/workflows/durable/invoke",label:"Invoke",icon:s0},{to:"/workflows/executions",label:"Executions",icon:Af}]},{kind:"group",label:"Graph",icon:Kf,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:n0,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:s0},{to:"/mcp/executions",label:"Executions",icon:Af}]}];return d.jsx(ji,{heading:"Orchestrate",entries:r})}const jw=[{to:"/mcp/queries",label:"Designer",icon:Rx},{to:"/mcp/servers",label:"Servers & Tools",icon:Dx}];function Ow(){return d.jsx(ji,{heading:"Design",entries:jw})}const Tw=[{to:"/files",label:"Files",icon:zx},{to:"/knowledge",label:"Knowledge",icon:qx}];function Nw(){return d.jsx(ji,{heading:"Storage",entries:Tw})}function Cw({isBuilder:r=!1}){var f;const{data:n}=Qo(),s=((f=n==null?void 0:n.features)==null?void 0:f.dbMaintenance)!==!1,a=[{to:"/admin/users",label:"Accounts",icon:Ux},...r?[{to:"/admin/roles",label:"Roles & Permissions",icon:Bx}]:[]],o=[{to:"/admin/controlplane",label:"Routers",icon:Lx},{to:"/admin/streams",label:"Messages",icon:Hx},...s?[{to:"/admin/maintenance",label:"DB Maintenance",icon:Px}]:[]];return d.jsxs(d.Fragment,{children:[d.jsx(ji,{heading:"Identity & Access",entries:a}),r&&d.jsx(ji,{heading:"Infrastructure",entries:o})]})}const Zg="lt_event_feed_patterns";function kw(r){if(r.startsWith("/topics/")){const f=decodeURIComponent(r.replace("/topics/",""));if(f&&!f.includes("/"))return`lt.events.${f}`}const n=r.match(/^\/escalations\/detail\/(.+)/);if(n)return`lt.events.system.escalation.${n[1]}.>`;if(r.startsWith("/escalations"))return"lt.events.system.escalation.>";const s=r.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(r.startsWith("/workflows"))return"lt.events.system.workflow.>";const a=r.match(/^\/agents\/([^/]+)$/);if(a&&a[1]!=="new")return`lt.events.system.agent.${a[1]}.>`;if(r.startsWith("/agents"))return"lt.events.system.agent.>";if(r.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(r.startsWith("/files"))return"lt.events.system.file.>";if(r==="/")return"lt.events.system.>";const o=r.match(/^\/mcp\/executions\/(.+)/);return o?`lt.events.system.*.${o[1]}.>`:(r.startsWith("/mcp"),"lt.events.system.>")}function Mw(){try{const r=localStorage.getItem(Zg);return r?JSON.parse(r):[]}catch{return[]}}function _f(r){try{localStorage.setItem(Zg,JSON.stringify(r))}catch{}}function Rw(){const{pathname:r}=Ws(),[n,s]=T.useState(Mw),a=T.useMemo(()=>kw(r),[r]),o=T.useMemo(()=>{const g=new Set([a,...n]);return Array.from(g)},[a,n]),f=T.useCallback(g=>{const y=g.startsWith("lt.events.")?g:`lt.events.${g}`;s(E=>{if(E.includes(y))return E;const w=[...E,y];return _f(w),w})},[]),h=T.useCallback(g=>{s(y=>{const E=y.filter(w=>w!==g);return _f(E),E})},[]),m=T.useCallback(()=>{s([]),_f([])},[]);return{patterns:o,pagePattern:a,userPatterns:n,addPattern:f,removePattern:h,clearUserPatterns:m}}function Dw({children:r,className:n=""}){return d.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:r})}const wf=280,P0="cubic-bezier(0.4, 0, 0.2, 1)",_o=40;function zw(r){if(!r)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-_o*2,o=s-_o*2,f=r.width/a,h=r.height/o,m=r.left+r.width/2-(_o+a/2),g=r.top+r.height/2-(_o+o/2);return`translate(${m}px, ${g}px) scale(${f}, ${h})`}function Wg({open:r,onClose:n,sourceRef:s,children:a}){const[o,f]=T.useState(null),h=T.useRef(null),m=T.useRef(!1);T.useEffect(()=>{var O,q;r&&!m.current?(h.current=((O=s==null?void 0:s.current)==null?void 0:O.getBoundingClientRect())??null,f("entering")):!r&&m.current&&o==="open"&&(h.current=((q=s==null?void 0:s.current)==null?void 0:q.getBoundingClientRect())??null,f("exiting")),m.current=r},[r,s,o]),T.useEffect(()=>{if(o!=="entering")return;const O=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(O)},[o]),T.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),T.useEffect(()=>{if(!o)return;const O=q=>{q.key==="Escape"&&n()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[o,n]);const g=T.useCallback(O=>{O.propertyName==="transform"&&o==="exiting"&&f(null)},[o]);if(T.useEffect(()=>{if(o!=="exiting")return;const O=setTimeout(()=>f(null),wf+50);return()=>clearTimeout(O)},[o]),!o)return null;const y=o==="entering"||o==="exiting",E=y?zw(h.current):"none",w=y?0:1;return cg.createPortal(d.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${wf}ms ${P0}, opacity ${wf}ms ${P0}`,transform:E,opacity:w,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}function qw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function Uw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function Bw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.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 Lw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function Hw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.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 Pw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.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 $w(r){const n=r.trim().split(`
|
|
54
|
+
`);if(n.length<2)return r;const s=m=>m.split("|").map(g=>g.trim()).filter(Boolean),a=s(n[0]),o=n.slice(2),f=a.map(m=>`<th class="px-3 py-1.5 text-left text-[10px] font-semibold uppercase tracking-wider text-text-tertiary">${m}</th>`).join(""),h=o.map(m=>`<tr class="border-t border-surface-border">${s(m).map(E=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${E}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${f}</tr></thead><tbody>${h}</tbody></table>`}function wo(r){return r.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function Yw(r){const n=[];let s=r.replace(/```(\w*)\n([\s\S]*?)```/g,(g,y,E)=>{const w=n.length;return n.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-[11px] leading-relaxed"><code>${E}</code></pre>`),`\0CODE${w}\0`});const a=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(a,(g,y,E,w)=>$w(`${y}
|
|
55
55
|
${E}
|
|
56
|
-
${w.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${wo(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${wo(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${wo(y)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${y}</h2>`).replace(/^# (.+)$/gm,(g,y)=>`<h1 id="${wo(y)}" class="text-lg font-bold text-text-primary mb-3">${y}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const y=g.replace(/^> /gm,"").trim(),E=/⚠️|warning|caution/i.test(y),w=/note:|ℹ️|info/i.test(y);return`<div class="${E?"bg-status-warning/5":w?"bg-accent/5":"bg-surface-sunken/50"} ${E?"border-status-warning":w?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(f('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,y)=>n[parseInt(y,10)]);const h="text-xs leading-relaxed text-text-secondary mb-2",d=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const y=g.trim();if(!y)return"";const E=[];let w=y,j;for(;(j=d.exec(w))!==null;){const q=j.index+j[0].length;E.push(w.slice(0,q)),w=w.slice(q).replace(/^<br\/>/,"").trim(),d.lastIndex=0}return w&&E.push(w),E.map(q=>{const M=q.trim();return M?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(M)?M:`<p class="${h}">${M}</p>`:""}).join("")}).join(""),s}const Fw=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function Jw(r){return Fw.test(r)}function mh({content:r,className:n,onClick:s}){const a=T.useMemo(()=>Vw(r),[r]);return m.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function Lo({data:r,depth:n=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,h]=T.useState(o),[d,g]=T.useState(s);if(s!==void 0&&s!==d&&(g(s),h(s%2===0&&n>0)),r==null)return m.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return m.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return m.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?m.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?m.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),m.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((y,E)=>m.jsxs("div",{children:[m.jsx(Lo,{data:y,depth:n+1,generation:s}),E<r.length-1&&m.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),m.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const y=Object.entries(r);return y.length===0?m.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?m.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),m.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([E,w],j)=>m.jsxs("div",{children:[m.jsx("span",{className:"text-text-secondary",children:E}),m.jsx("span",{className:"text-text-tertiary",children:": "}),m.jsx(Lo,{data:w,depth:n+1,generation:s}),j<y.length-1&&m.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),m.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return m.jsx("span",{children:String(r)})}function Ua({data:r,depth:n=0}){if(r==null)return m.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&Jw(r)?m.jsx(mh,{content:r}):m.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return m.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?m.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):m.jsx("div",{className:"space-y-2",children:r.map((s,a)=>m.jsxs("div",{className:"flex items-baseline gap-2",children:[m.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),m.jsx("div",{className:"flex-1",children:m.jsx(Ua,{data:s,depth:n+1})})]},a))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?m.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):m.jsx("div",{className:n>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,o])=>{const f=o===null||typeof o!="object";return m.jsxs("div",{children:[m.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?m.jsx("p",{className:"text-sm text-text-primary",children:m.jsx(Ua,{data:o,depth:n+1})}):m.jsx(Ua,{data:o,depth:n+1})]},a)})})}return m.jsx("span",{children:String(r)})}function P0({mode:r,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:o,copied:f,onFullscreen:h,onClose:d,large:g}){const y=g?"w-5 h-5":"w-3.5 h-3.5",E=`${g?"p-2":"p-1.5"} rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150`;return m.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&m.jsx("button",{onClick:a,className:E,title:s?"Expand all":"Collapse all",children:s?m.jsx(Yw,{className:y}):m.jsx($w,{className:y})}),m.jsx("button",{onClick:()=>n(r==="json"?"tree":"json"),className:E,title:r==="json"?"Outline view":"JSON view",children:r==="json"?m.jsx(Bw,{className:y}):m.jsx(Lw,{className:y})}),m.jsx("button",{onClick:o,className:E,title:"Copy to clipboard",children:f?m.jsx(Pw,{className:`${y} text-status-success`}):m.jsx(Hw,{className:y})}),h&&m.jsx("button",{onClick:h,className:E,title:"Fullscreen",children:m.jsx(hg,{className:y})}),d&&m.jsx("button",{onClick:d,className:E,title:"Close (Esc)",children:m.jsx(dg,{className:y})})]})}function Qw({data:r,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:o}){const f=T.useRef(null),[h,d]=T.useState(o??"json"),[g,y]=T.useState(!1),[E,w]=T.useState(!1),[j,q]=T.useState(a?0:1),[M,D]=T.useState(1),W=j%2===0,se=M%2===0,ee=T.useCallback(()=>q(K=>K+1),[]),me=T.useCallback(()=>D(K=>K+1),[]);let re=r;if(typeof r=="string")try{re=JSON.parse(r)}catch{}const C=async()=>{const K=typeof r=="string"?r:JSON.stringify(re,null,2);await navigator.clipboard.writeText(K),y(!0),setTimeout(()=>y(!1),2e3)},X=T.useCallback(()=>{D(1),w(!0)},[]),ce=s==="panel",V=ce?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",G=ce?"font-mono text-xs leading-relaxed bg-white rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken rounded-md p-4 overflow-x-auto break-all";return m.jsxs("div",{className:V,children:[n&&m.jsx(qw,{children:n}),m.jsxs("div",{ref:f,className:"relative",children:[m.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:m.jsx(P0,{mode:h,setMode:d,isCollapsed:W,onToggleCollapse:ee,onCopy:C,copied:g,onFullscreen:X})}),m.jsx("div",{className:G,children:h==="json"?m.jsx(Lo,{data:re,generation:j}):m.jsx(Ua,{data:re})})]}),m.jsxs(Wg,{open:E,onClose:()=>w(!1),sourceRef:f,children:[m.jsx("div",{className:"sticky top-0 float-right z-10",children:m.jsx(P0,{mode:h,setMode:d,isCollapsed:se,onToggleCollapse:me,onCopy:C,copied:g,onClose:()=>w(!1),large:!0})}),m.jsx("div",{className:"font-mono text-sm leading-relaxed",children:h==="json"?m.jsx(Lo,{data:re,generation:M}):m.jsx(Ua,{data:re})})]})]})}const Iw=100,$0=500;let Xw=0;const ey={"escalation.created":"text-blue-400","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-blue-400","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-violet-400","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-blue-400",milestone:"text-violet-400"};function ty(r){const n=r.split(".");return n[0]==="system"&&n.length>=3?`${n[1]}.${n[n.length-1]}`:r}function Y0({event:r,forceExpanded:n=!1}){var j,q;const[s,a]=T.useState(n),o=ey[ty(r.type)]||"text-text-tertiary";T.useEffect(()=>{a(n)},[n]);const f=n,h=f?"text-xs":"text-[9px]",d=f?"text-xs":"text-[9px]",g=f?"text-xs":"text-[9px]",y=f?"w-3.5 h-3.5":"w-2.5 h-2.5",E=f?"py-2 px-4":"py-1 px-3",w=f?"pb-4 px-4":"pb-2 px-3";return m.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[m.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${E} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[m.jsx("span",{className:`${h} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(r.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),m.jsx("span",{className:`${d} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),m.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(j=r.data)!=null&&j.workflowId?String(r.data.workflowId):"",(q=r.data)!=null&&q.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),m.jsx("svg",{className:`${y} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),m.jsx(dh,{open:s,children:m.jsx("div",{className:w,children:m.jsx(Qw,{data:r.data})})})]})}function Kw({open:r,onToggle:n,configOpen:s,onToggleConfig:a}){const[o,f]=T.useState([]),[h,d]=T.useState(!1),[g,y]=T.useState(""),E=T.useRef(null),w=T.useRef(new Map),{subscribe:j}=T.useContext(Va),{patterns:q,pagePattern:M,userPatterns:D,addPattern:W,removePattern:se}=zw(),ee=T.useCallback(re=>{const C=String(re.type||"unknown");if(C.startsWith("mesh."))return;const X=`${C}:${re.timestamp||""}:${re.escalationId||re.workflowId||re.taskId||""}`,ce=Date.now(),V=w.current.get(X);if(!(V&&ce-V<$0)){if(w.current.set(X,ce),w.current.size>200)for(const[G,K]of w.current)ce-K>$0*2&&w.current.delete(G);f(G=>[{id:++Xw,type:C,timestamp:re.timestamp||new Date().toISOString(),data:re},...G].slice(0,Iw))}},[]),me=T.useRef(ee);return me.current=ee,T.useEffect(()=>{const re=q.map(C=>j(C,X=>me.current(X)));return()=>re.forEach(C=>C())},[j,q.join(",")]),T.useEffect(()=>{r&&E.current&&(E.current.scrollTop=0)},[o.length,r]),m.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[m.jsxs("button",{onClick:n,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[r?m.jsx(Gx,{className:"w-3 h-3 text-text-tertiary"}):m.jsx(Vx,{className:"w-3 h-3 text-text-tertiary"}),m.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&m.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[o.length," events"]}),o.length>0&&!r&&m.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${ey[ty(o[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),m.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[m.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:re=>{re.stopPropagation(),a()},children:m.jsx(Fx,{className:"w-3 h-3"})}),o.length>0&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:re=>{re.stopPropagation(),d(!0)},children:m.jsx(hg,{className:"w-3 h-3"})}),m.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:re=>{re.stopPropagation(),f([])},children:m.jsx(Jx,{className:"w-3 h-3"})})]})]})]}),s&&m.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[m.jsx("span",{className:"text-[9px] text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),m.jsx("span",{className:"text-[9px] font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:M.replace("lt.events.","")}),D.map(re=>m.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[re.replace("lt.events.",""),m.jsx("button",{onClick:()=>se(re),className:"text-text-quaternary hover:text-status-error",children:m.jsx($o,{className:"w-2 h-2"})})]},re))]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{type:"text",value:g,onChange:re=>y(re.target.value),onKeyDown:re=>{re.key==="Enter"&&g.trim()&&(W(g.trim()),y(""))},placeholder:"task.> or file.stored",className:"input text-[10px] font-mono flex-1 py-1"}),m.jsxs("button",{onClick:()=>{g.trim()&&(W(g.trim()),y(""))},className:"text-[10px] text-accent hover:text-accent-hover flex items-center gap-0.5",children:[m.jsx(Qx,{className:"w-2.5 h-2.5"})," Add"]})]})]}),m.jsx(dh,{open:r,children:m.jsx("div",{ref:E,className:"h-48 overflow-y-auto",children:o.length===0?m.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(re=>m.jsx(Y0,{event:re},re.id))})}),m.jsxs(Wg,{open:h,onClose:()=>d(!1),sourceRef:E,children:[m.jsx("div",{className:"sticky top-0 float-right z-10",children:m.jsx("button",{onClick:()=>d(!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:m.jsx(dg,{className:"w-5 h-5"})})}),o.length===0?m.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(re=>m.jsx(Y0,{event:re,forceExpanded:!0},re.id))]})]})}function Zw(){return Pn({queryKey:["docs"],queryFn:()=>Ve("/docs"),staleTime:5*6e4})}function Ww(r){return Pn({queryKey:["docs",r],queryFn:()=>Ve(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function eS(){const[r,n]=T.useState([]),[s,a]=T.useState([]),[o,f]=T.useState(null),h=T.useRef(o),d=T.useRef(r),g=T.useRef(s);h.current=o,d.current=r,g.current=s;const y=T.useCallback((M,D)=>{var se;const W=h.current;if(W){const ee=((se=D==null?void 0:D.current)==null?void 0:se.scrollTop)??0;n([...d.current,{...W,scrollTop:ee}])}a([]),f({path:M,scrollTop:0})},[]),E=T.useCallback(M=>{var ee;const D=d.current;if(D.length===0)return;const W=D[D.length-1],se=h.current;if(se){const me=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;a([...g.current,{...se,scrollTop:me}])}n(D.slice(0,-1)),f(W),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=W.scrollTop)})},[]),w=T.useCallback(M=>{var ee;const D=g.current;if(D.length===0)return;const W=D[D.length-1],se=h.current;if(se){const me=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;n([...d.current,{...se,scrollTop:me}])}a(D.slice(0,-1)),f(W),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=W.scrollTop)})},[]),j=T.useCallback(M=>{var se,ee;const D=h.current;if(!D)return;const W=((se=M==null?void 0:M.current)==null?void 0:se.scrollTop)??0;n([...d.current,{...D,scrollTop:W}]),a([]),f({...D,scrollTop:((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0})},[]),q=T.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:o,backStack:r,forwardStack:s,navigate:y,goBack:E,goForward:w,pushScrollPosition:j,reset:q}}function tS(r,n){const[s,a]=r.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const h=((n?n.replace(/[^/]+$/,""):"")+o).split("/"),d=[];for(const g of h)g===".."?d.pop():g&&g!=="."&&d.push(g);o=d.join("/")}return{path:o,anchor:a}}function nS(r){if(!r.startsWith("#docs"))return null;const n=r.slice(1).split(":"),s=n[1]||"README.md",a=n[2]||void 0;return{path:s,anchor:a}}function sS(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function iS({content:r,currentPath:n,onNavigate:s,onAnchorClick:a}){const o=f=>{var y;const h=f.target,d=h.closest("[data-anchor]");if(d){f.preventDefault(),a();const E=d.dataset.anchor,w=(y=d.closest(".docs-content"))==null?void 0:y.querySelector(`#${CSS.escape(E)}`);w==null||w.scrollIntoView({behavior:"smooth",block:"start"});return}const g=h.closest("[data-doc-link]");if(g){f.preventDefault();const{path:E,anchor:w}=tS(g.dataset.docLink,n);s(E,w);return}};return m.jsx(mh,{content:r,className:"docs-content",onClick:o})}function rS(r){const n=[],s=new Map;for(const a of r){const o=a.path.split("/");if(o.length===1){n.push(a);continue}let f=s;for(let h=0;h<o.length-1;h++){const d=o[h];f.has(d)||f.set(d,{label:d,children:[],subdirs:new Map});const g=f.get(d);h===o.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:n,dirs:s}}function aS({docs:r,selected:n,onSelect:s}){const{topLevel:a,dirs:o}=rS(r),f=d=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${n===d?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function h(d,g){return m.jsxs("details",{open:!0,children:[m.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[m.jsx(Ix,{className:"w-3 h-3",strokeWidth:1.5}),d.label]}),m.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...d.subdirs.values()].map(y=>h(y)),d.children.map(y=>m.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},d.label)}return m.jsxs("div",{className:"space-y-0.5",children:[a.map(d=>m.jsx("button",{className:f(d.path),onClick:()=>s(d.path),children:d.title},d.path)),[...o.values()].map(d=>h(d))]})}function lS({open:r,onClose:n}){var ce,V,G;const[s,a]=T.useState(!1),{data:o}=Zw(),f=eS(),{data:h,isLoading:d}=Ww(((ce=f.current)==null?void 0:ce.path)??null),g=T.useRef(null),[y,E]=T.useState(null);T.useEffect(()=>{y&&(h!=null&&h.content)&&g.current&&requestAnimationFrame(()=>{var ae;const K=(ae=g.current)==null?void 0:ae.querySelector(`#${CSS.escape(y)}`);K==null||K.scrollIntoView({behavior:"smooth",block:"start"}),E(null)})},[y,h]);const w=T.useCallback(()=>{var ne;const K=nS(window.location.hash),ae=(K==null?void 0:K.path)??"README.md";((ne=f.current)==null?void 0:ne.path)!==ae&&f.navigate(ae,g),K!=null&&K.anchor&&E(K.anchor)},[f]),j=T.useRef(!0);T.useEffect(()=>{if(!r||!f.current)return;if(j.current){j.current=!1;return}const K=sS(f.current.path);window.location.hash!==K&&window.history.replaceState(null,"",window.location.pathname+window.location.search+K)},[r,(V=f.current)==null?void 0:V.path]),T.useEffect(()=>{if(!r)return;const K=()=>{window.location.hash.startsWith("#docs")&&w()};return window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)},[r,w]);const q=T.useCallback((K,ae)=>{ae&&E(ae),f.navigate(K,g)},[f]),M=T.useCallback(K=>{f.navigate(K,g)},[f]),D=T.useCallback(()=>{f.goBack(g)},[f]),W=T.useCallback(()=>{f.goForward(g)},[f]),se=T.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(T.useEffect(()=>{if(r){j.current=!0,w();const K=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(K)}},[r]),!(r||s))return null;const me=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},re=((G=f.current)==null?void 0:G.path)??null,C=f.backStack.length>0,X=f.forwardStack.length>0;return m.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[m.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:me}),m.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&r?"translate-x-0":"translate-x-full"}`,children:[m.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("button",{onClick:D,disabled:!C,className:`p-0.5 transition-colors ${C?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:m.jsx(Xx,{className:"w-4 h-4"})}),m.jsx("button",{onClick:W,disabled:!X,className:`p-0.5 transition-colors ${X?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:m.jsx(s0,{className:"w-4 h-4"})}),m.jsx(fg,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),m.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),m.jsx("button",{onClick:me,className:"p-1 text-text-tertiary hover:text-text-primary",children:m.jsx($o,{className:"w-4 h-4"})})]}),m.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?m.jsx(aS,{docs:o.docs,selected:re,onSelect:M}):m.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),m.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:re?d?m.jsxs("div",{className:"animate-pulse space-y-2",children:[m.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),m.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),m.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):h!=null&&h.content?m.jsx(iS,{content:h.content,currentPath:re,onNavigate:q,onAnchorClick:se}):m.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):m.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[m.jsx(s0,{className:"w-5 h-5 mb-2"}),m.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function oS(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const G0=2e3;function cS(r){const s=r.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
|
|
56
|
+
${w.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${wo(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${wo(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${wo(y)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${y}</h2>`).replace(/^# (.+)$/gm,(g,y)=>`<h1 id="${wo(y)}" class="text-lg font-bold text-text-primary mb-3">${y}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const y=g.replace(/^> /gm,"").trim(),E=/⚠️|warning|caution/i.test(y),w=/note:|ℹ️|info/i.test(y);return`<div class="${E?"bg-status-warning/5":w?"bg-accent/5":"bg-surface-sunken/50"} ${E?"border-status-warning":w?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(f('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,y)=>n[parseInt(y,10)]);const h="text-xs leading-relaxed text-text-secondary mb-2",m=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const y=g.trim();if(!y)return"";const E=[];let w=y,O;for(;(O=m.exec(w))!==null;){const q=O.index+O[0].length;E.push(w.slice(0,q)),w=w.slice(q).replace(/^<br\/>/,"").trim(),m.lastIndex=0}return w&&E.push(w),E.map(q=>{const M=q.trim();return M?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(M)?M:`<p class="${h}">${M}</p>`:""}).join("")}).join(""),s}const Gw=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function Vw(r){return Gw.test(r)}function ph({content:r,className:n,onClick:s}){const a=T.useMemo(()=>Yw(r),[r]);return d.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function Lo({data:r,depth:n=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,h]=T.useState(o),[m,g]=T.useState(s);if(s!==void 0&&s!==m&&(g(s),h(s%2===0&&n>0)),r==null)return d.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return d.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return d.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?d.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?d.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):d.jsxs("span",{children:[d.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),d.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((y,E)=>d.jsxs("div",{children:[d.jsx(Lo,{data:y,depth:n+1,generation:s}),E<r.length-1&&d.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),d.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const y=Object.entries(r);return y.length===0?d.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?d.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):d.jsxs("span",{children:[d.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),d.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([E,w],O)=>d.jsxs("div",{children:[d.jsx("span",{className:"text-text-secondary",children:E}),d.jsx("span",{className:"text-text-tertiary",children:": "}),d.jsx(Lo,{data:w,depth:n+1,generation:s}),O<y.length-1&&d.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),d.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return d.jsx("span",{children:String(r)})}function Ua({data:r,depth:n=0}){if(r==null)return d.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&Vw(r)?d.jsx(ph,{content:r}):d.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return d.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?d.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):d.jsx("div",{className:"space-y-2",children:r.map((s,a)=>d.jsxs("div",{className:"flex items-baseline gap-2",children:[d.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),d.jsx("div",{className:"flex-1",children:d.jsx(Ua,{data:s,depth:n+1})})]},a))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?d.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):d.jsx("div",{className:n>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,o])=>{const f=o===null||typeof o!="object";return d.jsxs("div",{children:[d.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?d.jsx("p",{className:"text-sm text-text-primary",children:d.jsx(Ua,{data:o,depth:n+1})}):d.jsx(Ua,{data:o,depth:n+1})]},a)})})}return d.jsx("span",{children:String(r)})}function $0({mode:r,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:o,copied:f,onFullscreen:h,onClose:m,large:g}){const y=g?"w-5 h-5":"w-3.5 h-3.5",E=`${g?"p-2":"p-1.5"} rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150`;return d.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&d.jsx("button",{onClick:a,className:E,title:s?"Expand all":"Collapse all",children:s?d.jsx(Pw,{className:y}):d.jsx(Hw,{className:y})}),d.jsx("button",{onClick:()=>n(r==="json"?"tree":"json"),className:E,title:r==="json"?"Outline view":"JSON view",children:r==="json"?d.jsx(qw,{className:y}):d.jsx(Uw,{className:y})}),d.jsx("button",{onClick:o,className:E,title:"Copy to clipboard",children:f?d.jsx(Lw,{className:`${y} text-status-success`}):d.jsx(Bw,{className:y})}),h&&d.jsx("button",{onClick:h,className:E,title:"Fullscreen",children:d.jsx(dg,{className:y})}),m&&d.jsx("button",{onClick:m,className:E,title:"Close (Esc)",children:d.jsx(mg,{className:y})})]})}function Fw({data:r,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:o}){const f=T.useRef(null),[h,m]=T.useState(o??"json"),[g,y]=T.useState(!1),[E,w]=T.useState(!1),[O,q]=T.useState(a?0:1),[M,D]=T.useState(1),W=O%2===0,se=M%2===0,ee=T.useCallback(()=>q(K=>K+1),[]),me=T.useCallback(()=>D(K=>K+1),[]);let re=r;if(typeof r=="string")try{re=JSON.parse(r)}catch{}const C=async()=>{const K=typeof r=="string"?r:JSON.stringify(re,null,2);await navigator.clipboard.writeText(K),y(!0),setTimeout(()=>y(!1),2e3)},X=T.useCallback(()=>{D(1),w(!0)},[]),ce=s==="panel",V=ce?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",G=ce?"font-mono text-xs leading-relaxed bg-white rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken rounded-md p-4 overflow-x-auto break-all";return d.jsxs("div",{className:V,children:[n&&d.jsx(Dw,{children:n}),d.jsxs("div",{ref:f,className:"relative",children:[d.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:d.jsx($0,{mode:h,setMode:m,isCollapsed:W,onToggleCollapse:ee,onCopy:C,copied:g,onFullscreen:X})}),d.jsx("div",{className:G,children:h==="json"?d.jsx(Lo,{data:re,generation:O}):d.jsx(Ua,{data:re})})]}),d.jsxs(Wg,{open:E,onClose:()=>w(!1),sourceRef:f,children:[d.jsx("div",{className:"sticky top-0 float-right z-10",children:d.jsx($0,{mode:h,setMode:m,isCollapsed:se,onToggleCollapse:me,onCopy:C,copied:g,onClose:()=>w(!1),large:!0})}),d.jsx("div",{className:"font-mono text-sm leading-relaxed",children:h==="json"?d.jsx(Lo,{data:re,generation:M}):d.jsx(Ua,{data:re})})]})]})}const Jw=100,Y0=500;let Iw=0;const ey={"escalation.created":"text-blue-400","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-blue-400","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-violet-400","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-blue-400",milestone:"text-violet-400"};function ty(r){const n=r.split(".");return n[0]==="system"&&n.length>=3?`${n[1]}.${n[n.length-1]}`:r}function G0({event:r,forceExpanded:n=!1}){var O,q;const[s,a]=T.useState(n),o=ey[ty(r.type)]||"text-text-tertiary";T.useEffect(()=>{a(n)},[n]);const f=n,h=f?"text-xs":"text-[9px]",m=f?"text-xs":"text-[9px]",g=f?"text-xs":"text-[9px]",y=f?"w-3.5 h-3.5":"w-2.5 h-2.5",E=f?"py-2 px-4":"py-1 px-3",w=f?"pb-4 px-4":"pb-2 px-3";return d.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[d.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${E} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[d.jsx("span",{className:`${h} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(r.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),d.jsx("span",{className:`${m} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),d.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(O=r.data)!=null&&O.workflowId?String(r.data.workflowId):"",(q=r.data)!=null&&q.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),d.jsx("svg",{className:`${y} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),d.jsx(mh,{open:s,children:d.jsx("div",{className:w,children:d.jsx(Fw,{data:r.data})})})]})}function Qw({open:r,onToggle:n,configOpen:s,onToggleConfig:a}){const[o,f]=T.useState([]),[h,m]=T.useState(!1),[g,y]=T.useState(""),E=T.useRef(null),w=T.useRef(new Map),{subscribe:O}=T.useContext(Va),{patterns:q,pagePattern:M,userPatterns:D,addPattern:W,removePattern:se}=Rw(),ee=T.useCallback(re=>{const C=String(re.type||"unknown");if(C.startsWith("mesh."))return;const X=`${C}:${re.timestamp||""}:${re.escalationId||re.workflowId||re.taskId||""}`,ce=Date.now(),V=w.current.get(X);if(!(V&&ce-V<Y0)){if(w.current.set(X,ce),w.current.size>200)for(const[G,K]of w.current)ce-K>Y0*2&&w.current.delete(G);f(G=>[{id:++Iw,type:C,timestamp:re.timestamp||new Date().toISOString(),data:re},...G].slice(0,Jw))}},[]),me=T.useRef(ee);return me.current=ee,T.useEffect(()=>{const re=q.map(C=>O(C,X=>me.current(X)));return()=>re.forEach(C=>C())},[O,q.join(",")]),T.useEffect(()=>{r&&E.current&&(E.current.scrollTop=0)},[o.length,r]),d.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[d.jsxs("button",{onClick:n,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[r?d.jsx($x,{className:"w-3 h-3 text-text-tertiary"}):d.jsx(Yx,{className:"w-3 h-3 text-text-tertiary"}),d.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&d.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[o.length," events"]}),o.length>0&&!r&&d.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${ey[ty(o[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),d.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[d.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:re=>{re.stopPropagation(),a()},children:d.jsx(Gx,{className:"w-3 h-3"})}),o.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:re=>{re.stopPropagation(),m(!0)},children:d.jsx(dg,{className:"w-3 h-3"})}),d.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:re=>{re.stopPropagation(),f([])},children:d.jsx(Vx,{className:"w-3 h-3"})})]})]})]}),s&&d.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[d.jsx("span",{className:"text-[9px] text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),d.jsx("span",{className:"text-[9px] font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:M.replace("lt.events.","")}),D.map(re=>d.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[re.replace("lt.events.",""),d.jsx("button",{onClick:()=>se(re),className:"text-text-quaternary hover:text-status-error",children:d.jsx($o,{className:"w-2 h-2"})})]},re))]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("input",{type:"text",value:g,onChange:re=>y(re.target.value),onKeyDown:re=>{re.key==="Enter"&&g.trim()&&(W(g.trim()),y(""))},placeholder:"task.> or file.stored",className:"input text-[10px] font-mono flex-1 py-1"}),d.jsxs("button",{onClick:()=>{g.trim()&&(W(g.trim()),y(""))},className:"text-[10px] text-accent hover:text-accent-hover flex items-center gap-0.5",children:[d.jsx(Fx,{className:"w-2.5 h-2.5"})," Add"]})]})]}),d.jsx(mh,{open:r,children:d.jsx("div",{ref:E,className:"h-48 overflow-y-auto",children:o.length===0?d.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(re=>d.jsx(G0,{event:re},re.id))})}),d.jsxs(Wg,{open:h,onClose:()=>m(!1),sourceRef:E,children:[d.jsx("div",{className:"sticky top-0 float-right z-10",children:d.jsx("button",{onClick:()=>m(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:d.jsx(mg,{className:"w-5 h-5"})})}),o.length===0?d.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(re=>d.jsx(G0,{event:re,forceExpanded:!0},re.id))]})]})}function Xw(){return $n({queryKey:["docs"],queryFn:()=>Ve("/docs"),staleTime:5*6e4})}function Kw(r){return $n({queryKey:["docs",r],queryFn:()=>Ve(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function Zw(){const[r,n]=T.useState([]),[s,a]=T.useState([]),[o,f]=T.useState(null),h=T.useRef(o),m=T.useRef(r),g=T.useRef(s);h.current=o,m.current=r,g.current=s;const y=T.useCallback((M,D)=>{var se;const W=h.current;if(W){const ee=((se=D==null?void 0:D.current)==null?void 0:se.scrollTop)??0;n([...m.current,{...W,scrollTop:ee}])}a([]),f({path:M,scrollTop:0})},[]),E=T.useCallback(M=>{var ee;const D=m.current;if(D.length===0)return;const W=D[D.length-1],se=h.current;if(se){const me=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;a([...g.current,{...se,scrollTop:me}])}n(D.slice(0,-1)),f(W),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=W.scrollTop)})},[]),w=T.useCallback(M=>{var ee;const D=g.current;if(D.length===0)return;const W=D[D.length-1],se=h.current;if(se){const me=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;n([...m.current,{...se,scrollTop:me}])}a(D.slice(0,-1)),f(W),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=W.scrollTop)})},[]),O=T.useCallback(M=>{var se,ee;const D=h.current;if(!D)return;const W=((se=M==null?void 0:M.current)==null?void 0:se.scrollTop)??0;n([...m.current,{...D,scrollTop:W}]),a([]),f({...D,scrollTop:((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0})},[]),q=T.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:o,backStack:r,forwardStack:s,navigate:y,goBack:E,goForward:w,pushScrollPosition:O,reset:q}}function Ww(r,n){const[s,a]=r.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const h=((n?n.replace(/[^/]+$/,""):"")+o).split("/"),m=[];for(const g of h)g===".."?m.pop():g&&g!=="."&&m.push(g);o=m.join("/")}return{path:o,anchor:a}}function eS(r){if(!r.startsWith("#docs"))return null;const n=r.slice(1).split(":"),s=n[1]||"README.md",a=n[2]||void 0;return{path:s,anchor:a}}function tS(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function nS({content:r,currentPath:n,onNavigate:s,onAnchorClick:a}){const o=f=>{var y;const h=f.target,m=h.closest("[data-anchor]");if(m){f.preventDefault(),a();const E=m.dataset.anchor,w=(y=m.closest(".docs-content"))==null?void 0:y.querySelector(`#${CSS.escape(E)}`);w==null||w.scrollIntoView({behavior:"smooth",block:"start"});return}const g=h.closest("[data-doc-link]");if(g){f.preventDefault();const{path:E,anchor:w}=Ww(g.dataset.docLink,n);s(E,w);return}};return d.jsx(ph,{content:r,className:"docs-content",onClick:o})}function sS(r){const n=[],s=new Map;for(const a of r){const o=a.path.split("/");if(o.length===1){n.push(a);continue}let f=s;for(let h=0;h<o.length-1;h++){const m=o[h];f.has(m)||f.set(m,{label:m,children:[],subdirs:new Map});const g=f.get(m);h===o.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:n,dirs:s}}function iS({docs:r,selected:n,onSelect:s}){const{topLevel:a,dirs:o}=sS(r),f=m=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${n===m?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function h(m,g){return d.jsxs("details",{open:!0,children:[d.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[d.jsx(Jx,{className:"w-3 h-3",strokeWidth:1.5}),m.label]}),d.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...m.subdirs.values()].map(y=>h(y)),m.children.map(y=>d.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},m.label)}return d.jsxs("div",{className:"space-y-0.5",children:[a.map(m=>d.jsx("button",{className:f(m.path),onClick:()=>s(m.path),children:m.title},m.path)),[...o.values()].map(m=>h(m))]})}function rS({open:r,onClose:n}){var ce,V,G;const[s,a]=T.useState(!1),{data:o}=Xw(),f=Zw(),{data:h,isLoading:m}=Kw(((ce=f.current)==null?void 0:ce.path)??null),g=T.useRef(null),[y,E]=T.useState(null);T.useEffect(()=>{y&&(h!=null&&h.content)&&g.current&&requestAnimationFrame(()=>{var ae;const K=(ae=g.current)==null?void 0:ae.querySelector(`#${CSS.escape(y)}`);K==null||K.scrollIntoView({behavior:"smooth",block:"start"}),E(null)})},[y,h]);const w=T.useCallback(()=>{var ne;const K=eS(window.location.hash),ae=(K==null?void 0:K.path)??"README.md";((ne=f.current)==null?void 0:ne.path)!==ae&&f.navigate(ae,g),K!=null&&K.anchor&&E(K.anchor)},[f]),O=T.useRef(!0);T.useEffect(()=>{if(!r||!f.current)return;if(O.current){O.current=!1;return}const K=tS(f.current.path);window.location.hash!==K&&window.history.replaceState(null,"",window.location.pathname+window.location.search+K)},[r,(V=f.current)==null?void 0:V.path]),T.useEffect(()=>{if(!r)return;const K=()=>{window.location.hash.startsWith("#docs")&&w()};return window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)},[r,w]);const q=T.useCallback((K,ae)=>{ae&&E(ae),f.navigate(K,g)},[f]),M=T.useCallback(K=>{f.navigate(K,g)},[f]),D=T.useCallback(()=>{f.goBack(g)},[f]),W=T.useCallback(()=>{f.goForward(g)},[f]),se=T.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(T.useEffect(()=>{if(r){O.current=!0,w();const K=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(K)}},[r]),!(r||s))return null;const me=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},re=((G=f.current)==null?void 0:G.path)??null,C=f.backStack.length>0,X=f.forwardStack.length>0;return d.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[d.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:me}),d.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&r?"translate-x-0":"translate-x-full"}`,children:[d.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("button",{onClick:D,disabled:!C,className:`p-0.5 transition-colors ${C?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:d.jsx(Ix,{className:"w-4 h-4"})}),d.jsx("button",{onClick:W,disabled:!X,className:`p-0.5 transition-colors ${X?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:d.jsx(i0,{className:"w-4 h-4"})}),d.jsx(hg,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),d.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),d.jsx("button",{onClick:me,className:"p-1 text-text-tertiary hover:text-text-primary",children:d.jsx($o,{className:"w-4 h-4"})})]}),d.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[d.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?d.jsx(iS,{docs:o.docs,selected:re,onSelect:M}):d.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),d.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:re?m?d.jsxs("div",{className:"animate-pulse space-y-2",children:[d.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),d.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),d.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):h!=null&&h.content?d.jsx(nS,{content:h.content,currentPath:re,onNavigate:q,onAnchorClick:se}):d.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[d.jsx(i0,{className:"w-5 h-5 mb-2"}),d.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function aS(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const V0=2e3;function lS(r){const s=r.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
|
|
57
57
|
${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
|
|
58
58
|
`)}
|
|
59
59
|
[End prior conversation]
|
|
60
60
|
|
|
61
|
-
`}function
|
|
62
|
-
... (truncated)`});const ce=`${cS(o.concat(me))}${se}`;try{const K=(await Ve("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ce,tags:C.suggestedTags,context:C,wait:!1,direct:!0})})).workflow_id;d(K),f(ae=>ae.map(ne=>ne.id===re.id?{...ne,workflowId:K}:ne)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var ae;try{const ne=await Ve(`/workflows/${K}/result`),ke=(ae=ne==null?void 0:ne.result)==null?void 0:ae.data;if(ke){E.current&&clearInterval(E.current),E.current=null,d(null);const He=uS(ke);let Me;try{Me=(await Ve(`/workflow-states/${K}/execution`)).duration_ms}catch{}f($=>$.map(te=>te.id===re.id?{...te,content:He,timestamp:new Date().toISOString(),pending:!1,durationMs:Me}:te))}}catch{}},3e3)}catch{f(G=>G.map(K=>K.id===re.id?{...K,content:"Failed to submit query. Please try again.",pending:!1}:K))}},[o,w]),W=T.useCallback(async se=>{const ee=o.find(C=>C.id===se);if(!(ee!=null&&ee.workflowId)||ee.compilationStatus==="compiling"||ee.compilationStatus==="done")return;const me=o.indexOf(ee),re=o.slice(0,me).reverse().find(C=>C.role==="user");if(re){f(C=>C.map(X=>X.id===se?{...X,compilationStatus:"compiling"}:X));try{const C=await Ve("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:re.content,summary:ee.content})}),X=await Ve("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:ee.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:C.tool_name,description:C.description,tags:C.tags,app_id:""})});await Ve(`/yaml-workflows/${X.id}/deploy`,{method:"POST"}),f(ce=>ce.map(V=>V.id===se?{...V,compilationStatus:"done"}:V))}catch(C){const X=C instanceof Error?C.message:"Compilation failed";f(ce=>ce.map(V=>V.id===se?{...V,compilationStatus:"error",compilationError:X}:V))}}},[o]);return m.jsx(ny.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:j,messages:o,sendMessage:D,pageContext:w,setPageContext:q,activeWorkflowId:h,clearMessages:M,compileMessage:W},children:r})}function sy(){const r=T.useContext(ny);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function hS(){const{helpOpen:r,toggleHelp:n}=sy();return m.jsx("button",{onClick:n,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":r?"Close help":"Ask for help",children:r?m.jsx($o,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):m.jsx("img",{src:`${Wt}/logo512.png`,alt:"Help",className:"w-8 h-8 -rotate-[120deg]"})})}const iy=6048e5,dS=864e5,V0=6e4,F0=525600,J0=43200,Q0=1440,I0=Symbol.for("constructDateFrom");function ds(r,n){return typeof r=="function"?r(n):r&&typeof r=="object"&&I0 in r?r[I0](n):r instanceof Date?new r.constructor(n):new Date(n)}function sn(r,n){return ds(n||r,r)}let mS={};function Fa(){return mS}function $a(r,n){var d,g,y,E;const s=Fa(),a=(n==null?void 0:n.weekStartsOn)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.weekStartsOn)??0,o=sn(r,n==null?void 0:n.in),f=o.getDay(),h=(f<a?7:0)+f-a;return o.setDate(o.getDate()-h),o.setHours(0,0,0,0),o}function Ho(r,n){return $a(r,{...n,weekStartsOn:1})}function ry(r,n){const s=sn(r,n==null?void 0:n.in),a=s.getFullYear(),o=ds(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const f=Ho(o),h=ds(s,0);h.setFullYear(a,0,4),h.setHours(0,0,0,0);const d=Ho(h);return s.getTime()>=f.getTime()?a+1:s.getTime()>=d.getTime()?a:a-1}function Po(r){const n=sn(r),s=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return s.setUTCFullYear(n.getFullYear()),+r-+s}function ay(r,...n){const s=ds.bind(null,r||n.find(a=>typeof a=="object"));return n.map(s)}function X0(r,n){const s=sn(r,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function pS(r,n,s){const[a,o]=ay(s==null?void 0:s.in,r,n),f=X0(a),h=X0(o),d=+f-Po(f),g=+h-Po(h);return Math.round((d-g)/dS)}function gS(r,n){const s=ry(r,n),a=ds(r,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),Ho(a)}function yS(r,n){const s=+sn(r)-+sn(n);return s<0?-1:s>0?1:s}function bS(r){return ds(r,Date.now())}function xS(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function vS(r){return!(!xS(r)&&typeof r!="number"||isNaN(+sn(r)))}function _S(r){return n=>{const a=(r?Math[r]:Math.trunc)(n);return a===0?0:a}}function wS(r,n){const s=sn(r,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const SS={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"}},ES=(r,n,s)=>{let a;const o=SS[r];return typeof o=="string"?a=o:n===1?a=o.one:a=o.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function wf(r){return(n={})=>{const s=n.width?String(n.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const AS={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},OS={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},jS={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},TS={date:wf({formats:AS,defaultWidth:"full"}),time:wf({formats:OS,defaultWidth:"full"}),dateTime:wf({formats:jS,defaultWidth:"full"})},NS={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},CS=(r,n,s,a)=>NS[r];function ja(r){return(n,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let o;if(a==="formatting"&&r.formattingValues){const h=r.defaultFormattingWidth||r.defaultWidth,d=s!=null&&s.width?String(s.width):h;o=r.formattingValues[d]||r.formattingValues[h]}else{const h=r.defaultWidth,d=s!=null&&s.width?String(s.width):r.defaultWidth;o=r.values[d]||r.values[h]}const f=r.argumentCallback?r.argumentCallback(n):n;return o[f]}}const kS={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},MS={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},RS={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"]},DS={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"]},zS={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"}},qS={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"}},US=(r,n)=>{const s=Number(r),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},BS={ordinalNumber:US,era:ja({values:kS,defaultWidth:"wide"}),quarter:ja({values:MS,defaultWidth:"wide",argumentCallback:r=>r-1}),month:ja({values:RS,defaultWidth:"wide"}),day:ja({values:DS,defaultWidth:"wide"}),dayPeriod:ja({values:zS,defaultWidth:"wide",formattingValues:qS,defaultFormattingWidth:"wide"})};function Ta(r){return(n,s={})=>{const a=s.width,o=a&&r.matchPatterns[a]||r.matchPatterns[r.defaultMatchWidth],f=n.match(o);if(!f)return null;const h=f[0],d=a&&r.parsePatterns[a]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(d)?HS(d,w=>w.test(h)):LS(d,w=>w.test(h));let y;y=r.valueCallback?r.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const E=n.slice(h.length);return{value:y,rest:E}}}function LS(r,n){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&n(r[s]))return s}function HS(r,n){for(let s=0;s<r.length;s++)if(n(r[s]))return s}function PS(r){return(n,s={})=>{const a=n.match(r.matchPattern);if(!a)return null;const o=a[0],f=n.match(r.parsePattern);if(!f)return null;let h=r.valueCallback?r.valueCallback(f[0]):f[0];h=s.valueCallback?s.valueCallback(h):h;const d=n.slice(o.length);return{value:h,rest:d}}}const $S=/^(\d+)(th|st|nd|rd)?/i,YS=/\d+/i,GS={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},VS={any:[/^b/i,/^(a|c)/i]},FS={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},JS={any:[/1/i,/2/i,/3/i,/4/i]},QS={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},IS={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]},XS={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},KS={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]},ZS={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},WS={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}},e2={ordinalNumber:PS({matchPattern:$S,parsePattern:YS,valueCallback:r=>parseInt(r,10)}),era:Ta({matchPatterns:GS,defaultMatchWidth:"wide",parsePatterns:VS,defaultParseWidth:"any"}),quarter:Ta({matchPatterns:FS,defaultMatchWidth:"wide",parsePatterns:JS,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Ta({matchPatterns:QS,defaultMatchWidth:"wide",parsePatterns:IS,defaultParseWidth:"any"}),day:Ta({matchPatterns:XS,defaultMatchWidth:"wide",parsePatterns:KS,defaultParseWidth:"any"}),dayPeriod:Ta({matchPatterns:ZS,defaultMatchWidth:"any",parsePatterns:WS,defaultParseWidth:"any"})},ly={code:"en-US",formatDistance:ES,formatLong:TS,formatRelative:CS,localize:BS,match:e2,options:{weekStartsOn:0,firstWeekContainsDate:1}};function t2(r,n){const s=sn(r,n==null?void 0:n.in);return pS(s,wS(s))+1}function n2(r,n){const s=sn(r,n==null?void 0:n.in),a=+Ho(s)-+gS(s);return Math.round(a/iy)+1}function oy(r,n){var E,w,j,q;const s=sn(r,n==null?void 0:n.in),a=s.getFullYear(),o=Fa(),f=(n==null?void 0:n.firstWeekContainsDate)??((w=(E=n==null?void 0:n.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??o.firstWeekContainsDate??((q=(j=o.locale)==null?void 0:j.options)==null?void 0:q.firstWeekContainsDate)??1,h=ds((n==null?void 0:n.in)||r,0);h.setFullYear(a+1,0,f),h.setHours(0,0,0,0);const d=$a(h,n),g=ds((n==null?void 0:n.in)||r,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=$a(g,n);return+s>=+d?a+1:+s>=+y?a:a-1}function s2(r,n){var d,g,y,E;const s=Fa(),a=(n==null?void 0:n.firstWeekContainsDate)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.firstWeekContainsDate)??1,o=oy(r,n),f=ds((n==null?void 0:n.in)||r,0);return f.setFullYear(o,0,a),f.setHours(0,0,0,0),$a(f,n)}function i2(r,n){const s=sn(r,n==null?void 0:n.in),a=+$a(s,n)-+s2(s,n);return Math.round(a/iy)+1}function Ge(r,n){const s=r<0?"-":"",a=Math.abs(r).toString().padStart(n,"0");return s+a}const Vs={y(r,n){const s=r.getFullYear(),a=s>0?s:1-s;return Ge(n==="yy"?a%100:a,n.length)},M(r,n){const s=r.getMonth();return n==="M"?String(s+1):Ge(s+1,2)},d(r,n){return Ge(r.getDate(),n.length)},a(r,n){const s=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(r,n){return Ge(r.getHours()%12||12,n.length)},H(r,n){return Ge(r.getHours(),n.length)},m(r,n){return Ge(r.getMinutes(),n.length)},s(r,n){return Ge(r.getSeconds(),n.length)},S(r,n){const s=n.length,a=r.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Ge(o,n.length)}},pr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},K0={G:function(r,n,s){const a=r.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(r,n,s){if(n==="yo"){const a=r.getFullYear(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Vs.y(r,n)},Y:function(r,n,s,a){const o=oy(r,a),f=o>0?o:1-o;if(n==="YY"){const h=f%100;return Ge(h,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):Ge(f,n.length)},R:function(r,n){const s=ry(r);return Ge(s,n.length)},u:function(r,n){const s=r.getFullYear();return Ge(s,n.length)},Q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return Ge(a,2);case"Qo":return s.ordinalNumber(a,{unit:"quarter"});case"QQQ":return s.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(a,{width:"wide",context:"formatting"})}},q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return Ge(a,2);case"qo":return s.ordinalNumber(a,{unit:"quarter"});case"qqq":return s.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(a,{width:"wide",context:"standalone"})}},M:function(r,n,s){const a=r.getMonth();switch(n){case"M":case"MM":return Vs.M(r,n);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(r,n,s){const a=r.getMonth();switch(n){case"L":return String(a+1);case"LL":return Ge(a+1,2);case"Lo":return s.ordinalNumber(a+1,{unit:"month"});case"LLL":return s.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(a,{width:"wide",context:"standalone"})}},w:function(r,n,s,a){const o=i2(r,a);return n==="wo"?s.ordinalNumber(o,{unit:"week"}):Ge(o,n.length)},I:function(r,n,s){const a=n2(r);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):Ge(a,n.length)},d:function(r,n,s){return n==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):Vs.d(r,n)},D:function(r,n,s){const a=t2(r);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Ge(a,n.length)},E:function(r,n,s){const a=r.getDay();switch(n){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return Ge(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return Ge(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(r,n,s){const a=r.getDay(),o=a===0?7:a;switch(n){case"i":return String(o);case"ii":return Ge(o,n.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(r,n,s){const o=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(r,n,s){const a=r.getHours();let o;switch(a===12?o=pr.noon:a===0?o=pr.midnight:o=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(r,n,s){const a=r.getHours();let o;switch(a>=17?o=pr.evening:a>=12?o=pr.afternoon:a>=4?o=pr.morning:o=pr.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(r,n,s){if(n==="ho"){let a=r.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return Vs.h(r,n)},H:function(r,n,s){return n==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):Vs.H(r,n)},K:function(r,n,s){const a=r.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Ge(a,n.length)},k:function(r,n,s){let a=r.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):Ge(a,n.length)},m:function(r,n,s){return n==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):Vs.m(r,n)},s:function(r,n,s){return n==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):Vs.s(r,n)},S:function(r,n){return Vs.S(r,n)},X:function(r,n,s){const a=r.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return W0(a);case"XXXX":case"XX":return Ei(a);case"XXXXX":case"XXX":default:return Ei(a,":")}},x:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"x":return W0(a);case"xxxx":case"xx":return Ei(a);case"xxxxx":case"xxx":default:return Ei(a,":")}},O:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+Z0(a,":");case"OOOO":default:return"GMT"+Ei(a,":")}},z:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+Z0(a,":");case"zzzz":default:return"GMT"+Ei(a,":")}},t:function(r,n,s){const a=Math.trunc(+r/1e3);return Ge(a,n.length)},T:function(r,n,s){return Ge(+r,n.length)}};function Z0(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Math.trunc(a/60),f=a%60;return f===0?s+String(o):s+String(o)+n+Ge(f,2)}function W0(r,n){return r%60===0?(r>0?"-":"+")+Ge(Math.abs(r)/60,2):Ei(r,n)}function Ei(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Ge(Math.trunc(a/60),2),f=Ge(a%60,2);return s+o+n+f}const eg=(r,n)=>{switch(r){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},cy=(r,n)=>{switch(r){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},r2=(r,n)=>{const s=r.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return eg(r,n);let f;switch(a){case"P":f=n.dateTime({width:"short"});break;case"PP":f=n.dateTime({width:"medium"});break;case"PPP":f=n.dateTime({width:"long"});break;case"PPPP":default:f=n.dateTime({width:"full"});break}return f.replace("{{date}}",eg(a,n)).replace("{{time}}",cy(o,n))},a2={p:cy,P:r2},l2=/^D+$/,o2=/^Y+$/,c2=["D","DD","YY","YYYY"];function u2(r){return l2.test(r)}function f2(r){return o2.test(r)}function h2(r,n,s){const a=d2(r,n,s);if(console.warn(a),c2.includes(r))throw new RangeError(a)}function d2(r,n,s){const a=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${n}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const m2=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,p2=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,g2=/^'([^]*?)'?$/,y2=/''/g,b2=/[a-zA-Z]/;function uy(r,n,s){var E,w,j,q;const a=Fa(),o=a.locale??ly,f=a.firstWeekContainsDate??((w=(E=a.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??1,h=a.weekStartsOn??((q=(j=a.locale)==null?void 0:j.options)==null?void 0:q.weekStartsOn)??0,d=sn(r,s==null?void 0:s.in);if(!vS(d))throw new RangeError("Invalid time value");let g=n.match(p2).map(M=>{const D=M[0];if(D==="p"||D==="P"){const W=a2[D];return W(M,o.formatLong)}return M}).join("").match(m2).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const D=M[0];if(D==="'")return{isToken:!1,value:x2(M)};if(K0[D])return{isToken:!0,value:M};if(D.match(b2))throw new RangeError("Format string contains an unescaped latin alphabet character `"+D+"`");return{isToken:!1,value:M}});o.localize.preprocessor&&(g=o.localize.preprocessor(d,g));const y={firstWeekContainsDate:f,weekStartsOn:h,locale:o};return g.map(M=>{if(!M.isToken)return M.value;const D=M.value;(f2(D)||u2(D))&&h2(D,n,String(r));const W=K0[D[0]];return W(d,D,o.localize,y)}).join("")}function x2(r){const n=r.match(g2);return n?n[1].replace(y2,"'"):r}function v2(r,n,s){const a=Fa(),o=(s==null?void 0:s.locale)??a.locale??ly,f=yS(r,n);if(isNaN(f))throw new RangeError("Invalid time value");const h=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[d,g]=ay(s==null?void 0:s.in,...f>0?[n,r]:[r,n]),y=_S((s==null?void 0:s.roundingMethod)??"round"),E=g.getTime()-d.getTime(),w=E/V0,j=Po(g)-Po(d),q=(E-j)/V0,M=s==null?void 0:s.unit;let D;if(M?D=M:w<1?D="second":w<60?D="minute":w<Q0?D="hour":q<J0?D="day":q<F0?D="month":D="year",D==="second"){const W=y(E/1e3);return o.formatDistance("xSeconds",W,h)}else if(D==="minute"){const W=y(w);return o.formatDistance("xMinutes",W,h)}else if(D==="hour"){const W=y(w/60);return o.formatDistance("xHours",W,h)}else if(D==="day"){const W=y(q/Q0);return o.formatDistance("xDays",W,h)}else if(D==="month"){const W=y(q/J0);return W===12&&M!=="month"?o.formatDistance("xYears",1,h):o.formatDistance("xMonths",W,h)}else{const W=y(q/F0);return o.formatDistance("xYears",W,h)}}function _2(r,n){return v2(r,bS(r),n)}function w2(r){const n=new Date(r);return n.getTime()>Date.now()?"just now":_2(n,{addSuffix:!0})}function JE(r){return r<=0?"Expired":ph(r)}function S2(r){return r==null?"--":ph(r)}function ph(r){if(r<1e3)return`${Math.round(r)}ms`;if(r<6e4){const h=r/1e3;return Number.isInteger(h)?`${h}s`:`${h.toFixed(1)}s`}const n=Math.floor(r/1e3),s=Math.floor(n/86400),a=Math.floor(n%86400/3600),o=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:f>0?`${o}m ${f}s`:`${o}m`}function QE(r,n){const s=new Date(r).getTime(),a=n?new Date(n).getTime():Date.now();return ph(a-s)}function fy({options:r,children:n,className:s=""}){const[a,o]=T.useState(!1),[f,h]=T.useState(null),[d,g]=T.useState(null),y=T.useRef(null),E=T.useRef(void 0),w=T.useRef(void 0),j=220,q=T.useCallback(()=>{if(!y.current)return;const se=y.current.getBoundingClientRect(),ee=window.innerWidth-j-8,me=Math.max(8,Math.min(se.left,ee));g({top:se.bottom+4,left:me})},[]),M=T.useCallback(async(se,ee)=>{try{await navigator.clipboard.writeText(se),h(ee),clearTimeout(E.current),E.current=setTimeout(()=>h(null),1200)}catch{}},[]),D=T.useCallback(()=>{clearTimeout(w.current),q(),o(!0)},[q]),W=T.useCallback(()=>{w.current=setTimeout(()=>o(!1),150)},[]);return T.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(w.current)},[]),m.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:D,onMouseLeave:W,children:[n,a&&d&&og.createPortal(m.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:d.top,left:d.left},onMouseEnter:D,onMouseLeave:W,children:r.map(se=>m.jsxs("button",{onClick:ee=>{ee.stopPropagation(),M(se.value,se.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:se.label}),m.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===se.label?"✓":se.value})]},se.label))}),document.body)]})}function E2(r,n){const s=new Date(r);switch(n){case"relative":return w2(r);case"datetime":return uy(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function A2(r){const n=new Date(r);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:uy(n,"MMM d, yyyy h:mm:ss a")}]}function O2({date:r,format:n="relative",className:s=""}){const[,a]=T.useState(0);T.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(h=>h+1),3e4);return()=>clearInterval(f)},[n]);const o=T.useMemo(()=>A2(r),[r]);return m.jsx(fy,{options:o,children:m.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:E2(r,n)})})}function j2({ms:r,className:n=""}){const s=S2(r),a=T.useMemo(()=>r==null?[]:[{label:"ms",value:String(r)},{label:"sec",value:`${(r/1e3).toFixed(3)}s`},{label:"text",value:s}],[r,s]);return r==null?m.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:"--"}):m.jsx(fy,{options:a,children:m.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const T2=["sm","md","lg","full"],tg={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"},ng={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function N2({which:r}){const n="stroke-current";switch(r){case"sm":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:n,strokeWidth:"1.5"})});case"md":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:n,strokeWidth:"1.5"})});case"lg":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:n,strokeWidth:"1.5"})});case"full":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:n,strokeWidth:"1.5"})})}}function C2({msg:r}){const[n,s]=T.useState(0);T.useEffect(()=>{const h=new Date(r.timestamp).getTime(),d=()=>s(Math.floor((Date.now()-h)/1e3));d();const g=setInterval(d,1e3);return()=>clearInterval(g)},[r.timestamp]);const a=Math.floor(n/60),o=n%60,f=a>0?`${a}m ${o}s`:`${o}s`;return m.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[m.jsxs("span",{className:"inline-flex items-center gap-1",children:[m.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),m.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),r.workflowId&&m.jsxs(gr,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[m.jsx(Xf,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function k2({msg:r,compileMessage:n}){const s=r.role==="assistant";return m.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[m.jsx(O2,{date:r.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),r.durationMs!=null&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),m.jsx(j2,{ms:r.durationMs,className:"!text-[9px] text-text-muted/50"})]}),r.workflowId&&m.jsx(gr,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:m.jsx(Xf,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&m.jsx("button",{onClick:()=>n(r.id),disabled:r.compilationStatus==="compiling"||r.compilationStatus==="done",className:"transition-colors",title:r.compilationStatus==="done"?"Compiled — future queries will match this pipeline":r.compilationStatus==="error"?r.compilationError??"Compilation failed":r.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:m.jsx(Kx,{className:`w-2.5 h-2.5 ${r.compilationStatus==="done"?"text-status-success":r.compilationStatus==="error"?"text-status-error":r.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function M2(){const{helpOpen:r,setHelpOpen:n,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:f,clearMessages:h,compileMessage:d}=sy(),[g,y]=T.useState(""),[E,w]=T.useState("md"),[j,q]=T.useState(!0),M=T.useRef(null),D=T.useRef(null);if(T.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[s]),T.useEffect(()=>{r&&D.current&&D.current.focus()},[r]),T.useEffect(()=>{if(!r)return;const C=X=>{X.key==="Escape"&&(E==="full"?w("lg"):E==="lg"?w("md"):E==="md"?w("sm"):n(!1))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[r,E,n]),!r)return null;const W=()=>{const C=g.trim();!C||f||(a(C),y(""),D.current&&(D.current.style.height="auto"))},se=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),W())},ee=E==="full",me=o.page.replace(/-/g," "),re=ee?{}:{bottom:"108px"};return m.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${ee?tg.full:`right-6 ${tg[E]}`} ${j?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:re,onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),children:[m.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),m.jsx("p",{className:"text-[10px] text-text-tertiary truncate",children:me})]}),m.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[m.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:T2.map(C=>m.jsx("button",{onClick:()=>w(C),className:`p-1 rounded transition-colors ${C===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":C===E,"aria-label":ng[C],title:ng[C],children:m.jsx(N2,{which:C})},C))}),s.length>0&&m.jsx("button",{onClick:h,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:m.jsx(Zx,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),m.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:m.jsx($o,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),m.jsxs("div",{ref:M,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&m.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(C=>m.jsxs("div",{className:`text-xs leading-relaxed ${C.role==="user"?"text-right":"text-left"}`,children:[m.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${C.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:C.pending?m.jsx(C2,{msg:C}):C.role==="assistant"?m.jsx(mh,{content:C.content}):C.content}),!C.pending&&m.jsx("div",{className:"mt-0.5",children:m.jsx(k2,{msg:C,compileMessage:d})})]},C.id))]}),m.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[m.jsx("textarea",{ref:D,value:g,onChange:C=>{y(C.target.value);const X=C.target;X.style.height="auto",X.style.height=`${Math.min(X.scrollHeight,120)}px`},onKeyDown:se,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!f}),m.jsx("button",{onClick:W,disabled:!g.trim()||!!f,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:m.jsx(Wx,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function R2(){var M;const{isBuilder:r,isOps:n}=Qg(),{data:s}=Ig(),a=!!((M=s==null?void 0:s.ai)!=null&&M.enabled),{collapsed:o,toggle:f}=Kg(),[h,d]=T.useState(!1),[g,y]=T.useState(!1),[E,w]=T.useState(()=>window.location.hash.startsWith("#docs")),j=Ws(),q=T.useRef(null);return T.useEffect(()=>{const D=q.current;D&&(D.classList.remove("animate-page-in"),D.offsetWidth,D.classList.add("animate-page-in"))},[j.pathname]),T.useEffect(()=>{const D=()=>{window.location.hash.startsWith("#docs")&&w(!0)};return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[]),m.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[m.jsx(_w,{onToggleEventFeed:()=>d(D=>!D),onToggleDocs:()=>w(D=>!D)}),m.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m.jsxs("aside",{className:`${o?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[m.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[m.jsx(Ow,{aiEnabled:a,isBuilder:r}),r&&m.jsx(jw,{}),r&&a&&m.jsx(Nw,{}),r&&m.jsx(kw,{}),(r||n)&&m.jsx(Mw,{isBuilder:r})]}),m.jsx("button",{onClick:f,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${o?"flex justify-center":"flex items-center px-7"}`,"aria-label":o?"Expand sidebar":"Collapse sidebar",children:o?m.jsx(ev,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):m.jsx(tv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})})]}),m.jsx("main",{className:"flex-1 overflow-y-auto",children:m.jsx("div",{ref:q,className:"max-w-dashboard mx-auto px-10 py-10 pb-16 animate-page-in",children:m.jsx(Ma,{})})})]}),m.jsx(Kw,{open:h,onToggle:()=>d(D=>!D),configOpen:g,onToggleConfig:()=>y(D=>!D)}),m.jsx(lS,{open:E,onClose:()=>{w(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),a&&m.jsx(hS,{}),a&&m.jsx(M2,{})]})}function D2(){const{isAuthenticated:r}=Oi(),n=Ws();return r?m.jsx(yw,{children:m.jsx(fS,{children:m.jsx(R2,{})})}):m.jsx(cs,{to:"/login",state:{from:n.pathname},replace:!0})}function hy({provider:r,className:n="w-5 h-5"}){switch(r){case"google":return m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[m.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"}),m.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"}),m.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"}),m.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 m.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:m.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 m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[m.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),m.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),m.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),m.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return m.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:m.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 m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[m.jsx("circle",{cx:"12",cy:"12",r:"10"}),m.jsx("path",{d:"M12 8v4l3 3"})]})}}async function z2(){return Ve("/auth/oauth/providers")}async function q2(r,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return Ve(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function IE(){return Pn({queryKey:["oauth-connections"],queryFn:()=>Ve("/auth/oauth/connections")})}function XE(){const r=rn();return _n({mutationFn:({provider:n,label:s})=>q2(n,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function U2(){var ce;const{login:r,isAuthenticated:n}=Oi(),s=cg(),a=Ws(),o=new URLSearchParams(a.search),f=o.get("token"),h=o.get("error"),d=((ce=a.state)==null?void 0:ce.from)??o.get("returnTo")??"/",g=T.useRef(!1);f&&!g.current&&(g.current=!0,r(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[y,E]=T.useState(""),[w,j]=T.useState(""),[q,M]=T.useState(h||""),[D,W]=T.useState(!1),[se,ee]=T.useState(!!f),[me,re]=T.useState([]),C=T.useRef(!1);if(T.useEffect(()=>{f||C.current||(C.current=!0,(async()=>{var V,G,K,ae;try{const ne=await fetch(`${Wt}/api/settings`);if(!ne.ok)return;const ke=await ne.json();if(!((V=ke.auth)!=null&&V.sso))return;const He=await fetch(`${Wt}/api/auth/sso`,{method:"POST"});if(!He.ok){M("Host authentication required — please log in to your organization first");return}const Me=await He.json();Me.token&&((G=ke.auth)!=null&&G.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",ke.auth.ssoLogoutUrl),ee(!0),r(Me.token,void 0,{displayName:(K=Me.user)==null?void 0:K.display_name,username:(ae=Me.user)==null?void 0:ae.external_id}))}catch{}})())},[]),T.useEffect(()=>{f||z2().then(re).catch(()=>{})},[]),T.useEffect(()=>{if(!se)return;const V=setTimeout(()=>s(d,{replace:!0}),1500);return()=>clearTimeout(V)},[se]),n&&!se)return m.jsx(cs,{to:d,replace:!0});const X=async V=>{var G,K;if(V.preventDefault(),M(""),!y.trim()||!w){M("Username and password are required");return}W(!0);try{const ae=await fetch(`${Wt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:w})}),ne=await ae.json();if(!ae.ok){M(ne.error||"Login failed");return}ee(!0),r(ne.token,{username:y.trim(),password:w},{displayName:(G=ne.user)==null?void 0:G.display_name,username:(K=ne.user)==null?void 0:K.external_id})}catch{M("Unable to connect to server")}finally{W(!1)}};return m.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:m.jsxs("div",{className:"w-full max-w-md p-10",children:[m.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${se?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:m.jsx(hh,{size:"lg",hideLabel:se})}),m.jsxs("form",{onSubmit:X,className:`space-y-5 transition-opacity duration-300 ${se?"opacity-0":""}`,children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),m.jsx("input",{id:"username",type:"text",value:y,onChange:V=>E(V.target.value),className:"input",placeholder:"Enter your username",autoFocus:!se,autoComplete:"username"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),m.jsx("input",{id:"password",type:"password",value:w,onChange:V=>j(V.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),q&&m.jsx("p",{className:"text-sm text-status-error",children:q}),m.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:D||se,children:D?"Signing in...":"Sign In"}),me.length>0&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[m.jsx("div",{className:"flex-1 h-px bg-border"}),m.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),m.jsx("div",{className:"flex-1 h-px bg-border"})]}),m.jsx("div",{className:"space-y-2",children:me.filter(V=>V.provider!=="anthropic").map(V=>m.jsxs("a",{href:`${Wt}/api/auth/oauth/${V.provider}?returnTo=${encodeURIComponent(d)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[m.jsx(hy,{provider:V.provider}),"Sign in with ",V.name]},V.provider))})]})]})]})})}function sg(){const{isAuthenticated:r}=Oi(),n=cg(),s=Ws(),a=new URLSearchParams(s.search),o=a.get("state")||"";T.useEffect(()=>{r||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[f,h]=T.useState(""),[d,g]=T.useState(a.get("label")||"default"),[y,E]=T.useState(""),[w,j]=T.useState(!1),q=f.trim().startsWith("sk-ant-oat"),M=f.trim().startsWith("sk-ant-api"),D=W=>{W.preventDefault();const se=f.trim();if(!se){E("A token or API key is required");return}if(!se.startsWith("sk-ant-")){E('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}j(!0),E("");const ee=`${Wt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(se)}&state=${encodeURIComponent(o)}`;window.location.href=ee};return m.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:m.jsxs("div",{className:"w-full max-w-md p-10",children:[m.jsx("div",{className:"mb-10",children:m.jsx(hh,{size:"lg"})}),m.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[m.jsx(hy,{provider:"anthropic",className:"w-6 h-6"}),m.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),m.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."}),m.jsxs("form",{onSubmit:D,className:"space-y-5",children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),m.jsx("input",{id:"token",type:"password",value:f,onChange:W=>h(W.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),q&&m.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),M&&m.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),m.jsx("input",{id:"label",type:"text",value:d,onChange:W=>g(W.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),m.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),y&&m.jsx("p",{className:"text-sm text-status-error",children:y}),m.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:w,children:w?"Validating...":"Connect"}),m.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),m.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[m.jsxs("div",{children:[m.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",m.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-[11px]",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),m.jsxs("div",{children:[m.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",m.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 So({roleTypes:r,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:f}=Oi();return a?m.jsx(Ma,{}):r&&r.some(h=>f(h))?m.jsx(Ma,{}):n&&n.some(h=>o(h))?m.jsx(Ma,{}):m.jsx(cs,{to:s,replace:!0})}function B2({redirectTo:r="/"}){var a;const{data:n,isLoading:s}=Ig();return s||!n?null:(a=n.ai)!=null&&a.enabled?m.jsx(Ma,{}):m.jsx(cs,{to:r,replace:!0})}const L2=T.lazy(()=>_e(()=>import("./ProcessesListPage-vJimii8-.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url).then(r=>({default:r.ProcessesListPage}))),H2=T.lazy(()=>_e(()=>import("./ProcessDetailPage-DjQuNERz.js"),__vite__mapDeps([16,1,2,4,17,13,18,15,9,6,19,20,21]),import.meta.url).then(r=>({default:r.ProcessDetailPage}))),P2=T.lazy(()=>_e(()=>import("./McpOverview-BClbGYb8.js"),__vite__mapDeps([22,1,23,24,25,26,12,13,27,6]),import.meta.url).then(r=>({default:r.McpOverview}))),$2=T.lazy(()=>_e(()=>import("./McpRunsPage-CMfwXQ4R.js"),__vite__mapDeps([28,1,24,25,5,6,29,26,7,8,15,13,9,30,12,11,10,14,31]),import.meta.url).then(r=>({default:r.McpRunsPage}))),Y2=T.lazy(()=>_e(()=>import("./McpRunDetailPage-DRbIZMU2.js"),__vite__mapDeps([32,1,24,18,12,13,33,6,34,35,14,36,37,11]),import.meta.url).then(r=>({default:r.McpRunDetailPage}))),G2=T.lazy(()=>_e(()=>import("./McpQueryPage-qtEuMDrd.js"),__vite__mapDeps([38,1,12,13,7,8,11,10,14,9,30,15,31,5,6,4,39]),import.meta.url).then(r=>({default:r.McpQueryPage}))),V2=T.lazy(()=>_e(()=>import("./McpQueryDetailPage-DHjfDRdm.js"),__vite__mapDeps([40,1,12,13,18,39,6,25,4,41,34,24,3,2,42,43,44,45,46,47,33,48,36]),import.meta.url).then(r=>({default:r.McpQueryDetailPage}))),F2=T.lazy(()=>_e(()=>import("./EscalationsOverview-blGOYKtJ.js"),__vite__mapDeps([49,1,4,12,13,27,6]),import.meta.url).then(r=>({default:r.EscalationsOverview}))),J2=T.lazy(()=>_e(()=>import("./AvailableEscalationsPage-B7gEfcw3.js"),__vite__mapDeps([50,1,4,51,52,6,53,54,5,7,8,10,12,13,21,55,11,56,19,15,9,57,31,14]),import.meta.url).then(r=>({default:r.AvailableEscalationsPage}))),Q2=T.lazy(()=>_e(()=>import("./OperatorDashboard-Dq2pfV68.js"),__vite__mapDeps([58,1,4,54,5,6,7,8,12,13,10,31,55,11,56,19,15,9,57,14]),import.meta.url).then(r=>({default:r.OperatorDashboard}))),I2=T.lazy(()=>_e(()=>import("./index-E2hQ8DIi.js"),__vite__mapDeps([59,1,35,51,52,6,53,54,12,13,57,3,4,20,21,18,19,33,34]),import.meta.url).then(r=>({default:r.EscalationDetailPage}))),X2=T.lazy(()=>_e(()=>import("./WorkflowsOverview-CaMeZwde.js"),__vite__mapDeps([60,1,3,4,12,13,27,6]),import.meta.url).then(r=>({default:r.WorkflowsOverview}))),K2=T.lazy(()=>_e(()=>import("./index-mEQ6kCnt.js"),__vite__mapDeps([61,1,3,12,13,15,62,45,46,6]),import.meta.url).then(r=>({default:r.StartWorkflowPage}))),Z2=T.lazy(()=>_e(()=>import("./index-mEQ6kCnt.js"),__vite__mapDeps([61,1,3,12,13,15,62,45,46,6]),import.meta.url).then(r=>({default:r.DurableInvokePage}))),W2=T.lazy(()=>_e(()=>import("./WorkflowsDashboard-tCBP0i0Y.js"),__vite__mapDeps([63,1,9,30,3,29,26,6,4,5,7,8,15,13,12,11,10,14,31]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),eE=T.lazy(()=>_e(()=>import("./WorkflowsDashboard-tCBP0i0Y.js"),__vite__mapDeps([63,1,9,30,3,29,26,6,4,5,7,8,15,13,12,11,10,14,31]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),tE=T.lazy(()=>_e(()=>import("./YamlWorkflowsPage-DRnYgsvA.js"),__vite__mapDeps([64,1,25,5,6,12,13,11,8,47,62,18]),import.meta.url).then(r=>({default:r.YamlWorkflowsPage}))),nE=T.lazy(()=>_e(()=>import("./GraphInvokePage-QVAUHmjI.js"),__vite__mapDeps([65,1,25,12,13,42,44,45,46,43,6,47,62]),import.meta.url).then(r=>({default:r.GraphInvokePage}))),sE=T.lazy(()=>_e(()=>import("./YamlWorkflowDetailPage-C3uyCiIX.js"),__vite__mapDeps([66,1,25,18,62,13,6]),import.meta.url).then(r=>({default:r.YamlWorkflowDetailPage}))),iE=T.lazy(()=>_e(()=>import("./TasksListPage-qj25rRZL.js"),__vite__mapDeps([67,1,2,3,5,6,7,8,18,56,48,10,11,12,13,15]),import.meta.url).then(r=>({default:r.TasksListPage}))),rE=T.lazy(()=>_e(()=>import("./TaskDetailPage-CgFN5uWn.js"),__vite__mapDeps([68,1,2,18,56,12,13,6]),import.meta.url).then(r=>({default:r.TaskDetailPage}))),ig=T.lazy(()=>_e(()=>import("./WorkflowExecutionPage-CDr5CTM2.js"),__vite__mapDeps([69,1,3,4,35,2,12,13,34,14,18,33,6,36,37,11]),import.meta.url).then(r=>({default:r.WorkflowExecutionPage}))),aE=T.lazy(()=>_e(()=>import("./AdminDashboard-0LSslIQ7.js"),__vite__mapDeps([70,1,2,4,23,17,13,6]),import.meta.url).then(r=>({default:r.AdminDashboard}))),lE=T.lazy(()=>_e(()=>import("./index-CPIYW81T.js"),__vite__mapDeps([71,1,3,7,8,11,31,5,6,12,13,72,15]),import.meta.url).then(r=>({default:r.WorkersPage}))),oE=T.lazy(()=>_e(()=>import("./index-BYpWOUEe.js"),__vite__mapDeps([73,1,3,7,8,74,52,6,11,31,5,12,13,19,72,15,54,45,46,62]),import.meta.url).then(r=>({default:r.WorkflowConfigsPage}))),rg=T.lazy(()=>_e(()=>import("./index-BYpWOUEe.js"),__vite__mapDeps([73,1,3,7,8,74,52,6,11,31,5,12,13,19,72,15,54,45,46,62]),import.meta.url).then(r=>({default:r.WorkflowConfigDetailPage}))),cE=T.lazy(()=>_e(()=>import("./index-DBi9Q9Hw.js"),__vite__mapDeps([75,1,23,8,74,52,6,12,13,11,10,5,76,44,45,46,47,43,31,18]),import.meta.url).then(r=>({default:r.McpServersPage}))),ag=T.lazy(()=>_e(()=>import("./index-Dhy2PVAw.js"),__vite__mapDeps([77,1,23,12,13,41,6]),import.meta.url).then(r=>({default:r.McpServerDetailPage}))),uE=T.lazy(()=>_e(()=>import("./index-rUST2YsO.js"),__vite__mapDeps([78,1,21,5,6,7,8,10,11,9,74,52,31,12,13,19,46,54,48]),import.meta.url).then(r=>({default:r.UsersPage}))),fE=T.lazy(()=>_e(()=>import("./RolesPage-CFCN_mRF.js"),__vite__mapDeps([79,1,54,7,8,74,52,6,12,13,31]),import.meta.url).then(r=>({default:r.RolesPage}))),hE=T.lazy(()=>_e(()=>import("./index-BW-fIquS.js"),__vite__mapDeps([80,1,12,13,52,6,53]),import.meta.url).then(r=>({default:r.MaintenancePage}))),dE=T.lazy(()=>_e(()=>import("./index-DRIJM1L-.js"),__vite__mapDeps([81,1,17,13,11,5,6,29,26,52,34,72,7,8,31]),import.meta.url).then(r=>({default:r.ControlPlanePage}))),mE=T.lazy(()=>_e(()=>import("./index-u08vQUaw.js"),__vite__mapDeps([82,1,6,5,29,26,7,8,10,11,9,12,13,14]),import.meta.url).then(r=>({default:r.StreamMessagesPage}))),pE=T.lazy(()=>_e(()=>import("./CredentialsPage-C08U6dlv.js"),__vite__mapDeps([83,1,12,13,48,74,52,6]),import.meta.url).then(r=>({default:r.CredentialsPage}))),gE=T.lazy(()=>_e(()=>import("./index-Cydgj_Co.js"),__vite__mapDeps([84,1,6,12,13,11,14,8,85,48]),import.meta.url).then(r=>({default:r.FilesPage}))),yE=T.lazy(()=>_e(()=>import("./index-BNkpns_E.js"),__vite__mapDeps([86,1,12,13,11,14,10,8,85,48,87,41,6]),import.meta.url).then(r=>({default:r.KnowledgePage}))),bE=T.lazy(()=>_e(()=>import("./HomePage-DvYgvCcO.js"),__vite__mapDeps([88,1,3,24,26,2,4,19,13,15,14,6]),import.meta.url).then(r=>({default:r.HomePage}))),xE=T.lazy(()=>_e(()=>import("./AgentsPage-tJIlrnfM.js"),__vite__mapDeps([89,1,90,4,5,6,7,8,10,11,12,13,14]),import.meta.url).then(r=>({default:r.AgentsPage}))),vE=T.lazy(()=>_e(()=>import("./AgentDetailPage-bnXR1ezD.js"),__vite__mapDeps([91,1,90,92,13,4,15,6]),import.meta.url).then(r=>({default:r.AgentDetailPage}))),lg=T.lazy(()=>_e(()=>import("./AgentConfigPage-hqBr1540.js"),__vite__mapDeps([93,1,90,92,13,12,87,44,45,46,3,25,94,95,15,6]),import.meta.url).then(r=>({default:r.AgentConfigPage}))),_E=T.lazy(()=>_e(()=>import("./CapabilitiesPage-DotZ7iQc.js"),__vite__mapDeps([96,1,94,76,23,44,45,46,13,47,6,43,12]),import.meta.url).then(r=>({default:r.CapabilitiesPage}))),wE=T.lazy(()=>_e(()=>import("./TopicsPage-C5nOLsLx.js"),__vite__mapDeps([97,1,95,5,6,7,8,10,11,12,13,14]),import.meta.url).then(r=>({default:r.TopicsPage}))),SE=T.lazy(()=>_e(()=>import("./TopicDetailPage-DLY6X_R6.js"),__vite__mapDeps([98,1,95,14,13,6]),import.meta.url).then(r=>({default:r.TopicDetailPage})));function EE(){return m.jsxs("div",{className:"animate-pulse space-y-4",children:[m.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),m.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function xe({children:r}){return m.jsx(T.Suspense,{fallback:m.jsx(EE,{}),children:m.jsx("div",{className:"animate-page-enter",children:r})})}const dy=new Ex({defaultOptions:{queries:{staleTime:1e4,retry:(r,n)=>n instanceof Error&&n.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{dy.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=`${window.__LT_BASE__||""}/login`;window.location.pathname!==n&&(window.location.href=`${n}?returnTo=${encodeURIComponent(window.location.pathname)}`)});const AE=jx([{path:"/login",element:m.jsx(U2,{})},{path:"/connect/anthropic",element:m.jsx(sg,{})},{path:"/connect/:provider",element:m.jsx(sg,{})},{path:"/",element:m.jsx(D2,{}),children:[{index:!0,element:m.jsx(xe,{children:m.jsx(bE,{})})},{path:"processes/all",element:m.jsx(xe,{children:m.jsx(L2,{})})},{path:"processes/detail/:originId",element:m.jsx(xe,{children:m.jsx(H2,{})})},{path:"credentials",element:m.jsx(xe,{children:m.jsx(pE,{})})},{path:"connections",element:m.jsx(cs,{to:"/credentials",replace:!0})},{path:"escalations",element:m.jsx(xe,{children:m.jsx(F2,{})})},{path:"escalations/available",element:m.jsx(xe,{children:m.jsx(J2,{})})},{path:"escalations/queue",element:m.jsx(xe,{children:m.jsx(Q2,{})})},{path:"escalations/detail/:id",element:m.jsx(xe,{children:m.jsx(I2,{})})},{path:"capabilities",element:m.jsx(xe,{children:m.jsx(_E,{})})},{path:"agents",element:m.jsx(xe,{children:m.jsx(xE,{})})},{path:"agents/new",element:m.jsx(xe,{children:m.jsx(lg,{})})},{path:"agents/:id",element:m.jsx(xe,{children:m.jsx(vE,{})})},{path:"agents/:id/edit",element:m.jsx(xe,{children:m.jsx(lg,{})})},{path:"topics",element:m.jsx(xe,{children:m.jsx(wE,{})})},{path:"topics/:topic",element:m.jsx(xe,{children:m.jsx(SE,{})})},{element:m.jsx(So,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:m.jsx(xe,{children:m.jsx(X2,{})})},{path:"workflows/executions",element:m.jsx(xe,{children:m.jsx(eE,{})})},{path:"workflows/durable/executions",element:m.jsx(xe,{children:m.jsx(W2,{})})},{path:"workflows/durable/executions/:workflowId",element:m.jsx(xe,{children:m.jsx(ig,{})})},{path:"workflows/tasks",element:m.jsx(xe,{children:m.jsx(iE,{})})},{path:"workflows/tasks/detail/:id",element:m.jsx(xe,{children:m.jsx(rE,{})})},{path:"workflows/executions/:workflowId",element:m.jsx(xe,{children:m.jsx(ig,{})})},{path:"workflows/start",element:m.jsx(xe,{children:m.jsx(K2,{})})},{path:"workflows/durable/invoke",element:m.jsx(xe,{children:m.jsx(Z2,{})})},{path:"workflows/cron",element:m.jsx(cs,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:m.jsx(xe,{children:m.jsx(lE,{})})},{path:"workflows/registry",element:m.jsx(xe,{children:m.jsx(oE,{})})},{path:"workflows/registry/new",element:m.jsx(xe,{children:m.jsx(rg,{})})},{path:"workflows/registry/:workflowType",element:m.jsx(xe,{children:m.jsx(rg,{})})}]},{element:m.jsx(So,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:m.jsx(xe,{children:m.jsx(tE,{})})},{path:"mcp/workflows/invoke",element:m.jsx(xe,{children:m.jsx(nE,{})})},{path:"mcp/workflows/:id",element:m.jsx(xe,{children:m.jsx(sE,{})})},{path:"mcp/executions",element:m.jsx(xe,{children:m.jsx($2,{})})},{path:"mcp/executions/:jobId",element:m.jsx(xe,{children:m.jsx(Y2,{})})},{path:"files",element:m.jsx(xe,{children:m.jsx(gE,{})})},{path:"knowledge",element:m.jsx(xe,{children:m.jsx(yE,{})})},{element:m.jsx(B2,{}),children:[{path:"mcp",element:m.jsx(xe,{children:m.jsx(P2,{})})},{path:"mcp/queries",element:m.jsx(xe,{children:m.jsx(G2,{})})},{path:"mcp/queries/:workflowId",element:m.jsx(xe,{children:m.jsx(V2,{})})},{path:"mcp/tools",element:m.jsx(cs,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:m.jsx(xe,{children:m.jsx(cE,{})})},{path:"mcp/servers/new",element:m.jsx(xe,{children:m.jsx(ag,{})})},{path:"mcp/servers/:serverId",element:m.jsx(xe,{children:m.jsx(ag,{})})}]}]},{element:m.jsx(So,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:m.jsx(xe,{children:m.jsx(aE,{})})},{path:"admin/users",element:m.jsx(xe,{children:m.jsx(uE,{})})}]},{element:m.jsx(So,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:m.jsx(cs,{to:"/admin/users?tab=service-accounts",replace:!0})},{path:"admin/escalation-chains",element:m.jsx(cs,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:m.jsx(xe,{children:m.jsx(fE,{})})},{path:"admin/maintenance",element:m.jsx(xe,{children:m.jsx(hE,{})})},{path:"admin/controlplane",element:m.jsx(xe,{children:m.jsx(dE,{})})},{path:"admin/streams",element:m.jsx(xe,{children:m.jsx(mE,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function OE(){return m.jsx(Ax,{client:dy,children:m.jsx(uv,{children:m.jsx(mw,{children:m.jsx(Tx,{router:AE})})})})}av.createRoot(document.getElementById("root")).render(m.jsx(T.StrictMode,{children:m.jsx(OE,{})}));export{fy as A,JE as B,dh as C,j2 as D,ph as E,Wg as F,IE as G,XE as H,pg as I,Qw as J,Wt as L,d_ as N,hy as O,qw as S,QE as a,p_ as b,O2 as c,Ve as d,DE as e,S2 as f,qE as g,BE as h,ME as i,Oi as j,HE as k,PE as l,$E as m,YE as n,GE as o,FE as p,RE as q,xw as r,bw as s,Qg as t,Ig as u,UE as v,zE as w,LE as x,VE as y,uy as z};
|
|
63
|
-
//# sourceMappingURL=index-
|
|
61
|
+
`}function oS(r){const n=r.summary,s=r.title;if(n){const a=n.search(/\n\s*\{[\s\S]*"title"\s*:/);return a>0?n.slice(0,a).trim():n}return s||(typeof r=="string"?r:"Query completed.")}const ny=T.createContext(null);function cS({children:r}){const n=Ws(),[s,a]=T.useState(!1),[o,f]=T.useState([]),[h,m]=T.useState(null),[g,y]=T.useState({}),E=T.useRef(null),w={page:n.pathname.split("/").filter(Boolean).join("-")||"home",route:n.pathname,params:{},...g,suggestedTags:g.suggestedTags??aS(n.pathname)};T.useEffect(()=>()=>{E.current&&clearInterval(E.current)},[]);const O=T.useCallback(()=>a(se=>!se),[]),q=T.useCallback(se=>{y(se)},[]),M=T.useCallback(()=>{f([]),m(null)},[]),D=T.useCallback(async se=>{var V;const ee=new Date().toISOString(),me={id:`user-${Date.now()}`,role:"user",content:se,timestamp:ee},re={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:ee,pending:!0};f(G=>[...G,me,re]);const C={...w};(V=C.entities)!=null&&V.yamlContent&&C.entities.yamlContent.length>V0&&(C.entities={...C.entities,yamlContent:C.entities.yamlContent.slice(0,V0)+`
|
|
62
|
+
... (truncated)`});const ce=`${lS(o.concat(me))}${se}`;try{const K=(await Ve("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ce,tags:C.suggestedTags,context:C,wait:!1,direct:!0})})).workflow_id;m(K),f(ae=>ae.map(ne=>ne.id===re.id?{...ne,workflowId:K}:ne)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var ae;try{const ne=await Ve(`/workflows/${K}/result`),ke=(ae=ne==null?void 0:ne.result)==null?void 0:ae.data;if(ke){E.current&&clearInterval(E.current),E.current=null,m(null);const He=oS(ke);let Me;try{Me=(await Ve(`/workflow-states/${K}/execution`)).duration_ms}catch{}f($=>$.map(te=>te.id===re.id?{...te,content:He,timestamp:new Date().toISOString(),pending:!1,durationMs:Me}:te))}}catch{}},3e3)}catch{f(G=>G.map(K=>K.id===re.id?{...K,content:"Failed to submit query. Please try again.",pending:!1}:K))}},[o,w]),W=T.useCallback(async se=>{const ee=o.find(C=>C.id===se);if(!(ee!=null&&ee.workflowId)||ee.compilationStatus==="compiling"||ee.compilationStatus==="done")return;const me=o.indexOf(ee),re=o.slice(0,me).reverse().find(C=>C.role==="user");if(re){f(C=>C.map(X=>X.id===se?{...X,compilationStatus:"compiling"}:X));try{const C=await Ve("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:re.content,summary:ee.content})}),X=await Ve("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:ee.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:C.tool_name,description:C.description,tags:C.tags,app_id:""})});await Ve(`/yaml-workflows/${X.id}/deploy`,{method:"POST"}),f(ce=>ce.map(V=>V.id===se?{...V,compilationStatus:"done"}:V))}catch(C){const X=C instanceof Error?C.message:"Compilation failed";f(ce=>ce.map(V=>V.id===se?{...V,compilationStatus:"error",compilationError:X}:V))}}},[o]);return d.jsx(ny.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:O,messages:o,sendMessage:D,pageContext:w,setPageContext:q,activeWorkflowId:h,clearMessages:M,compileMessage:W},children:r})}function sy(){const r=T.useContext(ny);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function uS(){const{helpOpen:r,toggleHelp:n}=sy();return d.jsx("button",{onClick:n,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":r?"Close help":"Ask for help",children:r?d.jsx($o,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):d.jsx("img",{src:`${Wt}/logo512.png`,alt:"Help",className:"w-8 h-8 -rotate-[120deg]"})})}const iy=6048e5,fS=864e5,F0=6e4,J0=525600,I0=43200,Q0=1440,X0=Symbol.for("constructDateFrom");function ds(r,n){return typeof r=="function"?r(n):r&&typeof r=="object"&&X0 in r?r[X0](n):r instanceof Date?new r.constructor(n):new Date(n)}function sn(r,n){return ds(n||r,r)}let hS={};function Fa(){return hS}function $a(r,n){var m,g,y,E;const s=Fa(),a=(n==null?void 0:n.weekStartsOn)??((g=(m=n==null?void 0:n.locale)==null?void 0:m.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.weekStartsOn)??0,o=sn(r,n==null?void 0:n.in),f=o.getDay(),h=(f<a?7:0)+f-a;return o.setDate(o.getDate()-h),o.setHours(0,0,0,0),o}function Ho(r,n){return $a(r,{...n,weekStartsOn:1})}function ry(r,n){const s=sn(r,n==null?void 0:n.in),a=s.getFullYear(),o=ds(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const f=Ho(o),h=ds(s,0);h.setFullYear(a,0,4),h.setHours(0,0,0,0);const m=Ho(h);return s.getTime()>=f.getTime()?a+1:s.getTime()>=m.getTime()?a:a-1}function Po(r){const n=sn(r),s=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return s.setUTCFullYear(n.getFullYear()),+r-+s}function ay(r,...n){const s=ds.bind(null,r||n.find(a=>typeof a=="object"));return n.map(s)}function K0(r,n){const s=sn(r,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function dS(r,n,s){const[a,o]=ay(s==null?void 0:s.in,r,n),f=K0(a),h=K0(o),m=+f-Po(f),g=+h-Po(h);return Math.round((m-g)/fS)}function mS(r,n){const s=ry(r,n),a=ds(r,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),Ho(a)}function pS(r,n){const s=+sn(r)-+sn(n);return s<0?-1:s>0?1:s}function gS(r){return ds(r,Date.now())}function yS(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function bS(r){return!(!yS(r)&&typeof r!="number"||isNaN(+sn(r)))}function xS(r){return n=>{const a=(r?Math[r]:Math.trunc)(n);return a===0?0:a}}function vS(r,n){const s=sn(r,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const _S={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"}},wS=(r,n,s)=>{let a;const o=_S[r];return typeof o=="string"?a=o:n===1?a=o.one:a=o.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function Sf(r){return(n={})=>{const s=n.width?String(n.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const SS={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ES={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},AS={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},jS={date:Sf({formats:SS,defaultWidth:"full"}),time:Sf({formats:ES,defaultWidth:"full"}),dateTime:Sf({formats:AS,defaultWidth:"full"})},OS={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},TS=(r,n,s,a)=>OS[r];function Ta(r){return(n,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let o;if(a==="formatting"&&r.formattingValues){const h=r.defaultFormattingWidth||r.defaultWidth,m=s!=null&&s.width?String(s.width):h;o=r.formattingValues[m]||r.formattingValues[h]}else{const h=r.defaultWidth,m=s!=null&&s.width?String(s.width):r.defaultWidth;o=r.values[m]||r.values[h]}const f=r.argumentCallback?r.argumentCallback(n):n;return o[f]}}const NS={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},CS={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},kS={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"]},MS={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"]},RS={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"}},DS={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"}},zS=(r,n)=>{const s=Number(r),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},qS={ordinalNumber:zS,era:Ta({values:NS,defaultWidth:"wide"}),quarter:Ta({values:CS,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Ta({values:kS,defaultWidth:"wide"}),day:Ta({values:MS,defaultWidth:"wide"}),dayPeriod:Ta({values:RS,defaultWidth:"wide",formattingValues:DS,defaultFormattingWidth:"wide"})};function Na(r){return(n,s={})=>{const a=s.width,o=a&&r.matchPatterns[a]||r.matchPatterns[r.defaultMatchWidth],f=n.match(o);if(!f)return null;const h=f[0],m=a&&r.parsePatterns[a]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(m)?BS(m,w=>w.test(h)):US(m,w=>w.test(h));let y;y=r.valueCallback?r.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const E=n.slice(h.length);return{value:y,rest:E}}}function US(r,n){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&n(r[s]))return s}function BS(r,n){for(let s=0;s<r.length;s++)if(n(r[s]))return s}function LS(r){return(n,s={})=>{const a=n.match(r.matchPattern);if(!a)return null;const o=a[0],f=n.match(r.parsePattern);if(!f)return null;let h=r.valueCallback?r.valueCallback(f[0]):f[0];h=s.valueCallback?s.valueCallback(h):h;const m=n.slice(o.length);return{value:h,rest:m}}}const HS=/^(\d+)(th|st|nd|rd)?/i,PS=/\d+/i,$S={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},YS={any:[/^b/i,/^(a|c)/i]},GS={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},VS={any:[/1/i,/2/i,/3/i,/4/i]},FS={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},JS={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]},IS={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},QS={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]},XS={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},KS={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}},ZS={ordinalNumber:LS({matchPattern:HS,parsePattern:PS,valueCallback:r=>parseInt(r,10)}),era:Na({matchPatterns:$S,defaultMatchWidth:"wide",parsePatterns:YS,defaultParseWidth:"any"}),quarter:Na({matchPatterns:GS,defaultMatchWidth:"wide",parsePatterns:VS,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Na({matchPatterns:FS,defaultMatchWidth:"wide",parsePatterns:JS,defaultParseWidth:"any"}),day:Na({matchPatterns:IS,defaultMatchWidth:"wide",parsePatterns:QS,defaultParseWidth:"any"}),dayPeriod:Na({matchPatterns:XS,defaultMatchWidth:"any",parsePatterns:KS,defaultParseWidth:"any"})},ly={code:"en-US",formatDistance:wS,formatLong:jS,formatRelative:TS,localize:qS,match:ZS,options:{weekStartsOn:0,firstWeekContainsDate:1}};function WS(r,n){const s=sn(r,n==null?void 0:n.in);return dS(s,vS(s))+1}function e2(r,n){const s=sn(r,n==null?void 0:n.in),a=+Ho(s)-+mS(s);return Math.round(a/iy)+1}function oy(r,n){var E,w,O,q;const s=sn(r,n==null?void 0:n.in),a=s.getFullYear(),o=Fa(),f=(n==null?void 0:n.firstWeekContainsDate)??((w=(E=n==null?void 0:n.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??o.firstWeekContainsDate??((q=(O=o.locale)==null?void 0:O.options)==null?void 0:q.firstWeekContainsDate)??1,h=ds((n==null?void 0:n.in)||r,0);h.setFullYear(a+1,0,f),h.setHours(0,0,0,0);const m=$a(h,n),g=ds((n==null?void 0:n.in)||r,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=$a(g,n);return+s>=+m?a+1:+s>=+y?a:a-1}function t2(r,n){var m,g,y,E;const s=Fa(),a=(n==null?void 0:n.firstWeekContainsDate)??((g=(m=n==null?void 0:n.locale)==null?void 0:m.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.firstWeekContainsDate)??1,o=oy(r,n),f=ds((n==null?void 0:n.in)||r,0);return f.setFullYear(o,0,a),f.setHours(0,0,0,0),$a(f,n)}function n2(r,n){const s=sn(r,n==null?void 0:n.in),a=+$a(s,n)-+t2(s,n);return Math.round(a/iy)+1}function Ge(r,n){const s=r<0?"-":"",a=Math.abs(r).toString().padStart(n,"0");return s+a}const Vs={y(r,n){const s=r.getFullYear(),a=s>0?s:1-s;return Ge(n==="yy"?a%100:a,n.length)},M(r,n){const s=r.getMonth();return n==="M"?String(s+1):Ge(s+1,2)},d(r,n){return Ge(r.getDate(),n.length)},a(r,n){const s=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(r,n){return Ge(r.getHours()%12||12,n.length)},H(r,n){return Ge(r.getHours(),n.length)},m(r,n){return Ge(r.getMinutes(),n.length)},s(r,n){return Ge(r.getSeconds(),n.length)},S(r,n){const s=n.length,a=r.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Ge(o,n.length)}},gr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Z0={G:function(r,n,s){const a=r.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(r,n,s){if(n==="yo"){const a=r.getFullYear(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Vs.y(r,n)},Y:function(r,n,s,a){const o=oy(r,a),f=o>0?o:1-o;if(n==="YY"){const h=f%100;return Ge(h,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):Ge(f,n.length)},R:function(r,n){const s=ry(r);return Ge(s,n.length)},u:function(r,n){const s=r.getFullYear();return Ge(s,n.length)},Q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return Ge(a,2);case"Qo":return s.ordinalNumber(a,{unit:"quarter"});case"QQQ":return s.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(a,{width:"wide",context:"formatting"})}},q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return Ge(a,2);case"qo":return s.ordinalNumber(a,{unit:"quarter"});case"qqq":return s.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(a,{width:"wide",context:"standalone"})}},M:function(r,n,s){const a=r.getMonth();switch(n){case"M":case"MM":return Vs.M(r,n);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(r,n,s){const a=r.getMonth();switch(n){case"L":return String(a+1);case"LL":return Ge(a+1,2);case"Lo":return s.ordinalNumber(a+1,{unit:"month"});case"LLL":return s.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(a,{width:"wide",context:"standalone"})}},w:function(r,n,s,a){const o=n2(r,a);return n==="wo"?s.ordinalNumber(o,{unit:"week"}):Ge(o,n.length)},I:function(r,n,s){const a=e2(r);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):Ge(a,n.length)},d:function(r,n,s){return n==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):Vs.d(r,n)},D:function(r,n,s){const a=WS(r);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Ge(a,n.length)},E:function(r,n,s){const a=r.getDay();switch(n){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return Ge(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return Ge(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(r,n,s){const a=r.getDay(),o=a===0?7:a;switch(n){case"i":return String(o);case"ii":return Ge(o,n.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(r,n,s){const o=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(r,n,s){const a=r.getHours();let o;switch(a===12?o=gr.noon:a===0?o=gr.midnight:o=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(r,n,s){const a=r.getHours();let o;switch(a>=17?o=gr.evening:a>=12?o=gr.afternoon:a>=4?o=gr.morning:o=gr.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(r,n,s){if(n==="ho"){let a=r.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return Vs.h(r,n)},H:function(r,n,s){return n==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):Vs.H(r,n)},K:function(r,n,s){const a=r.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Ge(a,n.length)},k:function(r,n,s){let a=r.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):Ge(a,n.length)},m:function(r,n,s){return n==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):Vs.m(r,n)},s:function(r,n,s){return n==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):Vs.s(r,n)},S:function(r,n){return Vs.S(r,n)},X:function(r,n,s){const a=r.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return eg(a);case"XXXX":case"XX":return Ei(a);case"XXXXX":case"XXX":default:return Ei(a,":")}},x:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"x":return eg(a);case"xxxx":case"xx":return Ei(a);case"xxxxx":case"xxx":default:return Ei(a,":")}},O:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+W0(a,":");case"OOOO":default:return"GMT"+Ei(a,":")}},z:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+W0(a,":");case"zzzz":default:return"GMT"+Ei(a,":")}},t:function(r,n,s){const a=Math.trunc(+r/1e3);return Ge(a,n.length)},T:function(r,n,s){return Ge(+r,n.length)}};function W0(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Math.trunc(a/60),f=a%60;return f===0?s+String(o):s+String(o)+n+Ge(f,2)}function eg(r,n){return r%60===0?(r>0?"-":"+")+Ge(Math.abs(r)/60,2):Ei(r,n)}function Ei(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Ge(Math.trunc(a/60),2),f=Ge(a%60,2);return s+o+n+f}const tg=(r,n)=>{switch(r){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},cy=(r,n)=>{switch(r){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},s2=(r,n)=>{const s=r.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return tg(r,n);let f;switch(a){case"P":f=n.dateTime({width:"short"});break;case"PP":f=n.dateTime({width:"medium"});break;case"PPP":f=n.dateTime({width:"long"});break;case"PPPP":default:f=n.dateTime({width:"full"});break}return f.replace("{{date}}",tg(a,n)).replace("{{time}}",cy(o,n))},i2={p:cy,P:s2},r2=/^D+$/,a2=/^Y+$/,l2=["D","DD","YY","YYYY"];function o2(r){return r2.test(r)}function c2(r){return a2.test(r)}function u2(r,n,s){const a=f2(r,n,s);if(console.warn(a),l2.includes(r))throw new RangeError(a)}function f2(r,n,s){const a=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${n}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const h2=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,d2=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,m2=/^'([^]*?)'?$/,p2=/''/g,g2=/[a-zA-Z]/;function uy(r,n,s){var E,w,O,q;const a=Fa(),o=a.locale??ly,f=a.firstWeekContainsDate??((w=(E=a.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??1,h=a.weekStartsOn??((q=(O=a.locale)==null?void 0:O.options)==null?void 0:q.weekStartsOn)??0,m=sn(r,s==null?void 0:s.in);if(!bS(m))throw new RangeError("Invalid time value");let g=n.match(d2).map(M=>{const D=M[0];if(D==="p"||D==="P"){const W=i2[D];return W(M,o.formatLong)}return M}).join("").match(h2).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const D=M[0];if(D==="'")return{isToken:!1,value:y2(M)};if(Z0[D])return{isToken:!0,value:M};if(D.match(g2))throw new RangeError("Format string contains an unescaped latin alphabet character `"+D+"`");return{isToken:!1,value:M}});o.localize.preprocessor&&(g=o.localize.preprocessor(m,g));const y={firstWeekContainsDate:f,weekStartsOn:h,locale:o};return g.map(M=>{if(!M.isToken)return M.value;const D=M.value;(c2(D)||o2(D))&&u2(D,n,String(r));const W=Z0[D[0]];return W(m,D,o.localize,y)}).join("")}function y2(r){const n=r.match(m2);return n?n[1].replace(p2,"'"):r}function b2(r,n,s){const a=Fa(),o=(s==null?void 0:s.locale)??a.locale??ly,f=pS(r,n);if(isNaN(f))throw new RangeError("Invalid time value");const h=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[m,g]=ay(s==null?void 0:s.in,...f>0?[n,r]:[r,n]),y=xS((s==null?void 0:s.roundingMethod)??"round"),E=g.getTime()-m.getTime(),w=E/F0,O=Po(g)-Po(m),q=(E-O)/F0,M=s==null?void 0:s.unit;let D;if(M?D=M:w<1?D="second":w<60?D="minute":w<Q0?D="hour":q<I0?D="day":q<J0?D="month":D="year",D==="second"){const W=y(E/1e3);return o.formatDistance("xSeconds",W,h)}else if(D==="minute"){const W=y(w);return o.formatDistance("xMinutes",W,h)}else if(D==="hour"){const W=y(w/60);return o.formatDistance("xHours",W,h)}else if(D==="day"){const W=y(q/Q0);return o.formatDistance("xDays",W,h)}else if(D==="month"){const W=y(q/I0);return W===12&&M!=="month"?o.formatDistance("xYears",1,h):o.formatDistance("xMonths",W,h)}else{const W=y(q/J0);return o.formatDistance("xYears",W,h)}}function x2(r,n){return b2(r,gS(r),n)}function v2(r){const n=new Date(r);return n.getTime()>Date.now()?"just now":x2(n,{addSuffix:!0})}function FE(r){return r<=0?"Expired":gh(r)}function _2(r){return r==null?"--":gh(r)}function gh(r){if(r<1e3)return`${Math.round(r)}ms`;if(r<6e4){const h=r/1e3;return Number.isInteger(h)?`${h}s`:`${h.toFixed(1)}s`}const n=Math.floor(r/1e3),s=Math.floor(n/86400),a=Math.floor(n%86400/3600),o=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:f>0?`${o}m ${f}s`:`${o}m`}function JE(r,n){const s=new Date(r).getTime(),a=n?new Date(n).getTime():Date.now();return gh(a-s)}function fy({options:r,children:n,className:s=""}){const[a,o]=T.useState(!1),[f,h]=T.useState(null),[m,g]=T.useState(null),y=T.useRef(null),E=T.useRef(void 0),w=T.useRef(void 0),O=220,q=T.useCallback(()=>{if(!y.current)return;const se=y.current.getBoundingClientRect(),ee=window.innerWidth-O-8,me=Math.max(8,Math.min(se.left,ee));g({top:se.bottom+4,left:me})},[]),M=T.useCallback(async(se,ee)=>{try{await navigator.clipboard.writeText(se),h(ee),clearTimeout(E.current),E.current=setTimeout(()=>h(null),1200)}catch{}},[]),D=T.useCallback(()=>{clearTimeout(w.current),q(),o(!0)},[q]),W=T.useCallback(()=>{w.current=setTimeout(()=>o(!1),150)},[]);return T.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(w.current)},[]),d.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:D,onMouseLeave:W,children:[n,a&&m&&cg.createPortal(d.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:m.top,left:m.left},onMouseEnter:D,onMouseLeave:W,children:r.map(se=>d.jsxs("button",{onClick:ee=>{ee.stopPropagation(),M(se.value,se.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[d.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:se.label}),d.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===se.label?"✓":se.value})]},se.label))}),document.body)]})}function w2(r,n){const s=new Date(r);switch(n){case"relative":return v2(r);case"datetime":return uy(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function S2(r){const n=new Date(r);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:uy(n,"MMM d, yyyy h:mm:ss a")}]}function E2({date:r,format:n="relative",className:s=""}){const[,a]=T.useState(0);T.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(h=>h+1),3e4);return()=>clearInterval(f)},[n]);const o=T.useMemo(()=>S2(r),[r]);return d.jsx(fy,{options:o,children:d.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:w2(r,n)})})}function A2({ms:r,className:n=""}){const s=_2(r),a=T.useMemo(()=>r==null?[]:[{label:"ms",value:String(r)},{label:"sec",value:`${(r/1e3).toFixed(3)}s`},{label:"text",value:s}],[r,s]);return r==null?d.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:"--"}):d.jsx(fy,{options:a,children:d.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const j2=["sm","md","lg","full"],ng={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"},sg={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function O2({which:r}){const n="stroke-current";switch(r){case"sm":return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:d.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:n,strokeWidth:"1.5"})});case"md":return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:d.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:n,strokeWidth:"1.5"})});case"lg":return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:d.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:n,strokeWidth:"1.5"})});case"full":return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:d.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:n,strokeWidth:"1.5"})})}}function T2({msg:r}){const[n,s]=T.useState(0);T.useEffect(()=>{const h=new Date(r.timestamp).getTime(),m=()=>s(Math.floor((Date.now()-h)/1e3));m();const g=setInterval(m,1e3);return()=>clearInterval(g)},[r.timestamp]);const a=Math.floor(n/60),o=n%60,f=a>0?`${a}m ${o}s`:`${o}s`;return d.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[d.jsxs("span",{className:"inline-flex items-center gap-1",children:[d.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),d.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),d.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),d.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),d.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),r.workflowId&&d.jsxs(yr,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[d.jsx(Kf,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function N2({msg:r,compileMessage:n}){const s=r.role==="assistant";return d.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[d.jsx(E2,{date:r.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),r.durationMs!=null&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),d.jsx(A2,{ms:r.durationMs,className:"!text-[9px] text-text-muted/50"})]}),r.workflowId&&d.jsx(yr,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:d.jsx(Kf,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&d.jsx("button",{onClick:()=>n(r.id),disabled:r.compilationStatus==="compiling"||r.compilationStatus==="done",className:"transition-colors",title:r.compilationStatus==="done"?"Compiled — future queries will match this pipeline":r.compilationStatus==="error"?r.compilationError??"Compilation failed":r.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:d.jsx(Qx,{className:`w-2.5 h-2.5 ${r.compilationStatus==="done"?"text-status-success":r.compilationStatus==="error"?"text-status-error":r.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function C2(){const{helpOpen:r,setHelpOpen:n,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:f,clearMessages:h,compileMessage:m}=sy(),[g,y]=T.useState(""),[E,w]=T.useState("md"),[O,q]=T.useState(!0),M=T.useRef(null),D=T.useRef(null);if(T.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[s]),T.useEffect(()=>{r&&D.current&&D.current.focus()},[r]),T.useEffect(()=>{if(!r)return;const C=X=>{X.key==="Escape"&&(E==="full"?w("lg"):E==="lg"?w("md"):E==="md"?w("sm"):n(!1))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[r,E,n]),!r)return null;const W=()=>{const C=g.trim();!C||f||(a(C),y(""),D.current&&(D.current.style.height="auto"))},se=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),W())},ee=E==="full",me=o.page.replace(/-/g," "),re=ee?{}:{bottom:"108px"};return d.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${ee?ng.full:`right-6 ${ng[E]}`} ${O?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:re,onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),children:[d.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${O?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),d.jsx("p",{className:"text-[10px] text-text-tertiary truncate",children:me})]}),d.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[d.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:j2.map(C=>d.jsx("button",{onClick:()=>w(C),className:`p-1 rounded transition-colors ${C===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":C===E,"aria-label":sg[C],title:sg[C],children:d.jsx(O2,{which:C})},C))}),s.length>0&&d.jsx("button",{onClick:h,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:d.jsx(Xx,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),d.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:d.jsx($o,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),d.jsxs("div",{ref:M,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${O?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&d.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(C=>d.jsxs("div",{className:`text-xs leading-relaxed ${C.role==="user"?"text-right":"text-left"}`,children:[d.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${C.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:C.pending?d.jsx(T2,{msg:C}):C.role==="assistant"?d.jsx(ph,{content:C.content}):C.content}),!C.pending&&d.jsx("div",{className:"mt-0.5",children:d.jsx(N2,{msg:C,compileMessage:m})})]},C.id))]}),d.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${O?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[d.jsx("textarea",{ref:D,value:g,onChange:C=>{y(C.target.value);const X=C.target;X.style.height="auto",X.style.height=`${Math.min(X.scrollHeight,120)}px`},onKeyDown:se,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!f}),d.jsx("button",{onClick:W,disabled:!g.trim()||!!f,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:d.jsx(Kx,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function k2(){var M;const{isBuilder:r,isOps:n}=Qg(),{data:s}=Qo(),a=!!((M=s==null?void 0:s.ai)!=null&&M.enabled),{collapsed:o,toggle:f}=Kg(),[h,m]=T.useState(!1),[g,y]=T.useState(!1),[E,w]=T.useState(()=>window.location.hash.startsWith("#docs")),O=Ws(),q=T.useRef(null);return T.useEffect(()=>{const D=q.current;D&&(D.classList.remove("animate-page-in"),D.offsetWidth,D.classList.add("animate-page-in"))},[O.pathname]),T.useEffect(()=>{const D=()=>{window.location.hash.startsWith("#docs")&&w(!0)};return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[]),d.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[d.jsx(xw,{onToggleEventFeed:()=>m(D=>!D),onToggleDocs:()=>w(D=>!D)}),d.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[d.jsxs("aside",{className:`${o?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[d.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[d.jsx(Ew,{aiEnabled:a,isBuilder:r}),r&&d.jsx(Aw,{}),r&&a&&d.jsx(Ow,{}),r&&d.jsx(Nw,{}),(r||n)&&d.jsx(Cw,{isBuilder:r})]}),d.jsx("button",{onClick:f,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${o?"flex justify-center":"flex items-center px-7"}`,"aria-label":o?"Expand sidebar":"Collapse sidebar",children:o?d.jsx(Zx,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):d.jsx(Wx,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!o&&(s==null?void 0:s.environment)&&d.jsxs("div",{className:"shrink-0 px-5 pb-3 text-[10px] leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${s.environment.longTailVersion} · HotMesh v${s.environment.hotmeshVersion} · Node ${s.environment.nodeVersion} · ${s.environment.nodeEnv}`,children:["long-tail v",s.environment.longTailVersion,d.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",s.environment.hotmeshVersion]})]}),d.jsx("main",{className:"flex-1 overflow-y-auto",children:d.jsx("div",{ref:q,className:"max-w-dashboard mx-auto px-10 py-10 pb-16 animate-page-in",children:d.jsx(xr,{})})})]}),d.jsx(Qw,{open:h,onToggle:()=>m(D=>!D),configOpen:g,onToggleConfig:()=>y(D=>!D)}),d.jsx(rS,{open:E,onClose:()=>{w(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),a&&d.jsx(uS,{}),a&&d.jsx(C2,{})]})}function M2(){const{isAuthenticated:r}=Oi(),n=Ws();return r?d.jsx(pw,{children:d.jsx(cS,{children:d.jsx(k2,{})})}):d.jsx(Un,{to:"/login",state:{from:n.pathname},replace:!0})}function hy({provider:r,className:n="w-5 h-5"}){switch(r){case"google":return d.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[d.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"}),d.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"}),d.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"}),d.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 d.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:d.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 d.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[d.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),d.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),d.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),d.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return d.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:d.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 d.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[d.jsx("circle",{cx:"12",cy:"12",r:"10"}),d.jsx("path",{d:"M12 8v4l3 3"})]})}}async function R2(){return Ve("/auth/oauth/providers")}async function D2(r,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return Ve(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function IE(){return $n({queryKey:["oauth-connections"],queryFn:()=>Ve("/auth/oauth/connections")})}function QE(){const r=rn();return _n({mutationFn:({provider:n,label:s})=>D2(n,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function z2(){var ce;const{login:r,isAuthenticated:n}=Oi(),s=ug(),a=Ws(),o=new URLSearchParams(a.search),f=o.get("token"),h=o.get("error"),m=((ce=a.state)==null?void 0:ce.from)??o.get("returnTo")??"/",g=T.useRef(!1);f&&!g.current&&(g.current=!0,r(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[y,E]=T.useState(""),[w,O]=T.useState(""),[q,M]=T.useState(h||""),[D,W]=T.useState(!1),[se,ee]=T.useState(!!f),[me,re]=T.useState([]),C=T.useRef(!1);if(T.useEffect(()=>{f||C.current||(C.current=!0,(async()=>{var V,G,K,ae;try{const ne=await fetch(`${Wt}/api/settings`);if(!ne.ok)return;const ke=await ne.json();if(!((V=ke.auth)!=null&&V.sso))return;const He=await fetch(`${Wt}/api/auth/sso`,{method:"POST"});if(!He.ok){M("Host authentication required — please log in to your organization first");return}const Me=await He.json();Me.token&&((G=ke.auth)!=null&&G.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",ke.auth.ssoLogoutUrl),ee(!0),r(Me.token,void 0,{displayName:(K=Me.user)==null?void 0:K.display_name,username:(ae=Me.user)==null?void 0:ae.external_id}))}catch{}})())},[]),T.useEffect(()=>{f||R2().then(re).catch(()=>{})},[]),T.useEffect(()=>{if(!se)return;const V=setTimeout(()=>s(m,{replace:!0}),1500);return()=>clearTimeout(V)},[se]),n&&!se)return d.jsx(Un,{to:m,replace:!0});const X=async V=>{var G,K;if(V.preventDefault(),M(""),!y.trim()||!w){M("Username and password are required");return}W(!0);try{const ae=await fetch(`${Wt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:w})}),ne=await ae.json();if(!ae.ok){M(ne.error||"Login failed");return}ee(!0),r(ne.token,{username:y.trim(),password:w},{displayName:(G=ne.user)==null?void 0:G.display_name,username:(K=ne.user)==null?void 0:K.external_id})}catch{M("Unable to connect to server")}finally{W(!1)}};return d.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:d.jsxs("div",{className:"w-full max-w-md p-10",children:[d.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${se?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:d.jsx(dh,{size:"lg",hideLabel:se})}),d.jsxs("form",{onSubmit:X,className:`space-y-5 transition-opacity duration-300 ${se?"opacity-0":""}`,children:[d.jsxs("div",{children:[d.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),d.jsx("input",{id:"username",type:"text",value:y,onChange:V=>E(V.target.value),className:"input",placeholder:"Enter your username",autoFocus:!se,autoComplete:"username"})]}),d.jsxs("div",{children:[d.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),d.jsx("input",{id:"password",type:"password",value:w,onChange:V=>O(V.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),q&&d.jsx("p",{className:"text-sm text-status-error",children:q}),d.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:D||se,children:D?"Signing in...":"Sign In"}),me.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[d.jsx("div",{className:"flex-1 h-px bg-border"}),d.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),d.jsx("div",{className:"flex-1 h-px bg-border"})]}),d.jsx("div",{className:"space-y-2",children:me.filter(V=>V.provider!=="anthropic").map(V=>d.jsxs("a",{href:`${Wt}/api/auth/oauth/${V.provider}?returnTo=${encodeURIComponent(m)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[d.jsx(hy,{provider:V.provider}),"Sign in with ",V.name]},V.provider))})]})]})]})})}function ig(){const{isAuthenticated:r}=Oi(),n=ug(),s=Ws(),a=new URLSearchParams(s.search),o=a.get("state")||"";T.useEffect(()=>{r||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[f,h]=T.useState(""),[m,g]=T.useState(a.get("label")||"default"),[y,E]=T.useState(""),[w,O]=T.useState(!1),q=f.trim().startsWith("sk-ant-oat"),M=f.trim().startsWith("sk-ant-api"),D=W=>{W.preventDefault();const se=f.trim();if(!se){E("A token or API key is required");return}if(!se.startsWith("sk-ant-")){E('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}O(!0),E("");const ee=`${Wt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(se)}&state=${encodeURIComponent(o)}`;window.location.href=ee};return d.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:d.jsxs("div",{className:"w-full max-w-md p-10",children:[d.jsx("div",{className:"mb-10",children:d.jsx(dh,{size:"lg"})}),d.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[d.jsx(hy,{provider:"anthropic",className:"w-6 h-6"}),d.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),d.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."}),d.jsxs("form",{onSubmit:D,className:"space-y-5",children:[d.jsxs("div",{children:[d.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),d.jsx("input",{id:"token",type:"password",value:f,onChange:W=>h(W.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),q&&d.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),M&&d.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),d.jsxs("div",{children:[d.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),d.jsx("input",{id:"label",type:"text",value:m,onChange:W=>g(W.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),d.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),y&&d.jsx("p",{className:"text-sm text-status-error",children:y}),d.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:w,children:w?"Validating...":"Connect"}),d.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),d.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[d.jsxs("div",{children:[d.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",d.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-[11px]",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),d.jsxs("div",{children:[d.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",d.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 So({roleTypes:r,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:f}=Oi();return a?d.jsx(xr,{}):r&&r.some(h=>f(h))?d.jsx(xr,{}):n&&n.some(h=>o(h))?d.jsx(xr,{}):d.jsx(Un,{to:s,replace:!0})}function q2({redirectTo:r="/"}){var a;const{data:n,isLoading:s}=Qo();return s||!n?null:(a=n.ai)!=null&&a.enabled?d.jsx(xr,{}):d.jsx(Un,{to:r,replace:!0})}function U2({flag:r,redirectTo:n="/"}){var o;const{data:s,isLoading:a}=Qo();return a||!s?null:((o=s.features)==null?void 0:o[r])===!1?d.jsx(Un,{to:n,replace:!0}):d.jsx(xr,{})}const B2=T.lazy(()=>_e(()=>import("./ProcessesListPage-BTsXds4l.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url).then(r=>({default:r.ProcessesListPage}))),L2=T.lazy(()=>_e(()=>import("./ProcessDetailPage-ByyWCs2A.js"),__vite__mapDeps([18,1,2,4,19,15,20,17,11,6,21,22,23]),import.meta.url).then(r=>({default:r.ProcessDetailPage}))),H2=T.lazy(()=>_e(()=>import("./McpOverview-CvnDG5OB.js"),__vite__mapDeps([24,1,25,26,27,28,14,15,29,6]),import.meta.url).then(r=>({default:r.McpOverview}))),P2=T.lazy(()=>_e(()=>import("./McpRunsPage-CPMYWgm_.js"),__vite__mapDeps([30,1,26,27,5,6,31,28,8,9,10,17,15,11,32,14,13,12,16,33]),import.meta.url).then(r=>({default:r.McpRunsPage}))),$2=T.lazy(()=>_e(()=>import("./McpRunDetailPage-8a6lsehv.js"),__vite__mapDeps([34,1,26,20,14,15,35,6,36,37,16,38,39,40,13]),import.meta.url).then(r=>({default:r.McpRunDetailPage}))),Y2=T.lazy(()=>_e(()=>import("./McpQueryPage-CU6FMEEk.js"),__vite__mapDeps([41,1,14,15,9,10,13,12,16,8,11,32,17,33,5,6,4,42]),import.meta.url).then(r=>({default:r.McpQueryPage}))),G2=T.lazy(()=>_e(()=>import("./McpQueryDetailPage-DwmSIcIL.js"),__vite__mapDeps([43,1,14,15,20,42,6,27,4,44,36,26,3,2,45,46,47,48,49,50,35,51,38,39]),import.meta.url).then(r=>({default:r.McpQueryDetailPage}))),V2=T.lazy(()=>_e(()=>import("./EscalationsOverview-BmI8jxlh.js"),__vite__mapDeps([52,1,4,14,15,29,6]),import.meta.url).then(r=>({default:r.EscalationsOverview}))),F2=T.lazy(()=>_e(()=>import("./AvailableEscalationsPage-BEylRqjP.js"),__vite__mapDeps([53,1,4,54,55,6,56,57,5,7,8,9,10,12,14,15,23,58,13,59,21,17,11,60,33,16]),import.meta.url).then(r=>({default:r.AvailableEscalationsPage}))),J2=T.lazy(()=>_e(()=>import("./OperatorDashboard-g9o7I925.js"),__vite__mapDeps([61,1,4,57,5,6,7,8,9,10,14,15,12,33,58,13,59,21,17,11,60,16]),import.meta.url).then(r=>({default:r.OperatorDashboard}))),I2=T.lazy(()=>_e(()=>import("./index-CP0JEQhZ.js"),__vite__mapDeps([62,1,37,54,55,6,56,57,14,15,16,60,3,4,22,23,20,21,35,36]),import.meta.url).then(r=>({default:r.EscalationDetailPage}))),Q2=T.lazy(()=>_e(()=>import("./WorkflowsOverview-BRc0QbA7.js"),__vite__mapDeps([63,1,3,4,14,15,29,6]),import.meta.url).then(r=>({default:r.WorkflowsOverview}))),X2=T.lazy(()=>_e(()=>import("./index-DzVYjoex.js"),__vite__mapDeps([64,1,3,14,15,17,65,48,49,6]),import.meta.url).then(r=>({default:r.StartWorkflowPage}))),K2=T.lazy(()=>_e(()=>import("./index-DzVYjoex.js"),__vite__mapDeps([64,1,3,14,15,17,65,48,49,6]),import.meta.url).then(r=>({default:r.DurableInvokePage}))),Z2=T.lazy(()=>_e(()=>import("./WorkflowsDashboard-BgI-iOP6.js"),__vite__mapDeps([66,1,11,32,3,31,28,6,4,5,8,9,10,17,15,14,13,12,16,33]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),W2=T.lazy(()=>_e(()=>import("./WorkflowsDashboard-BgI-iOP6.js"),__vite__mapDeps([66,1,11,32,3,31,28,6,4,5,8,9,10,17,15,14,13,12,16,33]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),eE=T.lazy(()=>_e(()=>import("./YamlWorkflowsPage-Djw5ZbgQ.js"),__vite__mapDeps([67,1,27,5,6,14,15,13,10,50,65,20]),import.meta.url).then(r=>({default:r.YamlWorkflowsPage}))),tE=T.lazy(()=>_e(()=>import("./GraphInvokePage-BZBPBCSq.js"),__vite__mapDeps([68,1,27,14,15,45,47,48,49,46,6,50,65]),import.meta.url).then(r=>({default:r.GraphInvokePage}))),nE=T.lazy(()=>_e(()=>import("./YamlWorkflowDetailPage-DdzspNQR.js"),__vite__mapDeps([69,1,27,20,65,15,6]),import.meta.url).then(r=>({default:r.YamlWorkflowDetailPage}))),sE=T.lazy(()=>_e(()=>import("./TasksListPage-Bem44zd0.js"),__vite__mapDeps([70,1,2,3,5,6,9,10,20,59,51,12,13,14,15,17]),import.meta.url).then(r=>({default:r.TasksListPage}))),iE=T.lazy(()=>_e(()=>import("./TaskDetailPage-BjHU6opi.js"),__vite__mapDeps([71,1,2,20,59,14,15,6]),import.meta.url).then(r=>({default:r.TaskDetailPage}))),rg=T.lazy(()=>_e(()=>import("./WorkflowExecutionPage-Bw6QdtUO.js"),__vite__mapDeps([72,1,3,4,37,2,14,15,36,16,20,35,6,38,39,40,13]),import.meta.url).then(r=>({default:r.WorkflowExecutionPage}))),rE=T.lazy(()=>_e(()=>import("./AdminDashboard-LTiYLuzq.js"),__vite__mapDeps([73,1,2,4,25,19,15,6]),import.meta.url).then(r=>({default:r.AdminDashboard}))),aE=T.lazy(()=>_e(()=>import("./index-BUmnJ4eT.js"),__vite__mapDeps([74,1,3,9,10,13,33,5,6,14,15,75,17]),import.meta.url).then(r=>({default:r.WorkersPage}))),lE=T.lazy(()=>_e(()=>import("./index-CMviPjXQ.js"),__vite__mapDeps([76,1,3,9,10,77,55,6,13,33,5,14,15,21,75,17,57,48,49,65]),import.meta.url).then(r=>({default:r.WorkflowConfigsPage}))),ag=T.lazy(()=>_e(()=>import("./index-CMviPjXQ.js"),__vite__mapDeps([76,1,3,9,10,77,55,6,13,33,5,14,15,21,75,17,57,48,49,65]),import.meta.url).then(r=>({default:r.WorkflowConfigDetailPage}))),oE=T.lazy(()=>_e(()=>import("./index-B7VC0vjf.js"),__vite__mapDeps([78,1,25,10,77,55,6,14,15,13,12,5,79,47,48,49,50,46,33,20]),import.meta.url).then(r=>({default:r.McpServersPage}))),lg=T.lazy(()=>_e(()=>import("./index-Dsi5o7dx.js"),__vite__mapDeps([80,1,25,14,15,44,6]),import.meta.url).then(r=>({default:r.McpServerDetailPage}))),cE=T.lazy(()=>_e(()=>import("./index-DPLy-jwO.js"),__vite__mapDeps([81,1,23,5,6,9,10,12,13,11,77,55,33,14,15,21,49,57,51]),import.meta.url).then(r=>({default:r.UsersPage}))),uE=T.lazy(()=>_e(()=>import("./RolesPage-B2Kdf-L9.js"),__vite__mapDeps([82,1,57,9,10,77,55,6,14,15,33]),import.meta.url).then(r=>({default:r.RolesPage}))),fE=T.lazy(()=>_e(()=>import("./index-B5qsp8lb.js"),__vite__mapDeps([83,1,14,15,55,6,56]),import.meta.url).then(r=>({default:r.MaintenancePage}))),hE=T.lazy(()=>_e(()=>import("./index-DjJ6VCuc.js"),__vite__mapDeps([84,1,19,15,13,5,6,31,28,55,36,75,9,10,33]),import.meta.url).then(r=>({default:r.ControlPlanePage}))),dE=T.lazy(()=>_e(()=>import("./index-CUfgt3mV.js"),__vite__mapDeps([85,1,6,39,15,5,31,28,8,9,10,12,13,11,14,16]),import.meta.url).then(r=>({default:r.StreamMessagesPage}))),mE=T.lazy(()=>_e(()=>import("./CredentialsPage-fat5Z2U9.js"),__vite__mapDeps([86,1,14,15,51,77,55,6]),import.meta.url).then(r=>({default:r.CredentialsPage}))),pE=T.lazy(()=>_e(()=>import("./index-FuhiJuHL.js"),__vite__mapDeps([87,1,6,14,15,13,16,8,10,88,51]),import.meta.url).then(r=>({default:r.FilesPage}))),gE=T.lazy(()=>_e(()=>import("./index-CAqEy2Db.js"),__vite__mapDeps([89,1,14,15,13,16,12,10,88,51,90,44,6]),import.meta.url).then(r=>({default:r.KnowledgePage}))),yE=T.lazy(()=>_e(()=>import("./HomePage-dM7U2tl6.js"),__vite__mapDeps([91,1,3,26,28,2,4,21,15,17,16,6]),import.meta.url).then(r=>({default:r.HomePage}))),bE=T.lazy(()=>_e(()=>import("./AgentsPage-DpS0cCYe.js"),__vite__mapDeps([92,1,93,4,5,6,8,9,10,12,13,14,15,16]),import.meta.url).then(r=>({default:r.AgentsPage}))),xE=T.lazy(()=>_e(()=>import("./AgentDetailPage-BSUnDvGp.js"),__vite__mapDeps([94,1,93,95,15,4,17,6]),import.meta.url).then(r=>({default:r.AgentDetailPage}))),og=T.lazy(()=>_e(()=>import("./AgentConfigPage-nlOudfpZ.js"),__vite__mapDeps([96,1,93,95,15,14,90,47,48,49,3,27,97,98,17,6]),import.meta.url).then(r=>({default:r.AgentConfigPage}))),vE=T.lazy(()=>_e(()=>import("./CapabilitiesPage-DLIleX2L.js"),__vite__mapDeps([99,1,97,79,25,47,48,49,15,50,6,46,14]),import.meta.url).then(r=>({default:r.CapabilitiesPage}))),_E=T.lazy(()=>_e(()=>import("./TopicsPage-CD_40_v-.js"),__vite__mapDeps([100,1,98,5,6,9,10,12,13,14,15,16]),import.meta.url).then(r=>({default:r.TopicsPage}))),wE=T.lazy(()=>_e(()=>import("./TopicDetailPage-rh_dsTJI.js"),__vite__mapDeps([101,1,98,16,15,6]),import.meta.url).then(r=>({default:r.TopicDetailPage})));function SE(){return d.jsxs("div",{className:"animate-pulse space-y-4",children:[d.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),d.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function xe({children:r}){return d.jsx(T.Suspense,{fallback:d.jsx(SE,{}),children:d.jsx("div",{className:"animate-page-enter",children:r})})}const dy=new Ex({defaultOptions:{queries:{staleTime:1e4,retry:(r,n)=>n instanceof Error&&n.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{dy.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=`${window.__LT_BASE__||""}/login`;window.location.pathname!==n&&(window.location.href=`${n}?returnTo=${encodeURIComponent(window.location.pathname)}`)});const EE=Ox([{path:"/login",element:d.jsx(z2,{})},{path:"/connect/anthropic",element:d.jsx(ig,{})},{path:"/connect/:provider",element:d.jsx(ig,{})},{path:"/",element:d.jsx(M2,{}),children:[{index:!0,element:d.jsx(xe,{children:d.jsx(yE,{})})},{path:"processes/all",element:d.jsx(xe,{children:d.jsx(B2,{})})},{path:"processes/detail/:originId",element:d.jsx(xe,{children:d.jsx(L2,{})})},{path:"credentials",element:d.jsx(xe,{children:d.jsx(mE,{})})},{path:"connections",element:d.jsx(Un,{to:"/credentials",replace:!0})},{path:"escalations",element:d.jsx(xe,{children:d.jsx(V2,{})})},{path:"escalations/available",element:d.jsx(xe,{children:d.jsx(F2,{})})},{path:"escalations/queue",element:d.jsx(xe,{children:d.jsx(J2,{})})},{path:"escalations/detail/:id",element:d.jsx(xe,{children:d.jsx(I2,{})})},{path:"capabilities",element:d.jsx(xe,{children:d.jsx(vE,{})})},{path:"agents",element:d.jsx(xe,{children:d.jsx(bE,{})})},{path:"agents/new",element:d.jsx(xe,{children:d.jsx(og,{})})},{path:"agents/:id",element:d.jsx(xe,{children:d.jsx(xE,{})})},{path:"agents/:id/edit",element:d.jsx(xe,{children:d.jsx(og,{})})},{path:"topics",element:d.jsx(xe,{children:d.jsx(_E,{})})},{path:"topics/:topic",element:d.jsx(xe,{children:d.jsx(wE,{})})},{element:d.jsx(So,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:d.jsx(xe,{children:d.jsx(Q2,{})})},{path:"workflows/executions",element:d.jsx(xe,{children:d.jsx(W2,{})})},{path:"workflows/durable/executions",element:d.jsx(xe,{children:d.jsx(Z2,{})})},{path:"workflows/durable/executions/:workflowId",element:d.jsx(xe,{children:d.jsx(rg,{})})},{path:"workflows/tasks",element:d.jsx(xe,{children:d.jsx(sE,{})})},{path:"workflows/tasks/detail/:id",element:d.jsx(xe,{children:d.jsx(iE,{})})},{path:"workflows/executions/:workflowId",element:d.jsx(xe,{children:d.jsx(rg,{})})},{path:"workflows/start",element:d.jsx(xe,{children:d.jsx(X2,{})})},{path:"workflows/durable/invoke",element:d.jsx(xe,{children:d.jsx(K2,{})})},{path:"workflows/cron",element:d.jsx(Un,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:d.jsx(xe,{children:d.jsx(aE,{})})},{path:"workflows/registry",element:d.jsx(xe,{children:d.jsx(lE,{})})},{path:"workflows/registry/new",element:d.jsx(xe,{children:d.jsx(ag,{})})},{path:"workflows/registry/:workflowType",element:d.jsx(xe,{children:d.jsx(ag,{})})}]},{element:d.jsx(So,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:d.jsx(xe,{children:d.jsx(eE,{})})},{path:"mcp/workflows/invoke",element:d.jsx(xe,{children:d.jsx(tE,{})})},{path:"mcp/workflows/:id",element:d.jsx(xe,{children:d.jsx(nE,{})})},{path:"mcp/executions",element:d.jsx(xe,{children:d.jsx(P2,{})})},{path:"mcp/executions/:jobId",element:d.jsx(xe,{children:d.jsx($2,{})})},{path:"files",element:d.jsx(xe,{children:d.jsx(pE,{})})},{path:"knowledge",element:d.jsx(xe,{children:d.jsx(gE,{})})},{element:d.jsx(q2,{}),children:[{path:"mcp",element:d.jsx(xe,{children:d.jsx(H2,{})})},{path:"mcp/queries",element:d.jsx(xe,{children:d.jsx(Y2,{})})},{path:"mcp/queries/:workflowId",element:d.jsx(xe,{children:d.jsx(G2,{})})},{path:"mcp/tools",element:d.jsx(Un,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:d.jsx(xe,{children:d.jsx(oE,{})})},{path:"mcp/servers/new",element:d.jsx(xe,{children:d.jsx(lg,{})})},{path:"mcp/servers/:serverId",element:d.jsx(xe,{children:d.jsx(lg,{})})}]}]},{element:d.jsx(So,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:d.jsx(xe,{children:d.jsx(rE,{})})},{path:"admin/users",element:d.jsx(xe,{children:d.jsx(cE,{})})}]},{element:d.jsx(So,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:d.jsx(Un,{to:"/admin/users?tab=service-accounts",replace:!0})},{path:"admin/escalation-chains",element:d.jsx(Un,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:d.jsx(xe,{children:d.jsx(uE,{})})},{element:d.jsx(U2,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:d.jsx(xe,{children:d.jsx(fE,{})})}]},{path:"admin/controlplane",element:d.jsx(xe,{children:d.jsx(hE,{})})},{path:"admin/streams",element:d.jsx(xe,{children:d.jsx(dE,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function AE(){return d.jsx(Ax,{client:dy,children:d.jsx(ov,{children:d.jsx(hw,{children:d.jsx(Tx,{router:EE})})})})}iv.createRoot(document.getElementById("root")).render(d.jsx(T.StrictMode,{children:d.jsx(AE,{})}));export{fy as A,FE as B,mh as C,A2 as D,gh as E,Wg as F,IE as G,QE as H,gg as I,Fw as J,Wt as L,f_ as N,hy as O,Dw as S,JE as a,d_ as b,E2 as c,Ve as d,RE as e,_2 as f,zE as g,UE as h,kE as i,Oi as j,LE as k,HE as l,PE as m,$E as n,YE as o,VE as p,ME as q,yw as r,gw as s,Qg as t,Qo as u,qE as v,DE as w,BE as x,GE as y,uy as z};
|
|
63
|
+
//# sourceMappingURL=index-D1xVY4JR.js.map
|