@hotmeshio/long-tail 0.23.2 → 0.24.1
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/adapters/express.d.ts +11 -1
- package/build/adapters/express.js +42 -41
- package/build/api/auth-sso.d.ts +1 -1
- package/build/api/bot-accounts.d.ts +2 -0
- package/build/api/bot-accounts.js +4 -0
- package/build/api/capabilities.d.ts +7 -2
- package/build/api/capabilities.js +13 -2
- package/build/api/escalations/analytics.js +5 -0
- package/build/api/escalations/bulk.d.ts +2 -0
- package/build/api/escalations/bulk.js +9 -4
- package/build/api/escalations/helpers.d.ts +5 -0
- package/build/api/escalations/helpers.js +7 -0
- package/build/api/escalations/metadata.js +3 -0
- package/build/api/escalations/single.d.ts +3 -2
- package/build/api/escalations/single.js +8 -3
- package/build/api/mcp/tools.d.ts +12 -0
- package/build/api/mcp/tools.js +113 -9
- package/build/api/scan-codes/choice.js +31 -7
- package/build/api/settings.js +9 -0
- package/build/api/tasks.d.ts +3 -3
- package/build/api/tasks.js +30 -7
- package/build/api/workflows/input-lookups.js +1 -1
- package/build/api/workflows/invocable.js +2 -2
- package/build/api/workflows/invocation.js +1 -1
- package/build/api/yaml-workflows/cron.d.ts +3 -2
- package/build/api/yaml-workflows/cron.js +6 -1
- package/build/api/yaml-workflows/deploy.d.ts +15 -2
- package/build/api/yaml-workflows/deploy.js +69 -2
- package/build/lib/db/schemas/038_oauth_server.sql +46 -0
- package/build/lib/db/schemas/039_nats_ws_tickets.sql +12 -0
- package/build/lib/events/browser-view.d.ts +20 -0
- package/build/lib/events/browser-view.js +117 -0
- package/build/lib/events/nats-ws-filter.d.ts +29 -0
- package/build/lib/events/nats-ws-filter.js +109 -0
- package/build/lib/events/nats-ws-proxy.d.ts +7 -0
- package/build/lib/events/nats-ws-proxy.js +86 -7
- package/build/lib/events/nats-ws-server-filter.d.ts +16 -0
- package/build/lib/events/nats-ws-server-filter.js +56 -0
- package/build/lib/events/nats-ws-ticket.d.ts +19 -0
- package/build/lib/events/nats-ws-ticket.js +63 -0
- package/build/lib/events/socketio.d.ts +10 -1
- package/build/lib/events/socketio.js +10 -3
- package/build/lib/http/index.d.ts +27 -0
- package/build/lib/http/index.js +55 -0
- package/build/modules/auth.d.ts +15 -24
- package/build/modules/auth.js +43 -126
- package/build/modules/capabilities.d.ts +62 -0
- package/build/modules/capabilities.js +188 -0
- package/build/modules/config.d.ts +19 -0
- package/build/modules/config.js +27 -0
- package/build/modules/defaults.d.ts +10 -0
- package/build/modules/defaults.js +12 -1
- package/build/modules/maintenance.d.ts +2 -0
- package/build/modules/maintenance.js +7 -0
- package/build/modules/mcp-auth.d.ts +11 -0
- package/build/modules/mcp-auth.js +56 -0
- package/build/modules/oauth-server.d.ts +18 -0
- package/build/modules/oauth-server.js +40 -0
- package/build/routes/agents.js +47 -14
- package/build/routes/announcements.js +2 -2
- package/build/routes/auth-sso.js +2 -2
- package/build/routes/auth.js +2 -2
- package/build/routes/bot-accounts.js +26 -3
- package/build/routes/capabilities.js +4 -4
- package/build/routes/controlplane.js +2 -2
- package/build/routes/dba.js +2 -2
- package/build/routes/delegation.js +2 -2
- package/build/routes/diagnostics.js +2 -2
- package/build/routes/docs.js +2 -2
- package/build/routes/domain.js +2 -2
- package/build/routes/escalations/accumulate.d.ts +1 -1
- package/build/routes/escalations/acting.d.ts +1 -1
- package/build/routes/escalations/analytics.d.ts +1 -1
- package/build/routes/escalations/bulk.d.ts +1 -1
- package/build/routes/escalations/facets.d.ts +1 -1
- package/build/routes/escalations/index.js +2 -2
- package/build/routes/escalations/list.d.ts +1 -1
- package/build/routes/escalations/metadata.d.ts +1 -1
- package/build/routes/escalations/related.d.ts +1 -1
- package/build/routes/escalations/resolve.d.ts +1 -1
- package/build/routes/escalations/single.d.ts +1 -1
- package/build/routes/escalations/single.js +1 -1
- package/build/routes/exports.js +14 -13
- package/build/routes/file-browser.js +9 -8
- package/build/routes/files.js +2 -2
- package/build/routes/index.js +4 -2
- package/build/routes/insight.js +5 -4
- package/build/routes/knowledge.js +2 -2
- package/build/routes/maintenance.js +2 -2
- package/build/routes/mcp-endpoint.d.ts +3 -1
- package/build/routes/mcp-endpoint.js +18 -8
- package/build/routes/mcp.js +35 -15
- package/build/routes/me.js +2 -2
- package/build/routes/namespaces.js +4 -3
- package/build/routes/nats-credentials.js +27 -3
- package/build/routes/oauth-server/authorize.d.ts +2 -0
- package/build/routes/oauth-server/authorize.js +110 -0
- package/build/routes/oauth-server/grants.d.ts +2 -0
- package/build/routes/oauth-server/grants.js +35 -0
- package/build/routes/oauth-server/index.d.ts +8 -0
- package/build/routes/oauth-server/index.js +52 -0
- package/build/routes/oauth-server/registration.d.ts +2 -0
- package/build/routes/oauth-server/registration.js +38 -0
- package/build/routes/oauth-server/token.d.ts +2 -0
- package/build/routes/oauth-server/token.js +100 -0
- package/build/routes/oauth-well-known.d.ts +8 -0
- package/build/routes/oauth-well-known.js +31 -0
- package/build/routes/oauth.js +2 -2
- package/build/routes/overview.js +2 -2
- package/build/routes/personas.js +2 -2
- package/build/routes/pipelines.js +6 -5
- package/build/routes/roles.js +2 -2
- package/build/routes/scan-codes.js +2 -2
- package/build/routes/settings.js +2 -2
- package/build/routes/tasks.js +5 -5
- package/build/routes/topics.js +21 -9
- package/build/routes/users.js +25 -22
- package/build/routes/workflow-sets.js +13 -12
- package/build/routes/workflows/config.js +15 -2
- package/build/routes/workflows/discovery.js +2 -2
- package/build/routes/workflows/index.js +2 -2
- package/build/routes/workflows/invocation.js +11 -10
- package/build/routes/yaml-workflows/cron.js +20 -7
- package/build/routes/yaml-workflows/crud.js +13 -12
- package/build/routes/yaml-workflows/deployment.js +11 -10
- package/build/routes/yaml-workflows/index.js +2 -2
- package/build/routes/yaml-workflows/versions.js +2 -2
- package/build/services/agent/authority.d.ts +15 -0
- package/build/services/agent/authority.js +59 -0
- package/build/services/agent/trigger-registry.js +7 -2
- package/build/services/auth/bot-api-key.d.ts +2 -0
- package/build/services/auth/bot-api-key.js +10 -0
- package/build/services/auth/oauth-server/access-token.d.ts +36 -0
- package/build/services/auth/oauth-server/access-token.js +80 -0
- package/build/services/auth/oauth-server/authorization.d.ts +47 -0
- package/build/services/auth/oauth-server/authorization.js +54 -0
- package/build/services/auth/oauth-server/constants.d.ts +11 -0
- package/build/services/auth/oauth-server/constants.js +16 -0
- package/build/services/auth/oauth-server/index.d.ts +3 -0
- package/build/services/auth/oauth-server/index.js +27 -0
- package/build/services/auth/oauth-server/metadata.d.ts +21 -0
- package/build/services/auth/oauth-server/metadata.js +53 -0
- package/build/services/auth/oauth-server/registration.d.ts +42 -0
- package/build/services/auth/oauth-server/registration.js +134 -0
- package/build/services/auth/oauth-server/sql.d.ts +50 -0
- package/build/services/auth/oauth-server/sql.js +156 -0
- package/build/services/auth/oauth-server/store.d.ts +88 -0
- package/build/services/auth/oauth-server/store.js +171 -0
- package/build/services/auth/sql.d.ts +1 -0
- package/build/services/auth/sql.js +3 -1
- package/build/services/cron/index.js +5 -3
- package/build/services/escalation/queries.js +7 -2
- package/build/services/export/index.d.ts +10 -0
- package/build/services/export/index.js +27 -0
- package/build/services/invocation-access.d.ts +25 -4
- package/build/services/invocation-access.js +39 -7
- package/build/services/maintenance/index.js +8 -0
- package/build/services/mcp/client/connection-dispatch.d.ts +6 -1
- package/build/services/mcp/client/connection-dispatch.js +3 -2
- package/build/services/mcp/client/connection-lifecycle.d.ts +10 -2
- package/build/services/mcp/client/connection-lifecycle.js +45 -7
- package/build/services/mcp/client/connection-test.js +2 -6
- package/build/services/mcp/client/connection.d.ts +1 -1
- package/build/services/mcp/client/connection.js +3 -1
- package/build/services/mcp/client/index.d.ts +2 -2
- package/build/services/mcp/client/index.js +4 -1
- package/build/services/mcp/client/network-transport.d.ts +12 -0
- package/build/services/mcp/client/network-transport.js +20 -0
- package/build/services/mcp/client/tools.d.ts +13 -0
- package/build/services/mcp/client/tools.js +18 -0
- package/build/services/mcp/db-server/index.js +2 -1
- package/build/services/mcp/external-server.d.ts +9 -4
- package/build/services/mcp/external-server.js +34 -11
- package/build/services/mcp/playwright-server/index.js +2 -1
- package/build/services/mcp/registered-tools.d.ts +3 -0
- package/build/services/mcp/registered-tools.js +7 -0
- package/build/services/mcp/seed-service-account.d.ts +4 -1
- package/build/services/mcp/seed-service-account.js +11 -6
- package/build/services/mcp/server-lifecycle.js +2 -1
- package/build/services/workflow-invocation.d.ts +16 -3
- package/build/services/workflow-invocation.js +42 -10
- package/build/services/yaml-workflow/deployer.d.ts +10 -2
- package/build/services/yaml-workflow/deployer.js +17 -5
- package/build/services/yaml-workflow/invoke.js +31 -26
- package/build/services/yaml-workflow/workers/register.js +3 -13
- package/build/services/yaml-workflow/workers/step-tool.d.ts +7 -0
- package/build/services/yaml-workflow/workers/step-tool.js +69 -0
- package/build/start/config.js +7 -0
- package/build/start/index.js +4 -22
- package/build/start/server.d.ts +6 -4
- package/build/start/server.js +11 -35
- package/build/start/socket-auth.js +2 -1
- package/build/start/workers.js +1 -1
- package/build/system/mcp-servers/admin/agent-subscriptions.js +25 -1
- package/build/system/mcp-servers/admin/agents.js +25 -2
- package/build/system/mcp-servers/admin/announcements.js +3 -2
- package/build/system/mcp-servers/admin/bot-accounts.js +37 -5
- package/build/system/mcp-servers/admin/escalations.d.ts +3 -5
- package/build/system/mcp-servers/admin/escalations.js +74 -70
- package/build/system/mcp-servers/admin/exports.js +7 -1
- package/build/system/mcp-servers/admin/index.js +24 -25
- package/build/system/mcp-servers/admin/overview.d.ts +2 -2
- package/build/system/mcp-servers/admin/run-read.d.ts +2 -0
- package/build/system/mcp-servers/admin/run-read.js +5 -0
- package/build/system/mcp-servers/admin/scan-codes.d.ts +2 -2
- package/build/system/mcp-servers/admin/scan-codes.js +5 -11
- package/build/system/mcp-servers/admin/schemas.d.ts +26 -26
- package/build/system/mcp-servers/admin/tasks.js +7 -2
- package/build/system/mcp-servers/admin/users.js +31 -4
- package/build/system/mcp-servers/admin/workflow-config.js +12 -1
- package/build/system/mcp-servers/admin/workflows.js +27 -5
- package/build/system/mcp-servers/admin/yaml-workflows.js +13 -21
- package/build/system/mcp-servers/caller-auth.d.ts +18 -0
- package/build/system/mcp-servers/caller-auth.js +29 -0
- package/build/system/mcp-servers/claude-code.js +2 -1
- package/build/system/mcp-servers/db-query/index.js +2 -1
- package/build/system/mcp-servers/file-storage.js +2 -1
- package/build/system/mcp-servers/http-fetch.js +2 -1
- package/build/system/mcp-servers/human-queue.js +7 -3
- package/build/system/mcp-servers/oauth.js +31 -4
- package/build/system/mcp-servers/schema-exchange.js +2 -1
- package/build/system/mcp-servers/vision.d.ts +1 -0
- package/build/system/mcp-servers/vision.js +17 -7
- package/build/system/mcp-servers/workflow.js +13 -25
- package/build/system/seed/tool-manifests-admin.d.ts +2 -17985
- package/build/system/seed/tool-manifests-admin.js +121 -121
- package/build/system/seed/tool-manifests-data.d.ts +8 -374
- package/build/system/seed/tool-manifests-data.js +22 -4
- package/build/system/seed/tool-manifests-escalation.d.ts +2 -352
- package/build/system/seed/tool-manifests-escalation.js +11 -1
- package/build/system/seed/tool-manifests-events.d.ts +2 -116
- package/build/system/seed/tool-manifests-events.js +6 -2
- package/build/system/seed/tool-manifests-knowledge.d.ts +2 -221
- package/build/system/seed/tool-manifests-knowledge.js +41 -1
- package/build/system/seed/tool-manifests-workflows.d.ts +2 -71
- package/build/system/seed/tool-manifests-workflows.js +3 -1
- package/build/system/workflows/shared/principal-tools.d.ts +20 -0
- package/build/system/workflows/shared/principal-tools.js +64 -0
- package/build/system/workflows/shared/tool-executor.js +21 -11
- package/build/system/workflows/shared/tool-loader.js +8 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/auth.d.ts +1 -1
- package/build/types/capability.d.ts +14 -0
- package/build/types/capability.js +2 -0
- package/build/types/events.d.ts +1 -1
- package/build/types/index.d.ts +3 -1
- package/build/types/maintenance.d.ts +2 -2
- package/build/types/mcp.d.ts +3 -1
- package/build/types/oauth-server.d.ts +52 -0
- package/build/types/oauth-server.js +2 -0
- package/build/types/startup.d.ts +15 -7
- package/build/vitest.config.js +2 -1
- package/build/vitest.fast.config.d.ts +2 -0
- package/build/vitest.fast.config.js +20 -0
- package/build/vitest.llm.config.d.ts +2 -0
- package/build/vitest.llm.config.js +16 -0
- package/dashboard/dist/assets/{AdminDashboard-BPWsgMfZ.js → AdminDashboard-B3mkMIOT.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-BPWsgMfZ.js.map → AdminDashboard-B3mkMIOT.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-De9imyo5.js → AgentConfigPage-CQj2B678.js} +2 -2
- package/dashboard/dist/assets/{AgentConfigPage-De9imyo5.js.map → AgentConfigPage-CQj2B678.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-B6o96Y5G.js → AgentDetailPage-CzrD8JJI.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-B6o96Y5G.js.map → AgentDetailPage-CzrD8JJI.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-DMEmiK_W.js → AgentsPage-jg2OFwyW.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-DMEmiK_W.js.map → AgentsPage-jg2OFwyW.js.map} +1 -1
- package/dashboard/dist/assets/{AvailableEscalationsPage-DeYMngwE.js → AvailableEscalationsPage-IS28XBRe.js} +2 -2
- package/dashboard/dist/assets/{AvailableEscalationsPage-DeYMngwE.js.map → AvailableEscalationsPage-IS28XBRe.js.map} +1 -1
- package/dashboard/dist/assets/{BotPicker-DDmpgGHZ.js → BotPicker-DvEJFpwS.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-DDmpgGHZ.js.map → BotPicker-DvEJFpwS.js.map} +1 -1
- package/dashboard/dist/assets/{BulkAssignModal-BqlklomG.js → BulkAssignModal-BoQCi-YC.js} +2 -2
- package/dashboard/dist/assets/{BulkAssignModal-BqlklomG.js.map → BulkAssignModal-BoQCi-YC.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-DOtjDTbK.js → CapabilitiesPage-kwlrcb_t.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-DOtjDTbK.js.map → CapabilitiesPage-kwlrcb_t.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-CLr8LP0V.js → CollapsibleSection-UMIV4KIj.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-CLr8LP0V.js.map → CollapsibleSection-UMIV4KIj.js.map} +1 -1
- package/dashboard/dist/assets/ConfirmDeleteModal-C5puwMg7.js +2 -0
- package/dashboard/dist/assets/ConfirmDeleteModal-C5puwMg7.js.map +1 -0
- package/dashboard/dist/assets/ConnectedAppsPage-drZa65kP.js +2 -0
- package/dashboard/dist/assets/ConnectedAppsPage-drZa65kP.js.map +1 -0
- package/dashboard/dist/assets/{CountdownTimer-DxX72PwV.js → CountdownTimer-LG03dVgR.js} +2 -2
- package/dashboard/dist/assets/{CountdownTimer-DxX72PwV.js.map → CountdownTimer-LG03dVgR.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-CObc9Rs5.js → CredentialsPage-CaFQ6vLb.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-CObc9Rs5.js.map → CredentialsPage-CaFQ6vLb.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-Bb8GoNY5.js → CronLabel-Co5j7tzW.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-Bb8GoNY5.js.map → CronLabel-Co5j7tzW.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-CmGhVlYl.js → ElapsedCell-WJyE9G0T.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-CmGhVlYl.js.map → ElapsedCell-WJyE9G0T.js.map} +1 -1
- package/dashboard/dist/assets/{EntityTimelinePanel-B4Jwy1w3.js → EntityTimelinePanel-CDFFfX9d.js} +2 -2
- package/dashboard/dist/assets/{EntityTimelinePanel-B4Jwy1w3.js.map → EntityTimelinePanel-CDFFfX9d.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListSchemaPage-CZZbZ4Aa.js → EscalationListSchemaPage-CMrUlaKI.js} +3 -3
- package/dashboard/dist/assets/{EscalationListSchemaPage-CZZbZ4Aa.js.map → EscalationListSchemaPage-CMrUlaKI.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationSchemaPage-D0ko59_S.js → EscalationSchemaPage-Dx2Lyfrz.js} +2 -2
- package/dashboard/dist/assets/{EscalationSchemaPage-D0ko59_S.js.map → EscalationSchemaPage-Dx2Lyfrz.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationTimeline-BcnJEKFD.js → EscalationTimeline-d3nvshOk.js} +2 -2
- package/dashboard/dist/assets/{EscalationTimeline-BcnJEKFD.js.map → EscalationTimeline-d3nvshOk.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationTitleSelect-P0q5sck4.js → EscalationTitleSelect-DWQieOM9.js} +2 -2
- package/dashboard/dist/assets/{EscalationTitleSelect-P0q5sck4.js.map → EscalationTitleSelect-DWQieOM9.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-BLPmh4AF.js → EscalationsOverview-BX8Cpi0X.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-BLPmh4AF.js.map → EscalationsOverview-BX8Cpi0X.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-gBzi5tIS.js → EventTable-D1-ITVXS.js} +2 -2
- package/dashboard/dist/assets/{EventTable-gBzi5tIS.js.map → EventTable-D1-ITVXS.js.map} +1 -1
- package/dashboard/dist/assets/{FilterBar-BulSsWb2.js → FilterBar-ABC9ctin.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-BulSsWb2.js.map → FilterBar-ABC9ctin.js.map} +1 -1
- package/dashboard/dist/assets/{FormattedValue-BMHRrvrL.js → FormattedValue-k27T4bG7.js} +2 -2
- package/dashboard/dist/assets/{FormattedValue-BMHRrvrL.js.map → FormattedValue-k27T4bG7.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage--997yNRr.js → GraphInvokePage-DKUErxWc.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage--997yNRr.js.map → GraphInvokePage-DKUErxWc.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-CwXFz--v.js → HomePage-C6u9dIpR.js} +2 -2
- package/dashboard/dist/assets/{HomePage-CwXFz--v.js.map → HomePage-C6u9dIpR.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-Df4qZryJ.js → ListToolbar-gA5rFzkz.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-Df4qZryJ.js.map → ListToolbar-gA5rFzkz.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-DrogIAKJ.js → McpOverview-BOPo3J_i.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-DrogIAKJ.js.map → McpOverview-BOPo3J_i.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-CJmvCAE6.js → McpQueryDetailPage-BRVVi0Zh.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-CJmvCAE6.js.map → McpQueryDetailPage-BRVVi0Zh.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-lygo4Yq0.js → McpQueryPage-Dmbb6SAc.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-lygo4Yq0.js.map → McpQueryPage-Dmbb6SAc.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-hvns2sCm.js → McpRunDetailPage-bMXNO-6V.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-hvns2sCm.js.map → McpRunDetailPage-bMXNO-6V.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-C2_7spTX.js → McpRunsPage-Bi9AMWja.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-C2_7spTX.js.map → McpRunsPage-Bi9AMWja.js.map} +1 -1
- package/dashboard/dist/assets/{OperationsPage-BlK8WlsY.js → OperationsPage-CvR74ZUJ.js} +3 -3
- package/dashboard/dist/assets/{OperationsPage-BlK8WlsY.js.map → OperationsPage-CvR74ZUJ.js.map} +1 -1
- package/dashboard/dist/assets/{OperatorDashboard-BeWBiMGX.js → OperatorDashboard-DctmZw10.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-BeWBiMGX.js.map → OperatorDashboard-DctmZw10.js.map} +1 -1
- package/dashboard/dist/assets/{PersonaDetailPage-CNHpsX_i.js → PersonaDetailPage-Ubqm2rQH.js} +2 -2
- package/dashboard/dist/assets/{PersonaDetailPage-CNHpsX_i.js.map → PersonaDetailPage-Ubqm2rQH.js.map} +1 -1
- package/dashboard/dist/assets/{PersonasPage-ChASEZRg.js → PersonasPage-BpFL2rpo.js} +2 -2
- package/dashboard/dist/assets/{PersonasPage-ChASEZRg.js.map → PersonasPage-BpFL2rpo.js.map} +1 -1
- package/dashboard/dist/assets/{PortalPage-D5Lk-PKF.js → PortalPage-Dfc_Q02R.js} +2 -2
- package/dashboard/dist/assets/{PortalPage-D5Lk-PKF.js.map → PortalPage-Dfc_Q02R.js.map} +1 -1
- package/dashboard/dist/assets/ProcessDetailPage-liJspvQh.js +2 -0
- package/dashboard/dist/assets/{ProcessDetailPage-DNgCIwRl.js.map → ProcessDetailPage-liJspvQh.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-pRjWuWlH.js → ProcessesListPage-C3OM5ZUy.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-pRjWuWlH.js.map → ProcessesListPage-C3OM5ZUy.js.map} +1 -1
- package/dashboard/dist/assets/ResolverForm-B1_x8Blv.js +8 -0
- package/dashboard/dist/assets/ResolverForm-B1_x8Blv.js.map +1 -0
- package/dashboard/dist/assets/{RoleDetailPage-Bh_UcfYY.js → RoleDetailPage-CrlYCh-R.js} +2 -2
- package/dashboard/dist/assets/{RoleDetailPage-Bh_UcfYY.js.map → RoleDetailPage-CrlYCh-R.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-CK17N7zz.js → RolesPage-BaazL_pt.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-CK17N7zz.js.map → RolesPage-BaazL_pt.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-BEKUP0p2.js → RunAsSelector-DxuV0fa1.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-BEKUP0p2.js.map → RunAsSelector-DxuV0fa1.js.map} +1 -1
- package/dashboard/dist/assets/{ScanCodesPage-Bd0Pflqx.js → ScanCodesPage-C0mvmYTq.js} +2 -2
- package/dashboard/dist/assets/{ScanCodesPage-Bd0Pflqx.js.map → ScanCodesPage-C0mvmYTq.js.map} +1 -1
- package/dashboard/dist/assets/{ScanSchemeDetailPage-CnuhozmJ.js → ScanSchemeDetailPage-CiJgt5dZ.js} +2 -2
- package/dashboard/dist/assets/{ScanSchemeDetailPage-CnuhozmJ.js.map → ScanSchemeDetailPage-CiJgt5dZ.js.map} +1 -1
- package/dashboard/dist/assets/{ScanStationPage-CoLc-q3h.js → ScanStationPage-DzGaXc40.js} +2 -2
- package/dashboard/dist/assets/{ScanStationPage-CoLc-q3h.js.map → ScanStationPage-DzGaXc40.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-COrfvkBi.js → StickyPagination-CqbjVY6T.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-COrfvkBi.js.map → StickyPagination-CqbjVY6T.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-Cif2egLy.js → StreamMessageDetail-wX3i0aqs.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-Cif2egLy.js.map → StreamMessageDetail-wX3i0aqs.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-BnZYTrAh.js → SwimlaneTimeline-C50PsFoV.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-BnZYTrAh.js.map → SwimlaneTimeline-C50PsFoV.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-DEz_dqyR.js → TaskDetailPage-bbNSv4Ae.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-DEz_dqyR.js.map → TaskDetailPage-bbNSv4Ae.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-oEfEGj0_.js → TasksListPage-CDWnm_d9.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-oEfEGj0_.js.map → TasksListPage-CDWnm_d9.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-Dz5TgZZZ.js → TimeAgo-BLjqlfoX.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-Dz5TgZZZ.js.map → TimeAgo-BLjqlfoX.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-BUTgE244.js → TimestampCell-CnW0ENb5.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-BUTgE244.js.map → TimestampCell-CnW0ENb5.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-BS4g6vt-.js → ToolTestPanel-DkMgCB-k.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-BS4g6vt-.js.map → ToolTestPanel-DkMgCB-k.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-C_I6JIVD.js → TopicDetailPage-g3pljKKX.js} +2 -2
- package/dashboard/dist/assets/{TopicDetailPage-C_I6JIVD.js.map → TopicDetailPage-g3pljKKX.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-Cr6-wfhJ.js → TopicsPage-CVcCYdy-.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-Cr6-wfhJ.js.map → TopicsPage-CVcCYdy-.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-ZFpWMaFF.js → UserName-D6zGIK2i.js} +2 -2
- package/dashboard/dist/assets/{UserName-ZFpWMaFF.js.map → UserName-D6zGIK2i.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-ByPixDZW.js → WorkflowExecutionPage-B8g81FCJ.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-ByPixDZW.js.map → WorkflowExecutionPage-B8g81FCJ.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-CWsJdMdR.js → WorkflowsDashboard-nxT3bv6W.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-CWsJdMdR.js.map → WorkflowsDashboard-nxT3bv6W.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-Dk9gyqZN.js → WorkflowsOverview-grI-KAI2.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-Dk9gyqZN.js.map → WorkflowsOverview-grI-KAI2.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-CHwcrsaT.js → YamlWorkflowDetailPage-BoZ-hfBE.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-CHwcrsaT.js.map → YamlWorkflowDetailPage-BoZ-hfBE.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-B5jRX2Ph.js → YamlWorkflowsPage-Bf04rwRv.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-B5jRX2Ph.js.map → YamlWorkflowsPage-Bf04rwRv.js.map} +1 -1
- package/dashboard/dist/assets/{agents-Dd7E-27d.js → agents-Dphpdi8l.js} +2 -2
- package/dashboard/dist/assets/{agents-Dd7E-27d.js.map → agents-Dphpdi8l.js.map} +1 -1
- package/dashboard/dist/assets/{bots-CpaYjZTk.js → bots-DIFE298x.js} +2 -2
- package/dashboard/dist/assets/{bots-CpaYjZTk.js.map → bots-DIFE298x.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-CNjg_qv1.js → capabilities-D7Y7LClY.js} +2 -2
- package/dashboard/dist/assets/{capabilities-CNjg_qv1.js.map → capabilities-D7Y7LClY.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-DgmvnAtU.js → controlplane-D1TGcYsS.js} +2 -2
- package/dashboard/dist/assets/{controlplane-DgmvnAtU.js.map → controlplane-D1TGcYsS.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-Uj4U9g5H.js → escalation-columns-cwZE6xyo.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-Uj4U9g5H.js.map → escalation-columns-cwZE6xyo.js.map} +1 -1
- package/dashboard/dist/assets/{index-x5z73M9N.js → index-BzYcUPdD.js} +2 -2
- package/dashboard/dist/assets/{index-x5z73M9N.js.map → index-BzYcUPdD.js.map} +1 -1
- package/dashboard/dist/assets/index-CeCtqujG.js +67 -0
- package/dashboard/dist/assets/index-CeCtqujG.js.map +1 -0
- package/dashboard/dist/assets/{index-RIFT3RlO.js → index-ChV7pBjM.js} +2 -2
- package/dashboard/dist/assets/{index-RIFT3RlO.js.map → index-ChV7pBjM.js.map} +1 -1
- package/dashboard/dist/assets/{index-OfO0173w.js → index-CniRa65p.js} +2 -2
- package/dashboard/dist/assets/{index-OfO0173w.js.map → index-CniRa65p.js.map} +1 -1
- package/dashboard/dist/assets/{index-ByBy9M3L.js → index-CxdjT1Yk.js} +2 -2
- package/dashboard/dist/assets/{index-ByBy9M3L.js.map → index-CxdjT1Yk.js.map} +1 -1
- package/dashboard/dist/assets/{index-C_K7OlzT.js → index-DAvi5_2T.js} +2 -2
- package/dashboard/dist/assets/{index-C_K7OlzT.js.map → index-DAvi5_2T.js.map} +1 -1
- package/dashboard/dist/assets/{index-BrwqtXRh.js → index-DN-kX7hL.js} +2 -2
- package/dashboard/dist/assets/{index-BrwqtXRh.js.map → index-DN-kX7hL.js.map} +1 -1
- package/dashboard/dist/assets/index-Dl_8hbYI.js +2 -0
- package/dashboard/dist/assets/index-Dl_8hbYI.js.map +1 -0
- package/dashboard/dist/assets/{index-D4Dlznn9.js → index-DpKOr311.js} +2 -2
- package/dashboard/dist/assets/{index-D4Dlznn9.js.map → index-DpKOr311.js.map} +1 -1
- package/dashboard/dist/assets/{index-CnOvJz6U.js → index-Dy1wWu2e.js} +2 -2
- package/dashboard/dist/assets/{index-CnOvJz6U.js.map → index-Dy1wWu2e.js.map} +1 -1
- package/dashboard/dist/assets/{index-BT1Ms5Q5.js → index-HLu98Sqh.js} +2 -2
- package/dashboard/dist/assets/{index-BT1Ms5Q5.js.map → index-HLu98Sqh.js.map} +1 -1
- package/dashboard/dist/assets/{index-BFASQ7_X.js → index-ag2pCAPu.js} +2 -2
- package/dashboard/dist/assets/{index-BFASQ7_X.js.map → index-ag2pCAPu.js.map} +1 -1
- package/dashboard/dist/assets/{index-BsHVgWH6.js → index-gkxPN7Vx.js} +2 -2
- package/dashboard/dist/assets/{index-BsHVgWH6.js.map → index-gkxPN7Vx.js.map} +1 -1
- package/dashboard/dist/assets/index-m9A3UYst.css +1 -0
- package/dashboard/dist/assets/{knowledge-Cci_r6Kl.js → knowledge-DnMs-SOJ.js} +2 -2
- package/dashboard/dist/assets/{knowledge-Cci_r6Kl.js.map → knowledge-DnMs-SOJ.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-NY4iL0L-.js → mcp-CwW-K3r4.js} +2 -2
- package/dashboard/dist/assets/{mcp-NY4iL0L-.js.map → mcp-CwW-K3r4.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-CbvZo_I_.js → mcp-query-BZt5e8_Q.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-CbvZo_I_.js.map → mcp-query-BZt5e8_Q.js.map} +1 -1
- package/dashboard/dist/assets/{personas-Fy-f7QQd.js → personas-UA-Xn60f.js} +2 -2
- package/dashboard/dist/assets/{personas-Fy-f7QQd.js.map → personas-UA-Xn60f.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-DKiuozxV.js → pipelines-Cu3PARum.js} +2 -2
- package/dashboard/dist/assets/{pipelines-DKiuozxV.js.map → pipelines-Cu3PARum.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-CdM1Rkk9.js → tasks-BO6h8GJE.js} +2 -2
- package/dashboard/dist/assets/{tasks-CdM1Rkk9.js.map → tasks-BO6h8GJE.js.map} +1 -1
- package/dashboard/dist/assets/{topics-XNy2mf3n.js → topics-CWjCR-17.js} +2 -2
- package/dashboard/dist/assets/{topics-XNy2mf3n.js.map → topics-CWjCR-17.js.map} +1 -1
- package/dashboard/dist/assets/{useDebouncedValue-CyGcU3_S.js → useDebouncedValue-6t0jx1RB.js} +2 -2
- package/dashboard/dist/assets/{useDebouncedValue-CyGcU3_S.js.map → useDebouncedValue-6t0jx1RB.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-C2RIh_IN.js → useNamespace-CqpoQx6D.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-C2RIh_IN.js.map → useNamespace-CqpoQx6D.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-CDiV5fjf.js → useYamlActivityEvents-hmCQQwzB.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-CDiV5fjf.js.map → useYamlActivityEvents-hmCQQwzB.js.map} +1 -1
- package/dashboard/dist/assets/{validate-DcGWN82Y.js → validate-BIRn4a6d.js} +2 -2
- package/dashboard/dist/assets/{validate-DcGWN82Y.js.map → validate-BIRn4a6d.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-CH8UrouH.js → yaml-workflows-ziUdZhKY.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-CH8UrouH.js.map → yaml-workflows-ziUdZhKY.js.map} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/docs/agents.md +3 -1
- package/docs/api/http/agents.md +15 -1
- package/docs/api/http/escalations.md +3 -3
- package/docs/api/http/exports.md +3 -1
- package/docs/api/http/file-browser.md +3 -1
- package/docs/api/http/mcp-endpoint.md +8 -5
- package/docs/api/http/mcp-servers.md +34 -4
- package/docs/api/http/namespaces.md +2 -0
- package/docs/api/http/pipelines.md +2 -0
- package/docs/api/http/roles.md +11 -8
- package/docs/api/http/service-accounts.md +8 -2
- package/docs/api/http/settings.md +29 -2
- package/docs/api/http/tasks.md +3 -1
- package/docs/api/http/topics.md +7 -1
- package/docs/api/http/users.md +8 -2
- package/docs/api/http/workflows.md +25 -10
- package/docs/api/http/yaml-workflows.md +21 -0
- package/docs/api/mcp/admin.md +409 -49
- package/docs/api/mcp/file-storage.md +4 -0
- package/docs/api/mcp/http-fetch.md +6 -2
- package/docs/api/mcp/human-queue.md +53 -0
- package/docs/api/mcp/index.md +13 -10
- package/docs/api/mcp/knowledge.md +34 -0
- package/docs/api/mcp/oauth.md +1 -1
- package/docs/api/mcp/ortho.md +113 -0
- package/docs/api/mcp/vision.md +1 -1
- package/docs/api/sdk/bot-accounts.md +1 -0
- package/docs/api/sdk/escalations.md +2 -2
- package/docs/api/sdk/mcp.md +2 -2
- package/docs/api/sdk/settings.md +1 -1
- package/docs/api/sdk/tasks.md +2 -2
- package/docs/api/sdk/workflows.md +2 -2
- package/docs/api/sdk/yaml-workflows.md +1 -1
- package/docs/architecture.md +3 -1
- package/docs/auth.md +3 -2
- package/docs/cloud.md +7 -2
- package/docs/dashboard.md +16 -7
- package/docs/data.md +1 -1
- package/docs/escalation-strategies.md +9 -20
- package/docs/events.md +6 -0
- package/docs/iam.md +7 -5
- package/docs/maintenance.md +51 -28
- package/docs/mcp.md +159 -210
- package/docs/oauth-and-delegation.md +32 -21
- package/docs/topics.md +2 -0
- package/docs/workflows.md +14 -112
- package/package.json +5 -3
- package/dashboard/dist/assets/ConfirmDeleteModal-DW4DrPur.js +0 -2
- package/dashboard/dist/assets/ConfirmDeleteModal-DW4DrPur.js.map +0 -1
- package/dashboard/dist/assets/ProcessDetailPage-DNgCIwRl.js +0 -2
- package/dashboard/dist/assets/ResolverForm-CKIOAGtY.js +0 -8
- package/dashboard/dist/assets/ResolverForm-CKIOAGtY.js.map +0 -1
- package/dashboard/dist/assets/index-CtlBjl8o.js +0 -2
- package/dashboard/dist/assets/index-CtlBjl8o.js.map +0 -1
- package/dashboard/dist/assets/index-LRYC__mE.js +0 -67
- package/dashboard/dist/assets/index-LRYC__mE.js.map +0 -1
- package/dashboard/dist/assets/index-MYI2_Xb3.css +0 -1
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-pRjWuWlH.js","./vendor-query-DvWWuNIB.js","./tasks-CdM1Rkk9.js","./useFilterParams-DBRw1Hcv.js","./vendor-react-_9U4mKFr.js","./useDebouncedValue-CyGcU3_S.js","./api-path-u2Jf9QXS.js","./DataTable-FjFhx0SE.js","./EmptyState-DgC_6njU.js","./useContainerWidth-DSLp1gEm.js","./TimestampCell-BUTgE244.js","./StickyPagination-COrfvkBi.js","./FilterBar-BulSsWb2.js","./vendor-icons-CeVtUKyP.js","./PageHeader-CMd3f4bz.js","./ListToolbar-Df4qZryJ.js","./WorkflowPill-Dg7BDTyM.js","./ProcessDetailPage-DNgCIwRl.js","./PageHeaderWithStats-DHj8Mqox.js","./StatusBadge-DHVwxre2.js","./RolePill-Di2CAHuD.js","./UserName-ZFpWMaFF.js","./McpOverview-DrogIAKJ.js","./mcp-NY4iL0L-.js","./pipelines-DKiuozxV.js","./yaml-workflows-CH8UrouH.js","./controlplane-DgmvnAtU.js","./StatCard-nWY4sndl.js","./McpRunsPage-C2_7spTX.js","./useNamespace-C2RIh_IN.js","./ElapsedCell-CmGhVlYl.js","./RowActions-Bdd7z4eB.js","./McpRunDetailPage-hvns2sCm.js","./SegmentedTabs-BpJh4Hwn.js","./EventTable-gBzi5tIS.js","./SwimlaneTimeline-BnZYTrAh.js","./StreamMessageDetail-Cif2egLy.js","./CopyableId-Bn02zYxt.js","./McpQueryPage-lygo4Yq0.js","./mcp-query-CbvZo_I_.js","./McpQueryDetailPage-CJmvCAE6.js","./TagInput-CAgdLN_b.js","./CollapsibleSection-CLr8LP0V.js","./useYamlActivityEvents-CDiV5fjf.js","./helpers-DzO-OGPe.js","./RunAsSelector-BEKUP0p2.js","./BotPicker-DDmpgGHZ.js","./bots-CpaYjZTk.js","./ToolPill-CQCsVdzD.js","./TimeAgo-Dz5TgZZZ.js","./EscalationsOverview-BLPmh4AF.js","./AvailableEscalationsPage-DeYMngwE.js","./task-queues-7-sHKPsN.js","./BulkAssignModal-BqlklomG.js","./constants-CeBBTzf5.js","./EscalationTitleSelect-P0q5sck4.js","./EscalationTimeline-BcnJEKFD.js","./validate-DcGWN82Y.js","./escalation-columns-Uj4U9g5H.js","./FormattedValue-BMHRrvrL.js","./CountdownTimer-DxX72PwV.js","./EntityTimelinePanel-B4Jwy1w3.js","./PriorityBadge-r33mpDju.js","./OperatorDashboard-BeWBiMGX.js","./index-OfO0173w.js","./ResolverForm-CKIOAGtY.js","./metadata-display-B7X5hGxG.js","./WorkflowsOverview-Dk9gyqZN.js","./index-ByBy9M3L.js","./NamespacePill-DwM5pNA4.js","./WorkflowsDashboard-CWsJdMdR.js","./YamlWorkflowsPage-B5jRX2Ph.js","./GraphInvokePage--997yNRr.js","./YamlWorkflowDetailPage-CHwcrsaT.js","./TasksListPage-oEfEGj0_.js","./TaskDetailPage-DEz_dqyR.js","./WorkflowExecutionPage-ByPixDZW.js","./AdminDashboard-BPWsgMfZ.js","./index-BFASQ7_X.js","./TaskQueuePill-h0oorVMe.js","./index-BsHVgWH6.js","./ConfirmDeleteModal-DW4DrPur.js","./index-BrwqtXRh.js","./ToolTestPanel-BS4g6vt-.js","./index-CtlBjl8o.js","./index-BT1Ms5Q5.js","./personas-Fy-f7QQd.js","./ScopeBadge-CSItPVOH.js","./RolesPage-CK17N7zz.js","./RoleDetailPage-Bh_UcfYY.js","./AutoGrowTextarea-7X3T9La8.js","./PersonasPage-ChASEZRg.js","./PersonaDetailPage-CNHpsX_i.js","./EscalationSchemaPage-D0ko59_S.js","./PortalPage-D5Lk-PKF.js","./EscalationListSchemaPage-CZZbZ4Aa.js","./ScanCodesPage-Bd0Pflqx.js","./GrantScopeField-BzWGzBfA.js","./ScanSchemeDetailPage-CnuhozmJ.js","./ScanStationPage-CoLc-q3h.js","./index-CnOvJz6U.js","./OperationsPage-BlK8WlsY.js","./index-x5z73M9N.js","./index-D4Dlznn9.js","./CredentialsPage-CObc9Rs5.js","./index-RIFT3RlO.js","./DropZone-B1Tdfddc.js","./index-C_K7OlzT.js","./knowledge-Cci_r6Kl.js","./HomePage-CwXFz--v.js","./AgentsPage-DMEmiK_W.js","./agents-Dd7E-27d.js","./AgentDetailPage-B6o96Y5G.js","./CronLabel-Bb8GoNY5.js","./AgentConfigPage-De9imyo5.js","./capabilities-CNjg_qv1.js","./topics-XNy2mf3n.js","./CapabilitiesPage-DOtjDTbK.js","./TopicsPage-Cr6-wfhJ.js","./TopicDetailPage-C_I6JIVD.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var eS=Object.defineProperty;var tS=(n,t,s)=>t in n?eS(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var j=(n,t,s)=>tS(n,typeof t!="symbol"?t+"":t,s);import{r as nS,u as $e,a as E,j as h,b as He,c as Ve,g as rS,d as sS,Q as iS,e as aS}from"./vendor-query-DvWWuNIB.js";import{r as oS,u as ra,a as on,b as Zd,L as Mr,N as Ss,c as wn,O as Zs,d as lS,R as cS}from"./vendor-react-_9U4mKFr.js";import{X as Wt,E as uS,S as fS,M as hS,a as To,C as em,b as dS,c as mS,d as tx,e as dd,I as md,U as pS,L as pd,B as yS,G as gS,T as bS,R as nx,f as xS,Z as vS,P as jg,g as rx,h as _S,i as kg,j as yd,k as Tg,l as wS,W as tm,m as SS,n as ES,F as OS,o as sx,p as AS,D as jS,N as kS,q as TS,r as ix,s as ax,t as ox,u as NS,v as CS,w as MS,x as RS,y as DS,z as LS,A as qS,H as BS,J as PS}from"./vendor-icons-CeVtUKyP.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const m of c.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function s(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(o){if(o.ep)return;o.ep=!0;const c=s(o);fetch(o.href,c)}})();var Vh={exports:{}},to={},Yh={exports:{}},Kh={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* scheduler.production.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var Ng;function US(){return Ng||(Ng=1,(function(n){function t(F,W){var ce=F.length;F.push(W);e:for(;0<ce;){var xe=ce-1>>>1,ve=F[xe];if(0<o(ve,W))F[xe]=W,F[ce]=ve,ce=xe;else break e}}function s(F){return F.length===0?null:F[0]}function i(F){if(F.length===0)return null;var W=F[0],ce=F.pop();if(ce!==W){F[0]=ce;e:for(var xe=0,ve=F.length,Ce=ve>>>1;xe<Ce;){var Te=2*(xe+1)-1,Me=F[Te],Ze=Te+1,yt=F[Ze];if(0>o(Me,ce))Ze<ve&&0>o(yt,Me)?(F[xe]=yt,F[Ze]=ce,xe=Ze):(F[xe]=Me,F[Te]=ce,xe=Te);else if(Ze<ve&&0>o(yt,ce))F[xe]=yt,F[Ze]=ce,xe=Ze;else break e}}return W}function o(F,W){var ce=F.sortIndex-W.sortIndex;return ce!==0?ce:F.id-W.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;n.unstable_now=function(){return c.now()}}else{var m=Date,y=m.now();n.unstable_now=function(){return m.now()-y}}var g=[],u=[],d=1,b=null,x=3,v=!1,w=!1,S=!1,C=!1,q=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,se=typeof setImmediate<"u"?setImmediate:null;function le(F){for(var W=s(u);W!==null;){if(W.callback===null)i(u);else if(W.startTime<=F)i(u),W.sortIndex=W.expirationTime,t(g,W);else break;W=s(u)}}function R(F){if(S=!1,le(F),!w)if(s(g)!==null)w=!0,H||(H=!0,X());else{var W=s(u);W!==null&&ke(R,W.startTime-F)}}var H=!1,ae=-1,$=5,I=-1;function D(){return C?!0:!(n.unstable_now()-I<$)}function Q(){if(C=!1,H){var F=n.unstable_now();I=F;var W=!0;try{e:{w=!1,S&&(S=!1,B(ae),ae=-1),v=!0;var ce=x;try{t:{for(le(F),b=s(g);b!==null&&!(b.expirationTime>F&&D());){var xe=b.callback;if(typeof xe=="function"){b.callback=null,x=b.priorityLevel;var ve=xe(b.expirationTime<=F);if(F=n.unstable_now(),typeof ve=="function"){b.callback=ve,le(F),W=!0;break t}b===s(g)&&i(g),le(F)}else i(g);b=s(g)}if(b!==null)W=!0;else{var Ce=s(u);Ce!==null&&ke(R,Ce.startTime-F),W=!1}}break e}finally{b=null,x=ce,v=!1}W=void 0}}finally{W?X():H=!1}}}var X;if(typeof se=="function")X=function(){se(Q)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,Se=he.port2;he.port1.onmessage=Q,X=function(){Se.postMessage(null)}}else X=function(){q(Q,0)};function ke(F,W){ae=q(function(){F(n.unstable_now())},W)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(F){F.callback=null},n.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<F?Math.floor(1e3/F):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(F){switch(x){case 1:case 2:case 3:var W=3;break;default:W=x}var ce=x;x=W;try{return F()}finally{x=ce}},n.unstable_requestPaint=function(){C=!0},n.unstable_runWithPriority=function(F,W){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var ce=x;x=F;try{return W()}finally{x=ce}},n.unstable_scheduleCallback=function(F,W,ce){var xe=n.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?xe+ce:xe):ce=xe,F){case 1:var ve=-1;break;case 2:ve=250;break;case 5:ve=1073741823;break;case 4:ve=1e4;break;default:ve=5e3}return ve=ce+ve,F={id:d++,callback:W,priorityLevel:F,startTime:ce,expirationTime:ve,sortIndex:-1},ce>xe?(F.sortIndex=ce,t(u,F),s(g)===null&&F===s(u)&&(S?(B(ae),ae=-1):S=!0,ke(R,ce-xe))):(F.sortIndex=ve,t(g,F),w||v||(w=!0,H||(H=!0,X()))),F},n.unstable_shouldYield=D,n.unstable_wrapCallback=function(F){var W=x;return function(){var ce=x;x=W;try{return F.apply(this,arguments)}finally{x=ce}}}})(Kh)),Kh}var Cg;function zS(){return Cg||(Cg=1,Yh.exports=US()),Yh.exports}/**
|
|
11
|
-
* @license React
|
|
12
|
-
* react-dom-client.production.js
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var Mg;function IS(){if(Mg)return to;Mg=1;var n=zS(),t=nS(),s=oS();function i(e){var r="https://react.dev/errors/"+e;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)r+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var r=e,a=e;if(e.alternate)for(;r.return;)r=r.return;else{e=r;do r=e,(r.flags&4098)!==0&&(a=r.return),e=r.return;while(e)}return r.tag===3?a:null}function m(e){if(e.tag===13){var r=e.memoizedState;if(r===null&&(e=e.alternate,e!==null&&(r=e.memoizedState)),r!==null)return r.dehydrated}return null}function y(e){if(e.tag===31){var r=e.memoizedState;if(r===null&&(e=e.alternate,e!==null&&(r=e.memoizedState)),r!==null)return r.dehydrated}return null}function g(e){if(c(e)!==e)throw Error(i(188))}function u(e){var r=e.alternate;if(!r){if(r=c(e),r===null)throw Error(i(188));return r!==e?null:e}for(var a=e,l=r;;){var f=a.return;if(f===null)break;var p=f.alternate;if(p===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===p.child){for(p=f.child;p;){if(p===a)return g(f),e;if(p===l)return g(f),r;p=p.sibling}throw Error(i(188))}if(a.return!==l.return)a=f,l=p;else{for(var _=!1,O=f.child;O;){if(O===a){_=!0,a=f,l=p;break}if(O===l){_=!0,l=f,a=p;break}O=O.sibling}if(!_){for(O=p.child;O;){if(O===a){_=!0,a=p,l=f;break}if(O===l){_=!0,l=p,a=f;break}O=O.sibling}if(!_)throw Error(i(189))}}if(a.alternate!==l)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?e:r}function d(e){var r=e.tag;if(r===5||r===26||r===27||r===6)return e;for(e=e.child;e!==null;){if(r=d(e),r!==null)return r;e=e.sibling}return null}var b=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),q=Symbol.for("react.profiler"),B=Symbol.for("react.consumer"),se=Symbol.for("react.context"),le=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function X(e){return e===null||typeof e!="object"?null:(e=Q&&e[Q]||e["@@iterator"],typeof e=="function"?e:null)}var he=Symbol.for("react.client.reference");function Se(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===he?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case q:return"Profiler";case C:return"StrictMode";case R:return"Suspense";case H:return"SuspenseList";case I:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case se:return e.displayName||"Context";case B:return(e._context.displayName||"Context")+".Consumer";case le:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ae:return r=e.displayName||null,r!==null?r:Se(e.type)||"Memo";case $:r=e._payload,e=e._init;try{return Se(e(r))}catch{}}return null}var ke=Array.isArray,F=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},xe=[],ve=-1;function Ce(e){return{current:e}}function Te(e){0>ve||(e.current=xe[ve],xe[ve]=null,ve--)}function Me(e,r){ve++,xe[ve]=e.current,e.current=r}var Ze=Ce(null),yt=Ce(null),Ct=Ce(null),we=Ce(null);function Re(e,r){switch(Me(Ct,r),Me(yt,e),Me(Ze,null),r.nodeType){case 9:case 11:e=(e=r.documentElement)&&(e=e.namespaceURI)?Xy(e):0;break;default:if(e=r.tagName,r=r.namespaceURI)r=Xy(r),e=Qy(r,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Te(Ze),Me(Ze,e)}function oe(){Te(Ze),Te(yt),Te(Ct)}function Be(e){e.memoizedState!==null&&Me(we,e);var r=Ze.current,a=Qy(r,e.type);r!==a&&(Me(yt,e),Me(Ze,a))}function We(e){yt.current===e&&(Te(Ze),Te(yt)),we.current===e&&(Te(we),Qa._currentValue=ce)}var ln,pe;function Ye(e){if(ln===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);ln=r&&r[1]||"",pe=-1<a.stack.indexOf(`
|
|
19
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
-
`+ln+e+pe}var Ot=!1;function ft(e,r){if(!e||Ot)return"";Ot=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(r){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(J){var Y=J}Reflect.construct(e,[],re)}else{try{re.call()}catch(J){Y=J}e.call(re.prototype)}}else{try{throw Error()}catch(J){Y=J}(re=e())&&typeof re.catch=="function"&&re.catch(function(){})}}catch(J){if(J&&Y&&typeof J.stack=="string")return[J.stack,Y.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=l.DetermineComponentFrameRoot(),_=p[0],O=p[1];if(_&&O){var M=_.split(`
|
|
21
|
-
`),V=O.split(`
|
|
22
|
-
`);for(f=l=0;l<M.length&&!M[l].includes("DetermineComponentFrameRoot");)l++;for(;f<V.length&&!V[f].includes("DetermineComponentFrameRoot");)f++;if(l===M.length||f===V.length)for(l=M.length-1,f=V.length-1;1<=l&&0<=f&&M[l]!==V[f];)f--;for(;1<=l&&0<=f;l--,f--)if(M[l]!==V[f]){if(l!==1||f!==1)do if(l--,f--,0>f||M[l]!==V[f]){var Z=`
|
|
23
|
-
`+M[l].replace(" at new "," at ");return e.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",e.displayName)),Z}while(1<=l&&0<=f);break}}}finally{Ot=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Ye(a):""}function Pr(e,r){switch(e.tag){case 26:case 27:case 5:return Ye(e.type);case 16:return Ye("Lazy");case 13:return e.child!==r&&r!==null?Ye("Suspense Fallback"):Ye("Suspense");case 19:return Ye("SuspenseList");case 0:case 15:return ft(e.type,!1);case 11:return ft(e.type.render,!1);case 1:return ft(e.type,!0);case 31:return Ye("Activity");default:return""}}function Bo(e){try{var r="",a=null;do r+=Pr(e,a),a=e,e=e.return;while(e);return r}catch(l){return`
|
|
24
|
-
Error generating stack: `+l.message+`
|
|
25
|
-
`+l.stack}}var oa=Object.prototype.hasOwnProperty,la=n.unstable_scheduleCallback,ur=n.unstable_cancelCallback,Po=n.unstable_shouldYield,ni=n.unstable_requestPaint,ht=n.unstable_now,Lu=n.unstable_getCurrentPriorityLevel,Uo=n.unstable_ImmediatePriority,zo=n.unstable_UserBlockingPriority,ri=n.unstable_NormalPriority,qu=n.unstable_LowPriority,Io=n.unstable_IdlePriority,Bu=n.log,$o=n.unstable_setDisableYieldValue,js=null,_t=null;function cn(e){if(typeof Bu=="function"&&$o(e),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(js,e)}catch{}}var Ft=Math.clz32?Math.clz32:si,ca=Math.log,ua=Math.LN2;function si(e){return e>>>=0,e===0?32:31-(ca(e)/ua|0)|0}var Ur=256,fr=262144,zr=4194304;function $n(e){var r=e&42;if(r!==0)return r;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ks(e,r,a){var l=e.pendingLanes;if(l===0)return 0;var f=0,p=e.suspendedLanes,_=e.pingedLanes;e=e.warmLanes;var O=l&134217727;return O!==0?(l=O&~p,l!==0?f=$n(l):(_&=O,_!==0?f=$n(_):a||(a=O&~e,a!==0&&(f=$n(a))))):(O=l&~p,O!==0?f=$n(O):_!==0?f=$n(_):a||(a=l&~e,a!==0&&(f=$n(a)))),f===0?0:r!==0&&r!==f&&(r&p)===0&&(p=f&-f,a=r&-r,p>=a||p===32&&(a&4194048)!==0)?r:f}function Ts(e,r){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&r)===0}function fa(e,r){switch(e){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ii(){var e=zr;return zr<<=1,(zr&62914560)===0&&(zr=4194304),e}function Ir(e){for(var r=[],a=0;31>a;a++)r.push(e);return r}function Hn(e,r){e.pendingLanes|=r,r!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function $r(e,r,a,l,f,p){var _=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var O=e.entanglements,M=e.expirationTimes,V=e.hiddenUpdates;for(a=_&~a;0<a;){var Z=31-Ft(a),re=1<<Z;O[Z]=0,M[Z]=-1;var Y=V[Z];if(Y!==null)for(V[Z]=null,Z=0;Z<Y.length;Z++){var J=Y[Z];J!==null&&(J.lane&=-536870913)}a&=~re}l!==0&&Hr(e,l,0),p!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=p&~(_&~r))}function Hr(e,r,a){e.pendingLanes|=r,e.suspendedLanes&=~r;var l=31-Ft(r);e.entangledLanes|=r,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Ns(e,r){var a=e.entangledLanes|=r;for(e=e.entanglements;a;){var l=31-Ft(a),f=1<<l;f&r|e[l]&r&&(e[l]|=r),a&=~f}}function Fr(e,r){var a=r&-r;return a=(a&42)!==0?1:hr(a),(a&(e.suspendedLanes|r))!==0?0:a}function hr(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 Cs(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ha(){var e=W.p;return e!==0?e:(e=window.event,e===void 0?32:vg(e.type))}function Ho(e,r){var a=W.p;try{return W.p=e,r()}finally{W.p=a}}var er=Math.random().toString(36).slice(2),at="__reactFiber$"+er,gt="__reactProps$"+er,un="__reactContainer$"+er,Ms="__reactEvents$"+er,da="__reactListeners$"+er,Fo="__reactHandles$"+er,Go="__reactResources$"+er,Mt="__reactMarker$"+er;function ai(e){delete e[at],delete e[gt],delete e[Ms],delete e[da],delete e[Fo]}function A(e){var r=e[at];if(r)return r;for(var a=e.parentNode;a;){if(r=a[un]||a[at]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(e=sg(e);e!==null;){if(a=e[at])return a;e=sg(e)}return r}e=a,a=e.parentNode}return null}function T(e){if(e=e[at]||e[un]){var r=e.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return e}return null}function k(e){var r=e.tag;if(r===5||r===26||r===27||r===6)return e.stateNode;throw Error(i(33))}function N(e){var r=e[Go];return r||(r=e[Go]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function L(e){e[Mt]=!0}var z=new Set,ne={};function ie(e,r){K(e,r),K(e+"Capture",r)}function K(e,r){for(ne[e]=r,e=0;e<r.length;e++)z.add(r[e])}var te=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]*$"),ge={},qe={};function lt(e){return oa.call(qe,e)?!0:oa.call(ge,e)?!1:te.test(e)?qe[e]=!0:(ge[e]=!0,!1)}function Gt(e,r,a){if(lt(r))if(a===null)e.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(r);return;case"boolean":var l=r.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(r);return}}e.setAttribute(r,""+a)}}function Fn(e,r,a){if(a===null)e.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttribute(r,""+a)}}function dr(e,r,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(r,a,""+l)}}function Tn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function $m(e){var r=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Yv(e,r,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,r);if(!e.hasOwnProperty(r)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,p=l.set;return Object.defineProperty(e,r,{configurable:!0,get:function(){return f.call(this)},set:function(_){a=""+_,p.call(this,_)}}),Object.defineProperty(e,r,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(_){a=""+_},stopTracking:function(){e._valueTracker=null,delete e[r]}}}}function Pu(e){if(!e._valueTracker){var r=$m(e)?"checked":"value";e._valueTracker=Yv(e,r,""+e[r])}}function Hm(e){if(!e)return!1;var r=e._valueTracker;if(!r)return!0;var a=r.getValue(),l="";return e&&(l=$m(e)?e.checked?"true":"false":e.value),e=l,e!==a?(r.setValue(e),!0):!1}function Vo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Kv=/[\n"\\]/g;function Nn(e){return e.replace(Kv,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Uu(e,r,a,l,f,p,_,O){e.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.type=_:e.removeAttribute("type"),r!=null?_==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+Tn(r)):e.value!==""+Tn(r)&&(e.value=""+Tn(r)):_!=="submit"&&_!=="reset"||e.removeAttribute("value"),r!=null?zu(e,_,Tn(r)):a!=null?zu(e,_,Tn(a)):l!=null&&e.removeAttribute("value"),f==null&&p!=null&&(e.defaultChecked=!!p),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?e.name=""+Tn(O):e.removeAttribute("name")}function Fm(e,r,a,l,f,p,_,O){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),r!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||r!=null)){Pu(e);return}a=a!=null?""+Tn(a):"",r=r!=null?""+Tn(r):a,O||r===e.value||(e.value=r),e.defaultValue=r}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=O?e.checked:!!l,e.defaultChecked=!!l,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(e.name=_),Pu(e)}function zu(e,r,a){r==="number"&&Vo(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function oi(e,r,a,l){if(e=e.options,r){r={};for(var f=0;f<a.length;f++)r["$"+a[f]]=!0;for(a=0;a<e.length;a++)f=r.hasOwnProperty("$"+e[a].value),e[a].selected!==f&&(e[a].selected=f),f&&l&&(e[a].defaultSelected=!0)}else{for(a=""+Tn(a),r=null,f=0;f<e.length;f++){if(e[f].value===a){e[f].selected=!0,l&&(e[f].defaultSelected=!0);return}r!==null||e[f].disabled||(r=e[f])}r!==null&&(r.selected=!0)}}function Gm(e,r,a){if(r!=null&&(r=""+Tn(r),r!==e.value&&(e.value=r),a==null)){e.defaultValue!==r&&(e.defaultValue=r);return}e.defaultValue=a!=null?""+Tn(a):""}function Vm(e,r,a,l){if(r==null){if(l!=null){if(a!=null)throw Error(i(92));if(ke(l)){if(1<l.length)throw Error(i(93));l=l[0]}a=l}a==null&&(a=""),r=a}a=Tn(r),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),Pu(e)}function li(e,r){if(r){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=r;return}}e.textContent=r}var Jv=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 Ym(e,r,a){var l=r.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="":l?e.setProperty(r,a):typeof a!="number"||a===0||Jv.has(r)?r==="float"?e.cssFloat=a:e[r]=(""+a).trim():e[r]=a+"px"}function Km(e,r,a){if(r!=null&&typeof r!="object")throw Error(i(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||r!=null&&r.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in r)l=r[f],r.hasOwnProperty(f)&&a[f]!==l&&Ym(e,f,l)}else for(var p in r)r.hasOwnProperty(p)&&Ym(e,p,r[p])}function Iu(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 Xv=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"]]),Qv=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Yo(e){return Qv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function mr(){}var $u=null;function Hu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ci=null,ui=null;function Jm(e){var r=T(e);if(r&&(e=r.stateNode)){var a=e[gt]||null;e:switch(e=r.stateNode,r.type){case"input":if(Uu(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),r=a.name,a.type==="radio"&&r!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Nn(""+r)+'"][type="radio"]'),r=0;r<a.length;r++){var l=a[r];if(l!==e&&l.form===e.form){var f=l[gt]||null;if(!f)throw Error(i(90));Uu(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(r=0;r<a.length;r++)l=a[r],l.form===e.form&&Hm(l)}break e;case"textarea":Gm(e,a.value,a.defaultValue);break e;case"select":r=a.value,r!=null&&oi(e,!!a.multiple,r,!1)}}}var Fu=!1;function Xm(e,r,a){if(Fu)return e(r,a);Fu=!0;try{var l=e(r);return l}finally{if(Fu=!1,(ci!==null||ui!==null)&&(Dl(),ci&&(r=ci,e=ui,ui=ci=null,Jm(r),e)))for(r=0;r<e.length;r++)Jm(e[r])}}function ma(e,r){var a=e.stateNode;if(a===null)return null;var l=a[gt]||null;if(l===null)return null;a=l[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(i(231,r,typeof a));return a}var pr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Gu=!1;if(pr)try{var pa={};Object.defineProperty(pa,"passive",{get:function(){Gu=!0}}),window.addEventListener("test",pa,pa),window.removeEventListener("test",pa,pa)}catch{Gu=!1}var Gr=null,Vu=null,Ko=null;function Qm(){if(Ko)return Ko;var e,r=Vu,a=r.length,l,f="value"in Gr?Gr.value:Gr.textContent,p=f.length;for(e=0;e<a&&r[e]===f[e];e++);var _=a-e;for(l=1;l<=_&&r[a-l]===f[p-l];l++);return Ko=f.slice(e,1<l?1-l:void 0)}function Jo(e){var r=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&r===13&&(e=13)):e=r,e===10&&(e=13),32<=e||e===13?e:0}function Xo(){return!0}function Wm(){return!1}function en(e){function r(a,l,f,p,_){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=p,this.target=_,this.currentTarget=null;for(var O in e)e.hasOwnProperty(O)&&(a=e[O],this[O]=a?a(p):p[O]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Xo:Wm,this.isPropagationStopped=Wm,this}return b(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Xo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Xo)},persist:function(){},isPersistent:Xo}),r}var Rs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qo=en(Rs),ya=b({},Rs,{view:0,detail:0}),Wv=en(ya),Yu,Ku,ga,Wo=b({},ya,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xu,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ga&&(ga&&e.type==="mousemove"?(Yu=e.screenX-ga.screenX,Ku=e.screenY-ga.screenY):Ku=Yu=0,ga=e),Yu)},movementY:function(e){return"movementY"in e?e.movementY:Ku}}),Zm=en(Wo),Zv=b({},Wo,{dataTransfer:0}),e_=en(Zv),t_=b({},ya,{relatedTarget:0}),Ju=en(t_),n_=b({},Rs,{animationName:0,elapsedTime:0,pseudoElement:0}),r_=en(n_),s_=b({},Rs,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),i_=en(s_),a_=b({},Rs,{data:0}),e0=en(a_),o_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},l_={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"},c_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function u_(e){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(e):(e=c_[e])?!!r[e]:!1}function Xu(){return u_}var f_=b({},ya,{key:function(e){if(e.key){var r=o_[e.key]||e.key;if(r!=="Unidentified")return r}return e.type==="keypress"?(e=Jo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?l_[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xu,charCode:function(e){return e.type==="keypress"?Jo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Jo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),h_=en(f_),d_=b({},Wo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),t0=en(d_),m_=b({},ya,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xu}),p_=en(m_),y_=b({},Rs,{propertyName:0,elapsedTime:0,pseudoElement:0}),g_=en(y_),b_=b({},Wo,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),x_=en(b_),v_=b({},Rs,{newState:0,oldState:0}),__=en(v_),w_=[9,13,27,32],Qu=pr&&"CompositionEvent"in window,ba=null;pr&&"documentMode"in document&&(ba=document.documentMode);var S_=pr&&"TextEvent"in window&&!ba,n0=pr&&(!Qu||ba&&8<ba&&11>=ba),r0=" ",s0=!1;function i0(e,r){switch(e){case"keyup":return w_.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function a0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fi=!1;function E_(e,r){switch(e){case"compositionend":return a0(r);case"keypress":return r.which!==32?null:(s0=!0,r0);case"textInput":return e=r.data,e===r0&&s0?null:e;default:return null}}function O_(e,r){if(fi)return e==="compositionend"||!Qu&&i0(e,r)?(e=Qm(),Ko=Vu=Gr=null,fi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return n0&&r.locale!=="ko"?null:r.data;default:return null}}var A_={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 o0(e){var r=e&&e.nodeName&&e.nodeName.toLowerCase();return r==="input"?!!A_[e.type]:r==="textarea"}function l0(e,r,a,l){ci?ui?ui.push(l):ui=[l]:ci=l,r=Il(r,"onChange"),0<r.length&&(a=new Qo("onChange","change",null,a,l),e.push({event:a,listeners:r}))}var xa=null,va=null;function j_(e){Fy(e,0)}function Zo(e){var r=k(e);if(Hm(r))return e}function c0(e,r){if(e==="change")return r}var u0=!1;if(pr){var Wu;if(pr){var Zu="oninput"in document;if(!Zu){var f0=document.createElement("div");f0.setAttribute("oninput","return;"),Zu=typeof f0.oninput=="function"}Wu=Zu}else Wu=!1;u0=Wu&&(!document.documentMode||9<document.documentMode)}function h0(){xa&&(xa.detachEvent("onpropertychange",d0),va=xa=null)}function d0(e){if(e.propertyName==="value"&&Zo(va)){var r=[];l0(r,va,e,Hu(e)),Xm(j_,r)}}function k_(e,r,a){e==="focusin"?(h0(),xa=r,va=a,xa.attachEvent("onpropertychange",d0)):e==="focusout"&&h0()}function T_(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zo(va)}function N_(e,r){if(e==="click")return Zo(r)}function C_(e,r){if(e==="input"||e==="change")return Zo(r)}function M_(e,r){return e===r&&(e!==0||1/e===1/r)||e!==e&&r!==r}var fn=typeof Object.is=="function"?Object.is:M_;function _a(e,r){if(fn(e,r))return!0;if(typeof e!="object"||e===null||typeof r!="object"||r===null)return!1;var a=Object.keys(e),l=Object.keys(r);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!oa.call(r,f)||!fn(e[f],r[f]))return!1}return!0}function m0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function p0(e,r){var a=m0(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=r&&l>=r)return{node:a,offset:r-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=m0(a)}}function y0(e,r){return e&&r?e===r?!0:e&&e.nodeType===3?!1:r&&r.nodeType===3?y0(e,r.parentNode):"contains"in e?e.contains(r):e.compareDocumentPosition?!!(e.compareDocumentPosition(r)&16):!1:!1}function g0(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var r=Vo(e.document);r instanceof e.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)e=r.contentWindow;else break;r=Vo(e.document)}return r}function ef(e){var r=e&&e.nodeName&&e.nodeName.toLowerCase();return r&&(r==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||r==="textarea"||e.contentEditable==="true")}var R_=pr&&"documentMode"in document&&11>=document.documentMode,hi=null,tf=null,wa=null,nf=!1;function b0(e,r,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;nf||hi==null||hi!==Vo(l)||(l=hi,"selectionStart"in l&&ef(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),wa&&_a(wa,l)||(wa=l,l=Il(tf,"onSelect"),0<l.length&&(r=new Qo("onSelect","select",null,r,a),e.push({event:r,listeners:l}),r.target=hi)))}function Ds(e,r){var a={};return a[e.toLowerCase()]=r.toLowerCase(),a["Webkit"+e]="webkit"+r,a["Moz"+e]="moz"+r,a}var di={animationend:Ds("Animation","AnimationEnd"),animationiteration:Ds("Animation","AnimationIteration"),animationstart:Ds("Animation","AnimationStart"),transitionrun:Ds("Transition","TransitionRun"),transitionstart:Ds("Transition","TransitionStart"),transitioncancel:Ds("Transition","TransitionCancel"),transitionend:Ds("Transition","TransitionEnd")},rf={},x0={};pr&&(x0=document.createElement("div").style,"AnimationEvent"in window||(delete di.animationend.animation,delete di.animationiteration.animation,delete di.animationstart.animation),"TransitionEvent"in window||delete di.transitionend.transition);function Ls(e){if(rf[e])return rf[e];if(!di[e])return e;var r=di[e],a;for(a in r)if(r.hasOwnProperty(a)&&a in x0)return rf[e]=r[a];return e}var v0=Ls("animationend"),_0=Ls("animationiteration"),w0=Ls("animationstart"),D_=Ls("transitionrun"),L_=Ls("transitionstart"),q_=Ls("transitioncancel"),S0=Ls("transitionend"),E0=new Map,sf="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(" ");sf.push("scrollEnd");function Gn(e,r){E0.set(e,r),ie(r,[e])}var el=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Cn=[],mi=0,af=0;function tl(){for(var e=mi,r=af=mi=0;r<e;){var a=Cn[r];Cn[r++]=null;var l=Cn[r];Cn[r++]=null;var f=Cn[r];Cn[r++]=null;var p=Cn[r];if(Cn[r++]=null,l!==null&&f!==null){var _=l.pending;_===null?f.next=f:(f.next=_.next,_.next=f),l.pending=f}p!==0&&O0(a,f,p)}}function nl(e,r,a,l){Cn[mi++]=e,Cn[mi++]=r,Cn[mi++]=a,Cn[mi++]=l,af|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function of(e,r,a,l){return nl(e,r,a,l),rl(e)}function qs(e,r){return nl(e,null,null,r),rl(e)}function O0(e,r,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var f=!1,p=e.return;p!==null;)p.childLanes|=a,l=p.alternate,l!==null&&(l.childLanes|=a),p.tag===22&&(e=p.stateNode,e===null||e._visibility&1||(f=!0)),e=p,p=p.return;return e.tag===3?(p=e.stateNode,f&&r!==null&&(f=31-Ft(a),e=p.hiddenUpdates,l=e[f],l===null?e[f]=[r]:l.push(r),r.lane=a|536870912),p):null}function rl(e){if(50<Fa)throw Fa=0,yh=null,Error(i(185));for(var r=e.return;r!==null;)e=r,r=e.return;return e.tag===3?e.stateNode:null}var pi={};function B_(e,r,a,l){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function hn(e,r,a,l){return new B_(e,r,a,l)}function lf(e){return e=e.prototype,!(!e||!e.isReactComponent)}function yr(e,r){var a=e.alternate;return a===null?(a=hn(e.tag,r,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=r,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,r=e.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function A0(e,r){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=r,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,r=a.dependencies,e.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),e}function sl(e,r,a,l,f,p){var _=0;if(l=e,typeof e=="function")lf(e)&&(_=1);else if(typeof e=="string")_=$w(e,a,Ze.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case I:return e=hn(31,a,r,f),e.elementType=I,e.lanes=p,e;case S:return Bs(a.children,f,p,r);case C:_=8,f|=24;break;case q:return e=hn(12,a,r,f|2),e.elementType=q,e.lanes=p,e;case R:return e=hn(13,a,r,f),e.elementType=R,e.lanes=p,e;case H:return e=hn(19,a,r,f),e.elementType=H,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case se:_=10;break e;case B:_=9;break e;case le:_=11;break e;case ae:_=14;break e;case $:_=16,l=null;break e}_=29,a=Error(i(130,e===null?"null":typeof e,"")),l=null}return r=hn(_,a,r,f),r.elementType=e,r.type=l,r.lanes=p,r}function Bs(e,r,a,l){return e=hn(7,e,l,r),e.lanes=a,e}function cf(e,r,a){return e=hn(6,e,null,r),e.lanes=a,e}function j0(e){var r=hn(18,null,null,0);return r.stateNode=e,r}function uf(e,r,a){return r=hn(4,e.children!==null?e.children:[],e.key,r),r.lanes=a,r.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},r}var k0=new WeakMap;function Mn(e,r){if(typeof e=="object"&&e!==null){var a=k0.get(e);return a!==void 0?a:(r={value:e,source:r,stack:Bo(r)},k0.set(e,r),r)}return{value:e,source:r,stack:Bo(r)}}var yi=[],gi=0,il=null,Sa=0,Rn=[],Dn=0,Vr=null,tr=1,nr="";function gr(e,r){yi[gi++]=Sa,yi[gi++]=il,il=e,Sa=r}function T0(e,r,a){Rn[Dn++]=tr,Rn[Dn++]=nr,Rn[Dn++]=Vr,Vr=e;var l=tr;e=nr;var f=32-Ft(l)-1;l&=~(1<<f),a+=1;var p=32-Ft(r)+f;if(30<p){var _=f-f%5;p=(l&(1<<_)-1).toString(32),l>>=_,f-=_,tr=1<<32-Ft(r)+f|a<<f|l,nr=p+e}else tr=1<<p|a<<f|l,nr=e}function ff(e){e.return!==null&&(gr(e,1),T0(e,1,0))}function hf(e){for(;e===il;)il=yi[--gi],yi[gi]=null,Sa=yi[--gi],yi[gi]=null;for(;e===Vr;)Vr=Rn[--Dn],Rn[Dn]=null,nr=Rn[--Dn],Rn[Dn]=null,tr=Rn[--Dn],Rn[Dn]=null}function N0(e,r){Rn[Dn++]=tr,Rn[Dn++]=nr,Rn[Dn++]=Vr,tr=r.id,nr=r.overflow,Vr=e}var Ut=null,ct=null,Fe=!1,Yr=null,Ln=!1,df=Error(i(519));function Kr(e){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ea(Mn(r,e)),df}function C0(e){var r=e.stateNode,a=e.type,l=e.memoizedProps;switch(r[at]=e,r[gt]=l,a){case"dialog":Ue("cancel",r),Ue("close",r);break;case"iframe":case"object":case"embed":Ue("load",r);break;case"video":case"audio":for(a=0;a<Va.length;a++)Ue(Va[a],r);break;case"source":Ue("error",r);break;case"img":case"image":case"link":Ue("error",r),Ue("load",r);break;case"details":Ue("toggle",r);break;case"input":Ue("invalid",r),Fm(r,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ue("invalid",r);break;case"textarea":Ue("invalid",r),Vm(r,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||r.textContent===""+a||l.suppressHydrationWarning===!0||Ky(r.textContent,a)?(l.popover!=null&&(Ue("beforetoggle",r),Ue("toggle",r)),l.onScroll!=null&&Ue("scroll",r),l.onScrollEnd!=null&&Ue("scrollend",r),l.onClick!=null&&(r.onclick=mr),r=!0):r=!1,r||Kr(e,!0)}function M0(e){for(Ut=e.return;Ut;)switch(Ut.tag){case 5:case 31:case 13:Ln=!1;return;case 27:case 3:Ln=!0;return;default:Ut=Ut.return}}function bi(e){if(e!==Ut)return!1;if(!Fe)return M0(e),Fe=!0,!1;var r=e.tag,a;if((a=r!==3&&r!==27)&&((a=r===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Ch(e.type,e.memoizedProps)),a=!a),a&&ct&&Kr(e),M0(e),r===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));ct=rg(e)}else if(r===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));ct=rg(e)}else r===27?(r=ct,ls(e.type)?(e=qh,qh=null,ct=e):ct=r):ct=Ut?Bn(e.stateNode.nextSibling):null;return!0}function Ps(){ct=Ut=null,Fe=!1}function mf(){var e=Yr;return e!==null&&(sn===null?sn=e:sn.push.apply(sn,e),Yr=null),e}function Ea(e){Yr===null?Yr=[e]:Yr.push(e)}var pf=Ce(null),Us=null,br=null;function Jr(e,r,a){Me(pf,r._currentValue),r._currentValue=a}function xr(e){e._currentValue=pf.current,Te(pf)}function yf(e,r,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&r)!==r?(e.childLanes|=r,l!==null&&(l.childLanes|=r)):l!==null&&(l.childLanes&r)!==r&&(l.childLanes|=r),e===a)break;e=e.return}}function gf(e,r,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var p=f.dependencies;if(p!==null){var _=f.child;p=p.firstContext;e:for(;p!==null;){var O=p;p=f;for(var M=0;M<r.length;M++)if(O.context===r[M]){p.lanes|=a,O=p.alternate,O!==null&&(O.lanes|=a),yf(p.return,a,e),l||(_=null);break e}p=O.next}}else if(f.tag===18){if(_=f.return,_===null)throw Error(i(341));_.lanes|=a,p=_.alternate,p!==null&&(p.lanes|=a),yf(_,a,e),_=null}else _=f.child;if(_!==null)_.return=f;else for(_=f;_!==null;){if(_===e){_=null;break}if(f=_.sibling,f!==null){f.return=_.return,_=f;break}_=_.return}f=_}}function xi(e,r,a,l){e=null;for(var f=r,p=!1;f!==null;){if(!p){if((f.flags&524288)!==0)p=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var _=f.alternate;if(_===null)throw Error(i(387));if(_=_.memoizedProps,_!==null){var O=f.type;fn(f.pendingProps.value,_.value)||(e!==null?e.push(O):e=[O])}}else if(f===we.current){if(_=f.alternate,_===null)throw Error(i(387));_.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Qa):e=[Qa])}f=f.return}e!==null&&gf(r,e,a,l),r.flags|=262144}function al(e){for(e=e.firstContext;e!==null;){if(!fn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function zs(e){Us=e,br=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function zt(e){return R0(Us,e)}function ol(e,r){return Us===null&&zs(e),R0(e,r)}function R0(e,r){var a=r._currentValue;if(r={context:r,memoizedValue:a,next:null},br===null){if(e===null)throw Error(i(308));br=r,e.dependencies={lanes:0,firstContext:r},e.flags|=524288}else br=br.next=r;return a}var P_=typeof AbortController<"u"?AbortController:function(){var e=[],r=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){r.aborted=!0,e.forEach(function(a){return a()})}},U_=n.unstable_scheduleCallback,z_=n.unstable_NormalPriority,At={$$typeof:se,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bf(){return{controller:new P_,data:new Map,refCount:0}}function Oa(e){e.refCount--,e.refCount===0&&U_(z_,function(){e.controller.abort()})}var Aa=null,xf=0,vi=0,_i=null;function I_(e,r){if(Aa===null){var a=Aa=[];xf=0,vi=wh(),_i={status:"pending",value:void 0,then:function(l){a.push(l)}}}return xf++,r.then(D0,D0),r}function D0(){if(--xf===0&&Aa!==null){_i!==null&&(_i.status="fulfilled");var e=Aa;Aa=null,vi=0,_i=null;for(var r=0;r<e.length;r++)(0,e[r])()}}function $_(e,r){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return e.then(function(){l.status="fulfilled",l.value=r;for(var f=0;f<a.length;f++)(0,a[f])(r)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var L0=F.S;F.S=function(e,r){by=ht(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&I_(e,r),L0!==null&&L0(e,r)};var Is=Ce(null);function vf(){var e=Is.current;return e!==null?e:ot.pooledCache}function ll(e,r){r===null?Me(Is,Is.current):Me(Is,r.pool)}function q0(){var e=vf();return e===null?null:{parent:At._currentValue,pool:e}}var wi=Error(i(460)),_f=Error(i(474)),cl=Error(i(542)),ul={then:function(){}};function B0(e){return e=e.status,e==="fulfilled"||e==="rejected"}function P0(e,r,a){switch(a=e[a],a===void 0?e.push(r):a!==r&&(r.then(mr,mr),r=a),r.status){case"fulfilled":return r.value;case"rejected":throw e=r.reason,z0(e),e;default:if(typeof r.status=="string")r.then(mr,mr);else{if(e=ot,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=r,e.status="pending",e.then(function(l){if(r.status==="pending"){var f=r;f.status="fulfilled",f.value=l}},function(l){if(r.status==="pending"){var f=r;f.status="rejected",f.reason=l}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw e=r.reason,z0(e),e}throw Hs=r,wi}}function $s(e){try{var r=e._init;return r(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Hs=a,wi):a}}var Hs=null;function U0(){if(Hs===null)throw Error(i(459));var e=Hs;return Hs=null,e}function z0(e){if(e===wi||e===cl)throw Error(i(483))}var Si=null,ja=0;function fl(e){var r=ja;return ja+=1,Si===null&&(Si=[]),P0(Si,e,r)}function ka(e,r){r=r.props.ref,e.ref=r!==void 0?r:null}function hl(e,r){throw r.$$typeof===x?Error(i(525)):(e=Object.prototype.toString.call(r),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":e)))}function I0(e){function r(U,P){if(e){var G=U.deletions;G===null?(U.deletions=[P],U.flags|=16):G.push(P)}}function a(U,P){if(!e)return null;for(;P!==null;)r(U,P),P=P.sibling;return null}function l(U){for(var P=new Map;U!==null;)U.key!==null?P.set(U.key,U):P.set(U.index,U),U=U.sibling;return P}function f(U,P){return U=yr(U,P),U.index=0,U.sibling=null,U}function p(U,P,G){return U.index=G,e?(G=U.alternate,G!==null?(G=G.index,G<P?(U.flags|=67108866,P):G):(U.flags|=67108866,P)):(U.flags|=1048576,P)}function _(U){return e&&U.alternate===null&&(U.flags|=67108866),U}function O(U,P,G,ee){return P===null||P.tag!==6?(P=cf(G,U.mode,ee),P.return=U,P):(P=f(P,G),P.return=U,P)}function M(U,P,G,ee){var Oe=G.type;return Oe===S?Z(U,P,G.props.children,ee,G.key):P!==null&&(P.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===$&&$s(Oe)===P.type)?(P=f(P,G.props),ka(P,G),P.return=U,P):(P=sl(G.type,G.key,G.props,null,U.mode,ee),ka(P,G),P.return=U,P)}function V(U,P,G,ee){return P===null||P.tag!==4||P.stateNode.containerInfo!==G.containerInfo||P.stateNode.implementation!==G.implementation?(P=uf(G,U.mode,ee),P.return=U,P):(P=f(P,G.children||[]),P.return=U,P)}function Z(U,P,G,ee,Oe){return P===null||P.tag!==7?(P=Bs(G,U.mode,ee,Oe),P.return=U,P):(P=f(P,G),P.return=U,P)}function re(U,P,G){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return P=cf(""+P,U.mode,G),P.return=U,P;if(typeof P=="object"&&P!==null){switch(P.$$typeof){case v:return G=sl(P.type,P.key,P.props,null,U.mode,G),ka(G,P),G.return=U,G;case w:return P=uf(P,U.mode,G),P.return=U,P;case $:return P=$s(P),re(U,P,G)}if(ke(P)||X(P))return P=Bs(P,U.mode,G,null),P.return=U,P;if(typeof P.then=="function")return re(U,fl(P),G);if(P.$$typeof===se)return re(U,ol(U,P),G);hl(U,P)}return null}function Y(U,P,G,ee){var Oe=P!==null?P.key:null;if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return Oe!==null?null:O(U,P,""+G,ee);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case v:return G.key===Oe?M(U,P,G,ee):null;case w:return G.key===Oe?V(U,P,G,ee):null;case $:return G=$s(G),Y(U,P,G,ee)}if(ke(G)||X(G))return Oe!==null?null:Z(U,P,G,ee,null);if(typeof G.then=="function")return Y(U,P,fl(G),ee);if(G.$$typeof===se)return Y(U,P,ol(U,G),ee);hl(U,G)}return null}function J(U,P,G,ee,Oe){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return U=U.get(G)||null,O(P,U,""+ee,Oe);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case v:return U=U.get(ee.key===null?G:ee.key)||null,M(P,U,ee,Oe);case w:return U=U.get(ee.key===null?G:ee.key)||null,V(P,U,ee,Oe);case $:return ee=$s(ee),J(U,P,G,ee,Oe)}if(ke(ee)||X(ee))return U=U.get(G)||null,Z(P,U,ee,Oe,null);if(typeof ee.then=="function")return J(U,P,G,fl(ee),Oe);if(ee.$$typeof===se)return J(U,P,G,ol(P,ee),Oe);hl(P,ee)}return null}function be(U,P,G,ee){for(var Oe=null,Je=null,_e=P,Le=P=0,Ie=null;_e!==null&&Le<G.length;Le++){_e.index>Le?(Ie=_e,_e=null):Ie=_e.sibling;var Xe=Y(U,_e,G[Le],ee);if(Xe===null){_e===null&&(_e=Ie);break}e&&_e&&Xe.alternate===null&&r(U,_e),P=p(Xe,P,Le),Je===null?Oe=Xe:Je.sibling=Xe,Je=Xe,_e=Ie}if(Le===G.length)return a(U,_e),Fe&&gr(U,Le),Oe;if(_e===null){for(;Le<G.length;Le++)_e=re(U,G[Le],ee),_e!==null&&(P=p(_e,P,Le),Je===null?Oe=_e:Je.sibling=_e,Je=_e);return Fe&&gr(U,Le),Oe}for(_e=l(_e);Le<G.length;Le++)Ie=J(_e,U,Le,G[Le],ee),Ie!==null&&(e&&Ie.alternate!==null&&_e.delete(Ie.key===null?Le:Ie.key),P=p(Ie,P,Le),Je===null?Oe=Ie:Je.sibling=Ie,Je=Ie);return e&&_e.forEach(function(ds){return r(U,ds)}),Fe&&gr(U,Le),Oe}function Ne(U,P,G,ee){if(G==null)throw Error(i(151));for(var Oe=null,Je=null,_e=P,Le=P=0,Ie=null,Xe=G.next();_e!==null&&!Xe.done;Le++,Xe=G.next()){_e.index>Le?(Ie=_e,_e=null):Ie=_e.sibling;var ds=Y(U,_e,Xe.value,ee);if(ds===null){_e===null&&(_e=Ie);break}e&&_e&&ds.alternate===null&&r(U,_e),P=p(ds,P,Le),Je===null?Oe=ds:Je.sibling=ds,Je=ds,_e=Ie}if(Xe.done)return a(U,_e),Fe&&gr(U,Le),Oe;if(_e===null){for(;!Xe.done;Le++,Xe=G.next())Xe=re(U,Xe.value,ee),Xe!==null&&(P=p(Xe,P,Le),Je===null?Oe=Xe:Je.sibling=Xe,Je=Xe);return Fe&&gr(U,Le),Oe}for(_e=l(_e);!Xe.done;Le++,Xe=G.next())Xe=J(_e,U,Le,Xe.value,ee),Xe!==null&&(e&&Xe.alternate!==null&&_e.delete(Xe.key===null?Le:Xe.key),P=p(Xe,P,Le),Je===null?Oe=Xe:Je.sibling=Xe,Je=Xe);return e&&_e.forEach(function(Zw){return r(U,Zw)}),Fe&&gr(U,Le),Oe}function it(U,P,G,ee){if(typeof G=="object"&&G!==null&&G.type===S&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case v:e:{for(var Oe=G.key;P!==null;){if(P.key===Oe){if(Oe=G.type,Oe===S){if(P.tag===7){a(U,P.sibling),ee=f(P,G.props.children),ee.return=U,U=ee;break e}}else if(P.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===$&&$s(Oe)===P.type){a(U,P.sibling),ee=f(P,G.props),ka(ee,G),ee.return=U,U=ee;break e}a(U,P);break}else r(U,P);P=P.sibling}G.type===S?(ee=Bs(G.props.children,U.mode,ee,G.key),ee.return=U,U=ee):(ee=sl(G.type,G.key,G.props,null,U.mode,ee),ka(ee,G),ee.return=U,U=ee)}return _(U);case w:e:{for(Oe=G.key;P!==null;){if(P.key===Oe)if(P.tag===4&&P.stateNode.containerInfo===G.containerInfo&&P.stateNode.implementation===G.implementation){a(U,P.sibling),ee=f(P,G.children||[]),ee.return=U,U=ee;break e}else{a(U,P);break}else r(U,P);P=P.sibling}ee=uf(G,U.mode,ee),ee.return=U,U=ee}return _(U);case $:return G=$s(G),it(U,P,G,ee)}if(ke(G))return be(U,P,G,ee);if(X(G)){if(Oe=X(G),typeof Oe!="function")throw Error(i(150));return G=Oe.call(G),Ne(U,P,G,ee)}if(typeof G.then=="function")return it(U,P,fl(G),ee);if(G.$$typeof===se)return it(U,P,ol(U,G),ee);hl(U,G)}return typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint"?(G=""+G,P!==null&&P.tag===6?(a(U,P.sibling),ee=f(P,G),ee.return=U,U=ee):(a(U,P),ee=cf(G,U.mode,ee),ee.return=U,U=ee),_(U)):a(U,P)}return function(U,P,G,ee){try{ja=0;var Oe=it(U,P,G,ee);return Si=null,Oe}catch(_e){if(_e===wi||_e===cl)throw _e;var Je=hn(29,_e,null,U.mode);return Je.lanes=ee,Je.return=U,Je}finally{}}}var Fs=I0(!0),$0=I0(!1),Xr=!1;function wf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sf(e,r){e=e.updateQueue,r.updateQueue===e&&(r.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Qr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Wr(e,r,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Qe&2)!==0){var f=l.pending;return f===null?r.next=r:(r.next=f.next,f.next=r),l.pending=r,r=rl(e),O0(e,null,a),r}return nl(e,l,r,a),rl(e)}function Ta(e,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194048)!==0)){var l=r.lanes;l&=e.pendingLanes,a|=l,r.lanes=a,Ns(e,a)}}function Ef(e,r){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var _={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?f=p=_:p=p.next=_,a=a.next}while(a!==null);p===null?f=p=r:p=p.next=r}else f=p=r;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=r:e.next=r,a.lastBaseUpdate=r}var Of=!1;function Na(){if(Of){var e=_i;if(e!==null)throw e}}function Ca(e,r,a,l){Of=!1;var f=e.updateQueue;Xr=!1;var p=f.firstBaseUpdate,_=f.lastBaseUpdate,O=f.shared.pending;if(O!==null){f.shared.pending=null;var M=O,V=M.next;M.next=null,_===null?p=V:_.next=V,_=M;var Z=e.alternate;Z!==null&&(Z=Z.updateQueue,O=Z.lastBaseUpdate,O!==_&&(O===null?Z.firstBaseUpdate=V:O.next=V,Z.lastBaseUpdate=M))}if(p!==null){var re=f.baseState;_=0,Z=V=M=null,O=p;do{var Y=O.lane&-536870913,J=Y!==O.lane;if(J?(ze&Y)===Y:(l&Y)===Y){Y!==0&&Y===vi&&(Of=!0),Z!==null&&(Z=Z.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var be=e,Ne=O;Y=r;var it=a;switch(Ne.tag){case 1:if(be=Ne.payload,typeof be=="function"){re=be.call(it,re,Y);break e}re=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ne.payload,Y=typeof be=="function"?be.call(it,re,Y):be,Y==null)break e;re=b({},re,Y);break e;case 2:Xr=!0}}Y=O.callback,Y!==null&&(e.flags|=64,J&&(e.flags|=8192),J=f.callbacks,J===null?f.callbacks=[Y]:J.push(Y))}else J={lane:Y,tag:O.tag,payload:O.payload,callback:O.callback,next:null},Z===null?(V=Z=J,M=re):Z=Z.next=J,_|=Y;if(O=O.next,O===null){if(O=f.shared.pending,O===null)break;J=O,O=J.next,J.next=null,f.lastBaseUpdate=J,f.shared.pending=null}}while(!0);Z===null&&(M=re),f.baseState=M,f.firstBaseUpdate=V,f.lastBaseUpdate=Z,p===null&&(f.shared.lanes=0),rs|=_,e.lanes=_,e.memoizedState=re}}function H0(e,r){if(typeof e!="function")throw Error(i(191,e));e.call(r)}function F0(e,r){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)H0(a[e],r)}var Ei=Ce(null),dl=Ce(0);function G0(e,r){e=kr,Me(dl,e),Me(Ei,r),kr=e|r.baseLanes}function Af(){Me(dl,kr),Me(Ei,Ei.current)}function jf(){kr=dl.current,Te(Ei),Te(dl)}var dn=Ce(null),qn=null;function Zr(e){var r=e.alternate;Me(wt,wt.current&1),Me(dn,e),qn===null&&(r===null||Ei.current!==null||r.memoizedState!==null)&&(qn=e)}function kf(e){Me(wt,wt.current),Me(dn,e),qn===null&&(qn=e)}function V0(e){e.tag===22?(Me(wt,wt.current),Me(dn,e),qn===null&&(qn=e)):es()}function es(){Me(wt,wt.current),Me(dn,dn.current)}function mn(e){Te(dn),qn===e&&(qn=null),Te(wt)}var wt=Ce(0);function ml(e){for(var r=e;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Dh(a)||Lh(a)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var vr=0,De=null,rt=null,jt=null,pl=!1,Oi=!1,Gs=!1,yl=0,Ma=0,Ai=null,H_=0;function bt(){throw Error(i(321))}function Tf(e,r){if(r===null)return!1;for(var a=0;a<r.length&&a<e.length;a++)if(!fn(e[a],r[a]))return!1;return!0}function Nf(e,r,a,l,f,p){return vr=p,De=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,F.H=e===null||e.memoizedState===null?Tp:Gf,Gs=!1,p=a(l,f),Gs=!1,Oi&&(p=K0(r,a,l,f)),Y0(e),p}function Y0(e){F.H=La;var r=rt!==null&&rt.next!==null;if(vr=0,jt=rt=De=null,pl=!1,Ma=0,Ai=null,r)throw Error(i(300));e===null||kt||(e=e.dependencies,e!==null&&al(e)&&(kt=!0))}function K0(e,r,a,l){De=e;var f=0;do{if(Oi&&(Ai=null),Ma=0,Oi=!1,25<=f)throw Error(i(301));if(f+=1,jt=rt=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}F.H=Np,p=r(a,l)}while(Oi);return p}function F_(){var e=F.H,r=e.useState()[0];return r=typeof r.then=="function"?Ra(r):r,e=e.useState()[0],(rt!==null?rt.memoizedState:null)!==e&&(De.flags|=1024),r}function Cf(){var e=yl!==0;return yl=0,e}function Mf(e,r,a){r.updateQueue=e.updateQueue,r.flags&=-2053,e.lanes&=~a}function Rf(e){if(pl){for(e=e.memoizedState;e!==null;){var r=e.queue;r!==null&&(r.pending=null),e=e.next}pl=!1}vr=0,jt=rt=De=null,Oi=!1,Ma=yl=0,Ai=null}function Vt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jt===null?De.memoizedState=jt=e:jt=jt.next=e,jt}function St(){if(rt===null){var e=De.alternate;e=e!==null?e.memoizedState:null}else e=rt.next;var r=jt===null?De.memoizedState:jt.next;if(r!==null)jt=r,rt=e;else{if(e===null)throw De.alternate===null?Error(i(467)):Error(i(310));rt=e,e={memoizedState:rt.memoizedState,baseState:rt.baseState,baseQueue:rt.baseQueue,queue:rt.queue,next:null},jt===null?De.memoizedState=jt=e:jt=jt.next=e}return jt}function gl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ra(e){var r=Ma;return Ma+=1,Ai===null&&(Ai=[]),e=P0(Ai,e,r),r=De,(jt===null?r.memoizedState:jt.next)===null&&(r=r.alternate,F.H=r===null||r.memoizedState===null?Tp:Gf),e}function bl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ra(e);if(e.$$typeof===se)return zt(e)}throw Error(i(438,String(e)))}function Df(e){var r=null,a=De.updateQueue;if(a!==null&&(r=a.memoCache),r==null){var l=De.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(r={data:l.data.map(function(f){return f.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),a===null&&(a=gl(),De.updateQueue=a),a.memoCache=r,a=r.data[r.index],a===void 0)for(a=r.data[r.index]=Array(e),l=0;l<e;l++)a[l]=D;return r.index++,a}function _r(e,r){return typeof r=="function"?r(e):r}function xl(e){var r=St();return Lf(r,rt,e)}function Lf(e,r,a){var l=e.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=a;var f=e.baseQueue,p=l.pending;if(p!==null){if(f!==null){var _=f.next;f.next=p.next,p.next=_}r.baseQueue=f=p,l.pending=null}if(p=e.baseState,f===null)e.memoizedState=p;else{r=f.next;var O=_=null,M=null,V=r,Z=!1;do{var re=V.lane&-536870913;if(re!==V.lane?(ze&re)===re:(vr&re)===re){var Y=V.revertLane;if(Y===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),re===vi&&(Z=!0);else if((vr&Y)===Y){V=V.next,Y===vi&&(Z=!0);continue}else re={lane:0,revertLane:V.revertLane,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},M===null?(O=M=re,_=p):M=M.next=re,De.lanes|=Y,rs|=Y;re=V.action,Gs&&a(p,re),p=V.hasEagerState?V.eagerState:a(p,re)}else Y={lane:re,revertLane:V.revertLane,gesture:V.gesture,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},M===null?(O=M=Y,_=p):M=M.next=Y,De.lanes|=re,rs|=re;V=V.next}while(V!==null&&V!==r);if(M===null?_=p:M.next=O,!fn(p,e.memoizedState)&&(kt=!0,Z&&(a=_i,a!==null)))throw a;e.memoizedState=p,e.baseState=_,e.baseQueue=M,l.lastRenderedState=p}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function qf(e){var r=St(),a=r.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var l=a.dispatch,f=a.pending,p=r.memoizedState;if(f!==null){a.pending=null;var _=f=f.next;do p=e(p,_.action),_=_.next;while(_!==f);fn(p,r.memoizedState)||(kt=!0),r.memoizedState=p,r.baseQueue===null&&(r.baseState=p),a.lastRenderedState=p}return[p,l]}function J0(e,r,a){var l=De,f=St(),p=Fe;if(p){if(a===void 0)throw Error(i(407));a=a()}else a=r();var _=!fn((rt||f).memoizedState,a);if(_&&(f.memoizedState=a,kt=!0),f=f.queue,Uf(W0.bind(null,l,f,e),[e]),f.getSnapshot!==r||_||jt!==null&&jt.memoizedState.tag&1){if(l.flags|=2048,ji(9,{destroy:void 0},Q0.bind(null,l,f,a,r),null),ot===null)throw Error(i(349));p||(vr&127)!==0||X0(l,r,a)}return a}function X0(e,r,a){e.flags|=16384,e={getSnapshot:r,value:a},r=De.updateQueue,r===null?(r=gl(),De.updateQueue=r,r.stores=[e]):(a=r.stores,a===null?r.stores=[e]:a.push(e))}function Q0(e,r,a,l){r.value=a,r.getSnapshot=l,Z0(r)&&ep(e)}function W0(e,r,a){return a(function(){Z0(r)&&ep(e)})}function Z0(e){var r=e.getSnapshot;e=e.value;try{var a=r();return!fn(e,a)}catch{return!0}}function ep(e){var r=qs(e,2);r!==null&&an(r,e,2)}function Bf(e){var r=Vt();if(typeof e=="function"){var a=e;if(e=a(),Gs){cn(!0);try{a()}finally{cn(!1)}}}return r.memoizedState=r.baseState=e,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_r,lastRenderedState:e},r}function tp(e,r,a,l){return e.baseState=a,Lf(e,rt,typeof l=="function"?l:_r)}function G_(e,r,a,l,f){if(wl(e))throw Error(i(485));if(e=r.action,e!==null){var p={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){p.listeners.push(_)}};F.T!==null?a(!0):p.isTransition=!1,l(p),a=r.pending,a===null?(p.next=r.pending=p,np(r,p)):(p.next=a.next,r.pending=a.next=p)}}function np(e,r){var a=r.action,l=r.payload,f=e.state;if(r.isTransition){var p=F.T,_={};F.T=_;try{var O=a(f,l),M=F.S;M!==null&&M(_,O),rp(e,r,O)}catch(V){Pf(e,r,V)}finally{p!==null&&_.types!==null&&(p.types=_.types),F.T=p}}else try{p=a(f,l),rp(e,r,p)}catch(V){Pf(e,r,V)}}function rp(e,r,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){sp(e,r,l)},function(l){return Pf(e,r,l)}):sp(e,r,a)}function sp(e,r,a){r.status="fulfilled",r.value=a,ip(r),e.state=a,r=e.pending,r!==null&&(a=r.next,a===r?e.pending=null:(a=a.next,r.next=a,np(e,a)))}function Pf(e,r,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do r.status="rejected",r.reason=a,ip(r),r=r.next;while(r!==l)}e.action=null}function ip(e){e=e.listeners;for(var r=0;r<e.length;r++)(0,e[r])()}function ap(e,r){return r}function op(e,r){if(Fe){var a=ot.formState;if(a!==null){e:{var l=De;if(Fe){if(ct){t:{for(var f=ct,p=Ln;f.nodeType!==8;){if(!p){f=null;break t}if(f=Bn(f.nextSibling),f===null){f=null;break t}}p=f.data,f=p==="F!"||p==="F"?f:null}if(f){ct=Bn(f.nextSibling),l=f.data==="F!";break e}}Kr(l)}l=!1}l&&(r=a[0])}}return a=Vt(),a.memoizedState=a.baseState=r,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ap,lastRenderedState:r},a.queue=l,a=Ap.bind(null,De,l),l.dispatch=a,l=Bf(!1),p=Ff.bind(null,De,!1,l.queue),l=Vt(),f={state:r,dispatch:null,action:e,pending:null},l.queue=f,a=G_.bind(null,De,f,p,a),f.dispatch=a,l.memoizedState=e,[r,a,!1]}function lp(e){var r=St();return cp(r,rt,e)}function cp(e,r,a){if(r=Lf(e,r,ap)[0],e=xl(_r)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var l=Ra(r)}catch(_){throw _===wi?cl:_}else l=r;r=St();var f=r.queue,p=f.dispatch;return a!==r.memoizedState&&(De.flags|=2048,ji(9,{destroy:void 0},V_.bind(null,f,a),null)),[l,p,e]}function V_(e,r){e.action=r}function up(e){var r=St(),a=rt;if(a!==null)return cp(r,a,e);St(),r=r.memoizedState,a=St();var l=a.queue.dispatch;return a.memoizedState=e,[r,l,!1]}function ji(e,r,a,l){return e={tag:e,create:a,deps:l,inst:r,next:null},r=De.updateQueue,r===null&&(r=gl(),De.updateQueue=r),a=r.lastEffect,a===null?r.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,r.lastEffect=e),e}function fp(){return St().memoizedState}function vl(e,r,a,l){var f=Vt();De.flags|=e,f.memoizedState=ji(1|r,{destroy:void 0},a,l===void 0?null:l)}function _l(e,r,a,l){var f=St();l=l===void 0?null:l;var p=f.memoizedState.inst;rt!==null&&l!==null&&Tf(l,rt.memoizedState.deps)?f.memoizedState=ji(r,p,a,l):(De.flags|=e,f.memoizedState=ji(1|r,p,a,l))}function hp(e,r){vl(8390656,8,e,r)}function Uf(e,r){_l(2048,8,e,r)}function Y_(e){De.flags|=4;var r=De.updateQueue;if(r===null)r=gl(),De.updateQueue=r,r.events=[e];else{var a=r.events;a===null?r.events=[e]:a.push(e)}}function dp(e){var r=St().memoizedState;return Y_({ref:r,nextImpl:e}),function(){if((Qe&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function mp(e,r){return _l(4,2,e,r)}function pp(e,r){return _l(4,4,e,r)}function yp(e,r){if(typeof r=="function"){e=e();var a=r(e);return function(){typeof a=="function"?a():r(null)}}if(r!=null)return e=e(),r.current=e,function(){r.current=null}}function gp(e,r,a){a=a!=null?a.concat([e]):null,_l(4,4,yp.bind(null,r,e),a)}function zf(){}function bp(e,r){var a=St();r=r===void 0?null:r;var l=a.memoizedState;return r!==null&&Tf(r,l[1])?l[0]:(a.memoizedState=[e,r],e)}function xp(e,r){var a=St();r=r===void 0?null:r;var l=a.memoizedState;if(r!==null&&Tf(r,l[1]))return l[0];if(l=e(),Gs){cn(!0);try{e()}finally{cn(!1)}}return a.memoizedState=[l,r],l}function If(e,r,a){return a===void 0||(vr&1073741824)!==0&&(ze&261930)===0?e.memoizedState=r:(e.memoizedState=a,e=vy(),De.lanes|=e,rs|=e,a)}function vp(e,r,a,l){return fn(a,r)?a:Ei.current!==null?(e=If(e,a,l),fn(e,r)||(kt=!0),e):(vr&42)===0||(vr&1073741824)!==0&&(ze&261930)===0?(kt=!0,e.memoizedState=a):(e=vy(),De.lanes|=e,rs|=e,r)}function _p(e,r,a,l,f){var p=W.p;W.p=p!==0&&8>p?p:8;var _=F.T,O={};F.T=O,Ff(e,!1,r,a);try{var M=f(),V=F.S;if(V!==null&&V(O,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var Z=$_(M,l);Da(e,r,Z,gn(e))}else Da(e,r,l,gn(e))}catch(re){Da(e,r,{then:function(){},status:"rejected",reason:re},gn())}finally{W.p=p,_!==null&&O.types!==null&&(_.types=O.types),F.T=_}}function K_(){}function $f(e,r,a,l){if(e.tag!==5)throw Error(i(476));var f=wp(e).queue;_p(e,f,r,ce,a===null?K_:function(){return Sp(e),a(l)})}function wp(e){var r=e.memoizedState;if(r!==null)return r;r={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_r,lastRenderedState:ce},next:null};var a={};return r.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_r,lastRenderedState:a},next:null},e.memoizedState=r,e=e.alternate,e!==null&&(e.memoizedState=r),r}function Sp(e){var r=wp(e);r.next===null&&(r=e.alternate.memoizedState),Da(e,r.next.queue,{},gn())}function Hf(){return zt(Qa)}function Ep(){return St().memoizedState}function Op(){return St().memoizedState}function J_(e){for(var r=e.return;r!==null;){switch(r.tag){case 24:case 3:var a=gn();e=Qr(a);var l=Wr(r,e,a);l!==null&&(an(l,r,a),Ta(l,r,a)),r={cache:bf()},e.payload=r;return}r=r.return}}function X_(e,r,a){var l=gn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},wl(e)?jp(r,a):(a=of(e,r,a,l),a!==null&&(an(a,e,l),kp(a,r,l)))}function Ap(e,r,a){var l=gn();Da(e,r,a,l)}function Da(e,r,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(wl(e))jp(r,f);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=r.lastRenderedReducer,p!==null))try{var _=r.lastRenderedState,O=p(_,a);if(f.hasEagerState=!0,f.eagerState=O,fn(O,_))return nl(e,r,f,0),ot===null&&tl(),!1}catch{}finally{}if(a=of(e,r,f,l),a!==null)return an(a,e,l),kp(a,r,l),!0}return!1}function Ff(e,r,a,l){if(l={lane:2,revertLane:wh(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},wl(e)){if(r)throw Error(i(479))}else r=of(e,a,l,2),r!==null&&an(r,e,2)}function wl(e){var r=e.alternate;return e===De||r!==null&&r===De}function jp(e,r){Oi=pl=!0;var a=e.pending;a===null?r.next=r:(r.next=a.next,a.next=r),e.pending=r}function kp(e,r,a){if((a&4194048)!==0){var l=r.lanes;l&=e.pendingLanes,a|=l,r.lanes=a,Ns(e,a)}}var La={readContext:zt,use:bl,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useLayoutEffect:bt,useInsertionEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useSyncExternalStore:bt,useId:bt,useHostTransitionStatus:bt,useFormState:bt,useActionState:bt,useOptimistic:bt,useMemoCache:bt,useCacheRefresh:bt};La.useEffectEvent=bt;var Tp={readContext:zt,use:bl,useCallback:function(e,r){return Vt().memoizedState=[e,r===void 0?null:r],e},useContext:zt,useEffect:hp,useImperativeHandle:function(e,r,a){a=a!=null?a.concat([e]):null,vl(4194308,4,yp.bind(null,r,e),a)},useLayoutEffect:function(e,r){return vl(4194308,4,e,r)},useInsertionEffect:function(e,r){vl(4,2,e,r)},useMemo:function(e,r){var a=Vt();r=r===void 0?null:r;var l=e();if(Gs){cn(!0);try{e()}finally{cn(!1)}}return a.memoizedState=[l,r],l},useReducer:function(e,r,a){var l=Vt();if(a!==void 0){var f=a(r);if(Gs){cn(!0);try{a(r)}finally{cn(!1)}}}else f=r;return l.memoizedState=l.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},l.queue=e,e=e.dispatch=X_.bind(null,De,e),[l.memoizedState,e]},useRef:function(e){var r=Vt();return e={current:e},r.memoizedState=e},useState:function(e){e=Bf(e);var r=e.queue,a=Ap.bind(null,De,r);return r.dispatch=a,[e.memoizedState,a]},useDebugValue:zf,useDeferredValue:function(e,r){var a=Vt();return If(a,e,r)},useTransition:function(){var e=Bf(!1);return e=_p.bind(null,De,e.queue,!0,!1),Vt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,r,a){var l=De,f=Vt();if(Fe){if(a===void 0)throw Error(i(407));a=a()}else{if(a=r(),ot===null)throw Error(i(349));(ze&127)!==0||X0(l,r,a)}f.memoizedState=a;var p={value:a,getSnapshot:r};return f.queue=p,hp(W0.bind(null,l,p,e),[e]),l.flags|=2048,ji(9,{destroy:void 0},Q0.bind(null,l,p,a,r),null),a},useId:function(){var e=Vt(),r=ot.identifierPrefix;if(Fe){var a=nr,l=tr;a=(l&~(1<<32-Ft(l)-1)).toString(32)+a,r="_"+r+"R_"+a,a=yl++,0<a&&(r+="H"+a.toString(32)),r+="_"}else a=H_++,r="_"+r+"r_"+a.toString(32)+"_";return e.memoizedState=r},useHostTransitionStatus:Hf,useFormState:op,useActionState:op,useOptimistic:function(e){var r=Vt();r.memoizedState=r.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=a,r=Ff.bind(null,De,!0,a),a.dispatch=r,[e,r]},useMemoCache:Df,useCacheRefresh:function(){return Vt().memoizedState=J_.bind(null,De)},useEffectEvent:function(e){var r=Vt(),a={impl:e};return r.memoizedState=a,function(){if((Qe&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Gf={readContext:zt,use:bl,useCallback:bp,useContext:zt,useEffect:Uf,useImperativeHandle:gp,useInsertionEffect:mp,useLayoutEffect:pp,useMemo:xp,useReducer:xl,useRef:fp,useState:function(){return xl(_r)},useDebugValue:zf,useDeferredValue:function(e,r){var a=St();return vp(a,rt.memoizedState,e,r)},useTransition:function(){var e=xl(_r)[0],r=St().memoizedState;return[typeof e=="boolean"?e:Ra(e),r]},useSyncExternalStore:J0,useId:Ep,useHostTransitionStatus:Hf,useFormState:lp,useActionState:lp,useOptimistic:function(e,r){var a=St();return tp(a,rt,e,r)},useMemoCache:Df,useCacheRefresh:Op};Gf.useEffectEvent=dp;var Np={readContext:zt,use:bl,useCallback:bp,useContext:zt,useEffect:Uf,useImperativeHandle:gp,useInsertionEffect:mp,useLayoutEffect:pp,useMemo:xp,useReducer:qf,useRef:fp,useState:function(){return qf(_r)},useDebugValue:zf,useDeferredValue:function(e,r){var a=St();return rt===null?If(a,e,r):vp(a,rt.memoizedState,e,r)},useTransition:function(){var e=qf(_r)[0],r=St().memoizedState;return[typeof e=="boolean"?e:Ra(e),r]},useSyncExternalStore:J0,useId:Ep,useHostTransitionStatus:Hf,useFormState:up,useActionState:up,useOptimistic:function(e,r){var a=St();return rt!==null?tp(a,rt,e,r):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Df,useCacheRefresh:Op};Np.useEffectEvent=dp;function Vf(e,r,a,l){r=e.memoizedState,a=a(l,r),a=a==null?r:b({},r,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Yf={enqueueSetState:function(e,r,a){e=e._reactInternals;var l=gn(),f=Qr(l);f.payload=r,a!=null&&(f.callback=a),r=Wr(e,f,l),r!==null&&(an(r,e,l),Ta(r,e,l))},enqueueReplaceState:function(e,r,a){e=e._reactInternals;var l=gn(),f=Qr(l);f.tag=1,f.payload=r,a!=null&&(f.callback=a),r=Wr(e,f,l),r!==null&&(an(r,e,l),Ta(r,e,l))},enqueueForceUpdate:function(e,r){e=e._reactInternals;var a=gn(),l=Qr(a);l.tag=2,r!=null&&(l.callback=r),r=Wr(e,l,a),r!==null&&(an(r,e,a),Ta(r,e,a))}};function Cp(e,r,a,l,f,p,_){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,p,_):r.prototype&&r.prototype.isPureReactComponent?!_a(a,l)||!_a(f,p):!0}function Mp(e,r,a,l){e=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(a,l),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(a,l),r.state!==e&&Yf.enqueueReplaceState(r,r.state,null)}function Vs(e,r){var a=r;if("ref"in r){a={};for(var l in r)l!=="ref"&&(a[l]=r[l])}if(e=e.defaultProps){a===r&&(a=b({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function Rp(e){el(e)}function Dp(e){console.error(e)}function Lp(e){el(e)}function Sl(e,r){try{var a=e.onUncaughtError;a(r.value,{componentStack:r.stack})}catch(l){setTimeout(function(){throw l})}}function qp(e,r,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Kf(e,r,a){return a=Qr(a),a.tag=3,a.payload={element:null},a.callback=function(){Sl(e,r)},a}function Bp(e){return e=Qr(e),e.tag=3,e}function Pp(e,r,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var p=l.value;e.payload=function(){return f(p)},e.callback=function(){qp(r,a,l)}}var _=a.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(e.callback=function(){qp(r,a,l),typeof f!="function"&&(ss===null?ss=new Set([this]):ss.add(this));var O=l.stack;this.componentDidCatch(l.value,{componentStack:O!==null?O:""})})}function Q_(e,r,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(r=a.alternate,r!==null&&xi(r,a,f,!0),a=dn.current,a!==null){switch(a.tag){case 31:case 13:return qn===null?Ll():a.alternate===null&&xt===0&&(xt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===ul?a.flags|=16384:(r=a.updateQueue,r===null?a.updateQueue=new Set([l]):r.add(l),xh(e,l,f)),!1;case 22:return a.flags|=65536,l===ul?a.flags|=16384:(r=a.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=r):(a=r.retryQueue,a===null?r.retryQueue=new Set([l]):a.add(l)),xh(e,l,f)),!1}throw Error(i(435,a.tag))}return xh(e,l,f),Ll(),!1}if(Fe)return r=dn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=f,l!==df&&(e=Error(i(422),{cause:l}),Ea(Mn(e,a)))):(l!==df&&(r=Error(i(423),{cause:l}),Ea(Mn(r,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=Mn(l,a),f=Kf(e.stateNode,l,f),Ef(e,f),xt!==4&&(xt=2)),!1;var p=Error(i(520),{cause:l});if(p=Mn(p,a),Ha===null?Ha=[p]:Ha.push(p),xt!==4&&(xt=2),r===null)return!0;l=Mn(l,a),a=r;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=Kf(a.stateNode,l,e),Ef(a,e),!1;case 1:if(r=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(ss===null||!ss.has(p))))return a.flags|=65536,f&=-f,a.lanes|=f,f=Bp(f),Pp(f,e,a,l),Ef(a,f),!1}a=a.return}while(a!==null);return!1}var Jf=Error(i(461)),kt=!1;function It(e,r,a,l){r.child=e===null?$0(r,null,a,l):Fs(r,e.child,a,l)}function Up(e,r,a,l,f){a=a.render;var p=r.ref;if("ref"in l){var _={};for(var O in l)O!=="ref"&&(_[O]=l[O])}else _=l;return zs(r),l=Nf(e,r,a,_,p,f),O=Cf(),e!==null&&!kt?(Mf(e,r,f),wr(e,r,f)):(Fe&&O&&ff(r),r.flags|=1,It(e,r,l,f),r.child)}function zp(e,r,a,l,f){if(e===null){var p=a.type;return typeof p=="function"&&!lf(p)&&p.defaultProps===void 0&&a.compare===null?(r.tag=15,r.type=p,Ip(e,r,p,l,f)):(e=sl(a.type,null,l,r,r.mode,f),e.ref=r.ref,e.return=r,r.child=e)}if(p=e.child,!rh(e,f)){var _=p.memoizedProps;if(a=a.compare,a=a!==null?a:_a,a(_,l)&&e.ref===r.ref)return wr(e,r,f)}return r.flags|=1,e=yr(p,l),e.ref=r.ref,e.return=r,r.child=e}function Ip(e,r,a,l,f){if(e!==null){var p=e.memoizedProps;if(_a(p,l)&&e.ref===r.ref)if(kt=!1,r.pendingProps=l=p,rh(e,f))(e.flags&131072)!==0&&(kt=!0);else return r.lanes=e.lanes,wr(e,r,f)}return Xf(e,r,a,l,f)}function $p(e,r,a,l){var f=l.children,p=e!==null?e.memoizedState:null;if(e===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((r.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,e!==null){for(l=r.child=e.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~p}else l=0,r.child=null;return Hp(e,r,p,a,l)}if((a&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},e!==null&&ll(r,p!==null?p.cachePool:null),p!==null?G0(r,p):Af(),V0(r);else return l=r.lanes=536870912,Hp(e,r,p!==null?p.baseLanes|a:a,a,l)}else p!==null?(ll(r,p.cachePool),G0(r,p),es(),r.memoizedState=null):(e!==null&&ll(r,null),Af(),es());return It(e,r,f,a),r.child}function qa(e,r){return e!==null&&e.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Hp(e,r,a,l,f){var p=vf();return p=p===null?null:{parent:At._currentValue,pool:p},r.memoizedState={baseLanes:a,cachePool:p},e!==null&&ll(r,null),Af(),V0(r),e!==null&&xi(e,r,l,!0),r.childLanes=f,null}function El(e,r){return r=Al({mode:r.mode,children:r.children},e.mode),r.ref=e.ref,e.child=r,r.return=e,r}function Fp(e,r,a){return Fs(r,e.child,null,a),e=El(r,r.pendingProps),e.flags|=2,mn(r),r.memoizedState=null,e}function W_(e,r,a){var l=r.pendingProps,f=(r.flags&128)!==0;if(r.flags&=-129,e===null){if(Fe){if(l.mode==="hidden")return e=El(r,l),r.lanes=536870912,qa(null,e);if(kf(r),(e=ct)?(e=ng(e,Ln),e=e!==null&&e.data==="&"?e:null,e!==null&&(r.memoizedState={dehydrated:e,treeContext:Vr!==null?{id:tr,overflow:nr}:null,retryLane:536870912,hydrationErrors:null},a=j0(e),a.return=r,r.child=a,Ut=r,ct=null)):e=null,e===null)throw Kr(r);return r.lanes=536870912,null}return El(r,l)}var p=e.memoizedState;if(p!==null){var _=p.dehydrated;if(kf(r),f)if(r.flags&256)r.flags&=-257,r=Fp(e,r,a);else if(r.memoizedState!==null)r.child=e.child,r.flags|=128,r=null;else throw Error(i(558));else if(kt||xi(e,r,a,!1),f=(a&e.childLanes)!==0,kt||f){if(l=ot,l!==null&&(_=Fr(l,a),_!==0&&_!==p.retryLane))throw p.retryLane=_,qs(e,_),an(l,e,_),Jf;Ll(),r=Fp(e,r,a)}else e=p.treeContext,ct=Bn(_.nextSibling),Ut=r,Fe=!0,Yr=null,Ln=!1,e!==null&&N0(r,e),r=El(r,l),r.flags|=4096;return r}return e=yr(e.child,{mode:l.mode,children:l.children}),e.ref=r.ref,r.child=e,e.return=r,e}function Ol(e,r){var a=r.ref;if(a===null)e!==null&&e.ref!==null&&(r.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(r.flags|=4194816)}}function Xf(e,r,a,l,f){return zs(r),a=Nf(e,r,a,l,void 0,f),l=Cf(),e!==null&&!kt?(Mf(e,r,f),wr(e,r,f)):(Fe&&l&&ff(r),r.flags|=1,It(e,r,a,f),r.child)}function Gp(e,r,a,l,f,p){return zs(r),r.updateQueue=null,a=K0(r,l,a,f),Y0(e),l=Cf(),e!==null&&!kt?(Mf(e,r,p),wr(e,r,p)):(Fe&&l&&ff(r),r.flags|=1,It(e,r,a,p),r.child)}function Vp(e,r,a,l,f){if(zs(r),r.stateNode===null){var p=pi,_=a.contextType;typeof _=="object"&&_!==null&&(p=zt(_)),p=new a(l,p),r.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Yf,r.stateNode=p,p._reactInternals=r,p=r.stateNode,p.props=l,p.state=r.memoizedState,p.refs={},wf(r),_=a.contextType,p.context=typeof _=="object"&&_!==null?zt(_):pi,p.state=r.memoizedState,_=a.getDerivedStateFromProps,typeof _=="function"&&(Vf(r,a,_,l),p.state=r.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(_=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),_!==p.state&&Yf.enqueueReplaceState(p,p.state,null),Ca(r,l,p,f),Na(),p.state=r.memoizedState),typeof p.componentDidMount=="function"&&(r.flags|=4194308),l=!0}else if(e===null){p=r.stateNode;var O=r.memoizedProps,M=Vs(a,O);p.props=M;var V=p.context,Z=a.contextType;_=pi,typeof Z=="object"&&Z!==null&&(_=zt(Z));var re=a.getDerivedStateFromProps;Z=typeof re=="function"||typeof p.getSnapshotBeforeUpdate=="function",O=r.pendingProps!==O,Z||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(O||V!==_)&&Mp(r,p,l,_),Xr=!1;var Y=r.memoizedState;p.state=Y,Ca(r,l,p,f),Na(),V=r.memoizedState,O||Y!==V||Xr?(typeof re=="function"&&(Vf(r,a,re,l),V=r.memoizedState),(M=Xr||Cp(r,a,M,l,Y,V,_))?(Z||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(r.flags|=4194308)):(typeof p.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=l,r.memoizedState=V),p.props=l,p.state=V,p.context=_,l=M):(typeof p.componentDidMount=="function"&&(r.flags|=4194308),l=!1)}else{p=r.stateNode,Sf(e,r),_=r.memoizedProps,Z=Vs(a,_),p.props=Z,re=r.pendingProps,Y=p.context,V=a.contextType,M=pi,typeof V=="object"&&V!==null&&(M=zt(V)),O=a.getDerivedStateFromProps,(V=typeof O=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(_!==re||Y!==M)&&Mp(r,p,l,M),Xr=!1,Y=r.memoizedState,p.state=Y,Ca(r,l,p,f),Na();var J=r.memoizedState;_!==re||Y!==J||Xr||e!==null&&e.dependencies!==null&&al(e.dependencies)?(typeof O=="function"&&(Vf(r,a,O,l),J=r.memoizedState),(Z=Xr||Cp(r,a,Z,l,Y,J,M)||e!==null&&e.dependencies!==null&&al(e.dependencies))?(V||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(l,J,M),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(l,J,M)),typeof p.componentDidUpdate=="function"&&(r.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof p.componentDidUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(r.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(r.flags|=1024),r.memoizedProps=l,r.memoizedState=J),p.props=l,p.state=J,p.context=M,l=Z):(typeof p.componentDidUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(r.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(r.flags|=1024),l=!1)}return p=l,Ol(e,r),l=(r.flags&128)!==0,p||l?(p=r.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:p.render(),r.flags|=1,e!==null&&l?(r.child=Fs(r,e.child,null,f),r.child=Fs(r,null,a,f)):It(e,r,a,f),r.memoizedState=p.state,e=r.child):e=wr(e,r,f),e}function Yp(e,r,a,l){return Ps(),r.flags|=256,It(e,r,a,l),r.child}var Qf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wf(e){return{baseLanes:e,cachePool:q0()}}function Zf(e,r,a){return e=e!==null?e.childLanes&~a:0,r&&(e|=yn),e}function Kp(e,r,a){var l=r.pendingProps,f=!1,p=(r.flags&128)!==0,_;if((_=p)||(_=e!==null&&e.memoizedState===null?!1:(wt.current&2)!==0),_&&(f=!0,r.flags&=-129),_=(r.flags&32)!==0,r.flags&=-33,e===null){if(Fe){if(f?Zr(r):es(),(e=ct)?(e=ng(e,Ln),e=e!==null&&e.data!=="&"?e:null,e!==null&&(r.memoizedState={dehydrated:e,treeContext:Vr!==null?{id:tr,overflow:nr}:null,retryLane:536870912,hydrationErrors:null},a=j0(e),a.return=r,r.child=a,Ut=r,ct=null)):e=null,e===null)throw Kr(r);return Lh(e)?r.lanes=32:r.lanes=536870912,null}var O=l.children;return l=l.fallback,f?(es(),f=r.mode,O=Al({mode:"hidden",children:O},f),l=Bs(l,f,a,null),O.return=r,l.return=r,O.sibling=l,r.child=O,l=r.child,l.memoizedState=Wf(a),l.childLanes=Zf(e,_,a),r.memoizedState=Qf,qa(null,l)):(Zr(r),eh(r,O))}var M=e.memoizedState;if(M!==null&&(O=M.dehydrated,O!==null)){if(p)r.flags&256?(Zr(r),r.flags&=-257,r=th(e,r,a)):r.memoizedState!==null?(es(),r.child=e.child,r.flags|=128,r=null):(es(),O=l.fallback,f=r.mode,l=Al({mode:"visible",children:l.children},f),O=Bs(O,f,a,null),O.flags|=2,l.return=r,O.return=r,l.sibling=O,r.child=l,Fs(r,e.child,null,a),l=r.child,l.memoizedState=Wf(a),l.childLanes=Zf(e,_,a),r.memoizedState=Qf,r=qa(null,l));else if(Zr(r),Lh(O)){if(_=O.nextSibling&&O.nextSibling.dataset,_)var V=_.dgst;_=V,l=Error(i(419)),l.stack="",l.digest=_,Ea({value:l,source:null,stack:null}),r=th(e,r,a)}else if(kt||xi(e,r,a,!1),_=(a&e.childLanes)!==0,kt||_){if(_=ot,_!==null&&(l=Fr(_,a),l!==0&&l!==M.retryLane))throw M.retryLane=l,qs(e,l),an(_,e,l),Jf;Dh(O)||Ll(),r=th(e,r,a)}else Dh(O)?(r.flags|=192,r.child=e.child,r=null):(e=M.treeContext,ct=Bn(O.nextSibling),Ut=r,Fe=!0,Yr=null,Ln=!1,e!==null&&N0(r,e),r=eh(r,l.children),r.flags|=4096);return r}return f?(es(),O=l.fallback,f=r.mode,M=e.child,V=M.sibling,l=yr(M,{mode:"hidden",children:l.children}),l.subtreeFlags=M.subtreeFlags&65011712,V!==null?O=yr(V,O):(O=Bs(O,f,a,null),O.flags|=2),O.return=r,l.return=r,l.sibling=O,r.child=l,qa(null,l),l=r.child,O=e.child.memoizedState,O===null?O=Wf(a):(f=O.cachePool,f!==null?(M=At._currentValue,f=f.parent!==M?{parent:M,pool:M}:f):f=q0(),O={baseLanes:O.baseLanes|a,cachePool:f}),l.memoizedState=O,l.childLanes=Zf(e,_,a),r.memoizedState=Qf,qa(e.child,l)):(Zr(r),a=e.child,e=a.sibling,a=yr(a,{mode:"visible",children:l.children}),a.return=r,a.sibling=null,e!==null&&(_=r.deletions,_===null?(r.deletions=[e],r.flags|=16):_.push(e)),r.child=a,r.memoizedState=null,a)}function eh(e,r){return r=Al({mode:"visible",children:r},e.mode),r.return=e,e.child=r}function Al(e,r){return e=hn(22,e,null,r),e.lanes=0,e}function th(e,r,a){return Fs(r,e.child,null,a),e=eh(r,r.pendingProps.children),e.flags|=2,r.memoizedState=null,e}function Jp(e,r,a){e.lanes|=r;var l=e.alternate;l!==null&&(l.lanes|=r),yf(e.return,r,a)}function nh(e,r,a,l,f,p){var _=e.memoizedState;_===null?e.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:p}:(_.isBackwards=r,_.rendering=null,_.renderingStartTime=0,_.last=l,_.tail=a,_.tailMode=f,_.treeForkCount=p)}function Xp(e,r,a){var l=r.pendingProps,f=l.revealOrder,p=l.tail;l=l.children;var _=wt.current,O=(_&2)!==0;if(O?(_=_&1|2,r.flags|=128):_&=1,Me(wt,_),It(e,r,l,a),l=Fe?Sa:0,!O&&e!==null&&(e.flags&128)!==0)e:for(e=r.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Jp(e,a,r);else if(e.tag===19)Jp(e,a,r);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===r)break e;for(;e.sibling===null;){if(e.return===null||e.return===r)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(a=r.child,f=null;a!==null;)e=a.alternate,e!==null&&ml(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=r.child,r.child=null):(f=a.sibling,a.sibling=null),nh(r,!1,f,a,p,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=r.child,r.child=null;f!==null;){if(e=f.alternate,e!==null&&ml(e)===null){r.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}nh(r,!0,a,null,p,l);break;case"together":nh(r,!1,null,null,void 0,l);break;default:r.memoizedState=null}return r.child}function wr(e,r,a){if(e!==null&&(r.dependencies=e.dependencies),rs|=r.lanes,(a&r.childLanes)===0)if(e!==null){if(xi(e,r,a,!1),(a&r.childLanes)===0)return null}else return null;if(e!==null&&r.child!==e.child)throw Error(i(153));if(r.child!==null){for(e=r.child,a=yr(e,e.pendingProps),r.child=a,a.return=r;e.sibling!==null;)e=e.sibling,a=a.sibling=yr(e,e.pendingProps),a.return=r;a.sibling=null}return r.child}function rh(e,r){return(e.lanes&r)!==0?!0:(e=e.dependencies,!!(e!==null&&al(e)))}function Z_(e,r,a){switch(r.tag){case 3:Re(r,r.stateNode.containerInfo),Jr(r,At,e.memoizedState.cache),Ps();break;case 27:case 5:Be(r);break;case 4:Re(r,r.stateNode.containerInfo);break;case 10:Jr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,kf(r),null;break;case 13:var l=r.memoizedState;if(l!==null)return l.dehydrated!==null?(Zr(r),r.flags|=128,null):(a&r.child.childLanes)!==0?Kp(e,r,a):(Zr(r),e=wr(e,r,a),e!==null?e.sibling:null);Zr(r);break;case 19:var f=(e.flags&128)!==0;if(l=(a&r.childLanes)!==0,l||(xi(e,r,a,!1),l=(a&r.childLanes)!==0),f){if(l)return Xp(e,r,a);r.flags|=128}if(f=r.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Me(wt,wt.current),l)break;return null;case 22:return r.lanes=0,$p(e,r,a,r.pendingProps);case 24:Jr(r,At,e.memoizedState.cache)}return wr(e,r,a)}function Qp(e,r,a){if(e!==null)if(e.memoizedProps!==r.pendingProps)kt=!0;else{if(!rh(e,a)&&(r.flags&128)===0)return kt=!1,Z_(e,r,a);kt=(e.flags&131072)!==0}else kt=!1,Fe&&(r.flags&1048576)!==0&&T0(r,Sa,r.index);switch(r.lanes=0,r.tag){case 16:e:{var l=r.pendingProps;if(e=$s(r.elementType),r.type=e,typeof e=="function")lf(e)?(l=Vs(e,l),r.tag=1,r=Vp(null,r,e,l,a)):(r.tag=0,r=Xf(null,r,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===le){r.tag=11,r=Up(null,r,e,l,a);break e}else if(f===ae){r.tag=14,r=zp(null,r,e,l,a);break e}}throw r=Se(e)||e,Error(i(306,r,""))}}return r;case 0:return Xf(e,r,r.type,r.pendingProps,a);case 1:return l=r.type,f=Vs(l,r.pendingProps),Vp(e,r,l,f,a);case 3:e:{if(Re(r,r.stateNode.containerInfo),e===null)throw Error(i(387));l=r.pendingProps;var p=r.memoizedState;f=p.element,Sf(e,r),Ca(r,l,null,a);var _=r.memoizedState;if(l=_.cache,Jr(r,At,l),l!==p.cache&&gf(r,[At],a,!0),Na(),l=_.element,p.isDehydrated)if(p={element:l,isDehydrated:!1,cache:_.cache},r.updateQueue.baseState=p,r.memoizedState=p,r.flags&256){r=Yp(e,r,l,a);break e}else if(l!==f){f=Mn(Error(i(424)),r),Ea(f),r=Yp(e,r,l,a);break e}else{switch(e=r.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(ct=Bn(e.firstChild),Ut=r,Fe=!0,Yr=null,Ln=!0,a=$0(r,null,l,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ps(),l===f){r=wr(e,r,a);break e}It(e,r,l,a)}r=r.child}return r;case 26:return Ol(e,r),e===null?(a=lg(r.type,null,r.pendingProps,null))?r.memoizedState=a:Fe||(a=r.type,e=r.pendingProps,l=$l(Ct.current).createElement(a),l[at]=r,l[gt]=e,$t(l,a,e),L(l),r.stateNode=l):r.memoizedState=lg(r.type,e.memoizedProps,r.pendingProps,e.memoizedState),null;case 27:return Be(r),e===null&&Fe&&(l=r.stateNode=ig(r.type,r.pendingProps,Ct.current),Ut=r,Ln=!0,f=ct,ls(r.type)?(qh=f,ct=Bn(l.firstChild)):ct=f),It(e,r,r.pendingProps.children,a),Ol(e,r),e===null&&(r.flags|=4194304),r.child;case 5:return e===null&&Fe&&((f=l=ct)&&(l=Tw(l,r.type,r.pendingProps,Ln),l!==null?(r.stateNode=l,Ut=r,ct=Bn(l.firstChild),Ln=!1,f=!0):f=!1),f||Kr(r)),Be(r),f=r.type,p=r.pendingProps,_=e!==null?e.memoizedProps:null,l=p.children,Ch(f,p)?l=null:_!==null&&Ch(f,_)&&(r.flags|=32),r.memoizedState!==null&&(f=Nf(e,r,F_,null,null,a),Qa._currentValue=f),Ol(e,r),It(e,r,l,a),r.child;case 6:return e===null&&Fe&&((e=a=ct)&&(a=Nw(a,r.pendingProps,Ln),a!==null?(r.stateNode=a,Ut=r,ct=null,e=!0):e=!1),e||Kr(r)),null;case 13:return Kp(e,r,a);case 4:return Re(r,r.stateNode.containerInfo),l=r.pendingProps,e===null?r.child=Fs(r,null,l,a):It(e,r,l,a),r.child;case 11:return Up(e,r,r.type,r.pendingProps,a);case 7:return It(e,r,r.pendingProps,a),r.child;case 8:return It(e,r,r.pendingProps.children,a),r.child;case 12:return It(e,r,r.pendingProps.children,a),r.child;case 10:return l=r.pendingProps,Jr(r,r.type,l.value),It(e,r,l.children,a),r.child;case 9:return f=r.type._context,l=r.pendingProps.children,zs(r),f=zt(f),l=l(f),r.flags|=1,It(e,r,l,a),r.child;case 14:return zp(e,r,r.type,r.pendingProps,a);case 15:return Ip(e,r,r.type,r.pendingProps,a);case 19:return Xp(e,r,a);case 31:return W_(e,r,a);case 22:return $p(e,r,a,r.pendingProps);case 24:return zs(r),l=zt(At),e===null?(f=vf(),f===null&&(f=ot,p=bf(),f.pooledCache=p,p.refCount++,p!==null&&(f.pooledCacheLanes|=a),f=p),r.memoizedState={parent:l,cache:f},wf(r),Jr(r,At,f)):((e.lanes&a)!==0&&(Sf(e,r),Ca(r,null,null,a),Na()),f=e.memoizedState,p=r.memoizedState,f.parent!==l?(f={parent:l,cache:l},r.memoizedState=f,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=f),Jr(r,At,l)):(l=p.cache,Jr(r,At,l),l!==f.cache&&gf(r,[At],a,!0))),It(e,r,r.pendingProps.children,a),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function Sr(e){e.flags|=4}function sh(e,r,a,l,f){if((r=(e.mode&32)!==0)&&(r=!1),r){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(Ey())e.flags|=8192;else throw Hs=ul,_f}else e.flags&=-16777217}function Wp(e,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!dg(r))if(Ey())e.flags|=8192;else throw Hs=ul,_f}function jl(e,r){r!==null&&(e.flags|=4),e.flags&16384&&(r=e.tag!==22?ii():536870912,e.lanes|=r,Ci|=r)}function Ba(e,r){if(!Fe)switch(e.tailMode){case"hidden":r=e.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?r||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function ut(e){var r=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(r)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=a,r}function ew(e,r,a){var l=r.pendingProps;switch(hf(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ut(r),null;case 1:return ut(r),null;case 3:return a=r.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),xr(At),oe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(bi(r)?Sr(r):e===null||e.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,mf())),ut(r),null;case 26:var f=r.type,p=r.memoizedState;return e===null?(Sr(r),p!==null?(ut(r),Wp(r,p)):(ut(r),sh(r,f,null,l,a))):p?p!==e.memoizedState?(Sr(r),ut(r),Wp(r,p)):(ut(r),r.flags&=-16777217):(e=e.memoizedProps,e!==l&&Sr(r),ut(r),sh(r,f,e,l,a)),null;case 27:if(We(r),a=Ct.current,f=r.type,e!==null&&r.stateNode!=null)e.memoizedProps!==l&&Sr(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return ut(r),null}e=Ze.current,bi(r)?C0(r):(e=ig(f,l,a),r.stateNode=e,Sr(r))}return ut(r),null;case 5:if(We(r),f=r.type,e!==null&&r.stateNode!=null)e.memoizedProps!==l&&Sr(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return ut(r),null}if(p=Ze.current,bi(r))C0(r);else{var _=$l(Ct.current);switch(p){case 1:p=_.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:p=_.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":p=_.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":p=_.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":p=_.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof l.is=="string"?_.createElement("select",{is:l.is}):_.createElement("select"),l.multiple?p.multiple=!0:l.size&&(p.size=l.size);break;default:p=typeof l.is=="string"?_.createElement(f,{is:l.is}):_.createElement(f)}}p[at]=r,p[gt]=l;e:for(_=r.child;_!==null;){if(_.tag===5||_.tag===6)p.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===r)break e;for(;_.sibling===null;){if(_.return===null||_.return===r)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}r.stateNode=p;e:switch($t(p,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Sr(r)}}return ut(r),sh(r,r.type,e===null?null:e.memoizedProps,r.pendingProps,a),null;case 6:if(e&&r.stateNode!=null)e.memoizedProps!==l&&Sr(r);else{if(typeof l!="string"&&r.stateNode===null)throw Error(i(166));if(e=Ct.current,bi(r)){if(e=r.stateNode,a=r.memoizedProps,l=null,f=Ut,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[at]=r,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||Ky(e.nodeValue,a)),e||Kr(r,!0)}else e=$l(e).createTextNode(l),e[at]=r,r.stateNode=e}return ut(r),null;case 31:if(a=r.memoizedState,e===null||e.memoizedState!==null){if(l=bi(r),a!==null){if(e===null){if(!l)throw Error(i(318));if(e=r.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[at]=r}else Ps(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ut(r),e=!1}else a=mf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return r.flags&256?(mn(r),r):(mn(r),null);if((r.flags&128)!==0)throw Error(i(558))}return ut(r),null;case 13:if(l=r.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=bi(r),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(i(318));if(f=r.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[at]=r}else Ps(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ut(r),f=!1}else f=mf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return r.flags&256?(mn(r),r):(mn(r),null)}return mn(r),(r.flags&128)!==0?(r.lanes=a,r):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=r.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),p=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==f&&(l.flags|=2048)),a!==e&&a&&(r.child.flags|=8192),jl(r,r.updateQueue),ut(r),null);case 4:return oe(),e===null&&Ah(r.stateNode.containerInfo),ut(r),null;case 10:return xr(r.type),ut(r),null;case 19:if(Te(wt),l=r.memoizedState,l===null)return ut(r),null;if(f=(r.flags&128)!==0,p=l.rendering,p===null)if(f)Ba(l,!1);else{if(xt!==0||e!==null&&(e.flags&128)!==0)for(e=r.child;e!==null;){if(p=ml(e),p!==null){for(r.flags|=128,Ba(l,!1),e=p.updateQueue,r.updateQueue=e,jl(r,e),r.subtreeFlags=0,e=a,a=r.child;a!==null;)A0(a,e),a=a.sibling;return Me(wt,wt.current&1|2),Fe&&gr(r,l.treeForkCount),r.child}e=e.sibling}l.tail!==null&&ht()>Ml&&(r.flags|=128,f=!0,Ba(l,!1),r.lanes=4194304)}else{if(!f)if(e=ml(p),e!==null){if(r.flags|=128,f=!0,e=e.updateQueue,r.updateQueue=e,jl(r,e),Ba(l,!0),l.tail===null&&l.tailMode==="hidden"&&!p.alternate&&!Fe)return ut(r),null}else 2*ht()-l.renderingStartTime>Ml&&a!==536870912&&(r.flags|=128,f=!0,Ba(l,!1),r.lanes=4194304);l.isBackwards?(p.sibling=r.child,r.child=p):(e=l.last,e!==null?e.sibling=p:r.child=p,l.last=p)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=ht(),e.sibling=null,a=wt.current,Me(wt,f?a&1|2:a&1),Fe&&gr(r,l.treeForkCount),e):(ut(r),null);case 22:case 23:return mn(r),jf(),l=r.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(r.flags|=8192):l&&(r.flags|=8192),l?(a&536870912)!==0&&(r.flags&128)===0&&(ut(r),r.subtreeFlags&6&&(r.flags|=8192)):ut(r),a=r.updateQueue,a!==null&&jl(r,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),l!==a&&(r.flags|=2048),e!==null&&Te(Is),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),xr(At),ut(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function tw(e,r){switch(hf(r),r.tag){case 1:return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 3:return xr(At),oe(),e=r.flags,(e&65536)!==0&&(e&128)===0?(r.flags=e&-65537|128,r):null;case 26:case 27:case 5:return We(r),null;case 31:if(r.memoizedState!==null){if(mn(r),r.alternate===null)throw Error(i(340));Ps()}return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 13:if(mn(r),e=r.memoizedState,e!==null&&e.dehydrated!==null){if(r.alternate===null)throw Error(i(340));Ps()}return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 19:return Te(wt),null;case 4:return oe(),null;case 10:return xr(r.type),null;case 22:case 23:return mn(r),jf(),e!==null&&Te(Is),e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 24:return xr(At),null;case 25:return null;default:return null}}function Zp(e,r){switch(hf(r),r.tag){case 3:xr(At),oe();break;case 26:case 27:case 5:We(r);break;case 4:oe();break;case 31:r.memoizedState!==null&&mn(r);break;case 13:mn(r);break;case 19:Te(wt);break;case 10:xr(r.type);break;case 22:case 23:mn(r),jf(),e!==null&&Te(Is);break;case 24:xr(At)}}function Pa(e,r){try{var a=r.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&e)===e){l=void 0;var p=a.create,_=a.inst;l=p(),_.destroy=l}a=a.next}while(a!==f)}}catch(O){tt(r,r.return,O)}}function ts(e,r,a){try{var l=r.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var p=f.next;l=p;do{if((l.tag&e)===e){var _=l.inst,O=_.destroy;if(O!==void 0){_.destroy=void 0,f=r;var M=a,V=O;try{V()}catch(Z){tt(f,M,Z)}}}l=l.next}while(l!==p)}}catch(Z){tt(r,r.return,Z)}}function ey(e){var r=e.updateQueue;if(r!==null){var a=e.stateNode;try{F0(r,a)}catch(l){tt(e,e.return,l)}}}function ty(e,r,a){a.props=Vs(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){tt(e,r,l)}}function Ua(e,r){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(f){tt(e,r,f)}}function rr(e,r){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){tt(e,r,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){tt(e,r,f)}else a.current=null}function ny(e){var r=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){tt(e,e.return,f)}}function ih(e,r,a){try{var l=e.stateNode;Sw(l,e.type,a,r),l[gt]=r}catch(f){tt(e,e.return,f)}}function ry(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ls(e.type)||e.tag===4}function ah(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ry(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ls(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function oh(e,r,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,r?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,r):(r=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,r.appendChild(e),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=mr));else if(l!==4&&(l===27&&ls(e.type)&&(a=e.stateNode,r=null),e=e.child,e!==null))for(oh(e,r,a),e=e.sibling;e!==null;)oh(e,r,a),e=e.sibling}function kl(e,r,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,r?a.insertBefore(e,r):a.appendChild(e);else if(l!==4&&(l===27&&ls(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(kl(e,r,a),e=e.sibling;e!==null;)kl(e,r,a),e=e.sibling}function sy(e){var r=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=r.attributes;f.length;)r.removeAttributeNode(f[0]);$t(r,l,a),r[at]=e,r[gt]=a}catch(p){tt(e,e.return,p)}}var Er=!1,Tt=!1,lh=!1,iy=typeof WeakSet=="function"?WeakSet:Set,Lt=null;function nw(e,r){if(e=e.containerInfo,Th=Jl,e=g0(e),ef(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,p=l.focusNode;l=l.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var _=0,O=-1,M=-1,V=0,Z=0,re=e,Y=null;t:for(;;){for(var J;re!==a||f!==0&&re.nodeType!==3||(O=_+f),re!==p||l!==0&&re.nodeType!==3||(M=_+l),re.nodeType===3&&(_+=re.nodeValue.length),(J=re.firstChild)!==null;)Y=re,re=J;for(;;){if(re===e)break t;if(Y===a&&++V===f&&(O=_),Y===p&&++Z===l&&(M=_),(J=re.nextSibling)!==null)break;re=Y,Y=re.parentNode}re=J}a=O===-1||M===-1?null:{start:O,end:M}}else a=null}a=a||{start:0,end:0}}else a=null;for(Nh={focusedElem:e,selectionRange:a},Jl=!1,Lt=r;Lt!==null;)if(r=Lt,e=r.child,(r.subtreeFlags&1028)!==0&&e!==null)e.return=r,Lt=e;else for(;Lt!==null;){switch(r=Lt,p=r.alternate,e=r.flags,r.tag){case 0:if((e&4)!==0&&(e=r.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)f=e[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&p!==null){e=void 0,a=r,f=p.memoizedProps,p=p.memoizedState,l=a.stateNode;try{var be=Vs(a.type,f);e=l.getSnapshotBeforeUpdate(be,p),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ne){tt(a,a.return,Ne)}}break;case 3:if((e&1024)!==0){if(e=r.stateNode.containerInfo,a=e.nodeType,a===9)Rh(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Rh(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(i(163))}if(e=r.sibling,e!==null){e.return=r.return,Lt=e;break}Lt=r.return}}function ay(e,r,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Ar(e,a),l&4&&Pa(5,a);break;case 1:if(Ar(e,a),l&4)if(e=a.stateNode,r===null)try{e.componentDidMount()}catch(_){tt(a,a.return,_)}else{var f=Vs(a.type,r.memoizedProps);r=r.memoizedState;try{e.componentDidUpdate(f,r,e.__reactInternalSnapshotBeforeUpdate)}catch(_){tt(a,a.return,_)}}l&64&&ey(a),l&512&&Ua(a,a.return);break;case 3:if(Ar(e,a),l&64&&(e=a.updateQueue,e!==null)){if(r=null,a.child!==null)switch(a.child.tag){case 27:case 5:r=a.child.stateNode;break;case 1:r=a.child.stateNode}try{F0(e,r)}catch(_){tt(a,a.return,_)}}break;case 27:r===null&&l&4&&sy(a);case 26:case 5:Ar(e,a),r===null&&l&4&&ny(a),l&512&&Ua(a,a.return);break;case 12:Ar(e,a);break;case 31:Ar(e,a),l&4&&cy(e,a);break;case 13:Ar(e,a),l&4&&uy(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=fw.bind(null,a),Cw(e,a))));break;case 22:if(l=a.memoizedState!==null||Er,!l){r=r!==null&&r.memoizedState!==null||Tt,f=Er;var p=Tt;Er=l,(Tt=r)&&!p?jr(e,a,(a.subtreeFlags&8772)!==0):Ar(e,a),Er=f,Tt=p}break;case 30:break;default:Ar(e,a)}}function oy(e){var r=e.alternate;r!==null&&(e.alternate=null,oy(r)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(r=e.stateNode,r!==null&&ai(r)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var dt=null,tn=!1;function Or(e,r,a){for(a=a.child;a!==null;)ly(e,r,a),a=a.sibling}function ly(e,r,a){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(js,a)}catch{}switch(a.tag){case 26:Tt||rr(a,r),Or(e,r,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Tt||rr(a,r);var l=dt,f=tn;ls(a.type)&&(dt=a.stateNode,tn=!1),Or(e,r,a),Ka(a.stateNode),dt=l,tn=f;break;case 5:Tt||rr(a,r);case 6:if(l=dt,f=tn,dt=null,Or(e,r,a),dt=l,tn=f,dt!==null)if(tn)try{(dt.nodeType===9?dt.body:dt.nodeName==="HTML"?dt.ownerDocument.body:dt).removeChild(a.stateNode)}catch(p){tt(a,r,p)}else try{dt.removeChild(a.stateNode)}catch(p){tt(a,r,p)}break;case 18:dt!==null&&(tn?(e=dt,eg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Ui(e)):eg(dt,a.stateNode));break;case 4:l=dt,f=tn,dt=a.stateNode.containerInfo,tn=!0,Or(e,r,a),dt=l,tn=f;break;case 0:case 11:case 14:case 15:ts(2,a,r),Tt||ts(4,a,r),Or(e,r,a);break;case 1:Tt||(rr(a,r),l=a.stateNode,typeof l.componentWillUnmount=="function"&&ty(a,r,l)),Or(e,r,a);break;case 21:Or(e,r,a);break;case 22:Tt=(l=Tt)||a.memoizedState!==null,Or(e,r,a),Tt=l;break;default:Or(e,r,a)}}function cy(e,r){if(r.memoizedState===null&&(e=r.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ui(e)}catch(a){tt(r,r.return,a)}}}function uy(e,r){if(r.memoizedState===null&&(e=r.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ui(e)}catch(a){tt(r,r.return,a)}}function rw(e){switch(e.tag){case 31:case 13:case 19:var r=e.stateNode;return r===null&&(r=e.stateNode=new iy),r;case 22:return e=e.stateNode,r=e._retryCache,r===null&&(r=e._retryCache=new iy),r;default:throw Error(i(435,e.tag))}}function Tl(e,r){var a=rw(e);r.forEach(function(l){if(!a.has(l)){a.add(l);var f=hw.bind(null,e,l);l.then(f,f)}})}function nn(e,r){var a=r.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],p=e,_=r,O=_;e:for(;O!==null;){switch(O.tag){case 27:if(ls(O.type)){dt=O.stateNode,tn=!1;break e}break;case 5:dt=O.stateNode,tn=!1;break e;case 3:case 4:dt=O.stateNode.containerInfo,tn=!0;break e}O=O.return}if(dt===null)throw Error(i(160));ly(p,_,f),dt=null,tn=!1,p=f.alternate,p!==null&&(p.return=null),f.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)fy(r,e),r=r.sibling}var Vn=null;function fy(e,r){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:nn(r,e),rn(e),l&4&&(ts(3,e,e.return),Pa(3,e),ts(5,e,e.return));break;case 1:nn(r,e),rn(e),l&512&&(Tt||a===null||rr(a,a.return)),l&64&&Er&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=Vn;if(nn(r,e),rn(e),l&512&&(Tt||a===null||rr(a,a.return)),l&4){var p=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":p=f.getElementsByTagName("title")[0],(!p||p[Mt]||p[at]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=f.createElement(l),f.head.insertBefore(p,f.querySelector("head > title"))),$t(p,l,a),p[at]=e,L(p),l=p;break e;case"link":var _=fg("link","href",f).get(l+(a.href||""));if(_){for(var O=0;O<_.length;O++)if(p=_[O],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){_.splice(O,1);break t}}p=f.createElement(l),$t(p,l,a),f.head.appendChild(p);break;case"meta":if(_=fg("meta","content",f).get(l+(a.content||""))){for(O=0;O<_.length;O++)if(p=_[O],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){_.splice(O,1);break t}}p=f.createElement(l),$t(p,l,a),f.head.appendChild(p);break;default:throw Error(i(468,l))}p[at]=e,L(p),l=p}e.stateNode=l}else hg(f,e.type,e.stateNode);else e.stateNode=ug(f,l,e.memoizedProps);else p!==l?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,l===null?hg(f,e.type,e.stateNode):ug(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&ih(e,e.memoizedProps,a.memoizedProps)}break;case 27:nn(r,e),rn(e),l&512&&(Tt||a===null||rr(a,a.return)),a!==null&&l&4&&ih(e,e.memoizedProps,a.memoizedProps);break;case 5:if(nn(r,e),rn(e),l&512&&(Tt||a===null||rr(a,a.return)),e.flags&32){f=e.stateNode;try{li(f,"")}catch(be){tt(e,e.return,be)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,ih(e,f,a!==null?a.memoizedProps:f)),l&1024&&(lh=!0);break;case 6:if(nn(r,e),rn(e),l&4){if(e.stateNode===null)throw Error(i(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(be){tt(e,e.return,be)}}break;case 3:if(Gl=null,f=Vn,Vn=Hl(r.containerInfo),nn(r,e),Vn=f,rn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{Ui(r.containerInfo)}catch(be){tt(e,e.return,be)}lh&&(lh=!1,hy(e));break;case 4:l=Vn,Vn=Hl(e.stateNode.containerInfo),nn(r,e),rn(e),Vn=l;break;case 12:nn(r,e),rn(e);break;case 31:nn(r,e),rn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Tl(e,l)));break;case 13:nn(r,e),rn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Cl=ht()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Tl(e,l)));break;case 22:f=e.memoizedState!==null;var M=a!==null&&a.memoizedState!==null,V=Er,Z=Tt;if(Er=V||f,Tt=Z||M,nn(r,e),Tt=Z,Er=V,rn(e),l&8192)e:for(r=e.stateNode,r._visibility=f?r._visibility&-2:r._visibility|1,f&&(a===null||M||Er||Tt||Ys(e)),a=null,r=e;;){if(r.tag===5||r.tag===26){if(a===null){M=a=r;try{if(p=M.stateNode,f)_=p.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{O=M.stateNode;var re=M.memoizedProps.style,Y=re!=null&&re.hasOwnProperty("display")?re.display:null;O.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(be){tt(M,M.return,be)}}}else if(r.tag===6){if(a===null){M=r;try{M.stateNode.nodeValue=f?"":M.memoizedProps}catch(be){tt(M,M.return,be)}}}else if(r.tag===18){if(a===null){M=r;try{var J=M.stateNode;f?tg(J,!0):tg(M.stateNode,!1)}catch(be){tt(M,M.return,be)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===e)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break e;for(;r.sibling===null;){if(r.return===null||r.return===e)break e;a===r&&(a=null),r=r.return}a===r&&(a=null),r.sibling.return=r.return,r=r.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,Tl(e,a))));break;case 19:nn(r,e),rn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Tl(e,l)));break;case 30:break;case 21:break;default:nn(r,e),rn(e)}}function rn(e){var r=e.flags;if(r&2){try{for(var a,l=e.return;l!==null;){if(ry(l)){a=l;break}l=l.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var f=a.stateNode,p=ah(e);kl(e,p,f);break;case 5:var _=a.stateNode;a.flags&32&&(li(_,""),a.flags&=-33);var O=ah(e);kl(e,O,_);break;case 3:case 4:var M=a.stateNode.containerInfo,V=ah(e);oh(e,V,M);break;default:throw Error(i(161))}}catch(Z){tt(e,e.return,Z)}e.flags&=-3}r&4096&&(e.flags&=-4097)}function hy(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var r=e;hy(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),e=e.sibling}}function Ar(e,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)ay(e,r.alternate,r),r=r.sibling}function Ys(e){for(e=e.child;e!==null;){var r=e;switch(r.tag){case 0:case 11:case 14:case 15:ts(4,r,r.return),Ys(r);break;case 1:rr(r,r.return);var a=r.stateNode;typeof a.componentWillUnmount=="function"&&ty(r,r.return,a),Ys(r);break;case 27:Ka(r.stateNode);case 26:case 5:rr(r,r.return),Ys(r);break;case 22:r.memoizedState===null&&Ys(r);break;case 30:Ys(r);break;default:Ys(r)}e=e.sibling}}function jr(e,r,a){for(a=a&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var l=r.alternate,f=e,p=r,_=p.flags;switch(p.tag){case 0:case 11:case 15:jr(f,p,a),Pa(4,p);break;case 1:if(jr(f,p,a),l=p,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(V){tt(l,l.return,V)}if(l=p,f=l.updateQueue,f!==null){var O=l.stateNode;try{var M=f.shared.hiddenCallbacks;if(M!==null)for(f.shared.hiddenCallbacks=null,f=0;f<M.length;f++)H0(M[f],O)}catch(V){tt(l,l.return,V)}}a&&_&64&&ey(p),Ua(p,p.return);break;case 27:sy(p);case 26:case 5:jr(f,p,a),a&&l===null&&_&4&&ny(p),Ua(p,p.return);break;case 12:jr(f,p,a);break;case 31:jr(f,p,a),a&&_&4&&cy(f,p);break;case 13:jr(f,p,a),a&&_&4&&uy(f,p);break;case 22:p.memoizedState===null&&jr(f,p,a),Ua(p,p.return);break;case 30:break;default:jr(f,p,a)}r=r.sibling}}function ch(e,r){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(e=r.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Oa(a))}function uh(e,r){e=null,r.alternate!==null&&(e=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==e&&(r.refCount++,e!=null&&Oa(e))}function Yn(e,r,a,l){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)dy(e,r,a,l),r=r.sibling}function dy(e,r,a,l){var f=r.flags;switch(r.tag){case 0:case 11:case 15:Yn(e,r,a,l),f&2048&&Pa(9,r);break;case 1:Yn(e,r,a,l);break;case 3:Yn(e,r,a,l),f&2048&&(e=null,r.alternate!==null&&(e=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==e&&(r.refCount++,e!=null&&Oa(e)));break;case 12:if(f&2048){Yn(e,r,a,l),e=r.stateNode;try{var p=r.memoizedProps,_=p.id,O=p.onPostCommit;typeof O=="function"&&O(_,r.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(M){tt(r,r.return,M)}}else Yn(e,r,a,l);break;case 31:Yn(e,r,a,l);break;case 13:Yn(e,r,a,l);break;case 23:break;case 22:p=r.stateNode,_=r.alternate,r.memoizedState!==null?p._visibility&2?Yn(e,r,a,l):za(e,r):p._visibility&2?Yn(e,r,a,l):(p._visibility|=2,ki(e,r,a,l,(r.subtreeFlags&10256)!==0||!1)),f&2048&&ch(_,r);break;case 24:Yn(e,r,a,l),f&2048&&uh(r.alternate,r);break;default:Yn(e,r,a,l)}}function ki(e,r,a,l,f){for(f=f&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var p=e,_=r,O=a,M=l,V=_.flags;switch(_.tag){case 0:case 11:case 15:ki(p,_,O,M,f),Pa(8,_);break;case 23:break;case 22:var Z=_.stateNode;_.memoizedState!==null?Z._visibility&2?ki(p,_,O,M,f):za(p,_):(Z._visibility|=2,ki(p,_,O,M,f)),f&&V&2048&&ch(_.alternate,_);break;case 24:ki(p,_,O,M,f),f&&V&2048&&uh(_.alternate,_);break;default:ki(p,_,O,M,f)}r=r.sibling}}function za(e,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var a=e,l=r,f=l.flags;switch(l.tag){case 22:za(a,l),f&2048&&ch(l.alternate,l);break;case 24:za(a,l),f&2048&&uh(l.alternate,l);break;default:za(a,l)}r=r.sibling}}var Ia=8192;function Ti(e,r,a){if(e.subtreeFlags&Ia)for(e=e.child;e!==null;)my(e,r,a),e=e.sibling}function my(e,r,a){switch(e.tag){case 26:Ti(e,r,a),e.flags&Ia&&e.memoizedState!==null&&Hw(a,Vn,e.memoizedState,e.memoizedProps);break;case 5:Ti(e,r,a);break;case 3:case 4:var l=Vn;Vn=Hl(e.stateNode.containerInfo),Ti(e,r,a),Vn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Ia,Ia=16777216,Ti(e,r,a),Ia=l):Ti(e,r,a));break;default:Ti(e,r,a)}}function py(e){var r=e.alternate;if(r!==null&&(e=r.child,e!==null)){r.child=null;do r=e.sibling,e.sibling=null,e=r;while(e!==null)}}function $a(e){var r=e.deletions;if((e.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Lt=l,gy(l,e)}py(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)yy(e),e=e.sibling}function yy(e){switch(e.tag){case 0:case 11:case 15:$a(e),e.flags&2048&&ts(9,e,e.return);break;case 3:$a(e);break;case 12:$a(e);break;case 22:var r=e.stateNode;e.memoizedState!==null&&r._visibility&2&&(e.return===null||e.return.tag!==13)?(r._visibility&=-3,Nl(e)):$a(e);break;default:$a(e)}}function Nl(e){var r=e.deletions;if((e.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Lt=l,gy(l,e)}py(e)}for(e=e.child;e!==null;){switch(r=e,r.tag){case 0:case 11:case 15:ts(8,r,r.return),Nl(r);break;case 22:a=r.stateNode,a._visibility&2&&(a._visibility&=-3,Nl(r));break;default:Nl(r)}e=e.sibling}}function gy(e,r){for(;Lt!==null;){var a=Lt;switch(a.tag){case 0:case 11:case 15:ts(8,a,r);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Oa(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Lt=l;else e:for(a=e;Lt!==null;){l=Lt;var f=l.sibling,p=l.return;if(oy(l),l===a){Lt=null;break e}if(f!==null){f.return=p,Lt=f;break e}Lt=p}}}var sw={getCacheForType:function(e){var r=zt(At),a=r.data.get(e);return a===void 0&&(a=e(),r.data.set(e,a)),a},cacheSignal:function(){return zt(At).controller.signal}},iw=typeof WeakMap=="function"?WeakMap:Map,Qe=0,ot=null,Pe=null,ze=0,et=0,pn=null,ns=!1,Ni=!1,fh=!1,kr=0,xt=0,rs=0,Ks=0,hh=0,yn=0,Ci=0,Ha=null,sn=null,dh=!1,Cl=0,by=0,Ml=1/0,Rl=null,ss=null,Rt=0,is=null,Mi=null,Tr=0,mh=0,ph=null,xy=null,Fa=0,yh=null;function gn(){return(Qe&2)!==0&&ze!==0?ze&-ze:F.T!==null?wh():ha()}function vy(){if(yn===0)if((ze&536870912)===0||Fe){var e=fr;fr<<=1,(fr&3932160)===0&&(fr=262144),yn=e}else yn=536870912;return e=dn.current,e!==null&&(e.flags|=32),yn}function an(e,r,a){(e===ot&&(et===2||et===9)||e.cancelPendingCommit!==null)&&(Ri(e,0),as(e,ze,yn,!1)),Hn(e,a),((Qe&2)===0||e!==ot)&&(e===ot&&((Qe&2)===0&&(Ks|=a),xt===4&&as(e,ze,yn,!1)),sr(e))}function _y(e,r,a){if((Qe&6)!==0)throw Error(i(327));var l=!a&&(r&127)===0&&(r&e.expiredLanes)===0||Ts(e,r),f=l?lw(e,r):bh(e,r,!0),p=l;do{if(f===0){Ni&&!l&&as(e,r,0,!1);break}else{if(a=e.current.alternate,p&&!aw(a)){f=bh(e,r,!1),p=!1;continue}if(f===2){if(p=r,e.errorRecoveryDisabledLanes&p)var _=0;else _=e.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){r=_;e:{var O=e;f=Ha;var M=O.current.memoizedState.isDehydrated;if(M&&(Ri(O,_).flags|=256),_=bh(O,_,!1),_!==2){if(fh&&!M){O.errorRecoveryDisabledLanes|=p,Ks|=p,f=4;break e}p=sn,sn=f,p!==null&&(sn===null?sn=p:sn.push.apply(sn,p))}f=_}if(p=!1,f!==2)continue}}if(f===1){Ri(e,0),as(e,r,0,!0);break}e:{switch(l=e,p=f,p){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:as(l,r,yn,!ns);break e;case 2:sn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(f=Cl+300-ht(),10<f)){if(as(l,r,yn,!ns),ks(l,0,!0)!==0)break e;Tr=r,l.timeoutHandle=Wy(wy.bind(null,l,a,sn,Rl,dh,r,yn,Ks,Ci,ns,p,"Throttled",-0,0),f);break e}wy(l,a,sn,Rl,dh,r,yn,Ks,Ci,ns,p,null,-0,0)}}break}while(!0);sr(e)}function wy(e,r,a,l,f,p,_,O,M,V,Z,re,Y,J){if(e.timeoutHandle=-1,re=r.subtreeFlags,re&8192||(re&16785408)===16785408){re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:mr},my(r,p,re);var be=(p&62914560)===p?Cl-ht():(p&4194048)===p?by-ht():0;if(be=Fw(re,be),be!==null){Tr=p,e.cancelPendingCommit=be(Ny.bind(null,e,r,p,a,l,f,_,O,M,Z,re,null,Y,J)),as(e,p,_,!V);return}}Ny(e,r,p,a,l,f,_,O,M)}function aw(e){for(var r=e;;){var a=r.tag;if((a===0||a===11||a===15)&&r.flags&16384&&(a=r.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],p=f.getSnapshot;f=f.value;try{if(!fn(p(),f))return!1}catch{return!1}}if(a=r.child,r.subtreeFlags&16384&&a!==null)a.return=r,r=a;else{if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function as(e,r,a,l){r&=~hh,r&=~Ks,e.suspendedLanes|=r,e.pingedLanes&=~r,l&&(e.warmLanes|=r),l=e.expirationTimes;for(var f=r;0<f;){var p=31-Ft(f),_=1<<p;l[p]=-1,f&=~_}a!==0&&Hr(e,a,r)}function Dl(){return(Qe&6)===0?(Ga(0),!1):!0}function gh(){if(Pe!==null){if(et===0)var e=Pe.return;else e=Pe,br=Us=null,Rf(e),Si=null,ja=0,e=Pe;for(;e!==null;)Zp(e.alternate,e),e=e.return;Pe=null}}function Ri(e,r){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Aw(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Tr=0,gh(),ot=e,Pe=a=yr(e.current,null),ze=r,et=0,pn=null,ns=!1,Ni=Ts(e,r),fh=!1,Ci=yn=hh=Ks=rs=xt=0,sn=Ha=null,dh=!1,(r&8)!==0&&(r|=r&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=r;0<l;){var f=31-Ft(l),p=1<<f;r|=e[f],l&=~p}return kr=r,tl(),a}function Sy(e,r){De=null,F.H=La,r===wi||r===cl?(r=U0(),et=3):r===_f?(r=U0(),et=4):et=r===Jf?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,pn=r,Pe===null&&(xt=1,Sl(e,Mn(r,e.current)))}function Ey(){var e=dn.current;return e===null?!0:(ze&4194048)===ze?qn===null:(ze&62914560)===ze||(ze&536870912)!==0?e===qn:!1}function Oy(){var e=F.H;return F.H=La,e===null?La:e}function Ay(){var e=F.A;return F.A=sw,e}function Ll(){xt=4,ns||(ze&4194048)!==ze&&dn.current!==null||(Ni=!0),(rs&134217727)===0&&(Ks&134217727)===0||ot===null||as(ot,ze,yn,!1)}function bh(e,r,a){var l=Qe;Qe|=2;var f=Oy(),p=Ay();(ot!==e||ze!==r)&&(Rl=null,Ri(e,r)),r=!1;var _=xt;e:do try{if(et!==0&&Pe!==null){var O=Pe,M=pn;switch(et){case 8:gh(),_=6;break e;case 3:case 2:case 9:case 6:dn.current===null&&(r=!0);var V=et;if(et=0,pn=null,Di(e,O,M,V),a&&Ni){_=0;break e}break;default:V=et,et=0,pn=null,Di(e,O,M,V)}}ow(),_=xt;break}catch(Z){Sy(e,Z)}while(!0);return r&&e.shellSuspendCounter++,br=Us=null,Qe=l,F.H=f,F.A=p,Pe===null&&(ot=null,ze=0,tl()),_}function ow(){for(;Pe!==null;)jy(Pe)}function lw(e,r){var a=Qe;Qe|=2;var l=Oy(),f=Ay();ot!==e||ze!==r?(Rl=null,Ml=ht()+500,Ri(e,r)):Ni=Ts(e,r);e:do try{if(et!==0&&Pe!==null){r=Pe;var p=pn;t:switch(et){case 1:et=0,pn=null,Di(e,r,p,1);break;case 2:case 9:if(B0(p)){et=0,pn=null,ky(r);break}r=function(){et!==2&&et!==9||ot!==e||(et=7),sr(e)},p.then(r,r);break e;case 3:et=7;break e;case 4:et=5;break e;case 7:B0(p)?(et=0,pn=null,ky(r)):(et=0,pn=null,Di(e,r,p,7));break;case 5:var _=null;switch(Pe.tag){case 26:_=Pe.memoizedState;case 5:case 27:var O=Pe;if(_?dg(_):O.stateNode.complete){et=0,pn=null;var M=O.sibling;if(M!==null)Pe=M;else{var V=O.return;V!==null?(Pe=V,ql(V)):Pe=null}break t}}et=0,pn=null,Di(e,r,p,5);break;case 6:et=0,pn=null,Di(e,r,p,6);break;case 8:gh(),xt=6;break e;default:throw Error(i(462))}}cw();break}catch(Z){Sy(e,Z)}while(!0);return br=Us=null,F.H=l,F.A=f,Qe=a,Pe!==null?0:(ot=null,ze=0,tl(),xt)}function cw(){for(;Pe!==null&&!Po();)jy(Pe)}function jy(e){var r=Qp(e.alternate,e,kr);e.memoizedProps=e.pendingProps,r===null?ql(e):Pe=r}function ky(e){var r=e,a=r.alternate;switch(r.tag){case 15:case 0:r=Gp(a,r,r.pendingProps,r.type,void 0,ze);break;case 11:r=Gp(a,r,r.pendingProps,r.type.render,r.ref,ze);break;case 5:Rf(r);default:Zp(a,r),r=Pe=A0(r,kr),r=Qp(a,r,kr)}e.memoizedProps=e.pendingProps,r===null?ql(e):Pe=r}function Di(e,r,a,l){br=Us=null,Rf(r),Si=null,ja=0;var f=r.return;try{if(Q_(e,f,r,a,ze)){xt=1,Sl(e,Mn(a,e.current)),Pe=null;return}}catch(p){if(f!==null)throw Pe=f,p;xt=1,Sl(e,Mn(a,e.current)),Pe=null;return}r.flags&32768?(Fe||l===1?e=!0:Ni||(ze&536870912)!==0?e=!1:(ns=e=!0,(l===2||l===9||l===3||l===6)&&(l=dn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Ty(r,e)):ql(r)}function ql(e){var r=e;do{if((r.flags&32768)!==0){Ty(r,ns);return}e=r.return;var a=ew(r.alternate,r,kr);if(a!==null){Pe=a;return}if(r=r.sibling,r!==null){Pe=r;return}Pe=r=e}while(r!==null);xt===0&&(xt=5)}function Ty(e,r){do{var a=tw(e.alternate,e);if(a!==null){a.flags&=32767,Pe=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!r&&(e=e.sibling,e!==null)){Pe=e;return}Pe=e=a}while(e!==null);xt=6,Pe=null}function Ny(e,r,a,l,f,p,_,O,M){e.cancelPendingCommit=null;do Bl();while(Rt!==0);if((Qe&6)!==0)throw Error(i(327));if(r!==null){if(r===e.current)throw Error(i(177));if(p=r.lanes|r.childLanes,p|=af,$r(e,a,p,_,O,M),e===ot&&(Pe=ot=null,ze=0),Mi=r,is=e,Tr=a,mh=p,ph=f,xy=l,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,dw(ri,function(){return Ly(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||l){l=F.T,F.T=null,f=W.p,W.p=2,_=Qe,Qe|=4;try{nw(e,r,a)}finally{Qe=_,W.p=f,F.T=l}}Rt=1,Cy(),My(),Ry()}}function Cy(){if(Rt===1){Rt=0;var e=is,r=Mi,a=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||a){a=F.T,F.T=null;var l=W.p;W.p=2;var f=Qe;Qe|=4;try{fy(r,e);var p=Nh,_=g0(e.containerInfo),O=p.focusedElem,M=p.selectionRange;if(_!==O&&O&&O.ownerDocument&&y0(O.ownerDocument.documentElement,O)){if(M!==null&&ef(O)){var V=M.start,Z=M.end;if(Z===void 0&&(Z=V),"selectionStart"in O)O.selectionStart=V,O.selectionEnd=Math.min(Z,O.value.length);else{var re=O.ownerDocument||document,Y=re&&re.defaultView||window;if(Y.getSelection){var J=Y.getSelection(),be=O.textContent.length,Ne=Math.min(M.start,be),it=M.end===void 0?Ne:Math.min(M.end,be);!J.extend&&Ne>it&&(_=it,it=Ne,Ne=_);var U=p0(O,Ne),P=p0(O,it);if(U&&P&&(J.rangeCount!==1||J.anchorNode!==U.node||J.anchorOffset!==U.offset||J.focusNode!==P.node||J.focusOffset!==P.offset)){var G=re.createRange();G.setStart(U.node,U.offset),J.removeAllRanges(),Ne>it?(J.addRange(G),J.extend(P.node,P.offset)):(G.setEnd(P.node,P.offset),J.addRange(G))}}}}for(re=[],J=O;J=J.parentNode;)J.nodeType===1&&re.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<re.length;O++){var ee=re[O];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}Jl=!!Th,Nh=Th=null}finally{Qe=f,W.p=l,F.T=a}}e.current=r,Rt=2}}function My(){if(Rt===2){Rt=0;var e=is,r=Mi,a=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||a){a=F.T,F.T=null;var l=W.p;W.p=2;var f=Qe;Qe|=4;try{ay(e,r.alternate,r)}finally{Qe=f,W.p=l,F.T=a}}Rt=3}}function Ry(){if(Rt===4||Rt===3){Rt=0,ni();var e=is,r=Mi,a=Tr,l=xy;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Rt=5:(Rt=0,Mi=is=null,Dy(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(ss=null),Cs(a),r=r.stateNode,_t&&typeof _t.onCommitFiberRoot=="function")try{_t.onCommitFiberRoot(js,r,void 0,(r.current.flags&128)===128)}catch{}if(l!==null){r=F.T,f=W.p,W.p=2,F.T=null;try{for(var p=e.onRecoverableError,_=0;_<l.length;_++){var O=l[_];p(O.value,{componentStack:O.stack})}}finally{F.T=r,W.p=f}}(Tr&3)!==0&&Bl(),sr(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===yh?Fa++:(Fa=0,yh=e):Fa=0,Ga(0)}}function Dy(e,r){(e.pooledCacheLanes&=r)===0&&(r=e.pooledCache,r!=null&&(e.pooledCache=null,Oa(r)))}function Bl(){return Cy(),My(),Ry(),Ly()}function Ly(){if(Rt!==5)return!1;var e=is,r=mh;mh=0;var a=Cs(Tr),l=F.T,f=W.p;try{W.p=32>a?32:a,F.T=null,a=ph,ph=null;var p=is,_=Tr;if(Rt=0,Mi=is=null,Tr=0,(Qe&6)!==0)throw Error(i(331));var O=Qe;if(Qe|=4,yy(p.current),dy(p,p.current,_,a),Qe=O,Ga(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(js,p)}catch{}return!0}finally{W.p=f,F.T=l,Dy(e,r)}}function qy(e,r,a){r=Mn(a,r),r=Kf(e.stateNode,r,2),e=Wr(e,r,2),e!==null&&(Hn(e,2),sr(e))}function tt(e,r,a){if(e.tag===3)qy(e,e,a);else for(;r!==null;){if(r.tag===3){qy(r,e,a);break}else if(r.tag===1){var l=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(ss===null||!ss.has(l))){e=Mn(a,e),a=Bp(2),l=Wr(r,a,2),l!==null&&(Pp(a,l,r,e),Hn(l,2),sr(l));break}}r=r.return}}function xh(e,r,a){var l=e.pingCache;if(l===null){l=e.pingCache=new iw;var f=new Set;l.set(r,f)}else f=l.get(r),f===void 0&&(f=new Set,l.set(r,f));f.has(a)||(fh=!0,f.add(a),e=uw.bind(null,e,r,a),r.then(e,e))}function uw(e,r,a){var l=e.pingCache;l!==null&&l.delete(r),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,ot===e&&(ze&a)===a&&(xt===4||xt===3&&(ze&62914560)===ze&&300>ht()-Cl?(Qe&2)===0&&Ri(e,0):hh|=a,Ci===ze&&(Ci=0)),sr(e)}function By(e,r){r===0&&(r=ii()),e=qs(e,r),e!==null&&(Hn(e,r),sr(e))}function fw(e){var r=e.memoizedState,a=0;r!==null&&(a=r.retryLane),By(e,a)}function hw(e,r){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(i(314))}l!==null&&l.delete(r),By(e,a)}function dw(e,r){return la(e,r)}var Pl=null,Li=null,vh=!1,Ul=!1,_h=!1,os=0;function sr(e){e!==Li&&e.next===null&&(Li===null?Pl=Li=e:Li=Li.next=e),Ul=!0,vh||(vh=!0,pw())}function Ga(e,r){if(!_h&&Ul){_h=!0;do for(var a=!1,l=Pl;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var p=0;else{var _=l.suspendedLanes,O=l.pingedLanes;p=(1<<31-Ft(42|e)+1)-1,p&=f&~(_&~O),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,Iy(l,p))}else p=ze,p=ks(l,l===ot?p:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(p&3)===0||Ts(l,p)||(a=!0,Iy(l,p));l=l.next}while(a);_h=!1}}function mw(){Py()}function Py(){Ul=vh=!1;var e=0;os!==0&&Ow()&&(e=os);for(var r=ht(),a=null,l=Pl;l!==null;){var f=l.next,p=Uy(l,r);p===0?(l.next=null,a===null?Pl=f:a.next=f,f===null&&(Li=a)):(a=l,(e!==0||(p&3)!==0)&&(Ul=!0)),l=f}Rt!==0&&Rt!==5||Ga(e),os!==0&&(os=0)}function Uy(e,r){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var _=31-Ft(p),O=1<<_,M=f[_];M===-1?((O&a)===0||(O&l)!==0)&&(f[_]=fa(O,r)):M<=r&&(e.expiredLanes|=O),p&=~O}if(r=ot,a=ze,a=ks(e,e===r?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===r&&(et===2||et===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&ur(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Ts(e,a)){if(r=a&-a,r===e.callbackPriority)return r;switch(l!==null&&ur(l),Cs(a)){case 2:case 8:a=zo;break;case 32:a=ri;break;case 268435456:a=Io;break;default:a=ri}return l=zy.bind(null,e),a=la(a,l),e.callbackPriority=r,e.callbackNode=a,r}return l!==null&&l!==null&&ur(l),e.callbackPriority=2,e.callbackNode=null,2}function zy(e,r){if(Rt!==0&&Rt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Bl()&&e.callbackNode!==a)return null;var l=ze;return l=ks(e,e===ot?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(_y(e,l,r),Uy(e,ht()),e.callbackNode!=null&&e.callbackNode===a?zy.bind(null,e):null)}function Iy(e,r){if(Bl())return null;_y(e,r,!0)}function pw(){jw(function(){(Qe&6)!==0?la(Uo,mw):Py()})}function wh(){if(os===0){var e=vi;e===0&&(e=Ur,Ur<<=1,(Ur&261888)===0&&(Ur=256)),os=e}return os}function $y(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Yo(""+e)}function Hy(e,r){var a=r.ownerDocument.createElement("input");return a.name=r.name,a.value=r.value,e.id&&a.setAttribute("form",e.id),r.parentNode.insertBefore(a,r),e=new FormData(e),a.parentNode.removeChild(a),e}function yw(e,r,a,l,f){if(r==="submit"&&a&&a.stateNode===f){var p=$y((f[gt]||null).action),_=l.submitter;_&&(r=(r=_[gt]||null)?$y(r.formAction):_.getAttribute("formAction"),r!==null&&(p=r,_=null));var O=new Qo("action","action",null,l,f);e.push({event:O,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(os!==0){var M=_?Hy(f,_):new FormData(f);$f(a,{pending:!0,data:M,method:f.method,action:p},null,M)}}else typeof p=="function"&&(O.preventDefault(),M=_?Hy(f,_):new FormData(f),$f(a,{pending:!0,data:M,method:f.method,action:p},p,M))},currentTarget:f}]})}}for(var Sh=0;Sh<sf.length;Sh++){var Eh=sf[Sh],gw=Eh.toLowerCase(),bw=Eh[0].toUpperCase()+Eh.slice(1);Gn(gw,"on"+bw)}Gn(v0,"onAnimationEnd"),Gn(_0,"onAnimationIteration"),Gn(w0,"onAnimationStart"),Gn("dblclick","onDoubleClick"),Gn("focusin","onFocus"),Gn("focusout","onBlur"),Gn(D_,"onTransitionRun"),Gn(L_,"onTransitionStart"),Gn(q_,"onTransitionCancel"),Gn(S0,"onTransitionEnd"),K("onMouseEnter",["mouseout","mouseover"]),K("onMouseLeave",["mouseout","mouseover"]),K("onPointerEnter",["pointerout","pointerover"]),K("onPointerLeave",["pointerout","pointerover"]),ie("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ie("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ie("onBeforeInput",["compositionend","keypress","textInput","paste"]),ie("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ie("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ie("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Va="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),xw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Va));function Fy(e,r){r=(r&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],f=l.event;l=l.listeners;e:{var p=void 0;if(r)for(var _=l.length-1;0<=_;_--){var O=l[_],M=O.instance,V=O.currentTarget;if(O=O.listener,M!==p&&f.isPropagationStopped())break e;p=O,f.currentTarget=V;try{p(f)}catch(Z){el(Z)}f.currentTarget=null,p=M}else for(_=0;_<l.length;_++){if(O=l[_],M=O.instance,V=O.currentTarget,O=O.listener,M!==p&&f.isPropagationStopped())break e;p=O,f.currentTarget=V;try{p(f)}catch(Z){el(Z)}f.currentTarget=null,p=M}}}}function Ue(e,r){var a=r[Ms];a===void 0&&(a=r[Ms]=new Set);var l=e+"__bubble";a.has(l)||(Gy(r,e,2,!1),a.add(l))}function Oh(e,r,a){var l=0;r&&(l|=4),Gy(a,e,l,r)}var zl="_reactListening"+Math.random().toString(36).slice(2);function Ah(e){if(!e[zl]){e[zl]=!0,z.forEach(function(a){a!=="selectionchange"&&(xw.has(a)||Oh(a,!1,e),Oh(a,!0,e))});var r=e.nodeType===9?e:e.ownerDocument;r===null||r[zl]||(r[zl]=!0,Oh("selectionchange",!1,r))}}function Gy(e,r,a,l){switch(vg(r)){case 2:var f=Yw;break;case 8:f=Kw;break;default:f=Ih}a=f.bind(null,r,a,e),f=void 0,!Gu||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(f=!0),l?f!==void 0?e.addEventListener(r,a,{capture:!0,passive:f}):e.addEventListener(r,a,!0):f!==void 0?e.addEventListener(r,a,{passive:f}):e.addEventListener(r,a,!1)}function jh(e,r,a,l,f){var p=l;if((r&1)===0&&(r&2)===0&&l!==null)e:for(;;){if(l===null)return;var _=l.tag;if(_===3||_===4){var O=l.stateNode.containerInfo;if(O===f)break;if(_===4)for(_=l.return;_!==null;){var M=_.tag;if((M===3||M===4)&&_.stateNode.containerInfo===f)return;_=_.return}for(;O!==null;){if(_=A(O),_===null)return;if(M=_.tag,M===5||M===6||M===26||M===27){l=p=_;continue e}O=O.parentNode}}l=l.return}Xm(function(){var V=p,Z=Hu(a),re=[];e:{var Y=E0.get(e);if(Y!==void 0){var J=Qo,be=e;switch(e){case"keypress":if(Jo(a)===0)break e;case"keydown":case"keyup":J=h_;break;case"focusin":be="focus",J=Ju;break;case"focusout":be="blur",J=Ju;break;case"beforeblur":case"afterblur":J=Ju;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":J=Zm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=e_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=p_;break;case v0:case _0:case w0:J=r_;break;case S0:J=g_;break;case"scroll":case"scrollend":J=Wv;break;case"wheel":J=x_;break;case"copy":case"cut":case"paste":J=i_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=t0;break;case"toggle":case"beforetoggle":J=__}var Ne=(r&4)!==0,it=!Ne&&(e==="scroll"||e==="scrollend"),U=Ne?Y!==null?Y+"Capture":null:Y;Ne=[];for(var P=V,G;P!==null;){var ee=P;if(G=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||G===null||U===null||(ee=ma(P,U),ee!=null&&Ne.push(Ya(P,ee,G))),it)break;P=P.return}0<Ne.length&&(Y=new J(Y,be,null,a,Z),re.push({event:Y,listeners:Ne}))}}if((r&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",J=e==="mouseout"||e==="pointerout",Y&&a!==$u&&(be=a.relatedTarget||a.fromElement)&&(A(be)||be[un]))break e;if((J||Y)&&(Y=Z.window===Z?Z:(Y=Z.ownerDocument)?Y.defaultView||Y.parentWindow:window,J?(be=a.relatedTarget||a.toElement,J=V,be=be?A(be):null,be!==null&&(it=c(be),Ne=be.tag,be!==it||Ne!==5&&Ne!==27&&Ne!==6)&&(be=null)):(J=null,be=V),J!==be)){if(Ne=Zm,ee="onMouseLeave",U="onMouseEnter",P="mouse",(e==="pointerout"||e==="pointerover")&&(Ne=t0,ee="onPointerLeave",U="onPointerEnter",P="pointer"),it=J==null?Y:k(J),G=be==null?Y:k(be),Y=new Ne(ee,P+"leave",J,a,Z),Y.target=it,Y.relatedTarget=G,ee=null,A(Z)===V&&(Ne=new Ne(U,P+"enter",be,a,Z),Ne.target=G,Ne.relatedTarget=it,ee=Ne),it=ee,J&&be)t:{for(Ne=vw,U=J,P=be,G=0,ee=U;ee;ee=Ne(ee))G++;ee=0;for(var Oe=P;Oe;Oe=Ne(Oe))ee++;for(;0<G-ee;)U=Ne(U),G--;for(;0<ee-G;)P=Ne(P),ee--;for(;G--;){if(U===P||P!==null&&U===P.alternate){Ne=U;break t}U=Ne(U),P=Ne(P)}Ne=null}else Ne=null;J!==null&&Vy(re,Y,J,Ne,!1),be!==null&&it!==null&&Vy(re,it,be,Ne,!0)}}e:{if(Y=V?k(V):window,J=Y.nodeName&&Y.nodeName.toLowerCase(),J==="select"||J==="input"&&Y.type==="file")var Je=c0;else if(o0(Y))if(u0)Je=C_;else{Je=T_;var _e=k_}else J=Y.nodeName,!J||J.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?V&&Iu(V.elementType)&&(Je=c0):Je=N_;if(Je&&(Je=Je(e,V))){l0(re,Je,a,Z);break e}_e&&_e(e,Y,V),e==="focusout"&&V&&Y.type==="number"&&V.memoizedProps.value!=null&&zu(Y,"number",Y.value)}switch(_e=V?k(V):window,e){case"focusin":(o0(_e)||_e.contentEditable==="true")&&(hi=_e,tf=V,wa=null);break;case"focusout":wa=tf=hi=null;break;case"mousedown":nf=!0;break;case"contextmenu":case"mouseup":case"dragend":nf=!1,b0(re,a,Z);break;case"selectionchange":if(R_)break;case"keydown":case"keyup":b0(re,a,Z)}var Le;if(Qu)e:{switch(e){case"compositionstart":var Ie="onCompositionStart";break e;case"compositionend":Ie="onCompositionEnd";break e;case"compositionupdate":Ie="onCompositionUpdate";break e}Ie=void 0}else fi?i0(e,a)&&(Ie="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ie="onCompositionStart");Ie&&(n0&&a.locale!=="ko"&&(fi||Ie!=="onCompositionStart"?Ie==="onCompositionEnd"&&fi&&(Le=Qm()):(Gr=Z,Vu="value"in Gr?Gr.value:Gr.textContent,fi=!0)),_e=Il(V,Ie),0<_e.length&&(Ie=new e0(Ie,e,null,a,Z),re.push({event:Ie,listeners:_e}),Le?Ie.data=Le:(Le=a0(a),Le!==null&&(Ie.data=Le)))),(Le=S_?E_(e,a):O_(e,a))&&(Ie=Il(V,"onBeforeInput"),0<Ie.length&&(_e=new e0("onBeforeInput","beforeinput",null,a,Z),re.push({event:_e,listeners:Ie}),_e.data=Le)),yw(re,e,V,a,Z)}Fy(re,r)})}function Ya(e,r,a){return{instance:e,listener:r,currentTarget:a}}function Il(e,r){for(var a=r+"Capture",l=[];e!==null;){var f=e,p=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||p===null||(f=ma(e,a),f!=null&&l.unshift(Ya(e,f,p)),f=ma(e,r),f!=null&&l.push(Ya(e,f,p))),e.tag===3)return l;e=e.return}return[]}function vw(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Vy(e,r,a,l,f){for(var p=r._reactName,_=[];a!==null&&a!==l;){var O=a,M=O.alternate,V=O.stateNode;if(O=O.tag,M!==null&&M===l)break;O!==5&&O!==26&&O!==27||V===null||(M=V,f?(V=ma(a,p),V!=null&&_.unshift(Ya(a,V,M))):f||(V=ma(a,p),V!=null&&_.push(Ya(a,V,M)))),a=a.return}_.length!==0&&e.push({event:r,listeners:_})}var _w=/\r\n?/g,ww=/\u0000|\uFFFD/g;function Yy(e){return(typeof e=="string"?e:""+e).replace(_w,`
|
|
26
|
-
`).replace(ww,"")}function Ky(e,r){return r=Yy(r),Yy(e)===r}function st(e,r,a,l,f,p){switch(a){case"children":typeof l=="string"?r==="body"||r==="textarea"&&l===""||li(e,l):(typeof l=="number"||typeof l=="bigint")&&r!=="body"&&li(e,""+l);break;case"className":Fn(e,"class",l);break;case"tabIndex":Fn(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Fn(e,a,l);break;case"style":Km(e,l,p);break;case"data":if(r!=="object"){Fn(e,"data",l);break}case"src":case"href":if(l===""&&(r!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Yo(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(a==="formAction"?(r!=="input"&&st(e,r,"name",f.name,f,null),st(e,r,"formEncType",f.formEncType,f,null),st(e,r,"formMethod",f.formMethod,f,null),st(e,r,"formTarget",f.formTarget,f,null)):(st(e,r,"encType",f.encType,f,null),st(e,r,"method",f.method,f,null),st(e,r,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Yo(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=mr);break;case"onScroll":l!=null&&Ue("scroll",e);break;case"onScrollEnd":l!=null&&Ue("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=Yo(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""+l):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":Ue("beforetoggle",e),Ue("toggle",e),Gt(e,"popover",l);break;case"xlinkActuate":dr(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":dr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":dr(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":dr(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":dr(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":dr(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":dr(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":dr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":dr(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Gt(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Xv.get(a)||a,Gt(e,a,l))}}function kh(e,r,a,l,f,p){switch(a){case"style":Km(e,l,p);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof l=="string"?li(e,l):(typeof l=="number"||typeof l=="bigint")&&li(e,""+l);break;case"onScroll":l!=null&&Ue("scroll",e);break;case"onScrollEnd":l!=null&&Ue("scrollend",e);break;case"onClick":l!=null&&(e.onclick=mr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ne.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),r=a.slice(2,f?a.length-7:void 0),p=e[gt]||null,p=p!=null?p[a]:null,typeof p=="function"&&e.removeEventListener(r,p,f),typeof l=="function")){typeof p!="function"&&p!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(r,l,f);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):Gt(e,a,l)}}}function $t(e,r,a){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ue("error",e),Ue("load",e);var l=!1,f=!1,p;for(p in a)if(a.hasOwnProperty(p)){var _=a[p];if(_!=null)switch(p){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:st(e,r,p,_,a,null)}}f&&st(e,r,"srcSet",a.srcSet,a,null),l&&st(e,r,"src",a.src,a,null);return;case"input":Ue("invalid",e);var O=p=_=f=null,M=null,V=null;for(l in a)if(a.hasOwnProperty(l)){var Z=a[l];if(Z!=null)switch(l){case"name":f=Z;break;case"type":_=Z;break;case"checked":M=Z;break;case"defaultChecked":V=Z;break;case"value":p=Z;break;case"defaultValue":O=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(i(137,r));break;default:st(e,r,l,Z,a,null)}}Fm(e,p,O,M,V,_,f,!1);return;case"select":Ue("invalid",e),l=_=p=null;for(f in a)if(a.hasOwnProperty(f)&&(O=a[f],O!=null))switch(f){case"value":p=O;break;case"defaultValue":_=O;break;case"multiple":l=O;default:st(e,r,f,O,a,null)}r=p,a=_,e.multiple=!!l,r!=null?oi(e,!!l,r,!1):a!=null&&oi(e,!!l,a,!0);return;case"textarea":Ue("invalid",e),p=f=l=null;for(_ in a)if(a.hasOwnProperty(_)&&(O=a[_],O!=null))switch(_){case"value":l=O;break;case"defaultValue":f=O;break;case"children":p=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(i(91));break;default:st(e,r,_,O,a,null)}Vm(e,l,f,p);return;case"option":for(M in a)if(a.hasOwnProperty(M)&&(l=a[M],l!=null))switch(M){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:st(e,r,M,l,a,null)}return;case"dialog":Ue("beforetoggle",e),Ue("toggle",e),Ue("cancel",e),Ue("close",e);break;case"iframe":case"object":Ue("load",e);break;case"video":case"audio":for(l=0;l<Va.length;l++)Ue(Va[l],e);break;case"image":Ue("error",e),Ue("load",e);break;case"details":Ue("toggle",e);break;case"embed":case"source":case"link":Ue("error",e),Ue("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(V in a)if(a.hasOwnProperty(V)&&(l=a[V],l!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:st(e,r,V,l,a,null)}return;default:if(Iu(r)){for(Z in a)a.hasOwnProperty(Z)&&(l=a[Z],l!==void 0&&kh(e,r,Z,l,a,void 0));return}}for(O in a)a.hasOwnProperty(O)&&(l=a[O],l!=null&&st(e,r,O,l,a,null))}function Sw(e,r,a,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,p=null,_=null,O=null,M=null,V=null,Z=null;for(J in a){var re=a[J];if(a.hasOwnProperty(J)&&re!=null)switch(J){case"checked":break;case"value":break;case"defaultValue":M=re;default:l.hasOwnProperty(J)||st(e,r,J,null,l,re)}}for(var Y in l){var J=l[Y];if(re=a[Y],l.hasOwnProperty(Y)&&(J!=null||re!=null))switch(Y){case"type":p=J;break;case"name":f=J;break;case"checked":V=J;break;case"defaultChecked":Z=J;break;case"value":_=J;break;case"defaultValue":O=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(i(137,r));break;default:J!==re&&st(e,r,Y,J,l,re)}}Uu(e,_,O,M,V,Z,p,f);return;case"select":J=_=O=Y=null;for(p in a)if(M=a[p],a.hasOwnProperty(p)&&M!=null)switch(p){case"value":break;case"multiple":J=M;default:l.hasOwnProperty(p)||st(e,r,p,null,l,M)}for(f in l)if(p=l[f],M=a[f],l.hasOwnProperty(f)&&(p!=null||M!=null))switch(f){case"value":Y=p;break;case"defaultValue":O=p;break;case"multiple":_=p;default:p!==M&&st(e,r,f,p,l,M)}r=O,a=_,l=J,Y!=null?oi(e,!!a,Y,!1):!!l!=!!a&&(r!=null?oi(e,!!a,r,!0):oi(e,!!a,a?[]:"",!1));return;case"textarea":J=Y=null;for(O in a)if(f=a[O],a.hasOwnProperty(O)&&f!=null&&!l.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:st(e,r,O,null,l,f)}for(_ in l)if(f=l[_],p=a[_],l.hasOwnProperty(_)&&(f!=null||p!=null))switch(_){case"value":Y=f;break;case"defaultValue":J=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(i(91));break;default:f!==p&&st(e,r,_,f,l,p)}Gm(e,Y,J);return;case"option":for(var be in a)if(Y=a[be],a.hasOwnProperty(be)&&Y!=null&&!l.hasOwnProperty(be))switch(be){case"selected":e.selected=!1;break;default:st(e,r,be,null,l,Y)}for(M in l)if(Y=l[M],J=a[M],l.hasOwnProperty(M)&&Y!==J&&(Y!=null||J!=null))switch(M){case"selected":e.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:st(e,r,M,Y,l,J)}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 Ne in a)Y=a[Ne],a.hasOwnProperty(Ne)&&Y!=null&&!l.hasOwnProperty(Ne)&&st(e,r,Ne,null,l,Y);for(V in l)if(Y=l[V],J=a[V],l.hasOwnProperty(V)&&Y!==J&&(Y!=null||J!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(i(137,r));break;default:st(e,r,V,Y,l,J)}return;default:if(Iu(r)){for(var it in a)Y=a[it],a.hasOwnProperty(it)&&Y!==void 0&&!l.hasOwnProperty(it)&&kh(e,r,it,void 0,l,Y);for(Z in l)Y=l[Z],J=a[Z],!l.hasOwnProperty(Z)||Y===J||Y===void 0&&J===void 0||kh(e,r,Z,Y,l,J);return}}for(var U in a)Y=a[U],a.hasOwnProperty(U)&&Y!=null&&!l.hasOwnProperty(U)&&st(e,r,U,null,l,Y);for(re in l)Y=l[re],J=a[re],!l.hasOwnProperty(re)||Y===J||Y==null&&J==null||st(e,r,re,Y,l,J)}function Jy(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ew(){if(typeof performance.getEntriesByType=="function"){for(var e=0,r=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],p=f.transferSize,_=f.initiatorType,O=f.duration;if(p&&O&&Jy(_)){for(_=0,O=f.responseEnd,l+=1;l<a.length;l++){var M=a[l],V=M.startTime;if(V>O)break;var Z=M.transferSize,re=M.initiatorType;Z&&Jy(re)&&(M=M.responseEnd,_+=Z*(M<O?1:(O-V)/(M-V)))}if(--l,r+=8*(p+_)/(f.duration/1e3),e++,10<e)break}}if(0<e)return r/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Th=null,Nh=null;function $l(e){return e.nodeType===9?e:e.ownerDocument}function Xy(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 Qy(e,r){if(e===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&r==="foreignObject"?0:e}function Ch(e,r){return e==="textarea"||e==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Mh=null;function Ow(){var e=window.event;return e&&e.type==="popstate"?e===Mh?!1:(Mh=e,!0):(Mh=null,!1)}var Wy=typeof setTimeout=="function"?setTimeout:void 0,Aw=typeof clearTimeout=="function"?clearTimeout:void 0,Zy=typeof Promise=="function"?Promise:void 0,jw=typeof queueMicrotask=="function"?queueMicrotask:typeof Zy<"u"?function(e){return Zy.resolve(null).then(e).catch(kw)}:Wy;function kw(e){setTimeout(function(){throw e})}function ls(e){return e==="head"}function eg(e,r){var a=r,l=0;do{var f=a.nextSibling;if(e.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(f),Ui(r);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Ka(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Ka(a);for(var p=a.firstChild;p;){var _=p.nextSibling,O=p.nodeName;p[Mt]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=_}}else a==="body"&&Ka(e.ownerDocument.body);a=f}while(a);Ui(r)}function tg(e,r){var a=e;e=0;do{var l=a.nextSibling;if(a.nodeType===1?r?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(r?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function Rh(e){var r=e.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var a=r;switch(r=r.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Rh(a),ai(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Tw(e,r,a,l){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==r.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Mt])switch(r){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(p=e.getAttribute("src"),(p!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(r==="input"&&e.type==="hidden"){var p=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=Bn(e.nextSibling),e===null)break}return null}function Nw(e,r,a){if(r==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Bn(e.nextSibling),e===null))return null;return e}function ng(e,r){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=Bn(e.nextSibling),e===null))return null;return e}function Dh(e){return e.data==="$?"||e.data==="$~"}function Lh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Cw(e,r){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=r;else if(e.data!=="$?"||a.readyState!=="loading")r();else{var l=function(){r(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Bn(e){for(;e!=null;e=e.nextSibling){var r=e.nodeType;if(r===1||r===3)break;if(r===8){if(r=e.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return e}var qh=null;function rg(e){e=e.nextSibling;for(var r=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(r===0)return Bn(e.nextSibling);r--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||r++}e=e.nextSibling}return null}function sg(e){e=e.previousSibling;for(var r=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(r===0)return e;r--}else a!=="/$"&&a!=="/&"||r++}e=e.previousSibling}return null}function ig(e,r,a){switch(r=$l(a),e){case"html":if(e=r.documentElement,!e)throw Error(i(452));return e;case"head":if(e=r.head,!e)throw Error(i(453));return e;case"body":if(e=r.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Ka(e){for(var r=e.attributes;r.length;)e.removeAttributeNode(r[0]);ai(e)}var Pn=new Map,ag=new Set;function Hl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Nr=W.d;W.d={f:Mw,r:Rw,D:Dw,C:Lw,L:qw,m:Bw,X:Uw,S:Pw,M:zw};function Mw(){var e=Nr.f(),r=Dl();return e||r}function Rw(e){var r=T(e);r!==null&&r.tag===5&&r.type==="form"?Sp(r):Nr.r(e)}var qi=typeof document>"u"?null:document;function og(e,r,a){var l=qi;if(l&&typeof r=="string"&&r){var f=Nn(r);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),ag.has(f)||(ag.add(f),e={rel:e,crossOrigin:a,href:r},l.querySelector(f)===null&&(r=l.createElement("link"),$t(r,"link",e),L(r),l.head.appendChild(r)))}}function Dw(e){Nr.D(e),og("dns-prefetch",e,null)}function Lw(e,r){Nr.C(e,r),og("preconnect",e,r)}function qw(e,r,a){Nr.L(e,r,a);var l=qi;if(l&&e&&r){var f='link[rel="preload"][as="'+Nn(r)+'"]';r==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Nn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Nn(a.imageSizes)+'"]')):f+='[href="'+Nn(e)+'"]';var p=f;switch(r){case"style":p=Bi(e);break;case"script":p=Pi(e)}Pn.has(p)||(e=b({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:e,as:r},a),Pn.set(p,e),l.querySelector(f)!==null||r==="style"&&l.querySelector(Ja(p))||r==="script"&&l.querySelector(Xa(p))||(r=l.createElement("link"),$t(r,"link",e),L(r),l.head.appendChild(r)))}}function Bw(e,r){Nr.m(e,r);var a=qi;if(a&&e){var l=r&&typeof r.as=="string"?r.as:"script",f='link[rel="modulepreload"][as="'+Nn(l)+'"][href="'+Nn(e)+'"]',p=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Pi(e)}if(!Pn.has(p)&&(e=b({rel:"modulepreload",href:e},r),Pn.set(p,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Xa(p)))return}l=a.createElement("link"),$t(l,"link",e),L(l),a.head.appendChild(l)}}}function Pw(e,r,a){Nr.S(e,r,a);var l=qi;if(l&&e){var f=N(l).hoistableStyles,p=Bi(e);r=r||"default";var _=f.get(p);if(!_){var O={loading:0,preload:null};if(_=l.querySelector(Ja(p)))O.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":r},a),(a=Pn.get(p))&&Bh(e,a);var M=_=l.createElement("link");L(M),$t(M,"link",e),M._p=new Promise(function(V,Z){M.onload=V,M.onerror=Z}),M.addEventListener("load",function(){O.loading|=1}),M.addEventListener("error",function(){O.loading|=2}),O.loading|=4,Fl(_,r,l)}_={type:"stylesheet",instance:_,count:1,state:O},f.set(p,_)}}}function Uw(e,r){Nr.X(e,r);var a=qi;if(a&&e){var l=N(a).hoistableScripts,f=Pi(e),p=l.get(f);p||(p=a.querySelector(Xa(f)),p||(e=b({src:e,async:!0},r),(r=Pn.get(f))&&Ph(e,r),p=a.createElement("script"),L(p),$t(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(f,p))}}function zw(e,r){Nr.M(e,r);var a=qi;if(a&&e){var l=N(a).hoistableScripts,f=Pi(e),p=l.get(f);p||(p=a.querySelector(Xa(f)),p||(e=b({src:e,async:!0,type:"module"},r),(r=Pn.get(f))&&Ph(e,r),p=a.createElement("script"),L(p),$t(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(f,p))}}function lg(e,r,a,l){var f=(f=Ct.current)?Hl(f):null;if(!f)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(r=Bi(a.href),a=N(f).hoistableStyles,l=a.get(r),l||(l={type:"style",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Bi(a.href);var p=N(f).hoistableStyles,_=p.get(e);if(_||(f=f.ownerDocument||f,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,_),(p=f.querySelector(Ja(e)))&&!p._p&&(_.instance=p,_.state.loading=5),Pn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Pn.set(e,a),p||Iw(f,e,a,_.state))),r&&l===null)throw Error(i(528,""));return _}if(r&&l!==null)throw Error(i(529,""));return null;case"script":return r=a.async,a=a.src,typeof a=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Pi(a),a=N(f).hoistableScripts,l=a.get(r),l||(l={type:"script",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Bi(e){return'href="'+Nn(e)+'"'}function Ja(e){return'link[rel="stylesheet"]['+e+"]"}function cg(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function Iw(e,r,a,l){e.querySelector('link[rel="preload"][as="style"]['+r+"]")?l.loading=1:(r=e.createElement("link"),l.preload=r,r.addEventListener("load",function(){return l.loading|=1}),r.addEventListener("error",function(){return l.loading|=2}),$t(r,"link",a),L(r),e.head.appendChild(r))}function Pi(e){return'[src="'+Nn(e)+'"]'}function Xa(e){return"script[async]"+e}function ug(e,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var l=e.querySelector('style[data-href~="'+Nn(a.href)+'"]');if(l)return r.instance=l,L(l),l;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),L(l),$t(l,"style",f),Fl(l,a.precedence,e),r.instance=l;case"stylesheet":f=Bi(a.href);var p=e.querySelector(Ja(f));if(p)return r.state.loading|=4,r.instance=p,L(p),p;l=cg(a),(f=Pn.get(f))&&Bh(l,f),p=(e.ownerDocument||e).createElement("link"),L(p);var _=p;return _._p=new Promise(function(O,M){_.onload=O,_.onerror=M}),$t(p,"link",l),r.state.loading|=4,Fl(p,a.precedence,e),r.instance=p;case"script":return p=Pi(a.src),(f=e.querySelector(Xa(p)))?(r.instance=f,L(f),f):(l=a,(f=Pn.get(p))&&(l=b({},a),Ph(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),L(f),$t(f,"link",l),e.head.appendChild(f),r.instance=f);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(l=r.instance,r.state.loading|=4,Fl(l,a.precedence,e));return r.instance}function Fl(e,r,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,p=f,_=0;_<l.length;_++){var O=l[_];if(O.dataset.precedence===r)p=O;else if(p!==f)break}p?p.parentNode.insertBefore(e,p.nextSibling):(r=a.nodeType===9?a.head:a,r.insertBefore(e,r.firstChild))}function Bh(e,r){e.crossOrigin==null&&(e.crossOrigin=r.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=r.referrerPolicy),e.title==null&&(e.title=r.title)}function Ph(e,r){e.crossOrigin==null&&(e.crossOrigin=r.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=r.referrerPolicy),e.integrity==null&&(e.integrity=r.integrity)}var Gl=null;function fg(e,r,a){if(Gl===null){var l=new Map,f=Gl=new Map;f.set(a,l)}else f=Gl,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var p=a[f];if(!(p[Mt]||p[at]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var _=p.getAttribute(r)||"";_=e+_;var O=l.get(_);O?O.push(p):l.set(_,[p])}}return l}function hg(e,r,a){e=e.ownerDocument||e,e.head.insertBefore(a,r==="title"?e.querySelector("head > title"):null)}function $w(e,r,a){if(a===1||r.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return e=r.disabled,typeof r.precedence=="string"&&e==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function dg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Hw(e,r,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=Bi(l.href),p=r.querySelector(Ja(f));if(p){r=p._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(e.count++,e=Vl.bind(e),r.then(e,e)),a.state.loading|=4,a.instance=p,L(p);return}p=r.ownerDocument||r,l=cg(l),(f=Pn.get(f))&&Bh(l,f),p=p.createElement("link"),L(p);var _=p;_._p=new Promise(function(O,M){_.onload=O,_.onerror=M}),$t(p,"link",l),a.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,r),(r=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Vl.bind(e),r.addEventListener("load",a),r.addEventListener("error",a))}}var Uh=0;function Fw(e,r){return e.stylesheets&&e.count===0&&Kl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&Kl(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+r);0<e.imgBytes&&Uh===0&&(Uh=62500*Ew());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Kl(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>Uh?50:800)+r);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function Vl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Kl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yl=null;function Kl(e,r){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yl=new Map,r.forEach(Gw,e),Yl=null,Vl.call(e))}function Gw(e,r){if(!(r.state.loading&4)){var a=Yl.get(e);if(a)var l=a.get(null);else{a=new Map,Yl.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<f.length;p++){var _=f[p];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(a.set(_.dataset.precedence,_),l=_)}l&&a.set(null,l)}f=r.instance,_=f.getAttribute("data-precedence"),p=a.get(_)||l,p===l&&a.set(null,f),a.set(_,f),this.count++,l=Vl.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),p?p.parentNode.insertBefore(f,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),r.state.loading|=4}}var Qa={$$typeof:se,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function Vw(e,r,a,l,f,p,_,O,M){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ir(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ir(0),this.hiddenUpdates=Ir(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=p,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function mg(e,r,a,l,f,p,_,O,M,V,Z,re){return e=new Vw(e,r,a,_,M,V,Z,re,O),r=1,p===!0&&(r|=24),p=hn(3,null,null,r),e.current=p,p.stateNode=e,r=bf(),r.refCount++,e.pooledCache=r,r.refCount++,p.memoizedState={element:l,isDehydrated:a,cache:r},wf(p),e}function pg(e){return e?(e=pi,e):pi}function yg(e,r,a,l,f,p){f=pg(f),l.context===null?l.context=f:l.pendingContext=f,l=Qr(r),l.payload={element:a},p=p===void 0?null:p,p!==null&&(l.callback=p),a=Wr(e,l,r),a!==null&&(an(a,e,r),Ta(a,e,r))}function gg(e,r){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<r?a:r}}function zh(e,r){gg(e,r),(e=e.alternate)&&gg(e,r)}function bg(e){if(e.tag===13||e.tag===31){var r=qs(e,67108864);r!==null&&an(r,e,67108864),zh(e,67108864)}}function xg(e){if(e.tag===13||e.tag===31){var r=gn();r=hr(r);var a=qs(e,r);a!==null&&an(a,e,r),zh(e,r)}}var Jl=!0;function Yw(e,r,a,l){var f=F.T;F.T=null;var p=W.p;try{W.p=2,Ih(e,r,a,l)}finally{W.p=p,F.T=f}}function Kw(e,r,a,l){var f=F.T;F.T=null;var p=W.p;try{W.p=8,Ih(e,r,a,l)}finally{W.p=p,F.T=f}}function Ih(e,r,a,l){if(Jl){var f=$h(l);if(f===null)jh(e,r,l,Xl,a),_g(e,l);else if(Xw(f,e,r,a,l))l.stopPropagation();else if(_g(e,l),r&4&&-1<Jw.indexOf(e)){for(;f!==null;){var p=T(f);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var _=$n(p.pendingLanes);if(_!==0){var O=p;for(O.pendingLanes|=2,O.entangledLanes|=2;_;){var M=1<<31-Ft(_);O.entanglements[1]|=M,_&=~M}sr(p),(Qe&6)===0&&(Ml=ht()+500,Ga(0))}}break;case 31:case 13:O=qs(p,2),O!==null&&an(O,p,2),Dl(),zh(p,2)}if(p=$h(l),p===null&&jh(e,r,l,Xl,a),p===f)break;f=p}f!==null&&l.stopPropagation()}else jh(e,r,l,null,a)}}function $h(e){return e=Hu(e),Hh(e)}var Xl=null;function Hh(e){if(Xl=null,e=A(e),e!==null){var r=c(e);if(r===null)e=null;else{var a=r.tag;if(a===13){if(e=m(r),e!==null)return e;e=null}else if(a===31){if(e=y(r),e!==null)return e;e=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;e=null}else r!==e&&(e=null)}}return Xl=e,null}function vg(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(Lu()){case Uo:return 2;case zo:return 8;case ri:case qu:return 32;case Io:return 268435456;default:return 32}default:return 32}}var Fh=!1,cs=null,us=null,fs=null,Wa=new Map,Za=new Map,hs=[],Jw="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 _g(e,r){switch(e){case"focusin":case"focusout":cs=null;break;case"dragenter":case"dragleave":us=null;break;case"mouseover":case"mouseout":fs=null;break;case"pointerover":case"pointerout":Wa.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Za.delete(r.pointerId)}}function eo(e,r,a,l,f,p){return e===null||e.nativeEvent!==p?(e={blockedOn:r,domEventName:a,eventSystemFlags:l,nativeEvent:p,targetContainers:[f]},r!==null&&(r=T(r),r!==null&&bg(r)),e):(e.eventSystemFlags|=l,r=e.targetContainers,f!==null&&r.indexOf(f)===-1&&r.push(f),e)}function Xw(e,r,a,l,f){switch(r){case"focusin":return cs=eo(cs,e,r,a,l,f),!0;case"dragenter":return us=eo(us,e,r,a,l,f),!0;case"mouseover":return fs=eo(fs,e,r,a,l,f),!0;case"pointerover":var p=f.pointerId;return Wa.set(p,eo(Wa.get(p)||null,e,r,a,l,f)),!0;case"gotpointercapture":return p=f.pointerId,Za.set(p,eo(Za.get(p)||null,e,r,a,l,f)),!0}return!1}function wg(e){var r=A(e.target);if(r!==null){var a=c(r);if(a!==null){if(r=a.tag,r===13){if(r=m(a),r!==null){e.blockedOn=r,Ho(e.priority,function(){xg(a)});return}}else if(r===31){if(r=y(a),r!==null){e.blockedOn=r,Ho(e.priority,function(){xg(a)});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ql(e){if(e.blockedOn!==null)return!1;for(var r=e.targetContainers;0<r.length;){var a=$h(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);$u=l,a.target.dispatchEvent(l),$u=null}else return r=T(a),r!==null&&bg(r),e.blockedOn=a,!1;r.shift()}return!0}function Sg(e,r,a){Ql(e)&&a.delete(r)}function Qw(){Fh=!1,cs!==null&&Ql(cs)&&(cs=null),us!==null&&Ql(us)&&(us=null),fs!==null&&Ql(fs)&&(fs=null),Wa.forEach(Sg),Za.forEach(Sg)}function Wl(e,r){e.blockedOn===r&&(e.blockedOn=null,Fh||(Fh=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Qw)))}var Zl=null;function Eg(e){Zl!==e&&(Zl=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Zl===e&&(Zl=null);for(var r=0;r<e.length;r+=3){var a=e[r],l=e[r+1],f=e[r+2];if(typeof l!="function"){if(Hh(l||a)===null)continue;break}var p=T(a);p!==null&&(e.splice(r,3),r-=3,$f(p,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function Ui(e){function r(M){return Wl(M,e)}cs!==null&&Wl(cs,e),us!==null&&Wl(us,e),fs!==null&&Wl(fs,e),Wa.forEach(r),Za.forEach(r);for(var a=0;a<hs.length;a++){var l=hs[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<hs.length&&(a=hs[0],a.blockedOn===null);)wg(a),a.blockedOn===null&&hs.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],p=a[l+1],_=f[gt]||null;if(typeof p=="function")_||Eg(a);else if(_){var O=null;if(p&&p.hasAttribute("formAction")){if(f=p,_=p[gt]||null)O=_.formAction;else if(Hh(f)!==null)continue}else O=_.action;typeof O=="function"?a[l+1]=O:(a.splice(l,3),l-=3),Eg(a)}}}function Og(){function e(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(_){return f=_})},focusReset:"manual",scroll:"manual"})}function r(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),f!==null&&(f(),f=null)}}}function Gh(e){this._internalRoot=e}ec.prototype.render=Gh.prototype.render=function(e){var r=this._internalRoot;if(r===null)throw Error(i(409));var a=r.current,l=gn();yg(a,l,e,r,null,null)},ec.prototype.unmount=Gh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var r=e.containerInfo;yg(e.current,2,null,e,null,null),Dl(),r[un]=null}};function ec(e){this._internalRoot=e}ec.prototype.unstable_scheduleHydration=function(e){if(e){var r=ha();e={blockedOn:null,target:e,priority:r};for(var a=0;a<hs.length&&r!==0&&r<hs[a].priority;a++);hs.splice(a,0,e),a===0&&wg(e)}};var Ag=t.version;if(Ag!=="19.2.4")throw Error(i(527,Ag,"19.2.4"));W.findDOMNode=function(e){var r=e._reactInternals;if(r===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=u(r),e=e!==null?d(e):null,e=e===null?null:e.stateNode,e};var Ww={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var tc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tc.isDisabled&&tc.supportsFiber)try{js=tc.inject(Ww),_t=tc}catch{}}return to.createRoot=function(e,r){if(!o(e))throw Error(i(299));var a=!1,l="",f=Rp,p=Dp,_=Lp;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(l=r.identifierPrefix),r.onUncaughtError!==void 0&&(f=r.onUncaughtError),r.onCaughtError!==void 0&&(p=r.onCaughtError),r.onRecoverableError!==void 0&&(_=r.onRecoverableError)),r=mg(e,1,!1,null,null,a,l,null,f,p,_,Og),e[un]=r.current,Ah(e),new Gh(r)},to.hydrateRoot=function(e,r,a){if(!o(e))throw Error(i(299));var l=!1,f="",p=Rp,_=Dp,O=Lp,M=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(_=a.onCaughtError),a.onRecoverableError!==void 0&&(O=a.onRecoverableError),a.formState!==void 0&&(M=a.formState)),r=mg(e,1,!0,r,a??null,l,f,M,p,_,O,Og),r.context=pg(null),a=r.current,l=gn(),l=hr(l),f=Qr(l),f.callback=null,Wr(a,f,l),a=l,r.current.lanes=a,Hn(r,a),sr(r),e[un]=r.current,Ah(e),new ec(r)},to.version="19.2.4",to}var Rg;function $S(){if(Rg)return Vh.exports;Rg=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),Vh.exports=IS(),Vh.exports}var HS=$S();const FS="modulepreload",GS=function(n,t){return new URL(n,t).href},Dg={},je=function(t,s,i){let o=Promise.resolve();if(s&&s.length>0){let m=function(d){return Promise.all(d.map(b=>Promise.resolve(b).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const y=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),u=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=m(s.map(d=>{if(d=GS(d,i),d in Dg)return;Dg[d]=!0;const b=d.endsWith(".css"),x=b?'[rel="stylesheet"]':"";if(!!i)for(let S=y.length-1;S>=0;S--){const C=y[S];if(C.href===d&&(!b||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${x}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":FS,b||(w.as="script"),w.crossOrigin="",w.href=d,u&&w.setAttribute("nonce",u),document.head.appendChild(w),b)return new Promise((S,C)=>{w.addEventListener("load",S),w.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${d}`)))})}))}function c(m){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=m,window.dispatchEvent(y),!y.defaultPrevented)throw m}return o.then(m=>{for(const y of m||[])y.status==="rejected"&&c(y.reason);return t().catch(c)})};function Su(n){try{const t=n.split(".");if(t.length!==3)return null;const s=atob(t[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function lx(n){const t=Su(n);return!t||typeof t.exp!="number"?null:t.exp}function nm(n,t=0){const s=lx(n);return s===null?!0:Date.now()/1e3>=s-t}const Ht=window.__LT_BASE__??"",gd=`${Ht}/api`;class Lg extends Error{constructor(t,s,i){super(t),this.status=s,this.body=i,this.name="ApiError"}}let gs=null;function nc(n){gs=n}function cx(){return gs}const VS="X-LT-Acting-Token",YS="X-LT-Acting-Remaining";let Zc=null,eu=null;function qg(n){Zc=n}let tu=null;function Bg(n){tu=n}function Pg(n){eu=n}function KS(n){const t=n==null?void 0:n.error;return typeof t=="string"&&/acting[- ]identity/i.test(t)}async function Ug(){const n=sessionStorage.getItem("lt_credentials");if(!n)return null;try{const{username:t,password:s}=JSON.parse(n),i=await fetch(`${gd}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:s})});if(!i.ok)return null;const o=await i.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let ms=null;async function fe(n,t={}){const s={"Content-Type":"application/json",...t.headers};if(gs){if(nm(gs)){ms||(ms=Ug().finally(()=>{ms=null}));const y=await ms;if(y)gs=y,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:y}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${gs}`}const o=(t.method??"GET").toUpperCase()==="GET"?null:(Zc==null?void 0:Zc())??null;o&&(s[VS]=o);let c=await fetch(`${gd}${n}`,{...t,headers:s});const m=o?c.headers.get(YS):null;if(o&&m!==null&&(tu==null||tu(o,m==="unbounded"?null:Number(m))),c.status===401&&o){const y=await c.clone().json().catch(()=>null);if(KS(y))throw eu==null||eu(),new Lg(y.error,401,y)}if(c.status===401&&gs){ms||(ms=Ug().finally(()=>{ms=null}));const y=await ms;if(y&&(gs=y,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:y}})),s.Authorization=`Bearer ${y}`,c=await fetch(`${gd}${n}`,{...t,headers:s})),c.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(c.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!c.ok){const y=await c.json().catch(()=>({error:c.statusText}));throw new Lg(y.message||y.error||c.statusText,c.status,y)}return c.json()}const JS="lt_ai_override";let rc=null;function rm(){return rc||(rc=fetch(`${Ht}/api/settings`).then(n=>{if(!n.ok)throw new Error(`settings ${n.status}`);return n.json()}).catch(n=>{throw rc=null,n})),rc}function XS(){try{if(localStorage.getItem(JS)==="off")return!1}catch{}return null}function Zn(){var s;const n=$e({queryKey:["settings"],queryFn:rm,staleTime:1/0}),t=XS();return n.data&&t===!1&&((s=n.data.ai)!=null&&s.enabled)?{...n,data:{...n.data,ai:{enabled:!1}}}:n}function QS(n){var u,d,b;const{data:t}=Zn(),s=((u=t==null?void 0:t.auth)==null?void 0:u.ssoKeepaliveSeconds)??0,i=((d=t==null?void 0:t.auth)==null?void 0:d.ssoKeepaliveIdleTimeoutSeconds)??0,o=E.useRef(Date.now()),c=E.useRef(Date.now()),m=E.useRef(!1),g=!!n&&((b=Su(n))==null?void 0:b.sso)===!0&&s>0;E.useEffect(()=>{if(!g)return;const x=()=>{o.current=Date.now()};window.addEventListener("pointerdown",x,{passive:!0}),window.addEventListener("keydown",x,{passive:!0}),window.addEventListener("wheel",x,{passive:!0});const v=async()=>{if(!m.current&&document.visibilityState==="visible"&&!(i>0&&Date.now()-o.current>i*1e3)){m.current=!0;try{const C=await fetch(`${Ht}/api/auth/sso`,{method:"POST"});if(C.status===401||C.status===403){window.dispatchEvent(new CustomEvent("auth:unauthorized"));return}if(!C.ok)return;const q=await C.json().catch(()=>null);q!=null&&q.token&&(c.current=Date.now(),window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:q.token}})))}catch{}finally{m.current=!1}}},w=setInterval(v,s*1e3),S=()=>{document.visibilityState==="visible"&&Date.now()-c.current>s*1e3&&v()};return document.addEventListener("visibilitychange",S),()=>{clearInterval(w),document.removeEventListener("visibilitychange",S),window.removeEventListener("pointerdown",x),window.removeEventListener("keydown",x),window.removeEventListener("wheel",x)}},[g,s,i])}const ux=E.createContext(null),WS=300;function Jh(n,t){if(nm(n))return null;const s=Su(n);if(!s)return null;const i=t??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(i==null?void 0:i.displayName)??null,username:(i==null?void 0:i.username)??null,roles:s.roles??[]}}function ZS({children:n}){const[t,s]=E.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?nm(b)?(sessionStorage.removeItem("lt_token"),null):(nc(b),Jh(b)):null}),i=E.useRef(void 0),o=E.useCallback(b=>{clearTimeout(i.current);const x=lx(b);if(!x)return;const v=(x-WS)*1e3-Date.now();v<=0||(i.current=setTimeout(async()=>{try{const w=Su(b);if(w!=null&&w.sso){const le=await fetch(`${Ht}/api/auth/sso`,{method:"POST"});if(!le.ok)return;const R=await le.json();R.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:R.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:C,password:q}=JSON.parse(S),B=await fetch(`${Ht}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:C,password:q})});if(!B.ok)return;const se=await B.json();se.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:se.token}}))}catch{}},v))},[]),c=E.useCallback((b,x,v)=>{const w={displayName:(v==null?void 0:v.displayName)??null,username:(v==null?void 0:v.username)??(x==null?void 0:x.username)??null},S=Jh(b,w);S&&(nc(b),sessionStorage.setItem("lt_token",b),sessionStorage.setItem("lt_user_info",JSON.stringify(w)),x&&sessionStorage.setItem("lt_credentials",JSON.stringify(x)),s(S),o(b))},[o]),m=E.useCallback(()=>{clearTimeout(i.current);const b=sessionStorage.getItem("lt_sso_logout_url");nc(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),b&&(window.location.href=b)},[]);E.useEffect(()=>{const b=()=>m(),x=v=>{var C;const w=(C=v.detail)==null?void 0:C.token;if(!w)return;const S=Jh(w);S&&(nc(w),sessionStorage.setItem("lt_token",w),s(S),o(w))};return window.addEventListener("auth:unauthorized",b),window.addEventListener("auth:refreshed",x),()=>{window.removeEventListener("auth:unauthorized",b),window.removeEventListener("auth:refreshed",x)}},[m,o]),E.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&t&&o(b),()=>clearTimeout(i.current)},[]);const y=(t==null?void 0:t.roles.some(b=>b.type==="superadmin"))??!1,g=E.useCallback(b=>(t==null?void 0:t.roles.some(x=>x.role===b))??!1,[t]),u=E.useCallback(b=>(t==null?void 0:t.roles.some(x=>x.type===b))??!1,[t]),d=(t==null?void 0:t.roles.map(b=>b.role))??[];return h.jsxs(ux.Provider,{value:{user:t,isAuthenticated:!!t,isSuperAdmin:y,login:c,logout:m,hasRole:g,hasRoleType:u,userRoleNames:d},children:[h.jsx(eE,{authenticated:t!==null}),n]})}function eE({authenticated:n}){return QS(n?sessionStorage.getItem("lt_token"):null),null}function Pt(){const n=E.useContext(ux);if(!n)throw new Error("useAuth must be used within AuthProvider");return n}const An=new Uint8Array(0),ti=new TextEncoder,Sn=new TextDecoder;function tE(...n){let t=0;for(let o=0;o<n.length;o++)t+=n[o].length;const s=new Uint8Array(t);let i=0;for(let o=0;o<n.length;o++)s.set(n[o],i),i+=n[o].length;return s}function go(...n){const t=[];for(let s=0;s<n.length;s++)t.push(ti.encode(n[s]));return t.length===0?An:t.length===1?t[0]:tE(...t)}function zg(n){return!n||n.length===0?"":Sn.decode(n)}const Ig="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",$g=36,nE=0xcfd41b9100000,Hg=33,rE=333,Fg=22;function sE(n){for(let t=0;t<n.length;t++)n[t]=Math.floor(Math.random()*255)}function iE(n){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(n):sE(n)}class aE{constructor(){j(this,"buf");j(this,"seq");j(this,"inc");j(this,"inited");this.buf=new Uint8Array(Fg),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*nE),this.inc=Math.floor(Math.random()*(rE-Hg)+Hg)}setPre(){const t=new Uint8Array(12);iE(t);for(let s=0;s<12;s++){const i=t[s]%36;this.buf[s]=Ig.charCodeAt(i)}}fillSeq(){let t=this.seq;for(let s=Fg-1;s>=12;s--)this.buf[s]=Ig.charCodeAt(t%$g),t=Math.floor(t/$g)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const Es=new aE;var Rr;(function(n){n.Disconnect="disconnect",n.Reconnect="reconnect",n.Update="update",n.LDM="ldm",n.Error="error"})(Rr||(Rr={}));var Yi;(function(n){n.Reconnecting="reconnecting",n.PingTimer="pingTimer",n.StaleConnection="staleConnection",n.ClientInitiatedReconnect="client initiated reconnect"})(Yi||(Yi={}));var ue;(function(n){n.ApiError="BAD API",n.BadAuthentication="BAD_AUTHENTICATION",n.BadCreds="BAD_CREDS",n.BadHeader="BAD_HEADER",n.BadJson="BAD_JSON",n.BadPayload="BAD_PAYLOAD",n.BadSubject="BAD_SUBJECT",n.Cancelled="CANCELLED",n.ConnectionClosed="CONNECTION_CLOSED",n.ConnectionDraining="CONNECTION_DRAINING",n.ConnectionRefused="CONNECTION_REFUSED",n.ConnectionTimeout="CONNECTION_TIMEOUT",n.Disconnect="DISCONNECT",n.InvalidOption="INVALID_OPTION",n.InvalidPayload="INVALID_PAYLOAD",n.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",n.NoResponders="503",n.NotFunction="NOT_FUNC",n.RequestError="REQUEST_ERROR",n.ServerOptionNotAvailable="SERVER_OPT_NA",n.SubClosed="SUB_CLOSED",n.SubDraining="SUB_DRAINING",n.Timeout="TIMEOUT",n.Tls="TLS",n.Unknown="UNKNOWN_ERROR",n.WssRequired="WSS_REQUIRED",n.JetStreamInvalidAck="JESTREAM_INVALID_ACK",n.JetStream404NoMessages="404",n.JetStream408RequestTimeout="408",n.JetStream409MaxAckPendingExceeded="409",n.JetStream409="409",n.JetStreamNotEnabled="503",n.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",n.AuthorizationViolation="AUTHORIZATION_VIOLATION",n.AuthenticationExpired="AUTHENTICATION_EXPIRED",n.ProtocolError="NATS_PROTOCOL_ERR",n.PermissionsViolation="PERMISSIONS_VIOLATION",n.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",n.AccountExpired="ACCOUNT_EXPIRED"})(ue||(ue={}));function oE(n){return typeof n.code=="string"}class fx{constructor(){j(this,"messages");this.messages=new Map,this.messages.set(ue.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ue.BadJson,"Bad JSON"),this.messages.set(ue.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return lE.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const lE=new fx;class ye extends Error{constructor(s,i,o){super(s);j(this,"name");j(this,"message");j(this,"code");j(this,"permissionContext");j(this,"chainedError");j(this,"api_error");this.name="NatsError",this.message=s,this.code=i,this.chainedError=o}static errorForCode(s,i){const o=fx.getMessage(s);return new ye(o,s,i)}isAuthError(){return this.code===ue.AuthenticationExpired||this.code===ue.AuthorizationViolation||this.code===ue.AccountExpired}isAuthTimeout(){return this.code===ue.AuthenticationTimeout}isPermissionError(){return this.code===ue.PermissionsViolation}isProtocolError(){return this.code===ue.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var vn;(function(n){n[n.Exact=0]="Exact",n[n.CanonicalMIME=1]="CanonicalMIME",n[n.IgnoreCase=2]="IgnoreCase"})(vn||(vn={}));var Qn;(function(n){n.Timer="timer",n.Count="count",n.JitterTimer="jitterTimer",n.SentinelMsg="sentinelMsg"})(Qn||(Qn={}));var bo;(function(n){n.STATS="io.nats.micro.v1.stats_response",n.INFO="io.nats.micro.v1.info_response",n.PING="io.nats.micro.v1.ping_response"})(bo||(bo={}));const cu="Nats-Service-Error",uu="Nats-Service-Error-Code";class fu extends Error{constructor(s,i){super(i);j(this,"code");this.code=s}static isServiceError(s){return fu.toServiceError(s)!==null}static toServiceError(s){var o,c;const i=((o=s==null?void 0:s.headers)==null?void 0:o.get(uu))||"";if(i!==""){const m=parseInt(i)||400,y=((c=s==null?void 0:s.headers)==null?void 0:c.get(cu))||"";return new fu(m,y.length?y:i)}return null}}function Dr(n=""){if(n=n||"_INBOX",typeof n!="string")throw new Error("prefix must be a string");return n.split(".").forEach(t=>{if(t==="*"||t===">")throw new Error(`inbox prefixes cannot have wildcards '${n}'`)}),`${n}.${Es.next()}`}const bd="127.0.0.1";var xs;(function(n){n.PING="PING",n.STATS="STATS",n.INFO="INFO"})(xs||(xs={}));function Eu(n,...t){for(let s=0;s<t.length;s++){const i=t[s];Object.keys(i).forEach(function(o){n[o]=i[o]})}return n}function sc(n){return Sn.decode(n).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ea(n,t=!0){const s=t?ye.errorForCode(ue.Timeout):null;let i,o;const c=new Promise((m,y)=>{i={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{y(s===null?ye.errorForCode(ue.Timeout):s)},n)});return Object.assign(c,i)}function sa(n=0){let t;const s=new Promise(i=>{const o=setTimeout(()=>{i()},n);t={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,t)}function pt(){let n={};const t=new Promise((s,i)=>{n={resolve:s,reject:i}});return Object.assign(t,n)}function hx(n){for(let t=n.length-1;t>0;t--){const s=Math.floor(Math.random()*(t+1));[n[t],n[s]]=[n[s],n[t]]}return n}function cE(n){return n===0?0:Math.floor(n/2+Math.random()*n)}function sm(n=[0,250,250,500,500,3e3,5e3]){Array.isArray(n)||(n=[0,250,250,500,500,3e3,5e3]);const t=n.length-1;return{backoff(s){return cE(s>t?n[t]:n[s])}}}function mt(n){return n*1e6}function im(n){return Math.floor(n/1e6)}function Gg(n){let i=!0;const o=new Array(n.length);for(let c=0;c<n.length;c++){let m=n.charCodeAt(c);if(m===58||m<33||m>126)throw new ye(`'${n[c]}' is not a valid character for a header key`,ue.BadHeader);i&&97<=m&&m<=122?m-=32:!i&&65<=m&&m<=90&&(m+=32),o[c]=m,i=m==45}return String.fromCharCode(...o)}function qr(n=0,t=""){if(n===0&&t!==""||n>0&&t==="")throw new Error("setting status requires both code and description");return new vs(n,t)}const Xh="NATS/1.0";class vs{constructor(t=0,s=""){j(this,"_code");j(this,"headers");j(this,"_description");this._code=t,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(t){if(t&&this.headers.size===t.headers.size&&this._code===t._code){for(const[s,i]of this.headers){const o=t.values(s);if(i.length!==o.length)return!1;const c=[...i].sort(),m=[...o].sort();for(let y=0;y<c.length;y++)if(c[y]!==m[y])return!1}return!0}return!1}static decode(t){const s=new vs,o=Sn.decode(t).split(`\r
|
|
27
|
-
`),c=o[0];if(c!==Xh){let m=c.replace(Xh,"").trim();if(m.length>0){s._code=parseInt(m,10),isNaN(s._code)&&(s._code=0);const y=s._code.toString();m=m.replace(y,""),s._description=m.trim()}}return o.length>=1&&o.slice(1).map(m=>{if(m){const y=m.indexOf(":");if(y>-1){const g=m.slice(0,y),u=m.slice(y+1).trim();s.append(g,u)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let t=Xh;this._code>0&&this._description!==""&&(t+=` ${this._code} ${this._description}`);for(const[s,i]of this.headers)for(let o=0;o<i.length;o++)t=`${t}\r
|
|
28
|
-
${s}: ${i[o]}`;return`${t}\r
|
|
29
|
-
\r
|
|
30
|
-
`}encode(){return ti.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new ye("invalid header value - \\r and \\n are not allowed.",ue.BadHeader);return t.trim()}keys(){const t=[];for(const s of this.headers.keys())t.push(s);return t}findKeys(t,s=vn.Exact){const i=this.keys();switch(s){case vn.Exact:return i.filter(o=>o===t);case vn.CanonicalMIME:return t=Gg(t),i.filter(o=>o===t);default:{const o=t.toLowerCase();return i.filter(c=>o===c.toLowerCase())}}}get(t,s=vn.Exact){const i=this.findKeys(t,s);if(i.length){const o=this.headers.get(i[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(t,s=vn.Exact){const i=this.findKeys(t,s);if(i.length){const o=this.headers.get(i[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(t,s=vn.Exact){return this.findKeys(t,s).length>0}set(t,s,i=vn.Exact){this.delete(t,i),this.append(t,s,i)}append(t,s,i=vn.Exact){const o=Gg(t);i===vn.CanonicalMIME&&(t=o);const c=this.findKeys(t,i);t=c.length>0?c[0]:t;const m=vs.validHeaderValue(s);let y=this.headers.get(t);y||(y=[],this.headers.set(t,y)),y.push(m)}values(t,s=vn.Exact){const i=[];return this.findKeys(t,s).forEach(c=>{const m=this.headers.get(c);m&&i.push(...m)}),i}delete(t,s=vn.Exact){this.findKeys(t,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const t={};return this.keys().forEach(s=>{t[s]=this.values(s)}),t}get code(){return this._code}get description(){return this._description}static fromRecord(t){const s=new vs;for(const i in t)s.headers.set(i,t[i]);return s}}function xd(){return{encode(n){return ti.encode(n)},decode(n){return Sn.decode(n)}}}function Wn(n){return{encode(t){try{return t===void 0&&(t=null),ti.encode(JSON.stringify(t))}catch(s){throw ye.errorForCode(ue.BadJson,s)}},decode(t){try{return JSON.parse(Sn.decode(t),n)}catch(s){throw ye.errorForCode(ue.BadJson,s)}}}}function dx(n){var t;return n&&n.data.length===0&&((t=n.headers)==null?void 0:t.code)===503?ye.errorForCode(ue.NoResponders):null}class am{constructor(t,s,i){j(this,"_headers");j(this,"_msg");j(this,"_rdata");j(this,"_reply");j(this,"_subject");j(this,"publisher");this._msg=t,this._rdata=s,this.publisher=i}get subject(){return this._subject?this._subject:(this._subject=Sn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=Sn.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const t=this._rdata.subarray(0,this._msg.hdr);this._headers=vs.decode(t)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(t=An,s){return this.reply?(this.publisher.publish(this.reply,t,s),!0):!1}size(){var o;const t=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,i=this._msg.size===-1?0:this._msg.size;return t+s+i}json(t){return Wn(t).decode(this.data)}string(){return Sn.decode(this.data)}requestInfo(){var s;const t=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return t?JSON.parse(t,function(i,o){return(i==="start"||i==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}j(am,"jc");function Ki(n){return Ou("durable",n)}function Kt(n){return Ou("stream",n)}function Ou(n,t=""){if(t==="")throw Error(`${n} name required`);return[".","*",">","/","\\"," "," ",`
|
|
31
|
-
`,"\r"].forEach(i=>{if(t.indexOf(i)!==-1){switch(i){case`
|
|
32
|
-
`:i="\\n";break;case"\r":i="\\r";break;case" ":i="\\t";break}throw Error(`invalid ${n} name - ${n} name cannot contain '${i}'`)}}),""}function mo(n,t=""){if(t==="")throw Error(`${n} name required`);const s=uE(t);if(s.length)throw new Error(`invalid ${n} name - ${n} name ${s}`)}function uE(n=""){if(n==="")throw Error("name required");const t=/^[-\w]+$/g;if(n.match(t)===null){for(const i of n.split(""))if(i.match(t)===null)return`cannot contain '${i}'`}return""}function vd(n){if(n.data.length>0)return!1;const t=n.headers;return t?t.code>=100&&t.code<200:!1}function _d(n){var t;return vd(n)&&((t=n.headers)==null?void 0:t.description)==="Idle Heartbeat"}function fE(n,t,s){const i=qr(n,t),o={hdr:1,sid:0,size:0},c=new am(o,An,{});return c._headers=i,c._subject=s,c}function Ji(n){if(n.data.length!==0)return null;const t=n.headers;return t?mx(t.code,t.description):null}var zn;(function(n){n.MaxBatchExceeded="exceeded maxrequestbatch of",n.MaxExpiresExceeded="exceeded maxrequestexpires of",n.MaxBytesExceeded="exceeded maxrequestmaxbytes of",n.MaxMessageSizeExceeded="message size exceeds maxbytes",n.PushConsumer="consumer is push based",n.MaxWaitingExceeded="exceeded maxwaiting",n.IdleHeartbeatMissed="idle heartbeats missed",n.ConsumerDeleted="consumer deleted"})(zn||(zn={}));function hE(n){return n.code!==ue.JetStream409?!1:[zn.MaxBatchExceeded,zn.MaxExpiresExceeded,zn.MaxBytesExceeded,zn.MaxMessageSizeExceeded,zn.PushConsumer,zn.IdleHeartbeatMissed,zn.ConsumerDeleted].find(s=>n.message.indexOf(s)!==-1)!==void 0}function mx(n,t=""){if(n<300)return null;switch(t=t.toLowerCase(),n){case 404:return new ye(t,ue.JetStream404NoMessages);case 408:return new ye(t,ue.JetStream408RequestTimeout);case 409:{const s=t.startsWith(zn.IdleHeartbeatMissed)?ue.JetStreamIdleHeartBeat:ue.JetStream409;return new ye(t,s)}case 503:return ye.errorForCode(ue.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=ue.Unknown),new ye(t,`${n}`)}}class Bt{constructor(){j(this,"inflight");j(this,"processed");j(this,"received");j(this,"noIterator");j(this,"iterClosed");j(this,"done");j(this,"signal");j(this,"yields");j(this,"filtered");j(this,"pendingFiltered");j(this,"ingestionFilterFn");j(this,"protocolFilterFn");j(this,"dispatchedFn");j(this,"ctx");j(this,"_data");j(this,"err");j(this,"time");j(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=pt(),this.yields=[],this.iterClosed=pt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(t){if(this.done)return;if(typeof t=="function"){this.yields.push(t),this.signal.resolve();return}const{ingest:s,protocol:i}=this.ingestionFilterFn?this.ingestionFilterFn(t,this.ctx||this):{ingest:!0,protocol:!1};s&&(i&&(this.filtered++,this.pendingFiltered++),this.yields.push(t),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new ye("unsupported iterator",ue.ApiError);if(this.yielding)throw new ye("already yielding",ue.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const t=this.yields;this.inflight=t.length,this.yields=[];for(let s=0;s<t.length;s++){if(typeof t[s]=="function"){const o=t[s];try{o()}catch(c){throw c}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(t[s]):!0){this.processed++;const o=Date.now();yield t[s],this.time=Date.now()-o,this.dispatchedFn&&t[s]&&this.dispatchedFn(t[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=pt())}}finally{this.stop()}}stop(t){this.done||(this.err=t,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(t))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class om{constructor(t,s,i={maxOut:2}){j(this,"interval");j(this,"maxOut");j(this,"cancelAfter");j(this,"timer");j(this,"autoCancelTimer");j(this,"last");j(this,"missed");j(this,"count");j(this,"callback");this.interval=t,this.maxOut=(i==null?void 0:i.maxOut)||2,this.cancelAfter=(i==null?void 0:i.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(t,s=0,i=2){this.interval=t,this.maxOut=i,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(t){console.log(t)}},this.interval)}}var wd;(function(n){n.Limits="limits",n.Interest="interest",n.Workqueue="workqueue"})(wd||(wd={}));var wo;(function(n){n.Old="old",n.New="new"})(wo||(wo={}));var Sd;(function(n){n.File="file",n.Memory="memory"})(Sd||(Sd={}));var Et;(function(n){n.All="all",n.Last="last",n.New="new",n.StartSequence="by_start_sequence",n.StartTime="by_start_time",n.LastPerSubject="last_per_subject"})(Et||(Et={}));var qt;(function(n){n.None="none",n.All="all",n.Explicit="explicit",n.NotSet=""})(qt||(qt={}));var ta;(function(n){n.Instant="instant",n.Original="original"})(ta||(ta={}));var Os;(function(n){n.None="none",n.S2="s2"})(Os||(Os={}));var hu;(function(n){n.CreateOrUpdate="",n.Update="update",n.Create="create"})(hu||(hu={}));function dE(n,t={}){return Object.assign({name:n,deliver_policy:Et.All,ack_policy:qt.Explicit,ack_wait:mt(30*1e3),replay_policy:ta.Instant},t)}var Vg;(function(n){n.API="api_audit",n.StreamAction="stream_action",n.ConsumerAction="consumer_action",n.SnapshotCreate="snapshot_create",n.SnapshotComplete="snapshot_complete",n.RestoreCreate="restore_create",n.RestoreComplete="restore_complete",n.MaxDeliver="max_deliver",n.Terminated="terminated",n.Ack="consumer_ack",n.StreamLeaderElected="stream_leader_elected",n.StreamQuorumLost="stream_quorum_lost",n.ConsumerLeaderElected="consumer_leader_elected",n.ConsumerQuorumLost="consumer_quorum_lost"})(Vg||(Vg={}));var Qt;(function(n){n.StreamSourceHdr="Nats-Stream-Source",n.LastConsumerSeqHdr="Nats-Last-Consumer",n.LastStreamSeqHdr="Nats-Last-Stream",n.ConsumerStalledHdr="Nats-Consumer-Stalled",n.MessageSizeHdr="Nats-Msg-Size",n.RollupHdr="Nats-Rollup",n.RollupValueSubject="sub",n.RollupValueAll="all",n.PendingMessagesHdr="Nats-Pending-Messages",n.PendingBytesHdr="Nats-Pending-Bytes"})(Qt||(Qt={}));var Jn;(function(n){n.LastValue="",n.AllHistory="history",n.UpdatesOnly="updates"})(Jn||(Jn={}));var Vi;(function(n){n.Stream="Nats-Stream",n.Sequence="Nats-Sequence",n.TimeStamp="Nats-Time-Stamp",n.Subject="Nats-Subject"})(Vi||(Vi={}));var Yg;(function(n){n.Stream="Nats-Stream",n.Subject="Nats-Subject",n.Sequence="Nats-Sequence",n.LastSequence="Nats-Last-Sequence",n.Size="Nats-Msg-Size"})(Yg||(Yg={}));const _n="KV_";class mE{constructor(t){j(this,"config");j(this,"ordered");j(this,"mack");j(this,"stream");j(this,"callbackFn");j(this,"max");j(this,"qname");j(this,"isBind");j(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=dE("",t||{})}getOpts(){var s;const t={};if(t.config=Object.assign({},this.config),t.config.filter_subject&&(this.filterSubject(t.config.filter_subject),t.config.filter_subject=void 0),t.config.filter_subjects&&((s=t.config.filter_subjects)==null||s.forEach(i=>{this.filterSubject(i)}),t.config.filter_subjects=void 0),t.mack=this.mack,t.stream=this.stream,t.callbackFn=this.callbackFn,t.max=this.max,t.queue=this.qname,t.ordered=this.ordered,t.config.ack_policy=t.ordered?qt.None:t.config.ack_policy,t.isBind=t.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:t.config.filter_subject=this.filters[0];break;default:t.config.filter_subjects=this.filters}return t}description(t){return this.config.description=t,this}deliverTo(t){return this.config.deliver_subject=t,this}durable(t){return Ki(t),this.config.durable_name=t,this}startSequence(t){if(t<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=Et.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=Et.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=Et.All,this}deliverLastPerSubject(){return this.config.deliver_policy=Et.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=Et.Last,this}deliverNew(){return this.config.deliver_policy=Et.New,this}startAtTimeDelta(t){return this.startTime(new Date(Date.now()-t)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=qt.None,this}ackAll(){return this.config.ack_policy=qt.All,this}ackExplicit(){return this.config.ack_policy=qt.Explicit,this}ackWait(t){return this.config.ack_wait=mt(t),this}maxDeliver(t){return this.config.max_deliver=t,this}filterSubject(t){return this.filters=this.filters||[],this.filters.push(t),this}replayInstantly(){return this.config.replay_policy=ta.Instant,this}replayOriginal(){return this.config.replay_policy=ta.Original,this}sample(t){if(t=Math.trunc(t),t<0||t>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${t}%`,this}limit(t){return this.config.rate_limit_bps=t,this}maxWaiting(t){return this.config.max_waiting=t,this}maxAckPending(t){return this.config.max_ack_pending=t,this}idleHeartbeat(t){return this.config.idle_heartbeat=mt(t),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(t){return this.queue(t),this}manualAck(){return this.mack=!0,this}maxMessages(t){return this.max=t,this}callback(t){return this.callbackFn=t,this}queue(t){return this.qname=t,this.config.deliver_group=t,this}orderedConsumer(){return this.ordered=!0,this}bind(t,s){return this.stream=t,this.config.durable_name=s,this.isBind=!0,this}bindStream(t){return this.stream=t,this}inactiveEphemeralThreshold(t){return this.config.inactive_threshold=mt(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=mt(t),this}memory(){return this.config.mem_storage=!0,this}numReplicas(t){return this.config.num_replicas=t,this}consumerName(t){return this.config.name=t,this}}function _s(n){return new mE(n)}function Kg(n){return typeof n.getOpts=="function"}class pE{static encode(t){if(typeof t=="string")return btoa(t);const s=Array.from(t);return btoa(String.fromCharCode(...s))}static decode(t,s=!1){const i=atob(t);return s?Uint8Array.from(i,o=>o.charCodeAt(0)):i}}class Xi{static encode(t){return Xi.toB64URLEncoding(pE.encode(t))}static decode(t,s=!1){return Xi.decode(Xi.fromB64URLEncoding(t),s)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class na{constructor(){j(this,"buffers");j(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let s=0;for(let c=0;c<t.length;c++)s+=t[c].length;const i=new Uint8Array(s);let o=0;for(let c=0;c<t.length;c++)i.set(t[c],o),o+=t[c].length;return i}static fromAscii(t){return t||(t=""),ti.encode(t)}static toAscii(t){return Sn.decode(t)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const t=new Uint8Array(this.byteLength);let s=0;for(let i=0;i<this.buffers.length;i++)t.set(this.buffers[i],s),s+=this.buffers[i].length;this.buffers.length=0,this.buffers.push(t)}}shift(){if(this.buffers.length){const t=this.buffers.shift();if(t)return this.byteLength-=t.length,t}return new Uint8Array(0)}drain(t){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const i=this.byteLength;(t===void 0||t>i)&&(t=i);const o=s.subarray(0,t);return i>t&&this.buffers.push(s.subarray(t)),this.byteLength=i-t,o}}return new Uint8Array(0)}fill(t,...s){t&&(this.buffers.push(t),this.byteLength+=t.length);for(let i=0;i<s.length;i++)s[i]&&s[i].length&&(this.buffers.push(s[i]),this.byteLength+=s[i].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function yE(n,t){return t.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(i){if(i!=="default"&&!(i in n)){var o=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(n,i,o.get?o:{enumerable:!0,get:function(){return s[i]}})}})}),Object.freeze(n)}var gE=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},no=gE.performance||{};no.now||no.mozNow||no.msNow||no.oNow||no.webkitNow;var Jg={versions:{}},bE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xE(n){if(n.__esModule)return n;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(n).forEach(function(s){var i=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return n[s]}})}),t}var Qh,Au={exports:{}},Xg={},Qg=xE(yE({__proto__:null,default:Xg},[Xg]));Qh=Au,(function(){var n="input is invalid type",t=typeof window=="object",s=t?window:{};s.JS_SHA256_NO_WINDOW&&(t=!1);var i=!t&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&Jg.versions&&Jg.versions.node;o?s=bE:i&&(s=self);var c=!s.JS_SHA256_NO_COMMON_JS&&Qh.exports,m=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",y="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],u=[24,16,8,0],d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],b=["hex","array","digest","arrayBuffer"],x=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(R){return Object.prototype.toString.call(R)==="[object Array]"}),!m||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(R){return typeof R=="object"&&R.buffer&&R.buffer.constructor===ArrayBuffer});var v=function(R,H){return function(ae){return new B(H,!0).update(ae)[R]()}},w=function(R){var H=v("hex",R);o&&(H=S(H,R)),H.create=function(){return new B(R)},H.update=function(I){return H.create().update(I)};for(var ae=0;ae<b.length;++ae){var $=b[ae];H[$]=v($,R)}return H},S=function(R,H){var ae,$=Qg,I=Qg.Buffer,D=H?"sha224":"sha256";return ae=I.from&&!s.JS_SHA256_NO_BUFFER_FROM?I.from:function(Q){return new I(Q)},function(Q){if(typeof Q=="string")return $.createHash(D).update(Q,"utf8").digest("hex");if(Q==null)throw new Error(n);return Q.constructor===ArrayBuffer&&(Q=new Uint8Array(Q)),Array.isArray(Q)||ArrayBuffer.isView(Q)||Q.constructor===I?$.createHash(D).update(ae(Q)).digest("hex"):R(Q)}},C=function(R,H){return function(ae,$){return new se(ae,H,!0).update($)[R]()}},q=function(R){var H=C("hex",R);H.create=function(I){return new se(I,R)},H.update=function(I,D){return H.create(I).update(D)};for(var ae=0;ae<b.length;++ae){var $=b[ae];H[$]=C($,R)}return H};function B(R,H){H?(x[0]=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],R?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=R}function se(R,H,ae){var $,I=typeof R;if(I==="string"){var D,Q=[],X=R.length,he=0;for($=0;$<X;++$)(D=R.charCodeAt($))<128?Q[he++]=D:D<2048?(Q[he++]=192|D>>>6,Q[he++]=128|63&D):D<55296||D>=57344?(Q[he++]=224|D>>>12,Q[he++]=128|D>>>6&63,Q[he++]=128|63&D):(D=65536+((1023&D)<<10|1023&R.charCodeAt(++$)),Q[he++]=240|D>>>18,Q[he++]=128|D>>>12&63,Q[he++]=128|D>>>6&63,Q[he++]=128|63&D);R=Q}else{if(I!=="object")throw new Error(n);if(R===null)throw new Error(n);if(m&&R.constructor===ArrayBuffer)R=new Uint8Array(R);else if(!(Array.isArray(R)||m&&ArrayBuffer.isView(R)))throw new Error(n)}R.length>64&&(R=new B(H,!0).update(R).array());var Se=[],ke=[];for($=0;$<64;++$){var F=R[$]||0;Se[$]=92^F,ke[$]=54^F}B.call(this,H,ae),this.update(ke),this.oKeyPad=Se,this.inner=!0,this.sharedMemory=ae}B.prototype.update=function(R){if(!this.finalized){var H,ae=typeof R;if(ae!=="string"){if(ae!=="object")throw new Error(n);if(R===null)throw new Error(n);if(m&&R.constructor===ArrayBuffer)R=new Uint8Array(R);else if(!(Array.isArray(R)||m&&ArrayBuffer.isView(R)))throw new Error(n);H=!0}for(var $,I,D=0,Q=R.length,X=this.blocks;D<Q;){if(this.hashed&&(this.hashed=!1,X[0]=this.block,this.block=X[16]=X[1]=X[2]=X[3]=X[4]=X[5]=X[6]=X[7]=X[8]=X[9]=X[10]=X[11]=X[12]=X[13]=X[14]=X[15]=0),H)for(I=this.start;D<Q&&I<64;++D)X[I>>>2]|=R[D]<<u[3&I++];else for(I=this.start;D<Q&&I<64;++D)($=R.charCodeAt(D))<128?X[I>>>2]|=$<<u[3&I++]:$<2048?(X[I>>>2]|=(192|$>>>6)<<u[3&I++],X[I>>>2]|=(128|63&$)<<u[3&I++]):$<55296||$>=57344?(X[I>>>2]|=(224|$>>>12)<<u[3&I++],X[I>>>2]|=(128|$>>>6&63)<<u[3&I++],X[I>>>2]|=(128|63&$)<<u[3&I++]):($=65536+((1023&$)<<10|1023&R.charCodeAt(++D)),X[I>>>2]|=(240|$>>>18)<<u[3&I++],X[I>>>2]|=(128|$>>>12&63)<<u[3&I++],X[I>>>2]|=(128|$>>>6&63)<<u[3&I++],X[I>>>2]|=(128|63&$)<<u[3&I++]);this.lastByteIndex=I,this.bytes+=I-this.start,I>=64?(this.block=X[16],this.start=I-64,this.hash(),this.hashed=!0):this.start=I}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},B.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var R=this.blocks,H=this.lastByteIndex;R[16]=this.block,R[H>>>2]|=g[3&H],this.block=R[16],H>=56&&(this.hashed||this.hash(),R[0]=this.block,R[16]=R[1]=R[2]=R[3]=R[4]=R[5]=R[6]=R[7]=R[8]=R[9]=R[10]=R[11]=R[12]=R[13]=R[14]=R[15]=0),R[14]=this.hBytes<<3|this.bytes>>>29,R[15]=this.bytes<<3,this.hash()}},B.prototype.hash=function(){var R,H,ae,$,I,D,Q,X,he,Se=this.h0,ke=this.h1,F=this.h2,W=this.h3,ce=this.h4,xe=this.h5,ve=this.h6,Ce=this.h7,Te=this.blocks;for(R=16;R<64;++R)H=((I=Te[R-15])>>>7|I<<25)^(I>>>18|I<<14)^I>>>3,ae=((I=Te[R-2])>>>17|I<<15)^(I>>>19|I<<13)^I>>>10,Te[R]=Te[R-16]+H+Te[R-7]+ae|0;for(he=ke&F,R=0;R<64;R+=4)this.first?(this.is224?(D=300032,Ce=(I=Te[0]-1413257819)-150054599|0,W=I+24177077|0):(D=704751109,Ce=(I=Te[0]-210244248)-1521486534|0,W=I+143694565|0),this.first=!1):(H=(Se>>>2|Se<<30)^(Se>>>13|Se<<19)^(Se>>>22|Se<<10),$=(D=Se&ke)^Se&F^he,Ce=W+(I=Ce+(ae=(ce>>>6|ce<<26)^(ce>>>11|ce<<21)^(ce>>>25|ce<<7))+(ce&xe^~ce&ve)+d[R]+Te[R])|0,W=I+(H+$)|0),H=(W>>>2|W<<30)^(W>>>13|W<<19)^(W>>>22|W<<10),$=(Q=W&Se)^W&ke^D,ve=F+(I=ve+(ae=(Ce>>>6|Ce<<26)^(Ce>>>11|Ce<<21)^(Ce>>>25|Ce<<7))+(Ce&ce^~Ce&xe)+d[R+1]+Te[R+1])|0,H=((F=I+(H+$)|0)>>>2|F<<30)^(F>>>13|F<<19)^(F>>>22|F<<10),$=(X=F&W)^F&Se^Q,xe=ke+(I=xe+(ae=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&Ce^~ve&ce)+d[R+2]+Te[R+2])|0,H=((ke=I+(H+$)|0)>>>2|ke<<30)^(ke>>>13|ke<<19)^(ke>>>22|ke<<10),$=(he=ke&F)^ke&W^X,ce=Se+(I=ce+(ae=(xe>>>6|xe<<26)^(xe>>>11|xe<<21)^(xe>>>25|xe<<7))+(xe&ve^~xe&Ce)+d[R+3]+Te[R+3])|0,Se=I+(H+$)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+Se|0,this.h1=this.h1+ke|0,this.h2=this.h2+F|0,this.h3=this.h3+W|0,this.h4=this.h4+ce|0,this.h5=this.h5+xe|0,this.h6=this.h6+ve|0,this.h7=this.h7+Ce|0},B.prototype.hex=function(){this.finalize();var R=this.h0,H=this.h1,ae=this.h2,$=this.h3,I=this.h4,D=this.h5,Q=this.h6,X=this.h7,he=y[R>>>28&15]+y[R>>>24&15]+y[R>>>20&15]+y[R>>>16&15]+y[R>>>12&15]+y[R>>>8&15]+y[R>>>4&15]+y[15&R]+y[H>>>28&15]+y[H>>>24&15]+y[H>>>20&15]+y[H>>>16&15]+y[H>>>12&15]+y[H>>>8&15]+y[H>>>4&15]+y[15&H]+y[ae>>>28&15]+y[ae>>>24&15]+y[ae>>>20&15]+y[ae>>>16&15]+y[ae>>>12&15]+y[ae>>>8&15]+y[ae>>>4&15]+y[15&ae]+y[$>>>28&15]+y[$>>>24&15]+y[$>>>20&15]+y[$>>>16&15]+y[$>>>12&15]+y[$>>>8&15]+y[$>>>4&15]+y[15&$]+y[I>>>28&15]+y[I>>>24&15]+y[I>>>20&15]+y[I>>>16&15]+y[I>>>12&15]+y[I>>>8&15]+y[I>>>4&15]+y[15&I]+y[D>>>28&15]+y[D>>>24&15]+y[D>>>20&15]+y[D>>>16&15]+y[D>>>12&15]+y[D>>>8&15]+y[D>>>4&15]+y[15&D]+y[Q>>>28&15]+y[Q>>>24&15]+y[Q>>>20&15]+y[Q>>>16&15]+y[Q>>>12&15]+y[Q>>>8&15]+y[Q>>>4&15]+y[15&Q];return this.is224||(he+=y[X>>>28&15]+y[X>>>24&15]+y[X>>>20&15]+y[X>>>16&15]+y[X>>>12&15]+y[X>>>8&15]+y[X>>>4&15]+y[15&X]),he},B.prototype.toString=B.prototype.hex,B.prototype.digest=function(){this.finalize();var R=this.h0,H=this.h1,ae=this.h2,$=this.h3,I=this.h4,D=this.h5,Q=this.h6,X=this.h7,he=[R>>>24&255,R>>>16&255,R>>>8&255,255&R,H>>>24&255,H>>>16&255,H>>>8&255,255&H,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae,$>>>24&255,$>>>16&255,$>>>8&255,255&$,I>>>24&255,I>>>16&255,I>>>8&255,255&I,D>>>24&255,D>>>16&255,D>>>8&255,255&D,Q>>>24&255,Q>>>16&255,Q>>>8&255,255&Q];return this.is224||he.push(X>>>24&255,X>>>16&255,X>>>8&255,255&X),he},B.prototype.array=B.prototype.digest,B.prototype.arrayBuffer=function(){this.finalize();var R=new ArrayBuffer(this.is224?28:32),H=new DataView(R);return H.setUint32(0,this.h0),H.setUint32(4,this.h1),H.setUint32(8,this.h2),H.setUint32(12,this.h3),H.setUint32(16,this.h4),H.setUint32(20,this.h5),H.setUint32(24,this.h6),this.is224||H.setUint32(28,this.h7),R},se.prototype=new B,se.prototype.finalize=function(){if(B.prototype.finalize.call(this),this.inner){this.inner=!1;var R=this.array();B.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(R),B.prototype.finalize.call(this)}};var le=w();le.sha256=le,le.sha224=w(!0),le.sha256.hmac=q(),le.sha224.hmac=q(!0),c?Qh.exports=le:(s.sha256=le.sha256,s.sha224=le.sha224)})();Au.exports;Au.exports.sha224;var Wg=Au.exports.sha256;function Ed(n){return OE(n)}function vE(n){if(!/^[0-9A-Fa-f]+$/.test(n))return!1;const s=/^[0-9A-F]+$/.test(n),i=/^[0-9a-f]+$/.test(n);return s||i?n.length%2===0:!1}function _E(n){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(n)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(n)}function wE(n){return vE(n)?"hex":_E(n)?"b64":""}function SE(n){if(n.length%2!==0)throw new Error("hex string must have an even length");const t=new Uint8Array(n.length/2);for(let s=0;s<n.length;s+=2)t[s/2]=parseInt(n.substring(s,s+2),16);return t}function EE(n){n=n.replace(/-/g,"+"),n=n.replace(/_/g,"/");const t=atob(n);return Uint8Array.from(t,s=>s.charCodeAt(0))}function OE(n){switch(wE(n)){case"hex":return SE(n);case"b64":return EE(n)}return null}function AE(n,t){const s=typeof n=="string"?Ed(n):n,i=typeof t=="string"?Ed(t):t;if(s===null||i===null||s.length!==i.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==i[o])return!1;return!0}class px{constructor(t,s,i=!0){j(this,"token");j(this,"received");j(this,"ctx");j(this,"requestSubject");j(this,"mux");this.mux=t,this.requestSubject=s,this.received=0,this.token=Es.next(),i&&(this.ctx=new Error)}}class jE extends px{constructor(s,i,o={maxWait:1e3}){super(s,i);j(this,"callback");j(this,"done");j(this,"timer");j(this,"max");j(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=pt(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,i){s?(this.ctx&&(s.stack+=`
|
|
33
|
-
|
|
34
|
-
${this.ctx.stack}`),this.cancel(s)):(this.callback(null,i),this.opts.strategy===Qn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Qn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Qn.SentinelMsg&&i&&i.data.length===0&&this.cancel())}}class yx extends px{constructor(s,i,o={timeout:1e3},c=!0){super(s,i,c);j(this,"deferred");j(this,"timer");this.deferred=pt(),this.timer=ea(o.timeout,c)}resolver(s,i){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
|
|
35
|
-
|
|
36
|
-
${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(i),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||ye.errorForCode(ue.Cancelled))}}const kE="$JS.API";function TE(n){return n=n||{},n.domain&&(n.apiPrefix=`$JS.${n.domain}.API`,delete n.domain),Eu({apiPrefix:kE,timeout:5e3},n)}class No{constructor(t,s){j(this,"nc");j(this,"opts");j(this,"prefix");j(this,"timeout");j(this,"jc");this.nc=t,this.opts=TE(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Wn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let t=this.opts.apiPrefix;if(!t||t.length===0)throw new Error("invalid empty prefix");t[t.length-1]==="."&&(t=t.substr(0,t.length-1)),this.opts.apiPrefix=t}async _request(t,s=null,i){i=i||{},i.timeout=this.timeout;let o=An;s&&(o=this.jc.encode(s));let{retries:c}=i;c=c||1,c=c===-1?Number.MAX_SAFE_INTEGER:c;const m=sm();for(let y=0;y<c;y++)try{const g=await this.nc.request(t,o,i);return this.parseJsResponse(g)}catch(g){const u=g;if((u.code==="503"||u.code===ue.Timeout)&&y+1<c)await sa(m.backoff(y));else throw g}}async findStream(t){const s={subject:t},o=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(t){const s=this.jc.decode(t.data),i=s;if(i.error){const o=mx(i.error.code,i.error.description);if(o!==null)throw o.api_error=i.error,o}return s}}class po{constructor(t,s,i,o){j(this,"err");j(this,"offset");j(this,"pageInfo");j(this,"subject");j(this,"jsm");j(this,"filter");j(this,"payload");if(!t)throw new Error("subject is required");this.subject=t,this.jsm=i,this.offset=0,this.pageInfo={},this.filter=s,this.payload=o||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const t={offset:this.offset};this.payload&&Object.assign(t,this.payload);try{const s=await this.jsm._request(this.subject,t,{timeout:this.jsm.timeout});this.pageInfo=s;const i=this.countResponse(s);return i===0?[]:(this.offset+=i,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(t){var s,i,o;switch(t==null?void 0:t.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=t.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((i=t.consumers)==null?void 0:i.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${t==null?void 0:t.type}`),((o=t.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let t=await this.next();for(;t.length>0;){for(const s of t)yield s;t=await this.next()}}}function ei(n=""){const t=n.match(/(\d+).(\d+).(\d+)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),micro:parseInt(t[3])};throw new Error(`'${n}' is not a semver value`)}function Od(n,t){return n.major<t.major?-1:n.major>t.major?1:n.minor<t.minor?-1:n.minor>t.minor?1:n.micro<t.micro?-1:n.micro>t.micro?1:0}var Ke;(function(n){n.JS_KV="js_kv",n.JS_OBJECTSTORE="js_objectstore",n.JS_PULL_MAX_BYTES="js_pull_max_bytes",n.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",n.JS_ALLOW_DIRECT="js_allow_direct",n.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",n.JS_SIMPLIFICATION="js_simplification",n.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",n.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",n.JS_STREAM_FIRST_SEQ="js_stream_first_seq",n.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",n.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",n.JS_STREAM_COMPRESSION="js_stream_compression",n.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",n.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Ke||(Ke={}));class NE{constructor(t){j(this,"server");j(this,"features");j(this,"disabled");this.features=new Map,this.disabled=[],this.update(t)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(t){this.disabled.push(t),this.update(this.server)}isDisabled(t){return this.disabled.indexOf(t)!==-1}update(t){typeof t=="string"&&(t=ei(t)),this.server=t,this.set(Ke.JS_KV,"2.6.2"),this.set(Ke.JS_OBJECTSTORE,"2.6.3"),this.set(Ke.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ke.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ke.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ke.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ke.JS_SIMPLIFICATION,"2.9.4"),this.set(Ke.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ke.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ke.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ke.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ke.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ke.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ke.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ke.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(t,s){this.features.set(t,{min:s,ok:Od(this.server,ei(s))>=0})}get(t){return this.features.get(t)||{min:"unknown",ok:!1}}supports(t){var s;return((s=this.get(t))==null?void 0:s.ok)||!1}require(t){return typeof t=="string"&&(t=ei(t)),Od(this.server,t)>=0}}class du extends No{constructor(t,s){super(t,s)}async add(t,s,i=hu.Create){if(Kt(t),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const o={};o.config=s,o.stream_name=t,o.action=i,o.config.durable_name&&Ki(o.config.durable_name);const c=this.nc;let{min:m,ok:y}=c.features.get(Ke.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!y)throw new Error(`consumer 'name' requires server ${m}`);if(g)try{Ou("name",g)}catch(x){const v=x.message,w=v.indexOf("cannot contain");throw w!==-1?new Error(`consumer 'name' ${v.substring(w)}`):x}let u,d="";if(Array.isArray(s.filter_subjects)){const{min:x,ok:v}=c.features.get(Ke.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${x}`);y=!1}if(s.metadata){const{min:x,ok:v}=c.features.get(Ke.JS_STREAM_CONSUMER_METADATA);if(!v)throw new Error(`consumer 'metadata' requires server ${x}`)}if(y&&(d=s.name??s.durable_name??""),d!==""){let x=s.filter_subject??void 0;x===">"&&(x=void 0),u=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${d}.${x}`:`${this.prefix}.CONSUMER.CREATE.${t}.${d}`}else u=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(u,o)}async update(t,s,i){const o=await this.info(t,s),c=i;return this.add(t,Object.assign(o.config,c),hu.Update)}async info(t,s){return Kt(t),Ki(s),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${s}`)}async delete(t,s){return Kt(t),Ki(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${s}`)).success}list(t){Kt(t);const s=o=>o.consumers,i=`${this.prefix}.CONSUMER.LIST.${t}`;return new po(i,s,this)}pause(t,s,i){const o=`${this.prefix}.CONSUMER.PAUSE.${t}.${s}`,c={pause_until:i.toISOString()};return this._request(o,c)}resume(t,s){return this.pause(t,s,new Date(0))}}function zi(n,t,s=!1){if(s===!0&&!n)throw ye.errorForCode(ue.ApiError,new Error(`${t} is not a function`));if(n&&typeof n!="function")throw ye.errorForCode(ue.ApiError,new Error(`${t} is not a function`))}class CE extends Bt{constructor(s,i,o){super();j(this,"sub");j(this,"adapter");j(this,"subIterDone");zi(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&zi(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(zi(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(zi(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(zi(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&zi(o.cleanupFn,"cleanupFn");let c=(d,b)=>{this.callback(d,b)};if(o.callback){const d=o.callback;c=(b,x)=>{const[v,w]=this.adapter(b,x);if(v){d(v,null);return}const{ingest:S}=this.ingestionFilterFn?this.ingestionFilterFn(w,this):{ingest:!0};S&&(!this.protocolFilterFn||this.protocolFilterFn(w))&&(d(v,w),this.dispatchedFn&&w&&this.dispatchedFn(w))}}const{max:m,queue:y,timeout:g}=o,u={queue:y,timeout:g,callback:c};m&&m>0&&(u.max=m),this.sub=s.subscribe(i,u),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=pt(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async d=>{await d.closed,this.stop()})(this.sub).then().catch()}unsubscribe(s){this.sub.unsubscribe(s)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(s,i){this.sub.cancelTimeout();const[o,c]=this.adapter(s,i);o&&this.stop(o),c&&this.push(c)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let En;function ME(n){En=n}function gx(){return En!==void 0&&En.defaultPort!==void 0?En.defaultPort:4222}function Wh(){return En!==void 0&&En.urlParseFn?En.urlParseFn:void 0}function RE(){if(!En||typeof En.factory!="function")throw new Error("transport fn is not set");return En.factory()}function Ad(){return En!==void 0&&En.dnsResolveFn?En.dnsResolveFn:void 0}const nu=`\r
|
|
37
|
-
`,mu=na.fromAscii(nu),DE=new Uint8Array(mu)[0],LE=new Uint8Array(mu)[1];function qE(n){for(let t=0;t<n.length;t++){const s=t+1;if(n.byteLength>s&&n[t]===DE&&n[s]===LE)return s+1}return 0}function BE(n){const t=qE(n);if(t>0){const i=new Uint8Array(n).slice(0,t);return Sn.decode(i)}return""}const PE=4,bx=48,UE=65,zE=97;function IE(n,t,s,i){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((m,y)=>{o[y]=m}),o[12]=n,o[13]=t,o[14]=s,o[15]=i,o}function jd(n){return $E(n)!==void 0}function $E(n){for(let t=0;t<n.length;t++)switch(n[t]){case".":return xx(n);case":":return HE(n)}}function xx(n){const t=new Uint8Array(4);for(let s=0;s<4;s++){if(n.length===0)return;if(s>0){if(n[0]!==".")return;n=n.substring(1)}const{n:i,c:o,ok:c}=FE(n);if(!c||i>255)return;n=n.substring(o),t[s]=i}return IE(t[0],t[1],t[2],t[3])}function HE(n){const t=new Uint8Array(16);let s=-1;if(n.length>=2&&n[0]===":"&&n[1]===":"&&(s=0,n=n.substring(2),n.length===0))return t;let i=0;for(;i<16;){const{n:o,c,ok:m}=GE(n);if(!m||o>65535)return;if(c<n.length&&n[c]==="."){if(s<0&&i!=12||i+4>16)return;const y=xx(n);if(y===void 0)return;t[i]=y[12],t[i+1]=y[13],t[i+2]=y[14],t[i+3]=y[15],n="",i+=PE;break}if(t[i]=o>>8,t[i+1]=o,i+=2,n=n.substring(c),n.length===0)break;if(n[0]!==":"||n.length==1)return;if(n=n.substring(1),n[0]===":"){if(s>=0)return;if(s=i,n=n.substring(1),n.length===0)break}}if(n.length===0){if(i<16){if(s<0)return;const o=16-i;for(let c=i-1;c>=s;c--)t[c+o]=t[c];for(let c=s+o-1;c>=s;c--)t[c]=0}else if(s>=0)return;return t}}function FE(n){let t=0,s=0;for(t=0;t<n.length&&48<=n.charCodeAt(t)&&n.charCodeAt(t)<=57;t++)if(s=s*10+(n.charCodeAt(t)-bx),s>=16777215)return{n:16777215,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n:s,c:t,ok:!0}}function GE(n){let t=0,s=0;for(s=0;s<n.length;s++){if(48<=n.charCodeAt(s)&&n.charCodeAt(s)<=57)t*=16,t+=n.charCodeAt(s)-bx;else if(97<=n.charCodeAt(s)&&n.charCodeAt(s)<=102)t*=16,t+=n.charCodeAt(s)-zE+10;else if(65<=n.charCodeAt(s)&&n.charCodeAt(s)<=70)t*=16,t+=n.charCodeAt(s)-UE+10;else break;if(t>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n:t,c:s,ok:!0}}function VE(n){return n.indexOf("[")!==-1||n.indexOf("::")!==-1?!1:n.indexOf(".")!==-1||n.split(":").length<=2}function kd(n){return!VE(n)}function YE(n){const t="::FFFF:",s=n.toUpperCase().indexOf(t);if(s!==-1&&n.indexOf(".")!==-1){let i=n.substring(s+t.length);return i=i.replace("[",""),i.replace("]","")}return n}function KE(n){n=n.trim(),n.match(/^(.*:\/\/)(.*)/m)&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2")),n=YE(n),kd(n)&&n.indexOf("[")===-1&&(n=`[${n}]`);const t=kd(n)?n.match(/(]:)(\d+)/):n.match(/(:)(\d+)/),s=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):4222,i=s===80?"https":"http",o=new URL(`${i}://${n}`);o.port=`${s}`;let c=o.hostname;return c.charAt(0)==="["&&(c=c.substring(1,c.length-1)),{listen:o.host,hostname:c,port:s}}class xo{constructor(t,s=!1){j(this,"src");j(this,"listen");j(this,"hostname");j(this,"port");j(this,"didConnect");j(this,"reconnects");j(this,"lastConnect");j(this,"gossiped");j(this,"tlsName");j(this,"resolves");this.src=t,this.tlsName="";const i=KE(t);this.listen=i.listen,this.hostname=i.hostname,this.port=i.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];const s=[];if(jd(this.hostname))return[this];{const i=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${i.join(",")}`);for(const o of i){const c=this.port===80?"https":"http",m=new URL(`${c}://${kd(o)?"["+o+"]":o}`);m.port=`${this.port}`;const y=new xo(m.host,!1);y.tlsName=this.hostname,s.push(y)}}return t.randomize&&hx(s),this.resolves=s,s}}class JE{constructor(t=[],s={}){j(this,"firstSelect");j(this,"servers");j(this,"currentServer");j(this,"tlsName");j(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const i=Wh();t&&(t.forEach(o=>{o=i?i(o):o,this.servers.push(new xo(o))}),this.randomize&&(this.servers=hx(this.servers))),this.servers.length===0&&this.addServer(`${bd}:${gx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();jd(t.hostname)||(this.tlsName=t.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(t,s=!1){const i=Wh();t=i?i(t):t;const o=new xo(t,s);jd(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const t=this.servers.shift();return t&&(this.servers.push(t),this.currentServer=t),t}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(t){if(t){const s=this.servers.indexOf(t);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(t,s){const i=[];let o=[];const c=Wh(),m=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(g=>{g=c?c(g,s):g;const u=new xo(g,!0);m.set(g,u)});const y=[];return this.servers.forEach((g,u)=>{const d=g.listen;g.gossiped&&this.currentServer.listen!==d&&m.get(d)===void 0&&y.push(u),m.delete(d)}),y.reverse(),y.forEach(g=>{const u=this.servers.splice(g,1);o=o.concat(u[0].listen)}),m.forEach((g,u)=>{this.servers.push(g),i.push(u)}),{added:i,deleted:o}}}class XE{constructor(){j(this,"baseInbox");j(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${Dr(t)}.`,this.baseInbox}add(t){isNaN(t.received)||(t.received=0),this.reqs.set(t.token,t)}get(t){return this.reqs.get(t)}cancel(t){this.reqs.delete(t.token)}getToken(t){const s=t.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(t,s){if(s&&s.permissionContext){if(t)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const i=s.permissionContext;if(i.operation==="publish"){const o=this.all().find(c=>c.requestSubject===i.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(t,s)=>{const i=this.getToken(s);if(i){const o=this.get(i);o&&(t===null&&s.headers&&(t=dx(s)),o.resolver(t,s))}}}close(){const t=ye.errorForCode(ue.Timeout);this.reqs.forEach(s=>{s.resolver(t,{})})}}class QE{constructor(t,s,i){j(this,"ph");j(this,"interval");j(this,"maxOut");j(this,"timer");j(this,"pendings");this.ph=t,this.interval=s,this.maxOut=i,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(t){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),t&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Yi.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=pt();this.ph.flush(t).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(t),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(t=>(t.resolve(),!1))}}class WE extends Error{constructor(t){super(t),this.name="AssertionError"}}function ZE(n,t="Assertion failed."){if(!n)throw new WE(t)}const Zg=32*1024,Zh=2**32-2;function ic(n,t,s=0){const i=t.byteLength-s;return n.byteLength>i&&(n=n.subarray(0,i)),t.set(n,s),n.byteLength}class ed{constructor(t){j(this,"_buf");j(this,"_off");if(this._off=0,t==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(t)}bytes(t={copy:!0}){return t.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+t)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(t){const s=this._buf.byteLength;return t<=this.capacity-s?(this._reslice(s+t),s):-1}_reslice(t){ZE(t<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,t)}readByte(){const t=new Uint8Array(1);return this.read(t)?t[0]:null}read(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;const s=ic(this._buf.subarray(this._off),t);return this._off+=s,s}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(ti.encode(t))}write(t){const s=this._grow(t.byteLength);return ic(t,this._buf,s)}_grow(t){const s=this.length;s===0&&this._off!==0&&this.reset();const i=this._tryGrowByReslice(t);if(i>=0)return i;const o=this.capacity;if(t<=Math.floor(o/2)-s)ic(this._buf.subarray(this._off),this._buf);else{if(o+t>Zh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*o+t,Zh));ic(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(s+t,Zh)),s}grow(t){if(t<0)throw Error("Buffer._grow: negative count");const s=this._grow(t);this._reslice(s)}readFrom(t){let s=0;const i=new Uint8Array(Zg);for(;;){const o=this.capacity-this.length<Zg,c=o?i:new Uint8Array(this._buf.buffer,this.length),m=t.read(c);if(m===null)return s;o?this.write(c.subarray(0,m)):this._reslice(this.length+m),s+=m}}}var Jt;(function(n){n[n.OK=0]="OK",n[n.ERR=1]="ERR",n[n.MSG=2]="MSG",n[n.INFO=3]="INFO",n[n.PING=4]="PING",n[n.PONG=5]="PONG"})(Jt||(Jt={}));function e1(){const n={};return n.sid=-1,n.hdr=-1,n.size=-1,n}const e2=48;class t1{constructor(t){j(this,"dispatcher");j(this,"state");j(this,"as");j(this,"drop");j(this,"hdr");j(this,"ma");j(this,"argBuf");j(this,"msgBuf");this.dispatcher=t,this.state=de.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(t){let s;for(s=0;s<t.length;s++){const i=t[s];switch(this.state){case de.OP_START:switch(i){case me.M:case me.m:this.state=de.OP_M,this.hdr=-1,this.ma=e1();break;case me.H:case me.h:this.state=de.OP_H,this.hdr=0,this.ma=e1();break;case me.P:case me.p:this.state=de.OP_P;break;case me.PLUS:this.state=de.OP_PLUS;break;case me.MINUS:this.state=de.OP_MINUS;break;case me.I:case me.i:this.state=de.OP_I;break;default:throw this.fail(t.subarray(s))}break;case de.OP_H:switch(i){case me.M:case me.m:this.state=de.OP_M;break;default:throw this.fail(t.subarray(s))}break;case de.OP_M:switch(i){case me.S:case me.s:this.state=de.OP_MS;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MS:switch(i){case me.G:case me.g:this.state=de.OP_MSG;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MSG:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_MSG_SPC;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MSG_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.MSG_ARG,this.as=s}break;case de.MSG_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{const o=this.argBuf?this.argBuf.bytes():t.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=de.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;case de.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Jt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=de.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const c=t.length-s;c<o&&(o=c),o>0?(this.msgBuf.write(t.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(i)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Jt.MSG,msg:this.ma,data:t.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=de.MSG_END);break;case de.MSG_END:switch(i){case me.NL:this.drop=0,this.as=s+1,this.state=de.OP_START;break;default:continue}break;case de.OP_PLUS:switch(i){case me.O:case me.o:this.state=de.OP_PLUS_O;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PLUS_O:switch(i){case me.K:case me.k:this.state=de.OP_PLUS_OK;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PLUS_OK:switch(i){case me.NL:this.dispatcher.push({kind:Jt.OK}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_MINUS:switch(i){case me.E:case me.e:this.state=de.OP_MINUS_E;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_E:switch(i){case me.R:case me.r:this.state=de.OP_MINUS_ER;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_ER:switch(i){case me.R:case me.r:this.state=de.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_ERR:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_ERR_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.MINUS_ERR_ARG,this.as=s}break;case de.MINUS_ERR_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Jt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=de.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(i))}break;case de.OP_P:switch(i){case me.I:case me.i:this.state=de.OP_PI;break;case me.O:case me.o:this.state=de.OP_PO;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PO:switch(i){case me.N:case me.n:this.state=de.OP_PON;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PON:switch(i){case me.G:case me.g:this.state=de.OP_PONG;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PONG:switch(i){case me.NL:this.dispatcher.push({kind:Jt.PONG}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_PI:switch(i){case me.N:case me.n:this.state=de.OP_PIN;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PIN:switch(i){case me.G:case me.g:this.state=de.OP_PING;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PING:switch(i){case me.NL:this.dispatcher.push({kind:Jt.PING}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_I:switch(i){case me.N:case me.n:this.state=de.OP_IN;break;default:throw this.fail(t.subarray(s))}break;case de.OP_IN:switch(i){case me.F:case me.f:this.state=de.OP_INF;break;default:throw this.fail(t.subarray(s))}break;case de.OP_INF:switch(i){case me.O:case me.o:this.state=de.OP_INFO;break;default:throw this.fail(t.subarray(s))}break;case de.OP_INFO:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_INFO_SPC;break;default:throw this.fail(t.subarray(s))}break;case de.OP_INFO_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.INFO_ARG,this.as=s}break;case de.INFO_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Jt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=de.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;default:throw this.fail(t.subarray(s))}}(this.state===de.MSG_ARG||this.state===de.MINUS_ERR_ARG||this.state===de.INFO_ARG)&&!this.argBuf&&(this.argBuf=new ed(t.subarray(this.as,s-this.drop))),this.state===de.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new ed(t.subarray(this.as)))}cloneMsgArg(){const t=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,i=new Uint8Array(t+s);i.set(this.ma.subject),this.ma.reply&&i.set(this.ma.reply,t),this.argBuf=new ed(i),this.ma.subject=i.subarray(0,t),this.ma.reply&&(this.ma.reply=i.subarray(t))}processMsgArgs(t){if(this.hdr>=0)return this.processHeaderMsgArgs(t);const s=[];let i=-1;for(let o=0;o<t.length;o++)switch(t[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(t.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(t.subarray(i)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(t,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(t,"processMsgArgs Bad or Missing Size Error")}fail(t,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${Sn.decode(t)}`)}processHeaderMsgArgs(t){const s=[];let i=-1;for(let o=0;o<t.length;o++)switch(t[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(t.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(t.subarray(i)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(t,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(t){if(t.length===0)return-1;let s=0;for(let i=0;i<t.length;i++){if(t[i]<48||t[i]>57)return-1;s=s*10+(t[i]-e2)}return s}}var de;(function(n){n[n.OP_START=0]="OP_START",n[n.OP_PLUS=1]="OP_PLUS",n[n.OP_PLUS_O=2]="OP_PLUS_O",n[n.OP_PLUS_OK=3]="OP_PLUS_OK",n[n.OP_MINUS=4]="OP_MINUS",n[n.OP_MINUS_E=5]="OP_MINUS_E",n[n.OP_MINUS_ER=6]="OP_MINUS_ER",n[n.OP_MINUS_ERR=7]="OP_MINUS_ERR",n[n.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",n[n.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",n[n.OP_M=10]="OP_M",n[n.OP_MS=11]="OP_MS",n[n.OP_MSG=12]="OP_MSG",n[n.OP_MSG_SPC=13]="OP_MSG_SPC",n[n.MSG_ARG=14]="MSG_ARG",n[n.MSG_PAYLOAD=15]="MSG_PAYLOAD",n[n.MSG_END=16]="MSG_END",n[n.OP_H=17]="OP_H",n[n.OP_P=18]="OP_P",n[n.OP_PI=19]="OP_PI",n[n.OP_PIN=20]="OP_PIN",n[n.OP_PING=21]="OP_PING",n[n.OP_PO=22]="OP_PO",n[n.OP_PON=23]="OP_PON",n[n.OP_PONG=24]="OP_PONG",n[n.OP_I=25]="OP_I",n[n.OP_IN=26]="OP_IN",n[n.OP_INF=27]="OP_INF",n[n.OP_INFO=28]="OP_INFO",n[n.OP_INFO_SPC=29]="OP_INFO_SPC",n[n.INFO_ARG=30]="INFO_ARG"})(de||(de={}));var me;(function(n){n[n.CR=13]="CR",n[n.E=69]="E",n[n.e=101]="e",n[n.F=70]="F",n[n.f=102]="f",n[n.G=71]="G",n[n.g=103]="g",n[n.H=72]="H",n[n.h=104]="h",n[n.I=73]="I",n[n.i=105]="i",n[n.K=75]="K",n[n.k=107]="k",n[n.M=77]="M",n[n.m=109]="m",n[n.MINUS=45]="MINUS",n[n.N=78]="N",n[n.n=110]="n",n[n.NL=10]="NL",n[n.O=79]="O",n[n.o=111]="o",n[n.P=80]="P",n[n.p=112]="p",n[n.PLUS=43]="PLUS",n[n.R=82]="R",n[n.r=114]="r",n[n.S=83]="S",n[n.s=115]="s",n[n.SPACE=32]="SPACE",n[n.TAB=9]="TAB"})(me||(me={}));(function(n){var t=function(A,T){this.hi=A|0,this.lo=T|0},s=function(A){var T,k=new Float64Array(16);if(A)for(T=0;T<A.length;T++)k[T]=A[T];return k},i=function(){throw new Error("no PRNG")},o=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var m=s(),y=s([1]),g=s([56129,1]),u=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),b=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),x=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(A,T){return A<<T|A>>>32-T}function S(A,T){var k=A[T+3]&255;return k=k<<8|A[T+2]&255,k=k<<8|A[T+1]&255,k<<8|A[T+0]&255}function C(A,T){var k=A[T]<<24|A[T+1]<<16|A[T+2]<<8|A[T+3],N=A[T+4]<<24|A[T+5]<<16|A[T+6]<<8|A[T+7];return new t(k,N)}function q(A,T,k){var N;for(N=0;N<4;N++)A[T+N]=k&255,k>>>=8}function B(A,T,k){A[T]=k.hi>>24&255,A[T+1]=k.hi>>16&255,A[T+2]=k.hi>>8&255,A[T+3]=k.hi&255,A[T+4]=k.lo>>24&255,A[T+5]=k.lo>>16&255,A[T+6]=k.lo>>8&255,A[T+7]=k.lo&255}function se(A,T,k,N,L){var z,ne=0;for(z=0;z<L;z++)ne|=A[T+z]^k[N+z];return(1&ne-1>>>8)-1}function le(A,T,k,N){return se(A,T,k,N,16)}function R(A,T,k,N){return se(A,T,k,N,32)}function H(A,T,k,N,L){var z=new Uint32Array(16),ne=new Uint32Array(16),ie=new Uint32Array(16),K=new Uint32Array(4),te,ge,qe;for(te=0;te<4;te++)ne[5*te]=S(N,4*te),ne[1+te]=S(k,4*te),ne[6+te]=S(T,4*te),ne[11+te]=S(k,16+4*te);for(te=0;te<16;te++)ie[te]=ne[te];for(te=0;te<20;te++){for(ge=0;ge<4;ge++){for(qe=0;qe<4;qe++)K[qe]=ne[(5*ge+4*qe)%16];for(K[1]^=w(K[0]+K[3]|0,7),K[2]^=w(K[1]+K[0]|0,9),K[3]^=w(K[2]+K[1]|0,13),K[0]^=w(K[3]+K[2]|0,18),qe=0;qe<4;qe++)z[4*ge+(ge+qe)%4]=K[qe]}for(qe=0;qe<16;qe++)ne[qe]=z[qe]}if(L){for(te=0;te<16;te++)ne[te]=ne[te]+ie[te]|0;for(te=0;te<4;te++)ne[5*te]=ne[5*te]-S(N,4*te)|0,ne[6+te]=ne[6+te]-S(T,4*te)|0;for(te=0;te<4;te++)q(A,4*te,ne[5*te]),q(A,16+4*te,ne[6+te])}else for(te=0;te<16;te++)q(A,4*te,ne[te]+ie[te]|0)}function ae(A,T,k,N){return H(A,T,k,N,!1),0}function $(A,T,k,N){return H(A,T,k,N,!0),0}var I=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function D(A,T,k,N,L,z,ne){var ie=new Uint8Array(16),K=new Uint8Array(64),te,ge;if(!L)return 0;for(ge=0;ge<16;ge++)ie[ge]=0;for(ge=0;ge<8;ge++)ie[ge]=z[ge];for(;L>=64;){for(ae(K,ie,ne,I),ge=0;ge<64;ge++)A[T+ge]=(k?k[N+ge]:0)^K[ge];for(te=1,ge=8;ge<16;ge++)te=te+(ie[ge]&255)|0,ie[ge]=te&255,te>>>=8;L-=64,T+=64,k&&(N+=64)}if(L>0)for(ae(K,ie,ne,I),ge=0;ge<L;ge++)A[T+ge]=(k?k[N+ge]:0)^K[ge];return 0}function Q(A,T,k,N,L){return D(A,T,null,0,k,N,L)}function X(A,T,k,N,L){var z=new Uint8Array(32);return $(z,N,L,I),Q(A,T,k,N.subarray(16),z)}function he(A,T,k,N,L,z,ne){var ie=new Uint8Array(32);return $(ie,z,ne,I),D(A,T,k,N,L,z.subarray(16),ie)}function Se(A,T){var k,N=0;for(k=0;k<17;k++)N=N+(A[k]+T[k]|0)|0,A[k]=N&255,N>>>=8}var ke=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function F(A,T,k,N,L,z){var ne,ie,K,te,ge=new Uint32Array(17),qe=new Uint32Array(17),lt=new Uint32Array(17),Gt=new Uint32Array(17),Fn=new Uint32Array(17);for(K=0;K<17;K++)qe[K]=lt[K]=0;for(K=0;K<16;K++)qe[K]=z[K];for(qe[3]&=15,qe[4]&=252,qe[7]&=15,qe[8]&=252,qe[11]&=15,qe[12]&=252,qe[15]&=15;L>0;){for(K=0;K<17;K++)Gt[K]=0;for(K=0;K<16&&K<L;++K)Gt[K]=k[N+K];for(Gt[K]=1,N+=K,L-=K,Se(lt,Gt),ie=0;ie<17;ie++)for(ge[ie]=0,K=0;K<17;K++)ge[ie]=ge[ie]+lt[K]*(K<=ie?qe[ie-K]:320*qe[ie+17-K]|0)|0|0;for(ie=0;ie<17;ie++)lt[ie]=ge[ie];for(te=0,K=0;K<16;K++)te=te+lt[K]|0,lt[K]=te&255,te>>>=8;for(te=te+lt[16]|0,lt[16]=te&3,te=5*(te>>>2)|0,K=0;K<16;K++)te=te+lt[K]|0,lt[K]=te&255,te>>>=8;te=te+lt[16]|0,lt[16]=te}for(K=0;K<17;K++)Fn[K]=lt[K];for(Se(lt,ke),ne=-(lt[16]>>>7)|0,K=0;K<17;K++)lt[K]^=ne&(Fn[K]^lt[K]);for(K=0;K<16;K++)Gt[K]=z[K+16];for(Gt[16]=0,Se(lt,Gt),K=0;K<16;K++)A[T+K]=lt[K];return 0}function W(A,T,k,N,L,z){var ne=new Uint8Array(16);return F(ne,0,k,N,L,z),le(A,T,ne,0)}function ce(A,T,k,N,L){var z;if(k<32)return-1;for(he(A,0,T,0,k,N,L),F(A,16,A,32,k-32,A),z=0;z<16;z++)A[z]=0;return 0}function xe(A,T,k,N,L){var z,ne=new Uint8Array(32);if(k<32||(X(ne,0,32,N,L),W(T,16,T,32,k-32,ne)!==0))return-1;for(he(A,0,T,0,k,N,L),z=0;z<32;z++)A[z]=0;return 0}function ve(A,T){var k;for(k=0;k<16;k++)A[k]=T[k]|0}function Ce(A){var T,k;for(k=0;k<16;k++)A[k]+=65536,T=Math.floor(A[k]/65536),A[(k+1)*(k<15?1:0)]+=T-1+37*(T-1)*(k===15?1:0),A[k]-=T*65536}function Te(A,T,k){for(var N,L=~(k-1),z=0;z<16;z++)N=L&(A[z]^T[z]),A[z]^=N,T[z]^=N}function Me(A,T){var k,N,L,z=s(),ne=s();for(k=0;k<16;k++)ne[k]=T[k];for(Ce(ne),Ce(ne),Ce(ne),N=0;N<2;N++){for(z[0]=ne[0]-65517,k=1;k<15;k++)z[k]=ne[k]-65535-(z[k-1]>>16&1),z[k-1]&=65535;z[15]=ne[15]-32767-(z[14]>>16&1),L=z[15]>>16&1,z[14]&=65535,Te(ne,z,1-L)}for(k=0;k<16;k++)A[2*k]=ne[k]&255,A[2*k+1]=ne[k]>>8}function Ze(A,T){var k=new Uint8Array(32),N=new Uint8Array(32);return Me(k,A),Me(N,T),R(k,0,N,0)}function yt(A){var T=new Uint8Array(32);return Me(T,A),T[0]&1}function Ct(A,T){var k;for(k=0;k<16;k++)A[k]=T[2*k]+(T[2*k+1]<<8);A[15]&=32767}function we(A,T,k){var N;for(N=0;N<16;N++)A[N]=T[N]+k[N]|0}function Re(A,T,k){var N;for(N=0;N<16;N++)A[N]=T[N]-k[N]|0}function oe(A,T,k){var N,L,z=new Float64Array(31);for(N=0;N<31;N++)z[N]=0;for(N=0;N<16;N++)for(L=0;L<16;L++)z[N+L]+=T[N]*k[L];for(N=0;N<15;N++)z[N]+=38*z[N+16];for(N=0;N<16;N++)A[N]=z[N];Ce(A),Ce(A)}function Be(A,T){oe(A,T,T)}function We(A,T){var k=s(),N;for(N=0;N<16;N++)k[N]=T[N];for(N=253;N>=0;N--)Be(k,k),N!==2&&N!==4&&oe(k,k,T);for(N=0;N<16;N++)A[N]=k[N]}function ln(A,T){var k=s(),N;for(N=0;N<16;N++)k[N]=T[N];for(N=250;N>=0;N--)Be(k,k),N!==1&&oe(k,k,T);for(N=0;N<16;N++)A[N]=k[N]}function pe(A,T,k){var N=new Uint8Array(32),L=new Float64Array(80),z,ne,ie=s(),K=s(),te=s(),ge=s(),qe=s(),lt=s();for(ne=0;ne<31;ne++)N[ne]=T[ne];for(N[31]=T[31]&127|64,N[0]&=248,Ct(L,k),ne=0;ne<16;ne++)K[ne]=L[ne],ge[ne]=ie[ne]=te[ne]=0;for(ie[0]=ge[0]=1,ne=254;ne>=0;--ne)z=N[ne>>>3]>>>(ne&7)&1,Te(ie,K,z),Te(te,ge,z),we(qe,ie,te),Re(ie,ie,te),we(te,K,ge),Re(K,K,ge),Be(ge,qe),Be(lt,ie),oe(ie,te,ie),oe(te,K,qe),we(qe,ie,te),Re(ie,ie,te),Be(K,ie),Re(te,ge,lt),oe(ie,te,g),we(ie,ie,ge),oe(te,te,ie),oe(ie,ge,lt),oe(ge,K,L),Be(K,qe),Te(ie,K,z),Te(te,ge,z);for(ne=0;ne<16;ne++)L[ne+16]=ie[ne],L[ne+32]=te[ne],L[ne+48]=K[ne],L[ne+64]=ge[ne];var Gt=L.subarray(32),Fn=L.subarray(16);return We(Gt,Gt),oe(Fn,Fn,Gt),Me(A,Fn),0}function Ye(A,T){return pe(A,T,c)}function Ot(A,T){return i(T,32),Ye(A,T)}function ft(A,T,k){var N=new Uint8Array(32);return pe(N,k,T),$(A,o,N,I)}var Pr=ce,Bo=xe;function oa(A,T,k,N,L,z){var ne=new Uint8Array(32);return ft(ne,L,z),Pr(A,T,k,N,ne)}function la(A,T,k,N,L,z){var ne=new Uint8Array(32);return ft(ne,L,z),Bo(A,T,k,N,ne)}function ur(){var A=0,T=0,k=0,N=0,L=65535,z,ne,ie;for(ie=0;ie<arguments.length;ie++)z=arguments[ie].lo,ne=arguments[ie].hi,A+=z&L,T+=z>>>16,k+=ne&L,N+=ne>>>16;return T+=A>>>16,k+=T>>>16,N+=k>>>16,new t(k&L|N<<16,A&L|T<<16)}function Po(A,T){return new t(A.hi>>>T,A.lo>>>T|A.hi<<32-T)}function ni(){var A=0,T=0,k;for(k=0;k<arguments.length;k++)A^=arguments[k].lo,T^=arguments[k].hi;return new t(T,A)}function ht(A,T){var k,N,L=32-T;return T<32?(k=A.hi>>>T|A.lo<<L,N=A.lo>>>T|A.hi<<L):T<64&&(k=A.lo>>>T|A.hi<<L,N=A.hi>>>T|A.lo<<L),new t(k,N)}function Lu(A,T,k){var N=A.hi&T.hi^~A.hi&k.hi,L=A.lo&T.lo^~A.lo&k.lo;return new t(N,L)}function Uo(A,T,k){var N=A.hi&T.hi^A.hi&k.hi^T.hi&k.hi,L=A.lo&T.lo^A.lo&k.lo^T.lo&k.lo;return new t(N,L)}function zo(A){return ni(ht(A,28),ht(A,34),ht(A,39))}function ri(A){return ni(ht(A,14),ht(A,18),ht(A,41))}function qu(A){return ni(ht(A,1),ht(A,8),Po(A,7))}function Io(A){return ni(ht(A,19),ht(A,61),Po(A,6))}var Bu=[new t(1116352408,3609767458),new t(1899447441,602891725),new t(3049323471,3964484399),new t(3921009573,2173295548),new t(961987163,4081628472),new t(1508970993,3053834265),new t(2453635748,2937671579),new t(2870763221,3664609560),new t(3624381080,2734883394),new t(310598401,1164996542),new t(607225278,1323610764),new t(1426881987,3590304994),new t(1925078388,4068182383),new t(2162078206,991336113),new t(2614888103,633803317),new t(3248222580,3479774868),new t(3835390401,2666613458),new t(4022224774,944711139),new t(264347078,2341262773),new t(604807628,2007800933),new t(770255983,1495990901),new t(1249150122,1856431235),new t(1555081692,3175218132),new t(1996064986,2198950837),new t(2554220882,3999719339),new t(2821834349,766784016),new t(2952996808,2566594879),new t(3210313671,3203337956),new t(3336571891,1034457026),new t(3584528711,2466948901),new t(113926993,3758326383),new t(338241895,168717936),new t(666307205,1188179964),new t(773529912,1546045734),new t(1294757372,1522805485),new t(1396182291,2643833823),new t(1695183700,2343527390),new t(1986661051,1014477480),new t(2177026350,1206759142),new t(2456956037,344077627),new t(2730485921,1290863460),new t(2820302411,3158454273),new t(3259730800,3505952657),new t(3345764771,106217008),new t(3516065817,3606008344),new t(3600352804,1432725776),new t(4094571909,1467031594),new t(275423344,851169720),new t(430227734,3100823752),new t(506948616,1363258195),new t(659060556,3750685593),new t(883997877,3785050280),new t(958139571,3318307427),new t(1322822218,3812723403),new t(1537002063,2003034995),new t(1747873779,3602036899),new t(1955562222,1575990012),new t(2024104815,1125592928),new t(2227730452,2716904306),new t(2361852424,442776044),new t(2428436474,593698344),new t(2756734187,3733110249),new t(3204031479,2999351573),new t(3329325298,3815920427),new t(3391569614,3928383900),new t(3515267271,566280711),new t(3940187606,3454069534),new t(4118630271,4000239992),new t(116418474,1914138554),new t(174292421,2731055270),new t(289380356,3203993006),new t(460393269,320620315),new t(685471733,587496836),new t(852142971,1086792851),new t(1017036298,365543100),new t(1126000580,2618297676),new t(1288033470,3409855158),new t(1501505948,4234509866),new t(1607167915,987167468),new t(1816402316,1246189591)];function $o(A,T,k){var N=[],L=[],z=[],ne=[],ie,K,te;for(K=0;K<8;K++)N[K]=z[K]=C(A,8*K);for(var ge=0;k>=128;){for(K=0;K<16;K++)ne[K]=C(T,8*K+ge);for(K=0;K<80;K++){for(te=0;te<8;te++)L[te]=z[te];for(ie=ur(z[7],ri(z[4]),Lu(z[4],z[5],z[6]),Bu[K],ne[K%16]),L[7]=ur(ie,zo(z[0]),Uo(z[0],z[1],z[2])),L[3]=ur(L[3],ie),te=0;te<8;te++)z[(te+1)%8]=L[te];if(K%16===15)for(te=0;te<16;te++)ne[te]=ur(ne[te],ne[(te+9)%16],qu(ne[(te+1)%16]),Io(ne[(te+14)%16]))}for(K=0;K<8;K++)z[K]=ur(z[K],N[K]),N[K]=z[K];ge+=128,k-=128}for(K=0;K<8;K++)B(A,8*K,N[K]);return k}var js=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function _t(A,T,k){var N=new Uint8Array(64),L=new Uint8Array(256),z,ne=k;for(z=0;z<64;z++)N[z]=js[z];for($o(N,T,k),k%=128,z=0;z<256;z++)L[z]=0;for(z=0;z<k;z++)L[z]=T[ne-k+z];for(L[k]=128,k=256-128*(k<112?1:0),L[k-9]=0,B(L,k-8,new t(ne/536870912|0,ne<<3)),$o(N,L,k),z=0;z<64;z++)A[z]=N[z];return 0}function cn(A,T){var k=s(),N=s(),L=s(),z=s(),ne=s(),ie=s(),K=s(),te=s(),ge=s();Re(k,A[1],A[0]),Re(ge,T[1],T[0]),oe(k,k,ge),we(N,A[0],A[1]),we(ge,T[0],T[1]),oe(N,N,ge),oe(L,A[3],T[3]),oe(L,L,d),oe(z,A[2],T[2]),we(z,z,z),Re(ne,N,k),Re(ie,z,L),we(K,z,L),we(te,N,k),oe(A[0],ne,ie),oe(A[1],te,K),oe(A[2],K,ie),oe(A[3],ne,te)}function Ft(A,T,k){var N;for(N=0;N<4;N++)Te(A[N],T[N],k)}function ca(A,T){var k=s(),N=s(),L=s();We(L,T[2]),oe(k,T[0],L),oe(N,T[1],L),Me(A,N),A[31]^=yt(k)<<7}function ua(A,T,k){var N,L;for(ve(A[0],m),ve(A[1],y),ve(A[2],y),ve(A[3],m),L=255;L>=0;--L)N=k[L/8|0]>>(L&7)&1,Ft(A,T,N),cn(T,A),cn(A,A),Ft(A,T,N)}function si(A,T){var k=[s(),s(),s(),s()];ve(k[0],b),ve(k[1],x),ve(k[2],y),oe(k[3],b,x),ua(A,k,T)}function Ur(A,T,k){var N=new Uint8Array(64),L=[s(),s(),s(),s()],z;for(k||i(T,32),_t(N,T,32),N[0]&=248,N[31]&=127,N[31]|=64,si(L,N),ca(A,L),z=0;z<32;z++)T[z+32]=A[z];return 0}var fr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function zr(A,T){var k,N,L,z;for(N=63;N>=32;--N){for(k=0,L=N-32,z=N-12;L<z;++L)T[L]+=k-16*T[N]*fr[L-(N-32)],k=Math.floor((T[L]+128)/256),T[L]-=k*256;T[L]+=k,T[N]=0}for(k=0,L=0;L<32;L++)T[L]+=k-(T[31]>>4)*fr[L],k=T[L]>>8,T[L]&=255;for(L=0;L<32;L++)T[L]-=k*fr[L];for(N=0;N<32;N++)T[N+1]+=T[N]>>8,A[N]=T[N]&255}function $n(A){var T=new Float64Array(64),k;for(k=0;k<64;k++)T[k]=A[k];for(k=0;k<64;k++)A[k]=0;zr(A,T)}function ks(A,T,k,N){var L=new Uint8Array(64),z=new Uint8Array(64),ne=new Uint8Array(64),ie,K,te=new Float64Array(64),ge=[s(),s(),s(),s()];_t(L,N,32),L[0]&=248,L[31]&=127,L[31]|=64;var qe=k+64;for(ie=0;ie<k;ie++)A[64+ie]=T[ie];for(ie=0;ie<32;ie++)A[32+ie]=L[32+ie];for(_t(ne,A.subarray(32),k+32),$n(ne),si(ge,ne),ca(A,ge),ie=32;ie<64;ie++)A[ie]=N[ie];for(_t(z,A,k+64),$n(z),ie=0;ie<64;ie++)te[ie]=0;for(ie=0;ie<32;ie++)te[ie]=ne[ie];for(ie=0;ie<32;ie++)for(K=0;K<32;K++)te[ie+K]+=z[ie]*L[K];return zr(A.subarray(32),te),qe}function Ts(A,T){var k=s(),N=s(),L=s(),z=s(),ne=s(),ie=s(),K=s();return ve(A[2],y),Ct(A[1],T),Be(L,A[1]),oe(z,L,u),Re(L,L,A[2]),we(z,A[2],z),Be(ne,z),Be(ie,ne),oe(K,ie,ne),oe(k,K,L),oe(k,k,z),ln(k,k),oe(k,k,L),oe(k,k,z),oe(k,k,z),oe(A[0],k,z),Be(N,A[0]),oe(N,N,z),Ze(N,L)&&oe(A[0],A[0],v),Be(N,A[0]),oe(N,N,z),Ze(N,L)?-1:(yt(A[0])===T[31]>>7&&Re(A[0],m,A[0]),oe(A[3],A[0],A[1]),0)}function fa(A,T,k,N){var L,z=new Uint8Array(32),ne=new Uint8Array(64),ie=[s(),s(),s(),s()],K=[s(),s(),s(),s()];if(k<64||Ts(K,N))return-1;for(L=0;L<k;L++)A[L]=T[L];for(L=0;L<32;L++)A[L+32]=N[L];if(_t(ne,A,k),$n(ne),ua(ie,K,ne),si(K,T.subarray(32)),cn(ie,K),ca(z,ie),k-=64,R(T,0,z,0)){for(L=0;L<k;L++)A[L]=0;return-1}for(L=0;L<k;L++)A[L]=T[L+64];return k}var ii=32,Ir=24,Hn=32,$r=16,Hr=32,Ns=32,Fr=32,hr=32,Cs=32,ha=Ir,Ho=Hn,er=$r,at=64,gt=32,un=64,Ms=32,da=64;n.lowlevel={crypto_core_hsalsa20:$,crypto_stream_xor:he,crypto_stream:X,crypto_stream_salsa20_xor:D,crypto_stream_salsa20:Q,crypto_onetimeauth:F,crypto_onetimeauth_verify:W,crypto_verify_16:le,crypto_verify_32:R,crypto_secretbox:ce,crypto_secretbox_open:xe,crypto_scalarmult:pe,crypto_scalarmult_base:Ye,crypto_box_beforenm:ft,crypto_box_afternm:Pr,crypto_box:oa,crypto_box_open:la,crypto_box_keypair:Ot,crypto_hash:_t,crypto_sign:ks,crypto_sign_keypair:Ur,crypto_sign_open:fa,crypto_secretbox_KEYBYTES:ii,crypto_secretbox_NONCEBYTES:Ir,crypto_secretbox_ZEROBYTES:Hn,crypto_secretbox_BOXZEROBYTES:$r,crypto_scalarmult_BYTES:Hr,crypto_scalarmult_SCALARBYTES:Ns,crypto_box_PUBLICKEYBYTES:Fr,crypto_box_SECRETKEYBYTES:hr,crypto_box_BEFORENMBYTES:Cs,crypto_box_NONCEBYTES:ha,crypto_box_ZEROBYTES:Ho,crypto_box_BOXZEROBYTES:er,crypto_sign_BYTES:at,crypto_sign_PUBLICKEYBYTES:gt,crypto_sign_SECRETKEYBYTES:un,crypto_sign_SEEDBYTES:Ms,crypto_hash_BYTES:da,gf:s,D:u,L:fr,pack25519:Me,unpack25519:Ct,M:oe,A:we,S:Be,Z:Re,pow2523:ln,add:cn,set25519:ve,modL:zr,scalarmult:ua,scalarbase:si};function Fo(A,T){if(A.length!==ii)throw new Error("bad key size");if(T.length!==Ir)throw new Error("bad nonce size")}function Go(A,T){if(A.length!==Fr)throw new Error("bad public key size");if(T.length!==hr)throw new Error("bad secret key size")}function Mt(){for(var A=0;A<arguments.length;A++)if(!(arguments[A]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ai(A){for(var T=0;T<A.length;T++)A[T]=0}n.randomBytes=function(A){var T=new Uint8Array(A);return i(T,A),T},n.secretbox=function(A,T,k){Mt(A,T,k),Fo(k,T);for(var N=new Uint8Array(Hn+A.length),L=new Uint8Array(N.length),z=0;z<A.length;z++)N[z+Hn]=A[z];return ce(L,N,N.length,T,k),L.subarray($r)},n.secretbox.open=function(A,T,k){Mt(A,T,k),Fo(k,T);for(var N=new Uint8Array($r+A.length),L=new Uint8Array(N.length),z=0;z<A.length;z++)N[z+$r]=A[z];return N.length<32||xe(L,N,N.length,T,k)!==0?null:L.subarray(Hn)},n.secretbox.keyLength=ii,n.secretbox.nonceLength=Ir,n.secretbox.overheadLength=$r,n.scalarMult=function(A,T){if(Mt(A,T),A.length!==Ns)throw new Error("bad n size");if(T.length!==Hr)throw new Error("bad p size");var k=new Uint8Array(Hr);return pe(k,A,T),k},n.scalarMult.base=function(A){if(Mt(A),A.length!==Ns)throw new Error("bad n size");var T=new Uint8Array(Hr);return Ye(T,A),T},n.scalarMult.scalarLength=Ns,n.scalarMult.groupElementLength=Hr,n.box=function(A,T,k,N){var L=n.box.before(k,N);return n.secretbox(A,T,L)},n.box.before=function(A,T){Mt(A,T),Go(A,T);var k=new Uint8Array(Cs);return ft(k,A,T),k},n.box.after=n.secretbox,n.box.open=function(A,T,k,N){var L=n.box.before(k,N);return n.secretbox.open(A,T,L)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var A=new Uint8Array(Fr),T=new Uint8Array(hr);return Ot(A,T),{publicKey:A,secretKey:T}},n.box.keyPair.fromSecretKey=function(A){if(Mt(A),A.length!==hr)throw new Error("bad secret key size");var T=new Uint8Array(Fr);return Ye(T,A),{publicKey:T,secretKey:new Uint8Array(A)}},n.box.publicKeyLength=Fr,n.box.secretKeyLength=hr,n.box.sharedKeyLength=Cs,n.box.nonceLength=ha,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(A,T){if(Mt(A,T),T.length!==un)throw new Error("bad secret key size");var k=new Uint8Array(at+A.length);return ks(k,A,A.length,T),k},n.sign.open=function(A,T){if(Mt(A,T),T.length!==gt)throw new Error("bad public key size");var k=new Uint8Array(A.length),N=fa(k,A,A.length,T);if(N<0)return null;for(var L=new Uint8Array(N),z=0;z<L.length;z++)L[z]=k[z];return L},n.sign.detached=function(A,T){for(var k=n.sign(A,T),N=new Uint8Array(at),L=0;L<N.length;L++)N[L]=k[L];return N},n.sign.detached.verify=function(A,T,k){if(Mt(A,T,k),T.length!==at)throw new Error("bad signature size");if(k.length!==gt)throw new Error("bad public key size");var N=new Uint8Array(at+A.length),L=new Uint8Array(at+A.length),z;for(z=0;z<at;z++)N[z]=T[z];for(z=0;z<A.length;z++)N[z+at]=A[z];return fa(L,N,N.length,k)>=0},n.sign.keyPair=function(){var A=new Uint8Array(gt),T=new Uint8Array(un);return Ur(A,T),{publicKey:A,secretKey:T}},n.sign.keyPair.fromSecretKey=function(A){if(Mt(A),A.length!==un)throw new Error("bad secret key size");for(var T=new Uint8Array(gt),k=0;k<T.length;k++)T[k]=A[32+k];return{publicKey:T,secretKey:new Uint8Array(A)}},n.sign.keyPair.fromSeed=function(A){if(Mt(A),A.length!==Ms)throw new Error("bad seed size");for(var T=new Uint8Array(gt),k=new Uint8Array(un),N=0;N<32;N++)k[N]=A[N];return Ur(T,k,!0),{publicKey:T,secretKey:k}},n.sign.publicKeyLength=gt,n.sign.secretKeyLength=un,n.sign.seedLength=Ms,n.sign.signatureLength=at,n.hash=function(A){Mt(A);var T=new Uint8Array(da);return _t(T,A,A.length),T},n.hash.hashLength=da,n.verify=function(A,T){return Mt(A,T),A.length===0||T.length===0||A.length!==T.length?!1:se(A,0,T,0,A.length)===0},n.setPRNG=function(A){i=A},(function(){var A=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(A&&A.getRandomValues){var T=65536;n.setPRNG(function(k,N){var L,z=new Uint8Array(N);for(L=0;L<N;L+=T)A.getRandomValues(z.subarray(L,L+Math.min(N-L,T)));for(L=0;L<N;L++)k[L]=z[L];ai(z)})}else typeof require<"u"&&(A=require("crypto"),A&&A.randomBytes&&n.setPRNG(function(k,N){var L,z=A.randomBytes(N);for(L=0;L<N;L++)k[L]=z[L];ai(z)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const ac=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;ac.sign.keyPair.fromSeed,ac.sign.detached,ac.sign.detached.verify,ac.randomBytes;var n1;(function(n){n.InvalidPrefixByte="nkeys: invalid prefix byte",n.InvalidKey="nkeys: invalid key",n.InvalidPublicKey="nkeys: invalid public key",n.InvalidSeedLen="nkeys: invalid seed length",n.InvalidSeed="nkeys: invalid seed",n.InvalidEncoding="nkeys: invalid encoded key",n.InvalidSignature="nkeys: signature verification failed",n.CannotSign="nkeys: cannot sign, no private key available",n.PublicKeyOnly="nkeys: no seed or private key available",n.InvalidChecksum="nkeys: invalid checksum",n.SerializationError="nkeys: serialization error",n.ApiError="nkeys: api error",n.ClearedPair="nkeys: pair is cleared"})(n1||(n1={}));var r1;(function(n){n[n.Seed=144]="Seed",n[n.Private=120]="Private",n[n.Operator=112]="Operator",n[n.Server=104]="Server",n[n.Cluster=16]="Cluster",n[n.Account=0]="Account",n[n.User=160]="User"})(r1||(r1={}));function t2(n){return t=>{let s={};return n.forEach(i=>{const o=i(t)||{};s=Object.assign(s,o)}),s}}function n2(){return()=>{}}function r2(n,t){return()=>{const s=typeof n=="function"?n():n,i=typeof t=="function"?t():t;return{user:s,pass:i}}}function s2(n){return()=>({auth_token:typeof n=="function"?n():n})}const vx=120*1e3,i2=2,_x=2*1e3;function a2(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:vx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:_x,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function o2(n){const t=[];return typeof n.authenticator=="function"&&t.push(n.authenticator),Array.isArray(n.authenticator)&&t.push(...n.authenticator),n.token&&t.push(s2(n.token)),n.user&&t.push(r2(n.user,n.pass)),t.length===0?n2():t2(t)}function l2(n){const t=`${bd}:${gx()}`;if(n=n||{servers:[t]},n.servers=n.servers||[],typeof n.servers=="string"&&(n.servers=[n.servers]),n.servers.length>0&&n.port)throw new ye("port and servers options are mutually exclusive",ue.InvalidOption);n.servers.length===0&&n.port&&(n.servers=[`${bd}:${n.port}`]),n.servers&&n.servers.length===0&&(n.servers=[t]);const s=Eu(a2(),n);if(s.authenticator=o2(s),["reconnectDelayHandler","authenticator"].forEach(i=>{if(s[i]&&typeof s[i]!="function")throw new ye(`${i} option should be a function`,ue.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let i=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return i&&(i++,i=Math.floor(Math.random()*i)),s.reconnectTimeWait+i}),s.inboxPrefix)try{Dr(s.inboxPrefix)}catch(i){throw new ye(i.message,ue.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Ad()=="function"),s.resolve&&typeof Ad()!="function")throw new ye("'resolve' is not supported on this client",ue.InvalidOption);return s}function c2(n,t){const{proto:s,tls_required:i,tls_available:o}=n;if((s===void 0||s<1)&&t.noEcho)throw new ye("noEcho",ue.ServerOptionNotAvailable);const c=i||o||!1;if(t.tls&&!c)throw new ye("tls",ue.ServerOptionNotAvailable)}const u2=1024*32,f2=/^INFO\s+([^\r\n]+)\r\n/i,h2=go(`PONG\r
|
|
38
|
-
`),s1=go(`PING\r
|
|
39
|
-
`);class d2{constructor(t,s,i){j(this,"echo");j(this,"no_responders");j(this,"protocol");j(this,"verbose");j(this,"pedantic");j(this,"jwt");j(this,"nkey");j(this,"sig");j(this,"user");j(this,"pass");j(this,"auth_token");j(this,"tls_required");j(this,"name");j(this,"lang");j(this,"version");j(this,"headers");this.protocol=1,this.version=t.version,this.lang=t.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(i):{})||{};Eu(this,o)}}class wx extends Bt{constructor(s,i,o={}){var m;super();j(this,"sid");j(this,"queue");j(this,"draining");j(this,"max");j(this,"subject");j(this,"drained");j(this,"protocol");j(this,"timer");j(this,"info");j(this,"cleanupFn");j(this,"closed");j(this,"requestSubject");Eu(this,o),this.protocol=s,this.subject=i,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=pt();const c=!((m=s.options)!=null&&m.noAsyncTraces);o.timeout&&(this.timer=ea(o.timeout,c),this.timer.then(()=>{this.timer=void 0}).catch(y=>{this.stop(y),this.noIterator&&this.callback(y,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const i=this.callback,o=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),c=s.protocolFilterFn?s.protocolFilterFn:()=>!0,m=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(y,g)=>{const{ingest:u}=o(g);u&&c(g)&&(i(y,g),m(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,i){this.cancelTimeout(),s?this.stop(s):this.push(i)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(ye.errorForCode(ue.ConnectionClosed)):this.isClosed()?Promise.reject(ye.errorForCode(ue.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(pt()).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 m2{constructor(){j(this,"mux");j(this,"subs");j(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(t){return this.sidCounter++,t.sid=this.sidCounter,this.subs.set(t.sid,t),t}setMux(t){return this.mux=t,t}getMux(){return this.mux}get(t){return this.subs.get(t)}resub(t){return this.sidCounter++,this.subs.delete(t.sid),t.sid=this.sidCounter,this.subs.set(t.sid,t),t}all(){return Array.from(this.subs.values())}cancel(t){t&&(t.close(),this.subs.delete(t.sid))}handleError(t){if(t&&t.permissionContext){const s=t.permissionContext,i=this.all();let o;if(s.operation==="subscription"&&(o=i.find(c=>c.subject===s.subject&&c.queue===s.queue)),s.operation==="publish"&&(o=i.find(c=>c.requestSubject===s.subject)),o)return o.callback(t,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(t=>{t.close()})}}class pu{constructor(t,s){j(this,"connected");j(this,"connectedOnce");j(this,"infoReceived");j(this,"info");j(this,"muxSubscriptions");j(this,"options");j(this,"outbound");j(this,"pongs");j(this,"subscriptions");j(this,"transport");j(this,"noMorePublishing");j(this,"connectError");j(this,"publisher");j(this,"_closed");j(this,"closed");j(this,"listeners");j(this,"heartbeats");j(this,"parser");j(this,"outMsgs");j(this,"inMsgs");j(this,"outBytes");j(this,"inBytes");j(this,"pendingLimit");j(this,"lastError");j(this,"abortReconnect");j(this,"whyClosed");j(this,"servers");j(this,"server");j(this,"features");j(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=u2,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=s,this.subscriptions=new m2,this.muxSubscriptions=new XE,this.outbound=new na,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new NE({major:0,minor:0,micro:0}),this.connectPromise=null;const i=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new JE(i,{randomize:!t.noRandomize}),this.closed=pt(),this.parser=new t1(this),this.heartbeats=new QE(this,this.options.pingInterval||vx,this.options.maxPingOut||i2)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const s=ye.errorForCode(ue.Disconnect);s.stack="",t.forEach(i=>{i.reject(s)}),this.parser=new t1(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(s=>{s.push(t)})}status(){const t=new Bt;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=pt();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=s=>{t.reject(s)},this.transport=RE(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),t}disconnect(){this.dispatchStatus({type:Yi.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Yi.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:Rr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:Rr.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===ue.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(t)}async dial(t){const s=this.prepare();let i;try{i=ea(this.options.timeout||2e4);const o=this.transport.connect(t,this.options);await Promise.race([o,i]),(async()=>{try{for await(const c of this.transport)this.parser.parse(c)}catch(c){console.log("reader closed",c)}})().then()}catch(o){s.reject(o)}try{await Promise.race([i,s]),i&&i.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(o){throw i&&i.cancel(),await this.transport.close(o),o}}async _doDial(t){const{resolve:s}=this.options,i=await t.resolve({fn:Ad(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const c of i)try{o=null,this.dispatchStatus({type:Yi.Reconnecting,data:c.toString()}),await this.dial(c);return}catch(m){o=m}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let t;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():_x;let i=s;const o=this.selectServer();if(!o||this.abortReconnect)throw t||(this.lastError?this.lastError:ye.errorForCode(ue.ConnectionRefused));const c=Date.now();if(o.lastConnect===0||o.lastConnect+s<=c){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(m){if(t=m,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const y=this.options.maxReconnectAttempts||0;y!==-1&&o.reconnects>=y&&this.servers.removeCurrentServer()}}else i=Math.min(i,o.lastConnect+s-c),await sa(i)}}static async connect(t,s){const i=new pu(t,s);return await i.dialLoop(),i}static toError(t){const s=t?t.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const i=new ye(t,ue.PermissionsViolation),o=t.match(/(Publish|Subscription) to "(\S+)"/);if(o){i.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const c=t.match(/using queue "(\S+)"/);c&&(i.permissionContext.queue=c[1])}return i}else return s.indexOf("authorization violation")!==-1?new ye(t,ue.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new ye(t,ue.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new ye(t,ue.AccountExpired):s.indexOf("authentication timeout")!==-1?new ye(t,ue.AuthenticationTimeout):new ye(t,ue.ProtocolError)}processMsg(t,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const i=this.subscriptions.get(t.sid);i&&(i.received+=1,i.callback&&i.callback(null,new am(t,s,this)),i.max!==void 0&&i.received>=i.max&&i.unsubscribe())}processError(t){const s=zg(t),i=pu.toError(s),o={type:Rr.Error,data:i.code};if(i.isPermissionError()){let c=!1;if(i.permissionContext){o.permissionContext=i.permissionContext;const m=this.subscriptions.getMux();c=(m==null?void 0:m.subject)===i.permissionContext.subject}this.subscriptions.handleError(i),this.muxSubscriptions.handleError(c,i),c&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(i)}handleError(t){t.isAuthError()?this.handleAuthError(t):t.isProtocolError()?this.lastError=t:t.isAuthTimeout()&&(this.lastError=t),t.isPermissionError()||(this.lastError=t)}handleAuthError(t){this.lastError&&t.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(t):this.disconnect()}processPing(){this.transport.send(h2)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const s=JSON.parse(zg(t));this.info=s;const i=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(ei(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:c,lang:m}=this.transport;try{const y=new d2({version:c,lang:m},this.options,s.nonce);s.headers&&(y.headers=!0,y.no_responders=!0);const g=JSON.stringify(y);this.transport.send(go(`CONNECT ${g}${nu}`)),this.transport.send(s1)}catch(y){this._close(y)}}i&&this.dispatchStatus({type:Rr.Update,data:i}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:Rr.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case Jt.MSG:{const{msg:s,data:i}=t;this.processMsg(s,i);break}case Jt.OK:break;case Jt.ERR:this.processError(t.data);break;case Jt.PING:this.processPing();break;case Jt.PONG:this.processPong();break;case Jt.INFO:this.processInfo(t.data);break}}sendCommand(t,...s){const i=this.outbound.length();let o;typeof t=="string"?o=go(t):o=t,this.outbound.fill(o,...s),i===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,s=An,i){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=ti.encode(s);else throw ye.errorForCode(ue.BadPayload);let c=o.length;i=i||{},i.reply=i.reply||"";let m=An,y=0;if(i.headers){if(this.info&&!this.info.headers)throw new ye("headers",ue.ServerOptionNotAvailable);m=i.headers.encode(),y=m.length,c=o.length+y}if(this.info&&c>this.info.max_payload)throw ye.errorForCode(ue.MaxPayloadExceeded);this.outBytes+=c,this.outMsgs++;let g;i.headers?(i.reply?g=`HPUB ${t} ${i.reply} ${y} ${c}\r
|
|
40
|
-
`:g=`HPUB ${t} ${y} ${c}\r
|
|
41
|
-
`,this.sendCommand(g,m,o,mu)):(i.reply?g=`PUB ${t} ${i.reply} ${c}\r
|
|
42
|
-
`:g=`PUB ${t} ${c}\r
|
|
43
|
-
`,this.sendCommand(g,o,mu))}request(t){return this.initMux(),this.muxSubscriptions.add(t),t}subscribe(t){return this.subscriptions.add(t),this._subunsub(t),t}_sub(t){t.queue?this.sendCommand(`SUB ${t.subject} ${t.queue} ${t.sid}\r
|
|
44
|
-
`):this.sendCommand(`SUB ${t.subject} ${t.sid}\r
|
|
45
|
-
`)}_subunsub(t){return this._sub(t),t.max&&this.unsubscribe(t,t.max),t}unsubscribe(t,s){this.unsub(t,s),(t.max===void 0||t.received>=t.max)&&this.subscriptions.cancel(t)}unsub(t,s){!t||this.isClosed()||(s?this.sendCommand(`UNSUB ${t.sid} ${s}\r
|
|
46
|
-
`):this.sendCommand(`UNSUB ${t.sid}\r
|
|
47
|
-
`),t.max=s)}resub(t,s){!t||this.isClosed()||(this.unsub(t),t.subject=s,this.subscriptions.resub(t),this._sub(t))}flush(t){return t||(t=pt()),this.pongs.push(t),this.outbound.fill(s1),this.flushPending(),t}sendSubscriptions(){const t=[];this.subscriptions.all().forEach(s=>{const i=s;i.queue?t.push(`SUB ${i.subject} ${i.queue} ${i.sid}${nu}`):t.push(`SUB ${i.subject} ${i.sid}${nu}`)}),t.length&&this.transport.send(go(t.join("")))}async _close(t){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(t),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(t),await this.closed.resolve(t))}close(){return this._close()}isClosed(){return this._closed}drain(){const t=this.subscriptions.all(),s=[];return t.forEach(i=>{s.push(i.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const t=this.outbound.drain();this.transport.send(t)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),i=new wx(this,`${s}*`);i.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(i),this.subscribe(i)}}selectServer(){const t=this.servers.selectServer();if(t!==void 0)return this.server=t,this.server}getServer(){return this.server}}const p2="$SRV";class i1{constructor(t){j(this,"msg");this.msg=t}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(t,s){return this.msg.respond(t,s)}respondError(t,s,i,o){var c,m;return o=o||{},o.headers=o.headers||qr(),(c=o.headers)==null||c.set(uu,`${t}`),(m=o.headers)==null||m.set(cu,s),this.msg.respond(i,o)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class So{constructor(t,s="",i=""){j(this,"subject");j(this,"queue");j(this,"srv");s!==""&&g2("service group",s);let o="";if(t instanceof Co)this.srv=t,o="";else if(t instanceof So){const c=t;this.srv=c.srv,i===""&&c.queue!==""&&(i=c.queue),o=c.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=i}calcSubject(t,s=""){return s===""?t:t!==""?`${t}.${s}`:s}addEndpoint(t="",s){s=s||{subject:t};const i=typeof s=="function"?{handler:s,subject:t}:s;mo("endpoint",t);let{subject:o,handler:c,metadata:m,queue:y}=i;o=o||t,y=y||this.queue,y2("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:t,subject:o,queue:y,handler:c,metadata:m};return this.srv._addEndpoint(g)}addGroup(t="",s=""){return new So(this,t,s)}}function y2(n,t){if(t==="")throw new Error(`${n} cannot be empty`);if(t.indexOf(" ")!==-1)throw new Error(`${n} cannot contain spaces: '${t}'`);const s=t.split(".");s.forEach((i,o)=>{if(i===">"&&o!==s.length-1)throw new Error(`${n} cannot have internal '>': '${t}'`)})}function g2(n,t){if(t.indexOf(" ")!==-1)throw new Error(`${n} cannot contain spaces: '${t}'`);t.split(".").forEach(i=>{if(i===">")throw new Error(`${n} name cannot contain internal '>': '${t}'`)})}class Co{constructor(t,s={name:"",version:""}){j(this,"nc");j(this,"_id");j(this,"config");j(this,"handlers");j(this,"internal");j(this,"_stopped");j(this,"_done");j(this,"started");this.nc=t,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),mo("name",this.config.name),mo("queue",this.config.queue),ei(this.config.version),this._id=Es.next(),this.internal=[],this._done=pt(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(i=>{this.close(i).catch()})}static controlSubject(t,s="",i="",o){const c=o??p2;return s===""&&i===""?`${c}.${t}`:(mo("control subject name",s),i!==""?(mo("control subject id",i),`${c}.${t}.${s}.${i}`):`${c}.${t}.${s}`)}get subjects(){return this.handlers.filter(t=>t.internal===!1).map(t=>t.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(t){const s=qr();if(t instanceof fu){const i=t;s.set(cu,i.message),s.set(uu,`${i.code}`)}else s.set(cu,t.message),s.set(uu,"500");return s}setupHandler(t,s=!1){const i=s?"":t.queue?t.queue:this.config.queue,{name:o,subject:c,handler:m}=t,y=t;y.internal=s,s&&this.internal.push(y),y.stats=new b2(o,c,i),y.queue=i;const g=m?(u,d)=>{if(u){this.close(u);return}const b=Date.now();try{m(u,new i1(d))}catch(x){y.stats.countError(x),d==null||d.respond(An,{headers:this.errorToHeader(x)})}finally{y.stats.countLatency(b)}}:void 0;return y.sub=this.nc.subscribe(c,{callback:g,queue:i}),y.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(u=>{if(!this._stopped){const d=new Error(`required subscription ${t.subject} errored: ${u.message}`);d.stack=u.stack,this.close(d).catch()}}),y}info(){return{type:bo.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(t=>{const{subject:s,metadata:i,name:o,queue:c}=t;return{subject:s,metadata:i,name:o,queue_group:c}})}async stats(){const t=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(i){s.stats.countError(i)}t.push(s.stats.stats(s.qi))}return{type:bo.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:t}}addInternalHandler(t,s){const i=`${t}`.toUpperCase();this._doAddInternalHandler(`${i}-all`,t,s),this._doAddInternalHandler(`${i}-kind`,t,s,this.name),this._doAddInternalHandler(`${i}`,t,s,this.name,this.id)}_doAddInternalHandler(t,s,i,o="",c=""){const m={};m.name=t,m.subject=Co.controlSubject(s,o,c),m.handler=i,this.setupHandler(m,!0)}start(){const t=Wn(),s=(m,y)=>m?(this.close(m),Promise.reject(m)):this.stats().then(g=>(y==null||y.respond(t.encode(g)),Promise.resolve())),i=(m,y)=>m?(this.close(m),Promise.reject(m)):(y==null||y.respond(t.encode(this.info())),Promise.resolve()),o=t.encode(this.ping()),c=(m,y)=>m?(this.close(m).then().catch(),Promise.reject(m)):(y.respond(o),Promise.resolve());return this.addInternalHandler(xs.PING,c),this.addInternalHandler(xs.STATS,s),this.addInternalHandler(xs.INFO,i),this.handlers.forEach(m=>{const{subject:y}=m;typeof y=="string"&&m.handler!==null&&this.setupHandler(m)}),Promise.resolve(this)}close(t){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(i=>i.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(t||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(t){return this.close(t)}ping(){return{type:bo.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const t of this.handlers)t.stats.reset(t.qi)}addGroup(t,s){return new So(this,t,s)}addEndpoint(t,s){return new So(this).addEndpoint(t,s)}_addEndpoint(t){const s=new Bt;s.noIterator=typeof t.handler=="function",s.noIterator||(t.handler=(o,c)=>{o?this.stop(o).catch():s.push(new i1(c))},s.iterClosed.then(()=>{this.close().catch()}));const i=this.setupHandler(t,!1);return i.qi=s,this.handlers.push(i),s}}class b2{constructor(t,s,i=""){j(this,"name");j(this,"subject");j(this,"average_processing_time");j(this,"num_requests");j(this,"processing_time");j(this,"num_errors");j(this,"last_error");j(this,"data");j(this,"metadata");j(this,"queue");this.name=t,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=i}reset(t){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=t;s&&(s.time=0,s.processed=0)}countLatency(t){this.num_requests++,this.processing_time+=mt(Date.now()-t),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(t){this.num_errors++,this.last_error=t.message}_stats(){const{name:t,subject:s,average_processing_time:i,num_errors:o,num_requests:c,processing_time:m,last_error:y,data:g,queue:u}=this;return{name:t,subject:s,average_processing_time:i,num_errors:o,num_requests:c,processing_time:m,last_error:y,data:g,queue_group:u}}stats(t){const s=t;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=mt(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 x2{constructor(t,s={strategy:Qn.JitterTimer,maxWait:2e3},i){j(this,"nc");j(this,"prefix");j(this,"opts");this.nc=t,this.prefix=i,this.opts=s}ping(t="",s=""){return this.q(xs.PING,t,s)}stats(t="",s=""){return this.q(xs.STATS,t,s)}info(t="",s=""){return this.q(xs.INFO,t,s)}async q(t,s="",i=""){const o=new Bt,c=Wn(),m=Co.controlSubject(t,s,i,this.prefix),y=await this.nc.requestMany(m,An,this.opts);return(async()=>{for await(const g of y)try{const u=c.decode(g.data);o.push(u)}catch(u){o.push(()=>{o.stop(u)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function Sx(){return{key:{encode(n){return n},decode(n){return n}},value:{encode(n){return n},decode(n){return n}}}}function v2(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Sx(),storage:Sd.File}}const yu="KV-Operation",a1="$KV",_2=/^[-/=.\w]+$/,w2=/^[-/=.>*\w]+$/,S2=/^[-\w]+$/;function E2(n){if(n.startsWith(".")||n.endsWith(".")||!_2.test(n))throw new Error(`invalid key: ${n}`)}function O2(n){if(n.startsWith(".")||n.endsWith(".")||!w2.test(n))throw new Error(`invalid key: ${n}`)}function A2(n){if(n.startsWith(".")||n.endsWith("."))throw new Error(`invalid key: ${n}`);const t=n.split(".");let s=!1;for(let i=0;i<t.length;i++)switch(t[i]){case"*":s=!0;break;case">":if(i!==t.length-1)throw new Error(`invalid key: ${n}`);s=!0;break}return s}function ru(n){if(!S2.test(n))throw new Error(`invalid bucket name: ${n}`)}var ir;(function(n){n.MsgIdHdr="Nats-Msg-Id",n.ExpectedStreamHdr="Nats-Expected-Stream",n.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",n.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",n.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(ir||(ir={}));class Eo{constructor(t,s,i){j(this,"js");j(this,"jsm");j(this,"stream");j(this,"bucket");j(this,"direct");j(this,"codec");j(this,"prefix");j(this,"editPrefix");j(this,"useJsPrefix");j(this,"_prefixLen");j(this,"validateKey",E2);j(this,"validateSearchKey",O2);j(this,"hasWildcards",A2);ru(t),this.js=s,this.jsm=i,this.bucket=t,this.prefix=a1,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,s,i={}){ru(s);const o=await t.jetstreamManager(),c=new Eo(s,t,o);return await c.init(i),c}static async bind(t,s,i={}){const o=await t.jetstreamManager(),c={config:{allow_direct:i.allow_direct}};ru(s);const m=new Eo(s,t,o);return c.config.name=i.streamName??m.bucketName(),Object.assign(m,c),m.stream=c.config.name,m.codec=i.codec||Sx(),m.direct=c.config.allow_direct??!1,m.initializePrefixes(c),m}async init(t={}){const s=Object.assign(v2(),t);this.codec=s.codec;const i={};this.stream=i.name=t.streamName??this.bucketName(),i.retention=wd.Limits,i.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(i.max_bytes=s.max_bytes),i.max_msg_size=s.maxValueSize,i.storage=s.storage;const o=t.placementCluster??"";if(o&&(t.placement={},t.placement.cluster=o,t.placement.tags=[]),t.placement&&(i.placement=t.placement),t.republish&&(i.republish=t.republish),t.description&&(i.description=t.description),t.mirror){const b=Object.assign({},t.mirror);b.name.startsWith(_n)||(b.name=`${_n}${b.name}`),i.mirror=b,i.mirror_direct=!0}else if(t.sources){const b=t.sources.map(x=>{const v=Object.assign({},x),w=v.name.startsWith(_n)?v.name.substring(_n.length):v.name;return v.name.startsWith(_n)||(v.name=`${_n}${v.name}`),!x.external&&w!==this.bucket&&(v.subject_transforms=[{src:`$KV.${w}.>`,dest:`$KV.${this.bucket}.>`}]),v});i.sources=b,i.subjects=[this.subjectForBucket()]}else i.subjects=[this.subjectForBucket()];t.metadata&&(i.metadata=t.metadata),typeof t.compression=="boolean"&&(i.compression=t.compression?Os.S2:Os.None);const c=this.js.nc,m=c.getServerVersion(),y=m?Od(m,ei("2.7.2"))>=0:!1;i.discard=y?wo.New:wo.Old;const{ok:g,min:u}=c.features.get(Ke.JS_ALLOW_DIRECT);if(!g&&t.allow_direct===!0){const b=m?`${m.major}.${m.minor}.${m.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${b} - requires ${u}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:g,i.allow_direct=t.allow_direct,this.direct=i.allow_direct,i.num_replicas=s.replicas,s.ttl&&(i.max_age=mt(s.ttl)),i.allow_rollup_hdrs=!0;let d;try{d=await this.jsm.streams.info(i.name),!d.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(b){if(b.message==="stream not found")d=await this.jsm.streams.add(i);else throw b}this.initializePrefixes(d)}initializePrefixes(t){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=t.config;if(s){let i=s.name;if(i.startsWith(_n)&&(i=i.substring(_n.length)),s.external&&s.external.api!==""){const o=s.name.substring(_n.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${i}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${_n}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(t,s=!1){const i=[];return s?(this.useJsPrefix&&i.push(this.js.apiPrefix),this.editPrefix!==""?i.push(this.editPrefix):i.push(this.prefix)):this.prefix&&i.push(this.prefix),i.push(t),i.join(".")}fullKeyName(t){return this.prefix!==""?`${this.prefix}.${t}`:`${a1}.${this.bucket}.${t}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(t){const s=[];for(const i of t.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.encode(i));break}return s.join(".")}decodeKey(t){const s=[];for(const i of t.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.decode(i));break}return s.join(".")}close(){return Promise.resolve()}dataLen(t,s){const i=s&&s.get(Qt.MessageSizeHdr)||"";return i!==""?parseInt(i,10):t.length}smToEntry(t){return new I2(this.bucket,this.prefixLen,t)}jmToEntry(t){const s=this.decodeKey(t.subject.substring(this.prefixLen));return new $2(this.bucket,s,t)}async create(t,s){var c;let i;try{const m=await this.put(t,s,{previousSeq:0});return Promise.resolve(m)}catch(m){if(i=m,((c=m==null?void 0:m.api_error)==null?void 0:c.err_code)!==10071)return Promise.reject(m)}let o=0;try{const m=await this.get(t);return(m==null?void 0:m.operation)==="DEL"||(m==null?void 0:m.operation)==="PURGE"?(o=m!==null?m.revision:0,this.update(t,s,o)):Promise.reject(i)}catch(m){return Promise.reject(m)}}update(t,s,i){if(i<=0)throw new Error("version must be greater than 0");return this.put(t,s,{previousSeq:i})}async put(t,s,i={}){var m,y;const o=this.encodeKey(t);this.validateKey(o);const c={};if(i.previousSeq!==void 0){const g=qr();c.headers=g,g.set(ir.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,c)).seq}catch(g){const u=g;return u.isJetStreamError()?(u.message=(m=u.api_error)==null?void 0:m.description,u.code=`${(y=u.api_error)==null?void 0:y.code}`,Promise.reject(u)):Promise.reject(g)}}async get(t,s){const i=this.encodeKey(t);this.validateKey(i);let o={last_by_subj:this.subjectForKey(i)};s&&s.revision>0&&(o={seq:s.revision});let c;try{this.direct?c=await this.jsm.direct.getMessage(this.bucketName(),o):c=await this.jsm.streams.getMessage(this.bucketName(),o);const m=this.smToEntry(c);return m.key!==i?null:m}catch(m){if(m.code===ue.JetStream404NoMessages)return null;throw m}}purge(t,s){return this._deleteOrPurge(t,"PURGE",s)}delete(t,s){return this._deleteOrPurge(t,"DEL",s)}async purgeDeletes(t=1800*1e3){const s=pt(),i=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&i.push(g)})().then(),await s,o.stop();const c=Date.now()-t,m=i.map(g=>{const u=this.subjectForKey(g.key);return g.created.getTime()>=c?this.jsm.streams.purge(this.stream,{filter:u,keep:1}):this.jsm.streams.purge(this.stream,{filter:u,keep:0})}),y=await Promise.all(m);return y.unshift({success:!0,purged:0}),y.reduce((g,u)=>(g.purged+=u.purged,g))}async _deleteOrPurge(t,s,i){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,s,i);const o=await this.keys(t),c=[];for await(const m of o)c.push(this._doDeleteOrPurge(m,s)),c.length===100&&(await Promise.all(c),c.length=0);c.length>0&&await Promise.all(c)}async _doDeleteOrPurge(t,s,i){const o=this.encodeKey(t);this.validateKey(o);const c=qr();c.set(yu,s),s==="PURGE"&&c.set(Qt.RollupHdr,Qt.RollupValueSubject),i!=null&&i.previousSeq&&c.set(ir.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),An,{headers:c})}_buildCC(t,s,i={}){let c=(Array.isArray(t)?t:[t]).map(g=>{const u=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(u)}),m=Et.LastPerSubject;s===Jn.AllHistory&&(m=Et.All),s===Jn.UpdatesOnly&&(m=Et.New);let y;return c.length===1&&(y=c[0],c=void 0),Object.assign({deliver_policy:m,ack_policy:qt.None,filter_subjects:c,filter_subject:y,flow_control:!0,idle_heartbeat:mt(5*1e3)},i)}remove(t){return this.purge(t)}async history(t={}){const s=t.key??">",i=new Bt,o={};o.headers_only=t.headers_only||!1;let c;c=()=>{i.stop()};let m=0;const y=this._buildCC(s,Jn.AllHistory,o),g=y.filter_subject,u=_s(y);u.bindStream(this.stream),u.orderedConsumer(),u.callback((b,x)=>{if(b){i.stop(b);return}if(x){const v=this.jmToEntry(x);i.push(v),i.received++,(c&&m>0&&i.received>=m||x.info.pending===0)&&(i.push(c),c=void 0)}});const d=await this.js.subscribe(g,u);if(c){const{info:{last:b}}=d,x=b.num_pending+b.delivered.consumer_seq;if(x===0||i.received>=x)try{c()}catch(v){i.stop(v)}finally{c=void 0}else m=x}return i._data=d,i.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{i.stop()}).catch(b=>{i.stop(b)}),i}canSetWatcherName(){const s=this.js.nc,{ok:i}=s.features.get(Ke.JS_NEW_CONSUMER_CREATE_API);return i}async watch(t={}){const s=t.key??">",i=new Bt,o={};o.headers_only=t.headers_only||!1;let c=Jn.LastValue;t.include===Jn.AllHistory?c=Jn.AllHistory:t.include===Jn.UpdatesOnly&&(c=Jn.UpdatesOnly);const m=t.ignoreDeletes===!0;let y=t.initializedFn,g=0;const u=this._buildCC(s,c,o),d=u.filter_subject,b=_s(u);this.canSetWatcherName()&&b.consumerName(Es.next()),b.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&b.startSequence(t.resumeFromRevision),b.orderedConsumer(),b.callback((v,w)=>{if(v){i.stop(v);return}if(w){const S=this.jmToEntry(w);if(m&&S.operation==="DEL")return;i.push(S),i.received++,y&&(g>0&&i.received>=g||w.info.pending===0)&&(i.push(y),y=void 0)}});const x=await this.js.subscribe(d,b);if(y){const{info:{last:v}}=x,w=v.num_pending+v.delivered.consumer_seq;if(w===0||i.received>=w)try{y()}catch(S){i.stop(S)}finally{y=void 0}else g=w}return i._data=x,i.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{i.stop()}).catch(v=>{i.stop(v)}),i}async keys(t=">"){const s=new Bt,i=this._buildCC(t,Jn.LastValue,{headers_only:!0}),o=Array.isArray(t)?">":i.filter_subject,c=_s(i);c.bindStream(this.stream),c.orderedConsumer();const m=await this.js.subscribe(o,c);return(async()=>{var g;for await(const u of m){const d=(g=u.headers)==null?void 0:g.get(yu);if(d!=="DEL"&&d!=="PURGE"){const b=this.decodeKey(u.subject.substring(this.prefixLen));s.push(b)}u.info.pending===0&&m.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),m.info.last.num_pending===0&&m.unsubscribe(),s}purgeBucket(t){return this.jsm.streams.purge(this.bucketName(),t)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var c;const s=((c=this.js.nc.info)==null?void 0:c.cluster)??"",i=this.bucketName(),o=await this.jsm.streams.info(i);return new Ex(o,s)}}class Ex{constructor(t,s=""){j(this,"si");j(this,"cluster");this.si=t,this.cluster=s}get bucket(){return this.si.config.name.startsWith(_n)?this.si.config.name.substring(_n.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 im(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var t;return((t=this.si.config.placement)==null?void 0:t.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Os.None:!1}}const lm="OBJ_",o1="SHA-256=";function j2(n){return ru(n),`${lm}${n}`}function k2(n){return n.startsWith(lm)?n.substring(4):n}class Td{constructor(t){j(this,"si");j(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return k2(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==Os.None:!1}}function oc(n){if(n===void 0)return;const{domain:t}=n;if(t===void 0)return n;const s=Object.assign({},n);if(delete s.domain,t==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${t}.API`},s}var Un;(function(n){n[n.Unset=-1]="Unset",n[n.Consume=0]="Consume",n[n.Fetch=1]="Fetch"})(Un||(Un={}));var ar;(function(n){n.HeartbeatsMissed="heartbeats_missed",n.ConsumerNotFound="consumer_not_found",n.StreamNotFound="stream_not_found",n.ConsumerDeleted="consumer_deleted",n.OrderedConsumerRecreated="ordered_consumer_recreated",n.NoResponders="no_responders"})(ar||(ar={}));var Qi;(function(n){n.DebugEvent="debug",n.Discard="discard",n.Reset="reset",n.Next="next"})(Qi||(Qi={}));const l1=Uint8Array.of(43,65,67,75),T2=Uint8Array.of(45,78,65,75),ro=Uint8Array.of(43,87,80,73),N2=Uint8Array.of(43,78,88,84),C2=Uint8Array.of(43,84,69,82,77),M2=Uint8Array.of(32);function Oo(n,t=5e3){return new J2(n,t)}class td extends Bt{constructor(s,i,o=!1){super();j(this,"consumer");j(this,"opts");j(this,"sub");j(this,"monitor");j(this,"pending");j(this,"inbox");j(this,"refilling");j(this,"pong");j(this,"callback");j(this,"timeout");j(this,"cleanupHandler");j(this,"listeners");j(this,"statusIterator");j(this,"forOrderedConsumer");j(this,"resetHandler");j(this,"abortOnMissingResource");j(this,"bind");j(this,"inBackOff");this.consumer=s;const c=i;this.opts=this.parseOptions(i,o),this.callback=c.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=Dr(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=c.abort_on_missing_resource===!0,this.bind=c.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:i,idle_heartbeat:o,threshold_bytes:c,threshold_messages:m}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:y}=this;y&&y.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,u)=>{var b,x,v,w;if(g){this.stop(g);return}if((b=this.monitor)==null||b.work(),u.subject===this.inbox){if(_d(u))return;const S=(x=u.headers)==null?void 0:x.code,C=((w=(v=u.headers)==null?void 0:v.description)==null?void 0:w.toLowerCase())||"unknown",{msgsLeft:q,bytesLeft:B}=this.parseDiscard(u.headers);if(q>0||B>0)this.pending.msgs-=q,this.pending.bytes-=B,this.pending.requests--,this.notify(Qi.Discard,{msgsLeft:q,bytesLeft:B});else if(S===400){this.stop(new ye(C,`${S}`));return}else if(S===409&&C==="consumer deleted"){if(this.notify(ar.ConsumerDeleted,`${S} ${C}`),!this.refilling||this.abortOnMissingResource){const se=new ye(C,`${S}`);this.stop(se);return}}else if(S===503){if(this.notify(ar.NoResponders,`${S} No Responders`),!this.refilling||this.abortOnMissingResource){const se=new ye("no responders",`${S}`);this.stop(se);return}}else this.notify(Qi.DebugEvent,`${S} ${C}`)}else this._push(Oo(u,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=u.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=m||i&&this.pending.bytes<=c){const S=this.pullOptions();this.pull(S)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new om(o,g=>(this.notify(ar.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var u;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const d of g)switch(d.type){case Rr.Disconnect:(u=this.monitor)==null||u.cancel();break;case Rr.Reconnect:this.resetPending().then(b=>{var x;b&&((x=this.monitor)==null||x.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const i=typeof s=="function"?s:null;try{i?i():this.callback(s)}catch(o){this.stop(o)}}}notify(s,i){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:i})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,i=0;const o=sm([this.opts.expires]);let c=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(m){if(m.message==="stream not found"){if(i++,this.notify(ar.StreamNotFound,i),!this.refilling||this.abortOnMissingResource)return this.stop(m),!1}else if(m.message==="consumer not found"){if(s++,this.notify(ar.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(m),!1;if(this.forOrderedConsumer)return!1}else s=0,i=0;this.inBackOff=!0;const y=o.backoff(c),g=sa(y);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),c++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const i=this.consumer.api.nc;this._push(()=>{i.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(Qi.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,i=this.opts.max_bytes-this.pending.bytes,o=mt(this.opts.idle_heartbeat),c=mt(this.opts.expires);return{batch:s,max_bytes:i,idle_heartbeat:o,expires:c}}parseDiscard(s){const i={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Qt.PendingMessagesHdr);o&&(i.msgsLeft=parseInt(o));const c=s==null?void 0:s.get(Qt.PendingBytesHdr);return c&&(i.bytesLeft=parseInt(c)),i}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,i;(s=this.monitor)==null||s.cancel(),this.monitor=null,(i=this.timeout)==null||i.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var i,o;this.done||((i=this.sub)==null||i.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(c=>{c.stop()})}))}parseOptions(s,i=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,i){const c=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||c;const m=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||m}return o}status(){const s=new Bt;return this.listeners.push(s),Promise.resolve(s)}}class R2 extends Bt{constructor(){super();j(this,"src");j(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(i=>{this.stop(i||void 0)}),(async()=>{const i=await this.src.status();for await(const o of i)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,i){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:i})})}stop(s){var i;this.done||((i=this.src)==null||i.stop(s),super.stop(s),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new Bt;return this.listeners.push(s),Promise.resolve(s)}}class Nd{constructor(t,s){j(this,"api");j(this,"_info");j(this,"stream");j(this,"name");this.api=t,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(t={max_messages:100,expires:3e4}){return Promise.resolve(new td(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const s=new td(this,t,!1),i=Math.round(s.opts.expires*1.05),o=ea(i);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(t={expires:3e4}){const s=pt(),i=t;i.max_messages=1;const o=new td(this,i,!1),c=Math.round(o.opts.expires*1.05);c>=6e4&&(async()=>{for await(const y of await o.status())if(y.type===ar.HeartbeatsMissed&&y.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const y of o){s.resolve(y);break}})().catch(()=>{});const m=ea(c);return o.closed().then(y=>{y?s.reject(y):s.resolve(null)}).catch(y=>{s.reject(y)}).finally(()=>{m.cancel()}),m.catch(y=>{s.resolve(null),o.close().catch()}),o.trackTimeout(m),s}delete(){const{stream_name:t,name:s}=this._info;return this.api.delete(t,s)}info(t=!1){if(t)return Promise.resolve(this._info);const{stream_name:s,name:i}=this._info;return this.api.info(s,i).then(o=>(this._info=o,this._info))}}class D2{constructor(t,s,i={}){j(this,"api");j(this,"consumerOpts");j(this,"consumer");j(this,"opts");j(this,"cursor");j(this,"stream");j(this,"namePrefix");j(this,"serial");j(this,"currentConsumer");j(this,"userCallback");j(this,"iter");j(this,"type");j(this,"startSeq");j(this,"maxInitialReset");this.api=t,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Es.next(),typeof i.name_prefix=="string"&&(Ou("name_prefix",i.name_prefix),this.namePrefix=i.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=Un.Unset,this.consumerOpts=i,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(t){this.serial++;const s=`${this.namePrefix}_${this.serial}`;t=t===0?1:t;const i={name:s,deliver_policy:Et.StartSequence,opt_start_seq:t,ack_policy:qt.None,inactive_threshold:mt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(i.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(i.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(i.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(i.replay_policy=this.consumerOpts.replay_policy),t===this.startSeq+1&&(i.deliver_policy=this.consumerOpts.deliver_policy||Et.StartSequence,(this.consumerOpts.deliver_policy===Et.LastPerSubject||this.consumerOpts.deliver_policy===Et.New||this.consumerOpts.deliver_policy===Et.Last)&&(delete i.opt_start_seq,i.deliver_policy=this.consumerOpts.deliver_policy),i.deliver_policy===Et.LastPerSubject&&typeof i.filter_subjects>"u"&&typeof i.filter_subject>"u"&&(i.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete i.opt_start_seq,i.deliver_policy=Et.StartTime,i.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(i.inactive_threshold=mt(this.consumerOpts.inactive_threshold))),i}async resetConsumer(t=0){var m,y,g,u,d;Es.next();const s=this.serial===0;(m=this.consumer)==null||m.delete().catch(()=>{}),t=t===0?1:t,this.cursor.deliver_seq=0;const i=this.getConsumerOpts(t);i.max_deliver=1,i.mem_storage=!0;const o=sm([((y=this.opts)==null?void 0:y.expires)||3e4]);let c;for(let b=0;;b++)try{c=await this.api.add(this.stream,i),(g=this.iter)==null||g.notify(ar.OrderedConsumerRecreated,c.name);break}catch(x){if(x.message==="stream not found"&&((u=this.iter)==null||u.notify(ar.StreamNotFound,b),this.type===Un.Fetch||this.opts.abort_on_missing_resource===!0))return(d=this.iter)==null||d.stop(x),Promise.reject(x);if(s&&b>=this.maxInitialReset)throw x;await sa(o.backoff(b+1))}return c}internalHandler(t){return s=>{var o;if(this.serial!==t)return;const i=s.info.deliverySequence;if(i!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=i,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(o=this.iter)==null||o.push(s)}}async reset(t={max_messages:100,expires:3e4},s){var g,u;s=s||{};const i=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===Un.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((u=this.iter)==null?void 0:u.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||i)&&(this.iter=new R2),this.consumer=new Nd(this.api,this.currentConsumer);const c=t;c.callback=this.internalHandler(this.serial);let m=null;this.type===Un.Fetch&&i?m=await this.consumer.fetch(t):this.type===Un.Consume&&(m=await this.consumer.consume(t));const y=m;y.forOrderedConsumer=!0,y.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(y)}notifyOrderedResetAndReset(){var t;(t=this.iter)==null||t.notify(Qi.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(t={max_messages:100,expires:3e4}){if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Un.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Un.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:i}=t;return i&&(this.userCallback=i),this.type=Un.Consume,this.opts=t,await this.reset(t),this.iter}async fetch(t={max_messages:100,expires:3e4}){var o;if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Un.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((o=this.iter)==null?void 0:o.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:i}=t;return i&&(this.userCallback=i),this.type=Un.Fetch,this.opts=t,await this.reset(t,{fromFetch:!0}),this.iter}async next(t={expires:3e4}){const s=t;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const i=pt();return s.callback=c=>{this.userCallback=null,i.resolve(c)},(await this.fetch(s)).iterClosed.then(c=>{c&&i.reject(c),i.resolve(null)}).catch(c=>{i.reject(c)}),i}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(t=>Promise.resolve(t)).catch(t=>Promise.reject(t)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(t){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):t&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Cd{constructor(t){j(this,"api");j(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(Ke.JS_SIMPLIFICATION);return t.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${t.min} or better`))}getPullConsumerFor(t){if(t.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new Nd(this.api,t)}async get(t,s={}){return typeof s=="object"?this.ordered(t,s):(await this.checkVersion(),this.api.info(t,s).then(i=>i.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Nd(this.api,i)).catch(i=>Promise.reject(i)))}async ordered(t,s){await this.checkVersion();const i=this.api;return new cm(i.nc,i.opts).info(t).then(c=>Promise.resolve(new D2(this.api,t,s))).catch(c=>Promise.reject(c))}}class ju{constructor(t,s){j(this,"api");j(this,"_info");this.api=t,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(t=>t.alternates?t.alternates:[])}async best(){if(await this.info(),this._info.alternates){const t=await this.api.info(this._info.alternates[0].name);return new ju(this.api,t)}else return this}info(t=!1,s){return t?Promise.resolve(this._info):this.api.info(this.name,s).then(i=>(this._info=i,this._info))}getConsumerFromInfo(t){return new Cd(new du(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new Cd(new du(this.api.nc,this.api.opts)).get(this.name,t)}getMessage(t){return this.api.getMessage(this.name,t)}deleteMessage(t,s){return this.api.deleteMessage(this.name,t,s)}}class cm extends No{constructor(t,s){super(t,s)}checkStreamConfigVersions(t){const s=this.nc;if(t.metadata){const{min:o,ok:c}=s.features.get(Ke.JS_STREAM_CONSUMER_METADATA);if(!c)throw new Error(`stream 'metadata' requires server ${o}`)}if(t.first_seq){const{min:o,ok:c}=s.features.get(Ke.JS_STREAM_FIRST_SEQ);if(!c)throw new Error(`stream 'first_seq' requires server ${o}`)}if(t.subject_transform){const{min:o,ok:c}=s.features.get(Ke.JS_STREAM_SUBJECT_TRANSFORM);if(!c)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(t.compression){const{min:o,ok:c}=s.features.get(Ke.JS_STREAM_COMPRESSION);if(!c)throw new Error(`stream 'compression' requires server ${o}`)}if(t.consumer_limits){const{min:o,ok:c}=s.features.get(Ke.JS_DEFAULT_CONSUMER_LIMITS);if(!c)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function i(o,c){var y;if((((y=c==null?void 0:c.subject_transforms)==null?void 0:y.length)||0)>0){const{min:g,ok:u}=s.features.get(Ke.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!u)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}t.sources&&t.sources.forEach(o=>{i("stream sources",o)}),t.mirror&&i("stream mirror",t.mirror)}async add(t={}){var o;this.checkStreamConfigVersions(t),Kt(t.name),t.mirror=oc(t.mirror),t.sources=(o=t.sources)==null?void 0:o.map(oc);const i=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(i),i}async delete(t){return Kt(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,s={}){var y;if(typeof t=="object"){const g=t;t=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),Kt(t);const i=await this.info(t),o=Object.assign(i.config,s);o.mirror=oc(o.mirror),o.sources=(y=o.sources)==null?void 0:y.map(oc);const m=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,o);return this._fixInfo(m),m}async info(t,s){Kt(t);const i=`${this.prefix}.STREAM.INFO.${t}`;let c=await this._request(i,s),{total:m,limit:y}=c,g=c.state.subjects?Object.getOwnPropertyNames(c.state.subjects).length:1;if(m&&m>g){const u=[c],d=s||{};let b=0;for(;m>g;){b++,d.offset=y*b;const v=await this._request(i,d);m=v.total,u.push(v);const w=Object.getOwnPropertyNames(v.state.subjects).length;if(g+=w,w<y)break}let x={};for(let v=0;v<u.length;v++)c=u[v],c.state.subjects&&(x=Object.assign(x,c.state.subjects));c.offset=0,c.total=0,c.limit=0,c.state.subjects=x}return this._fixInfo(c),c}list(t=""){const s=t!=null&&t.length?{subject:t}:{},i=c=>{const m=c;return m.streams.forEach(y=>{this._fixInfo(y)}),m.streams},o=`${this.prefix}.STREAM.LIST`;return new po(o,i,this,s)}_fixInfo(t){t.config.sealed=t.config.sealed||!1,t.config.deny_delete=t.config.deny_delete||!1,t.config.deny_purge=t.config.deny_purge||!1,t.config.allow_rollup_hdrs=t.config.allow_rollup_hdrs||!1}async purge(t,s){if(s){const{keep:o,seq:c}=s;if(typeof o=="number"&&typeof c=="number")throw new Error("can specify one of keep or seq")}return Kt(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,s)}async deleteMessage(t,s,i=!0){Kt(t);const o={seq:s};return i||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${t}`,o)).success}async getMessage(t,s){Kt(t);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,s);return new Ox(o)}find(t){return this.findStream(t)}listKvs(){const t=i=>{var g;const c=i.streams.filter(u=>u.config.name.startsWith(_n));c.forEach(u=>{this._fixInfo(u)});let m="";return c.length&&(m=((g=this.nc.info)==null?void 0:g.cluster)??""),c.map(u=>new Ex(u,m))},s=`${this.prefix}.STREAM.LIST`;return new po(s,t,this)}listObjectStores(){const t=i=>{const c=i.streams.filter(y=>y.config.name.startsWith(lm));return c.forEach(y=>{this._fixInfo(y)}),c.map(y=>new Td(y))},s=`${this.prefix}.STREAM.LIST`;return new po(s,t,this)}names(t=""){const s=t!=null&&t.length?{subject:t}:{},i=c=>c.streams,o=`${this.prefix}.STREAM.NAMES`;return new po(o,i,this,s)}async get(t){const s=await this.info(t);return Promise.resolve(new ju(this,s))}}class L2 extends No{constructor(t,s){super(t,s)}async getMessage(t,s){Kt(t);let i=s;const{last_by_subj:o}=i;o&&(i=null);const c=i?this.jc.encode(i):An,m=this.opts.apiPrefix||"$JS.API",y=o?`${m}.DIRECT.GET.${t}.${o}`:`${m}.DIRECT.GET.${t}`,g=await this.nc.request(y,c,{timeout:this.timeout}),u=Ji(g);if(u)return Promise.reject(u);const d=new Md(g);return Promise.resolve(d)}async getBatch(t,s){Kt(t);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${t}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const c=JSON.stringify(s,(g,u)=>g==="up_to_time"&&u instanceof Date?u.toISOString():u),m=new Bt,y=await this.nc.requestMany(o,c,{strategy:Qn.SentinelMsg});return(async()=>{var b,x,v;let g=!1,u=!1,d;for await(const w of y){if(!g){g=!0;const S=((b=w.headers)==null?void 0:b.code)||0;if(S!==0&&S<200||S>299){d=(x=w.headers)==null?void 0:x.description.toLowerCase();break}if(((v=w.headers)==null?void 0:v.get("Nats-Num-Pending"))===""){u=!0;break}}if(w.data.length===0)break;m.push(new Md(w))}m.push(()=>{if(u)throw new Error("batch direct get not supported by the server");if(d)throw new Error(`bad request: ${d}`);m.stop()})})(),Promise.resolve(m)}}class Md{constructor(t){j(this,"data");j(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(Vi.Subject)}get seq(){const t=this.header.last(Vi.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Vi.TimeStamp)}get stream(){return this.header.last(Vi.Stream)}json(t){return Wn(t).decode(this.data)}string(){return Sn.decode(this.data)}}j(Md,"jc");class q2 extends No{constructor(s,i){super(s,i);j(this,"streams");j(this,"consumers");j(this,"direct");this.streams=new cm(s,i),this.consumers=new du(s,i),this.direct=new L2(s,i)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new Bt;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(i,o)=>{if(i)throw i;try{const c=this.parseJsResponse(o),m=c.type.split("."),y=m[m.length-1];s.push({kind:y,data:c})}catch(c){s.stop(c)}}}),s}}class Ox{constructor(t){j(this,"_header");j(this,"smr");this.smr=t}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):An}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=vs.decode(t)}else this._header=qr();return this._header}_parse(t){const s=atob(t),i=s.length,o=new Uint8Array(i);for(let c=0;c<i;c++)o[c]=s.charCodeAt(c);return o}json(t){return Wn(t).decode(this.data)}string(){return Sn.decode(this.data)}}j(Ox,"jc");class B2{constructor(t){j(this,"api");this.api=t}get(t){return this.api.info(t).then(s=>new ju(this.api,s))}}class nd{constructor(t){j(this,"info");j(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=vs.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var t,s;return((t=this.info.options)==null?void 0:t.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function c1(n){const t={name:n.name,description:n.description??"",options:n.options,metadata:n.metadata};if(n.headers){const s=n.headers;t.headers=s.toRecord()}return t}function P2(){return new ReadableStream({pull(n){n.enqueue(new Uint8Array(0)),n.close()}})}class vo{constructor(t,s,i){j(this,"jsm");j(this,"js");j(this,"stream");j(this,"name");this.name=t,this.jsm=s,this.js=i}_checkNotEmpty(t){return!t||t.length===0?{name:t,error:new Error("name cannot be empty")}:{name:t}}async info(t){const s=await this.rawInfo(t);return s?new nd(s):null}async list(){const t=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const i of s){if(i===null)break;t.push(i)}return Promise.resolve(t)}async rawInfo(t){const{name:s,error:i}=this._checkNotEmpty(t);if(i)return Promise.reject(i);const o=this._metaSubject(s);try{const c=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),y=Wn().decode(c.data);return y.revision=c.seq,y}catch(c){return c.code==="404"?null:Promise.reject(c)}}async _si(t){try{return await this.jsm.streams.info(this.stream,t)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let t=await this._si();return t===null?Promise.reject(new Error("object store not found")):(t.config.sealed=!0,t=await this.jsm.streams.update(this.stream,t.config),Promise.resolve(new Td(t)))}async status(t){const s=await this._si(t);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Td(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,s,i){var le;const o=this.js.getOptions();i=i||{timeout:o.timeout},i.timeout=i.timeout||o.timeout,i.previousRevision=i.previousRevision??void 0;const{timeout:c,previousRevision:m}=i,y=this.js.nc.info,g=(y==null?void 0:y.max_payload)||1024;t=t||{},t.options=t.options||{};let u=((le=t.options)==null?void 0:le.max_chunk_size)||128*1024;u=u>g?g:u,t.options.max_chunk_size=u;const d=await this.info(t.name),{name:b,error:x}=this._checkNotEmpty(t.name);if(x)return Promise.reject(x);const v=Es.next(),w=this._chunkSubject(v),S=this._metaSubject(b),C=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},c1(t)),q=pt(),B=[],se=new na;try{const R=s?s.getReader():null,H=Wg.create();for(;;){const{done:ae,value:$}=R?await R.read():{done:!0,value:void 0};if(ae){if(se.size()>0){const X=se.drain();H.update(X),C.chunks++,C.size+=X.length,B.push(this.js.publish(w,X,{timeout:c}))}await Promise.all(B),B.length=0,C.mtime=new Date().toISOString();const I=Xi.encode(H.digest());C.digest=`${o1}${I}`,C.deleted=!1;const D=qr();typeof m=="number"&&D.set(ir.ExpectedLastSubjectSequenceHdr,`${m}`),D.set(Qt.RollupHdr,Qt.RollupValueSubject);const Q=await this.js.publish(S,Wn().encode(C),{headers:D,timeout:c});if(C.revision=Q.seq,d)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${d.nuid}`})}catch{}q.resolve(new nd(C));break}if($)for(se.fill($);se.size()>u;){C.chunks++,C.size+=u;const I=se.drain(t.options.max_chunk_size);H.update(I),B.push(this.js.publish(w,I,{timeout:c}))}}}catch(R){await this.jsm.streams.purge(this.stream,{filter:w}),q.reject(R)}return q}putBlob(t,s,i){function o(c){return new ReadableStream({pull(m){m.enqueue(c),m.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(t,o(s),i)}put(t,s,i){var o;return(o=t==null?void 0:t.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(t,s,i)}async getBlob(t){async function s(c){const m=new na,y=c.getReader();for(;;){const{done:g,value:u}=await y.read();if(g)return m.drain();u&&u.length&&m.fill(u)}}const i=await this.get(t);if(i===null)return Promise.resolve(null);const o=await Promise.all([i.error,s(i.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(t){const s=await this.rawInfo(t);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const b=s.options.link.name||"";if(b==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await vo.create(this.js,s.options.link.bucket):this).get(b)}if(!s.digest.startsWith(o1))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const i=Ed(s.digest.substring(8));if(i===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=pt(),c={info:new nd(s),error:o};if(s.size===0)return c.data=P2(),o.resolve(null),Promise.resolve(c);let m;const y=_s();y.orderedConsumer();const g=Wg.create(),u=`$O.${this.name}.C.${s.nuid}`,d=await this.js.subscribe(u,y);return(async()=>{for await(const b of d)b.data.length>0&&(g.update(b.data),m.enqueue(b.data)),b.info.pending===0&&(AE(i,g.digest())?m.close():m.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${i}`)),d.unsubscribe())})().then(()=>{o.resolve()}).catch(b=>{m.error(b),o.reject(b)}),c.data=new ReadableStream({start(b){m=b},cancel(){d.unsubscribe()}}),c}linkStore(t,s){if(!(s instanceof vo))return Promise.reject("bucket required");const i=s,{name:o,error:c}=this._checkNotEmpty(t);if(c)return Promise.reject(c);const m={name:o,options:{link:{bucket:i.name}}};return this._put(m,null)}async link(t,s){const{name:i,error:o}=this._checkNotEmpty(t);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const c=await this.rawInfo(t);if(c!==null&&!c.deleted)return Promise.reject(new Error("an object already exists with that name"));const m={bucket:s.bucket,name:s.name},y={name:i,bucket:s.bucket,options:{link:m}};await this.js.publish(this._metaSubject(t),JSON.stringify(y));const g=await this.info(t);return Promise.resolve(g)}async delete(t){const s=await this.rawInfo(t);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const i=Wn(),o=qr();return o.set(Qt.RollupHdr,Qt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),i.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(t,s={}){const i=await this.rawInfo(t);if(i===null)return Promise.reject(new Error("object not found"));if(i.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??i.name;const{name:o,error:c}=this._checkNotEmpty(s.name);if(c)return Promise.reject(c);if(t!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const m=Object.assign({},i,c1(s)),y=await this.js.publish(this._metaSubject(m.name),JSON.stringify(m));return t!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(t)}),Promise.resolve(y)}async watch(t={}){t.includeHistory=t.includeHistory??!1,t.ignoreDeletes=t.ignoreDeletes??!1;let s=!1;const i=new Bt,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(i.push(null),s=!0):i.stop(g)}const c=Wn(),m=_s();m.orderedConsumer(),t.includeHistory?m.deliverLastPerSubject():(s=!0,m.deliverNew()),m.callback((g,u)=>{var d;if(g){i.stop(g);return}if(u!==null){const b=c.decode(u.data);b.deleted&&t.ignoreDeletes===!0||i.push(b),((d=u.info)==null?void 0:d.pending)===0&&!s&&(s=!0,i.push(null))}});const y=await this.js.subscribe(o,m);return i._data=y,i.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{i.stop()}).catch(g=>{i.stop(g)}),i}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${Xi.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=j2(this.name)}catch(o){return Promise.reject(o)}const s=(t==null?void 0:t.ttl)||0;delete t.ttl;const i=Object.assign({max_age:s},t);i.name=this.stream,i.num_replicas=t.replicas??1,i.allow_direct=!0,i.allow_rollup_hdrs=!0,i.discard=wo.New,i.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],t.placement&&(i.placement=t.placement),t.metadata&&(i.metadata=t.metadata),typeof t.compression=="boolean"&&(i.compression=t.compression?Os.S2:Os.None);try{await this.jsm.streams.info(i.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(i)}}static async create(t,s,i={}){const o=await t.jetstreamManager(),c=new vo(s,o,t);return await c.init(i),Promise.resolve(c)}}class U2{constructor(t){j(this,"js");this.js=t}kv(t,s={}){const i=this.js,{ok:o,min:c}=i.nc.features.get(Ke.JS_KV);return o?s.bindOnly?Eo.bind(this.js,t,s):Eo.create(this.js,t,s):Promise.reject(new Error(`kv is only supported on servers ${c} or better`))}os(t,s={}){var m;if(typeof((m=crypto==null?void 0:crypto.subtle)==null?void 0:m.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const i=this.js,{ok:o,min:c}=i.nc.features.get(Ke.JS_OBJECTSTORE);return o?vo.create(this.js,t,s):Promise.reject(new Error(`objectstore is only supported on servers ${c} or better`))}}class um extends No{constructor(s,i){super(s,i);j(this,"consumers");j(this,"streams");j(this,"consumerAPI");j(this,"streamAPI");this.consumerAPI=new du(s,i),this.streamAPI=new cm(s,i),this.consumers=new Cd(this.consumerAPI),this.streams=new B2(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const i=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(i)}get apiPrefix(){return this.prefix}get views(){return new U2(this)}async publish(s,i=An,o){o=o||{},o.expect=o.expect||{};const c=(o==null?void 0:o.headers)||qr();o&&(o.msgID&&c.set(ir.MsgIdHdr,o.msgID),o.expect.lastMsgID&&c.set(ir.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&c.set(ir.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&c.set(ir.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&c.set(ir.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const m=o.timeout||this.timeout,y={};m&&(y.timeout=m),o&&(y.headers=c);let{retries:g,retry_delay:u}=o;g=g||1,u=u||250;let d;for(let x=0;x<g;x++)try{d=await this.nc.request(s,i,y);break}catch(v){if(v.code==="503"&&x+1<g)await sa(u);else throw v}const b=this.parseJsResponse(d);if(b.stream==="")throw ye.errorForCode(ue.JetStreamInvalidAck);return b.duplicate=b.duplicate?b.duplicate:!1,b}async pull(s,i,o=0){Kt(s),Ki(i);let c=this.timeout;o>c&&(c=o),o=o<0?0:mt(o);const m={batch:1,no_wait:o===0,expires:o},y=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(m),{noMux:!0,timeout:c}),g=Ji(y);if(g)throw g;return Oo(y,this.timeout)}fetch(s,i,o={}){Kt(s),Ki(i);let c=null;const m=(o.max_bytes??0)>0;let y=0;const g=m?o.max_bytes:0;let u=null;const d={};if(d.batch=o.batch||1,g){const B=this.nc.features.get(Ke.JS_PULL_MAX_BYTES);if(!B.ok)throw new Error(`max_bytes is only supported on servers ${B.min} or better`);d.max_bytes=g}d.no_wait=o.no_wait||!1,d.no_wait&&d.expires&&(d.expires=0);const b=o.expires||0;if(b&&(d.expires=mt(b)),b===0&&d.no_wait===!1)throw new Error("expires or no_wait is required");const x=o.idle_heartbeat||0;x&&(d.idle_heartbeat=mt(x),o.delay_heartbeat===!0&&(d.idle_heartbeat=mt(x*4)));const v=new Bt,w=d.batch;let S=0;v.protocolFilterFn=(B,se=!1)=>_d(B.msg)?(u==null||u.work(),!1):!0,v.dispatchedFn=B=>{if(B){if(m&&(y+=B.data.length),S++,c&&B.info.pending===0)return;(v.getPending()===1&&B.info.pending===0||w===S||g>0&&y>=g)&&v.stop()}};const C=Dr(this.nc.options.inboxPrefix),q=this.nc.subscribe(C,{max:o.batch,callback:(B,se)=>{B===null&&(B=Ji(se)),B!==null?(c&&(c.cancel(),c=null),oE(B)?v.stop(jx(B)===null?void 0:B):v.stop(B)):(u==null||u.work(),v.received++,v.push(Oo(se,this.timeout)))}});return b&&(c=ea(b),c.catch(()=>{q.isClosed()||(q.drain().catch(()=>{}),c=null),u&&u.cancel()})),(async()=>{try{x&&(u=new om(x,B=>(v.push(()=>{v.err=new ye(`${zn.IdleHeartbeatMissed}: ${B}`,ue.JetStreamIdleHeartBeat)}),!0)))}catch{}await q.closed,c!==null&&(c.cancel(),c=null),u&&u.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(d),{reply:C}),v}async pullSubscribe(s,i=_s()){const o=await this._processOptions(s,i);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const c=o.config.ack_policy;if(c===qt.None||c===qt.All)throw new Error("ack policy for pull consumers must be explicit");const m=this._buildTypedSubscriptionOpts(o),y=new H2(this,o.deliver,m);y.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw y.unsubscribe(),g}return y}async subscribe(s,i=_s()){const o=await this._processOptions(s,i);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const c=this._buildTypedSubscriptionOpts(o),m=new Ax(this,o.deliver,c);m.info=o;try{await this._maybeCreateConsumer(o)}catch(y){throw m.unsubscribe(),y}return m._maybeSetupHbMonitoring(),m}async _processOptions(s,i=_s()){const o=Kg(i)?i.getOpts():i;if(o.isBind=Kg(i)?i.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==qt.NotSet&&o.config.ack_policy!==qt.None)throw new ye("ordered consumer: ack_policy can only be set to 'none'",ue.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new ye("ordered consumer: durable_name cannot be set",ue.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new ye("ordered consumer: deliver_subject cannot be set",ue.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new ye("ordered consumer: max_deliver cannot be set",ue.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new ye("ordered consumer: deliver_group cannot be set",ue.ApiError);o.config.deliver_subject=Dr(this.nc.options.inboxPrefix),o.config.ack_policy=qt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||mt(5e3),o.config.ack_wait=mt(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===qt.NotSet&&(o.config.ack_policy=qt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const c=await this.consumerAPI.info(o.stream,o.config.durable_name);if(c){if(c.config.filter_subject&&c.config.filter_subject!==s)throw new Error("subject does not match consumer");const m=o.config.deliver_group??"";if(m===""&&c.push_bound===!0)throw new Error("duplicate subscription");const y=c.config.deliver_group??"";if(m!==y)throw y===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${y}'`);o.last=c,o.config=c.config,o.attached=!0,o.config.durable_name||(o.name=c.name)}}catch(c){if(c.code!=="404")throw c}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||Dr(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const i={};return i.adapter=F2(s.callbackFn===void 0,this.timeout),i.ingestionFilterFn=um.ingestionFn(s.ordered),i.protocolFilterFn=(o,c=!1)=>{const m=o;return vd(m.msg)?(c||m.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==qt.None&&(i.dispatchedFn=Y2),s.callbackFn&&(i.callback=s.callbackFn),i.max=s.max||0,i.queue=s.queue,i}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:Et.All,ack_policy:qt.Explicit,ack_wait:mt(30*1e3),replay_policy:ta.Instant},s.config);const i=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(i.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=i.name,s.config=i.config,s.last=i}static ingestionFn(s){return(i,o)=>{var g;const c=o;if(!i)return{ingest:!1,protocol:!1};const m=i;if(Ji(m.msg)||(g=c.monitor)==null||g.work(),_d(m.msg)){const u=s?c._checkHbOrderConsumer(m.msg):!0;return s||c.info.flow_control.heartbeat_count++,{ingest:u,protocol:!0}}else if(vd(m.msg))return c.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?c._checkOrderedConsumer(i):!0,protocol:!1}}}}class fm{constructor(t){j(this,"options");j(this,"protocol");j(this,"draining");j(this,"listeners");j(this,"_services");this.draining=!1,this.options=l2(t),this.listeners=[]}static connect(t={}){return new Promise((s,i)=>{const o=new fm(t);pu.connect(o.options,o).then(c=>{o.protocol=c,(async function(){for await(const m of c.status())o.listeners.forEach(y=>{y.push(m)})})(),s(o)}).catch(c=>{i(c)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,s,i){if(this.isClosed())throw ye.errorForCode(ue.ConnectionClosed);if(s&&this.isDraining()||i&&this.protocol.noMorePublishing)throw ye.errorForCode(ue.ConnectionDraining);if(t=t||"",t.length===0)throw ye.errorForCode(ue.BadSubject)}publish(t,s,i){this._check(t,!1,!0),this.protocol.publish(t,s,i)}publishMessage(t){return this.publish(t.subject,t.data,{reply:t.reply,headers:t.headers})}respondMessage(t){return t.reply?(this.publish(t.reply,t.data,{reply:t.reply,headers:t.headers}),!0):!1}subscribe(t,s={}){this._check(t,!0,!1);const i=new wx(this.protocol,t,s);return this.protocol.subscribe(i),i}_resub(t,s,i){this._check(s,!0,!1);const o=t;o.max=i,i&&(o.max=i+o.received),this.protocol.resub(o,s)}requestMany(t,s=An,i={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(g){return Promise.reject(g)}if(i.strategy=i.strategy||Qn.Timer,i.maxWait=i.maxWait||1e3,i.maxWait<1)return Promise.reject(new ye("timeout",ue.InvalidOption));const c=new Bt;function m(g){c.push(()=>{c.stop(g)})}function y(g,u){g||u===null?m(g===null?void 0:g):c.push(u)}if(i.noMux){const g=o?new Error().stack:null;let u=typeof i.maxMessages=="number"&&i.maxMessages>0?i.maxMessages:-1;const d=this.subscribe(Dr(this.options.inboxPrefix),{callback:(w,S)=>{var C,q;if(((C=S==null?void 0:S.data)==null?void 0:C.length)===0&&((q=S==null?void 0:S.headers)==null?void 0:q.status)===ue.NoResponders&&(w=ye.errorForCode(ue.NoResponders)),w){g&&(w.stack+=`
|
|
48
|
-
|
|
49
|
-
${g}`),b(w);return}y(null,S),i.strategy===Qn.Count&&(u--,u===0&&b()),i.strategy===Qn.JitterTimer&&(v(),x=setTimeout(()=>{b()},300)),i.strategy===Qn.SentinelMsg&&S&&S.data.length===0&&b()}});d.requestSubject=t,d.closed.then(()=>{m()}).catch(w=>{c.stop(w)});const b=w=>{w&&c.push(()=>{throw w}),v(),d.drain().then(()=>{m()}).catch(S=>{m()})};c.iterClosed.then(()=>{v(),d==null||d.unsubscribe()}).catch(w=>{v(),d==null||d.unsubscribe()});try{this.publish(t,s,{reply:d.getSubject()})}catch(w){b(w)}let x=setTimeout(()=>{b()},i.maxWait);const v=()=>{x&&clearTimeout(x)}}else{const g=i;g.callback=y,c.iterClosed.then(()=>{u.cancel()}).catch(d=>{u.cancel(d)});const u=new jE(this.protocol.muxSubscriptions,t,g);this.protocol.request(u);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:i.headers})}catch(d){u.cancel(d)}}return Promise.resolve(c)}request(t,s,i={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(c){return Promise.reject(c)}const o=!this.protocol.options.noAsyncTraces;if(i.timeout=i.timeout||1e3,i.timeout<1)return Promise.reject(new ye("timeout",ue.InvalidOption));if(!i.noMux&&i.reply)return Promise.reject(new ye("reply can only be used with noMux",ue.InvalidOption));if(i.noMux){const c=i.reply?i.reply:Dr(this.options.inboxPrefix),m=pt(),y=o?new Error:null,g=this.subscribe(c,{max:1,timeout:i.timeout,callback:(u,d)=>{u?(y&&u.code!==ue.Timeout&&(u.stack+=`
|
|
50
|
-
|
|
51
|
-
${y.stack}`),g.unsubscribe(),m.reject(u)):(u=dx(d),u?(y&&(u.stack+=`
|
|
52
|
-
|
|
53
|
-
${y.stack}`),m.reject(u)):m.resolve(d))}});return g.requestSubject=t,this.protocol.publish(t,s,{reply:c,headers:i.headers}),m}else{const c=new yx(this.protocol.muxSubscriptions,t,i,o);this.protocol.request(c);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${c.token}`,headers:i.headers})}catch(y){c.cancel(y)}const m=Promise.race([c.timer,c.deferred]);return m.catch(()=>{c.cancel()}),m}}flush(){return this.isClosed()?Promise.reject(ye.errorForCode(ue.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(ye.errorForCode(ue.ConnectionClosed)):this.isDraining()?Promise.reject(ye.errorForCode(ue.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const t=this.protocol.getServer();return t?t.listen:""}status(){const t=new Bt;return t.iterClosed.then(()=>{const s=this.listeners.indexOf(t);this.listeners.splice(s,1)}),this.listeners.push(t),t}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,i)=>s==="time"?new Date(Date.parse(i)):i)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const s=new q2(this,t);if(t.checkAPI!==!1)try{await s.getAccountInfo()}catch(i){const o=i;throw o.code===ue.NoResponders&&(o.code=ue.JetStreamNotEnabled),o}return s}jetstream(t={}){return new um(this,t)}getServerVersion(){const t=this.info;return t?ei(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw ye.errorForCode(ue.Disconnect);const t=Date.now();return await this.flush(),Date.now()-t}get features(){return this.protocol.features}get services(){return this._services||(this._services=new z2(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(ye.errorForCode(ue.ConnectionClosed)):this.isDraining()?Promise.reject(ye.errorForCode(ue.ConnectionDraining)):this.protocol.reconnect()}}class z2{constructor(t){j(this,"nc");this.nc=t}add(t){try{return new Co(this.nc,t).start()}catch(s){return Promise.reject(s)}}client(t,s){return new x2(this.nc,t,s)}}class I2{constructor(t,s,i){j(this,"bucket");j(this,"sm");j(this,"prefixLen");this.bucket=t,this.prefixLen=s,this.sm=i}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(yu)||"PUT"}get length(){const t=this.sm.header.get(Qt.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class $2{constructor(t,s,i){j(this,"bucket");j(this,"key");j(this,"sm");this.bucket=t,this.key=s,this.sm=i}get value(){return this.sm.data}get created(){return new Date(im(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(yu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const t=((s=this.sm.headers)==null?void 0:s.get(Qt.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Ax extends CE{constructor(s,i,o){super(s.nc,i,o);j(this,"js");j(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const i=Dr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,i);const c=this.info;c.config.name=Es.next(),c.ordered_consumer_sequence.delivery_seq=0,c.flow_control.heartbeat_count=0,c.flow_control.fc_count=0,c.flow_control.consumer_restarts++,c.deliver=i,c.config.deliver_subject=i,c.config.deliver_policy=Et.StartSequence,c.config.opt_start_seq=s;const m={};m.stream_name=this.info.stream,m.config=c.config;const y=`${c.api.prefix}.CONSUMER.CREATE.${c.stream}`;this.js._request(y,m,{retries:-1}).then(g=>{const u=g,d=this.sub.info;d.last=u,this.info.config=u.config,this.info.name=u.name}).catch(g=>{const u=new ye(`unable to recreate ordered consumer ${c.stream} at seq ${s}`,ue.RequestError,g);this.sub.callback(u,{})})}_maybeSetupHbMonitoring(){var i,o;const s=((o=(i=this.info)==null?void 0:i.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(im(s))}_setupHbMonitoring(s,i=0){const o={cancelAfter:0,maxOut:2};i&&(o.cancelAfter=i);const c=this.sub,m=y=>{var d,b,x,v;const g=fE(409,`${zn.IdleHeartbeatMissed}: ${y}`,this.sub.subject);if(!((d=this.info)==null?void 0:d.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const w=((x=(b=this.info)==null?void 0:b.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(w+1),(v=this.monitor)==null||v.restart(),!1}return!c.noIterator};this.monitor=new om(s,m,o)}_checkHbOrderConsumer(s){const i=s.headers.get(Qt.ConsumerStalledHdr);i!==""&&this.js.nc.publish(i);const o=parseInt(s.headers.get(Qt.LastConsumerSeqHdr),10),c=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==c.delivery_seq&&this._resetOrderedConsumer(c.stream_seq+1),!1}_checkOrderedConsumer(s){const i=this.info.ordered_consumer_sequence,o=s.info.streamSequence,c=s.info.deliverySequence;return c!=i.delivery_seq+1?(this._resetOrderedConsumer(i.stream_seq+1),!1):(i.delivery_seq=c,i.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,i=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${i}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,i=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${i}`,c=await s.api._request(o);return s.last=c,c}}class H2 extends Ax{constructor(t,s,i){super(t,s,i)}pull(t={batch:1}){const{stream:s,config:i,name:o}=this.sub.info,c=i.durable_name??o,m={};if(m.batch=t.batch||1,m.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const u=this.js.nc.features.get(Ke.JS_PULL_MAX_BYTES);if(!u.ok)throw new Error(`max_bytes is only supported on servers ${u.min} or better`);m.max_bytes=t.max_bytes}let y=0;t.expires&&t.expires>0&&(y=t.expires,m.expires=mt(y));let g=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(g=t.idle_heartbeat,m.idle_heartbeat=mt(g)),g&&y===0)throw new Error("idle_heartbeat requires expires");if(g>y)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),y&&g&&(this.monitor?this.monitor._change(g,y):this._setupHbMonitoring(g,y));const u=this.info.api,d=`${u.prefix}.CONSUMER.MSG.NEXT.${s}.${c}`,b=this.sub.subject;u.nc.publish(d,u.jc.encode(m),{reply:b})}}}function F2(n,t){return n?V2(t):G2(t)}function G2(n){return(t,s)=>t?[t,null]:(t=Ji(s),t?[t,null]:[null,Oo(s,n)])}function V2(n){return(t,s)=>{if(t)return[t,null];const i=Ji(s);return i!==null?[jx(i),null]:[null,Oo(s,n)]}}function jx(n){if(n!==null)switch(n.code){case ue.JetStream404NoMessages:case ue.JetStream408RequestTimeout:return null;case ue.JetStream409:return hE(n)?n:null;default:return n}return null}function Y2(n){n&&n.ack()}function K2(n){const t=n.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=t[2]==="_"?"":t[2],s.account_hash=t[3],s.stream=t[4],s.consumer=t[5],s.deliveryCount=parseInt(t[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(t[7],10),s.deliverySequence=parseInt(t[8],10),s.timestampNanos=parseInt(t[9],10),s.pending=parseInt(t[10],10),s}class J2{constructor(t,s){j(this,"msg");j(this,"di");j(this,"didAck");j(this,"timeout");this.msg=t,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=K2(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(t){this.didAck||(this.didAck=!this.isWIP(t),this.msg.respond(t))}isWIP(t){return t.length===4&&t[0]===ro[0]&&t[1]===ro[1]&&t[2]===ro[2]&&t[3]===ro[3]}async ackAck(t){var i;t=t||{},t.timeout=t.timeout||this.timeout;const s=pt();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const c=this.msg.publisher,m=!((i=c.options)!=null&&i.noAsyncTraces),y=new yx(c.muxSubscriptions,this.msg.reply,{timeout:t.timeout},m);c.request(y);try{c.publish(this.msg.reply,l1,{reply:`${c.muxSubscriptions.baseInbox}${y.token}`})}catch(g){y.cancel(g)}try{await Promise.race([y.timer,y.deferred]),s.resolve(!0)}catch(g){y.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(l1)}nak(t){let s=T2;t&&(s=xd().encode(`-NAK ${JSON.stringify({delay:mt(t)})}`)),this.doAck(s)}working(){this.doAck(ro)}next(t,s={batch:1}){const i={};i.batch=s.batch||1,i.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(i.expires=mt(s.expires));const o=Wn().encode(i),c=na.concat(N2,M2,o),m=t?{reply:t}:void 0;this.msg.respond(c,m)}term(t=""){let s=C2;(t==null?void 0:t.length)>0&&(s=xd().encode(`+TERM ${t}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const X2="1.30.3",Q2="nats.ws";class W2{constructor(){j(this,"version");j(this,"lang");j(this,"closeError");j(this,"connected");j(this,"done");j(this,"socket");j(this,"options");j(this,"socketClosed");j(this,"encrypted");j(this,"peeked");j(this,"yields");j(this,"signal");j(this,"closedNotification");this.version=X2,this.lang=Q2,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=pt(),this.closedNotification=pt()}async connect(t,s){const i=pt();if(s.tls)return i.reject(new ye("tls",ue.InvalidOption)),i;this.options=s;const o=t.src;if(s.wsFactory){const{socket:c,encrypted:m}=await s.wsFactory(t.src,s);this.socket=c,this.encrypted=m}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=c=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(c.data)),this.peeked){this.signal.resolve();return}const m=na.concat(...this.yields),y=BE(m);if(y!==""){const g=f2.exec(y);if(!g){s.debug&&console.error("!!!",sc(m)),i.reject(new Error("unexpected response from server"));return}try{const u=JSON.parse(g[1]);c2(u,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),i.resolve()}catch(u){i.reject(u);return}}},this.socket.onclose=c=>{if(this.isDiscarded())return;this.socketClosed=!0;let m;this.done||(c.wasClean||(m=new Error(c.reason)),this._closed(m))},this.socket.onerror=c=>{if(this.isDiscarded())return;const m=c,y=new ye(m.message,ue.Unknown,new Error(m.error));i.reject(y)},i}disconnect(){this._closed(void 0,!0)}async _closed(t,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await sa(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}s&&this.closedNotification.resolve(t)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const t=this.yields;this.yields=[];for(let s=0;s<t.length;s++)this.options.debug&&console.info(`> ${sc(t[s])}`),yield t[s];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=pt())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${sc(t)}`);return}catch(s){this.options.debug&&console.error(`!!! ${sc(t)}: ${s}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function Z2(n,t){/^(.*:\/\/)(.*)/.test(n)||(typeof t=="boolean"?n=`${t===!0?"https":"http"}://${n}`:n=`https://${n}`);let i=new URL(n);const o=i.protocol.toLowerCase();o==="ws:"&&(t=!1),o==="wss:"&&(t=!0),o!=="https:"&&o!=="http"&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2"),i=new URL(`http://${n}`));let c,m;const y=i.hostname,g=i.pathname,u=i.search||"";switch(o){case"http:":case"ws:":case"nats:":m=i.port||"80",c="ws:";break;case"https:":case"wss:":case"tls:":m=i.port||"443",c="wss:";break;default:m=i.port||t===!0?"443":"80",c=t===!0?"wss:":"ws:";break}return`${c}//${y}:${m}${g}${u}`}function eO(n={}){return ME({defaultPort:443,urlParseFn:Z2,factory:()=>new W2}),fm.connect(n)}const tO=null,nO=null,Xt="lt.events";function kx(n,t){const s=n.split("."),i=t.split(".");for(let o=0;o<i.length;o++){const c=i[o];if(c===">")return!0;if(o>=s.length||c!=="*"&&c!==s[o])return!1}return s.length===i.length}const ia=E.createContext({connected:!1,subscribe:()=>()=>{}});function Tx(){const{connected:n}=E.useContext(ia);return{connected:n}}function On(n,t){const{subscribe:s}=E.useContext(ia),i=E.useRef(t);i.current=t,E.useEffect(()=>s(n,c=>i.current(c)),[s,n])}function As(n,t){const{subscribe:s}=E.useContext(ia),i=E.useRef(t);i.current=t;const o=n.join(","),c=E.useMemo(()=>o.split(",").filter(Boolean),[o]);E.useEffect(()=>{const m=g=>i.current(g),y=c.map(g=>s(g,m));return()=>y.forEach(g=>g())},[s,c])}const rO=E.createContext({connected:!1,subscribe:()=>()=>{}}),sO=xd();function iO({children:n,url:t,token:s}){const i=E.useRef(null),[o,c]=E.useState(!1),m=E.useRef(null),y=E.useRef(new Map),g=E.useRef(new Map),u=E.useCallback((v,w)=>{(async()=>{for await(const S of w)try{if(!kx(S.subject,v))continue;const C=JSON.parse(sO.decode(S.data)),q=y.current.get(v);if(!q)continue;for(const B of q)try{B(C)}catch{}}catch{}})()},[]),d=E.useCallback(v=>{var S;const w=i.current;if(!(!w||(S=w.isClosed)!=null&&S.call(w)||g.current.has(v)))try{const C=w.subscribe(v);g.current.set(v,C),u(v,C)}catch{}},[u]),b=E.useCallback((v,w)=>{const S=y.current;return S.has(v)||S.set(v,new Set),S.get(v).add(w),d(v),()=>{const C=S.get(v);if(C&&(C.delete(w),C.size===0)){S.delete(v);const q=g.current.get(v);if(q){g.current.delete(v);try{q.unsubscribe()}catch{}}}}},[d]),x=E.useCallback(async()=>{try{if(i.current)return;const v=t||tO;if(!v){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const w=await eO({servers:v,token:s||nO||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});i.current=w,c(!0);for(const S of y.current.keys())d(S);(async()=>{for await(const S of w.status())S.type==="disconnect"?c(!1):S.type==="reconnect"&&c(!0)})()}catch{c(!1),m.current=setTimeout(x,3e3)}},[d]);return E.useEffect(()=>(x(),()=>{m.current&&clearTimeout(m.current);for(const v of g.current.values())try{v.unsubscribe()}catch{}g.current.clear(),i.current&&(i.current.close().catch(()=>{}),i.current=null),c(!1)}),[x]),h.jsx(rO.Provider,{value:{connected:o,subscribe:b},children:h.jsx(ia.Provider,{value:{connected:o,subscribe:b},children:n})})}const lr=Object.create(null);lr.open="0";lr.close="1";lr.ping="2";lr.pong="3";lr.message="4";lr.upgrade="5";lr.noop="6";const su=Object.create(null);Object.keys(lr).forEach(n=>{su[lr[n]]=n});const Rd={type:"error",data:"parser error"},Nx=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Cx=typeof ArrayBuffer=="function",Mx=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,hm=({type:n,data:t},s,i)=>Nx&&t instanceof Blob?s?i(t):u1(t,i):Cx&&(t instanceof ArrayBuffer||Mx(t))?s?i(t):u1(new Blob([t]),i):i(lr[n]+(t||"")),u1=(n,t)=>{const s=new FileReader;return s.onload=function(){const i=s.result.split(",")[1];t("b"+(i||""))},s.readAsDataURL(n)};function f1(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let rd;function aO(n,t){if(Nx&&n.data instanceof Blob)return n.data.arrayBuffer().then(f1).then(t);if(Cx&&(n.data instanceof ArrayBuffer||Mx(n.data)))return t(f1(n.data));hm(n,!1,s=>{rd||(rd=new TextEncoder),t(rd.encode(s))})}const h1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",yo=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<h1.length;n++)yo[h1.charCodeAt(n)]=n;const oO=n=>{let t=n.length*.75,s=n.length,i,o=0,c,m,y,g;n[n.length-1]==="="&&(t--,n[n.length-2]==="="&&t--);const u=new ArrayBuffer(t),d=new Uint8Array(u);for(i=0;i<s;i+=4)c=yo[n.charCodeAt(i)],m=yo[n.charCodeAt(i+1)],y=yo[n.charCodeAt(i+2)],g=yo[n.charCodeAt(i+3)],d[o++]=c<<2|m>>4,d[o++]=(m&15)<<4|y>>2,d[o++]=(y&3)<<6|g&63;return u},lO=typeof ArrayBuffer=="function",dm=(n,t)=>{if(typeof n!="string")return{type:"message",data:Rx(n,t)};const s=n.charAt(0);return s==="b"?{type:"message",data:cO(n.substring(1),t)}:su[s]?n.length>1?{type:su[s],data:n.substring(1)}:{type:su[s]}:Rd},cO=(n,t)=>{if(lO){const s=oO(n);return Rx(s,t)}else return{base64:!0,data:n}},Rx=(n,t)=>{switch(t){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},Dx="",uO=(n,t)=>{const s=n.length,i=new Array(s);let o=0;n.forEach((c,m)=>{hm(c,!1,y=>{i[m]=y,++o===s&&t(i.join(Dx))})})},fO=(n,t)=>{const s=n.split(Dx),i=[];for(let o=0;o<s.length;o++){const c=dm(s[o],t);if(i.push(c),c.type==="error")break}return i};function hO(){return new TransformStream({transform(n,t){aO(n,s=>{const i=s.length;let o;if(i<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,i);else if(i<65536){o=new Uint8Array(3);const c=new DataView(o.buffer);c.setUint8(0,126),c.setUint16(1,i)}else{o=new Uint8Array(9);const c=new DataView(o.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(i))}n.data&&typeof n.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(s)})}})}let sd;function lc(n){return n.reduce((t,s)=>t+s.length,0)}function cc(n,t){if(n[0].length===t)return n.shift();const s=new Uint8Array(t);let i=0;for(let o=0;o<t;o++)s[o]=n[0][i++],i===n[0].length&&(n.shift(),i=0);return n.length&&i<n[0].length&&(n[0]=n[0].slice(i)),s}function dO(n,t){sd||(sd=new TextDecoder);const s=[];let i=0,o=-1,c=!1;return new TransformStream({transform(m,y){for(s.push(m);;){if(i===0){if(lc(s)<1)break;const g=cc(s,1);c=(g[0]&128)===128,o=g[0]&127,o<126?i=3:o===126?i=1:i=2}else if(i===1){if(lc(s)<2)break;const g=cc(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),i=3}else if(i===2){if(lc(s)<8)break;const g=cc(s,8),u=new DataView(g.buffer,g.byteOffset,g.length),d=u.getUint32(0);if(d>Math.pow(2,21)-1){y.enqueue(Rd);break}o=d*Math.pow(2,32)+u.getUint32(4),i=3}else{if(lc(s)<o)break;const g=cc(s,o);y.enqueue(dm(c?g:sd.decode(g),t)),i=0}if(o===0||o>n){y.enqueue(Rd);break}}}})}const Lx=4;function Nt(n){if(n)return mO(n)}function mO(n){for(var t in Nt.prototype)n[t]=Nt.prototype[t];return n}Nt.prototype.on=Nt.prototype.addEventListener=function(n,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(t),this};Nt.prototype.once=function(n,t){function s(){this.off(n,s),t.apply(this,arguments)}return s.fn=t,this.on(n,s),this};Nt.prototype.off=Nt.prototype.removeListener=Nt.prototype.removeAllListeners=Nt.prototype.removeEventListener=function(n,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+n];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var i,o=0;o<s.length;o++)if(i=s[o],i===t||i.fn===t){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+n],this};Nt.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),s=this._callbacks["$"+n],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,o=s.length;i<o;++i)s[i].apply(this,t)}return this};Nt.prototype.emitReserved=Nt.prototype.emit;Nt.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};Nt.prototype.hasListeners=function(n){return!!this.listeners(n).length};const ku=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,s)=>s(t,0),In=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),pO="arraybuffer";function qx(n,...t){return t.reduce((s,i)=>(n.hasOwnProperty(i)&&(s[i]=n[i]),s),{})}const yO=In.setTimeout,gO=In.clearTimeout;function Tu(n,t){t.useNativeTimers?(n.setTimeoutFn=yO.bind(In),n.clearTimeoutFn=gO.bind(In)):(n.setTimeoutFn=In.setTimeout.bind(In),n.clearTimeoutFn=In.clearTimeout.bind(In))}const bO=1.33;function xO(n){return typeof n=="string"?vO(n):Math.ceil((n.byteLength||n.size)*bO)}function vO(n){let t=0,s=0;for(let i=0,o=n.length;i<o;i++)t=n.charCodeAt(i),t<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(i++,s+=4);return s}function Bx(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function _O(n){let t="";for(let s in n)n.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(n[s]));return t}function wO(n){let t={},s=n.split("&");for(let i=0,o=s.length;i<o;i++){let c=s[i].split("=");t[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return t}class SO extends Error{constructor(t,s,i){super(t),this.description=s,this.context=i,this.type="TransportError"}}class mm extends Nt{constructor(t){super(),this.writable=!1,Tu(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,s,i){return super.emitReserved("error",new SO(t,s,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const s=dm(t,this.socket.binaryType);this.onPacket(s)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,s={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const s=_O(t);return s.length?"?"+s:""}}class EO extends mm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const s=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||s()})),this.writable||(i++,this.once("drain",function(){--i||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const s=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};fO(t,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,uO(t,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Bx()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(t,s)}}let Px=!1;try{Px=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const OO=Px;function AO(){}class jO extends EO{constructor(t){if(super(t),typeof location<"u"){const s=location.protocol==="https:";let i=location.port;i||(i=s?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,s){const i=this.request({method:"POST",data:t});i.on("success",s),i.on("error",(o,c)=>{this.onError("xhr post error",o,c)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=t}}class or extends Nt{constructor(t,s,i){super(),this.createRequest=t,Tu(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;const s=qx(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&i.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var o;i.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=or.requestsCount++,or.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=AO,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete or.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}or.requestsCount=0;or.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",d1);else if(typeof addEventListener=="function"){const n="onpagehide"in In?"pagehide":"unload";addEventListener(n,d1,!1)}}function d1(){for(let n in or.requests)or.requests.hasOwnProperty(n)&&or.requests[n].abort()}const kO=(function(){const n=Ux({xdomain:!1});return n&&n.responseType!==null})();class TO extends jO{constructor(t){super(t);const s=t&&t.forceBase64;this.supportsBinary=kO&&!s}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new or(Ux,this.uri(),t)}}function Ux(n){const t=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||OO))return new XMLHttpRequest}catch{}if(!t)try{return new In[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const zx=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class NO extends mm{get name(){return"websocket"}doOpen(){const t=this.uri(),s=this.opts.protocols,i=zx?{}:qx(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,s,i)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const i=t[s],o=s===t.length-1;hm(i,this.supportsBinary,c=>{try{this.doWrite(i,c)}catch{}o&&ku(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Bx()),this.supportsBinary||(s.b64=1),this.createUri(t,s)}}const id=In.WebSocket||In.MozWebSocket;class CO extends NO{createSocket(t,s,i){return zx?new id(t,s,i):s?new id(t,s):new id(t)}doWrite(t,s){this.ws.send(s)}}class MO extends mm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const s=dO(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(s).getReader(),o=hO();o.readable.pipeTo(t.writable),this._writer=o.writable.getWriter();const c=()=>{i.read().then(({done:y,value:g})=>{y||(this.onPacket(g),c())}).catch(y=>{})};c();const m={type:"open"};this.query.sid&&(m.data=`{"sid":"${this.query.sid}"}`),this._writer.write(m).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const i=t[s],o=s===t.length-1;this._writer.write(i).then(()=>{o&&ku(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const RO={websocket:CO,webtransport:MO,polling:TO},DO=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,LO=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Dd(n){if(n.length>8e3)throw"URI too long";const t=n,s=n.indexOf("["),i=n.indexOf("]");s!=-1&&i!=-1&&(n=n.substring(0,s)+n.substring(s,i).replace(/:/g,";")+n.substring(i,n.length));let o=DO.exec(n||""),c={},m=14;for(;m--;)c[LO[m]]=o[m]||"";return s!=-1&&i!=-1&&(c.source=t,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=qO(c,c.path),c.queryKey=BO(c,c.query),c}function qO(n,t){const s=/\/{2,9}/g,i=t.replace(s,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function BO(n,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,o,c){o&&(s[o]=c)}),s}const Ld=typeof addEventListener=="function"&&typeof removeEventListener=="function",iu=[];Ld&&addEventListener("offline",()=>{iu.forEach(n=>n())},!1);class ws extends Nt{constructor(t,s){if(super(),this.binaryType=pO,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){const i=Dd(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=Dd(s.host).host);Tu(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{const o=i.prototype.name;this.transports.push(o),this._transportsByName[o]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=wO(this.opts.query)),Ld&&(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"})},iu.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const s=Object.assign({},this.opts.query);s.EIO=Lx,s.transport=t,this.id&&(s.sid=this.id);const i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&ws.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",ws.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){const o=this.writeBuffer[i].data;if(o&&(s+=xO(o)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,ku(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,o){if(typeof s=="function"&&(o=s,s=void 0),typeof i=="function"&&(o=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const c={type:t,data:s,options:i};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),o&&this.once("flush",o),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(ws.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ld&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=iu.indexOf(this._offlineEventListener);i!==-1&&iu.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}ws.protocol=Lx;class PO extends ws{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let s=this.createTransport(t),i=!1;ws.priorWebsocketSuccess=!1;const o=()=>{i||(s.send([{type:"ping",data:"probe"}]),s.once("packet",b=>{if(!i)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;ws.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(d(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=s.name,this.emitReserved("upgradeError",x)}}))};function c(){i||(i=!0,d(),s.close(),s=null)}const m=b=>{const x=new Error("probe error: "+b);x.transport=s.name,c(),this.emitReserved("upgradeError",x)};function y(){m("transport closed")}function g(){m("socket closed")}function u(b){s&&b.name!==s.name&&c()}const d=()=>{s.removeListener("open",o),s.removeListener("error",m),s.removeListener("close",y),this.off("close",g),this.off("upgrading",u)};s.once("open",o),s.once("error",m),s.once("close",y),this.once("close",g),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const s=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&s.push(t[i]);return s}}let UO=class extends PO{constructor(t,s={}){const i=typeof t=="object"?t:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(o=>RO[o]).filter(o=>!!o)),super(t,i)}};function zO(n,t="",s){let i=n;s=s||typeof location<"u"&&location,n==null&&(n=s.protocol+"//"+s.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=s.protocol+n:n=s.host+n),/^(https?|wss?):\/\//.test(n)||(typeof s<"u"?n=s.protocol+"//"+n:n="https://"+n),i=Dd(n)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const c=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+c+":"+i.port+t,i.href=i.protocol+"://"+c+(s&&s.port===i.port?"":":"+i.port),i}const IO=typeof ArrayBuffer=="function",$O=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Ix=Object.prototype.toString,HO=typeof Blob=="function"||typeof Blob<"u"&&Ix.call(Blob)==="[object BlobConstructor]",FO=typeof File=="function"||typeof File<"u"&&Ix.call(File)==="[object FileConstructor]";function pm(n){return IO&&(n instanceof ArrayBuffer||$O(n))||HO&&n instanceof Blob||FO&&n instanceof File}function au(n,t){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let s=0,i=n.length;s<i;s++)if(au(n[s]))return!0;return!1}if(pm(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return au(n.toJSON(),!0);for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&au(n[s]))return!0;return!1}function GO(n){const t=[],s=n.data,i=n;return i.data=qd(s,t),i.attachments=t.length,{packet:i,buffers:t}}function qd(n,t){if(!n)return n;if(pm(n)){const s={_placeholder:!0,num:t.length};return t.push(n),s}else if(Array.isArray(n)){const s=new Array(n.length);for(let i=0;i<n.length;i++)s[i]=qd(n[i],t);return s}else if(typeof n=="object"&&!(n instanceof Date)){const s={};for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&(s[i]=qd(n[i],t));return s}return n}function VO(n,t){return n.data=Bd(n.data,t),delete n.attachments,n}function Bd(n,t){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<t.length)return t[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let s=0;s<n.length;s++)n[s]=Bd(n[s],t);else if(typeof n=="object")for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]=Bd(n[s],t));return n}const YO=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ge;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(Ge||(Ge={}));class KO{constructor(t){this.replacer=t}encode(t){return(t.type===Ge.EVENT||t.type===Ge.ACK)&&au(t)?this.encodeAsBinary({type:t.type===Ge.EVENT?Ge.BINARY_EVENT:Ge.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let s=""+t.type;return(t.type===Ge.BINARY_EVENT||t.type===Ge.BINARY_ACK)&&(s+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(s+=t.nsp+","),t.id!=null&&(s+=t.id),t.data!=null&&(s+=JSON.stringify(t.data,this.replacer)),s}encodeAsBinary(t){const s=GO(t),i=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(i),o}}class ym extends Nt{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let s;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(t);const i=s.type===Ge.BINARY_EVENT;i||s.type===Ge.BINARY_ACK?(s.type=i?Ge.EVENT:Ge.ACK,this.reconstructor=new JO(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(pm(t)||t.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(t),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let s=0;const i={type:Number(t.charAt(0))};if(Ge[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===Ge.BINARY_EVENT||i.type===Ge.BINARY_ACK){const c=s+1;for(;t.charAt(++s)!=="-"&&s!=t.length;);const m=t.substring(c,s);if(m!=Number(m)||t.charAt(s)!=="-")throw new Error("Illegal attachments");const y=Number(m);if(!XO(y)||y<0)throw new Error("Illegal attachments");if(y>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=y}if(t.charAt(s+1)==="/"){const c=s+1;for(;++s&&!(t.charAt(s)===","||s===t.length););i.nsp=t.substring(c,s)}else i.nsp="/";const o=t.charAt(s+1);if(o!==""&&Number(o)==o){const c=s+1;for(;++s;){const m=t.charAt(s);if(m==null||Number(m)!=m){--s;break}if(s===t.length)break}i.id=Number(t.substring(c,s+1))}if(t.charAt(++s)){const c=this.tryParse(t.substr(s));if(ym.isPayloadValid(i.type,c))i.data=c;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,s){switch(t){case Ge.CONNECT:return m1(s);case Ge.DISCONNECT:return s===void 0;case Ge.CONNECT_ERROR:return typeof s=="string"||m1(s);case Ge.EVENT:case Ge.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&YO.indexOf(s[0])===-1);case Ge.ACK:case Ge.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class JO{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const s=VO(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const XO=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};function m1(n){return Object.prototype.toString.call(n)==="[object Object]"}const QO=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ym,Encoder:KO,get PacketType(){return Ge}},Symbol.toStringTag,{value:"Module"}));function Xn(n,t,s){return n.on(t,s),function(){n.off(t,s)}}const WO=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class $x extends Nt{constructor(t,s,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=s,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Xn(t,"open",this.onopen.bind(this)),Xn(t,"packet",this.onpacket.bind(this)),Xn(t,"error",this.onerror.bind(this)),Xn(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...s){var i,o,c;if(WO.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(s.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const m={type:Ge.EVENT,data:s};if(m.options={},m.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const d=this.ids++,b=s.pop();this._registerAckCallback(d,b),m.id=d}const y=(o=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!y||(g?(this.notifyOutgoingListeners(m),this.packet(m)):this.sendBuffer.push(m)),this.flags={},this}_registerAckCallback(t,s){var i;const o=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(o===void 0){this.acks[t]=s;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let y=0;y<this.sendBuffer.length;y++)this.sendBuffer[y].id===t&&this.sendBuffer.splice(y,1);s.call(this,new Error("operation has timed out"))},o),m=(...y)=>{this.io.clearTimeoutFn(c),s.apply(this,y)};m.withError=!0,this.acks[t]=m}emitWithAck(t,...s){return new Promise((i,o)=>{const c=(m,y)=>m?o(m):i(y);c.withError=!0,s.push(c),this.emit(t,...s)})}_addToQueue(t){let s;typeof t[t.length-1]=="function"&&(s=t.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...c)=>(this._queue[0],o!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...c)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!t||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ge.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){const i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ge.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ge.EVENT:case Ge.BINARY_EVENT:this.onevent(t);break;case Ge.ACK:case Ge.BINARY_ACK:this.onack(t);break;case Ge.DISCONNECT:this.ondisconnect();break;case Ge.CONNECT_ERROR:this.destroy();const i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){const s=t.data||[];t.id!=null&&s.push(this.ack(t.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const i of s)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const s=this;let i=!1;return function(...o){i||(i=!0,s.packet({type:Ge.ACK,id:t,data:o}))}}onack(t){const s=this.acks[t.id];typeof s=="function"&&(delete this.acks[t.id],s.withError&&t.data.unshift(null),s.apply(this,t.data))}onconnect(t,s){this.id=t,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ge.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const s=this._anyListeners;for(let i=0;i<s.length;i++)if(t===s[i])return s.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(t===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const i of s)i.apply(this,t.data)}}}function aa(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}aa.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*n);n=(Math.floor(t*10)&1)==0?n-s:n+s}return Math.min(n,this.max)|0};aa.prototype.reset=function(){this.attempts=0};aa.prototype.setMin=function(n){this.ms=n};aa.prototype.setMax=function(n){this.max=n};aa.prototype.setJitter=function(n){this.jitter=n};class Pd extends Nt{constructor(t,s){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(s=t,t=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Tu(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((i=s.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new aa({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=t;const o=s.parser||QO;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var s;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(s=this.backoff)===null||s===void 0||s.setMin(t),this)}randomizationFactor(t){var s;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(s=this.backoff)===null||s===void 0||s.setJitter(t),this)}reconnectionDelayMax(t){var s;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(s=this.backoff)===null||s===void 0||s.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new UO(this.uri,this.opts);const s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const o=Xn(s,"open",function(){i.onopen(),t&&t()}),c=y=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",y),t?t(y):this.maybeReconnectOnOpen()},m=Xn(s,"error",c);if(this._timeout!==!1){const y=this._timeout,g=this.setTimeoutFn(()=>{o(),c(new Error("timeout")),s.close()},y);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(m),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Xn(t,"ping",this.onping.bind(this)),Xn(t,"data",this.ondata.bind(this)),Xn(t,"error",this.onerror.bind(this)),Xn(t,"close",this.onclose.bind(this)),Xn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(s){this.onclose("parse error",s)}}ondecoded(t){ku(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,s){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new $x(this,t,s),this.nsps[t]=i),i}_destroy(t){const s=Object.keys(this.nsps);for(const i of s)if(this.nsps[i].active)return;this._close()}_packet(t){const s=this.encoder.encode(t);for(let i=0;i<s.length;i++)this.engine.write(s[i],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,s){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):t.onreconnect()}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const so={};function ou(n,t){typeof n=="object"&&(t=n,n=void 0),t=t||{};const s=zO(n,t.path||"/socket.io"),i=s.source,o=s.id,c=s.path,m=so[o]&&c in so[o].nsps,y=t.forceNew||t["force new connection"]||t.multiplex===!1||m;let g;return y?g=new Pd(i,t):(so[o]||(so[o]=new Pd(i,t)),g=so[o]),s.query&&!t.query&&(t.query=s.queryKey),g.socket(s.path,t)}Object.assign(ou,{Manager:Pd,Socket:$x,io:ou,connect:ou});const ZO=E.createContext({connected:!1,subscribe:()=>()=>{}});function eA({children:n}){const{isAuthenticated:t}=Pt(),s=E.useRef(null),[i,o]=E.useState(!1),c=E.useRef(new Map),m=E.useCallback((g,u)=>{var b;const d=c.current;return d.has(g)||(d.set(g,new Set),(b=s.current)==null||b.emit("lt.subscribe",g)),d.get(g).add(u),()=>{var v;const x=d.get(g);x&&(x.delete(u),x.size===0&&(d.delete(g),(v=s.current)==null||v.emit("lt.unsubscribe",g)))}},[]),y=E.useCallback((g,u)=>{for(const[d,b]of c.current)if(kx(g,d))for(const x of b)try{x(u)}catch{}},[]);return E.useEffect(()=>{if(!t)return;const g=ou({path:`${Ht}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,auth:u=>{const d=cx();u(d?{token:d}:{})}});return s.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),o(!0);for(const u of c.current.keys())g.emit("lt.subscribe",u)}),g.on("disconnect",u=>{console.log("[lt-socketio] disconnected:",u),o(!1)}),g.on("connect_error",u=>{console.warn("[lt-socketio] connect error:",u.message),o(!1)}),g.onAny((u,d)=>{if(u.startsWith("lt."))try{const b=typeof d=="string"?JSON.parse(d):d;y(u,b)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),s.current=null,o(!1)}},[y,t]),h.jsx(ZO.Provider,{value:{connected:i,subscribe:m},children:h.jsx(ia.Provider,{value:{connected:i,subscribe:m},children:n})})}function tA({children:n}){const{isAuthenticated:t}=Pt(),[s,i]=E.useState(null),[o,c]=E.useState({url:null,token:null});return E.useEffect(()=>{let m=!1;async function y(){var g;try{console.log("[lt-transport] detecting event transport...");const u=await rm(),d=(g=u==null?void 0:u.events)==null?void 0:g.transport;if(console.log("[lt-transport] server reports:",d),!m){if(d==="nats"){let b=u.events.natsWsUrl??null,x=null;const v=cx();if(v)try{const w=await fetch(`${Ht}/api/nats-credentials`,{headers:{Authorization:`Bearer ${v}`}});if(w.ok){const S=await w.json();b=S.natsWsUrl??b,x=S.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}c({url:b,token:x})}i(d==="nats"?"nats":"socketio")}}catch(u){console.warn("[lt-transport] settings fetch error, falling back to socketio",u),m||i("socketio")}}return y(),()=>{m=!0}},[t]),s==="nats"?h.jsx(iO,{url:o.url,token:o.token,children:n}):s==="socketio"?h.jsx(eA,{children:n}):h.jsx(h.Fragment,{children:n})}const gm="lt_view_as",bm="lt_ai_override",Ud="lt_graph_enabled",zd="lt_infrastructure_enabled",xm="lt_scan_override";function Hx(){try{const n=localStorage.getItem(bm);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function nA(n){try{localStorage.setItem(bm,String(n))}catch{}}function rA(){try{localStorage.removeItem(bm)}catch{}}function vm(){try{const n=localStorage.getItem(gm);if(n==="admin"||n==="engineer"||n==="operator")return n}catch{}return null}function sA(n){try{localStorage.setItem(gm,n)}catch{}window.location.reload()}function Id(){try{localStorage.removeItem(gm)}catch{}window.location.reload()}function Fx(){try{return localStorage.getItem(Ud)==="true"}catch{return!1}}function iA(n){try{n?localStorage.setItem(Ud,"true"):localStorage.removeItem(Ud)}catch{}}function Gx(){try{return localStorage.getItem(zd)==="true"}catch{return!1}}function aA(n){try{n?localStorage.setItem(zd,"true"):localStorage.removeItem(zd)}catch{}}function Vx(){try{const n=localStorage.getItem(xm);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function oA(n){try{localStorage.setItem(xm,String(n))}catch{}}function lA(){try{localStorage.removeItem(xm)}catch{}}function Yx(){const{isSuperAdmin:n,hasRoleType:t,hasRole:s}=Pt(),i=vm(),o=n||s("engineer"),c=t("admin"),m=n||t("admin");return{isBuilder:i?!1:o,isOps:i?i==="admin"||i==="engineer":c,canBulk:i?i==="admin":m,viewAs:i,realIsBuilder:o}}function Kx(){var u;const{isSuperAdmin:n,hasRoleType:t,hasRole:s}=Pt(),{data:i}=Zn(),o=((u=i==null?void 0:i.features)==null?void 0:u.publicPaceBoard)!==!1,c=n?"superadmin":t("admin")?"admin":s("engineer")?"engineer":"operator",m=vm(),y=m==="admin"||m==="engineer"||m==="operator"?m:null,g=y??c;return{tier:g,realTier:c,viewAs:y,canSeePaceBoard:o||g==="superadmin"||g==="admin",canSeeWorkflows:g==="superadmin"||g==="engineer",showTaskQueueCards:g==="operator"&&!o}}const Jx=E.createContext(null);function Xx(){const n=E.useContext(Jx);if(!n)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return n}function cA({children:n}){const[t,s]=E.useState(null),i=E.useRef(t);i.current=t,E.useEffect(()=>{if(!(t!=null&&t.expiresAt))return;const d=new Date(t.expiresAt).getTime()-Date.now();if(d<=0){s(null);return}const b=setTimeout(()=>s(null),d);return()=>clearTimeout(b)},[t]);const o=E.useCallback(d=>{var x;if(!d.actingToken||!d.actor)return null;const b=((x=i.current)==null?void 0:x.actingToken)??null;return s({actingToken:d.actingToken,actorId:d.actor.id,displayName:d.actor.displayName,expiresAt:d.expiresAt??null,subjectScoped:d.grantScope==="subject"}),b},[]),c=E.useCallback(()=>s(null),[]),m=E.useCallback((d,b)=>{const x=i.current;b===0&&(x==null?void 0:x.actingToken)===d&&s(null)},[]),y=E.useCallback((d,b)=>{const x=i.current;if(!x||x.actingToken!==d||!b.acting)return;const{consumed:v,remaining:w,bound:S}=b.acting;(v&&w===0||S&&b.clearSubject)&&s(null)},[]);E.useEffect(()=>(qg(()=>{var d;return((d=i.current)==null?void 0:d.actingToken)??null}),Pg(c),Bg(m),()=>{qg(null),Pg(null),Bg(null)}),[c,m]);const g=E.useCallback(()=>{var b;const d=(b=i.current)==null?void 0:b.expiresAt;return d?Math.max(0,Math.floor((new Date(d).getTime()-Date.now())/1e3)):0},[]),u=E.useMemo(()=>({identity:t,prime:o,clear:c,settle:y,remainingSeconds:g}),[t,o,c,y,g]);return h.jsx(Jx.Provider,{value:u,children:n})}function uA(){const{user:n}=Pt(),{identity:t}=Xx(),s=n==null?void 0:n.userId,i=t==null?void 0:t.actorId,o=E.useCallback(c=>!!c&&(c===i||c===s),[i,s]);return{viewerId:i??s,isViewer:o}}function Qx(n){return(n??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function cr(n={}){const t=n.role?Qx(n.role):"*",s=n.id??"*",i=n.verb??">";return`${Xt}.system.escalation.${t}.${s}.${i}`}function $d(n){return n.verbs.map(t=>cr({role:n.role,verb:t}))}function _m(n){const{user:t,isSuperAdmin:s,hasRoleType:i}=Pt(),o=s||i("admin"),c=((t==null?void 0:t.roles)??[]).map(y=>y.role).sort().join(","),m=(n??[]).join(",");return E.useMemo(()=>{const y=m?m.split(","):null;return o||!c?y?$d({verbs:y}):[cr({})]:c.split(",").flatMap(g=>y?$d({role:g,verbs:y}):[cr({role:g})])},[o,c,m])}const Hd="/escalations/detail/";function fA(n){return n.startsWith(Hd)&&n.slice(Hd.length).split("/")[0]||void 0}function hA(){const{isViewer:n}=uA(),t=ra(),s=on(),i=E.useRef(s.pathname);i.current=s.pathname;const o=E.useRef(n);o.current=n;const c=E.useCallback(m=>{var b,x,v;if((m==null?void 0:m.assignedAtCreation)!==!0)return;const y=(m==null?void 0:m.escalationId)??((b=m==null?void 0:m.data)==null?void 0:b.id),g=(x=m==null?void 0:m.data)==null?void 0:x.assigned_to,u=(v=m==null?void 0:m.data)==null?void 0:v.parent_id;if(!y||!o.current(g)||!u||u!==fA(i.current))return;const d=`${Hd}${y}`;i.current!==d&&t(d)},[t]);As(_m(["claimed"]),c)}const Wx=6048e5,dA=864e5,p1=6e4,y1=525600,g1=43200,b1=1440,x1=Symbol.for("constructDateFrom");function Br(n,t){return typeof n=="function"?n(t):n&&typeof n=="object"&&x1 in n?n[x1](t):n instanceof Date?new n.constructor(t):new Date(t)}function jn(n,t){return Br(t||n,n)}let mA={};function Mo(){return mA}function Ao(n,t){var y,g,u,d;const s=Mo(),i=(t==null?void 0:t.weekStartsOn)??((g=(y=t==null?void 0:t.locale)==null?void 0:y.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((d=(u=s.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,o=jn(n,t==null?void 0:t.in),c=o.getDay(),m=(c<i?7:0)+c-i;return o.setDate(o.getDate()-m),o.setHours(0,0,0,0),o}function gu(n,t){return Ao(n,{...t,weekStartsOn:1})}function Zx(n,t){const s=jn(n,t==null?void 0:t.in),i=s.getFullYear(),o=Br(s,0);o.setFullYear(i+1,0,4),o.setHours(0,0,0,0);const c=gu(o),m=Br(s,0);m.setFullYear(i,0,4),m.setHours(0,0,0,0);const y=gu(m);return s.getTime()>=c.getTime()?i+1:s.getTime()>=y.getTime()?i:i-1}function bu(n){const t=jn(n),s=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return s.setUTCFullYear(t.getFullYear()),+n-+s}function ev(n,...t){const s=Br.bind(null,n||t.find(i=>typeof i=="object"));return t.map(s)}function v1(n,t){const s=jn(n,t==null?void 0:t.in);return s.setHours(0,0,0,0),s}function pA(n,t,s){const[i,o]=ev(s==null?void 0:s.in,n,t),c=v1(i),m=v1(o),y=+c-bu(c),g=+m-bu(m);return Math.round((y-g)/dA)}function yA(n,t){const s=Zx(n,t),i=Br(n,0);return i.setFullYear(s,0,4),i.setHours(0,0,0,0),gu(i)}function gA(n,t){const s=+jn(n)-+jn(t);return s<0?-1:s>0?1:s}function bA(n){return Br(n,Date.now())}function xA(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function vA(n){return!(!xA(n)&&typeof n!="number"||isNaN(+jn(n)))}function _A(n){return t=>{const i=(n?Math[n]:Math.trunc)(t);return i===0?0:i}}function wA(n,t){const s=jn(n,t==null?void 0:t.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const SA={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"}},EA=(n,t,s)=>{let i;const o=SA[n];return typeof o=="string"?i=o:t===1?i=o.one:i=o.other.replace("{{count}}",t.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+i:i+" ago":i};function ad(n){return(t={})=>{const s=t.width?String(t.width):n.defaultWidth;return n.formats[s]||n.formats[n.defaultWidth]}}const OA={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},AA={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},jA={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},kA={date:ad({formats:OA,defaultWidth:"full"}),time:ad({formats:AA,defaultWidth:"full"}),dateTime:ad({formats:jA,defaultWidth:"full"})},TA={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},NA=(n,t,s,i)=>TA[n];function io(n){return(t,s)=>{const i=s!=null&&s.context?String(s.context):"standalone";let o;if(i==="formatting"&&n.formattingValues){const m=n.defaultFormattingWidth||n.defaultWidth,y=s!=null&&s.width?String(s.width):m;o=n.formattingValues[y]||n.formattingValues[m]}else{const m=n.defaultWidth,y=s!=null&&s.width?String(s.width):n.defaultWidth;o=n.values[y]||n.values[m]}const c=n.argumentCallback?n.argumentCallback(t):t;return o[c]}}const CA={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},MA={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},RA={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"]},DA={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"]},LA={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"}},qA={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"}},BA=(n,t)=>{const s=Number(n),i=s%100;if(i>20||i<10)switch(i%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},PA={ordinalNumber:BA,era:io({values:CA,defaultWidth:"wide"}),quarter:io({values:MA,defaultWidth:"wide",argumentCallback:n=>n-1}),month:io({values:RA,defaultWidth:"wide"}),day:io({values:DA,defaultWidth:"wide"}),dayPeriod:io({values:LA,defaultWidth:"wide",formattingValues:qA,defaultFormattingWidth:"wide"})};function ao(n){return(t,s={})=>{const i=s.width,o=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],c=t.match(o);if(!c)return null;const m=c[0],y=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],g=Array.isArray(y)?zA(y,b=>b.test(m)):UA(y,b=>b.test(m));let u;u=n.valueCallback?n.valueCallback(g):g,u=s.valueCallback?s.valueCallback(u):u;const d=t.slice(m.length);return{value:u,rest:d}}}function UA(n,t){for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&t(n[s]))return s}function zA(n,t){for(let s=0;s<n.length;s++)if(t(n[s]))return s}function IA(n){return(t,s={})=>{const i=t.match(n.matchPattern);if(!i)return null;const o=i[0],c=t.match(n.parsePattern);if(!c)return null;let m=n.valueCallback?n.valueCallback(c[0]):c[0];m=s.valueCallback?s.valueCallback(m):m;const y=t.slice(o.length);return{value:m,rest:y}}}const $A=/^(\d+)(th|st|nd|rd)?/i,HA=/\d+/i,FA={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},GA={any:[/^b/i,/^(a|c)/i]},VA={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},YA={any:[/1/i,/2/i,/3/i,/4/i]},KA={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},JA={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]},XA={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},QA={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]},WA={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},ZA={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}},ej={ordinalNumber:IA({matchPattern:$A,parsePattern:HA,valueCallback:n=>parseInt(n,10)}),era:ao({matchPatterns:FA,defaultMatchWidth:"wide",parsePatterns:GA,defaultParseWidth:"any"}),quarter:ao({matchPatterns:VA,defaultMatchWidth:"wide",parsePatterns:YA,defaultParseWidth:"any",valueCallback:n=>n+1}),month:ao({matchPatterns:KA,defaultMatchWidth:"wide",parsePatterns:JA,defaultParseWidth:"any"}),day:ao({matchPatterns:XA,defaultMatchWidth:"wide",parsePatterns:QA,defaultParseWidth:"any"}),dayPeriod:ao({matchPatterns:WA,defaultMatchWidth:"any",parsePatterns:ZA,defaultParseWidth:"any"})},tv={code:"en-US",formatDistance:EA,formatLong:kA,formatRelative:NA,localize:PA,match:ej,options:{weekStartsOn:0,firstWeekContainsDate:1}};function tj(n,t){const s=jn(n,t==null?void 0:t.in);return pA(s,wA(s))+1}function nj(n,t){const s=jn(n,t==null?void 0:t.in),i=+gu(s)-+yA(s);return Math.round(i/Wx)+1}function nv(n,t){var d,b,x,v;const s=jn(n,t==null?void 0:t.in),i=s.getFullYear(),o=Mo(),c=(t==null?void 0:t.firstWeekContainsDate)??((b=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:b.firstWeekContainsDate)??o.firstWeekContainsDate??((v=(x=o.locale)==null?void 0:x.options)==null?void 0:v.firstWeekContainsDate)??1,m=Br((t==null?void 0:t.in)||n,0);m.setFullYear(i+1,0,c),m.setHours(0,0,0,0);const y=Ao(m,t),g=Br((t==null?void 0:t.in)||n,0);g.setFullYear(i,0,c),g.setHours(0,0,0,0);const u=Ao(g,t);return+s>=+y?i+1:+s>=+u?i:i-1}function rj(n,t){var y,g,u,d;const s=Mo(),i=(t==null?void 0:t.firstWeekContainsDate)??((g=(y=t==null?void 0:t.locale)==null?void 0:y.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((d=(u=s.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,o=nv(n,t),c=Br((t==null?void 0:t.in)||n,0);return c.setFullYear(o,0,i),c.setHours(0,0,0,0),Ao(c,t)}function sj(n,t){const s=jn(n,t==null?void 0:t.in),i=+Ao(s,t)-+rj(s,t);return Math.round(i/Wx)+1}function nt(n,t){const s=n<0?"-":"",i=Math.abs(n).toString().padStart(t,"0");return s+i}const ps={y(n,t){const s=n.getFullYear(),i=s>0?s:1-s;return nt(t==="yy"?i%100:i,t.length)},M(n,t){const s=n.getMonth();return t==="M"?String(s+1):nt(s+1,2)},d(n,t){return nt(n.getDate(),t.length)},a(n,t){const s=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(n,t){return nt(n.getHours()%12||12,t.length)},H(n,t){return nt(n.getHours(),t.length)},m(n,t){return nt(n.getMinutes(),t.length)},s(n,t){return nt(n.getSeconds(),t.length)},S(n,t){const s=t.length,i=n.getMilliseconds(),o=Math.trunc(i*Math.pow(10,s-3));return nt(o,t.length)}},Ii={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},_1={G:function(n,t,s){const i=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return s.era(i,{width:"abbreviated"});case"GGGGG":return s.era(i,{width:"narrow"});case"GGGG":default:return s.era(i,{width:"wide"})}},y:function(n,t,s){if(t==="yo"){const i=n.getFullYear(),o=i>0?i:1-i;return s.ordinalNumber(o,{unit:"year"})}return ps.y(n,t)},Y:function(n,t,s,i){const o=nv(n,i),c=o>0?o:1-o;if(t==="YY"){const m=c%100;return nt(m,2)}return t==="Yo"?s.ordinalNumber(c,{unit:"year"}):nt(c,t.length)},R:function(n,t){const s=Zx(n);return nt(s,t.length)},u:function(n,t){const s=n.getFullYear();return nt(s,t.length)},Q:function(n,t,s){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return nt(i,2);case"Qo":return s.ordinalNumber(i,{unit:"quarter"});case"QQQ":return s.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,s){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return nt(i,2);case"qo":return s.ordinalNumber(i,{unit:"quarter"});case"qqq":return s.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,s){const i=n.getMonth();switch(t){case"M":case"MM":return ps.M(n,t);case"Mo":return s.ordinalNumber(i+1,{unit:"month"});case"MMM":return s.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,s){const i=n.getMonth();switch(t){case"L":return String(i+1);case"LL":return nt(i+1,2);case"Lo":return s.ordinalNumber(i+1,{unit:"month"});case"LLL":return s.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,s,i){const o=sj(n,i);return t==="wo"?s.ordinalNumber(o,{unit:"week"}):nt(o,t.length)},I:function(n,t,s){const i=nj(n);return t==="Io"?s.ordinalNumber(i,{unit:"week"}):nt(i,t.length)},d:function(n,t,s){return t==="do"?s.ordinalNumber(n.getDate(),{unit:"date"}):ps.d(n,t)},D:function(n,t,s){const i=tj(n);return t==="Do"?s.ordinalNumber(i,{unit:"dayOfYear"}):nt(i,t.length)},E:function(n,t,s){const i=n.getDay();switch(t){case"E":case"EE":case"EEE":return s.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(i,{width:"short",context:"formatting"});case"EEEE":default:return s.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(c);case"ee":return nt(c,2);case"eo":return s.ordinalNumber(c,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(n,t,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(c);case"cc":return nt(c,t.length);case"co":return s.ordinalNumber(c,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(n,t,s){const i=n.getDay(),o=i===0?7:i;switch(t){case"i":return String(o);case"ii":return nt(o,t.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(i,{width:"short",context:"formatting"});case"iiii":default:return s.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,s){const o=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(n,t,s){const i=n.getHours();let o;switch(i===12?o=Ii.noon:i===0?o=Ii.midnight:o=i/12>=1?"pm":"am",t){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(n,t,s){const i=n.getHours();let o;switch(i>=17?o=Ii.evening:i>=12?o=Ii.afternoon:i>=4?o=Ii.morning:o=Ii.night,t){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(n,t,s){if(t==="ho"){let i=n.getHours()%12;return i===0&&(i=12),s.ordinalNumber(i,{unit:"hour"})}return ps.h(n,t)},H:function(n,t,s){return t==="Ho"?s.ordinalNumber(n.getHours(),{unit:"hour"}):ps.H(n,t)},K:function(n,t,s){const i=n.getHours()%12;return t==="Ko"?s.ordinalNumber(i,{unit:"hour"}):nt(i,t.length)},k:function(n,t,s){let i=n.getHours();return i===0&&(i=24),t==="ko"?s.ordinalNumber(i,{unit:"hour"}):nt(i,t.length)},m:function(n,t,s){return t==="mo"?s.ordinalNumber(n.getMinutes(),{unit:"minute"}):ps.m(n,t)},s:function(n,t,s){return t==="so"?s.ordinalNumber(n.getSeconds(),{unit:"second"}):ps.s(n,t)},S:function(n,t){return ps.S(n,t)},X:function(n,t,s){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return S1(i);case"XXXX":case"XX":return Qs(i);case"XXXXX":case"XXX":default:return Qs(i,":")}},x:function(n,t,s){const i=n.getTimezoneOffset();switch(t){case"x":return S1(i);case"xxxx":case"xx":return Qs(i);case"xxxxx":case"xxx":default:return Qs(i,":")}},O:function(n,t,s){const i=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+w1(i,":");case"OOOO":default:return"GMT"+Qs(i,":")}},z:function(n,t,s){const i=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+w1(i,":");case"zzzz":default:return"GMT"+Qs(i,":")}},t:function(n,t,s){const i=Math.trunc(+n/1e3);return nt(i,t.length)},T:function(n,t,s){return nt(+n,t.length)}};function w1(n,t=""){const s=n>0?"-":"+",i=Math.abs(n),o=Math.trunc(i/60),c=i%60;return c===0?s+String(o):s+String(o)+t+nt(c,2)}function S1(n,t){return n%60===0?(n>0?"-":"+")+nt(Math.abs(n)/60,2):Qs(n,t)}function Qs(n,t=""){const s=n>0?"-":"+",i=Math.abs(n),o=nt(Math.trunc(i/60),2),c=nt(i%60,2);return s+o+t+c}const E1=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},rv=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},ij=(n,t)=>{const s=n.match(/(P+)(p+)?/)||[],i=s[1],o=s[2];if(!o)return E1(n,t);let c;switch(i){case"P":c=t.dateTime({width:"short"});break;case"PP":c=t.dateTime({width:"medium"});break;case"PPP":c=t.dateTime({width:"long"});break;case"PPPP":default:c=t.dateTime({width:"full"});break}return c.replace("{{date}}",E1(i,t)).replace("{{time}}",rv(o,t))},aj={p:rv,P:ij},oj=/^D+$/,lj=/^Y+$/,cj=["D","DD","YY","YYYY"];function uj(n){return oj.test(n)}function fj(n){return lj.test(n)}function hj(n,t,s){const i=dj(n,t,s);if(console.warn(i),cj.includes(n))throw new RangeError(i)}function dj(n,t,s){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${i} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const mj=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,pj=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,yj=/^'([^]*?)'?$/,gj=/''/g,bj=/[a-zA-Z]/;function xj(n,t,s){var d,b,x,v;const i=Mo(),o=i.locale??tv,c=i.firstWeekContainsDate??((b=(d=i.locale)==null?void 0:d.options)==null?void 0:b.firstWeekContainsDate)??1,m=i.weekStartsOn??((v=(x=i.locale)==null?void 0:x.options)==null?void 0:v.weekStartsOn)??0,y=jn(n,s==null?void 0:s.in);if(!vA(y))throw new RangeError("Invalid time value");let g=t.match(pj).map(w=>{const S=w[0];if(S==="p"||S==="P"){const C=aj[S];return C(w,o.formatLong)}return w}).join("").match(mj).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const S=w[0];if(S==="'")return{isToken:!1,value:vj(w)};if(_1[S])return{isToken:!0,value:w};if(S.match(bj))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:w}});o.localize.preprocessor&&(g=o.localize.preprocessor(y,g));const u={firstWeekContainsDate:c,weekStartsOn:m,locale:o};return g.map(w=>{if(!w.isToken)return w.value;const S=w.value;(fj(S)||uj(S))&&hj(S,t,String(n));const C=_1[S[0]];return C(y,S,o.localize,u)}).join("")}function vj(n){const t=n.match(yj);return t?t[1].replace(gj,"'"):n}function _j(n,t,s){const i=Mo(),o=(s==null?void 0:s.locale)??i.locale??tv,c=gA(n,t);if(isNaN(c))throw new RangeError("Invalid time value");const m=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:c}),[y,g]=ev(s==null?void 0:s.in,...c>0?[t,n]:[n,t]),u=_A((s==null?void 0:s.roundingMethod)??"round"),d=g.getTime()-y.getTime(),b=d/p1,x=bu(g)-bu(y),v=(d-x)/p1,w=s==null?void 0:s.unit;let S;if(w?S=w:b<1?S="second":b<60?S="minute":b<b1?S="hour":v<g1?S="day":v<y1?S="month":S="year",S==="second"){const C=u(d/1e3);return o.formatDistance("xSeconds",C,m)}else if(S==="minute"){const C=u(b);return o.formatDistance("xMinutes",C,m)}else if(S==="hour"){const C=u(b/60);return o.formatDistance("xHours",C,m)}else if(S==="day"){const C=u(v/b1);return o.formatDistance("xDays",C,m)}else if(S==="month"){const C=u(v/g1);return C===12&&w!=="month"?o.formatDistance("xYears",1,m):o.formatDistance("xMonths",C,m)}else{const C=u(v/y1);return o.formatDistance("xYears",C,m)}}function wj(n,t){return _j(n,bA(n),t)}let xu=null;function Sj(n){xu=n||null}function Ej(){return xu}function Oj(n,t,s){const i=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...s?{second:"2-digit"}:{},hour12:!0}).formatToParts(n);return Object.fromEntries(i.map(o=>[o.type,o.value]))}function wm(n,t=!1){const s=typeof n=="string"?new Date(n):n;if(Number.isNaN(s.getTime()))return String(n);if(!xu)return xj(s,t?"MMM d, yyyy h:mm:ss a":"MMM d, yyyy h:mm a");const i=Oj(s,xu,t),o=`${i.hour}:${i.minute}${t?`:${i.second}`:""}`;return`${i.month} ${i.day}, ${i.year} ${o} ${i.dayPeriod}`}function Aj(n){const t=n??[];return t.length>0&&t.every(s=>s.type==="member"&&s.write_scope==="none")}const Sm={staleTime:5*6e4,refetchOnWindowFocus:!1};function I3(n={},t={}){const s=new URLSearchParams;return n.role&&s.set("role",n.role),n.roleType&&s.set("roleType",n.roleType),n.status&&s.set("status",n.status),n.search&&s.set("search",n.search),n.limit&&s.set("limit",String(n.limit)),n.offset!==void 0&&s.set("offset",String(n.offset)),$e({queryKey:["users",n],queryFn:()=>fe(`/users?${s}`),enabled:t.enabled??!0,...Sm})}const O1=200;async function jj(n){const t=[];for(let s=0;s<n.length;s+=O1){const i=await fe("/users/names",{method:"POST",body:JSON.stringify({ids:n.slice(s,s+O1)})});t.push(...i.users??[])}return t}let Fd=[],Gd=new Map,Vd=!1;function kj(){const n=Fd,t=Gd;Fd=[],Gd=new Map,Vd=!1,jj(n).then(s=>{const i=new Map(s.map(o=>[o.id,o]));for(const[o,c]of t)c.resolve(i.get(o)??null)}).catch(s=>{for(const i of t.values())i.reject(s)})}function Tj(n){return new Promise((t,s)=>{Fd.push(n),Gd.set(n,{resolve:t,reject:s}),Vd||(Vd=!0,setTimeout(kj,0))})}function $3(n){return $e({queryKey:["user-name",n],queryFn:()=>Tj(n),enabled:!!n,...Sm})}function Nj(n){return $e({queryKey:["users",n,"roles"],queryFn:async()=>(await fe(`/users/${n}/roles`)).roles??[],enabled:!!n,...Sm})}function H3(){const n=He();return Ve({mutationFn:t=>fe("/users",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function F3(){const n=He();return Ve({mutationFn:({id:t,...s})=>fe(`/users/${t}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function G3(){const n=He();return Ve({mutationFn:({id:t,ops:s})=>fe(`/users/${t}/properties`,{method:"PATCH",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function V3(){return $e({queryKey:["users","system-property-keys"],queryFn:()=>fe("/users/system-property-keys")})}function Y3(){const n=He();return Ve({mutationFn:t=>fe(`/users/${t}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function K3(){const n=He();return Ve({mutationFn:({userId:t,role:s,type:i,read_scope:o,write_scope:c})=>fe(`/users/${t}/roles`,{method:"POST",body:JSON.stringify({role:s,type:i,read_scope:o,write_scope:c})}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function J3(){const n=He();return Ve({mutationFn:({userId:t,role:s})=>fe(`/users/${t}/roles/${encodeURIComponent(s)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}const X3={MAX_PORTALS:12,MAX_ROWS:4,MAX_COLS:6,MAX_COUNTS:8};function Cj(){return $e({queryKey:["roles"],queryFn:()=>fe("/roles")})}function Nu(n){return $e({queryKey:["roles","details"],queryFn:()=>fe("/roles/details"),enabled:(n==null?void 0:n.enabled)??!0})}function Q3(n,t,s=!0){return $e({queryKey:["roles",n,"schema",t??"latest"],queryFn:()=>fe(`/roles/${encodeURIComponent(n)}/schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!n})}function W3(n){return $e({queryKey:["roles",n,"schema-versions"],queryFn:()=>fe(`/roles/${encodeURIComponent(n)}/schema/versions`),enabled:!!n})}function Z3(n,t,s=!0){return $e({queryKey:["roles",n,"list-schema",t??"latest"],queryFn:()=>fe(`/roles/${encodeURIComponent(n)}/list-schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!n})}function e5(n){return $e({queryKey:["roles",n,"list-schema-versions"],queryFn:()=>fe(`/roles/${encodeURIComponent(n)}/list-schema/versions`),enabled:!!n})}function t5(){const n=He();return Ve({mutationFn:t=>fe("/roles",{method:"POST",body:JSON.stringify({role:t})}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function n5(){const n=He();return Ve({mutationFn:({role:t,...s})=>fe(`/roles/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:t,...s})=>{await n.cancelQueries({queryKey:["roles","details"]});const i=n.getQueryData(["roles","details"]);return i&&n.setQueryData(["roles","details"],{roles:i.roles.map(o=>o.role===t?{...o,...s}:o)}),{previous:i}},onError:(t,s,i)=>{i!=null&&i.previous&&n.setQueryData(["roles","details"],i.previous)},onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function r5(){const n=He();return Ve({mutationFn:t=>fe(`/roles/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}const sv="lt:station:kiosk-role:";function Yd(n){return`${sv}${n}`}const Kd=new Set;function Mj(){for(const n of Kd)n()}function Rj(n){try{return localStorage.getItem(Yd(n))}catch{return null}}function Dj(n,t){try{t===null?localStorage.removeItem(Yd(n)):localStorage.setItem(Yd(n),t)}catch{}Mj()}function Lj(n){Kd.add(n);const t=s=>{(s.key===null||s.key.startsWith(sv))&&n()};try{window.addEventListener("storage",t)}catch{}return()=>{Kd.delete(n);try{window.removeEventListener("storage",t)}catch{}}}function qj(n){return E.useSyncExternalStore(Lj,()=>n?Rj(n):null)}const vu="/portal";function Bj(n){return n===vu||n.startsWith(`${vu}/`)}function Em(n,t){const s=`${vu}/${encodeURIComponent(n)}`;return t?`${s}/${encodeURIComponent(t)}`:s}function Wi(n){return Array.isArray(n==null?void 0:n.portals)?n.portals:[]}function Pj(n){return Wi(n).length>0}function s5(n,t){const s=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"portal",i=new Set(t);if(!i.has(s))return s;let o=2;for(;i.has(`${s}-${o}`);)o+=1;return`${s}-${o}`}function iv(n,t){return t.length>0?Em(n,t[0].key):`/escalations/available?role=${encodeURIComponent(n)}&status=available`}function Om(){const{user:n}=Pt(),t=(n==null?void 0:n.userId)??null,{data:s}=Nj(t),{data:i}=Nu(),o=qj(t),c=E.useCallback(m=>{t&&Dj(t,m)},[t]);return E.useMemo(()=>{const m={kiosk:!1,role:null,homePath:null,targets:[],selectable:!1,selectRole:c},y=s??[];if(y.length===0||y.some(v=>v.type!=="member"))return m;const g=v=>{var w;return(w=i==null?void 0:i.roles)==null?void 0:w.find(S=>S.role===v)},u=v=>{var w,S;return((S=(w=g(v))==null?void 0:w.properties)==null?void 0:S.kiosk)===!0},d=y.map(v=>v.role).filter(u),b=v=>({kiosk:!0,role:v,homePath:iv(v,Wi(g(v))),targets:d,selectable:d.length>=2,selectRole:c});if(y.length===1)return d.length===1?b(d[0]):m;if(!Aj(y)||d.length===0)return m;const x=o&&d.includes(o)?o:d.length===1?d[0]:null;return x?b(x):{...m,targets:d,selectable:!0}},[s,i,o,c])}const Uj="/escalations/available",zj=["/escalations",vu,"/scan","/login"];function Ij(n,t=""){if(n===Uj){const s=new URLSearchParams(t);if(!s.get("role")&&!s.get("facets"))return!1}return zj.some(s=>n===s||n.startsWith(`${s}/`)||n.startsWith(`${s}?`))}const Am=E.createContext(null),od="lt_sidebar_collapsed",av="(max-width: 1023px)";function $j(){try{return window.matchMedia(av).matches}catch{return!1}}function Hj({children:n}){const[t,s]=E.useState(()=>{if($j())return!0;try{return localStorage.getItem(od)==="true"}catch{return!1}});E.useEffect(()=>{let o;try{o=window.matchMedia(av)}catch{return}const c=m=>{if(m.matches)s(!0);else try{s(localStorage.getItem(od)==="true")}catch{s(!1)}};return o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[]);const i=E.useCallback(()=>{s(o=>{const c=!o;try{localStorage.setItem(od,String(c))}catch{}return c})},[]);return h.jsx(Am.Provider,{value:{collapsed:t,toggle:i},children:n})}function Fj({children:n}){return h.jsx(Am.Provider,{value:{collapsed:!1,toggle:()=>{}},children:n})}function jm(){const n=E.useContext(Am);if(!n)throw new Error("useSidebar must be used within SidebarProvider");return n}const A1=380,km=E.createContext(null);function Gj({children:n}){const[t,s]=E.useState({node:null,width:A1,open:!1,ownerKey:null}),i=on(),o=E.useRef(i.pathname),c=E.useCallback((y,g)=>{s({node:y,width:(g==null?void 0:g.width)??A1,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),m=E.useCallback(y=>{s(g=>typeof y=="string"&&g.ownerKey!==y?g:{...g,open:!1})},[]);return E.useEffect(()=>{i.pathname!==o.current&&(o.current=i.pathname,s(y=>y.open||y.node?{...y,node:null,open:!1,ownerKey:null}:y))},[i.pathname]),h.jsx(km.Provider,{value:{...t,setPanel:c,closePanel:m},children:n})}function Tm(){const n=E.useContext(km);if(!n)throw new Error("useShellPanel must be used within ShellPanelProvider");return n}function i5(){return E.useContext(km)}function Vj({open:n,width:t=380,children:s,className:i=""}){const[o,c]=E.useState(n);return E.useEffect(()=>{n&&c(!0)},[n]),h.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${i}`,style:{width:n?t:0,maxWidth:"50%"},onTransitionEnd:m=>{!n&&m.propertyName==="width"&&c(!1)},children:h.jsx("div",{style:{width:t},className:"h-full",children:o?s:null})})}function a5({label:n,children:t}){return h.jsxs("div",{children:[h.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:n}),h.jsx("dd",{className:"text-xs text-text-primary mt-0.5",children:t})]})}function o5({views:n,activeId:t,onViewChange:s,onClose:i,headerActions:o,stickyClassName:c,labelInline:m}){const y=n.find(g=>g.id===t)??n[0];return y?h.jsx("div",{className:"h-full bg-surface-hover",children:h.jsxs("div",{className:`flex flex-col ${c??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[h.jsxs("div",{className:`flex items-center justify-between pl-4 pr-3 shrink-0 ${m?"pt-10 pb-2":"pt-3"}`,children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx("div",{className:"flex items-center gap-1 shrink-0",role:"radiogroup","aria-label":"Panel view",children:n.map(g=>{const u=g.icon,d=g.id===y.id;return h.jsx("button",{role:"radio","aria-checked":d,onClick:()=>s(g.id),title:g.label,className:`p-1.5 rounded-md transition-colors ${d?"bg-accent/10 text-accent":"text-accent/60 hover:text-accent hover:bg-surface-hover"}`,children:h.jsx(u,{className:"w-3.5 h-3.5"})},g.id)})}),m&&h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-secondary truncate",children:y.label})]}),h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[o,i&&h.jsx("button",{onClick:i,title:"Close panel",className:"p-1 rounded text-accent/60 hover:text-accent hover:bg-surface-hover transition-colors",children:h.jsx(Wt,{className:"w-3.5 h-3.5"})})]})]}),!m&&h.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:y.label}),h.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${m?"pt-4 pb-8":"pb-5 pt-1"}`,children:y.content})]})}):null}function ov(n,t){var s,i,o,c,m;t.facets&&Object.keys(t.facets).length&&n.set("facets",JSON.stringify(t.facets)),(s=t.block)!=null&&s.length&&n.set("block",JSON.stringify(t.block)),(i=t.range)!=null&&i.length&&n.set("range",JSON.stringify(t.range)),(o=t.exists)!=null&&o.length&&n.set("exists",JSON.stringify(t.exists)),(c=t.roles)!=null&&c.length&&n.set("roles",JSON.stringify(t.roles)),(m=t.orderBy)!=null&&m.length&&n.set("orderBy",JSON.stringify(t.orderBy)),t.available!==void 0&&n.set("available",String(t.available)),t.jeopardy===!0&&n.set("jeopardy","1"),t.include&&n.set("include",t.include),t.groupBy&&n.set("groupBy",t.groupBy)}function l5(n,t,s){const i=n??"24h",o=t&&Object.keys(t).length?JSON.stringify(t):null;return $e({queryKey:["stationMetrics",i,o],queryFn:()=>fe(`/escalations/station-metrics?period=${i}${o?`&facets=${encodeURIComponent(o)}`:""}`),staleTime:5e3,enabled:(s==null?void 0:s.enabled)??!0})}function c5(n){const t=n?`?period=${n}`:"";return $e({queryKey:["escalationStats",n],queryFn:()=>fe(`/escalations/stats${t}`)})}function u5(){return $e({queryKey:["escalationTypes"],queryFn:()=>fe("/escalations/types")})}function f5(n=!0){return $e({queryKey:["escalationFacetKeys"],queryFn:()=>fe("/escalations/facet-keys"),enabled:n,staleTime:6e4})}function Yj(n){return $e({queryKey:["escalationFacetValues",n],queryFn:()=>fe(`/escalations/facet-values?key=${encodeURIComponent(n)}`),enabled:!!n,staleTime:6e4})}function lv(n){const{enabled:t=!0,staleTime:s,...i}=n,o=new URLSearchParams;return i.status&&o.set("status",i.status),i.role&&o.set("role",i.role),i.type&&o.set("type",i.type),i.subtype&&o.set("subtype",i.subtype),i.assigned_to&&o.set("assigned_to",i.assigned_to),i.parent_id&&o.set("parent_id",i.parent_id),i.claimed&&o.set("claimed","true"),i.priority&&o.set("priority",String(i.priority)),i.limit&&o.set("limit",String(i.limit)),i.offset!==void 0&&o.set("offset",String(i.offset)),i.sort_by&&o.set("sort_by",i.sort_by),i.order&&o.set("order",i.order),i.search&&o.set("search",i.search),ov(o,i),$e({queryKey:["escalations",i],queryFn:()=>fe(`/escalations?${o}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function cv(n){const{enabled:t=!0,staleTime:s,...i}=n,o=new URLSearchParams;return i.role&&o.set("role",i.role),i.type&&o.set("type",i.type),i.subtype&&o.set("subtype",i.subtype),i.priority&&o.set("priority",String(i.priority)),i.limit&&o.set("limit",String(i.limit)),i.offset!==void 0&&o.set("offset",String(i.offset)),i.sort_by&&o.set("sort_by",i.sort_by),i.order&&o.set("order",i.order),i.search&&o.set("search",i.search),ov(o,i),$e({queryKey:["escalations","available",i],queryFn:()=>fe(`/escalations/available?${o}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function h5(n){return $e({queryKey:["escalations","by-workflow",n],queryFn:()=>fe(`/escalations/by-workflow/${n}`),enabled:!!n})}function d5(n){return $e({queryKey:["escalations",n],queryFn:()=>fe(`/escalations/${n}`),enabled:!!n})}function m5(n,t){return $e({queryKey:["escalations",n,"lookups"],queryFn:()=>fe(`/escalations/${n}/lookups`),enabled:!!n&&t,staleTime:0,refetchOnWindowFocus:!1})}function p5(){const n=He();return Ve({mutationFn:({id:t,durationMinutes:s})=>fe(`/escalations/${t}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function y5(){const n=He();return Ve({mutationFn:t=>fe(`/escalations/${t}/release`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function g5(){const n=He();return Ve({mutationFn:({id:t,resolverPayload:s})=>fe(`/escalations/${t}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]}),n.resetQueries({queryKey:["tasks"]}),n.resetQueries({queryKey:["jobs"]})}})}function b5(){const n=He();return Ve({mutationFn:({id:t,itemKey:s,payload:i})=>fe(`/escalations/${t}/accumulate`,{method:"POST",body:JSON.stringify({itemKey:s,...i?{payload:i}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function x5(){const n=He();return Ve({mutationFn:({id:t,itemKey:s})=>fe(`/escalations/${t}/remove-item`,{method:"POST",body:JSON.stringify({itemKey:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function v5(){const n=He();return Ve({mutationFn:({id:t,targetRole:s})=>fe(`/escalations/${t}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function _5(){const n=He();return Ve({mutationFn:({ids:t,priority:s})=>fe("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:t,priority:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function w5(){const n=He();return Ve({mutationFn:({ids:t,durationMinutes:s})=>fe("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:t,durationMinutes:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function S5(){const n=He();return Ve({mutationFn:({ids:t,targetUserId:s,durationMinutes:i,reassign:o})=>fe("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:t,targetUserId:s,durationMinutes:i,...o?{reassign:!0}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function E5(){const n=He();return Ve({mutationFn:({ids:t})=>fe("/escalations/bulk-unassign",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function O5(){const n=He();return Ve({mutationFn:({ids:t,hint:s})=>fe("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:t,...s?{hint:s}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function A5(){const n=He();return Ve({mutationFn:t=>fe(`/escalations/${t}/cancel`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function j5(){const n=He();return Ve({mutationFn:({ids:t})=>fe("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function Nm(n){const t=[],s=n.type.split(".");switch(s[0]==="system"?s[1]:s[0]){case"task":t.push(["tasks"]),t.push(["jobs"]),t.push(["processes"]),n.workflowId&&(t.push(["workflowExecution",n.workflowId]),t.push(["workflowState",n.workflowId]),t.push(["mcpQueryExecution",n.workflowId])),n.originId&&t.push(["processes",n.originId]);break;case"escalation":t.push(["escalations"]),t.push(["escalationStats"]),t.push(["stationMetrics"]),n.workflowId&&t.push(["workflowExecution",n.workflowId]);break;case"workflow":t.push(["jobs"]),t.push(["tasks"]),t.push(["processes"]),n.workflowId&&(t.push(["workflowExecution",n.workflowId]),t.push(["workflowState",n.workflowId]),t.push(["mcpQueryExecution",n.workflowId]),t.push(["mcpQueryResult",n.workflowId]),t.push(["builderResult",n.workflowId]));break;case"activity":n.workflowId&&t.push(["mcpRunExecution",n.workflowId]),t.push(["mcpRuns"]);break;case"milestone":n.workflowId&&(t.push(["workflowExecution",n.workflowId]),t.push(["mcpQueryExecution",n.workflowId])),t.push(["tasks"]);break;case"knowledge":t.push(["knowledge"]);break;case"file":t.push(["files"]);break;case"agent":t.push(["agents"]);break;default:t.push(["jobs"]),t.push(["tasks"]);break}return t}const Kj={DETAIL:{coalesceMs:300,minIntervalMs:2e3},LIST:{coalesceMs:500,minIntervalMs:3e3},SUMMARY:{coalesceMs:1e3,minIntervalMs:1e4}},k5=300,j1={DETAIL:0,LIST:1,SUMMARY:2};function Jj(n){const t=new Map,s={},i={};let o=!1;const c=()=>typeof document<"u"&&document.visibilityState==="hidden";function m(d){delete s[d],i[d]=Date.now();const b=[];for(const[v,w]of t)w===d&&b.push(v);for(const v of b)t.delete(v);if(b.length===0)return;const x=c();x&&(o=!0);for(const v of b)n.invalidateQueries({queryKey:JSON.parse(v),...x?{refetchType:"none"}:{}})}function y(d){if(s[d])return;const{coalesceMs:b,minIntervalMs:x}=Kj[d],v=i[d],w=v===void 0?0:v+x-Date.now(),S=Math.max(b,w);s[d]=setTimeout(()=>m(d),S)}function g(d,b){for(const x of b){const v=JSON.stringify(x),w=t.get(v);(w===void 0||j1[d]<j1[w])&&t.set(v,d)}y(d)}const u=()=>{typeof document>"u"||document.visibilityState==="visible"&&o&&(o=!1,n.refetchQueries({type:"active",stale:!0}))};return typeof document<"u"&&document.addEventListener("visibilitychange",u),{request:g,dispose(){for(const d of Object.keys(s)){const b=s[d];b&&clearTimeout(b),delete s[d]}t.clear(),typeof document<"u"&&document.removeEventListener("visibilitychange",u)}}}const k1=new WeakMap;function Xj(n){let t=k1.get(n);return t||(t=Jj(n),k1.set(n,t)),t}function Zt(n){const t=He();return E.useCallback(s=>{Xj(t).request(n,s)},[t,n])}function Cm(n){return n?[`${Xt}.system.workflow.>`,`${Xt}.system.activity.>`,`${Xt}.system.milestone.>`,`${Xt}.system.task.>`,`${Xt}.system.escalation.>`]:[]}function T5(){const n=Zt("LIST");On(`${Xt}.system.task.>`,()=>{n([["jobs"]])}),On(`${Xt}.system.workflow.>`,()=>{n([["jobs"]])})}function N5(n){const t=Zt("DETAIL");As(Cm(n),s=>{var y;if(!n||!(s.workflowId===n||((y=s.workflowId)==null?void 0:y.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],m=Nm(s);c==="escalation"&&m.push(["escalations","by-workflow",n]),t(m)})}function C5(n){const t=Zt("DETAIL");As(Cm(n),s=>{var y;if(!n||!(s.workflowId===n||((y=s.workflowId)==null?void 0:y.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],m=Nm(s);c==="escalation"&&m.push(["escalations","by-workflow",n]),t(m)})}function M5(n){const t=Zt("DETAIL");As(Cm(n),s=>{var c;if(!n||!(s.workflowId===n||((c=s.workflowId)==null?void 0:c.includes(n))))return;const o=Nm(s);o.push(["workflowSets"]),o.push(["yamlWorkflows"]),t(o)})}function R5(n){const t=Zt("DETAIL"),s=E.useCallback(i=>{n&&(i.originId!==n&&i.workflowId!==n||t([["processes",n]]))},[n,t]);On(`${Xt}.system.task.>`,s),On(`${Xt}.system.workflow.>`,s),On(`${Xt}.system.escalation.>`,s)}function D5(){const n=Zt("SUMMARY");On(cr({}),()=>{n([["escalationStats"]])})}function L5(){const n=Zt("SUMMARY");On(cr({}),()=>{n([["stationMetrics"]])})}function q5(){const n=Zt("SUMMARY");On(cr({}),()=>{n([["escAggregate"],["escTimeline"]])})}function B5(n){const t=Zt("LIST"),s=(n==null?void 0:n.role)??null,i=((n==null?void 0:n.verbs)??[]).join(","),o=E.useMemo(()=>{const c=i?i.split(","):null;return c?$d({role:s,verbs:c}):[cr({role:s})]},[s,i]);As(o,()=>{t([["escalations"]])})}const Qj=[["escalations","related"],["escalations","related-rows"]];function P5(n){const t=Zt("LIST"),s=[...new Set(n)].sort().join(","),i=E.useMemo(()=>s?s.split(",").map(o=>cr({role:o})):[],[s]);As(i,()=>{t(Qj)})}function U5(n){const t=Zt("DETAIL");On(cr(n?{id:n}:{id:"__none__"}),s=>{!n||s.escalationId!==n||t([["escalations",n]])})}function z5(){const n=Zt("LIST");On(`${Xt}.system.agent.>`,()=>{n([["agents"]])})}function I5(){const n=Zt("LIST");On(`${Xt}.system.task.>`,()=>{n([["processes"]])}),On(`${Xt}.system.workflow.>`,()=>{n([["processes"]])})}function Wj(){const{user:n}=Pt(),t=n==null?void 0:n.userId,s=Zt("SUMMARY");As(_m(),()=>{s([["escalations"]])});const{data:i}=cv({limit:1}),{data:o}=lv({assigned_to:t,status:"pending",limit:1});return{available:(i==null?void 0:i.total)??0,mine:(o==null?void 0:o.total)??0}}function Mm({size:n="sm",hideLabel:t=!1,className:s="",appName:i="LongTail",variant:o="full"}){const c=n==="lg";if(o==="comet")return h.jsx("div",{className:`relative overflow-visible ${s}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${Ht}/logo512.png)`,width:"82px",height:"82px",top:"-12px",left:"-80px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(o==="mark")return h.jsx("div",{className:`flex items-center ${s}`,children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${Ht}/logo512.png)`}})});const m=c?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-55 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-55 -ml-8",y=c?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return h.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[h.jsx("span",{role:"img","aria-label":i,className:`logo-mark shrink-0 z-0 ${m}`,style:{"--logo-url":`url(${Ht}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${y} ${t?"opacity-0":""}`,children:i})]})}const Zj="system.surfaces.dashboard",ek=`${Xt}.${Zj}`;function uv(n=!0){return $e({queryKey:["announcements"],queryFn:()=>fe("/announcements"),enabled:n,staleTime:3e4})}function tk(){const n=He();return Ve({mutationFn:t=>fe("/announcements",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function nk(){const n=He();return Ve({mutationFn:t=>fe(`/announcements/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function $5(n){return n.toLocaleString()}function H5(n){return n>=1e9?`${(n/1e9).toFixed(1).replace(/\.0$/,"")}B`:n>=1e6?`${(n/1e6).toFixed(1).replace(/\.0$/,"")}M`:n>=1e4?`${(n/1e3).toFixed(1).replace(/\.0$/,"")}K`:n.toLocaleString()}function rk(n){const t=new Date(n);return t.getTime()>Date.now()?"just now":wj(t,{addSuffix:!0})}function F5(n){const t=Date.now()-new Date(n).getTime();if(t<0)return"now";const s=Math.floor(t/1e3);if(s<60)return`${s}s`;const i=Math.floor(s/60);if(i<60)return`${i}m`;const o=Math.floor(i/60);if(o<24)return`${o}h`;const c=Math.floor(o/24);return c<7?`${c}d`:c<30?`${Math.floor(c/7)}w`:c<365?`${Math.floor(c/30)}mo`:`${Math.floor(c/365)}y`}function G5(n){return n<=0?"Expired":Rm(n)}function sk(n){return n==null?"--":Rm(n)}function V5(n){return n?wm(n):"--"}function Rm(n){if(n<1e3)return`${Math.round(n)}ms`;if(n<6e4){const m=n/1e3;return Number.isInteger(m)?`${m}s`:`${m.toFixed(1)}s`}const t=Math.floor(n/1e3),s=Math.floor(t/86400),i=Math.floor(t%86400/3600),o=Math.floor(t%3600/60),c=t%60;return s>0?i>0?`${s}d ${i}h`:`${s}d`:i>0?o>0?`${i}h ${o}m`:`${i}h`:c>0?`${o}m ${c}s`:`${o}m`}function Y5(n,t){const s=new Date(n).getTime(),i=t?new Date(t).getTime():Date.now();return Rm(i-s)}function fv({options:n,children:t,className:s=""}){const[i,o]=E.useState(!1),[c,m]=E.useState(null),[y,g]=E.useState(null),u=E.useRef(null),d=E.useRef(void 0),b=E.useRef(void 0),x=220,v=E.useCallback(()=>{if(!u.current)return;const q=u.current.getBoundingClientRect(),B=window.innerWidth-x-8,se=Math.max(8,Math.min(q.left,B));g({top:q.bottom+4,left:se})},[]),w=E.useCallback(async(q,B)=>{try{await navigator.clipboard.writeText(q),m(B),clearTimeout(d.current),d.current=setTimeout(()=>m(null),1200)}catch{}},[]),S=E.useCallback(()=>{clearTimeout(b.current),v(),o(!0)},[v]),C=E.useCallback(()=>{b.current=setTimeout(()=>o(!1),150)},[]);return E.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(b.current)},[]),h.jsxs("span",{ref:u,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:S,onMouseLeave:C,children:[t,i&&y&&Zd.createPortal(h.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:y.top,left:y.left},onMouseEnter:S,onMouseLeave:C,children:n.map(q=>h.jsxs("button",{onClick:B=>{B.stopPropagation(),w(q.value,q.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[h.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:q.label}),h.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===q.label?"✓":q.value})]},q.label))}),document.body)]})}function ik(n,t){const s=new Date(n);switch(t){case"relative":return rk(n);case"datetime":return wm(s);case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:Ej()??void 0})}}function ak(n){const t=new Date(n);return[{label:"ms",value:String(t.getTime())},{label:"utc",value:t.toISOString()},{label:"local",value:wm(t,!0)}]}function hv({date:n,format:t="relative",className:s=""}){const[,i]=E.useState(0);E.useEffect(()=>{if(t!=="relative")return;const c=setInterval(()=>i(m=>m+1),3e4);return()=>clearInterval(c)},[t]);const o=E.useMemo(()=>ak(n),[n]);return h.jsx(fv,{options:o,children:h.jsx("time",{dateTime:n,className:`text-xs text-text-tertiary ${s}`,children:ik(n,t)})})}function ok({values:n,options:t,onChange:s,addLabel:i,emptyText:o,ariaLabel:c}){const m=t.filter(y=>!n.includes(y));return h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.map(y=>h.jsxs("button",{type:"button",onClick:()=>s(n.filter(g=>g!==y)),className:"inline-flex items-center gap-1 text-2xs font-mono text-text-primary border border-surface-border px-1.5 py-0.5 hover:text-status-error hover:border-status-error/50 transition-colors",title:`Remove ${y}`,children:[y,h.jsx(Wt,{className:"w-3 h-3",strokeWidth:1.5})]},y)),n.length===0&&o&&h.jsx("span",{className:"text-2xs text-text-tertiary italic",children:o}),m.length>0&&h.jsxs("select",{value:"",onChange:y=>y.target.value&&s([...n,y.target.value]),className:"select font-mono","aria-label":c??i,children:[h.jsx("option",{value:"",children:i}),m.map(y=>h.jsx("option",{value:y,children:y},y))]})]})}const lk=[{minutes:1,label:"1 minute"},{minutes:15,label:"15 minutes"},{minutes:30,label:"30 minutes"},{minutes:60,label:"1 hour"},{minutes:240,label:"4 hours"},{minutes:1440,label:"24 hours"},{minutes:4320,label:"3 days"},{minutes:10080,label:"7 days"}];function ck(){const{data:n}=uv(),{data:t}=Cj(),s=tk(),i=nk(),[o,c]=E.useState(""),[m,y]=E.useState(""),[g,u]=E.useState(1440),[d,b]=E.useState([]),x=(n==null?void 0:n.announcements)??[],v=()=>{m.trim()&&s.mutate({body:m.trim(),...o.trim()?{title:o.trim()}:{},...d.length?{roles:d}:{},expiresAt:new Date(Date.now()+g*6e4).toISOString()},{onSuccess:()=>{c(""),y(""),b([])}})};return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Alerts"}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Title"}),h.jsx("input",{type:"text",value:o,onChange:w=>c(w.target.value),placeholder:"Optional headline",className:"input text-xs w-full"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Summary"}),h.jsx("textarea",{value:m,onChange:w=>y(w.target.value),placeholder:"What everyone should know (markdown supported)",rows:3,className:"input text-xs w-full resize-y"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible for"}),h.jsx("select",{value:g,onChange:w=>u(Number(w.target.value)),className:"select text-xs w-full",children:lk.map(w=>h.jsx("option",{value:w.minutes,children:w.label},w.minutes))})]}),h.jsxs("div",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible to"}),h.jsx(ok,{values:d,options:(t==null?void 0:t.roles)??[],onChange:b,addLabel:"Add a role…",emptyText:"Everyone",ariaLabel:"Add a role"})]}),s.error&&h.jsx("p",{className:"text-xs text-status-error",children:s.error.message}),h.jsx("button",{onClick:v,disabled:!m.trim()||s.isPending,className:"btn-primary text-xs w-full disabled:opacity-50",children:s.isPending?"Publishing…":"Publish alert"})]}),x.length>0&&h.jsxs("div",{className:"mt-6",children:[h.jsx("p",{className:"text-2xs text-text-tertiary mb-2",children:"Active now — stacked as banner rows, newest first"}),h.jsx("div",{className:"space-y-1",children:x.map(w=>h.jsxs("div",{className:"flex items-start gap-2 py-1.5 border-b border-surface-border/40 last:border-b-0",children:[h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block text-xs text-text-primary truncate",children:w.title??w.body.split(`
|
|
54
|
-
`)[0]}),h.jsxs("span",{className:"block text-2xs text-text-tertiary",children:["expires ",h.jsx(hv,{date:w.expires_at,format:"relative"})]})]}),h.jsx("button",{onClick:()=>i.mutate(w.id),disabled:i.isPending,className:"icon-link shrink-0 mt-0.5",title:"Remove for everyone","aria-label":`Remove ${w.title??"announcement"}`,children:h.jsx(Wt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]},w.id))})]})]})}const uk=[{id:null,label:"Your view",description:"Full access based on your account role",minTier:"operator"},{id:"admin",label:"Admin",description:"Pace Board + identity management",minTier:"superadmin"},{id:"engineer",label:"Engineer",description:"Work queue + identity management",minTier:"admin"},{id:"operator",label:"Operator",description:"Escalation queue only",minTier:"engineer"}],fk=["operator","engineer","admin","superadmin"];function T1(n){return fk.indexOf(n)}function hk(n,t){return T1(n)>=T1(t)}function dk({onClose:n}){var Te,Me,Ze,yt,Ct,we,Re;const{isSuperAdmin:t,hasRoleType:s,hasRole:i}=Pt(),{data:o}=Zn(),c=vm(),m=!!((Te=o==null?void 0:o.ai)!=null&&Te.enabled),y=Hx(),g=y!==null?y:m,[u,d]=E.useState(g),b=(Me=o==null?void 0:o.features)==null?void 0:Me.graphWorkflows,x=b==null,[v,w]=E.useState(b===!0||x&&Fx()),S=t||i("engineer"),[C,q]=E.useState(Gx()),B=!!((Ze=o==null?void 0:o.features)!=null&&Ze.scanCodes),se=Vx(),[le,R]=E.useState(se!==null?se:B),H=t?"superadmin":s("admin")?"admin":i("engineer")?"engineer":"operator",ae=((yt=o==null?void 0:o.branding)==null?void 0:yt.appName)??"LongTail",$=(Ct=o==null?void 0:o.environment)==null?void 0:Ct.longTailVersion,I=(we=o==null?void 0:o.environment)==null?void 0:we.hotmeshVersion,D=(Re=o==null?void 0:o.environment)==null?void 0:Re.nodeEnv;E.useEffect(()=>{const oe=Be=>{Be.key==="Escape"&&n()};return document.addEventListener("keydown",oe),()=>document.removeEventListener("keydown",oe)},[n]);const Q=uk.filter(oe=>hk(H,oe.minTier)),X=Q.length>1,he=H!=="operator",Se=[...X?[{id:"viewas",label:"View As",icon:uS}]:[],{id:"features",label:"Features",icon:fS},...he?[{id:"alerts",label:"Alerts",icon:hS}]:[]],[ke,F]=E.useState(Se[0].id),W=oe=>{oe===null?Id():sA(oe)},ce=()=>{const oe=!u;d(oe),oe===m?rA():nA(oe),window.location.reload()},xe=()=>{const oe=!v;w(oe),iA(oe),window.location.reload()},ve=()=>{const oe=!C;q(oe),aA(oe),window.location.reload()},Ce=()=>{const oe=!le;R(oe),oe===B?lA():oA(oe),window.location.reload()};return h.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:n,children:h.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:oe=>oe.stopPropagation(),children:[h.jsx("button",{onClick:n,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:h.jsx(Wt,{className:"w-4 h-4",strokeWidth:1.5})}),h.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[h.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${Ht}/logo512.png)`}}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:ae}),$&&h.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",$,I&&h.jsxs(h.Fragment,{children:[" · HotMesh v",I]}),D&&D!=="production"&&h.jsx("span",{className:"ml-1 text-status-warning",children:D})]})]})]}),h.jsx("hr",{className:"border-surface-border/50 mb-6"}),Se.length>1&&h.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:Se.map(oe=>{const Be=ke===oe.id;return h.jsxs("button",{role:"tab","aria-selected":Be,onClick:()=>F(oe.id),title:oe.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${Be?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[h.jsx(oe.icon,{className:"w-5 h-5",strokeWidth:1.5,...Be?{fill:"currentColor",fillOpacity:.15}:{}}),h.jsx("span",{className:"text-2xs font-medium",children:oe.label})]},oe.id)})}),ke==="viewas"&&X&&h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),Q.map(oe=>{const Be=c===oe.id,We=oe.id===null?`Your view · ${H}`:oe.label;return h.jsxs("button",{onClick:()=>W(oe.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[h.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${Be?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:Be&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),h.jsxs("span",{children:[h.jsx("span",{className:`block text-sm font-medium transition-colors ${Be?"text-accent":"text-text-primary group-hover:text-accent"}`,children:We}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:oe.description})]})]},String(oe.id))})]}),ke==="features"&&h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),h.jsxs("button",{onClick:ce,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:u?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${u?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${u?"translate-x-4":"translate-x-0"}`})})]}),x&&h.jsxs("button",{onClick:xe,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Graph workflows"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:v?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${v?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${v?"translate-x-4":"translate-x-0"}`})})]}),S&&h.jsxs("button",{onClick:ve,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group","data-testid":"feature-infrastructure",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Infrastructure"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:C?"Visible — Routers, Messages, and DB Maintenance in the sidebar":"Hidden — routers, message streams, and database maintenance"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${C?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${C?"translate-x-4":"translate-x-0"}`})})]}),h.jsxs("button",{onClick:Ce,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Scan input"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:le?"Enabled — header scan affordance, panel, and keyboard-wedge capture":"Hidden — the deployment opts in with features.scanCodes"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${le?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${le?"translate-x-4":"translate-x-0"}`})})]})]}),ke==="alerts"&&he&&h.jsx(ck,{}),h.jsx("hr",{className:"border-surface-border/50 mt-8"}),h.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const dv=[{id:"violet",label:"Violet",swatch:"#7B3BE0"},{id:"red",label:"Brick",swatch:"#DC382D"},{id:"green",label:"Emerald",swatch:"#059669"},{id:"blue",label:"Electric",swatch:"#2563EB"},{id:"rose",label:"Raspberry",swatch:"#D6246E"},{id:"orange",label:"Harvest",swatch:"#E85D04"}],N1="blue",mv="lt.theme";let pv=[];function mk(n){const t=new Set(dv.map(i=>i.id)),s=new Set;pv=n.filter(i=>!(i!=null&&i.id)||t.has(i.id)||s.has(i.id)?!1:(s.add(i.id),!0))}function pk(){return[...dv,...pv]}function yv(){try{return localStorage.getItem(mv)||N1}catch{return N1}}function gv(n){document.documentElement.dataset.theme=n}function yk(n){try{localStorage.setItem(mv,n)}catch{}gv(n)}const gk=[8,12,13,14];function bk(n){if(!/^[0-9]+$/.test(n)||!gk.includes(n.length))return!1;const t=n.split("").map(Number),s=t.pop();let i=0;for(let o=t.length-1,c=3;o>=0;o--,c=c===3?1:3)i+=t[o]*c;return(10-i%10)%10===s}function K5(n){return n.padStart(14,"0")}const lu={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},bv="lt_scan_wedge_config";function xv(){try{const n=localStorage.getItem(bv);return n?{...lu,...JSON.parse(n)}:lu}catch{return lu}}function xk(n){const t={...xv(),...n};return localStorage.setItem(bv,JSON.stringify(t)),t}const Dm=[{pattern:/(?:^|[^0-9])([1-9][0-9]:[0-9]:[a-zA-Z0-9._-]+)$/,digitsOnly:!1},{pattern:/(?:^|[^0-9])([1-9][0-9]{7,})$/,digitsOnly:!0}];function vk(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _k(n){const t=[];for(const s of n.filter(i=>i.enabled))if(s.encoding==="delimited"){const i=vk(s.delimiter);t.push({pattern:new RegExp(`(?:^|[^0-9])(${s.version}${i}[0-9]${i}[a-zA-Z0-9._-]+)$`),digitsOnly:!1})}else if(s.encoding==="fixed"){const i=1+(s.target_length??0);t.push({pattern:new RegExp(`(?:^|[^0-9])(${s.version}[0-9]{${i},${i+1}})$`),digitsOnly:!0})}else s.encoding==="gtin"&&t.push({pattern:/(?:^|[^0-9])([0-9]{8}|[0-9]{12,14})$/,digitsOnly:!0,accept:bk});return t.length?t:Dm}function wk(n,t=Dm){var i;let s=null;for(const o of t){const c=(i=n.match(o.pattern))==null?void 0:i[1];!c||o.accept&&!o.accept(c)||(!s||c.length>s.code.length)&&(s={code:c,shape:o})}return s}const Sk=new Set(["Shift","CapsLock"]),uc={suppress:!1,emit:null};function Ek(n=lu,t=Dm){let s={buffer:"",times:[],lastKeyMs:0};function i(u){const d=s.times.slice(-u.length);return d.length<2?!1:(d[d.length-1]-d[0])/(d.length-1)<=n.autoFireMaxAvgKeyMs}function o(){const u=wk(s.buffer,t);return!u||u.code.length<n.minLength||u.shape.digitsOnly&&!i(u.code)?null:u.code}function c(){s={buffer:"",times:[],lastKeyMs:0}}function m(u){const{key:d,timeMs:b,hasModifier:x,isRepeat:v}=u;if(Sk.has(d))return uc;if(n.terminators.includes(d)){const B=o();return c(),B?{suppress:!0,emit:B,consumedLength:B.length}:uc}if(x||v||d.length!==1)return c(),uc;const w=b-s.lastKeyMs,S=s.lastKeyMs>0&&w<=n.maxKeyGapMs,C=(S?s.buffer+d:d).slice(-128),q=(S?[...s.times,b]:[b]).slice(-128);return s={buffer:C,times:q,lastKeyMs:b},uc}function y(){return{buffer:s.buffer}}function g(){const u=o();return!u||!i(u)?null:{code:u,consumedLength:u.length}}return{step:m,reset:c,snapshot:y,pendingAutoFire:g}}function Ok(){const n=document.activeElement;return n instanceof HTMLInputElement?["text","search","tel","url","email","password","number"].includes(n.type)?n:null:n instanceof HTMLTextAreaElement?n:null}function Ak(n,t,s){var c;const i=n instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,o=(c=Object.getOwnPropertyDescriptor(i,"value"))==null?void 0:c.set;o?o.call(n,t):n.value=t;try{n.setSelectionRange(s,s)}catch{}n.dispatchEvent(new Event("input",{bubbles:!0}))}function C1(n){if(n<=0)return;const t=Ok();if(!t)return;const s=t.selectionStart??t.value.length,i=Math.max(0,s-n);Ak(t,t.value.slice(0,i)+t.value.slice(s),i)}function jk({active:n,wedgeConfig:t,tailShapes:s,diagnosticsOn:i,onScan:o,onDiag:c}){const m=E.useRef({diagnosticsOn:i,onScan:o,onDiag:c});m.current={diagnosticsOn:i,onScan:o,onDiag:c};const y=E.useRef(0),g=E.useRef(0);E.useEffect(()=>{if(!n)return;const u=Ek(t,s);let d=null;const b=()=>{d&&(clearTimeout(d),d=null)},x=(S,C,q)=>{C&&C1(C),m.current.diagnosticsOn&&(console.debug("[scan]",q),m.current.onDiag({seq:++y.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:q})),m.current.onScan(S)},v=()=>{b(),u.pendingAutoFire()&&(d=setTimeout(()=>{d=null;const S=u.pendingAutoFire();S&&(u.reset(),x(S.code,S.consumedLength,`capture → ${S.code} (quiet period — no suffix)`))},t.autoFireQuietMs))},w=S=>{const C=u.snapshot().buffer,{suppress:q,emit:B,consumedLength:se}=u.step({key:S.key,timeMs:S.timeStamp,hasModifier:S.ctrlKey||S.metaKey||S.altKey,isRepeat:S.repeat});if(q&&(S.preventDefault(),S.stopPropagation()),m.current.diagnosticsOn){const le=u.snapshot().buffer,R=t.terminators.includes(S.key),H=B?`capture → ${B}`:R?`terminator — no code tail in "${C.slice(-24)}"`:le===C?C?"neutral (chord key)":"ignored":le===""?"reset (edit/chord/non-printable)":le.length<=1&&C.length>1?"gap — new episode":"accumulate",ae=g.current?Math.round(S.timeStamp-g.current):0,$={seq:++y.current,key:S.key,code:S.code!==S.key?S.code:"",deltaMs:ae,buffer:le.slice(-24),note:H};console.debug("[scan]",$.key,$.code,`${$.deltaMs}ms`,$.note),m.current.onDiag($)}g.current=S.timeStamp,B?(b(),se&&C1(se),m.current.onScan(B)):v()};return window.addEventListener("keydown",w,{capture:!0}),()=>{b(),window.removeEventListener("keydown",w,{capture:!0})}},[n,t,s])}const Ae={EXECUTED:"executed",MATCHED_LIST:"matched_list",CONFIRM_REQUIRED:"confirm_required",NO_MATCH_FALLBACK:"no_match_fallback",UNCONFIGURED:"unconfigured",INVALID_CODE:"invalid_code",FORBIDDEN:"forbidden",CONFLICT:"conflict",IDENTITY_PRIMED:"identity_primed",IDENTITY_UNKNOWN:"identity_unknown",NOT_PRIMED:"not_primed",CHOICES:"choices",NO_OPEN_CONTAINER:"no_open_container",HELD:"held",REFUSED:"refused",SUBJECT_STALE:"subject_stale"},fc={SHOW_DETAIL:"show-detail",SHOW_LIST:"show-list",CLAIM:"claim",CLAIM_SHOW_DETAIL:"claim-show-detail",RELEASE:"release",RESOLVE:"resolve",ESCALATE:"escalate",CANCEL:"cancel",ACCUMULATE:"accumulate",PRESENT:"present",HOLD:"hold",FILL:"fill"},kk={ACTION:"action",IDENTITY:"identity"};function Tk(n,t){return fe("/scan-codes/execute",{method:"POST",body:JSON.stringify({code:n,...t!=null&&t.actingToken?{actingToken:t.actingToken}:{},...t!=null&&t.previousActingToken?{previousActingToken:t.previousActingToken}:{},...t!=null&&t.subject?{subject:t.subject}:{},...t!=null&&t.stationRole?{stationRole:t.stationRole}:{}})})}function J5(n){return fe("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(n)})}function vv(n){return $e({queryKey:["scan-schemes"],queryFn:()=>fe("/scan-codes/schemes"),...n})}function X5(n){return $e({queryKey:["scan-schemes",n],queryFn:()=>fe(`/scan-codes/schemes/${n}`),enabled:n!=null})}function Q5(){const n=He();return Ve({mutationFn:t=>fe(`/scan-codes/schemes/${t.version}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function W5(){const n=He();return Ve({mutationFn:t=>fe(`/scan-codes/schemes/${t}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function Z5(){const n=He();return Ve({mutationFn:t=>fe(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:(t,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}function eM(){const n=He();return Ve({mutationFn:t=>fe(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"DELETE"}),onSuccess:(t,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}const Nk=3e4;function Ck(n,t=Date.now()){if(!(!n||Date.parse(n.expiresAt)<=t))return{code:n.code,escalationId:n.escalationId}}function M1(n,t,s=Date.now()){if(t.outcome===Ae.HELD&&t.subject){const i=Math.max(0,Date.parse(t.subject.expiresAt)-s);return{...t.subject,ttlMs:i}}return t.clearSubject||!n?null:t.outcome===Ae.EXECUTED&&t.progress&&t.progress.remaining>0?{...n,expiresAt:new Date(s+n.ttlMs).toISOString()}:n}function R1(n){return n.outcome===Ae.NOT_PRIMED&&n.replayable===!0}function Mk(n,t=Date.now()){return n&&t-n.at<=Nk?n:null}const Rk=[Ae.HELD,Ae.REFUSED,Ae.SUBJECT_STALE],jo={KEYBOARD_WEDGE:"keyboard-wedge",MANUAL:"manual",TOOLBAR:"toolbar"},$i=n=>{if(n)try{return JSON.parse(n)}catch{return}},Ws=n=>n==null||Array.isArray(n)&&n.length===0||typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).length===0;function Dk(n){const t={},s=$i(n.get("facets"));Ws(s)||(t.facets=s);const i=$i(n.get("block"));Ws(i)||(t.block=i);const o=$i(n.get("range"));Ws(o)||(t.range=o);const c=$i(n.get("exists"));Ws(c)||(t.exists=c);const m=$i(n.get("roles"));Ws(m)||(t.roles=m);const y=$i(n.get("orderBy"));Ws(y)||(t.orderBy=y),n.get("available")!=null&&(t.available=n.get("available")==="true");const g=n.get("jeopardy");return(g==="1"||g==="true")&&(t.jeopardy=!0),t}function tM(n,t){const s=(i,o)=>Ws(o)?n.delete(i):n.set(i,JSON.stringify(o));s("facets",t.facets),s("block",t.block),s("range",t.range),s("exists",t.exists),s("roles",t.roles),s("orderBy",t.orderBy),t.available==null?n.delete("available"):n.set("available",String(t.available)),t.jeopardy===!0?n.set("jeopardy","1"):n.delete("jeopardy")}const D1=`&status=all&view=table&orderBy=${encodeURIComponent(JSON.stringify([{field:"created_at",direction:"desc"}]))}`;function _v(n,t){const s={};for(const[o,c]of Object.entries(n))s[o]=typeof c=="object"&&c!==null?JSON.stringify(c):c;const i=encodeURIComponent(JSON.stringify(s));return t?`/escalations/available?role=${encodeURIComponent(t)}&facets=${i}${D1}`:`/escalations/available?facets=${i}${D1}`}function Lk(n,t,s){return _v({[n]:t},s)}function nM(n){var t,s,i;return Object.keys(n.facets??{}).length+(((t=n.block)==null?void 0:t.length)??0)+(((s=n.range)==null?void 0:s.length)??0)+(((i=n.exists)==null?void 0:i.length)??0)+(n.available!=null?1:0)+(n.jeopardy===!0?1:0)}function Lm(){var s;const{data:n}=Zn(),t=Vx();return t!==null?t:!!((s=n==null?void 0:n.features)!=null&&s.scanCodes)}const qm=E.createContext(null);function Bm(){const n=E.useContext(qm);if(!n)throw new Error("useScanInput must be used within ScanInputProvider");return n}function rM(){return E.useContext(qm)}const qk="scanPendingAction",Bk="scanChoices",ld="/scan/station";function Pk({children:n}){const{user:t}=Pt(),s=Lm(),i=ra(),o=on(),{identity:c,prime:m,clear:y,settle:g}=Xx(),[u,d]=E.useState(null),[b,x]=E.useState(null),[v,w]=E.useState(null),{data:S}=vv({enabled:!!t&&s,staleTime:6e4}),C=E.useRef(null);C.current=Om().role;const q=E.useMemo(()=>_k((S==null?void 0:S.schemes)??[]),[S]),[B,se]=E.useState(!1),[le,R]=E.useState(()=>xv()),[H,ae]=E.useState([]),[$,I]=E.useState(!1),D=E.useCallback(we=>{var Be;const{outcome:Re}=we;if(Re===Ae.CONFIRM_REQUIRED&&we.pendingAction)return i(`/escalations/detail/${we.pendingAction.escalationId}`,{state:{[qk]:we.pendingAction}}),!0;const oe=Re===Ae.EXECUTED&&!!F.current;if(Rk.includes(Re)||R1(we)||oe)return ce.current!==ld&&i(ld),!0;if(Re===Ae.EXECUTED&&we.escalation){const We=[fc.SHOW_DETAIL,fc.CLAIM_SHOW_DETAIL,fc.CLAIM,fc.ESCALATE];return we.verb&&We.includes(we.verb)?(i(`/escalations/detail/${we.escalation.id}`),!0):!1}if(Re===Ae.MATCHED_LIST&&we.listQuery){const{targetFacet:We,target:ln,roles:pe}=we.listQuery;return i(_v({[We]:ln},(pe==null?void 0:pe[0])??null)),!0}return Re===Ae.CHOICES&&we.choices?(i(ld,{state:{[Bk]:we}}),!0):Re===Ae.NO_MATCH_FALLBACK&&((Be=we.fallback)!=null&&Be.route)?(i(we.fallback.route),!0):!1},[i]),Q=E.useRef(null);Q.current=(c==null?void 0:c.actingToken)??null;const X=E.useRef(null),he=E.useRef([]),Se=E.useCallback(we=>(he.current=[we,...he.current],()=>{he.current=he.current.filter(Re=>Re!==we)}),[]),ke=E.useRef(null);ke.current=b;const F=E.useRef(void 0),W=E.useRef(null);W.current=v;const ce=E.useRef(o.pathname);ce.current=o.pathname,E.useEffect(()=>{if(!b)return;const we=Date.parse(b.expiresAt)-Date.now();if(we<=0){x(null);return}const Re=setTimeout(()=>x(null),we);return()=>clearTimeout(Re)},[b]);const xe=E.useCallback(async(we,Re,oe)=>{se(!0);const Be=Date.now();try{F.current=Ck(ke.current);const We=await Tk(we,{actingToken:oe??void 0,previousActingToken:X.current??void 0,subject:F.current,stationRole:C.current??void 0});if(oe&&g(oe,We),x(pe=>M1(pe,We)),We.outcome===Ae.IDENTITY_PRIMED){X.current=m(We);const pe=Mk(W.current);if(w(null),pe&&We.actingToken){d({code:we,source:Re,at:Be,response:We,error:null,navigated:!1}),await xe(pe.code,Re,We.actingToken);return}}else R1(We)?w({code:we,at:Be}):w(null);We.outcome===Ae.NOT_PRIMED&&oe&&y();const ln=D(We);d({code:we,source:Re,at:Be,response:We,error:null,navigated:ln})}catch(We){d({code:we,source:Re,at:Be,response:null,error:We.message,navigated:!1})}finally{se(!1)}},[D,m,y,g]),ve=E.useCallback(async(we,Re=jo.MANUAL)=>{for(const oe of he.current)if(oe(we))return;await xe(we,Re,Q.current)},[xe]),Ce=E.useCallback(()=>x(null),[]),Te=E.useCallback(we=>{x(Re=>M1(Re,we))},[]),Me=E.useCallback(()=>w(null),[]),Ze=E.useRef(ve);Ze.current=ve,jk({active:!!t&&s,wedgeConfig:le,tailShapes:q,diagnosticsOn:$,onScan:we=>void Ze.current(we,jo.KEYBOARD_WEDGE),onDiag:we=>ae(Re=>[...Re.slice(-29),we])});const yt=E.useCallback(we=>{R(xk(we))},[]),Ct=E.useMemo(()=>({submitCode:ve,pushCodeInterceptor:Se,lastResult:u,subject:b,dropSubject:Ce,adoptResponse:Te,pendingScan:v,dropPendingScan:Me,busy:B,wedgeConfig:le,updateWedgeConfig:yt,diagnostics:H,diagnosticsOn:$,setDiagnosticsOn:I}),[ve,Se,u,b,Ce,Te,v,Me,B,le,yt,H,$]);return h.jsx(qm.Provider,{value:Ct,children:n})}var hc={},oo={},dc={},L1;function kn(){if(L1)return dc;L1=1,Object.defineProperty(dc,"__esModule",{value:!0});function n(s,i){if(!(s instanceof i))throw new TypeError("Cannot call a class as a function")}var t=function s(i,o){n(this,s),this.data=i,this.text=o.text||i,this.options=o};return dc.default=t,dc}var q1;function Uk(){if(q1)return oo;q1=1,Object.defineProperty(oo,"__esModule",{value:!0}),oo.CODE39=void 0;var n=(function(){function S(C,q){for(var B=0;B<q.length;B++){var se=q[B];se.enumerable=se.enumerable||!1,se.configurable=!0,"value"in se&&(se.writable=!0),Object.defineProperty(C,se.key,se)}}return function(C,q,B){return q&&S(C.prototype,q),B&&S(C,B),C}})(),t=kn(),s=i(t);function i(S){return S&&S.__esModule?S:{default:S}}function o(S,C){if(!(S instanceof C))throw new TypeError("Cannot call a class as a function")}function c(S,C){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:S}function m(S,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);S.prototype=Object.create(C&&C.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(S,C):S.__proto__=C)}var y=(function(S){m(C,S);function C(q,B){return o(this,C),q=q.toUpperCase(),B.mod43&&(q+=x(w(q))),c(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,q,B))}return n(C,[{key:"encode",value:function(){for(var B=d("*"),se=0;se<this.data.length;se++)B+=d(this.data[se])+"0";return B+=d("*"),{data:B,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),C})(s.default),g=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","*"],u=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function d(S){return b(v(S))}function b(S){return u[S].toString(2)}function x(S){return g[S]}function v(S){return g.indexOf(S)}function w(S){for(var C=0,q=0;q<S.length;q++)C+=v(S[q]);return C=C%43,C}return oo.CODE39=y,oo}var Kn={},mc={},pc={},vt={},B1;function Ro(){if(B1)return vt;B1=1,Object.defineProperty(vt,"__esModule",{value:!0});var n;function t(g,u,d){return u in g?Object.defineProperty(g,u,{value:d,enumerable:!0,configurable:!0,writable:!0}):g[u]=d,g}var s=vt.SET_A=0,i=vt.SET_B=1,o=vt.SET_C=2;vt.SHIFT=98;var c=vt.START_A=103,m=vt.START_B=104,y=vt.START_C=105;return vt.MODULO=103,vt.STOP=106,vt.FNC1=207,vt.SET_BY_CODE=(n={},t(n,c,s),t(n,m,i),t(n,y,o),n),vt.SWAP={101:s,100:i,99:o},vt.A_START_CHAR="Ð",vt.B_START_CHAR="Ñ",vt.C_START_CHAR="Ò",vt.A_CHARS="[\0-_È-Ï]",vt.B_CHARS="[ -È-Ï]",vt.C_CHARS="(Ï*[0-9]{2}Ï*)",vt.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011],vt}var P1;function Cu(){if(P1)return pc;P1=1,Object.defineProperty(pc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=kn(),s=o(t),i=Ro();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function y(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){y(d,u);function d(b,x){c(this,d);var v=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b.substring(1),x));return v.bytes=b.split("").map(function(w){return w.charCodeAt(0)}),v}return n(d,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.bytes,v=x.shift()-105,w=i.SET_BY_CODE[v];if(w===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&x.unshift(i.FNC1);var S=d.next(x,1,w);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:d.getBar(v)+S.result+d.getBar((S.checksum+v)%i.MODULO)+d.getBar(i.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var x=this.options.ean128||!1;return typeof x=="string"&&(x=x.toLowerCase()==="true"),x}}],[{key:"getBar",value:function(x){return i.BARS[x]?i.BARS[x].toString():""}},{key:"correctIndex",value:function(x,v){if(v===i.SET_A){var w=x.shift();return w<32?w+64:w-32}else return v===i.SET_B?x.shift()-32:(x.shift()-48)*10+x.shift()-48}},{key:"next",value:function(x,v,w){if(!x.length)return{result:"",checksum:0};var S=void 0,C=void 0;if(x[0]>=200){C=x.shift()-105;var q=i.SWAP[C];q!==void 0?S=d.next(x,v+1,q):((w===i.SET_A||w===i.SET_B)&&C===i.SHIFT&&(x[0]=w===i.SET_A?x[0]>95?x[0]-96:x[0]:x[0]<32?x[0]+96:x[0]),S=d.next(x,v+1,w))}else C=d.correctIndex(x,w),S=d.next(x,v+1,w);var B=d.getBar(C),se=C*v;return{result:B+S.result,checksum:se+S.checksum}}}]),d})(s.default);return pc.default=g,pc}var yc={},U1;function zk(){if(U1)return yc;U1=1,Object.defineProperty(yc,"__esModule",{value:!0});var n=Ro(),t=function(y){return y.match(new RegExp("^"+n.A_CHARS+"*"))[0].length},s=function(y){return y.match(new RegExp("^"+n.B_CHARS+"*"))[0].length},i=function(y){return y.match(new RegExp("^"+n.C_CHARS+"*"))[0]};function o(m,y){var g=y?n.A_CHARS:n.B_CHARS,u=m.match(new RegExp("^("+g+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(u)return u[1]+"Ì"+c(m.substring(u[1].length));var d=m.match(new RegExp("^"+g+"+"))[0];return d.length===m.length?m:d+String.fromCharCode(y?205:206)+o(m.substring(d.length),!y)}function c(m){var y=i(m),g=y.length;if(g===m.length)return m;m=m.substring(g);var u=t(m)>=s(m);return y+String.fromCharCode(u?206:205)+o(m,u)}return yc.default=function(m){var y=void 0,g=i(m).length;if(g>=2)y=n.C_START_CHAR+c(m);else{var u=t(m)>s(m);y=(u?n.A_START_CHAR:n.B_START_CHAR)+o(m,u)}return y.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(d,b){return"Ë"+b})},yc}var z1;function Ik(){if(z1)return mc;z1=1,Object.defineProperty(mc,"__esModule",{value:!0});var n=Cu(),t=o(n),s=zk(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function y(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){y(d,u);function d(b,x){if(c(this,d),/^[\x00-\x7F\xC8-\xD3]+$/.test(b))var v=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,(0,i.default)(b),x));else var v=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x));return m(v)}return d})(t.default);return mc.default=g,mc}var gc={},I1;function $k(){if(I1)return gc;I1=1,Object.defineProperty(gc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=Cu(),s=o(t),i=Ro();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function y(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){y(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.A_START_CHAR+b,x))}return n(d,[{key:"valid",value:function(){return new RegExp("^"+i.A_CHARS+"+$").test(this.data)}}]),d})(s.default);return gc.default=g,gc}var bc={},$1;function Hk(){if($1)return bc;$1=1,Object.defineProperty(bc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=Cu(),s=o(t),i=Ro();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function y(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){y(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.B_START_CHAR+b,x))}return n(d,[{key:"valid",value:function(){return new RegExp("^"+i.B_CHARS+"+$").test(this.data)}}]),d})(s.default);return bc.default=g,bc}var xc={},H1;function Fk(){if(H1)return xc;H1=1,Object.defineProperty(xc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=Cu(),s=o(t),i=Ro();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function y(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){y(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.C_START_CHAR+b,x))}return n(d,[{key:"valid",value:function(){return new RegExp("^"+i.C_CHARS+"+$").test(this.data)}}]),d})(s.default);return xc.default=g,xc}var F1;function Gk(){if(F1)return Kn;F1=1,Object.defineProperty(Kn,"__esModule",{value:!0}),Kn.CODE128C=Kn.CODE128B=Kn.CODE128A=Kn.CODE128=void 0;var n=Ik(),t=g(n),s=$k(),i=g(s),o=Hk(),c=g(o),m=Fk(),y=g(m);function g(u){return u&&u.__esModule?u:{default:u}}return Kn.CODE128=t.default,Kn.CODE128A=i.default,Kn.CODE128B=c.default,Kn.CODE128C=y.default,Kn}var Yt={},vc={},Cr={},G1;function Do(){return G1||(G1=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.SIDE_BIN="101",Cr.MIDDLE_BIN="01010",Cr.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},Cr.EAN2_STRUCTURE=["LL","LG","GL","GG"],Cr.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],Cr.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),Cr}var _c={},wc={},V1;function Lo(){if(V1)return wc;V1=1,Object.defineProperty(wc,"__esModule",{value:!0});var n=Do(),t=function(i,o,c){var m=i.split("").map(function(g,u){return n.BINARIES[o[u]]}).map(function(g,u){return g?g[i[u]]:""});if(c){var y=i.length-1;m=m.map(function(g,u){return u<y?g+c:g})}return m.join("")};return wc.default=t,wc}var Y1;function wv(){if(Y1)return _c;Y1=1,Object.defineProperty(_c,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})(),t=Do(),s=Lo(),i=m(s),o=kn(),c=m(o);function m(b){return b&&b.__esModule?b:{default:b}}function y(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function u(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var d=(function(b){u(x,b);function x(v,w){y(this,x);var S=g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,w));return S.fontSize=!w.flat&&w.fontSize>w.width*10?w.width*10:w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return n(x,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(w,S){return this.text.substr(w,S)}},{key:"leftEncode",value:function(w,S){return(0,i.default)(w,S)}},{key:"rightText",value:function(w,S){return this.text.substr(w,S)}},{key:"rightEncode",value:function(w,S){return(0,i.default)(w,S)}},{key:"encodeGuarded",value:function(){var w={fontSize:this.fontSize},S={height:this.guardHeight};return[{data:t.SIDE_BIN,options:S},{data:this.leftEncode(),text:this.leftText(),options:w},{data:t.MIDDLE_BIN,options:S},{data:this.rightEncode(),text:this.rightText(),options:w},{data:t.SIDE_BIN,options:S}]}},{key:"encodeFlat",value:function(){var w=[t.SIDE_BIN,this.leftEncode(),t.MIDDLE_BIN,this.rightEncode(),t.SIDE_BIN];return{data:w.join(""),text:this.text}}}]),x})(c.default);return _c.default=d,_c}var K1;function Vk(){if(K1)return vc;K1=1,Object.defineProperty(vc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})(),t=function b(x,v,w){x===null&&(x=Function.prototype);var S=Object.getOwnPropertyDescriptor(x,v);if(S===void 0){var C=Object.getPrototypeOf(x);return C===null?void 0:b(C,v,w)}else{if("value"in S)return S.value;var q=S.get;return q===void 0?void 0:q.call(w)}},s=Do(),i=wv(),o=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function y(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var u=function(x){var v=x.substr(0,12).split("").map(function(w){return+w}).reduce(function(w,S,C){return C%2?w+S*3:w+S},0);return(10-v%10)%10},d=(function(b){g(x,b);function x(v,w){m(this,x),v.search(/^[0-9]{12}$/)!==-1&&(v+=u(v));var S=y(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,w));return S.lastChar=w.lastChar,S}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===u(this.data)}},{key:"leftText",value:function(){return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftText",this).call(this,1,6)}},{key:"leftEncode",value:function(){var w=this.data.substr(1,6),S=s.EAN13_STRUCTURE[this.data[0]];return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftEncode",this).call(this,w,S)}},{key:"rightText",value:function(){return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var w=this.data.substr(7,6);return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightEncode",this).call(this,w,"RRRRRR")}},{key:"encodeGuarded",value:function(){var w=t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"encodeGuarded",this).call(this);return this.options.displayValue&&(w.unshift({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),this.options.lastChar&&(w.push({data:"00"}),w.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}}))),w}}]),x})(o.default);return vc.default=d,vc}var Sc={},J1;function Yk(){if(J1)return Sc;J1=1,Object.defineProperty(Sc,"__esModule",{value:!0});var n=(function(){function d(b,x){for(var v=0;v<x.length;v++){var w=x[v];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(b,w.key,w)}}return function(b,x,v){return x&&d(b.prototype,x),v&&d(b,v),b}})(),t=function d(b,x,v){b===null&&(b=Function.prototype);var w=Object.getOwnPropertyDescriptor(b,x);if(w===void 0){var S=Object.getPrototypeOf(b);return S===null?void 0:d(S,x,v)}else{if("value"in w)return w.value;var C=w.get;return C===void 0?void 0:C.call(v)}},s=wv(),i=o(s);function o(d){return d&&d.__esModule?d:{default:d}}function c(d,b){if(!(d instanceof b))throw new TypeError("Cannot call a class as a function")}function m(d,b){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:d}function y(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);d.prototype=Object.create(b&&b.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(d,b):d.__proto__=b)}var g=function(b){var x=b.substr(0,7).split("").map(function(v){return+v}).reduce(function(v,w,S){return S%2?v+w:v+w*3},0);return(10-x%10)%10},u=(function(d){y(b,d);function b(x,v){return c(this,b),x.search(/^[0-9]{7}$/)!==-1&&(x+=g(x)),m(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,x,v))}return n(b,[{key:"valid",value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===g(this.data)}},{key:"leftText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftText",this).call(this,0,4)}},{key:"leftEncode",value:function(){var v=this.data.substr(0,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,v,"LLLL")}},{key:"rightText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightText",this).call(this,4,4)}},{key:"rightEncode",value:function(){var v=this.data.substr(4,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,v,"RRRR")}}]),b})(i.default);return Sc.default=u,Sc}var Ec={},X1;function Kk(){if(X1)return Ec;X1=1,Object.defineProperty(Ec,"__esModule",{value:!0});var n=(function(){function x(v,w){for(var S=0;S<w.length;S++){var C=w[S];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(v,C.key,C)}}return function(v,w,S){return w&&x(v.prototype,w),S&&x(v,S),v}})(),t=Do(),s=Lo(),i=m(s),o=kn(),c=m(o);function m(x){return x&&x.__esModule?x:{default:x}}function y(x,v){if(!(x instanceof v))throw new TypeError("Cannot call a class as a function")}function g(x,v){if(!x)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:x}function u(x,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);x.prototype=Object.create(v&&v.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(x,v):x.__proto__=v)}var d=function(v){var w=v.split("").map(function(S){return+S}).reduce(function(S,C,q){return q%2?S+C*9:S+C*3},0);return w%10},b=(function(x){u(v,x);function v(w,S){return y(this,v),g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,w,S))}return n(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var S=t.EAN5_STRUCTURE[d(this.data)];return{data:"1011"+(0,i.default)(this.data,S,"01"),text:this.text}}}]),v})(c.default);return Ec.default=b,Ec}var Oc={},Q1;function Jk(){if(Q1)return Oc;Q1=1,Object.defineProperty(Oc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})(),t=Do(),s=Lo(),i=m(s),o=kn(),c=m(o);function m(b){return b&&b.__esModule?b:{default:b}}function y(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function u(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var d=(function(b){u(x,b);function x(v,w){return y(this,x),g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,w))}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:"encode",value:function(){var w=t.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,i.default)(this.data,w,"01"),text:this.text}}}]),x})(c.default);return Oc.default=d,Oc}var lo={},W1;function Sv(){if(W1)return lo;W1=1,Object.defineProperty(lo,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})();lo.checksum=d;var t=Lo(),s=c(t),i=kn(),o=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function y(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var u=(function(b){g(x,b);function x(v,w){m(this,x),v.search(/^[0-9]{11}$/)!==-1&&(v+=d(v));var S=y(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,w));return S.displayValue=w.displayValue,w.fontSize>w.width*10?S.fontSize=w.width*10:S.fontSize=w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==d(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var w="";return w+="101",w+=(0,s.default)(this.data.substr(0,6),"LLLLLL"),w+="01010",w+=(0,s.default)(this.data.substr(6,6),"RRRRRR"),w+="101",{data:w,text:this.text}}},{key:"guardedEncoding",value:function(){var w=[];return this.displayValue&&w.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),w.push({data:"101"+(0,s.default)(this.data[0],"L"),options:{height:this.guardHeight}}),w.push({data:(0,s.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),w.push({data:"01010",options:{height:this.guardHeight}}),w.push({data:(0,s.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),w.push({data:(0,s.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&w.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),w}}]),x})(o.default);function d(b){var x=0,v;for(v=1;v<11;v+=2)x+=parseInt(b[v]);for(v=0;v<11;v+=2)x+=parseInt(b[v])*3;return(10-x%10)%10}return lo.default=u,lo}var Ac={},Z1;function Xk(){if(Z1)return Ac;Z1=1,Object.defineProperty(Ac,"__esModule",{value:!0});var n=(function(){function w(S,C){for(var q=0;q<C.length;q++){var B=C[q];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(S,B.key,B)}}return function(S,C,q){return C&&w(S.prototype,C),q&&w(S,q),S}})(),t=Lo(),s=m(t),i=kn(),o=m(i),c=Sv();function m(w){return w&&w.__esModule?w:{default:w}}function y(w,S){if(!(w instanceof S))throw new TypeError("Cannot call a class as a function")}function g(w,S){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:w}function u(w,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);w.prototype=Object.create(S&&S.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(w,S):w.__proto__=S)}var d=["XX00000XXX","XX10000XXX","XX20000XXX","XXX00000XX","XXXX00000X","XXXXX00005","XXXXX00006","XXXXX00007","XXXXX00008","XXXXX00009"],b=[["EEEOOO","OOOEEE"],["EEOEOO","OOEOEE"],["EEOOEO","OOEEOE"],["EEOOOE","OOEEEO"],["EOEEOO","OEOOEE"],["EOOEEO","OEEOOE"],["EOOOEE","OEEEOO"],["EOEOEO","OEOEOE"],["EOEOOE","OEOEEO"],["EOOEOE","OEEOEO"]],x=(function(w){u(S,w);function S(C,q){y(this,S);var B=g(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,C,q));if(B.isValid=!1,C.search(/^[0-9]{6}$/)!==-1)B.middleDigits=C,B.upcA=v(C,"0"),B.text=q.text||""+B.upcA[0]+C+B.upcA[B.upcA.length-1],B.isValid=!0;else if(C.search(/^[01][0-9]{7}$/)!==-1)if(B.middleDigits=C.substring(1,C.length-1),B.upcA=v(B.middleDigits,C[0]),B.upcA[B.upcA.length-1]===C[C.length-1])B.isValid=!0;else return g(B);else return g(B);return B.displayValue=q.displayValue,q.fontSize>q.width*10?B.fontSize=q.width*10:B.fontSize=q.fontSize,B.guardHeight=q.height+B.fontSize/2+q.textMargin,B}return n(S,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var q="";return q+="101",q+=this.encodeMiddleDigits(),q+="010101",{data:q,text:this.text}}},{key:"guardedEncoding",value:function(){var q=[];return this.displayValue&&q.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),q.push({data:"101",options:{height:this.guardHeight}}),q.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),q.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&q.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),q}},{key:"encodeMiddleDigits",value:function(){var q=this.upcA[0],B=this.upcA[this.upcA.length-1],se=b[parseInt(B)][parseInt(q)];return(0,s.default)(this.middleDigits,se)}}]),S})(o.default);function v(w,S){for(var C=parseInt(w[w.length-1]),q=d[C],B="",se=0,le=0;le<q.length;le++){var R=q[le];R==="X"?B+=w[se++]:B+=R}return B=""+S+B,""+B+(0,c.checksum)(B)}return Ac.default=x,Ac}var eb;function Qk(){if(eb)return Yt;eb=1,Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.UPCE=Yt.UPC=Yt.EAN2=Yt.EAN5=Yt.EAN8=Yt.EAN13=void 0;var n=Vk(),t=x(n),s=Yk(),i=x(s),o=Kk(),c=x(o),m=Jk(),y=x(m),g=Sv(),u=x(g),d=Xk(),b=x(d);function x(v){return v&&v.__esModule?v:{default:v}}return Yt.EAN13=t.default,Yt.EAN8=i.default,Yt.EAN5=c.default,Yt.EAN2=y.default,Yt.UPC=u.default,Yt.UPCE=b.default,Yt}var Js={},jc={},Hi={},tb;function Wk(){return tb||(tb=1,Object.defineProperty(Hi,"__esModule",{value:!0}),Hi.START_BIN="1010",Hi.END_BIN="11101",Hi.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Hi}var nb;function Ev(){if(nb)return jc;nb=1,Object.defineProperty(jc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=Wk(),s=kn(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function y(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){y(d,u);function d(){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}return n(d,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var x=this,v=this.data.match(/.{2}/g).map(function(w){return x.encodePair(w)}).join("");return{data:t.START_BIN+v+t.END_BIN,text:this.text}}},{key:"encodePair",value:function(x){var v=t.BINARIES[x[1]];return t.BINARIES[x[0]].split("").map(function(w,S){return(w==="1"?"111":"1")+(v[S]==="1"?"000":"0")}).join("")}}]),d})(i.default);return jc.default=g,jc}var kc={},rb;function Zk(){if(rb)return kc;rb=1,Object.defineProperty(kc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=Ev(),s=i(t);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function c(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function m(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var y=function(d){var b=d.substr(0,13).split("").map(function(x){return parseInt(x,10)}).reduce(function(x,v,w){return x+v*(3-w%2*2)},0);return Math.ceil(b/10)*10-b},g=(function(u){m(d,u);function d(b,x){return o(this,d),b.search(/^[0-9]{13}$/)!==-1&&(b+=y(b)),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x))}return n(d,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===y(this.data)}}]),d})(s.default);return kc.default=g,kc}var sb;function eT(){if(sb)return Js;sb=1,Object.defineProperty(Js,"__esModule",{value:!0}),Js.ITF14=Js.ITF=void 0;var n=Ev(),t=o(n),s=Zk(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Js.ITF=t.default,Js.ITF14=i.default,Js}var bn={},Tc={},ib;function qo(){if(ib)return Tc;ib=1,Object.defineProperty(Tc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=kn(),s=i(t);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function c(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function m(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var y=(function(u){m(d,u);function d(b,x){return o(this,d),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x))}return n(d,[{key:"encode",value:function(){for(var x="110",v=0;v<this.data.length;v++){var w=parseInt(this.data[v]),S=w.toString(2);S=g(S,4-S.length);for(var C=0;C<S.length;C++)x+=S[C]=="0"?"100":"110"}return x+="1001",{data:x,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),d})(s.default);function g(u,d){for(var b=0;b<d;b++)u="0"+u;return u}return Tc.default=y,Tc}var Nc={},co={},ab;function Mu(){if(ab)return co;ab=1,Object.defineProperty(co,"__esModule",{value:!0}),co.mod10=n,co.mod11=t;function n(s){for(var i=0,o=0;o<s.length;o++){var c=parseInt(s[o]);(o+s.length)%2===0?i+=c:i+=c*2%10+Math.floor(c*2/10)}return(10-i%10)%10}function t(s){for(var i=0,o=[2,3,4,5,6,7],c=0;c<s.length;c++){var m=parseInt(s[s.length-1-c]);i+=o[c%o.length]*m}return(11-i%11)%11}return co}var ob;function tT(){if(ob)return Nc;ob=1,Object.defineProperty(Nc,"__esModule",{value:!0});var n=qo(),t=i(n),s=Mu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d+(0,s.mod10)(d),b))}return u})(t.default);return Nc.default=y,Nc}var Cc={},lb;function nT(){if(lb)return Cc;lb=1,Object.defineProperty(Cc,"__esModule",{value:!0});var n=qo(),t=i(n),s=Mu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d+(0,s.mod11)(d),b))}return u})(t.default);return Cc.default=y,Cc}var Mc={},cb;function rT(){if(cb)return Mc;cb=1,Object.defineProperty(Mc,"__esModule",{value:!0});var n=qo(),t=i(n),s=Mu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){m(u,g);function u(d,b){return o(this,u),d+=(0,s.mod10)(d),d+=(0,s.mod10)(d),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return u})(t.default);return Mc.default=y,Mc}var Rc={},ub;function sT(){if(ub)return Rc;ub=1,Object.defineProperty(Rc,"__esModule",{value:!0});var n=qo(),t=i(n),s=Mu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){m(u,g);function u(d,b){return o(this,u),d+=(0,s.mod11)(d),d+=(0,s.mod10)(d),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return u})(t.default);return Rc.default=y,Rc}var fb;function iT(){if(fb)return bn;fb=1,Object.defineProperty(bn,"__esModule",{value:!0}),bn.MSI1110=bn.MSI1010=bn.MSI11=bn.MSI10=bn.MSI=void 0;var n=qo(),t=d(n),s=tT(),i=d(s),o=nT(),c=d(o),m=rT(),y=d(m),g=sT(),u=d(g);function d(b){return b&&b.__esModule?b:{default:b}}return bn.MSI=t.default,bn.MSI10=i.default,bn.MSI11=c.default,bn.MSI1010=y.default,bn.MSI1110=u.default,bn}var uo={},hb;function aT(){if(hb)return uo;hb=1,Object.defineProperty(uo,"__esModule",{value:!0}),uo.pharmacode=void 0;var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),t=kn(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){m(u,g);function u(d,b){o(this,u);var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b));return x.number=parseInt(d,10),x}return n(u,[{key:"encode",value:function(){for(var b=this.number,x="";!isNaN(b)&&b!=0;)b%2===0?(x="11100"+x,b=(b-2)/2):(x="100"+x,b=(b-1)/2);return x=x.slice(0,-2),{data:x,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),u})(s.default);return uo.pharmacode=y,uo}var fo={},db;function oT(){if(db)return fo;db=1,Object.defineProperty(fo,"__esModule",{value:!0}),fo.codabar=void 0;var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),t=kn(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){m(u,g);function u(d,b){o(this,u),d.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(d="A"+d+"A");var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d.toUpperCase(),b));return x.text=x.options.text||x.text.replace(/[A-D]/g,""),x}return n(u,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var b=[],x=this.getEncodings(),v=0;v<this.data.length;v++)b.push(x[this.data.charAt(v)]),v!==this.data.length-1&&b.push("0");return{text:this.text,data:b.join("")}}},{key:"getEncodings",value:function(){return{0:"101010011",1:"101011001",2:"101001011",3:"110010101",4:"101101001",5:"110101001",6:"100101011",7:"100101101",8:"100110101",9:"110100101","-":"101001101",$:"101100101",":":"1101011011","/":"1101101011",".":"1101101101","+":"1011011011",A:"1011001001",B:"1001001011",C:"1010010011",D:"1010011001"}}}]),u})(s.default);return fo.codabar=y,fo}var Xs={},Dc={},Fi={},mb;function lT(){return mb||(mb=1,Object.defineProperty(Fi,"__esModule",{value:!0}),Fi.SYMBOLS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],Fi.BINARIES=["100010100","101001000","101000100","101000010","100101000","100100100","100100010","101010000","100010010","100001010","110101000","110100100","110100010","110010100","110010010","110001010","101101000","101100100","101100010","100110100","100011010","101011000","101001100","101000110","100101100","100010110","110110100","110110010","110101100","110100110","110010110","110011010","101101100","101100110","100110110","100111010","100101110","111010100","111010010","111001010","101101110","101110110","110101110","100100110","111011010","111010110","100110010","101011110"],Fi.MULTI_SYMBOLS={"\0":["(%)","U"],"":["($)","A"],"":["($)","B"],"":["($)","C"],"":["($)","D"],"":["($)","E"],"":["($)","F"],"\x07":["($)","G"],"\b":["($)","H"]," ":["($)","I"],"\n":["($)","J"],"\v":["($)","K"],"\f":["($)","L"],"\r":["($)","M"],"":["($)","N"],"":["($)","O"],"":["($)","P"],"":["($)","Q"],"":["($)","R"],"":["($)","S"],"":["($)","T"],"":["($)","U"],"":["($)","V"],"":["($)","W"],"":["($)","X"],"":["($)","Y"],"":["($)","Z"],"\x1B":["(%)","A"],"":["(%)","B"],"":["(%)","C"],"":["(%)","D"],"":["(%)","E"],"!":["(/)","A"],'"':["(/)","B"],"#":["(/)","C"],"&":["(/)","F"],"'":["(/)","G"],"(":["(/)","H"],")":["(/)","I"],"*":["(/)","J"],",":["(/)","L"],":":["(/)","Z"],";":["(%)","F"],"<":["(%)","G"],"=":["(%)","H"],">":["(%)","I"],"?":["(%)","J"],"@":["(%)","V"],"[":["(%)","K"],"\\":["(%)","L"],"]":["(%)","M"],"^":["(%)","N"],_:["(%)","O"],"`":["(%)","W"],a:["(+)","A"],b:["(+)","B"],c:["(+)","C"],d:["(+)","D"],e:["(+)","E"],f:["(+)","F"],g:["(+)","G"],h:["(+)","H"],i:["(+)","I"],j:["(+)","J"],k:["(+)","K"],l:["(+)","L"],m:["(+)","M"],n:["(+)","N"],o:["(+)","O"],p:["(+)","P"],q:["(+)","Q"],r:["(+)","R"],s:["(+)","S"],t:["(+)","T"],u:["(+)","U"],v:["(+)","V"],w:["(+)","W"],x:["(+)","X"],y:["(+)","Y"],z:["(+)","Z"],"{":["(%)","P"],"|":["(%)","Q"],"}":["(%)","R"],"~":["(%)","S"],"":["(%)","T"]}),Fi}var pb;function Ov(){if(pb)return Dc;pb=1,Object.defineProperty(Dc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=lT(),s=kn(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function y(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){y(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x))}return n(d,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.data.split("").flatMap(function(C){return t.MULTI_SYMBOLS[C]||C}),v=x.map(function(C){return d.getEncoding(C)}).join(""),w=d.checksum(x,20),S=d.checksum(x.concat(w),15);return{text:this.text,data:d.getEncoding("ÿ")+v+d.getEncoding(w)+d.getEncoding(S)+d.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(x){return t.BINARIES[d.symbolValue(x)]}},{key:"getSymbol",value:function(x){return t.SYMBOLS[x]}},{key:"symbolValue",value:function(x){return t.SYMBOLS.indexOf(x)}},{key:"checksum",value:function(x,v){var w=x.slice().reverse().reduce(function(S,C,q){var B=q%v+1;return S+d.symbolValue(C)*B},0);return d.getSymbol(w%47)}}]),d})(i.default);return Dc.default=g,Dc}var Lc={},yb;function cT(){if(yb)return Lc;yb=1,Object.defineProperty(Lc,"__esModule",{value:!0});var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),t=Ov(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return n(u,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),u})(s.default);return Lc.default=y,Lc}var gb;function uT(){if(gb)return Xs;gb=1,Object.defineProperty(Xs,"__esModule",{value:!0}),Xs.CODE93FullASCII=Xs.CODE93=void 0;var n=Ov(),t=o(n),s=cT(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Xs.CODE93=t.default,Xs.CODE93FullASCII=i.default,Xs}var ho={},bb;function fT(){if(bb)return ho;bb=1,Object.defineProperty(ho,"__esModule",{value:!0}),ho.GenericBarcode=void 0;var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),t=kn(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var y=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return n(u,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),u})(s.default);return ho.GenericBarcode=y,ho}var xb;function hT(){if(xb)return hc;xb=1,Object.defineProperty(hc,"__esModule",{value:!0});var n=Uk(),t=Gk(),s=Qk(),i=eT(),o=iT(),c=aT(),m=oT(),y=uT(),g=fT();return hc.default={CODE39:n.CODE39,CODE128:t.CODE128,CODE128A:t.CODE128A,CODE128B:t.CODE128B,CODE128C:t.CODE128C,EAN13:s.EAN13,EAN8:s.EAN8,EAN5:s.EAN5,EAN2:s.EAN2,UPC:s.UPC,UPCE:s.UPCE,ITF14:i.ITF14,ITF:i.ITF,MSI:o.MSI,MSI10:o.MSI10,MSI11:o.MSI11,MSI1010:o.MSI1010,MSI1110:o.MSI1110,pharmacode:c.pharmacode,codabar:m.codabar,CODE93:y.CODE93,CODE93FullASCII:y.CODE93FullASCII,GenericBarcode:g.GenericBarcode},hc}var qc={},vb;function Ru(){if(vb)return qc;vb=1,Object.defineProperty(qc,"__esModule",{value:!0});var n=Object.assign||function(t){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t};return qc.default=function(t,s){return n({},t,s)},qc}var Bc={},_b;function dT(){if(_b)return Bc;_b=1,Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.default=n;function n(t){var s=[];function i(o){if(Array.isArray(o))for(var c=0;c<o.length;c++)i(o[c]);else o.text=o.text||"",o.data=o.data||"",s.push(o)}return i(t),s}return Bc}var Pc={},wb;function mT(){if(wb)return Pc;wb=1,Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.default=n;function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}return Pc}var Uc={},zc={},Ic={},Sb;function Av(){if(Sb)return Ic;Sb=1,Object.defineProperty(Ic,"__esModule",{value:!0}),Ic.default=n;function n(t){var s=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var i in s)s.hasOwnProperty(i)&&(i=s[i],typeof t[i]=="string"&&(t[i]=parseInt(t[i],10)));return typeof t.displayValue=="string"&&(t.displayValue=t.displayValue!="false"),t}return Ic}var $c={},Eb;function jv(){if(Eb)return $c;Eb=1,Object.defineProperty($c,"__esModule",{value:!0});var n={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};return $c.default=n,$c}var Ob;function pT(){if(Ob)return zc;Ob=1,Object.defineProperty(zc,"__esModule",{value:!0});var n=Av(),t=o(n),s=jv(),i=o(s);function o(m){return m&&m.__esModule?m:{default:m}}function c(m){var y={};for(var g in i.default)i.default.hasOwnProperty(g)&&(m.hasAttribute("jsbarcode-"+g.toLowerCase())&&(y[g]=m.getAttribute("jsbarcode-"+g.toLowerCase())),m.hasAttribute("data-"+g.toLowerCase())&&(y[g]=m.getAttribute("data-"+g.toLowerCase())));return y.value=m.getAttribute("jsbarcode-value")||m.getAttribute("data-value"),y=(0,t.default)(y),y}return zc.default=c,zc}var Hc={},Fc={},xn={},Ab;function kv(){if(Ab)return xn;Ab=1,Object.defineProperty(xn,"__esModule",{value:!0}),xn.getTotalWidthOfEncodings=xn.calculateEncodingAttributes=xn.getBarcodePadding=xn.getEncodingHeight=xn.getMaximumHeightOfEncodings=void 0;var n=Ru(),t=s(n);function s(u){return u&&u.__esModule?u:{default:u}}function i(u,d){return d.height+(d.displayValue&&u.text.length>0?d.fontSize+d.textMargin:0)+d.marginTop+d.marginBottom}function o(u,d,b){if(b.displayValue&&d<u){if(b.textAlign=="center")return Math.floor((u-d)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(u-d)}return 0}function c(u,d,b){for(var x=0;x<u.length;x++){var v=u[x],w=(0,t.default)(d,v.options),S;w.displayValue?S=g(v.text,w,b):S=0;var C=v.data.length*w.width;v.width=Math.ceil(Math.max(S,C)),v.height=i(v,w),v.barcodePadding=o(S,C,w)}}function m(u){for(var d=0,b=0;b<u.length;b++)d+=u[b].width;return d}function y(u){for(var d=0,b=0;b<u.length;b++)u[b].height>d&&(d=u[b].height);return d}function g(u,d,b){var x;if(b)x=b;else if(typeof document<"u")x=document.createElement("canvas").getContext("2d");else return 0;x.font=d.fontOptions+" "+d.fontSize+"px "+d.font;var v=x.measureText(u);if(!v)return 0;var w=v.width;return w}return xn.getMaximumHeightOfEncodings=y,xn.getEncodingHeight=i,xn.getBarcodePadding=o,xn.calculateEncodingAttributes=c,xn.getTotalWidthOfEncodings=m,xn}var jb;function yT(){if(jb)return Fc;jb=1,Object.defineProperty(Fc,"__esModule",{value:!0});var n=(function(){function y(g,u){for(var d=0;d<u.length;d++){var b=u[d];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}return function(g,u,d){return u&&y(g.prototype,u),d&&y(g,d),g}})(),t=Ru(),s=o(t),i=kv();function o(y){return y&&y.__esModule?y:{default:y}}function c(y,g){if(!(y instanceof g))throw new TypeError("Cannot call a class as a function")}var m=(function(){function y(g,u,d){c(this,y),this.canvas=g,this.encodings=u,this.options=d}return n(y,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var u=0;u<this.encodings.length;u++){var d=(0,s.default)(this.options,this.encodings[u].options);this.drawCanvasBarcode(d,this.encodings[u]),this.drawCanvasText(d,this.encodings[u]),this.moveCanvasDrawing(this.encodings[u])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var u=this.canvas.getContext("2d");u.save(),(0,i.calculateEncodingAttributes)(this.encodings,this.options,u);var d=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=d+this.options.marginLeft+this.options.marginRight,this.canvas.height=b,u.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(u.fillStyle=this.options.background,u.fillRect(0,0,this.canvas.width,this.canvas.height)),u.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(u,d){var b=this.canvas.getContext("2d"),x=d.data,v;u.textPosition=="top"?v=u.marginTop+u.fontSize+u.textMargin:v=u.marginTop,b.fillStyle=u.lineColor;for(var w=0;w<x.length;w++){var S=w*u.width+d.barcodePadding;x[w]==="1"?b.fillRect(S,v,u.width,u.height):x[w]&&b.fillRect(S,v,u.width,u.height*x[w])}}},{key:"drawCanvasText",value:function(u,d){var b=this.canvas.getContext("2d"),x=u.fontOptions+" "+u.fontSize+"px "+u.font;if(u.displayValue){var v,w;u.textPosition=="top"?w=u.marginTop+u.fontSize-u.textMargin:w=u.height+u.textMargin+u.marginTop+u.fontSize,b.font=x,u.textAlign=="left"||d.barcodePadding>0?(v=0,b.textAlign="left"):u.textAlign=="right"?(v=d.width-1,b.textAlign="right"):(v=d.width/2,b.textAlign="center"),b.fillText(d.text,v,w)}}},{key:"moveCanvasDrawing",value:function(u){var d=this.canvas.getContext("2d");d.translate(u.width,0)}},{key:"restoreCanvas",value:function(){var u=this.canvas.getContext("2d");u.restore()}}]),y})();return Fc.default=m,Fc}var Gc={},kb;function gT(){if(kb)return Gc;kb=1,Object.defineProperty(Gc,"__esModule",{value:!0});var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),t=Ru(),s=o(t),i=kv();function o(g){return g&&g.__esModule?g:{default:g}}function c(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}var m="http://www.w3.org/2000/svg",y=(function(){function g(u,d,b){c(this,g),this.svg=u,this.encodings=d,this.options=b,this.document=b.xmlDocument||document}return n(g,[{key:"render",value:function(){var d=this.options.marginLeft;this.prepareSVG();for(var b=0;b<this.encodings.length;b++){var x=this.encodings[b],v=(0,s.default)(this.options,x.options),w=this.createGroup(d,v.marginTop,this.svg);this.setGroupOptions(w,v),this.drawSvgBarcode(w,v,x),this.drawSVGText(w,v,x),d+=x.width}}},{key:"prepareSVG",value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,i.calculateEncodingAttributes)(this.encodings,this.options);var d=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings),x=d+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(x,b),this.options.background&&this.drawRect(0,0,x,b,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(d,b,x){var v=x.data,w;b.textPosition=="top"?w=b.fontSize+b.textMargin:w=0;for(var S=0,C=0,q=0;q<v.length;q++)C=q*b.width+x.barcodePadding,v[q]==="1"?S++:S>0&&(this.drawRect(C-b.width*S,w,b.width*S,b.height,d),S=0);S>0&&this.drawRect(C-b.width*(S-1),w,b.width*S,b.height,d)}},{key:"drawSVGText",value:function(d,b,x){var v=this.document.createElementNS(m,"text");if(b.displayValue){var w,S;v.setAttribute("font-family",b.font),v.setAttribute("font-size",b.fontSize),b.fontOptions.includes("bold")&&v.setAttribute("font-weight","bold"),b.fontOptions.includes("italic")&&v.setAttribute("font-style","italic"),b.textPosition=="top"?S=b.fontSize-b.textMargin:S=b.height+b.textMargin+b.fontSize,b.textAlign=="left"||x.barcodePadding>0?(w=0,v.setAttribute("text-anchor","start")):b.textAlign=="right"?(w=x.width-1,v.setAttribute("text-anchor","end")):(w=x.width/2,v.setAttribute("text-anchor","middle")),v.setAttribute("x",w),v.setAttribute("y",S),v.appendChild(this.document.createTextNode(x.text)),d.appendChild(v)}}},{key:"setSvgAttributes",value:function(d,b){var x=this.svg;x.setAttribute("width",d+"px"),x.setAttribute("height",b+"px"),x.setAttribute("x","0px"),x.setAttribute("y","0px"),x.setAttribute("viewBox","0 0 "+d+" "+b),x.setAttribute("xmlns",m),x.setAttribute("version","1.1")}},{key:"createGroup",value:function(d,b,x){var v=this.document.createElementNS(m,"g");return v.setAttribute("transform","translate("+d+", "+b+")"),x.appendChild(v),v}},{key:"setGroupOptions",value:function(d,b){d.setAttribute("fill",b.lineColor)}},{key:"drawRect",value:function(d,b,x,v,w){var S=this.document.createElementNS(m,"rect");return S.setAttribute("x",d),S.setAttribute("y",b),S.setAttribute("width",x),S.setAttribute("height",v),w.appendChild(S),S}}]),g})();return Gc.default=y,Gc}var Vc={},Tb;function bT(){if(Tb)return Vc;Tb=1,Object.defineProperty(Vc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var m=0;m<c.length;m++){var y=c[m];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(o,y.key,y)}}return function(o,c,m){return c&&i(o.prototype,c),m&&i(o,m),o}})();function t(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o,c,m){t(this,i),this.object=o,this.encodings=c,this.options=m}return n(i,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),i})();return Vc.default=s,Vc}var Nb;function xT(){if(Nb)return Hc;Nb=1,Object.defineProperty(Hc,"__esModule",{value:!0});var n=yT(),t=m(n),s=gT(),i=m(s),o=bT(),c=m(o);function m(y){return y&&y.__esModule?y:{default:y}}return Hc.default={CanvasRenderer:t.default,SVGRenderer:i.default,ObjectRenderer:c.default},Hc}var Gi={},Cb;function Tv(){if(Cb)return Gi;Cb=1,Object.defineProperty(Gi,"__esModule",{value:!0});function n(m,y){if(!(m instanceof y))throw new TypeError("Cannot call a class as a function")}function t(m,y){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:m}function s(m,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);m.prototype=Object.create(y&&y.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(m,y):m.__proto__=y)}var i=(function(m){s(y,m);function y(g,u){n(this,y);var d=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return d.name="InvalidInputException",d.symbology=g,d.input=u,d.message='"'+d.input+'" is not a valid input for '+d.symbology,d}return y})(Error),o=(function(m){s(y,m);function y(){n(this,y);var g=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return g.name="InvalidElementException",g.message="Not supported type to render on",g}return y})(Error),c=(function(m){s(y,m);function y(){n(this,y);var g=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return g.name="NoElementException",g.message="No element to render on.",g}return y})(Error);return Gi.InvalidInputException=i,Gi.InvalidElementException=o,Gi.NoElementException=c,Gi}var Mb;function vT(){if(Mb)return Uc;Mb=1,Object.defineProperty(Uc,"__esModule",{value:!0});var n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},t=pT(),s=m(t),i=xT(),o=m(i),c=Tv();function m(d){return d&&d.__esModule?d:{default:d}}function y(d){if(typeof d=="string")return g(d);if(Array.isArray(d)){for(var b=[],x=0;x<d.length;x++)b.push(y(d[x]));return b}else{if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLImageElement)return u(d);if(d&&d.nodeName&&d.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&d instanceof SVGElement)return{element:d,options:(0,s.default)(d),renderer:o.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLCanvasElement)return{element:d,options:(0,s.default)(d),renderer:o.default.CanvasRenderer};if(d&&d.getContext)return{element:d,renderer:o.default.CanvasRenderer};if(d&&(typeof d>"u"?"undefined":n(d))==="object"&&!d.nodeName)return{element:d,renderer:o.default.ObjectRenderer};throw new c.InvalidElementException}}function g(d){var b=document.querySelectorAll(d);if(b.length!==0){for(var x=[],v=0;v<b.length;v++)x.push(y(b[v]));return x}}function u(d){var b=document.createElement("canvas");return{element:b,options:(0,s.default)(d),renderer:o.default.CanvasRenderer,afterRender:function(){d.setAttribute("src",b.toDataURL())}}}return Uc.default=y,Uc}var Yc={},Rb;function _T(){if(Rb)return Yc;Rb=1,Object.defineProperty(Yc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var m=0;m<c.length;m++){var y=c[m];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(o,y.key,y)}}return function(o,c,m){return c&&i(o.prototype,c),m&&i(o,m),o}})();function t(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o){t(this,i),this.api=o}return n(i,[{key:"handleCatch",value:function(c){if(c.name==="InvalidInputException")if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw c.message;else throw c;this.api.render=function(){}}},{key:"wrapBarcodeCall",value:function(c){try{var m=c.apply(void 0,arguments);return this.api._options.valid(!0),m}catch(y){return this.handleCatch(y),this.api}}}]),i})();return Yc.default=s,Yc}var cd,Db;function wT(){if(Db)return cd;Db=1;var n=hT(),t=q(n),s=Ru(),i=q(s),o=dT(),c=q(o),m=mT(),y=q(m),g=vT(),u=q(g),d=Av(),b=q(d),x=_T(),v=q(x),w=Tv(),S=jv(),C=q(S);function q(I){return I&&I.__esModule?I:{default:I}}var B=function(){},se=function(D,Q,X){var he=new B;if(typeof D>"u")throw Error("No element to render on was provided.");return he._renderProperties=(0,u.default)(D),he._encodings=[],he._options=C.default,he._errorHandler=new v.default(he),typeof Q<"u"&&(X=X||{},X.format||(X.format=ae()),he.options(X)[X.format](Q,X).render()),he};se.getModule=function(I){return t.default[I]};for(var le in t.default)t.default.hasOwnProperty(le)&&R(t.default,le);function R(I,D){B.prototype[D]=B.prototype[D.toUpperCase()]=B.prototype[D.toLowerCase()]=function(Q,X){var he=this;return he._errorHandler.wrapBarcodeCall(function(){X.text=typeof X.text>"u"?void 0:""+X.text;var Se=(0,i.default)(he._options,X);Se=(0,b.default)(Se);var ke=I[D],F=H(Q,ke,Se);return he._encodings.push(F),he})}}function H(I,D,Q){I=""+I;var X=new D(I,Q);if(!X.valid())throw new w.InvalidInputException(X.constructor.name,I);var he=X.encode();he=(0,c.default)(he);for(var Se=0;Se<he.length;Se++)he[Se].options=(0,i.default)(Q,he[Se].options);return he}function ae(){return t.default.CODE128?"CODE128":Object.keys(t.default)[0]}B.prototype.options=function(I){return this._options=(0,i.default)(this._options,I),this},B.prototype.blank=function(I){var D=new Array(I+1).join("0");return this._encodings.push({data:D}),this},B.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var I;for(var D in this._renderProperties){I=this._renderProperties[D];var Q=(0,i.default)(this._options,I.options);Q.format=="auto"&&(Q.format=ae()),this._errorHandler.wrapBarcodeCall(function(){var X=Q.value,he=t.default[Q.format.toUpperCase()],Se=H(X,he,Q);$(I,Se,Q)})}}},B.prototype.render=function(){if(!this._renderProperties)throw new w.NoElementException;if(Array.isArray(this._renderProperties))for(var I=0;I<this._renderProperties.length;I++)$(this._renderProperties[I],this._encodings,this._options);else $(this._renderProperties,this._encodings,this._options);return this},B.prototype._defaults=C.default;function $(I,D,Q){D=(0,c.default)(D);for(var X=0;X<D.length;X++)D[X].options=(0,i.default)(Q,D[X].options),(0,y.default)(D[X].options);(0,y.default)(Q);var he=I.renderer,Se=new he(I.element,D,Q);Se.render(),I.afterRender&&I.afterRender()}return typeof window<"u"&&(window.JsBarcode=se),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(I,D){var Q=[];return jQuery(this).each(function(){Q.push(this)}),se(Q,I,D)}),cd=se,cd}var ST=wT();const ET=rS(ST),OT={[Ae.EXECUTED]:"Executed",[Ae.MATCHED_LIST]:"Matched list",[Ae.CONFIRM_REQUIRED]:"Awaiting confirmation",[Ae.NO_MATCH_FALLBACK]:"No match",[Ae.UNCONFIGURED]:"Not configured",[Ae.INVALID_CODE]:"Invalid code",[Ae.FORBIDDEN]:"Not permitted",[Ae.CONFLICT]:"Conflict",[Ae.IDENTITY_PRIMED]:"Identity primed",[Ae.IDENTITY_UNKNOWN]:"Badge not recognized",[Ae.NOT_PRIMED]:"Badge required",[Ae.CHOICES]:"Choices presented",[Ae.NO_OPEN_CONTAINER]:"Container closing, scan again",[Ae.HELD]:"Holding",[Ae.REFUSED]:"Not placed",[Ae.SUBJECT_STALE]:"Scan it again"},AT={[Ae.EXECUTED]:"text-status-success",[Ae.MATCHED_LIST]:"text-status-success",[Ae.CONFIRM_REQUIRED]:"text-status-warning",[Ae.NO_MATCH_FALLBACK]:"text-text-secondary",[Ae.UNCONFIGURED]:"text-status-warning",[Ae.INVALID_CODE]:"text-status-error",[Ae.FORBIDDEN]:"text-status-error",[Ae.CONFLICT]:"text-status-warning",[Ae.IDENTITY_PRIMED]:"text-status-success",[Ae.IDENTITY_UNKNOWN]:"text-status-warning",[Ae.NOT_PRIMED]:"text-status-warning",[Ae.CHOICES]:"text-status-success",[Ae.NO_OPEN_CONTAINER]:"text-status-warning",[Ae.HELD]:"text-status-success",[Ae.REFUSED]:"text-status-error",[Ae.SUBJECT_STALE]:"text-status-warning"};function jT(n){return n.outcome===Ae.IDENTITY_PRIMED&&n.actor?`Hi ${n.actor.displayName}`:`${OT[n.outcome]}${n.rule?` — ${n.rule.name}`:""}`}function kT(n){var t,s,i,o,c,m,y;return n.outcome===Ae.NO_MATCH_FALLBACK?((t=n.fallback)==null?void 0:t.markdown)??null:n.outcome===Ae.IDENTITY_UNKNOWN?((s=n.fallback)==null?void 0:s.markdown)??null:n.outcome===Ae.NOT_PRIMED?((i=n.notPrimed)==null?void 0:i.markdown)??null:n.outcome===Ae.NO_OPEN_CONTAINER?((o=n.fallback)==null?void 0:o.markdown)??null:n.outcome===Ae.REFUSED?((c=n.refusal)==null?void 0:c.markdown)??n.error??null:n.outcome===Ae.HELD?((y=(m=n.subject)==null?void 0:m.expect)==null?void 0:y.prompt)??null:n.outcome===Ae.SUBJECT_STALE?n.error??null:null}function ys(n){return n.replace(/`([^`]+)`/g,'<code class="px-1 py-0.5 bg-surface-sunken rounded text-xs font-mono">$1</code>').replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent-primary hover:underline" target="_blank" rel="noopener noreferrer">$1</a>')}function TT({content:n,compact:t,inherit:s}){const i=[],o=/^```(\w*)\n([\s\S]*?)^```$/gm;let c=0,m;for(;(m=o.exec(n))!==null;)m.index>c&&i.push({type:"text",text:n.slice(c,m.index)}),i.push({type:"code",lang:m[1],code:m[2].replace(/\n$/,"")}),c=m.index+m[0].length;c<n.length&&i.push({type:"text",text:n.slice(c)});const y=s?{text:"",heading:"",list:"",code:"text-[0.85em]",tone:""}:t?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs",tone:"text-text-secondary"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs",tone:"text-text-secondary"},g=[];for(const u of i){if(u.type==="code"){const d=u.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");g.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${y.code} font-mono text-text-secondary leading-relaxed">${d}</code></pre>`);continue}g.push(...NT(u.text,y))}return h.jsx("div",{className:s?void 0:"prose-sm",dangerouslySetInnerHTML:{__html:g.join(`
|
|
55
|
-
`)}})}function NT(n,t){const s=n.split(`
|
|
56
|
-
`),i=[];let o=!1,c=!1,m=[];for(const y of s){const g=y.trim();if(g.startsWith("|")&&g.endsWith("|")){const u=g.slice(1,-1).split("|").map(d=>d.trim());if(u.every(d=>/^[-:]+$/.test(d)))continue;c||(c=!0,m=[]),m.push(u);continue}if(c){c=!1;const[u,...d]=m;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of u)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ys(b)}</th>`);i.push("</tr></thead><tbody>");for(const b of d){i.push("<tr>");for(const x of b)i.push(`<td class="py-1 px-2 border-b border-border/50">${ys(x)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>"),m=[]}if(!g){o&&(i.push("</ul>"),o=!1);continue}if(g.startsWith("### ")){o&&(i.push("</ul>"),o=!1),i.push(`<h4 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ys(g.slice(4))}</h4>`);continue}if(g.startsWith("## ")){o&&(i.push("</ul>"),o=!1),i.push(`<h3 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ys(g.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(g)){o&&(i.push("</ul>"),o=!1),i.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(g)){o||(i.push('<ul class="space-y-1 my-1">'),o=!0),i.push(`<li class="${t.list} ${t.tone} flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${ys(g.slice(2))}</span></li>`);continue}o&&(i.push("</ul>"),o=!1),i.push(`<p class="${t.text} ${t.tone} my-1">${ys(g)}</p>`)}if(c&&m.length){const[y,...g]=m;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const u of y)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ys(u)}</th>`);i.push("</tr></thead><tbody>");for(const u of g){i.push("<tr>");for(const d of u)i.push(`<td class="py-1 px-2 border-b border-border/50">${ys(d)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>")}return o&&i.push("</ul>"),i}function Pm({result:n,compact:t=!1}){const{response:s}=n,i=t?"text-xs":"text-sm",o=s?kT(s):null,c=s!=null&&s.error&&s.error!==o?s.error:null;return h.jsxs("div",{className:"min-w-0",children:[h.jsx("div",{className:`${i} font-mono text-text-secondary truncate`,children:n.code}),s?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:`${i} font-medium ${AT[s.outcome]}`,children:jT(s)}),c&&h.jsx("div",{className:"text-xs text-text-tertiary mt-0.5",children:c}),o&&h.jsx("div",{className:"text-xs text-text-secondary mt-1.5",children:h.jsx(TT,{content:o,compact:!0})})]}):h.jsx("div",{className:`${i} text-status-error`,children:n.error})]})}function Nv(n){return n.replace(/[\u2010-\u2015\u2212]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u00A0/g," ").replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\x00-\x1F\x7F]/g,"").trim()}function CT(n){const t=new Set;for(const s of n){const i=s.codePointAt(0);(i>127||i<32)&&t.add(`"${i<32?"\\x"+i.toString(16).padStart(2,"0"):s}" U+${i.toString(16).toUpperCase().padStart(4,"0")}`)}return[...t]}function MT({value:n}){const t=E.useRef(null),[s,i]=E.useState(!1);return E.useEffect(()=>{if(!(!t.current||!n))try{ET(t.current,n,{format:"CODE128",width:2,height:88,margin:12,displayValue:!0,fontSize:13,background:"#ffffff",lineColor:"#000000"}),i(!1)}catch{i(!0)}},[n]),n?h.jsxs("div",{children:[h.jsx("span",{className:"block text-xs uppercase tracking-wide text-text-tertiary mb-1",children:"Barcode"}),s?h.jsxs("p",{className:"text-xs text-status-error",children:["This value has characters Code 128 cannot carry:"," ",h.jsx("span",{className:"font-mono",children:CT(n).join(", ")||"unknown"})]}):h.jsx("div",{className:"bg-white rounded p-1 inline-block max-w-full overflow-hidden",children:h.jsx("svg",{ref:t,className:"max-w-full"})})]}):null}function RT({onClose:n}){const{submitCode:t,lastResult:s,busy:i,wedgeConfig:o,updateWedgeConfig:c,diagnostics:m,diagnosticsOn:y,setDiagnosticsOn:g}=Bm(),[u,d]=E.useState(""),[b,x]=E.useState(!1),v=w=>{w.preventDefault();const S=u.trim();S&&(d(""),t(S))};return h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-text-primary",children:[h.jsx(To,{className:"w-4 h-4"}),"Scan"]}),h.jsx("button",{type:"button",onClick:n,className:"text-text-tertiary hover:text-text-primary",title:"Close",children:h.jsx(Wt,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6",children:[h.jsxs("form",{onSubmit:v,className:"space-y-2",children:[h.jsx("label",{className:"block text-xs uppercase tracking-wide text-text-tertiary",children:"Enter a code"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{value:u,onChange:w=>d(Nv(w.target.value)),placeholder:"10:1:SN-12345",className:"flex-1 px-2 py-1.5 text-sm bg-surface-raised border border-surface-border rounded text-text-primary","data-scan-manual-entry":!0}),h.jsx("button",{type:"submit",disabled:i||!u.trim(),className:"px-3 py-1.5 text-sm rounded bg-accent text-text-inverse disabled:opacity-50",children:"Go"})]}),h.jsx("p",{className:"text-xs text-text-tertiary",children:"Scanning with a connected scanner works from any page — this entry exists for testing and for codes you can read but not scan. Typing here also draws the code below; point the scanner at the screen to fire it for real."})]}),h.jsx(MT,{value:u.trim()}),s&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"text-xs uppercase tracking-wide text-text-tertiary",children:"Last scan"}),h.jsx(Pm,{result:s})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("button",{type:"button",onClick:()=>x(w=>!w),className:"text-xs uppercase tracking-wide text-text-tertiary hover:text-text-primary",children:["Capture settings ",b?"▾":"▸"]}),b&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block text-sm text-text-primary",children:[h.jsx("span",{className:"block text-xs text-text-tertiary mb-1",children:"Key gap limit (ms) — a longer pause between keys starts a new capture; raise it for scanners that pace slowly"}),h.jsx("input",{type:"number",min:100,max:2e3,step:50,value:o.maxKeyGapMs,onChange:w=>c({maxKeyGapMs:Number(w.target.value)}),className:"w-24 px-2 py-1 text-sm bg-surface-raised border border-surface-border rounded"})]}),h.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[h.jsx("input",{type:"checkbox",checked:y,onChange:w=>g(w.target.checked)}),h.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),y&&h.jsxs("div",{className:"border border-surface-border rounded",children:[h.jsx("div",{className:"px-2 py-1.5 text-2xs uppercase tracking-wide text-text-tertiary border-b border-surface-border",children:"Keydown trace — scan now, newest last"}),h.jsxs("div",{className:"max-h-64 overflow-y-auto font-mono text-2xs leading-5 px-2 py-1",children:[m.length===0&&h.jsx("div",{className:"text-text-tertiary",children:"Waiting for keys…"}),m.map(w=>h.jsxs("div",{className:"whitespace-nowrap overflow-hidden text-ellipsis",title:`buffer: ${w.buffer}`,children:[h.jsxs("span",{className:"text-text-tertiary",children:[String(w.deltaMs).padStart(4),"ms "]}),h.jsx("span",{className:"text",children:JSON.stringify(w.key)}),w.code&&h.jsxs("span",{className:"text-text-tertiary",children:[" (",w.code,")"]}),h.jsxs("span",{className:"text-text-tertiary",children:[" — ",w.note]})]},w.seq))]}),h.jsxs("div",{className:"px-2 py-1.5 text-2xs text-text-tertiary border-t border-surface-border",children:["Read it like this: a scan should end with an"," ",h.jsx("span",{className:"font-mono",children:'"Enter"'})," row saying"," ",h.jsx("span",{className:"font-mono",children:"capture → …"}),'. An Enter row saying "no code tail" means the buffer split (raise the gap limit, or a key arrived as something other than one character). No Enter row at all means the scanner sends no suffix — program its Enter/CR suffix. Keys named'," ",h.jsx("span",{className:"font-mono",children:'"Unidentified"'})," mean the decode arrives outside the keydown path."]})]})]})]})]})]})}const Cv=/^\{lt:([A-Za-z0-9_]+)\}$/;function sM(n){return`{lt:${n}}`}const Mv="lt:station:link-vars:";function Jd(n){return`${Mv}${n}`}const Xd=new Set;function DT(){for(const n of Xd)n()}let _u,Kc={};function Rv(n){let t=null;try{t=localStorage.getItem(Jd(n))}catch{t=null}if(t===_u)return Kc;_u=t;try{const s=t?JSON.parse(t):{};Kc=s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).filter(([,i])=>typeof i=="string")):{}}catch{Kc={}}return Kc}function LT(n,t,s){const i={...Rv(n)};s===null||s===""?delete i[t]:i[t]=s;try{Object.keys(i).length===0?localStorage.removeItem(Jd(n)):localStorage.setItem(Jd(n),JSON.stringify(i))}catch{}_u=void 0,DT()}function qT(n){Xd.add(n);const t=s=>{(s.key===null||s.key.startsWith(Mv))&&(_u=void 0,n())};try{window.addEventListener("storage",t)}catch{}return()=>{Xd.delete(n);try{window.removeEventListener("storage",t)}catch{}}}const BT={};function PT(n){return E.useSyncExternalStore(qT,()=>n?Rv(n):BT)}function UT(n,t,s){let i;try{i=new URL(n,"http://local")}catch{return n}const o=i.searchParams.get("facets");if(!o)return n;let c;try{const y=JSON.parse(o);if(!y||typeof y!="object"||Array.isArray(y))return n;c=y}catch{return n}let m=!1;for(const[y,g]of Object.entries(c)){if(typeof g!="string")continue;const u=Cv.exec(g);if(!u)continue;const d=t[u[1]]??s[u[1]];typeof d=="string"&&d!==""?c[y]=d:delete c[y],m=!0}return m?(Object.keys(c).length===0?i.searchParams.delete("facets"):i.searchParams.set("facets",JSON.stringify(c)),i.pathname+i.search):n}function iM(n){let t;try{t=new URL(n,"http://local")}catch{return[]}const s=t.searchParams.get("facets");if(!s)return[];try{const i=JSON.parse(s);if(!i||typeof i!="object"||Array.isArray(i))return[];const o=[];for(const c of Object.values(i)){if(typeof c!="string")continue;const m=Cv.exec(c);m&&!o.includes(m[1])&&o.push(m[1])}return o}catch{return[]}}function Um(){const{user:n,isSuperAdmin:t,hasRoleType:s}=Pt(),i=(n==null?void 0:n.userId)??null,o=t||s("admin"),c=E.useMemo(()=>new Set(((n==null?void 0:n.roles)??[]).map(x=>x.role)),[n]),{data:m}=Nu({enabled:o||c.size>0}),y=PT(i),g=E.useMemo(()=>{var w;const x=[],v=new Set;for(const S of(m==null?void 0:m.roles)??[]){if(!o&&!c.has(S.role))continue;const C=(w=S.properties)==null?void 0:w.link_variables;if(Array.isArray(C))for(const q of C){const B=q==null?void 0:q.name;if(typeof B!="string"||B===""||v.has(B))continue;v.add(B);const se=q.label,le=q.default;x.push({name:B,...typeof se=="string"&&se!==""?{label:se}:{},...typeof le=="string"&&le!==""?{default:le}:{},fromRole:S.role})}}return x},[m,c,o]),u=E.useMemo(()=>{const x={};for(const v of g)v.default!==void 0&&(x[v.name]=v.default);return x},[g]),d=E.useCallback(x=>UT(x,y,u),[y,u]),b=E.useCallback((x,v)=>{i&<(i,x,v)},[i]);return{declarations:g,values:y,defaults:u,resolveUrl:d,setValue:b}}function zT({open:n,onClose:t,title:s,children:i,maxWidth:o,closeOnBackdrop:c=!0}){return E.useEffect(()=>{if(!n)return;const m=y=>{y.key==="Escape"&&t()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n,t]),n?Zd.createPortal(h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[h.jsx("div",{className:"absolute inset-0 bg-text-primary/30",onClick:c?t:void 0}),h.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"lt-modal-title",className:`relative bg-surface-raised border border-surface-border rounded-lg shadow-xl w-full ${o??"max-w-md"} mx-4 max-h-[85vh] flex flex-col`,children:[h.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b shrink-0",children:[h.jsx("h2",{id:"lt-modal-title",className:"text-sm font-medium text-text-primary",children:s}),h.jsx("button",{onClick:t,"aria-label":"Close dialog",className:"text-text-tertiary hover:text-text-primary text-lg leading-none",children:"×"})]}),h.jsx("div",{className:"px-6 py-5 overflow-y-auto",children:i})]})]}),document.body):null}function IT({open:n,onClose:t}){const{declarations:s,values:i,setValue:o}=Um();return h.jsxs(zT,{open:n,onClose:t,title:"Link Variables",maxWidth:"max-w-lg",children:[h.jsx("p",{className:"text-2xs text-text-tertiary leading-relaxed mb-4",children:"Values bound on this device. Pinned links and the Pace Board open scoped to the value applied; an unbound variable falls back to the role's default, or applies no filter at all."}),h.jsx("div",{className:"divide-y divide-surface-border",children:s.map((c,m)=>h.jsx($T,{declaration:c,value:i[c.name]??"",autoFocus:m===0,onChange:y=>o(c.name,y),onClear:()=>o(c.name,null),onEnter:t},c.name))}),s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary",children:"Your roles declare no link variables."}),s.length>0&&h.jsx("div",{className:"flex justify-end pt-4",children:h.jsx("button",{onClick:t,className:"px-3 py-1.5 text-xs rounded bg-accent text-text-inverse hover:bg-accent-hover transition-colors",children:"OK"})})]})}function $T({declaration:n,value:t,autoFocus:s,onChange:i,onClear:o,onEnter:c}){const m=E.useId(),{data:y}=Yj(n.name),g=(y==null?void 0:y.values)??[];return h.jsxs("div",{className:"py-3 flex items-center gap-3","data-testid":"link-var-row",children:[h.jsxs("div",{className:"w-40 shrink-0 min-w-0",children:[h.jsx("p",{className:"text-xs font-mono text-text-primary truncate",title:n.name,children:n.name}),h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:`declared by ${n.fromRole}`,children:n.label??n.fromRole})]}),h.jsx("input",{type:"text",list:m,autoFocus:s,value:t,onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"&&c()},placeholder:n.default?`${n.default} (default)`:"no filter","aria-label":`Value for ${n.name}`,className:"input text-xs font-mono flex-1 min-w-0"}),h.jsx("datalist",{id:m,children:g.map(u=>h.jsx("option",{value:u},u))}),h.jsx("button",{onClick:o,disabled:t==="",title:`Clear ${n.name}`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors disabled:opacity-30 disabled:cursor-not-allowed shrink-0",children:"×"})]})}const Lb=["escalationId","workflowId"],HT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Dv="lt:search:mode",FT="lt:search:facet",Dt={FACET:"facet",COMMAND:"command"};function GT(n,t){return{version:n.version,category:t.category,name:t.name,schemeName:n.name,targetFacet:n.target_facet,encoding:n.encoding,delimiter:n.delimiter,targetLength:n.target_length}}function ko(n){return n.encoding==="delimited"?`${n.version}${n.delimiter}${n.category}${n.delimiter}`:`${n.version}${n.category}`}function VT(n,t){if(n.encoding==="delimited")return YT(n,t)?{code:t}:{code:`${ko(n)}${t}`};if(!/^[0-9]+$/.test(t))return{error:`${n.name} takes digits only`};const s=n.targetLength;return s&&t.length!==s&&t.length!==s+1?{error:`${n.name} takes ${s} digits`}:{code:`${ko(n)}${t}`}}function YT(n,t){const s=n.delimiter.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^[1-9][0-9]${s}[0-9]${s}.+$`).test(t)}function KT(n,t){return n==="escalationId"||n==="workflowId"?null:Lk(n,t)}function JT(n){return n.kind===Dt.FACET?n.facet:n.command.name}function XT(n){return n.kind===Dt.COMMAND?n.command.targetFacet:n.facet==="escalationId"?"Escalation id":n.facet==="workflowId"?"Workflow id":n.facet}function QT(n){return n.kind===Dt.FACET?{kind:Dt.FACET,facet:n.facet}:{kind:Dt.COMMAND,version:n.command.version,category:n.command.category}}function WT(n,t,s){if((n==null?void 0:n.kind)===Dt.FACET&&t.includes(n.facet))return{kind:Dt.FACET,facet:n.facet};if((n==null?void 0:n.kind)===Dt.COMMAND){const i=s.find(o=>o.version===n.version&&o.category===n.category);if(i)return{kind:Dt.COMMAND,command:i}}return t.length>0?{kind:Dt.FACET,facet:t[0]}:s.length>0?{kind:Dt.COMMAND,command:s[0]}:null}function ZT(){try{const n=localStorage.getItem(Dv);if(n){const s=JSON.parse(n);if(s.kind===Dt.FACET&&typeof s.facet=="string"||s.kind===Dt.COMMAND&&typeof s.version=="number"&&typeof s.category=="string")return s}const t=localStorage.getItem(FT);return t?{kind:Dt.FACET,facet:t}:null}catch{return null}}function eN(n){try{localStorage.setItem(Dv,JSON.stringify(n))}catch{}}const qb=5*6e4,tN=n=>({rules:n.map(t=>{var s;return((s=t.data)==null?void 0:s.rules)??null}),loading:n.some(t=>t.isLoading)});function nN(n){const t=vv({enabled:n,staleTime:qb}),s=E.useMemo(()=>{var m;return(((m=t.data)==null?void 0:m.schemes)??[]).filter(y=>y.enabled&&y.kind===kk.ACTION).sort((y,g)=>y.version-g.version)},[t.data]),{rules:i,loading:o}=sS({queries:s.map(m=>({queryKey:["scan-schemes",m.version,"actions"],queryFn:()=>fe(`/scan-codes/schemes/${m.version}/actions`),enabled:n,staleTime:qb})),combine:tN});return{commands:E.useMemo(()=>s.flatMap((m,y)=>(i[y]??[]).filter(g=>g.enabled).sort((g,u)=>g.category.localeCompare(u.category)).map(g=>GT(m,g))),[s,i]),loading:t.isLoading||o}}const rN={escalationId:"opens the item",workflowId:"opens the run"};function sN({mode:n,facets:t,commands:s,onSelect:i,onOpenScanPanel:o}){const[c,m]=E.useState(!1),y=E.useRef(null);E.useEffect(()=>{if(!c)return;const x=w=>{y.current&&!y.current.contains(w.target)&&m(!1)},v=w=>{w.key==="Escape"&&m(!1)};return document.addEventListener("mousedown",x),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",v)}},[c]);const g=n.kind===Dt.COMMAND,u=g?`${n.command.schemeName} · ${n.command.name} — ${ko(n.command)}<${n.command.targetFacet}>`:`Search by ${n.facet}`,d=iN(s),b=x=>{i(x),m(!1)};return h.jsxs("div",{ref:y,className:"relative h-full shrink-0",children:[h.jsxs("button",{type:"button",onClick:()=>m(x=>!x),"aria-expanded":c,"aria-haspopup":"listbox","aria-label":"Search or run as",title:u,className:"group flex items-center gap-1 h-full pl-2.5 pr-2 border-l border-surface-field-border hover:bg-surface-hover transition-colors rounded-r-[var(--lt-radius-field)]","data-testid":"search-mode",children:[h.jsx("span",{className:`text-2xs whitespace-nowrap truncate max-w-[9rem] ${g?"font-medium text-accent":"font-mono text-text-tertiary"}`,children:JT(n)}),h.jsx(em,{className:`w-3 h-3 shrink-0 text-text-quaternary group-hover:text-accent transition-transform ${c?"rotate-180":""}`,strokeWidth:1.5})]}),c&&h.jsxs("div",{role:"listbox","aria-label":"Search or run as",className:"absolute z-50 top-full right-0 mt-1.5 min-w-[17rem] max-w-[24rem] max-h-[70vh] overflow-y-auto bg-surface-raised border border-surface-border rounded-md shadow-lg py-1",children:[t.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(Bb,{children:"Find"}),t.map(x=>h.jsx(Pb,{label:x,mono:!0,note:rN[x]??"filters the list",active:!g&&n.facet===x,onClick:()=>b({kind:Dt.FACET,facet:x})},x))]}),d.map(({schemeName:x,targetFacet:v,items:w})=>h.jsxs("div",{children:[h.jsxs(Bb,{note:v,children:["Run · ",x]}),w.map(S=>h.jsx(Pb,{label:S.name,note:ko(S),noteMono:!0,active:g&&n.command.version===S.version&&n.command.category===S.category,onClick:()=>b({kind:Dt.COMMAND,command:S})},`${S.version}:${S.category}`))]},x)),o&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{className:"border-surface-border/60 my-1"}),h.jsxs("button",{type:"button",onClick:()=>{m(!1),o()},className:"w-full text-left px-3 py-1.5 flex items-center gap-2 text-xs text-accent hover:bg-surface-hover","data-testid":"search-mode-scan-panel",children:[h.jsx(To,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Scanner settings and barcode preview"]})]})]})]})}function iN(n){const t=[];for(const s of n){const i=t.find(o=>o.schemeName===s.schemeName);i?i.items.push(s):t.push({schemeName:s.schemeName,targetFacet:s.targetFacet,items:[s]})}return t}function Bb({children:n,note:t}){return h.jsxs("p",{className:"px-3 pt-2 pb-1 flex items-baseline gap-2 text-2xs font-semibold uppercase tracking-widest text-text-quaternary first:pt-1",children:[h.jsx("span",{className:"truncate",children:n}),t&&h.jsx("span",{className:"ml-auto font-mono font-normal normal-case tracking-normal shrink-0",children:t})]})}function Pb({label:n,note:t,active:s,mono:i,noteMono:o,onClick:c}){return h.jsxs("button",{type:"button",role:"option","aria-selected":s,onClick:c,className:`w-full text-left pl-3 pr-3 py-1.5 flex items-baseline gap-3 border-l-2 transition-colors ${s?"border-accent bg-accent/10 text-accent":"border-transparent text-text-primary hover:bg-surface-hover"}`,children:[h.jsx("span",{className:`text-xs font-medium truncate ${i?"font-mono":""}`,children:n}),h.jsx("span",{className:`ml-auto text-2xs shrink-0 ${o?"font-mono tabular-nums":""} ${s?"text-accent/70":"text-text-quaternary"}`,children:t})]})}const aN=6e3;function oN({onOpenScanPanel:n}){const t=ra(),{data:s}=Zn(),i=Lm(),{submitCode:o,busy:c,lastResult:m}=Bm(),{commands:y}=nN(i),[g,u]=E.useState(""),[d,b]=E.useState(!1),[x,v]=E.useState(null),[w,S]=E.useState(null),[C,q]=E.useState(""),[B,se]=E.useState(null),[le,R]=E.useState(ZT),H=E.useRef(null),ae=E.useMemo(()=>{var ce;if(!((ce=s==null?void 0:s.search)!=null&&ce.enabled))return[];const W=(s.search.facets??[]).filter(xe=>!Lb.includes(xe));return[...Lb,...W]},[s]),$=E.useMemo(()=>WT(le,ae,y),[le,ae,y]),I=(m==null?void 0:m.source)===jo.TOOLBAR&&!m.navigated&&B!==m.at?m:null;E.useEffect(()=>{if(!I)return;const W=setTimeout(()=>se(I.at),aN);return()=>clearTimeout(W)},[I]);const D=()=>{v(null),S(null),m&&se(m.at)},Q=W=>{var xe;const ce=QT(W);R(ce),eN(ce),D(),(xe=H.current)==null||xe.focus()},X=(W,ce)=>{const xe=VT(W.command,Nv(ce));if("error"in xe){v(xe.error);return}u(""),o(xe.code,jo.TOOLBAR)},he=async(W,ce)=>{const xe=KT(W,ce);if(xe){u(""),t(xe);return}if(W==="escalationId"&&!HT.test(ce)){v("That is not a valid escalation id");return}b(!0);try{if(W==="escalationId")await fe(`/escalations/${encodeURIComponent(ce)}`),u(""),t(`/escalations/detail/${encodeURIComponent(ce)}`);else{const ve=await fe(`/escalations/by-workflow/${encodeURIComponent(ce)}`),Ce=(ve==null?void 0:ve.escalations)??[];Ce.length===1?(u(""),t(`/escalations/detail/${Ce[0].id}`)):(q(ce),S(Ce))}}catch{v(`No ${W==="escalationId"?"escalation":"workflow"} found for "${ce}"`)}finally{b(!1)}},Se=()=>{const W=g.trim();!W||d||c||!$||(D(),$.kind===Dt.COMMAND?X($,W):he($.facet,W))};if(!$)return null;const ke=$.kind===Dt.COMMAND,F=d||c;return h.jsxs("div",{className:"relative w-full max-w-[28rem]","data-testid":"global-search",children:[h.jsxs("div",{className:"flex items-center h-8 bg-surface-field border border-surface-field-border rounded-[var(--lt-radius-field)] focus-within:border-accent focus-within:bg-surface-field-focus transition-colors",children:[h.jsxs("label",{htmlFor:"global-search-input",className:"flex items-center gap-1.5 pl-2.5 shrink-0 cursor-text",children:[ke?h.jsx(To,{className:"w-3.5 h-3.5 text-accent/65",strokeWidth:1.5}):h.jsx(dS,{className:"w-3.5 h-3.5 text-text-quaternary",strokeWidth:1.5}),ke&&h.jsx("span",{className:"font-mono text-xs tabular-nums text-text-tertiary select-none","data-testid":"search-command-prefix",children:ko($.command)})]}),h.jsx("input",{ref:H,id:"global-search-input",type:"text",value:g,onChange:W=>{u(W.target.value),D()},onKeyDown:W=>{W.key==="Enter"&&Se(),W.key==="Escape"&&(u(""),D())},placeholder:XT($),"aria-label":ke?"Run target":"Global search",autoComplete:"off",spellCheck:!1,className:`flex-1 min-w-0 h-full bg-transparent text-xs text-text-primary placeholder:text-text-quaternary focus:outline-none ${ke?"pl-0.5 pr-2 font-mono":"px-2"}`}),F&&h.jsx("span",{className:"w-1.5 h-1.5 mr-2 rounded-full bg-accent animate-pulse shrink-0","aria-label":"Working"}),h.jsx(sN,{mode:$,facets:ae,commands:y,onSelect:Q,onOpenScanPanel:n})]}),x&&h.jsx("p",{className:"absolute top-full left-0 mt-1 text-2xs text-status-error whitespace-nowrap",role:"alert",children:x}),I&&h.jsx("div",{role:"status",className:"absolute top-full left-0 mt-1.5 z-50 w-full max-w-96 bg-surface-raised border border-surface-border rounded-md shadow-lg px-3 py-2 animate-fade-in","data-testid":"search-run-outcome",children:h.jsx(Pm,{result:I,compact:!0})}),w!==null&&h.jsxs("div",{className:"absolute top-full left-0 mt-1.5 z-50 min-w-72 max-w-96 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1","data-testid":"search-workflow-results",children:[w.map(W=>h.jsxs(Mr,{to:`/escalations/detail/${W.id}`,onClick:()=>{S(null),u("")},className:"block px-3 py-1.5 text-xs text-text-secondary hover:bg-surface-hover truncate",children:[h.jsx("span",{className:"font-medium text-text-primary",children:W.role}),h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),W.status,h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),h.jsx("span",{className:"text-text-tertiary",children:W.type})]},W.id)),w.length===0&&h.jsx("p",{className:"px-3 py-1.5 text-2xs text-text-tertiary",children:"No escalations for this workflow."}),h.jsx("hr",{className:"border-surface-border/60 my-0.5"}),h.jsx(Mr,{to:`/workflows/executions/${encodeURIComponent(C)}`,onClick:()=>{S(null),u("")},className:"block px-3 py-1.5 text-xs text-accent hover:bg-surface-hover",children:"Workflow execution →"})]})]})}function lN(n){return n.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Qd(n){var t;return((t=n.title)==null?void 0:t.trim())||lN(n.role)}const Lv="lt:bookmarks",Jc="scan";function cN(){try{const n=localStorage.getItem(Lv);if(!n)return[];const t=JSON.parse(n);return Array.isArray(t)?t:[]}catch{return[]}}function Ub(n){try{localStorage.setItem(Lv,JSON.stringify(n))}catch{}}function uN({onToggleEventFeed:n,onToggleDocs:t,onToggleNav:s}){var Be,We,ln;const i=ra(),{user:o,logout:c,isSuperAdmin:m,hasRoleType:y}=Pt(),{viewAs:g,realIsBuilder:u}=Yx(),{available:d,mine:b}=Wj();Kx();const{connected:x}=Tx(),{data:v}=Zn(),{role:w,targets:S,selectable:C,selectRole:q}=Om(),{declarations:B,values:se}=Um(),[le,R]=E.useState(!1),{data:H}=Nu(),ae=E.useMemo(()=>{const pe=(H==null?void 0:H.roles)??[],Ye=new Set(((o==null?void 0:o.roles)??[]).map(ft=>ft.role)),Ot=m||y("admin");return pe.filter(ft=>Wi(ft).length>0&&(Ot||Ye.has(ft.role))).map(ft=>({role:ft.role,title:Qd(ft),portals:Wi(ft)}))},[H,o,m,y]),{setPanel:$,closePanel:I,open:D,ownerKey:Q}=Tm(),X=Lm(),he=on(),Se=()=>{D&&Q===Jc?I(Jc):$(h.jsx(RT,{onClose:()=>I(Jc)}),{width:360,key:Jc})},[ke,F]=E.useState(!1),[W,ce]=E.useState(!1),[xe,ve]=E.useState(yv),[Ce,Te]=E.useState(cN),Me=E.useRef(null),Ze=(Be=v==null?void 0:v.branding)==null?void 0:Be.appName,yt=(We=v==null?void 0:v.branding)==null?void 0:We.themes,Ct=E.useMemo(()=>(mk(yt??[]),pk()),[yt]),we=pe=>{yk(pe),ve(pe)},Re=()=>{const pe=window.prompt("Bookmark label:");if(!(pe!=null&&pe.trim()))return;const Ye=he.pathname+he.search,Ot=[...Ce,{label:pe.trim(),url:Ye}].sort((ft,Pr)=>ft.label.localeCompare(Pr.label));Te(Ot),Ub(Ot),F(!1)},oe=pe=>{const Ye=Ce.filter(Ot=>!(Ot.label===pe.label&&Ot.url===pe.url));Te(Ye),Ub(Ye)};return E.useEffect(()=>{if(!ke)return;const pe=Ye=>{Me.current&&!Me.current.contains(Ye.target)&&F(!1)};return document.addEventListener("mousedown",pe),()=>document.removeEventListener("mousedown",pe)},[ke]),h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:`h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between pl-2 pr-5 relative ${ke?"z-[100]":"z-30"}`,children:[h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s&&h.jsx("button",{onClick:s,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:h.jsx(mS,{className:"w-5 h-5",strokeWidth:1.5})}),h.jsx(Mr,{to:"/","aria-label":"Home",className:"shrink-0 hidden lg:block",onClick:pe=>{(pe.ctrlKey||pe.metaKey)&&(pe.preventDefault(),ce(!0))},children:h.jsx(Mm,{appName:Ze,className:"flex"})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),h.jsx("button",{onClick:()=>i(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:h.jsx(tx,{className:"w-5 h-5",strokeWidth:2})}),h.jsx("button",{onClick:()=>i(1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go forward",children:h.jsx(dd,{className:"w-5 h-5",strokeWidth:2})})]}),(((ln=v==null?void 0:v.search)==null?void 0:ln.enabled)||X)&&h.jsx("div",{className:"hidden md:flex flex-1 min-w-0 justify-center px-4 lg:px-8",children:h.jsx(oN,{onOpenScanPanel:X?Se:void 0})}),h.jsxs("div",{className:"flex items-center gap-5 shrink-0",children:[h.jsxs(Mr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-xs transition-colors ${d>0?"text-status-queued":"text-text-quaternary hover:text-text-secondary"}`,title:"All escalations",children:[h.jsx(md,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"all"}),d>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:d})]}),h.jsxs(Mr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${b>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[h.jsx(md,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"mine"}),b>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:b})]}),g&&h.jsx(h.Fragment,{children:h.jsxs("span",{className:"hidden lg:flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-2xs text-accent select-none",children:[h.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[g," View"]}),h.jsx("button",{onClick:Id,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(Wt,{className:"w-2.5 h-2.5"})})]})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),o&&h.jsxs("div",{className:"relative",ref:Me,children:[h.jsxs("button",{onClick:()=>F(pe=>!pe),className:"btn-ghost flex items-center gap-1",children:[h.jsxs("span",{className:"relative",children:[h.jsx(pS,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),g&&h.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),h.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:o.displayName||o.username||o.userId}),h.jsx("svg",{className:"hidden lg:block w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),ke&&h.jsxs("div",{className:"absolute right-0 top-full mt-1 w-52 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-[100]",children:[h.jsx(Mr,{to:"/credentials",onClick:()=>F(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),X&&h.jsx("button",{onClick:()=>{F(!1),Se()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-scan",children:"Scan a code"}),h.jsx("button",{onClick:()=>{F(!1),x?n==null||n():window.location.reload()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:x?"Events":"Reconnect events"}),u&&h.jsx("button",{onClick:()=>{F(!1),t==null||t()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-docs",children:"Docs"}),g&&h.jsxs("button",{onClick:()=>{F(!1),Id()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",g," view"]}),h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),h.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:Ct.map(pe=>h.jsx("button",{type:"button",onClick:()=>we(pe.id),title:pe.label,"aria-label":`${pe.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${xe===pe.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:pe.swatch}},pe.id))})]}),C&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Station queue"}),h.jsxs("div",{className:"flex flex-col",children:[h.jsxs("button",{type:"button",onClick:()=>{F(!1),q(null),i("/")},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${w?"text-text-secondary":"text-accent"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${w?"bg-surface-border":"bg-accent"}`}),h.jsx("span",{className:"truncate",children:"Full dashboard"})]}),S.map(pe=>{var ft;const Ye=(ft=H==null?void 0:H.roles)==null?void 0:ft.find(Pr=>Pr.role===pe),Ot=pe===w;return h.jsxs("button",{type:"button",onClick:()=>{F(!1),q(pe),i(iv(pe,Wi(Ye)))},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${Ot?"text-accent":"text-text-secondary"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Ot?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:Qd({role:pe,title:Ye==null?void 0:Ye.title})})]},pe)})]})]}),ae.length>0&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60","data-testid":"menu-portals",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Portals"}),h.jsx("div",{className:"flex flex-col gap-1.5",children:ae.map(pe=>h.jsxs("div",{children:[ae.length>1&&h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:pe.role,children:pe.title}),pe.portals.map(Ye=>{const Ot=Em(pe.role,Ye.key),ft=he.pathname===Ot;return h.jsxs("button",{type:"button",onClick:()=>{F(!1),i(Ot)},className:`flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded hover:bg-surface-hover ${ft?"text-accent":"text-text-secondary"}`,"data-testid":`menu-portal-${pe.role}-${Ye.key}`,children:[h.jsx(pd,{className:"w-3.5 h-3.5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate",children:Ye.label})]},Ye.key)})]},pe.role))})]}),B.length>0&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Link variables"}),h.jsxs("button",{type:"button",onClick:()=>{F(!1),R(!0)},className:"flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded text-text-secondary hover:bg-surface-hover","data-testid":"link-vars-menu-entry",children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Object.keys(se).length>0?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:Object.keys(se).length>0?Object.entries(se).map(([pe,Ye])=>`${pe} = ${Ye}`).join(", "):"Set values for this device"})]})]}),h.jsx("button",{onClick:()=>{F(!1),c()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),h.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[Ce.map(pe=>h.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[h.jsx(Mr,{to:pe.url,onClick:()=>F(!1),title:pe.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:pe.label}),h.jsx("button",{type:"button",onClick:()=>oe(pe),title:`Remove "${pe.label}"`,className:"opacity-0 group-hover:opacity-100 transition-opacity ml-1 p-0.5 shrink-0 text-text-quaternary hover:text-status-error",children:h.jsx(Wt,{className:"w-3 h-3"})})]},`${pe.label}::${pe.url}`)),h.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),h.jsxs("button",{type:"button",onClick:Re,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[h.jsx(yS,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),W&&h.jsx(dk,{onClose:()=>ce(!1)}),h.jsx(IT,{open:le,onClose:()=>R(!1)})]})}function zm({open:n,children:t}){const[s,i]=E.useState(n);return E.useEffect(()=>{n&&i(!0)},[n]),h.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${n?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{n||i(!1)},children:h.jsx("div",{className:"overflow-hidden",children:s?t:null})})}function Wd(n){return({isActive:t})=>{const s="flex items-center rounded-md transition-colors duration-150",i="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return n?`${s} justify-center w-10 h-10 mx-auto ${t?i:o}`:`${s} gap-3 px-4 py-2 text-sm ${t?i:o}`}}function fN(){return({isActive:n})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${n?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function hN({group:n,collapsed:t}){const{pathname:s}=on(),i=n.matchPaths.some(y=>s.startsWith(y)),[o,c]=E.useState(i),m=o||i;return t?h.jsx(h.Fragment,{children:n.items.map(y=>h.jsx(Ss,{to:y.to,className:Wd(!0),title:y.label,children:y.icon&&h.jsx(y.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},y.to))}):h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>c(y=>!y),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[h.jsxs("span",{className:"flex items-center gap-3",children:[n.icon&&h.jsx(n.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:n.label})]}),h.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${m?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),h.jsx(zm,{open:m,children:n.items.map(y=>h.jsxs(Ss,{to:y.to,end:y.end,className:fN(),children:[y.icon&&h.jsx(y.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:y.label})]},y.to))})]})}function dN(n){return n.kind==="group"}function mN({entry:n,collapsed:t}){const{pathname:s,search:i}=on(),o=n.to.includes("?"),c=n.icon&&h.jsx(n.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${n.iconClassName??""}`,strokeWidth:1.5,...n.solid?{fill:"currentColor"}:{}});if(o){const[m,y]=n.to.split("?"),g=s===m&&i===`?${y}`,u=Wd(t)({isActive:g});return h.jsxs(Ss,{to:n.to,className:u,title:t?n.label:void 0,children:[c,!t&&h.jsx("span",{children:n.label})]})}return h.jsxs(Ss,{to:n.to,end:n.end,className:Wd(t),title:t?n.label:void 0,children:[c,!t&&h.jsx("span",{children:n.label})]})}function Lr({heading:n,entries:t}){const{collapsed:s}=jm();return h.jsxs("div",{className:"space-y-1",children:[s?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:n}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:n}),t.map(i=>dN(i)?h.jsx(hN,{group:i,collapsed:s},i.label):h.jsx(mN,{entry:i,collapsed:s},i.to))]})}function pN({aiEnabled:n=!1,isBuilder:t=!1,isOps:s=!1,viewAs:i=null,canSeePaceBoard:o=!1}){const c=[{to:"/pace",label:"Pace Board",icon:gS},{to:"/trends",label:"Trend Board",icon:bS}];if(!t&&(!s||i==="engineer"||i==="operator"))return o?h.jsx(Lr,{heading:"Monitor",entries:c}):null;if(!t)return h.jsx(Lr,{heading:"Monitor",entries:o?c:[]});const m=[...o?c:[],{to:"/topics",label:"Event Topics",icon:nx},{to:"/agents",label:n?"Agents":"Automations",icon:xS},{to:"/capabilities",label:"Capabilities",icon:vS}];return h.jsx(Lr,{heading:"Monitor",entries:m})}function yN(){return $e({queryKey:["me","preferences"],queryFn:()=>fe("/me/preferences"),staleTime:6e4})}function gN(){const n=He();return Ve({mutationFn:t=>fe("/me/preferences",{method:"PATCH",body:JSON.stringify(t)}),onSuccess:t=>{n.setQueryData(["me","preferences"],t)}})}const bs={TABLE:"table",RICH:"rich",TIMELINE:"timeline"},zb={COMPACT:"compact",CARDS:"cards"},ud={AVAILABLE:"/escalations/available",ALL:"/escalations"},Zi={AVAILABLE:"available",CLAIMED:"claimed",RESOLVED:"resolved",CANCELLED:"cancelled",EXPIRED:"expired"},bN={[Zi.RESOLVED]:"resolved",[Zi.CANCELLED]:"cancelled",[Zi.EXPIRED]:"expired"};function xN(n){const t=n===Zi.CLAIMED;return{available:n===Zi.AVAILABLE,claimed:t,apiStatus:t?"pending":bN[n]}}function vN(n){return n===bs.TABLE||n===bs.RICH||n===bs.TIMELINE}function _N(n){return n===zb.COMPACT||n===zb.CARDS}function wN(n,t=""){const s=n.get("priority"),i=n.get("view"),o=n.get("layout");return{statusFilter:n.get("status")||t,role:n.get("role")||void 0,type:n.get("type")||void 0,subtype:n.get("subtype")||void 0,priority:s?parseInt(s,10):void 0,search:n.get("search")||void 0,facets:Dk(n),view:vN(i)?i:null,layout:_N(o)?o:null}}function SN(n){let t;try{t=new URL(n,"http://local")}catch{return null}if(t.pathname!==ud.AVAILABLE&&t.pathname!==ud.ALL)return null;const s=t.pathname===ud.AVAILABLE?Zi.AVAILABLE:"";return wN(t.searchParams,s)}function aM(n){var t;return n.role||(((t=n.facets.roles)==null?void 0:t.length)===1?n.facets.roles[0]:null)}function oM(n,t){return n===bs.TIMELINE?bs.TIMELINE:t&&(!n||n===bs.RICH)?bs.RICH:bs.TABLE}function EN(n,t){const s=(n==null?void 0:n.pinnedViews)??[],i=new Set((n==null?void 0:n.hiddenRolePins)??[]),o=new Set(s.map(y=>y.label)),c=[...s],m=new Set;for(const{role:y,pins:g}of t)for(const u of g)o.has(u.label)||i.has(u.label)||m.has(u.label)||(m.add(u.label),c.push({...u,id:`role:${y}:${u.label}`,fromRole:y}));return c}function ON(n){const t=SN(n);if(!t)return null;const{available:s,claimed:i,apiStatus:o}=xN(t.statusFilter);return{available:s,params:{...t.facets,role:t.role,type:t.type,subtype:t.subtype,priority:t.priority,status:o,...i?{claimed:!0}:{},search:t.search}}}function AN(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function jN(){var I;const{collapsed:n}=jm(),{user:t}=Pt(),s=yN(),i=gN(),o=E.useMemo(()=>new Set(((t==null?void 0:t.roles)??[]).map(D=>D.role)),[t]),{data:c}=Nu({enabled:o.size>0}),m=Zt("SUMMARY");As(_m(),()=>{m([["escalations"]])});const y=(I=s.data)==null?void 0:I.preferences,g=E.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(D=>o.has(D.role)&&Array.isArray(D.default_pins)&&D.default_pins.length>0).map(D=>({role:D.role,pins:D.default_pins})),[c,o]),{resolveUrl:u}=Um(),d=E.useMemo(()=>EN(y,g),[y,g]),b=E.useMemo(()=>new Map(d.map(D=>[D.id,D.url])),[d]),x=E.useMemo(()=>d.map(D=>({...D,url:u(D.url)})),[d,u]),v=E.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(D=>[D.role,Qd(D)])),[c]),w=E.useMemo(()=>x.filter(D=>!D.fromRole),[x]),S=E.useMemo(()=>new Set(((c==null?void 0:c.roles)??[]).filter(D=>o.has(D.role)&&Pj(D)).map(D=>D.role)),[c,o]),C=E.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(D=>S.has(D.role)||g.some(Q=>Q.role===D.role)).map(D=>({role:D.role,title:v.get(D.role)??D.role,portals:S.has(D.role)?Wi(D):[],pins:x.filter(Q=>Q.fromRole===D.role)})).filter(D=>D.portals.length>0||D.pins.length>0),[c,g,S,v,x]),q=(y==null?void 0:y.pinnedViews)??[],B=E.useRef(null),se=D=>i.mutate({pinnedViews:D}),le=D=>se(q.filter(Q=>Q.id!==D)),R=D=>se([...q,{id:AN(),label:D.label,url:b.get(D.id)??D.url,badge:D.badge}]),H=D=>i.mutate({hiddenRolePins:[...(y==null?void 0:y.hiddenRolePins)??[],D]}),ae=(D,Q)=>{if(D===Q)return;const X=[...q],[he]=X.splice(D,1);X.splice(Q,0,he),se(X)};if(x.length===0&&S.size===0)return null;const $="px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary truncate";return h.jsxs("div",{className:"space-y-1",children:[n&&h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}),!n&&w.length>0&&h.jsx("p",{className:$,children:"Pinned"}),w.map(D=>{const Q=q.findIndex(X=>X.id===D.id);return h.jsx(Ib,{pin:D,collapsed:n,draggable:Q!==-1,onDragStart:()=>{B.current=Q},onDropOn:()=>{B.current!==null&&Q!==-1&&ae(B.current,Q),B.current=null},onRemove:()=>le(D.id)},D.id)}),C.map(D=>h.jsxs("div",{children:[!n&&h.jsx("p",{className:$,title:`${D.title} — pins from the ${D.role} role`,"data-testid":"pin-group-label",children:D.title}),D.portals.map(Q=>h.jsx(kN,{role:D.role,portal:Q,collapsed:n},Q.key)),D.pins.map(Q=>h.jsx(Ib,{pin:Q,collapsed:n,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>R(Q),onHide:()=>H(Q.label)},Q.id))]},D.role))]})}function kN({role:n,portal:t,collapsed:s}){const i=Em(n,t.key),o="flex items-center rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",c=`portal-link-${n}-${t.key}`;return s?h.jsx(Ss,{to:i,className:`${o} justify-center w-10 h-10 mx-auto`,title:t.label,"data-testid":c,children:h.jsx(pd,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs(Ss,{to:i,title:t.label,className:({isActive:m})=>`${o} gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] ${m?"bg-surface-hover text-text-primary font-medium":""}`,"data-testid":c,children:[h.jsx(pd,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:t.label})]})}function Ib({pin:n,collapsed:t,draggable:s,onDragStart:i,onDropOn:o,onRemove:c,onPromote:m,onHide:y}){const{pathname:g,search:u}=on(),[d,b=""]=n.url.split("?"),x=g===d&&u===(b?`?${b}`:""),v="group flex items-center rounded-md transition-colors duration-150",w=x?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return t?h.jsx(Ss,{to:n.url,className:`${v} ${w} justify-center w-10 h-10 mx-auto`,title:n.label,children:h.jsx(jg,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs("div",{className:`${v} ${w} relative`,draggable:s,onDragStart:i,onDragOver:S=>S.preventDefault(),onDrop:o,children:[h.jsxs(Ss,{to:n.url,title:n.label,className:"flex items-center gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] flex-1 min-w-0",children:[h.jsx(jg,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5,...n.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:n.label}),n.badge&&h.jsx(TN,{url:n.url})]}),h.jsxs("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5 rounded px-0.5 bg-surface-hover opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity",children:[m&&h.jsx("button",{onClick:m,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:h.jsx(rx,{className:"w-3 h-3"})}),y&&h.jsx("button",{onClick:y,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(_S,{className:"w-3 h-3"})}),c&&h.jsx("button",{onClick:c,title:`Remove "${n.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(Wt,{className:"w-3 h-3"})})]})]})}function TN({url:n}){var m;const t=E.useMemo(()=>ON(n),[n]),s={limit:1,staleTime:15e3},i=cv({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&t.available}),o=lv({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&!t.available});if(!t)return null;const c=t.available?i:o;return c.isError||((m=c.data)==null?void 0:m.total)===void 0?null:h.jsx("span",{className:"shrink-0 text-right text-2xs leading-none tabular-nums text-accent/80 relative -top-[0.35em]",title:`${c.data.total} matching now`,children:c.data.total})}function NN(){var c;const{data:n}=Zn(),t=(c=n==null?void 0:n.features)==null?void 0:c.graphWorkflows,s=t===!0||t!==!1&&Fx(),i=[{to:"/workflows/registry",label:"Registry",icon:kg},{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:yd},{to:"/workflows/executions",label:"Executions",icon:Tg}],o=s?[{kind:"group",label:"Procedural",icon:wS,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:i},{kind:"group",label:"Graph",icon:tm,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:kg,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:yd},{to:"/mcp/executions",label:"Executions",icon:Tg}]}]:i;return h.jsx(Lr,{heading:"Orchestrate",entries:o})}function lM(){return $e({queryKey:["activeWorkers"],queryFn:async()=>(await fe("/workflows/workers")).workers})}function cM(){return $e({queryKey:["discoveredWorkflows"],queryFn:async()=>(await fe("/workflows/discovered")).workflows})}function uM(){return $e({queryKey:["workflowConfigs"],queryFn:async()=>(await fe("/workflows/config")).workflows})}function qv(){return $e({queryKey:["invocableWorkflows"],queryFn:async()=>(await fe("/workflows/invocable")).workflows})}function fM(n){return Object.fromEntries(n.filter(t=>!t.missing).map(t=>[t.as??t.key,t.data]))}function hM(n,t){return $e({queryKey:["workflows",n,"input-lookups"],queryFn:()=>fe(`/workflows/${encodeURIComponent(n)}/input-lookups`),enabled:!!n&&t,staleTime:0,refetchOnWindowFocus:!1})}function dM(){return $e({queryKey:["cronStatus"],queryFn:async()=>(await fe("/workflows/cron/status")).schedules})}function mM(n){return $e({queryKey:["workflowExecution",n],queryFn:()=>fe(`/workflow-states/${n}/execution`),enabled:!!n})}function pM(n,t){const s=new URLSearchParams;return n.limit&&s.set("limit",String(n.limit)),n.offset!==void 0&&s.set("offset",String(n.offset)),n.entity&&s.set("entity",n.entity),n.search&&s.set("search",n.search),n.status&&s.set("status",n.status),n.sort_by&&s.set("sort_by",n.sort_by),n.order&&s.set("order",n.order),n.registered&&s.set("registered",n.registered),n.namespace&&s.set("namespace",n.namespace),$e({queryKey:["jobs",n],queryFn:()=>fe(`/workflow-states/jobs?${s}`),enabled:(t==null?void 0:t.enabled)??!0})}function yM(){const n=He();return Ve({mutationFn:t=>fe(`/workflows/${t}/terminate`,{method:"POST"}),onSuccess:(t,s)=>{n.invalidateQueries({queryKey:["workflowExecution",s],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function gM(){const n=He();return Ve({mutationFn:({workflow_type:t,...s})=>fe(`/workflows/${encodeURIComponent(t)}/config`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function bM(){const n=He();return Ve({mutationFn:t=>fe(`/workflows/${encodeURIComponent(t)}/config`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function xM(){const n=He();return Ve({mutationFn:({workflowType:t,data:s,metadata:i,execute_as:o})=>fe(`/workflows/${t}/invoke`,{method:"POST",body:JSON.stringify({data:s,metadata:i,...o?{execute_as:o}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function CN(){const{data:n}=qv();return n!=null&&n.length?h.jsx(Lr,{heading:"Tools",entries:[{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:yd}]}):null}const MN=[{to:"/mcp/queries",label:"Designer",icon:SS},{to:"/mcp/servers",label:"Servers & Tools",icon:ES}];function RN(){return h.jsx(Lr,{heading:"Design",entries:MN})}const DN=[{to:"/files",label:"Files",icon:OS},{to:"/knowledge",label:"Knowledge Base",icon:sx}];function LN(){return h.jsx(Lr,{heading:"Storage",entries:DN})}function qN({isBuilder:n=!1,isOps:t=!1}){var m;const{data:s}=Zn(),i=((m=s==null?void 0:s.features)==null?void 0:m.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:AS},...n||t?[{to:"/admin/roles",label:"Roles",icon:md},{to:"/admin/personas",label:"Personas",icon:jS},{to:"/admin/scan-codes",label:"Scan Codes",icon:To}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:kS},{to:"/admin/streams",label:"Messages",icon:sx},...i?[{to:"/admin/maintenance",label:"DB Maintenance",icon:TS}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(Lr,{heading:"Identity & Access",entries:o}),n&&Gx()&&h.jsx(Lr,{heading:"Infrastructure",entries:c})]})}function Bv({aiEnabled:n,isBuilder:t,isOps:s,viewAs:i,canSeePaceBoard:o}){return h.jsxs(h.Fragment,{children:[h.jsx(pN,{aiEnabled:n,isBuilder:t,isOps:s,viewAs:i,canSeePaceBoard:o}),h.jsx(jN,{}),!t&&h.jsx(CN,{}),t&&h.jsx(NN,{}),t&&n&&h.jsx(RN,{}),t&&h.jsx(LN,{}),(t||s)&&h.jsx(qN,{isBuilder:t,isOps:s})]})}function BN({open:n,onClose:t,...s}){const i=on();return E.useEffect(()=>{t()},[i.pathname]),h.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${n?"":"pointer-events-none"}`,children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${n?"opacity-100":"opacity-0"}`,onClick:t,"aria-hidden":!0}),h.jsxs("div",{className:`relative w-72 max-w-[85vw] h-full bg-surface-raised border-r border-surface-border shadow-xl flex flex-col transition-transform duration-200 ease-out ${n?"translate-x-0":"-translate-x-full"}`,children:[h.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:h.jsx("button",{onClick:t,className:"p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors","aria-label":"Close navigation",children:h.jsx(Wt,{className:"w-4 h-4"})})}),h.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(Fj,{children:h.jsx(Bv,{...s})})})]})]})}const Pv="lt_event_feed_patterns";function PN(n,t){if(n.startsWith("/topics/")){const m=decodeURIComponent(n.replace("/topics/",""));if(m&&!m.includes("/"))return`lt.events.${m}`}const s=n.match(/^\/escalations\/detail\/(.+)/);if(s)return`lt.events.system.escalation.*.${s[1]}.>`;if(n.startsWith("/escalations")){const m=new URLSearchParams(t).get("role");return m?`lt.events.system.escalation.${Qx(m)}.>`:"lt.events.system.escalation.>"}const i=n.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(i)return`lt.events.system.workflow.${i[1]}.>`;if(n.startsWith("/workflows"))return"lt.events.system.workflow.>";const o=n.match(/^\/agents\/([^/]+)$/);if(o&&o[1]!=="new")return`lt.events.system.agent.${o[1]}.>`;if(n.startsWith("/agents"))return"lt.events.system.agent.>";if(n.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(n.startsWith("/files"))return"lt.events.system.file.>";if(n==="/")return"lt.events.system.>";const c=n.match(/^\/mcp\/executions\/(.+)/);return c?`lt.events.system.*.${c[1]}.>`:(n.startsWith("/mcp"),"lt.events.system.>")}function UN(){try{const n=localStorage.getItem(Pv);return n?JSON.parse(n):[]}catch{return[]}}function fd(n){try{localStorage.setItem(Pv,JSON.stringify(n))}catch{}}function zN(){const{pathname:n,search:t}=on(),[s,i]=E.useState(UN),o=E.useMemo(()=>PN(n,t),[n,t]),c=E.useMemo(()=>{const u=new Set([o,...s]);return Array.from(u)},[o,s]),m=E.useCallback(u=>{const d=u.startsWith("lt.events.")?u:`lt.events.${u}`;i(b=>{if(b.includes(d))return b;const x=[...b,d];return fd(x),x})},[]),y=E.useCallback(u=>{i(d=>{const b=d.filter(x=>x!==u);return fd(b),b})},[]),g=E.useCallback(()=>{i([]),fd([])},[]);return{patterns:c,pagePattern:o,userPatterns:s,addPattern:m,removePattern:y,clearUserPatterns:g}}function IN({children:n,className:t=""}){return h.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${t}`,children:n})}const hd=280,$b="cubic-bezier(0.4, 0, 0.2, 1)",Xc=40;function $N(n){if(!n)return"scale(0.92)";const t=window.innerWidth,s=window.innerHeight,i=t-Xc*2,o=s-Xc*2,c=n.width/i,m=n.height/o,y=n.left+n.width/2-(Xc+i/2),g=n.top+n.height/2-(Xc+o/2);return`translate(${y}px, ${g}px) scale(${c}, ${m})`}function Uv({open:n,onClose:t,sourceRef:s,children:i}){const[o,c]=E.useState(null),m=E.useRef(null),y=E.useRef(!1);E.useEffect(()=>{var x,v;n&&!y.current?(m.current=((x=s==null?void 0:s.current)==null?void 0:x.getBoundingClientRect())??null,c("entering")):!n&&y.current&&o==="open"&&(m.current=((v=s==null?void 0:s.current)==null?void 0:v.getBoundingClientRect())??null,c("exiting")),y.current=n},[n,s,o]),E.useEffect(()=>{if(o!=="entering")return;const x=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(x)},[o]),E.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),E.useEffect(()=>{if(!o)return;const x=v=>{v.key==="Escape"&&t()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[o,t]);const g=E.useCallback(x=>{x.propertyName==="transform"&&o==="exiting"&&c(null)},[o]);if(E.useEffect(()=>{if(o!=="exiting")return;const x=setTimeout(()=>c(null),hd+50);return()=>clearTimeout(x)},[o]),!o)return null;const u=o==="entering"||o==="exiting",d=u?$N(m.current):"none",b=u?0:1;return Zd.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${hd}ms ${$b}, opacity ${hd}ms ${$b}`,transform:d,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:i}),document.body)}function HN({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function FN({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function GN({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}function VN({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function YN({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})})}function KN({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function JN(n){const t=n.trim().split(`
|
|
57
|
-
`);if(t.length<2)return n;const s=y=>y.split("|").map(g=>g.trim()).filter(Boolean),i=s(t[0]),o=t.slice(2),c=i.map(y=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${y}</th>`).join(""),m=o.map(y=>`<tr class="border-t border-surface-border">${s(y).map(d=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${d}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${c}</tr></thead><tbody>${m}</tbody></table>`}function Qc(n){return n.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function XN(n){const t=[];let s=n.replace(/```(\w*)\n([\s\S]*?)```/g,(g,u,d)=>{const b=t.length;return t.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-2xs leading-relaxed"><code>${d}</code></pre>`),`\0CODE${b}\0`});const i=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(i,(g,u,d,b)=>JN(`${u}
|
|
58
|
-
${d}
|
|
59
|
-
${b.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-2xs">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,u)=>`<h4 id="${Qc(u)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${u}</h4>`).replace(/^### (.+)$/gm,(g,u)=>`<h3 id="${Qc(u)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${u}</h3>`).replace(/^## (.+)$/gm,(g,u)=>`<h2 id="${Qc(u)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${u}</h2>`).replace(/^# (.+)$/gm,(g,u)=>`<h1 id="${Qc(u)}" class="text-lg font-bold text-text-primary mb-3">${u}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const u=g.replace(/^> /gm,"").trim(),d=/⚠️|warning|caution/i.test(u),b=/note:|ℹ️|info/i.test(u);return`<div class="${d?"bg-status-warning/5":b?"bg-accent/5":"bg-surface-sunken/50"} ${d?"border-status-warning":b?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${u}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(c('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,u)=>t[parseInt(u,10)]);const m="text-xs leading-relaxed text-text-secondary mb-2",y=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const u=g.trim();if(!u)return"";const d=[];let b=u,x;for(;(x=y.exec(b))!==null;){const v=x.index+x[0].length;d.push(b.slice(0,v)),b=b.slice(v).replace(/^<br\/>/,"").trim(),y.lastIndex=0}return b&&d.push(b),d.map(v=>{const w=v.trim();return w?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(w)?w:`<p class="${m}">${w}</p>`:""}).join("")}).join(""),s}const QN=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function WN(n){return QN.test(n)}function Du({content:n,className:t,onClick:s}){const i=E.useMemo(()=>XN(n),[n]);return h.jsx("div",{className:t,onClick:s,dangerouslySetInnerHTML:{__html:i}})}function wu({data:n,depth:t=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:t>0,[c,m]=E.useState(o),[y,g]=E.useState(s);if(s!==void 0&&s!==y&&(g(s),m(s%2===0&&t>0)),n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return h.jsxs("span",{className:"text-text-primary",children:['"',n,'"']});if(typeof n=="number"||typeof n=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(n)});if(Array.isArray(n))return n.length===0?h.jsx("span",{className:"text-text-tertiary",children:"[]"}):c?h.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["[",n.length," items]"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:n.map((u,d)=>h.jsxs("div",{children:[h.jsx(wu,{data:u,depth:t+1,generation:s}),d<n.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),h.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof n=="object"){const u=Object.entries(n);return u.length===0?h.jsx("span",{className:"text-text-tertiary",children:"{}"}):c?h.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:u.map(([d,b],x)=>h.jsxs("div",{children:[h.jsx("span",{className:"text-text-secondary",children:d}),h.jsx("span",{className:"text-text-tertiary",children:": "}),h.jsx(wu,{data:b,depth:t+1,generation:s}),x<u.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),h.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return h.jsx("span",{children:String(n)})}function _o({data:n,depth:t=0}){if(n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return n.length>40&&WN(n)?h.jsx(Du,{content:n}):h.jsx("span",{className:"text-text-primary",children:n});if(typeof n=="number"||typeof n=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(n)});if(Array.isArray(n))return n.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):h.jsx("div",{className:"space-y-2",children:n.map((s,i)=>h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsxs("span",{className:"text-text-tertiary text-2xs shrink-0",children:[i+1,"."]}),h.jsx("div",{className:"flex-1",children:h.jsx(_o,{data:s,depth:t+1})})]},i))});if(typeof n=="object"){const s=Object.entries(n);return s.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):h.jsx("div",{className:t>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([i,o])=>{const c=o===null||typeof o!="object";return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:i.replace(/[_-]/g," ")}),c?h.jsx("p",{className:"text-sm text-text-primary",children:h.jsx(_o,{data:o,depth:t+1})}):h.jsx(_o,{data:o,depth:t+1})]},i)})})}return h.jsx("span",{children:String(n)})}function Hb({mode:n,setMode:t,isCollapsed:s,onToggleCollapse:i,onCopy:o,copied:c,onFullscreen:m,onClose:y,large:g}){const u=g?"w-5 h-5":"w-3.5 h-3.5",d=`${g?"p-2":"p-1.5"} rounded text-accent/60 hover:text-accent hover:bg-surface-raised transition-colors duration-150`;return h.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[n==="json"&&h.jsx("button",{onClick:i,className:d,title:s?"Expand all":"Collapse all",children:s?h.jsx(KN,{className:u}):h.jsx(YN,{className:u})}),h.jsx("button",{onClick:()=>t(n==="json"?"tree":"json"),className:d,title:n==="json"?"Outline view":"JSON view",children:n==="json"?h.jsx(HN,{className:u}):h.jsx(FN,{className:u})}),h.jsx("button",{onClick:o,className:d,title:"Copy to clipboard",children:c?h.jsx(VN,{className:`${u} text-status-success`}):h.jsx(GN,{className:u})}),m&&h.jsx("button",{onClick:m,className:d,title:"Fullscreen",children:h.jsx(ix,{className:u})}),y&&h.jsx("button",{onClick:y,className:d,title:"Close (Esc)",children:h.jsx(ax,{className:u})})]})}function ZN({data:n,label:t,variant:s,defaultCollapsed:i=!1,defaultMode:o}){const c=E.useRef(null),[m,y]=E.useState(o??"json"),[g,u]=E.useState(!1),[d,b]=E.useState(!1),[x,v]=E.useState(i?0:1),[w,S]=E.useState(1),C=x%2===0,q=w%2===0,B=E.useCallback(()=>v(D=>D+1),[]),se=E.useCallback(()=>S(D=>D+1),[]);let le=n;if(typeof n=="string")try{le=JSON.parse(n)}catch{}const R=async()=>{const D=typeof n=="string"?n:JSON.stringify(le,null,2);await navigator.clipboard.writeText(D),u(!0),setTimeout(()=>u(!1),2e3)},H=E.useCallback(()=>{S(1),b(!0)},[]),ae=s==="panel",$=ae?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",I=ae?"font-mono text-xs leading-relaxed bg-surface-raised rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken border border-surface-border rounded-md p-4 overflow-x-auto break-all";return h.jsxs("div",{className:$,children:[t&&h.jsx(IN,{children:t}),h.jsxs("div",{ref:c,className:"relative",children:[h.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:h.jsx(Hb,{mode:m,setMode:y,isCollapsed:C,onToggleCollapse:B,onCopy:R,copied:g,onFullscreen:H})}),h.jsx("div",{className:I,children:m==="json"?h.jsx(wu,{data:le,generation:x}):h.jsx(_o,{data:le})})]}),h.jsxs(Uv,{open:d,onClose:()=>b(!1),sourceRef:c,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx(Hb,{mode:m,setMode:y,isCollapsed:q,onToggleCollapse:se,onCopy:R,copied:g,onClose:()=>b(!1),large:!0})}),h.jsx("div",{className:"font-mono text-sm leading-relaxed",children:m==="json"?h.jsx(wu,{data:le,generation:w}):h.jsx(_o,{data:le})})]})]})}const eC=100,Fb=500;let tC=0;const zv={"escalation.created":"text-status-active","escalation.claimed":"text-status-warning","escalation.released":"text-text-tertiary","escalation.resolved":"text-status-success","task.created":"text-accent","task.completed":"text-status-success","task.failed":"text-status-error","task.escalated":"text-status-warning","workflow.started":"text-accent","workflow.completed":"text-status-success","workflow.failed":"text-status-error","activity.started":"text-status-active","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-accent","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-status-active",milestone:"text-accent"};function Iv(n){const t=n.split(".");return t[0]==="system"&&t.length>=3?`${t[1]}.${t[t.length-1]}`:n}function Gb({event:n,forceExpanded:t=!1}){var x,v;const[s,i]=E.useState(t),o=zv[Iv(n.type)]||"text-text-tertiary";E.useEffect(()=>{i(t)},[t]);const c=t,m=c?"text-xs":"text-2xs",y=c?"text-xs":"text-2xs",g=c?"text-xs":"text-2xs",u=c?"w-3.5 h-3.5":"w-2.5 h-2.5",d=c?"py-2 px-4":"py-1 px-3",b=c?"pb-4 px-4":"pb-2 px-3";return h.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[h.jsxs("button",{onClick:()=>i(!s),className:`flex items-center gap-2 ${d} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[h.jsx("span",{className:`${m} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(n.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),h.jsx("span",{className:`${y} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:n.type}),h.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(x=n.data)!=null&&x.workflowId?String(n.data.workflowId):"",(v=n.data)!=null&&v.escalationId?` esc:${String(n.data.escalationId).slice(0,12)}`:""]}),h.jsx("svg",{className:`${u} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),h.jsx(zm,{open:s,children:h.jsx("div",{className:b,children:h.jsx(ZN,{data:n.data})})})]})}function nC({open:n,onToggle:t,configOpen:s,onToggleConfig:i}){const[o,c]=E.useState([]),[m,y]=E.useState(!1),[g,u]=E.useState(""),d=E.useRef(null),b=E.useRef(new Map),{subscribe:x}=E.useContext(ia),{connected:v}=Tx(),{patterns:w,pagePattern:S,userPatterns:C,addPattern:q,removePattern:B}=zN(),se=E.useCallback(H=>{const ae=String(H.type||"unknown");if(ae.startsWith("mesh."))return;const $=`${ae}:${H.timestamp||""}:${H.escalationId||H.workflowId||H.taskId||""}`,I=Date.now(),D=b.current.get($);if(!(D&&I-D<Fb)){if(b.current.set($,I),b.current.size>200)for(const[Q,X]of b.current)I-X>Fb*2&&b.current.delete(Q);c(Q=>[{id:++tC,type:ae,timestamp:H.timestamp||new Date().toISOString(),data:H},...Q].slice(0,eC))}},[]),le=E.useRef(se);le.current=se;const R=n||m||s;return E.useEffect(()=>{if(!R)return;const H=w.map(ae=>x(ae,$=>le.current($)));return()=>H.forEach(ae=>ae())},[x,w.join(","),R]),E.useEffect(()=>{n&&d.current&&(d.current.scrollTop=0)},[o.length,n]),h.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[h.jsxs("button",{onClick:t,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[n?h.jsx(em,{className:"w-3 h-3 text-text-tertiary"}):h.jsx(ox,{className:"w-3 h-3 text-text-tertiary"}),h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&h.jsxs("span",{className:"text-2xs text-text-tertiary",children:[o.length," events"]}),o.length>0&&!n&&h.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${zv[Iv(o[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),h.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[h.jsx("span",{className:`p-0.5 ${v?"text-status-success":"text-status-warning hover:text-text-primary cursor-pointer"}`,title:v?"Live events connected":"Events disconnected — click to reconnect",onClick:H=>{H.stopPropagation(),v||window.location.reload()},children:h.jsx(nx,{className:"w-3 h-3"})}),h.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:H=>{H.stopPropagation(),i()},children:h.jsx(NS,{className:"w-3 h-3"})}),o.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:H=>{H.stopPropagation(),y(!0)},children:h.jsx(ix,{className:"w-3 h-3"})}),h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:H=>{H.stopPropagation(),c([])},children:h.jsx(CS,{className:"w-3 h-3"})})]})]})]}),s&&h.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[h.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),h.jsx("span",{className:"text-2xs font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:S.replace("lt.events.","")}),C.map(H=>h.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[H.replace("lt.events.",""),h.jsx("button",{onClick:()=>B(H),className:"text-text-quaternary hover:text-status-error",children:h.jsx(Wt,{className:"w-2 h-2"})})]},H))]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",value:g,onChange:H=>u(H.target.value),onKeyDown:H=>{H.key==="Enter"&&g.trim()&&(q(g.trim()),u(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),h.jsxs("button",{onClick:()=>{g.trim()&&(q(g.trim()),u(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[h.jsx(rx,{className:"w-2.5 h-2.5"})," Add"]})]})]}),h.jsx(zm,{open:n,children:h.jsx("div",{ref:d,className:"h-48 overflow-y-auto",children:o.length===0?h.jsx("p",{className:"text-2xs text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(H=>h.jsx(Gb,{event:H},H.id))})}),h.jsxs(Uv,{open:m,onClose:()=>y(!1),sourceRef:d,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx("button",{onClick:()=>y(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:h.jsx(ax,{className:"w-5 h-5"})})}),o.length===0?h.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(H=>h.jsx(Gb,{event:H,forceExpanded:!0},H.id))]})]})}function rC(){return $e({queryKey:["docs"],queryFn:()=>fe("/docs"),staleTime:5*6e4})}function sC(n){return $e({queryKey:["docs",n],queryFn:()=>fe(`/docs/read?path=${encodeURIComponent(n)}`),enabled:!!n,staleTime:5*6e4})}function iC(){const[n,t]=E.useState([]),[s,i]=E.useState([]),[o,c]=E.useState(null),m=E.useRef(o),y=E.useRef(n),g=E.useRef(s);m.current=o,y.current=n,g.current=s;const u=E.useCallback((w,S)=>{var q;const C=m.current;if(C){const B=((q=S==null?void 0:S.current)==null?void 0:q.scrollTop)??0;t([...y.current,{...C,scrollTop:B}])}i([]),c({path:w,scrollTop:0})},[]),d=E.useCallback(w=>{var B;const S=y.current;if(S.length===0)return;const C=S[S.length-1],q=m.current;if(q){const se=((B=w==null?void 0:w.current)==null?void 0:B.scrollTop)??0;i([...g.current,{...q,scrollTop:se}])}t(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=C.scrollTop)})},[]),b=E.useCallback(w=>{var B;const S=g.current;if(S.length===0)return;const C=S[S.length-1],q=m.current;if(q){const se=((B=w==null?void 0:w.current)==null?void 0:B.scrollTop)??0;t([...y.current,{...q,scrollTop:se}])}i(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=C.scrollTop)})},[]),x=E.useCallback(w=>{var q,B;const S=m.current;if(!S)return;const C=((q=w==null?void 0:w.current)==null?void 0:q.scrollTop)??0;t([...y.current,{...S,scrollTop:C}]),i([]),c({...S,scrollTop:((B=w==null?void 0:w.current)==null?void 0:B.scrollTop)??0})},[]),v=E.useCallback(()=>{t([]),i([]),c(null)},[]);return{current:o,backStack:n,forwardStack:s,navigate:u,goBack:d,goForward:b,pushScrollPosition:x,reset:v}}function aC(n,t){const[s,i]=n.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const m=((t?t.replace(/[^/]+$/,""):"")+o).split("/"),y=[];for(const g of m)g===".."?y.pop():g&&g!=="."&&y.push(g);o=y.join("/")}return{path:o,anchor:i}}function oC(n){if(!n.startsWith("#docs"))return null;const t=n.slice(1).split(":"),s=t[1]||"README.md",i=t[2]||void 0;return{path:s,anchor:i}}function lC(n){return!n||n==="README.md"?"#docs":`#docs:${n}`}function cC({content:n,currentPath:t,onNavigate:s,onAnchorClick:i}){const o=c=>{var u;const m=c.target,y=m.closest("[data-anchor]");if(y){c.preventDefault(),i();const d=y.dataset.anchor,b=(u=y.closest(".docs-content"))==null?void 0:u.querySelector(`#${CSS.escape(d)}`);b==null||b.scrollIntoView({behavior:"smooth",block:"start"});return}const g=m.closest("[data-doc-link]");if(g){c.preventDefault();const{path:d,anchor:b}=aC(g.dataset.docLink,t);s(d,b);return}};return h.jsx(Du,{content:n,className:"docs-content",onClick:o})}function uC(n){const t=[],s=new Map;for(const i of n){const o=i.path.split("/");if(o.length===1){t.push(i);continue}let c=s;for(let m=0;m<o.length-1;m++){const y=o[m];c.has(y)||c.set(y,{label:y,children:[],subdirs:new Map});const g=c.get(y);m===o.length-2?g.children.push(i):c=g.subdirs}}return{topLevel:t,dirs:s}}function fC({docs:n,selected:t,onSelect:s}){const{topLevel:i,dirs:o}=uC(n),c=y=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${t===y?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function m(y,g){return h.jsxs("details",{open:!0,children:[h.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[h.jsx(MS,{className:"w-3 h-3",strokeWidth:1.5}),y.label]}),h.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...y.subdirs.values()].map(u=>m(u)),y.children.map(u=>h.jsx("button",{className:c(u.path),onClick:()=>s(u.path),children:u.title},u.path))]})]},y.label)}return h.jsxs("div",{className:"space-y-0.5",children:[i.map(y=>h.jsx("button",{className:c(y.path),onClick:()=>s(y.path),children:y.title},y.path)),[...o.values()].map(y=>m(y))]})}function hC({open:n,onClose:t}){var ae,$,I;const[s,i]=E.useState(!1),{data:o}=rC(),c=iC(),{data:m,isLoading:y}=sC(((ae=c.current)==null?void 0:ae.path)??null),g=E.useRef(null),[u,d]=E.useState(null);E.useEffect(()=>{u&&(m!=null&&m.content)&&g.current&&requestAnimationFrame(()=>{var Q;const D=(Q=g.current)==null?void 0:Q.querySelector(`#${CSS.escape(u)}`);D==null||D.scrollIntoView({behavior:"smooth",block:"start"}),d(null)})},[u,m]);const b=E.useCallback(()=>{var X;const D=oC(window.location.hash),Q=(D==null?void 0:D.path)??"README.md";((X=c.current)==null?void 0:X.path)!==Q&&c.navigate(Q,g),D!=null&&D.anchor&&d(D.anchor)},[c]),x=E.useRef(!0);E.useEffect(()=>{if(!n||!c.current)return;if(x.current){x.current=!1;return}const D=lC(c.current.path);window.location.hash!==D&&window.history.replaceState(null,"",window.location.pathname+window.location.search+D)},[n,($=c.current)==null?void 0:$.path]),E.useEffect(()=>{if(!n)return;const D=()=>{window.location.hash.startsWith("#docs")&&b()};return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[n,b]);const v=E.useCallback((D,Q)=>{Q&&d(Q),c.navigate(D,g)},[c]),w=E.useCallback(D=>{c.navigate(D,g)},[c]),S=E.useCallback(()=>{c.goBack(g)},[c]),C=E.useCallback(()=>{c.goForward(g)},[c]),q=E.useCallback(()=>{c.pushScrollPosition(g)},[c]);if(E.useEffect(()=>{if(n){x.current=!0,b();const D=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(D)}},[n]),!(n||s))return null;const se=()=>{i(!1),setTimeout(()=>{t(),c.reset()},200)},le=((I=c.current)==null?void 0:I.path)??null,R=c.backStack.length>0,H=c.forwardStack.length>0;return h.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&n?"opacity-100":"opacity-0"}`,onClick:se}),h.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&n?"translate-x-0":"translate-x-full"}`,children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("button",{onClick:S,disabled:!R,className:`p-0.5 transition-colors ${R?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:h.jsx(tx,{className:"w-4 h-4"})}),h.jsx("button",{onClick:C,disabled:!H,className:`p-0.5 transition-colors ${H?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:h.jsx(dd,{className:"w-4 h-4"})}),h.jsx(RS,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),h.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),h.jsx("button",{onClick:se,className:"p-1 text-text-tertiary hover:text-text-primary",children:h.jsx(Wt,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?h.jsx(fC,{docs:o.docs,selected:le,onSelect:w}):h.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),h.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:le?y?h.jsxs("div",{className:"animate-pulse space-y-2",children:[h.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):m!=null&&m.content?h.jsx(cC,{content:m.content,currentPath:le,onNavigate:v,onAnchorClick:q}):h.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[h.jsx(dd,{className:"w-5 h-5 mb-2"}),h.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function dC(n){if(n.includes("/escalations"))return["escalation","human-queue"]}const Vb=2e3;function mC(n){const s=n.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
|
|
60
|
-
${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
|
|
61
|
-
`)}
|
|
62
|
-
[End prior conversation]
|
|
63
|
-
|
|
64
|
-
`}function pC(n){const t=n.summary,s=n.title;if(t){const i=t.search(/\n\s*\{[\s\S]*"title"\s*:/);return i>0?t.slice(0,i).trim():t}return s||(typeof n=="string"?n:"Query completed.")}const $v=E.createContext(null);function yC({children:n}){const t=on(),[s,i]=E.useState(!1),[o,c]=E.useState([]),[m,y]=E.useState(null),[g,u]=E.useState({}),d=E.useRef(null),b={page:t.pathname.split("/").filter(Boolean).join("-")||"home",route:t.pathname,params:{},...g,suggestedTags:g.suggestedTags??dC(t.pathname)};E.useEffect(()=>()=>{d.current&&clearInterval(d.current)},[]);const x=E.useCallback(()=>i(q=>!q),[]),v=E.useCallback(q=>{u(q)},[]),w=E.useCallback(()=>{c([]),y(null)},[]),S=E.useCallback(async q=>{var $;const B=new Date().toISOString(),se={id:`user-${Date.now()}`,role:"user",content:q,timestamp:B},le={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:B,pending:!0};c(I=>[...I,se,le]);const R={...b};($=R.entities)!=null&&$.yamlContent&&R.entities.yamlContent.length>Vb&&(R.entities={...R.entities,yamlContent:R.entities.yamlContent.slice(0,Vb)+`
|
|
65
|
-
... (truncated)`});const ae=`${mC(o.concat(se))}${q}`;try{const D=(await fe("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ae,tags:R.suggestedTags,context:R,wait:!1,direct:!0})})).workflow_id;y(D),c(Q=>Q.map(X=>X.id===le.id?{...X,workflowId:D}:X)),d.current&&clearInterval(d.current),d.current=setInterval(async()=>{var Q;try{const X=await fe(`/workflows/${D}/result`),he=(Q=X==null?void 0:X.result)==null?void 0:Q.data;if(he){d.current&&clearInterval(d.current),d.current=null,y(null);const Se=pC(he);let ke;try{ke=(await fe(`/workflow-states/${D}/execution`)).duration_ms}catch{}c(F=>F.map(W=>W.id===le.id?{...W,content:Se,timestamp:new Date().toISOString(),pending:!1,durationMs:ke}:W))}}catch{}},3e3)}catch{c(I=>I.map(D=>D.id===le.id?{...D,content:"Failed to submit query. Please try again.",pending:!1}:D))}},[o,b]),C=E.useCallback(async q=>{const B=o.find(R=>R.id===q);if(!(B!=null&&B.workflowId)||B.compilationStatus==="compiling"||B.compilationStatus==="done")return;const se=o.indexOf(B),le=o.slice(0,se).reverse().find(R=>R.role==="user");if(le){c(R=>R.map(H=>H.id===q?{...H,compilationStatus:"compiling"}:H));try{const R=await fe("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:le.content,summary:B.content})}),H=await fe("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:B.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:R.tool_name,description:R.description,tags:R.tags,app_id:""})});await fe(`/yaml-workflows/${H.id}/deploy`,{method:"POST"}),c(ae=>ae.map($=>$.id===q?{...$,compilationStatus:"done"}:$))}catch(R){const H=R instanceof Error?R.message:"Compilation failed";c(ae=>ae.map($=>$.id===q?{...$,compilationStatus:"error",compilationError:H}:$))}}},[o]);return h.jsx($v.Provider,{value:{helpOpen:s,setHelpOpen:i,toggleHelp:x,messages:o,sendMessage:S,pageContext:b,setPageContext:v,activeWorkflowId:m,clearMessages:w,compileMessage:C},children:n})}function Hv(){const n=E.useContext($v);if(!n)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return n}function gC(){const{helpOpen:n,toggleHelp:t}=Hv();return h.jsx("button",{onClick:t,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":n?"Close help":"Ask for help",children:n?h.jsx(Wt,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):h.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${Ht}/logo512.png)`}})})}function bC({ms:n,className:t=""}){const s=sk(n),i=E.useMemo(()=>n==null?[]:[{label:"ms",value:String(n)},{label:"sec",value:`${(n/1e3).toFixed(3)}s`},{label:"text",value:s}],[n,s]);return n==null?h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:"--"}):h.jsx(fv,{options:i,children:h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:s})})}const xC=["sm","md","lg","full"],Yb={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"},Kb={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function vC({which:n}){const t="stroke-current";switch(n){case"sm":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:t,strokeWidth:"1.5"})});case"md":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:t,strokeWidth:"1.5"})});case"lg":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:t,strokeWidth:"1.5"})});case"full":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:t,strokeWidth:"1.5"})})}}function _C({msg:n}){const[t,s]=E.useState(0);E.useEffect(()=>{const m=new Date(n.timestamp).getTime(),y=()=>s(Math.floor((Date.now()-m)/1e3));y();const g=setInterval(y,1e3);return()=>clearInterval(g)},[n.timestamp]);const i=Math.floor(t/60),o=t%60,c=i>0?`${i}m ${o}s`:`${o}s`;return h.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),h.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:c})]}),n.workflowId&&h.jsxs(Mr,{to:`/workflows/executions/${n.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[h.jsx(tm,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function wC({msg:n,compileMessage:t}){const s=n.role==="assistant";return h.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[h.jsx(hv,{date:n.timestamp,format:"time",className:"!text-2xs text-text-muted/50"}),n.durationMs!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-muted/30 text-2xs",children:"·"}),h.jsx(bC,{ms:n.durationMs,className:"!text-2xs text-text-muted/50"})]}),n.workflowId&&h.jsx(Mr,{to:`/workflows/executions/${n.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx(tm,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&n.workflowId&&!n.pending&&h.jsx("button",{onClick:()=>t(n.id),disabled:n.compilationStatus==="compiling"||n.compilationStatus==="done",className:"transition-colors",title:n.compilationStatus==="done"?"Compiled — future queries will match this pipeline":n.compilationStatus==="error"?n.compilationError??"Compilation failed":n.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:h.jsx(DS,{className:`w-2.5 h-2.5 ${n.compilationStatus==="done"?"text-status-success":n.compilationStatus==="error"?"text-status-error":n.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function SC(){const{helpOpen:n,setHelpOpen:t,messages:s,sendMessage:i,pageContext:o,activeWorkflowId:c,clearMessages:m,compileMessage:y}=Hv(),[g,u]=E.useState(""),[d,b]=E.useState("md"),[x,v]=E.useState(!0),w=E.useRef(null),S=E.useRef(null);if(E.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[s]),E.useEffect(()=>{n&&S.current&&S.current.focus()},[n]),E.useEffect(()=>{if(!n)return;const R=H=>{H.key==="Escape"&&(d==="full"?b("lg"):d==="lg"?b("md"):d==="md"?b("sm"):t(!1))};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[n,d,t]),!n)return null;const C=()=>{const R=g.trim();!R||c||(i(R),u(""),S.current&&(S.current.style.height="auto"))},q=R=>{R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),C())},B=d==="full",se=o.page.replace(/-/g," "),le=B?{}:{bottom:"108px"};return h.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${B?Yb.full:`right-6 ${Yb[d]}`} ${x?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:le,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),children:[h.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),h.jsx("p",{className:"text-2xs text-text-tertiary truncate",children:se})]}),h.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[h.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:xC.map(R=>h.jsx("button",{onClick:()=>b(R),className:`p-1 rounded transition-colors ${R===d?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":R===d,"aria-label":Kb[R],title:Kb[R],children:h.jsx(vC,{which:R})},R))}),s.length>0&&h.jsx("button",{onClick:m,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:h.jsx(LS,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>t(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(Wt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),h.jsxs("div",{ref:w,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(R=>h.jsxs("div",{className:`text-xs leading-relaxed ${R.role==="user"?"text-right":"text-left"}`,children:[h.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${R.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:R.pending?h.jsx(_C,{msg:R}):R.role==="assistant"?h.jsx(Du,{content:R.content}):R.content}),!R.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(wC,{msg:R,compileMessage:y})})]},R.id))]}),h.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsx("textarea",{ref:S,value:g,onChange:R=>{u(R.target.value);const H=R.target;H.style.height="auto",H.style.height=`${Math.min(H.scrollHeight,120)}px`},onKeyDown:q,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!c}),h.jsx("button",{onClick:C,disabled:!g.trim()||!!c,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:h.jsx(qS,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const EC=6e3,OC="scan";function AC(){const{lastResult:n}=Bm(),{open:t,ownerKey:s}=Tm(),[i,o]=E.useState(null);return E.useEffect(()=>{if(!n)return;const c=setTimeout(()=>o(n.at),EC);return()=>clearTimeout(c)},[n]),!n||n.navigated||i===n.at||t&&s===OC||n.source===jo.TOOLBAR?null:h.jsx("div",{role:"status",className:"fixed bottom-14 right-4 z-[60] w-80 max-w-[calc(100vw-2rem)] bg-surface-raised border border-surface-border shadow-lg rounded-md animate-page-in",children:h.jsxs("div",{className:"flex items-start gap-2.5 px-3.5 py-3",children:[h.jsx(To,{className:"w-4 h-4 mt-0.5 text-accent-muted shrink-0",strokeWidth:1.5}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsx(Pm,{result:n})}),h.jsx("button",{type:"button",onClick:()=>o(n.at),className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Dismiss",children:h.jsx(Wt,{className:"w-3.5 h-3.5"})})]})})}const Fv="lt-announcement-dismissed:";function jC(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function kC(n){try{return localStorage.getItem(`${Fv}${n}`)==="1"}catch{return!1}}function TC(){const{isAuthenticated:n,userRoleNames:t}=Pt(),{data:s}=uv(n),i=He(),[o,c]=E.useState(null),[m,y]=E.useState(0);On(ek,()=>{i.invalidateQueries({queryKey:["announcements"]})});const g=Date.now(),u=((s==null?void 0:s.announcements)??[]).filter(b=>!kC(b.id)&&new Date(b.expires_at).getTime()>g&&(b.roles.length===0||b.roles.some(x=>t.includes(x))));if(E.useEffect(()=>{const b=((s==null?void 0:s.announcements)??[]).map(v=>new Date(v.expires_at).getTime()-Date.now()).filter(v=>v>0);if(b.length===0)return;const x=setTimeout(()=>y(v=>v+1),Math.min(...b)+250);return()=>clearTimeout(x)},[s,m]),u.length===0)return null;const d=b=>{try{localStorage.setItem(`${Fv}${b}`,"1")}catch{}y(x=>x+1)};return h.jsx("div",{"data-testid":"announcement-banner",className:"relative z-40",children:u.map(b=>{const x=o===b.id,v=b.title??b.body.split(`
|
|
66
|
-
`)[0];return h.jsxs("div",{className:"border-b border-accent/25 bg-accent/10",children:[h.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-accent",children:"Notice"}),h.jsxs("button",{type:"button",onClick:()=>c(x?null:b.id),className:"flex items-center gap-1.5 text-xs text-text-primary hover:text-accent transition-colors min-w-0",children:[h.jsx("span",{className:"truncate",children:v}),x?h.jsx(ox,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}):h.jsx(em,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{type:"button",onClick:()=>d(b.id),className:"icon-link",title:"Dismiss","aria-label":`Dismiss ${v}`,children:h.jsx(Wt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]}),x&&h.jsx("div",{className:"px-4 pb-3 text-sm text-text-secondary max-w-measure",children:h.jsx(Du,{content:jC(b.body)})})]},b.id)})})}function NC(){var H,ae;const{isBuilder:n,isOps:t,viewAs:s}=Yx(),{canSeePaceBoard:i}=Kx();hA();const{data:o}=Zn();Sj((H=o==null?void 0:o.display)==null?void 0:H.timeZone);const c=Hx(),m=c!==null?c:!!((ae=o==null?void 0:o.ai)!=null&&ae.enabled),{collapsed:y,toggle:g}=jm(),[u,d]=E.useState(!1),[b,x]=E.useState(!1),[v,w]=E.useState(!1),[S,C]=E.useState(()=>window.location.hash.startsWith("#docs")),q=on(),B=E.useRef(null),{kiosk:se,homePath:le}=Om(),R=se||Bj(q.pathname);return E.useEffect(()=>{const $=B.current;$&&($.classList.remove("animate-page-in"),$.offsetWidth,$.classList.add("animate-page-in"))},[q.pathname]),E.useEffect(()=>{const $=()=>{window.location.hash.startsWith("#docs")&&C(!0)};return window.addEventListener("hashchange",$),()=>window.removeEventListener("hashchange",$)},[]),se&&le&&!Ij(q.pathname,q.search)?h.jsx(wn,{to:le,replace:!0}):h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(uN,{onToggleEventFeed:()=>d($=>!$),onToggleDocs:()=>C($=>!$),onToggleNav:R?void 0:()=>x($=>!$)}),h.jsx(TC,{}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!R&&h.jsxs("aside",{className:`${y?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border hidden lg:flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[h.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(Bv,{aiEnabled:m,isBuilder:n,isOps:t,viewAs:s,canSeePaceBoard:i})}),h.jsx("button",{onClick:g,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${y?"flex justify-center":"flex items-center px-7"}`,"aria-label":y?"Expand sidebar":"Collapse sidebar",children:y?h.jsx(BS,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(PS,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!y&&(o==null?void 0:o.environment)&&h.jsxs("div",{className:"shrink-0 px-5 pb-3 text-2xs leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${o.environment.longTailVersion} · HotMesh v${o.environment.hotmeshVersion} · Node ${o.environment.nodeVersion} · ${o.environment.nodeEnv}`,children:["long-tail v",o.environment.longTailVersion,h.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",o.environment.hotmeshVersion]})]}),h.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:h.jsx("div",{ref:B,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:h.jsx(Zs,{})})}),h.jsx(CC,{})]}),!R&&h.jsx(BN,{open:b,onClose:()=>x(!1),aiEnabled:m,isBuilder:n,isOps:t,viewAs:s,canSeePaceBoard:i}),h.jsx(nC,{open:u,onToggle:()=>d($=>!$),configOpen:v,onToggleConfig:()=>w($=>!$)}),h.jsx(hC,{open:S,onClose:()=>{C(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),m&&h.jsx(gC,{}),m&&h.jsx(SC,{}),h.jsx(AC,{})]})}function CC(){const{node:n,width:t,open:s}=Tm();return h.jsx(Vj,{open:s,width:t,className:"border-l border-surface-border bg-surface-raised",children:n})}function MC(){const{isAuthenticated:n}=Pt(),t=on();return n?h.jsx(Hj,{children:h.jsx(Gj,{children:h.jsx(yC,{children:h.jsx(cA,{children:h.jsx(Pk,{children:h.jsx(NC,{})})})})})}):h.jsx(wn,{to:"/login",state:{from:t.pathname},replace:!0})}function Gv({provider:n,className:t="w-5 h-5"}){switch(n){case"google":return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),h.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),h.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),h.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]});case"github":return h.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:h.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})});case"microsoft":return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),h.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),h.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),h.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return h.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:h.jsx("path",{d:"M13.827 3.52h3.603L24 20.48h-3.603l-6.57-16.96zm-7.258 0h3.767L16.906 20.48h-3.674l-1.343-3.461H6.396l-1.34 3.461H1.5l5.07-16.96zm2.327 5.14l-2.065 5.326h4.108l-2.043-5.326z"})});default:return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"12",cy:"12",r:"10"}),h.jsx("path",{d:"M12 8v4l3 3"})]})}}async function RC(){return fe("/auth/oauth/providers")}async function DC(n,t){const s=t?`?label=${encodeURIComponent(t)}`:"";return fe(`/auth/oauth/connections/${n}${s}`,{method:"DELETE"})}function vM(){return $e({queryKey:["oauth-connections"],queryFn:()=>fe("/auth/oauth/connections")})}function _M(){const n=He();return Ve({mutationFn:({provider:t,label:s})=>DC(t,s),onSuccess:()=>{n.invalidateQueries({queryKey:["oauth-connections"]})}})}function LC(){var ae;const{login:n,isAuthenticated:t}=Pt(),s=ra(),i=on(),o=new URLSearchParams(i.search),c=o.get("token"),m=o.get("error"),y=((ae=i.state)==null?void 0:ae.from)??o.get("returnTo")??"/",g=E.useRef(!1);c&&!g.current&&(g.current=!0,n(c,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[u,d]=E.useState(""),[b,x]=E.useState(""),[v,w]=E.useState(m||""),[S,C]=E.useState(!1),[q,B]=E.useState(!!c),[se,le]=E.useState([]),R=E.useRef(!1);if(E.useEffect(()=>{c||R.current||(R.current=!0,(async()=>{var $,I,D,Q;try{const X=await rm().catch(()=>null);if(!(($=X==null?void 0:X.auth)!=null&&$.sso))return;const he=await fetch(`${Ht}/api/auth/sso`,{method:"POST"});if(!he.ok){w("Host authentication required — please log in to your organization first");return}const Se=await he.json();Se.token&&((I=X.auth)!=null&&I.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",X.auth.ssoLogoutUrl),B(!0),n(Se.token,void 0,{displayName:(D=Se.user)==null?void 0:D.display_name,username:(Q=Se.user)==null?void 0:Q.external_id}))}catch{}})())},[]),E.useEffect(()=>{c||RC().then(le).catch(()=>{})},[]),E.useEffect(()=>{if(!q)return;const $=setTimeout(()=>s(y,{replace:!0}),1500);return()=>clearTimeout($)},[q]),t&&!q)return h.jsx(wn,{to:y,replace:!0});const H=async $=>{var I,D;if($.preventDefault(),w(""),!u.trim()||!b){w("Username and password are required");return}C(!0);try{const Q=await fetch(`${Ht}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:u.trim(),password:b})}),X=await Q.json();if(!Q.ok){w(X.error||"Login failed");return}B(!0),n(X.token,{username:u.trim(),password:b},{displayName:(I=X.user)==null?void 0:I.display_name,username:(D=X.user)==null?void 0:D.external_id})}catch{w("Unable to connect to server")}finally{C(!1)}};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${q?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(Mm,{size:"lg",hideLabel:q})}),h.jsxs("form",{onSubmit:H,className:`space-y-5 transition-opacity duration-300 ${q?"opacity-0":""}`,children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),h.jsx("input",{id:"username",type:"text",value:u,onChange:$=>d($.target.value),className:"input",placeholder:"Enter your username",autoFocus:!q,autoComplete:"username"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),h.jsx("input",{id:"password",type:"password",value:b,onChange:$=>x($.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),v&&h.jsx("p",{className:"text-sm text-status-error",children:v}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:S||q,children:S?"Signing in...":"Sign In"}),se.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[h.jsx("div",{className:"flex-1 h-px bg-border"}),h.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),h.jsx("div",{className:"flex-1 h-px bg-border"})]}),h.jsx("div",{className:"space-y-2",children:se.filter($=>$.provider!=="anthropic").map($=>h.jsxs("a",{href:`${Ht}/api/auth/oauth/${$.provider}?returnTo=${encodeURIComponent(y)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx(Gv,{provider:$.provider}),"Sign in with ",$.name]},$.provider))})]})]})]})})}function Jb(){const{isAuthenticated:n}=Pt(),t=ra(),s=on(),i=new URLSearchParams(s.search),o=i.get("state")||"";E.useEffect(()=>{n||t(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[n]);const[c,m]=E.useState(""),[y,g]=E.useState(i.get("label")||"default"),[u,d]=E.useState(""),[b,x]=E.useState(!1),v=c.trim().startsWith("sk-ant-oat"),w=c.trim().startsWith("sk-ant-api"),S=C=>{C.preventDefault();const q=c.trim();if(!q){d("A token or API key is required");return}if(!q.startsWith("sk-ant-")){d('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}x(!0),d("");const B=`${Ht}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(q)}&state=${encodeURIComponent(o)}`;window.location.href=B};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(Mm,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx(Gv,{provider:"anthropic",className:"w-6 h-6"}),h.jsx("h2",{className:"heading-3",children:"Connect Anthropic"})]}),h.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Connect your Anthropic account so Claude Code tasks run under your credentials. Your token is encrypted at rest."}),h.jsxs("form",{onSubmit:S,className:"space-y-5",children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),h.jsx("input",{id:"token",type:"password",value:c,onChange:C=>m(C.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),v&&h.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),w&&h.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),h.jsx("input",{id:"label",type:"text",value:y,onChange:C=>g(C.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),h.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),u&&h.jsx("p",{className:"text-sm text-status-error",children:u}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:b,children:b?"Validating...":"Connect"}),h.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),h.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",h.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-2xs",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",h.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function Wc({roleTypes:n,roleNames:t,redirectTo:s="/"}){const{isSuperAdmin:i,hasRole:o,hasRoleType:c}=Pt();return i?h.jsx(Zs,{}):n&&n.some(m=>c(m))?h.jsx(Zs,{}):t&&t.some(m=>o(m))?h.jsx(Zs,{}):h.jsx(wn,{to:s,replace:!0})}function qC(){const{data:n,isSuccess:t}=qv();return t&&n.length===0?h.jsx(wn,{to:"/",replace:!0}):h.jsx(Zs,{})}function BC({redirectTo:n="/"}){var i;const{data:t,isLoading:s}=Zn();return s||!t?null:(i=t.ai)!=null&&i.enabled?h.jsx(Zs,{}):h.jsx(wn,{to:n,replace:!0})}function PC({flag:n,redirectTo:t="/"}){var o;const{data:s,isLoading:i}=Zn();return i||!s?null:((o=s.features)==null?void 0:o[n])===!1?h.jsx(wn,{to:t,replace:!0}):h.jsx(Zs,{})}const UC=E.lazy(()=>je(()=>import("./ProcessesListPage-pRjWuWlH.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url).then(n=>({default:n.ProcessesListPage}))),zC=E.lazy(()=>je(()=>import("./ProcessDetailPage-DNgCIwRl.js"),__vite__mapDeps([17,1,2,18,13,19,16,10,4,20,21]),import.meta.url).then(n=>({default:n.ProcessDetailPage}))),IC=E.lazy(()=>je(()=>import("./McpOverview-DrogIAKJ.js"),__vite__mapDeps([22,1,23,24,25,26,14,13,27,4]),import.meta.url).then(n=>({default:n.McpOverview}))),$C=E.lazy(()=>je(()=>import("./McpRunsPage-C2_7spTX.js"),__vite__mapDeps([28,1,24,25,3,4,29,26,6,7,8,9,16,13,30,14,12,11,15,31]),import.meta.url).then(n=>({default:n.McpRunsPage}))),HC=E.lazy(()=>je(()=>import("./McpRunDetailPage-hvns2sCm.js"),__vite__mapDeps([32,1,24,14,13,33,34,12,35,19,4,36,15,37]),import.meta.url).then(n=>({default:n.McpRunDetailPage}))),FC=E.lazy(()=>je(()=>import("./McpQueryPage-lygo4Yq0.js"),__vite__mapDeps([38,1,14,13,7,8,9,12,11,15,6,10,30,16,31,3,4,39]),import.meta.url).then(n=>({default:n.McpQueryPage}))),GC=E.lazy(()=>je(()=>import("./McpQueryDetailPage-CJmvCAE6.js"),__vite__mapDeps([40,1,14,13,19,39,4,25,41,42,24,2,43,44,45,46,47,48,37,49,35,36]),import.meta.url).then(n=>({default:n.McpQueryDetailPage}))),VC=E.lazy(()=>je(()=>import("./EscalationsOverview-BLPmh4AF.js"),__vite__mapDeps([50,1,14,13,27,4]),import.meta.url).then(n=>({default:n.EscalationsOverview}))),YC=E.lazy(()=>je(()=>import("./AvailableEscalationsPage-DeYMngwE.js"),__vite__mapDeps([51,1,4,52,13,53,54,5,55,56,57,19,7,8,9,58,59,21,11,60,61,12,62,20,16,3,31]),import.meta.url).then(n=>({default:n.AvailableEscalationsPage}))),KC=E.lazy(()=>je(()=>import("./OperatorDashboard-BeWBiMGX.js"),__vite__mapDeps([63,1,3,4,5,6,52,7,8,9,11,31,58,57,19,13,59,21,60,61,12,62,20,16,55,15]),import.meta.url).then(n=>({default:n.OperatorDashboard}))),JC=E.lazy(()=>je(()=>import("./index-OfO0173w.js"),__vite__mapDeps([64,1,65,13,57,19,4,54,16,53,5,14,15,20,60,37,21,66]),import.meta.url).then(n=>({default:n.EscalationDetailPage}))),XC=E.lazy(()=>je(()=>import("./WorkflowsOverview-Dk9gyqZN.js"),__vite__mapDeps([67,1,14,13,27,4]),import.meta.url).then(n=>({default:n.WorkflowsOverview}))),QC=E.lazy(()=>je(()=>import("./index-ByBy9M3L.js"),__vite__mapDeps([68,1,14,13,12,16,65,57,19,4,54,69,46,47]),import.meta.url).then(n=>({default:n.StartWorkflowPage}))),WC=E.lazy(()=>je(()=>import("./index-ByBy9M3L.js"),__vite__mapDeps([68,1,14,13,12,16,65,57,19,4,54,69,46,47]),import.meta.url).then(n=>({default:n.DurableInvokePage}))),ZC=E.lazy(()=>je(()=>import("./WorkflowsDashboard-CWsJdMdR.js"),__vite__mapDeps([70,1,30,29,26,4,3,6,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(n=>({default:()=>n.WorkflowsDashboard({tier:"durable"})}))),e3=E.lazy(()=>je(()=>import("./WorkflowsDashboard-CWsJdMdR.js"),__vite__mapDeps([70,1,30,29,26,4,3,6,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(n=>({default:()=>n.WorkflowsDashboard({tier:"all"})}))),t3=E.lazy(()=>je(()=>import("./YamlWorkflowsPage-B5jRX2Ph.js"),__vite__mapDeps([71,1,25,3,4,14,13,12,8,48,69,19]),import.meta.url).then(n=>({default:n.YamlWorkflowsPage}))),n3=E.lazy(()=>je(()=>import("./GraphInvokePage--997yNRr.js"),__vite__mapDeps([72,1,25,14,13,43,45,46,47,44,4,48,69]),import.meta.url).then(n=>({default:n.GraphInvokePage}))),r3=E.lazy(()=>je(()=>import("./YamlWorkflowDetailPage-CHwcrsaT.js"),__vite__mapDeps([73,1,25,19,69,13,4]),import.meta.url).then(n=>({default:n.YamlWorkflowDetailPage}))),s3=E.lazy(()=>je(()=>import("./TasksListPage-oEfEGj0_.js"),__vite__mapDeps([74,1,2,3,4,7,8,9,19,62,49,11,12,13,14,16]),import.meta.url).then(n=>({default:n.TasksListPage}))),i3=E.lazy(()=>je(()=>import("./TaskDetailPage-DEz_dqyR.js"),__vite__mapDeps([75,1,2,19,62,14,13,4]),import.meta.url).then(n=>({default:n.TaskDetailPage}))),Xb=E.lazy(()=>je(()=>import("./WorkflowExecutionPage-ByPixDZW.js"),__vite__mapDeps([76,1,34,12,13,35,19,4,36,2,14,33,15,37]),import.meta.url).then(n=>({default:n.WorkflowExecutionPage}))),a3=E.lazy(()=>je(()=>import("./AdminDashboard-BPWsgMfZ.js"),__vite__mapDeps([77,1,2,23,18,13,4]),import.meta.url).then(n=>({default:n.AdminDashboard}))),o3=E.lazy(()=>je(()=>import("./index-BFASQ7_X.js"),__vite__mapDeps([78,1,7,8,9,12,13,31,3,4,14,79,16]),import.meta.url).then(n=>({default:n.WorkersPage}))),l3=E.lazy(()=>je(()=>import("./index-BsHVgWH6.js"),__vite__mapDeps([80,1,12,13,81,20,16,14,4,46,47,69,65,57,19,54]),import.meta.url).then(n=>({default:n.WorkflowConfigsPage}))),Qb=E.lazy(()=>je(()=>import("./index-BsHVgWH6.js"),__vite__mapDeps([80,1,12,13,81,20,16,14,4,46,47,69,65,57,19,54]),import.meta.url).then(n=>({default:n.WorkflowConfigDetailPage}))),c3=E.lazy(()=>je(()=>import("./index-BrwqtXRh.js"),__vite__mapDeps([82,1,23,8,81,14,13,12,11,3,4,83,45,46,47,48,44,31,19]),import.meta.url).then(n=>({default:n.McpServersPage}))),Wb=E.lazy(()=>je(()=>import("./index-CtlBjl8o.js"),__vite__mapDeps([84,1,23,14,13,41,4]),import.meta.url).then(n=>({default:n.McpServerDetailPage}))),u3=E.lazy(()=>je(()=>import("./index-BT1Ms5Q5.js"),__vite__mapDeps([85,1,3,4,7,8,9,11,12,13,81,31,14,20,47,49,86,87,33]),import.meta.url).then(n=>({default:n.UsersPage}))),f3=E.lazy(()=>je(()=>import("./RolesPage-CK17N7zz.js"),__vite__mapDeps([88,1,12,13,14,20,4]),import.meta.url).then(n=>({default:n.RolesPage}))),h3=E.lazy(()=>je(()=>import("./RoleDetailPage-Bh_UcfYY.js"),__vite__mapDeps([89,1,90,81,13,4]),import.meta.url).then(n=>({default:n.RoleDetailPage}))),d3=E.lazy(()=>je(()=>import("./PersonasPage-ChASEZRg.js"),__vite__mapDeps([91,1,86,12,13,14,20,4,5]),import.meta.url).then(n=>({default:n.PersonasPage}))),m3=E.lazy(()=>je(()=>import("./PersonaDetailPage-CNHpsX_i.js"),__vite__mapDeps([92,1,86,20,13,87,90,81,4]),import.meta.url).then(n=>({default:n.PersonaDetailPage}))),p3=E.lazy(()=>je(()=>import("./EscalationSchemaPage-D0ko59_S.js"),__vite__mapDeps([93,1,65,13,57,19,4,54,16]),import.meta.url).then(n=>({default:n.EscalationSchemaPage}))),y3=E.lazy(()=>je(()=>import("./PortalPage-D5Lk-PKF.js"),__vite__mapDeps([94,1,9,56,13,57,19,4,7,8,58,59,21,11,60,61,12,62,20,16]),import.meta.url).then(n=>({default:n.PortalPage}))),g3=E.lazy(()=>je(()=>import("./EscalationListSchemaPage-CZZbZ4Aa.js"),__vite__mapDeps([95,1,13,4]),import.meta.url).then(n=>({default:n.EscalationListSchemaPage}))),b3=E.lazy(()=>je(()=>import("./ScanCodesPage-Bd0Pflqx.js"),__vite__mapDeps([96,1,97,14,13,4]),import.meta.url).then(n=>({default:n.ScanCodesPage}))),x3=E.lazy(()=>je(()=>import("./ScanSchemeDetailPage-CnuhozmJ.js"),__vite__mapDeps([98,1,81,14,13,97,4]),import.meta.url).then(n=>({default:n.ScanSchemeDetailPage}))),v3=E.lazy(()=>je(()=>import("./ScanStationPage-CoLc-q3h.js"),__vite__mapDeps([99,1,13,66,59,21,4]),import.meta.url).then(n=>({default:n.ScanStationPage}))),_3=E.lazy(()=>je(()=>import("./index-CnOvJz6U.js"),__vite__mapDeps([100,1,14,13,54,4]),import.meta.url).then(n=>({default:n.MaintenancePage}))),Zb=E.lazy(()=>je(()=>import("./OperationsPage-BlK8WlsY.js").then(n=>n.O),__vite__mapDeps([101,1,61,13,4,14,9]),import.meta.url).then(n=>({default:n.OperationsPage}))),w3=E.lazy(()=>je(()=>import("./index-x5z73M9N.js"),__vite__mapDeps([102,1,18,13,12,3,4,29,26,42,79,7,8,9,31]),import.meta.url).then(n=>({default:n.ControlPlanePage}))),S3=E.lazy(()=>je(()=>import("./index-D4Dlznn9.js"),__vite__mapDeps([103,1,36,13,3,4,29,26,6,7,8,9,11,12,14,15]),import.meta.url).then(n=>({default:n.StreamMessagesPage}))),E3=E.lazy(()=>je(()=>import("./CredentialsPage-CObc9Rs5.js"),__vite__mapDeps([104,1,14,13,49,81,4]),import.meta.url).then(n=>({default:n.CredentialsPage}))),O3=E.lazy(()=>je(()=>import("./index-RIFT3RlO.js"),__vite__mapDeps([105,1,4,14,13,12,15,6,8,106,49]),import.meta.url).then(n=>({default:n.FilesPage}))),A3=E.lazy(()=>je(()=>import("./index-C_K7OlzT.js"),__vite__mapDeps([107,1,14,13,12,15,11,8,106,49,108,41,4]),import.meta.url).then(n=>({default:n.KnowledgePage}))),j3=E.lazy(()=>je(()=>import("./HomePage-CwXFz--v.js"),__vite__mapDeps([109,1,24,26,20,13,16,15,101,61,4,14,9,52]),import.meta.url).then(n=>({default:n.HomePage}))),k3=E.lazy(()=>je(()=>import("./AgentsPage-DMEmiK_W.js"),__vite__mapDeps([110,1,111,3,4,6,7,8,9,11,12,13,14,15]),import.meta.url).then(n=>({default:n.AgentsPage}))),T3=E.lazy(()=>je(()=>import("./AgentDetailPage-B6o96Y5G.js"),__vite__mapDeps([112,1,111,113,13,16,4]),import.meta.url).then(n=>({default:n.AgentDetailPage}))),ex=E.lazy(()=>je(()=>import("./AgentConfigPage-De9imyo5.js"),__vite__mapDeps([114,1,111,113,13,14,108,45,46,47,25,115,116,16,4]),import.meta.url).then(n=>({default:n.AgentConfigPage}))),N3=E.lazy(()=>je(()=>import("./CapabilitiesPage-DOtjDTbK.js"),__vite__mapDeps([117,1,115,83,23,45,46,47,13,48,4,44,14,12]),import.meta.url).then(n=>({default:n.CapabilitiesPage}))),C3=E.lazy(()=>je(()=>import("./TopicsPage-Cr6-wfhJ.js"),__vite__mapDeps([118,1,116,14,13,12,4]),import.meta.url).then(n=>({default:n.TopicsPage}))),M3=E.lazy(()=>je(()=>import("./TopicDetailPage-C_I6JIVD.js"),__vite__mapDeps([119,1,116,15,13,4]),import.meta.url).then(n=>({default:n.TopicDetailPage})));function R3(){return h.jsxs("div",{className:"animate-pulse space-y-4",children:[h.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function Ee({children:n}){return h.jsx(E.Suspense,{fallback:h.jsx(R3,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:n})})}const Vv=new iS({defaultOptions:{queries:{staleTime:1e4,retry:(n,t)=>t instanceof Error&&t.message==="Session expired"?!1:n<1}}});window.addEventListener("auth:unauthorized",()=>{Vv.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=window.__LT_BASE__||"",t=`${n}/login`;if(window.location.pathname!==t){const s=window.location.pathname+window.location.search,i=n&&s.startsWith(n)?s.slice(n.length)||"/":s;window.location.href=`${t}?returnTo=${encodeURIComponent(i)}`}});const D3=lS([{path:"/login",element:h.jsx(LC,{})},{path:"/connect/anthropic",element:h.jsx(Jb,{})},{path:"/connect/:provider",element:h.jsx(Jb,{})},{path:"/",element:h.jsx(MC,{}),children:[{index:!0,element:h.jsx(Ee,{children:h.jsx(j3,{})})},{path:"processes/all",element:h.jsx(Ee,{children:h.jsx(UC,{})})},{path:"processes/detail/:originId",element:h.jsx(Ee,{children:h.jsx(zC,{})})},{path:"credentials",element:h.jsx(Ee,{children:h.jsx(E3,{})})},{path:"connections",element:h.jsx(wn,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(Ee,{children:h.jsx(VC,{})})},{path:"escalations/available",element:h.jsx(Ee,{children:h.jsx(YC,{})})},{path:"escalations/queue",element:h.jsx(Ee,{children:h.jsx(KC,{})})},{path:"escalations/detail/:id",element:h.jsx(Ee,{children:h.jsx(JC,{})})},{path:"portal/:role/:portal?",element:h.jsx(Ee,{children:h.jsx(y3,{})})},{path:"scan/station",element:h.jsx(Ee,{children:h.jsx(v3,{})})},{path:"capabilities",element:h.jsx(Ee,{children:h.jsx(N3,{})})},{path:"agents",element:h.jsx(Ee,{children:h.jsx(k3,{})})},{path:"agents/new",element:h.jsx(Ee,{children:h.jsx(ex,{})})},{path:"agents/:id",element:h.jsx(Ee,{children:h.jsx(T3,{})})},{path:"agents/:id/edit",element:h.jsx(Ee,{children:h.jsx(ex,{})})},{path:"topics",element:h.jsx(Ee,{children:h.jsx(C3,{})})},{path:"topics/:topic",element:h.jsx(Ee,{children:h.jsx(M3,{})})},{element:h.jsx(qC,{}),children:[{path:"workflows/start",element:h.jsx(Ee,{children:h.jsx(QC,{})})},{path:"workflows/durable/invoke",element:h.jsx(Ee,{children:h.jsx(WC,{})})}]},{element:h.jsx(Wc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(Ee,{children:h.jsx(XC,{})})},{path:"workflows/executions",element:h.jsx(Ee,{children:h.jsx(e3,{})})},{path:"workflows/durable/executions",element:h.jsx(Ee,{children:h.jsx(ZC,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(Ee,{children:h.jsx(Xb,{})})},{path:"workflows/tasks",element:h.jsx(Ee,{children:h.jsx(s3,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(Ee,{children:h.jsx(i3,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(Ee,{children:h.jsx(Xb,{})})},{path:"workflows/cron",element:h.jsx(wn,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(Ee,{children:h.jsx(o3,{})})},{path:"workflows/registry",element:h.jsx(Ee,{children:h.jsx(l3,{})})},{path:"workflows/registry/new",element:h.jsx(Ee,{children:h.jsx(Qb,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(Ee,{children:h.jsx(Qb,{})})}]},{element:h.jsx(Wc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(Ee,{children:h.jsx(t3,{})})},{path:"mcp/workflows/invoke",element:h.jsx(Ee,{children:h.jsx(n3,{})})},{path:"mcp/workflows/:id",element:h.jsx(Ee,{children:h.jsx(r3,{})})},{path:"mcp/executions",element:h.jsx(Ee,{children:h.jsx($C,{})})},{path:"mcp/executions/:jobId",element:h.jsx(Ee,{children:h.jsx(HC,{})})},{path:"files",element:h.jsx(Ee,{children:h.jsx(O3,{})})},{path:"knowledge",element:h.jsx(Ee,{children:h.jsx(A3,{})})},{element:h.jsx(BC,{}),children:[{path:"mcp",element:h.jsx(Ee,{children:h.jsx(IC,{})})},{path:"mcp/queries",element:h.jsx(Ee,{children:h.jsx(FC,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(Ee,{children:h.jsx(GC,{})})},{path:"mcp/tools",element:h.jsx(wn,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(Ee,{children:h.jsx(c3,{})})},{path:"mcp/servers/new",element:h.jsx(Ee,{children:h.jsx(Wb,{})})},{path:"mcp/servers/:serverId",element:h.jsx(Ee,{children:h.jsx(Wb,{})})}]}]},{path:"pace",element:h.jsx(Ee,{children:h.jsx(Zb,{})})},{path:"trends",element:h.jsx(Ee,{children:h.jsx(Zb,{})})},{path:"operations",element:h.jsx(wn,{to:"/pace",replace:!0})},{element:h.jsx(Wc,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(Ee,{children:h.jsx(a3,{})})},{path:"admin/users",element:h.jsx(Ee,{children:h.jsx(u3,{})})},{path:"admin/escalation-chains",element:h.jsx(wn,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(Ee,{children:h.jsx(f3,{})})},{path:"admin/roles/:role",element:h.jsx(Ee,{children:h.jsx(h3,{})})},{path:"admin/roles/:role/schema",element:h.jsx(Ee,{children:h.jsx(p3,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(Ee,{children:h.jsx(g3,{})})},{path:"admin/scan-codes",element:h.jsx(Ee,{children:h.jsx(b3,{})})},{path:"admin/scan-codes/:version",element:h.jsx(Ee,{children:h.jsx(x3,{})})},{path:"admin/personas",element:h.jsx(Ee,{children:h.jsx(d3,{})})},{path:"admin/personas/:key",element:h.jsx(Ee,{children:h.jsx(m3,{})})}]},{element:h.jsx(Wc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx(wn,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(PC,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(Ee,{children:h.jsx(_3,{})})}]},{path:"admin/controlplane",element:h.jsx(Ee,{children:h.jsx(w3,{})})},{path:"admin/streams",element:h.jsx(Ee,{children:h.jsx(S3,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function L3(){return h.jsx(aS,{client:Vv,children:h.jsx(ZS,{children:h.jsx(tA,{children:h.jsx(cS,{router:D3})})})})}gv(yv());const Im=document.createElement("link");Im.rel="stylesheet";Im.href=`${Ht}/api/settings/custom.css`;document.head.appendChild(Im);HS.createRoot(document.getElementById("root")).render(h.jsx(E.StrictMode,{children:h.jsx(L3,{})}));export{Pt as $,Dk as A,tM as B,zm as C,bC as D,f5 as E,Uv as F,nM as G,Tm as H,yN as I,ZN as J,gN as K,AN as L,zT as M,Xt as N,Yx as O,a5 as P,Om as Q,_5 as R,IN as S,w5 as T,S5 as U,E5 as V,O5 as W,j5 as X,Cj as Y,Nu as Z,u5 as _,uM as a,F5 as a$,Qd as a0,wN as a1,Q3 as a2,oM as a3,Rm as a4,Zi as a5,bs as a6,y5 as a7,Z3 as a8,lv as a9,fM as aA,qv as aB,dM as aC,cM as aD,fv as aE,N5 as aF,yM as aG,lM as aH,bM as aI,gM as aJ,H3 as aK,F3 as aL,K3 as aM,J3 as aN,G3 as aO,V3 as aP,Y3 as aQ,t5 as aR,r5 as aS,n5 as aT,sM as aU,X3 as aV,Em as aW,s5 as aX,SN as aY,i5 as aZ,W3 as a_,lN as aa,bk as ab,K5 as ac,qk as ad,fc as ae,b5 as af,x5 as ag,Du as ah,Lk as ai,TT as aj,rM as ak,vv as al,Xx as am,Lm as an,Nj as ao,uA as ap,d5 as aq,U5 as ar,m5 as as,v5 as at,A5 as au,Aj as av,Lg as aw,I3 as ax,pM as ay,hM as az,R5 as b,As as b0,_o as b1,xM as b2,Tx as b3,$5 as b4,Ht as b5,cx as b6,$3 as b7,xN as b8,aM as b9,l5 as bA,L5 as bB,IT as bC,vM as bD,_M as bE,Gv as bF,_m as bG,Kx as bH,z5 as bI,cv as ba,zb as bb,_v as bc,P5 as bd,wm as be,q5 as bf,V5 as bg,xj as bh,G5 as bi,cr as bj,Qx as bk,H5 as bl,Wi as bm,e5 as bn,kk as bo,Q5 as bp,ok as bq,Z5 as br,eM as bs,X5 as bt,W5 as bu,Bm as bv,rk as bw,Bk as bx,Ae as by,J5 as bz,Zn as c,Y5 as d,k5 as e,sk as f,hv as g,Vj as h,o5 as i,Zt as j,On as k,T5 as l,fe as m,mM as n,C5 as o,M5 as p,h5 as q,p5 as r,g5 as s,D5 as t,I5 as u,c5 as v,Um as w,iM as x,Hx as y,B5 as z};
|
|
67
|
-
//# sourceMappingURL=index-LRYC__mE.js.map
|