dexto 1.3.0 โ 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -22
- package/dist/agents/agent-registry.json +9 -0
- package/dist/agents/agent-template.yml +2 -2
- package/dist/agents/coding-agent/coding-agent.yml +27 -16
- package/dist/agents/database-agent/database-agent.yml +2 -2
- package/dist/agents/default-agent.yml +9 -7
- package/dist/agents/github-agent/github-agent.yml +2 -2
- package/dist/agents/product-name-researcher/product-name-researcher.yml +2 -2
- package/dist/agents/talk2pdf-agent/talk2pdf-agent.yml +2 -2
- package/dist/analytics/events.d.ts +13 -6
- package/dist/analytics/events.d.ts.map +1 -1
- package/dist/analytics/index.d.ts +1 -1
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics/index.js +6 -2
- package/dist/api/server-hono.d.ts.map +1 -1
- package/dist/api/server-hono.js +65 -9
- package/dist/cli/cli-subscriber.d.ts +4 -0
- package/dist/cli/cli-subscriber.d.ts.map +1 -1
- package/dist/cli/cli-subscriber.js +47 -3
- package/dist/cli/commands/create-app.d.ts +16 -14
- package/dist/cli/commands/create-app.d.ts.map +1 -1
- package/dist/cli/commands/create-app.js +626 -102
- package/dist/cli/commands/create-image.d.ts +7 -0
- package/dist/cli/commands/create-image.d.ts.map +1 -0
- package/dist/cli/commands/create-image.js +201 -0
- package/dist/cli/commands/helpers/formatters.d.ts.map +1 -1
- package/dist/cli/commands/helpers/formatters.js +9 -8
- package/dist/cli/commands/index.d.ts +2 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +2 -1
- package/dist/cli/commands/init-app.js +7 -7
- package/dist/cli/commands/install.d.ts +0 -3
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +19 -70
- package/dist/cli/commands/interactive-commands/command-parser.d.ts +17 -14
- package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/command-parser.js +7 -22
- package/dist/cli/commands/interactive-commands/commands.d.ts +4 -4
- package/dist/cli/commands/interactive-commands/commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/commands.js +34 -42
- package/dist/cli/commands/interactive-commands/documentation-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/documentation-commands.js +4 -7
- package/dist/cli/commands/interactive-commands/general-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/general-commands.js +159 -117
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts +9 -3
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/mcp/index.js +18 -3
- package/dist/cli/commands/interactive-commands/model/index.d.ts +8 -6
- package/dist/cli/commands/interactive-commands/model/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/model/index.js +18 -6
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts +3 -2
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.js +77 -60
- package/dist/cli/commands/interactive-commands/session/index.d.ts +7 -12
- package/dist/cli/commands/interactive-commands/session/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/session/index.js +7 -14
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts +10 -24
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/session/session-commands.js +16 -371
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts +1 -0
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/system/system-commands.js +106 -77
- package/dist/cli/commands/interactive-commands/tool-commands.d.ts +1 -1
- package/dist/cli/commands/interactive-commands/tool-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/tool-commands.js +5 -62
- package/dist/cli/commands/interactive-commands/utils/command-output.d.ts +13 -17
- package/dist/cli/commands/interactive-commands/utils/command-output.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/utils/command-output.js +18 -37
- package/dist/cli/commands/list-agents.d.ts +2 -2
- package/dist/cli/commands/list-agents.d.ts.map +1 -1
- package/dist/cli/commands/list-agents.js +38 -34
- package/dist/cli/commands/session-commands.js +16 -16
- package/dist/cli/commands/setup.d.ts +13 -5
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +860 -65
- package/dist/cli/commands/uninstall.d.ts.map +1 -1
- package/dist/cli/commands/uninstall.js +4 -6
- package/dist/cli/commands/which.d.ts.map +1 -1
- package/dist/cli/commands/which.js +18 -4
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts +9 -22
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/InkCLIRefactored.js +50 -133
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +26 -3
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.js +182 -45
- package/dist/cli/ink-cli/components/CustomInput.js +1 -1
- package/dist/cli/ink-cli/components/EditableMultiLineInput.js +4 -4
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts +22 -0
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/ElicitationForm.js +358 -0
- package/dist/cli/ink-cli/components/ErrorBoundary.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ErrorBoundary.js +1 -1
- package/dist/cli/ink-cli/components/Footer.d.ts +16 -0
- package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/Footer.js +27 -0
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts +17 -0
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/HistorySearchBar.js +8 -0
- package/dist/cli/ink-cli/components/MultiLineInput.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/MultiLineInput.js +3 -3
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts +15 -2
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ResourceAutocomplete.js +126 -82
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts +15 -2
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +228 -122
- package/dist/cli/ink-cli/components/StatusBar.d.ts +15 -2
- package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/StatusBar.js +50 -10
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts +52 -0
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/TextBufferInput.js +471 -0
- package/dist/cli/ink-cli/components/base/BaseAutocomplete.js +4 -4
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts +11 -1
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/base/BaseSelector.js +90 -49
- package/dist/cli/ink-cli/components/chat/Footer.js +1 -1
- package/dist/cli/ink-cli/components/chat/Header.d.ts +1 -0
- package/dist/cli/ink-cli/components/chat/Header.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/Header.js +6 -3
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts +3 -0
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.js +95 -9
- package/dist/cli/ink-cli/components/chat/MessageList.js +1 -1
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts +16 -0
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.js +27 -0
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts +5 -3
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/ToolIcon.js +21 -7
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.js +6 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.js +15 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.js +9 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.js +37 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.js +9 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.js +6 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.js +29 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts +45 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.js +38 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.js +6 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts +13 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.js +12 -0
- package/dist/cli/ink-cli/components/input/InputArea.d.ts +36 -8
- package/dist/cli/ink-cli/components/input/InputArea.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/input/InputArea.js +3 -3
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts +25 -0
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +166 -0
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts +27 -0
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/modes/StaticCLI.js +95 -0
- package/dist/cli/ink-cli/components/modes/index.d.ts +10 -0
- package/dist/cli/ink-cli/components/modes/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/modes/index.js +9 -0
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts +26 -0
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.js +92 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.js +286 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +59 -0
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.js +59 -0
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts +26 -0
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.js +73 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.js +51 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.js +215 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +74 -0
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpSelector.js +52 -0
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts +28 -0
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpServerActions.js +84 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.js +109 -0
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts +15 -8
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +400 -23
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.js +52 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.js +166 -0
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts +27 -0
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.js +119 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts +33 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.js +144 -0
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts +23 -0
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.js +189 -0
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts +7 -2
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.js +19 -5
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.js +42 -0
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts +20 -0
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/StreamSelector.js +58 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +400 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.js +609 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts +15 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.js +14 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts +33 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.js +419 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.js +29 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts +17 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.js +11 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts +20 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.js +10 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts +30 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.js +13 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts +8 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.js +7 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts +79 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.js +38 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts +21 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.js +65 -0
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts +28 -0
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +66 -0
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts +19 -0
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/FileRenderer.js +26 -0
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts +21 -0
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.js +26 -0
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts +20 -0
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.js +12 -0
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts +21 -0
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.js +25 -0
- package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts +61 -0
- package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/diff-shared.js +158 -0
- package/dist/cli/ink-cli/components/renderers/index.d.ts +28 -0
- package/dist/cli/ink-cli/components/renderers/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/index.js +36 -0
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts +38 -0
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/MarkdownText.js +362 -0
- package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts +44 -0
- package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/VirtualizedList.js +300 -0
- package/dist/cli/ink-cli/components/shared/text-buffer.d.ts +185 -0
- package/dist/cli/ink-cli/components/shared/text-buffer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/text-buffer.js +1338 -0
- package/dist/cli/ink-cli/constants/processingPhrases.d.ts +10 -0
- package/dist/cli/ink-cli/constants/processingPhrases.d.ts.map +1 -0
- package/dist/cli/ink-cli/constants/processingPhrases.js +64 -0
- package/dist/cli/ink-cli/constants/tips.d.ts +15 -0
- package/dist/cli/ink-cli/constants/tips.d.ts.map +1 -0
- package/dist/cli/ink-cli/constants/tips.js +53 -0
- package/dist/cli/ink-cli/containers/InputContainer.d.ts +42 -8
- package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/InputContainer.js +513 -85
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts +23 -5
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.js +1214 -132
- package/dist/cli/ink-cli/containers/index.d.ts +1 -1
- package/dist/cli/ink-cli/containers/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/contexts/KeypressContext.d.ts +36 -0
- package/dist/cli/ink-cli/contexts/KeypressContext.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/KeypressContext.js +461 -0
- package/dist/cli/ink-cli/contexts/MouseContext.d.ts +27 -0
- package/dist/cli/ink-cli/contexts/MouseContext.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/MouseContext.js +102 -0
- package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts +33 -0
- package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/ScrollProvider.js +170 -0
- package/dist/cli/ink-cli/contexts/index.d.ts +7 -0
- package/dist/cli/ink-cli/contexts/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/index.js +6 -0
- package/dist/cli/ink-cli/hooks/index.d.ts +5 -0
- package/dist/cli/ink-cli/hooks/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/index.js +6 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts +26 -9
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.js +90 -198
- package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts +14 -0
- package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useBatchedScroll.js +25 -0
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts +50 -0
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useCLIState.js +190 -0
- package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts +24 -0
- package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useElapsedTime.js +69 -0
- package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts +61 -0
- package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useHistorySearch.js +210 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts +136 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.js +663 -0
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.js +7 -26
- package/dist/cli/ink-cli/hooks/useKeypress.d.ts +18 -0
- package/dist/cli/ink-cli/hooks/useKeypress.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useKeypress.js +26 -0
- package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts +30 -0
- package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/usePhraseCycler.js +68 -0
- package/dist/cli/ink-cli/hooks/useStreaming.d.ts +19 -0
- package/dist/cli/ink-cli/hooks/useStreaming.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useStreaming.js +26 -0
- package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts +14 -0
- package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useTerminalSize.js +31 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts +42 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.js +96 -0
- package/dist/cli/ink-cli/services/CommandService.d.ts +32 -1
- package/dist/cli/ink-cli/services/CommandService.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/CommandService.js +36 -5
- package/dist/cli/ink-cli/services/InputService.d.ts +1 -5
- package/dist/cli/ink-cli/services/InputService.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/InputService.js +1 -8
- package/dist/cli/ink-cli/services/index.d.ts +2 -1
- package/dist/cli/ink-cli/services/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/index.js +2 -1
- package/dist/cli/ink-cli/services/processStream.d.ts +69 -0
- package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -0
- package/dist/cli/ink-cli/services/processStream.js +742 -0
- package/dist/cli/ink-cli/state/actions.d.ts +30 -60
- package/dist/cli/ink-cli/state/actions.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/actions.js +3 -0
- package/dist/cli/ink-cli/state/index.d.ts +5 -3
- package/dist/cli/ink-cli/state/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/index.js +4 -3
- package/dist/cli/ink-cli/state/initialState.d.ts +4 -3
- package/dist/cli/ink-cli/state/initialState.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/initialState.js +20 -4
- package/dist/cli/ink-cli/state/reducer.d.ts +3 -0
- package/dist/cli/ink-cli/state/reducer.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/reducer.js +62 -168
- package/dist/cli/ink-cli/state/streaming-state.d.ts +27 -0
- package/dist/cli/ink-cli/state/streaming-state.d.ts.map +1 -0
- package/dist/cli/ink-cli/state/streaming-state.js +39 -0
- package/dist/cli/ink-cli/state/types.d.ts +223 -6
- package/dist/cli/ink-cli/state/types.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/bracketedPaste.d.ts +22 -0
- package/dist/cli/ink-cli/utils/bracketedPaste.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/bracketedPaste.js +27 -0
- package/dist/cli/ink-cli/utils/clipboardUtils.d.ts +49 -0
- package/dist/cli/ink-cli/utils/clipboardUtils.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/clipboardUtils.js +356 -0
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts +33 -0
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/commandOverlays.js +78 -0
- package/dist/cli/ink-cli/utils/debugLog.d.ts +38 -0
- package/dist/cli/ink-cli/utils/debugLog.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/debugLog.js +66 -0
- package/dist/cli/ink-cli/utils/index.d.ts +2 -1
- package/dist/cli/ink-cli/utils/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/index.js +3 -1
- package/dist/cli/ink-cli/utils/input.d.ts +25 -0
- package/dist/cli/ink-cli/utils/input.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/input.js +56 -0
- package/dist/cli/ink-cli/utils/inputParsing.d.ts +0 -9
- package/dist/cli/ink-cli/utils/inputParsing.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/inputParsing.js +0 -27
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts +59 -3
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.js +348 -20
- package/dist/cli/ink-cli/utils/mouse.d.ts +61 -0
- package/dist/cli/ink-cli/utils/mouse.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/mouse.js +209 -0
- package/dist/cli/ink-cli/utils/streamSplitter.d.ts +44 -0
- package/dist/cli/ink-cli/utils/streamSplitter.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/streamSplitter.js +154 -0
- package/dist/cli/ink-cli/utils/textUtils.d.ts +63 -0
- package/dist/cli/ink-cli/utils/textUtils.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/textUtils.js +248 -0
- package/dist/cli/ink-cli/utils/toolUtils.d.ts +9 -0
- package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/toolUtils.js +15 -0
- package/dist/cli/utils/api-key-setup.d.ts +54 -4
- package/dist/cli/utils/api-key-setup.d.ts.map +1 -1
- package/dist/cli/utils/api-key-setup.js +433 -107
- package/dist/cli/utils/api-key-verification.d.ts +17 -0
- package/dist/cli/utils/api-key-verification.d.ts.map +1 -0
- package/dist/cli/utils/api-key-verification.js +211 -0
- package/dist/cli/utils/config-validation.d.ts +22 -2
- package/dist/cli/utils/config-validation.d.ts.map +1 -1
- package/dist/cli/utils/config-validation.js +354 -25
- package/dist/cli/utils/local-model-setup.d.ts +46 -0
- package/dist/cli/utils/local-model-setup.d.ts.map +1 -0
- package/dist/cli/utils/local-model-setup.js +662 -0
- package/dist/cli/utils/options.d.ts.map +1 -1
- package/dist/cli/utils/options.js +1 -3
- package/dist/cli/utils/prompt-helpers.d.ts +47 -0
- package/dist/cli/utils/prompt-helpers.d.ts.map +1 -0
- package/dist/cli/utils/prompt-helpers.js +66 -0
- package/dist/cli/utils/provider-setup.d.ts +66 -8
- package/dist/cli/utils/provider-setup.d.ts.map +1 -1
- package/dist/cli/utils/provider-setup.js +324 -84
- package/dist/cli/utils/scaffolding-utils.d.ts +76 -0
- package/dist/cli/utils/scaffolding-utils.d.ts.map +1 -0
- package/dist/cli/utils/scaffolding-utils.js +246 -0
- package/dist/cli/utils/setup-utils.d.ts +16 -0
- package/dist/cli/utils/setup-utils.d.ts.map +1 -1
- package/dist/cli/utils/setup-utils.js +72 -21
- package/dist/cli/utils/template-engine.d.ts +65 -0
- package/dist/cli/utils/template-engine.d.ts.map +1 -0
- package/dist/cli/utils/template-engine.js +1089 -0
- package/dist/config/cli-overrides.d.ts +45 -2
- package/dist/config/cli-overrides.d.ts.map +1 -1
- package/dist/config/cli-overrides.js +107 -10
- package/dist/index.js +379 -99
- package/dist/utils/agent-helpers.d.ts +95 -0
- package/dist/utils/agent-helpers.d.ts.map +1 -0
- package/dist/utils/agent-helpers.js +117 -0
- package/dist/webui/assets/index-8j-KMkX1.js +2054 -0
- package/dist/webui/assets/index-c_AX24V4.css +1 -0
- package/dist/webui/assets/{tanstack-DgxBONJY.js โ tanstack-Br79RQ-n.js} +1 -1
- package/dist/webui/index.html +4 -10
- package/dist/webui/logos/aws-color.svg +1 -0
- package/dist/webui/logos/dexto/dexto_logo.svg +1 -1
- package/dist/webui/logos/dexto/dexto_logo_light.svg +6 -6
- package/dist/webui/logos/glama.svg +7 -0
- package/dist/webui/logos/litellm.svg +7 -0
- package/dist/webui/logos/openrouter.svg +1 -0
- package/package.json +18 -15
- package/dist/cli/commands/interactive-commands/index.d.ts +0 -63
- package/dist/cli/commands/interactive-commands/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/index.js +0 -73
- package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.d.ts +0 -34
- package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.js +0 -178
- package/dist/cli/commands/interactive-commands/mcp/mcp-commands.d.ts +0 -9
- package/dist/cli/commands/interactive-commands/mcp/mcp-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/mcp/mcp-commands.js +0 -325
- package/dist/cli/commands/interactive-commands/model/model-commands.d.ts +0 -21
- package/dist/cli/commands/interactive-commands/model/model-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/model/model-commands.js +0 -190
- package/dist/cli/ink-cli/components/MultiLineTextInput.d.ts +0 -26
- package/dist/cli/ink-cli/components/MultiLineTextInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/MultiLineTextInput.js +0 -220
- package/dist/discord/bot.d.ts +0 -4
- package/dist/discord/bot.d.ts.map +0 -1
- package/dist/discord/bot.js +0 -193
- package/dist/telegram/bot.d.ts +0 -5
- package/dist/telegram/bot.d.ts.map +0 -1
- package/dist/telegram/bot.js +0 -251
- package/dist/webui/assets/index-DKq5Xng1.js +0 -687
- package/dist/webui/assets/index-D_0_GBu5.css +0 -1
|
@@ -1,687 +0,0 @@
|
|
|
1
|
-
var k3=Object.defineProperty;var S3=(t,e,n)=>e in t?k3(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Xn=(t,e,n)=>S3(t,typeof e!="symbol"?e+"":e,n);import{r as _,R as nt,Q as j3,j as c,a as N3,u as An,b as Tr,c as Fb,d as On,O as C3,e as Vm,f as MC,g as py,h as E3,i as T3,L as DC,k as A3,l as Bb,m as O3,n as R3}from"./tanstack-DgxBONJY.js";import{r as M3,a as D3,g as kc}from"./react-vendor-gH-7aFTg.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();var Hv={exports:{}},Ru={},Vv={exports:{}},Kv={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* scheduler.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var tS;function I3(){return tS||(tS=1,(function(t){function e(M,V){var U=M.length;M.push(V);e:for(;0<U;){var H=U-1>>>1,L=M[H];if(0<s(L,V))M[H]=V,M[U]=L,U=H;else break e}}function n(M){return M.length===0?null:M[0]}function r(M){if(M.length===0)return null;var V=M[0],U=M.pop();if(U!==V){M[0]=U;e:for(var H=0,L=M.length,ne=L>>>1;H<ne;){var ie=2*(H+1)-1,P=M[ie],pe=ie+1,Pe=M[pe];if(0>s(P,U))pe<L&&0>s(Pe,P)?(M[H]=Pe,M[pe]=U,H=pe):(M[H]=P,M[ie]=U,H=ie);else if(pe<L&&0>s(Pe,U))M[H]=Pe,M[pe]=U,H=pe;else break e}}return V}function s(M,V){var U=M.sortIndex-V.sortIndex;return U!==0?U:M.id-V.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var l=Date,u=l.now();t.unstable_now=function(){return l.now()-u}}var f=[],h=[],g=1,p=null,x=3,y=!1,k=!1,w=!1,S=!1,N=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function A(M){for(var V=n(h);V!==null;){if(V.callback===null)r(h);else if(V.startTime<=M)r(h),V.sortIndex=V.expirationTime,e(f,V);else break;V=n(h)}}function I(M){if(w=!1,A(M),!k)if(n(f)!==null)k=!0,T||(T=!0,q());else{var V=n(h);V!==null&&F(I,V.startTime-M)}}var T=!1,E=-1,R=5,z=-1;function D(){return S?!0:!(t.unstable_now()-z<R)}function B(){if(S=!1,T){var M=t.unstable_now();z=M;var V=!0;try{e:{k=!1,w&&(w=!1,C(E),E=-1),y=!0;var U=x;try{t:{for(A(M),p=n(f);p!==null&&!(p.expirationTime>M&&D());){var H=p.callback;if(typeof H=="function"){p.callback=null,x=p.priorityLevel;var L=H(p.expirationTime<=M);if(M=t.unstable_now(),typeof L=="function"){p.callback=L,A(M),V=!0;break t}p===n(f)&&r(f),A(M)}else r(f);p=n(f)}if(p!==null)V=!0;else{var ne=n(h);ne!==null&&F(I,ne.startTime-M),V=!1}}break e}finally{p=null,x=U,y=!1}V=void 0}}finally{V?q():T=!1}}}var q;if(typeof j=="function")q=function(){j(B)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,G=K.port2;K.port1.onmessage=B,q=function(){G.postMessage(null)}}else q=function(){N(B,0)};function F(M,V){E=N(function(){M(t.unstable_now())},V)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(M){M.callback=null},t.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<M?Math.floor(1e3/M):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function(M){switch(x){case 1:case 2:case 3:var V=3;break;default:V=x}var U=x;x=V;try{return M()}finally{x=U}},t.unstable_requestPaint=function(){S=!0},t.unstable_runWithPriority=function(M,V){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var U=x;x=M;try{return V()}finally{x=U}},t.unstable_scheduleCallback=function(M,V,U){var H=t.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?H+U:H):U=H,M){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=U+L,M={id:g++,callback:V,priorityLevel:M,startTime:U,expirationTime:L,sortIndex:-1},U>H?(M.sortIndex=U,e(h,M),n(f)===null&&M===n(h)&&(w?(C(E),E=-1):w=!0,F(I,U-H))):(M.sortIndex=L,e(f,M),k||y||(k=!0,T||(T=!0,q()))),M},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(M){var V=x;return function(){var U=x;x=V;try{return M.apply(this,arguments)}finally{x=U}}}})(Kv)),Kv}var nS;function L3(){return nS||(nS=1,Vv.exports=I3()),Vv.exports}/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-dom-client.production.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var rS;function P3(){if(rS)return Ru;rS=1;var t=L3(),e=M3(),n=D3();function r(i){var o="https://react.dev/errors/"+i;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)o+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+i+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function a(i){var o=i,d=i;if(i.alternate)for(;o.return;)o=o.return;else{i=o;do o=i,(o.flags&4098)!==0&&(d=o.return),i=o.return;while(i)}return o.tag===3?d:null}function l(i){if(i.tag===13){var o=i.memoizedState;if(o===null&&(i=i.alternate,i!==null&&(o=i.memoizedState)),o!==null)return o.dehydrated}return null}function u(i){if(a(i)!==i)throw Error(r(188))}function f(i){var o=i.alternate;if(!o){if(o=a(i),o===null)throw Error(r(188));return o!==i?null:i}for(var d=i,m=o;;){var v=d.return;if(v===null)break;var b=v.alternate;if(b===null){if(m=v.return,m!==null){d=m;continue}break}if(v.child===b.child){for(b=v.child;b;){if(b===d)return u(v),i;if(b===m)return u(v),o;b=b.sibling}throw Error(r(188))}if(d.return!==m.return)d=v,m=b;else{for(var O=!1,$=v.child;$;){if($===d){O=!0,d=v,m=b;break}if($===m){O=!0,m=v,d=b;break}$=$.sibling}if(!O){for($=b.child;$;){if($===d){O=!0,d=b,m=v;break}if($===m){O=!0,m=b,d=v;break}$=$.sibling}if(!O)throw Error(r(189))}}if(d.alternate!==m)throw Error(r(190))}if(d.tag!==3)throw Error(r(188));return d.stateNode.current===d?i:o}function h(i){var o=i.tag;if(o===5||o===26||o===27||o===6)return i;for(i=i.child;i!==null;){if(o=h(i),o!==null)return o;i=i.sibling}return null}var g=Object.assign,p=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),N=Symbol.for("react.provider"),C=Symbol.for("react.consumer"),j=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function q(i){return i===null||typeof i!="object"?null:(i=B&&i[B]||i["@@iterator"],typeof i=="function"?i:null)}var K=Symbol.for("react.client.reference");function G(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===K?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case k:return"Fragment";case S:return"Profiler";case w:return"StrictMode";case I:return"Suspense";case T:return"SuspenseList";case z:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case y:return"Portal";case j:return(i.displayName||"Context")+".Provider";case C:return(i._context.displayName||"Context")+".Consumer";case A:var o=i.render;return i=i.displayName,i||(i=o.displayName||o.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case E:return o=i.displayName||null,o!==null?o:G(i.type)||"Memo";case R:o=i._payload,i=i._init;try{return G(i(o))}catch{}}return null}var F=Array.isArray,M=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U={pending:!1,data:null,method:null,action:null},H=[],L=-1;function ne(i){return{current:i}}function ie(i){0>L||(i.current=H[L],H[L]=null,L--)}function P(i,o){L++,H[L]=i.current,i.current=o}var pe=ne(null),Pe=ne(null),Ne=ne(null),ge=ne(null);function Fe(i,o){switch(P(Ne,o),P(Pe,i),P(pe,null),o.nodeType){case 9:case 11:i=(i=o.documentElement)&&(i=i.namespaceURI)?Tk(i):0;break;default:if(i=o.tagName,o=o.namespaceURI)o=Tk(o),i=Ak(o,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}ie(pe),P(pe,i)}function Qe(){ie(pe),ie(Pe),ie(Ne)}function $e(i){i.memoizedState!==null&&P(ge,i);var o=pe.current,d=Ak(o,i.type);o!==d&&(P(Pe,i),P(pe,d))}function Q(i){Pe.current===i&&(ie(pe),ie(Pe)),ge.current===i&&(ie(ge),Cu._currentValue=U)}var _e=Object.prototype.hasOwnProperty,Oe=t.unstable_scheduleCallback,le=t.unstable_cancelCallback,he=t.unstable_shouldYield,Ee=t.unstable_requestPaint,De=t.unstable_now,ve=t.unstable_getCurrentPriorityLevel,ue=t.unstable_ImmediatePriority,Ce=t.unstable_UserBlockingPriority,ze=t.unstable_NormalPriority,be=t.unstable_LowPriority,Se=t.unstable_IdlePriority,ot=t.log,dt=t.unstable_setDisableYieldValue,J=null,me=null;function Ae(i){if(typeof ot=="function"&&dt(i),me&&typeof me.setStrictMode=="function")try{me.setStrictMode(J,i)}catch{}}var He=Math.clz32?Math.clz32:xr,Et=Math.log,kn=Math.LN2;function xr(i){return i>>>=0,i===0?32:31-(Et(i)/kn|0)|0}var on=256,Hn=4194304;function Rn(i){var o=i&42;if(o!==0)return o;switch(i&-i){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:case 262144:case 524288:case 1048576:case 2097152:return i&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function ln(i,o,d){var m=i.pendingLanes;if(m===0)return 0;var v=0,b=i.suspendedLanes,O=i.pingedLanes;i=i.warmLanes;var $=m&134217727;return $!==0?(m=$&~b,m!==0?v=Rn(m):(O&=$,O!==0?v=Rn(O):d||(d=$&~i,d!==0&&(v=Rn(d))))):($=m&~b,$!==0?v=Rn($):O!==0?v=Rn(O):d||(d=m&~i,d!==0&&(v=Rn(d)))),v===0?0:o!==0&&o!==v&&(o&b)===0&&(b=v&-v,d=o&-o,b>=d||b===32&&(d&4194048)!==0)?o:v}function Sn(i,o){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&o)===0}function $n(i,o){switch(i){case 1:case 2:case 4:case 8:case 64:return o+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 o+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 ps(){var i=on;return on<<=1,(on&4194048)===0&&(on=256),i}function gs(){var i=Hn;return Hn<<=1,(Hn&62914560)===0&&(Hn=4194304),i}function Zi(i){for(var o=[],d=0;31>d;d++)o.push(i);return o}function ci(i,o){i.pendingLanes|=o,o!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function vs(i,o,d,m,v,b){var O=i.pendingLanes;i.pendingLanes=d,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=d,i.entangledLanes&=d,i.errorRecoveryDisabledLanes&=d,i.shellSuspendCounter=0;var $=i.entanglements,Y=i.expirationTimes,ee=i.hiddenUpdates;for(d=O&~d;0<d;){var oe=31-He(d),fe=1<<oe;$[oe]=0,Y[oe]=-1;var te=ee[oe];if(te!==null)for(ee[oe]=null,oe=0;oe<te.length;oe++){var re=te[oe];re!==null&&(re.lane&=-536870913)}d&=~fe}m!==0&&xs(i,m,0),b!==0&&v===0&&i.tag!==0&&(i.suspendedLanes|=b&~(O&~o))}function xs(i,o,d){i.pendingLanes|=o,i.suspendedLanes&=~o;var m=31-He(o);i.entangledLanes|=o,i.entanglements[m]=i.entanglements[m]|1073741824|d&4194090}function Wi(i,o){var d=i.entangledLanes|=o;for(i=i.entanglements;d;){var m=31-He(d),v=1<<m;v&o|i[m]&o&&(i[m]|=o),d&=~v}}function ys(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function de(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Te(){var i=V.p;return i!==0?i:(i=window.event,i===void 0?32:Zk(i.type))}function it(i,o){var d=V.p;try{return V.p=i,o()}finally{V.p=d}}var et=Math.random().toString(36).slice(2),We="__reactFiber$"+et,ft="__reactProps$"+et,Kt="__reactContainer$"+et,zn="__reactEvents$"+et,Wn="__reactListeners$"+et,cn="__reactHandles$"+et,ui="__reactResources$"+et,mn="__reactMarker$"+et;function Go(i){delete i[We],delete i[ft],delete i[zn],delete i[Wn],delete i[cn]}function di(i){var o=i[We];if(o)return o;for(var d=i.parentNode;d;){if(o=d[Kt]||d[We]){if(d=o.alternate,o.child!==null||d!==null&&d.child!==null)for(i=Dk(i);i!==null;){if(d=i[We])return d;i=Dk(i)}return o}i=d,d=i.parentNode}return null}function zs(i){if(i=i[We]||i[Kt]){var o=i.tag;if(o===5||o===6||o===13||o===26||o===27||o===3)return i}return null}function Fs(i){var o=i.tag;if(o===5||o===26||o===27||o===6)return i.stateNode;throw Error(r(33))}function Bs(i){var o=i[ui];return o||(o=i[ui]={hoistableStyles:new Map,hoistableScripts:new Map}),o}function un(i){i[mn]=!0}var Jd=new Set,xe={};function je(i,o){Tt(i,o),Tt(i+"Capture",o)}function Tt(i,o){for(xe[i]=o,i=0;i<o.length;i++)Jd.add(o[i])}var pn=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]*$"),dn={},Qi={};function Pp(i){return _e.call(Qi,i)?!0:_e.call(dn,i)?!1:pn.test(i)?Qi[i]=!0:(dn[i]=!0,!1)}function ef(i,o,d){if(Pp(o))if(d===null)i.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":i.removeAttribute(o);return;case"boolean":var m=o.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){i.removeAttribute(o);return}}i.setAttribute(o,""+d)}}function tf(i,o,d){if(d===null)i.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(o);return}i.setAttribute(o,""+d)}}function fi(i,o,d,m){if(m===null)i.removeAttribute(d);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(d);return}i.setAttributeNS(o,d,""+m)}}var $p,_w;function Zo(i){if($p===void 0)try{throw Error()}catch(d){var o=d.stack.trim().match(/\n( *(at )?)/);$p=o&&o[1]||"",_w=-1<d.stack.indexOf(`
|
|
18
|
-
at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
19
|
-
`+$p+i+_w}var zp=!1;function Fp(i,o){if(!i||zp)return"";zp=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(o){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(re){var te=re}Reflect.construct(i,[],fe)}else{try{fe.call()}catch(re){te=re}i.call(fe.prototype)}}else{try{throw Error()}catch(re){te=re}(fe=i())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(re){if(re&&te&&typeof re.stack=="string")return[re.stack,te.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=m.DetermineComponentFrameRoot(),O=b[0],$=b[1];if(O&&$){var Y=O.split(`
|
|
20
|
-
`),ee=$.split(`
|
|
21
|
-
`);for(v=m=0;m<Y.length&&!Y[m].includes("DetermineComponentFrameRoot");)m++;for(;v<ee.length&&!ee[v].includes("DetermineComponentFrameRoot");)v++;if(m===Y.length||v===ee.length)for(m=Y.length-1,v=ee.length-1;1<=m&&0<=v&&Y[m]!==ee[v];)v--;for(;1<=m&&0<=v;m--,v--)if(Y[m]!==ee[v]){if(m!==1||v!==1)do if(m--,v--,0>v||Y[m]!==ee[v]){var oe=`
|
|
22
|
-
`+Y[m].replace(" at new "," at ");return i.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",i.displayName)),oe}while(1<=m&&0<=v);break}}}finally{zp=!1,Error.prepareStackTrace=d}return(d=i?i.displayName||i.name:"")?Zo(d):""}function vM(i){switch(i.tag){case 26:case 27:case 5:return Zo(i.type);case 16:return Zo("Lazy");case 13:return Zo("Suspense");case 19:return Zo("SuspenseList");case 0:case 15:return Fp(i.type,!1);case 11:return Fp(i.type.render,!1);case 1:return Fp(i.type,!0);case 31:return Zo("Activity");default:return""}}function kw(i){try{var o="";do o+=vM(i),i=i.return;while(i);return o}catch(d){return`
|
|
23
|
-
Error generating stack: `+d.message+`
|
|
24
|
-
`+d.stack}}function Gr(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Sw(i){var o=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function xM(i){var o=Sw(i)?"checked":"value",d=Object.getOwnPropertyDescriptor(i.constructor.prototype,o),m=""+i[o];if(!i.hasOwnProperty(o)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,b=d.set;return Object.defineProperty(i,o,{configurable:!0,get:function(){return v.call(this)},set:function(O){m=""+O,b.call(this,O)}}),Object.defineProperty(i,o,{enumerable:d.enumerable}),{getValue:function(){return m},setValue:function(O){m=""+O},stopTracking:function(){i._valueTracker=null,delete i[o]}}}}function nf(i){i._valueTracker||(i._valueTracker=xM(i))}function jw(i){if(!i)return!1;var o=i._valueTracker;if(!o)return!0;var d=o.getValue(),m="";return i&&(m=Sw(i)?i.checked?"true":"false":i.value),i=m,i!==d?(o.setValue(i),!0):!1}function rf(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var yM=/[\n"\\]/g;function Zr(i){return i.replace(yM,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function Bp(i,o,d,m,v,b,O,$){i.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?i.type=O:i.removeAttribute("type"),o!=null?O==="number"?(o===0&&i.value===""||i.value!=o)&&(i.value=""+Gr(o)):i.value!==""+Gr(o)&&(i.value=""+Gr(o)):O!=="submit"&&O!=="reset"||i.removeAttribute("value"),o!=null?Up(i,O,Gr(o)):d!=null?Up(i,O,Gr(d)):m!=null&&i.removeAttribute("value"),v==null&&b!=null&&(i.defaultChecked=!!b),v!=null&&(i.checked=v&&typeof v!="function"&&typeof v!="symbol"),$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?i.name=""+Gr($):i.removeAttribute("name")}function Nw(i,o,d,m,v,b,O,$){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(i.type=b),o!=null||d!=null){if(!(b!=="submit"&&b!=="reset"||o!=null))return;d=d!=null?""+Gr(d):"",o=o!=null?""+Gr(o):d,$||o===i.value||(i.value=o),i.defaultValue=o}m=m??v,m=typeof m!="function"&&typeof m!="symbol"&&!!m,i.checked=$?i.checked:!!m,i.defaultChecked=!!m,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(i.name=O)}function Up(i,o,d){o==="number"&&rf(i.ownerDocument)===i||i.defaultValue===""+d||(i.defaultValue=""+d)}function Wo(i,o,d,m){if(i=i.options,o){o={};for(var v=0;v<d.length;v++)o["$"+d[v]]=!0;for(d=0;d<i.length;d++)v=o.hasOwnProperty("$"+i[d].value),i[d].selected!==v&&(i[d].selected=v),v&&m&&(i[d].defaultSelected=!0)}else{for(d=""+Gr(d),o=null,v=0;v<i.length;v++){if(i[v].value===d){i[v].selected=!0,m&&(i[v].defaultSelected=!0);return}o!==null||i[v].disabled||(o=i[v])}o!==null&&(o.selected=!0)}}function Cw(i,o,d){if(o!=null&&(o=""+Gr(o),o!==i.value&&(i.value=o),d==null)){i.defaultValue!==o&&(i.defaultValue=o);return}i.defaultValue=d!=null?""+Gr(d):""}function Ew(i,o,d,m){if(o==null){if(m!=null){if(d!=null)throw Error(r(92));if(F(m)){if(1<m.length)throw Error(r(93));m=m[0]}d=m}d==null&&(d=""),o=d}d=Gr(o),i.defaultValue=d,m=i.textContent,m===d&&m!==""&&m!==null&&(i.value=m)}function Qo(i,o){if(o){var d=i.firstChild;if(d&&d===i.lastChild&&d.nodeType===3){d.nodeValue=o;return}}i.textContent=o}var bM=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 Tw(i,o,d){var m=o.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?m?i.setProperty(o,""):o==="float"?i.cssFloat="":i[o]="":m?i.setProperty(o,d):typeof d!="number"||d===0||bM.has(o)?o==="float"?i.cssFloat=d:i[o]=(""+d).trim():i[o]=d+"px"}function Aw(i,o,d){if(o!=null&&typeof o!="object")throw Error(r(62));if(i=i.style,d!=null){for(var m in d)!d.hasOwnProperty(m)||o!=null&&o.hasOwnProperty(m)||(m.indexOf("--")===0?i.setProperty(m,""):m==="float"?i.cssFloat="":i[m]="");for(var v in o)m=o[v],o.hasOwnProperty(v)&&d[v]!==m&&Tw(i,v,m)}else for(var b in o)o.hasOwnProperty(b)&&Tw(i,b,o[b])}function qp(i){if(i.indexOf("-")===-1)return!1;switch(i){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 wM=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"]]),_M=/^[\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 sf(i){return _M.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}var Hp=null;function Vp(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Xo=null,Jo=null;function Ow(i){var o=zs(i);if(o&&(i=o.stateNode)){var d=i[ft]||null;e:switch(i=o.stateNode,o.type){case"input":if(Bp(i,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),o=d.name,d.type==="radio"&&o!=null){for(d=i;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+Zr(""+o)+'"][type="radio"]'),o=0;o<d.length;o++){var m=d[o];if(m!==i&&m.form===i.form){var v=m[ft]||null;if(!v)throw Error(r(90));Bp(m,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(o=0;o<d.length;o++)m=d[o],m.form===i.form&&jw(m)}break e;case"textarea":Cw(i,d.value,d.defaultValue);break e;case"select":o=d.value,o!=null&&Wo(i,!!d.multiple,o,!1)}}}var Kp=!1;function Rw(i,o,d){if(Kp)return i(o,d);Kp=!0;try{var m=i(o);return m}finally{if(Kp=!1,(Xo!==null||Jo!==null)&&(Hf(),Xo&&(o=Xo,i=Jo,Jo=Xo=null,Ow(o),i)))for(o=0;o<i.length;o++)Ow(i[o])}}function Fc(i,o){var d=i.stateNode;if(d===null)return null;var m=d[ft]||null;if(m===null)return null;d=m[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(i=i.type,m=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!m;break e;default:i=!1}if(i)return null;if(d&&typeof d!="function")throw Error(r(231,o,typeof d));return d}var hi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yp=!1;if(hi)try{var Bc={};Object.defineProperty(Bc,"passive",{get:function(){Yp=!0}}),window.addEventListener("test",Bc,Bc),window.removeEventListener("test",Bc,Bc)}catch{Yp=!1}var Xi=null,Gp=null,af=null;function Mw(){if(af)return af;var i,o=Gp,d=o.length,m,v="value"in Xi?Xi.value:Xi.textContent,b=v.length;for(i=0;i<d&&o[i]===v[i];i++);var O=d-i;for(m=1;m<=O&&o[d-m]===v[b-m];m++);return af=v.slice(i,1<m?1-m:void 0)}function of(i){var o=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&o===13&&(i=13)):i=o,i===10&&(i=13),32<=i||i===13?i:0}function lf(){return!0}function Dw(){return!1}function yr(i){function o(d,m,v,b,O){this._reactName=d,this._targetInst=v,this.type=m,this.nativeEvent=b,this.target=O,this.currentTarget=null;for(var $ in i)i.hasOwnProperty($)&&(d=i[$],this[$]=d?d(b):b[$]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?lf:Dw,this.isPropagationStopped=Dw,this}return g(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=lf)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=lf)},persist:function(){},isPersistent:lf}),o}var Qa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},cf=yr(Qa),Uc=g({},Qa,{view:0,detail:0}),kM=yr(Uc),Zp,Wp,qc,uf=g({},Uc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xp,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==qc&&(qc&&i.type==="mousemove"?(Zp=i.screenX-qc.screenX,Wp=i.screenY-qc.screenY):Wp=Zp=0,qc=i),Zp)},movementY:function(i){return"movementY"in i?i.movementY:Wp}}),Iw=yr(uf),SM=g({},uf,{dataTransfer:0}),jM=yr(SM),NM=g({},Uc,{relatedTarget:0}),Qp=yr(NM),CM=g({},Qa,{animationName:0,elapsedTime:0,pseudoElement:0}),EM=yr(CM),TM=g({},Qa,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),AM=yr(TM),OM=g({},Qa,{data:0}),Lw=yr(OM),RM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},MM={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"},DM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function IM(i){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(i):(i=DM[i])?!!o[i]:!1}function Xp(){return IM}var LM=g({},Uc,{key:function(i){if(i.key){var o=RM[i.key]||i.key;if(o!=="Unidentified")return o}return i.type==="keypress"?(i=of(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?MM[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xp,charCode:function(i){return i.type==="keypress"?of(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?of(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),PM=yr(LM),$M=g({},uf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Pw=yr($M),zM=g({},Uc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xp}),FM=yr(zM),BM=g({},Qa,{propertyName:0,elapsedTime:0,pseudoElement:0}),UM=yr(BM),qM=g({},uf,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),HM=yr(qM),VM=g({},Qa,{newState:0,oldState:0}),KM=yr(VM),YM=[9,13,27,32],Jp=hi&&"CompositionEvent"in window,Hc=null;hi&&"documentMode"in document&&(Hc=document.documentMode);var GM=hi&&"TextEvent"in window&&!Hc,$w=hi&&(!Jp||Hc&&8<Hc&&11>=Hc),zw=" ",Fw=!1;function Bw(i,o){switch(i){case"keyup":return YM.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Uw(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var el=!1;function ZM(i,o){switch(i){case"compositionend":return Uw(o);case"keypress":return o.which!==32?null:(Fw=!0,zw);case"textInput":return i=o.data,i===zw&&Fw?null:i;default:return null}}function WM(i,o){if(el)return i==="compositionend"||!Jp&&Bw(i,o)?(i=Mw(),af=Gp=Xi=null,el=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return $w&&o.locale!=="ko"?null:o.data;default:return null}}var QM={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 qw(i){var o=i&&i.nodeName&&i.nodeName.toLowerCase();return o==="input"?!!QM[i.type]:o==="textarea"}function Hw(i,o,d,m){Xo?Jo?Jo.push(m):Jo=[m]:Xo=m,o=Wf(o,"onChange"),0<o.length&&(d=new cf("onChange","change",null,d,m),i.push({event:d,listeners:o}))}var Vc=null,Kc=null;function XM(i){Sk(i,0)}function df(i){var o=Fs(i);if(jw(o))return i}function Vw(i,o){if(i==="change")return o}var Kw=!1;if(hi){var eg;if(hi){var tg="oninput"in document;if(!tg){var Yw=document.createElement("div");Yw.setAttribute("oninput","return;"),tg=typeof Yw.oninput=="function"}eg=tg}else eg=!1;Kw=eg&&(!document.documentMode||9<document.documentMode)}function Gw(){Vc&&(Vc.detachEvent("onpropertychange",Zw),Kc=Vc=null)}function Zw(i){if(i.propertyName==="value"&&df(Kc)){var o=[];Hw(o,Kc,i,Vp(i)),Rw(XM,o)}}function JM(i,o,d){i==="focusin"?(Gw(),Vc=o,Kc=d,Vc.attachEvent("onpropertychange",Zw)):i==="focusout"&&Gw()}function e4(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return df(Kc)}function t4(i,o){if(i==="click")return df(o)}function n4(i,o){if(i==="input"||i==="change")return df(o)}function r4(i,o){return i===o&&(i!==0||1/i===1/o)||i!==i&&o!==o}var Rr=typeof Object.is=="function"?Object.is:r4;function Yc(i,o){if(Rr(i,o))return!0;if(typeof i!="object"||i===null||typeof o!="object"||o===null)return!1;var d=Object.keys(i),m=Object.keys(o);if(d.length!==m.length)return!1;for(m=0;m<d.length;m++){var v=d[m];if(!_e.call(o,v)||!Rr(i[v],o[v]))return!1}return!0}function Ww(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Qw(i,o){var d=Ww(i);i=0;for(var m;d;){if(d.nodeType===3){if(m=i+d.textContent.length,i<=o&&m>=o)return{node:d,offset:o-i};i=m}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Ww(d)}}function Xw(i,o){return i&&o?i===o?!0:i&&i.nodeType===3?!1:o&&o.nodeType===3?Xw(i,o.parentNode):"contains"in i?i.contains(o):i.compareDocumentPosition?!!(i.compareDocumentPosition(o)&16):!1:!1}function Jw(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var o=rf(i.document);o instanceof i.HTMLIFrameElement;){try{var d=typeof o.contentWindow.location.href=="string"}catch{d=!1}if(d)i=o.contentWindow;else break;o=rf(i.document)}return o}function ng(i){var o=i&&i.nodeName&&i.nodeName.toLowerCase();return o&&(o==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||o==="textarea"||i.contentEditable==="true")}var s4=hi&&"documentMode"in document&&11>=document.documentMode,tl=null,rg=null,Gc=null,sg=!1;function e1(i,o,d){var m=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;sg||tl==null||tl!==rf(m)||(m=tl,"selectionStart"in m&&ng(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Gc&&Yc(Gc,m)||(Gc=m,m=Wf(rg,"onSelect"),0<m.length&&(o=new cf("onSelect","select",null,o,d),i.push({event:o,listeners:m}),o.target=tl)))}function Xa(i,o){var d={};return d[i.toLowerCase()]=o.toLowerCase(),d["Webkit"+i]="webkit"+o,d["Moz"+i]="moz"+o,d}var nl={animationend:Xa("Animation","AnimationEnd"),animationiteration:Xa("Animation","AnimationIteration"),animationstart:Xa("Animation","AnimationStart"),transitionrun:Xa("Transition","TransitionRun"),transitionstart:Xa("Transition","TransitionStart"),transitioncancel:Xa("Transition","TransitionCancel"),transitionend:Xa("Transition","TransitionEnd")},ig={},t1={};hi&&(t1=document.createElement("div").style,"AnimationEvent"in window||(delete nl.animationend.animation,delete nl.animationiteration.animation,delete nl.animationstart.animation),"TransitionEvent"in window||delete nl.transitionend.transition);function Ja(i){if(ig[i])return ig[i];if(!nl[i])return i;var o=nl[i],d;for(d in o)if(o.hasOwnProperty(d)&&d in t1)return ig[i]=o[d];return i}var n1=Ja("animationend"),r1=Ja("animationiteration"),s1=Ja("animationstart"),i4=Ja("transitionrun"),a4=Ja("transitionstart"),o4=Ja("transitioncancel"),i1=Ja("transitionend"),a1=new Map,ag="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(" ");ag.push("scrollEnd");function bs(i,o){a1.set(i,o),je(o,[i])}var o1=new WeakMap;function Wr(i,o){if(typeof i=="object"&&i!==null){var d=o1.get(i);return d!==void 0?d:(o={value:i,source:o,stack:kw(o)},o1.set(i,o),o)}return{value:i,source:o,stack:kw(o)}}var Qr=[],rl=0,og=0;function ff(){for(var i=rl,o=og=rl=0;o<i;){var d=Qr[o];Qr[o++]=null;var m=Qr[o];Qr[o++]=null;var v=Qr[o];Qr[o++]=null;var b=Qr[o];if(Qr[o++]=null,m!==null&&v!==null){var O=m.pending;O===null?v.next=v:(v.next=O.next,O.next=v),m.pending=v}b!==0&&l1(d,v,b)}}function hf(i,o,d,m){Qr[rl++]=i,Qr[rl++]=o,Qr[rl++]=d,Qr[rl++]=m,og|=m,i.lanes|=m,i=i.alternate,i!==null&&(i.lanes|=m)}function lg(i,o,d,m){return hf(i,o,d,m),mf(i)}function sl(i,o){return hf(i,null,null,o),mf(i)}function l1(i,o,d){i.lanes|=d;var m=i.alternate;m!==null&&(m.lanes|=d);for(var v=!1,b=i.return;b!==null;)b.childLanes|=d,m=b.alternate,m!==null&&(m.childLanes|=d),b.tag===22&&(i=b.stateNode,i===null||i._visibility&1||(v=!0)),i=b,b=b.return;return i.tag===3?(b=i.stateNode,v&&o!==null&&(v=31-He(d),i=b.hiddenUpdates,m=i[v],m===null?i[v]=[o]:m.push(o),o.lane=d|536870912),b):null}function mf(i){if(50<yu)throw yu=0,mv=null,Error(r(185));for(var o=i.return;o!==null;)i=o,o=i.return;return i.tag===3?i.stateNode:null}var il={};function l4(i,o,d,m){this.tag=i,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mr(i,o,d,m){return new l4(i,o,d,m)}function cg(i){return i=i.prototype,!(!i||!i.isReactComponent)}function mi(i,o){var d=i.alternate;return d===null?(d=Mr(i.tag,o,i.key,i.mode),d.elementType=i.elementType,d.type=i.type,d.stateNode=i.stateNode,d.alternate=i,i.alternate=d):(d.pendingProps=o,d.type=i.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=i.flags&65011712,d.childLanes=i.childLanes,d.lanes=i.lanes,d.child=i.child,d.memoizedProps=i.memoizedProps,d.memoizedState=i.memoizedState,d.updateQueue=i.updateQueue,o=i.dependencies,d.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},d.sibling=i.sibling,d.index=i.index,d.ref=i.ref,d.refCleanup=i.refCleanup,d}function c1(i,o){i.flags&=65011714;var d=i.alternate;return d===null?(i.childLanes=0,i.lanes=o,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=d.childLanes,i.lanes=d.lanes,i.child=d.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=d.memoizedProps,i.memoizedState=d.memoizedState,i.updateQueue=d.updateQueue,i.type=d.type,o=d.dependencies,i.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),i}function pf(i,o,d,m,v,b){var O=0;if(m=i,typeof i=="function")cg(i)&&(O=1);else if(typeof i=="string")O=u3(i,d,pe.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case z:return i=Mr(31,d,o,v),i.elementType=z,i.lanes=b,i;case k:return eo(d.children,v,b,o);case w:O=8,v|=24;break;case S:return i=Mr(12,d,o,v|2),i.elementType=S,i.lanes=b,i;case I:return i=Mr(13,d,o,v),i.elementType=I,i.lanes=b,i;case T:return i=Mr(19,d,o,v),i.elementType=T,i.lanes=b,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case N:case j:O=10;break e;case C:O=9;break e;case A:O=11;break e;case E:O=14;break e;case R:O=16,m=null;break e}O=29,d=Error(r(130,i===null?"null":typeof i,"")),m=null}return o=Mr(O,d,o,v),o.elementType=i,o.type=m,o.lanes=b,o}function eo(i,o,d,m){return i=Mr(7,i,m,o),i.lanes=d,i}function ug(i,o,d){return i=Mr(6,i,null,o),i.lanes=d,i}function dg(i,o,d){return o=Mr(4,i.children!==null?i.children:[],i.key,o),o.lanes=d,o.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},o}var al=[],ol=0,gf=null,vf=0,Xr=[],Jr=0,to=null,pi=1,gi="";function no(i,o){al[ol++]=vf,al[ol++]=gf,gf=i,vf=o}function u1(i,o,d){Xr[Jr++]=pi,Xr[Jr++]=gi,Xr[Jr++]=to,to=i;var m=pi;i=gi;var v=32-He(m)-1;m&=~(1<<v),d+=1;var b=32-He(o)+v;if(30<b){var O=v-v%5;b=(m&(1<<O)-1).toString(32),m>>=O,v-=O,pi=1<<32-He(o)+v|d<<v|m,gi=b+i}else pi=1<<b|d<<v|m,gi=i}function fg(i){i.return!==null&&(no(i,1),u1(i,1,0))}function hg(i){for(;i===gf;)gf=al[--ol],al[ol]=null,vf=al[--ol],al[ol]=null;for(;i===to;)to=Xr[--Jr],Xr[Jr]=null,gi=Xr[--Jr],Xr[Jr]=null,pi=Xr[--Jr],Xr[Jr]=null}var cr=null,fn=null,Pt=!1,ro=null,Us=!1,mg=Error(r(519));function so(i){var o=Error(r(418,""));throw Qc(Wr(o,i)),mg}function d1(i){var o=i.stateNode,d=i.type,m=i.memoizedProps;switch(o[We]=i,o[ft]=m,d){case"dialog":kt("cancel",o),kt("close",o);break;case"iframe":case"object":case"embed":kt("load",o);break;case"video":case"audio":for(d=0;d<wu.length;d++)kt(wu[d],o);break;case"source":kt("error",o);break;case"img":case"image":case"link":kt("error",o),kt("load",o);break;case"details":kt("toggle",o);break;case"input":kt("invalid",o),Nw(o,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0),nf(o);break;case"select":kt("invalid",o);break;case"textarea":kt("invalid",o),Ew(o,m.value,m.defaultValue,m.children),nf(o)}d=m.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||o.textContent===""+d||m.suppressHydrationWarning===!0||Ek(o.textContent,d)?(m.popover!=null&&(kt("beforetoggle",o),kt("toggle",o)),m.onScroll!=null&&kt("scroll",o),m.onScrollEnd!=null&&kt("scrollend",o),m.onClick!=null&&(o.onclick=Qf),o=!0):o=!1,o||so(i)}function f1(i){for(cr=i.return;cr;)switch(cr.tag){case 5:case 13:Us=!1;return;case 27:case 3:Us=!0;return;default:cr=cr.return}}function Zc(i){if(i!==cr)return!1;if(!Pt)return f1(i),Pt=!0,!1;var o=i.tag,d;if((d=o!==3&&o!==27)&&((d=o===5)&&(d=i.type,d=!(d!=="form"&&d!=="button")||Av(i.type,i.memoizedProps)),d=!d),d&&fn&&so(i),f1(i),o===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));e:{for(i=i.nextSibling,o=0;i;){if(i.nodeType===8)if(d=i.data,d==="/$"){if(o===0){fn=_s(i.nextSibling);break e}o--}else d!=="$"&&d!=="$!"&&d!=="$?"||o++;i=i.nextSibling}fn=null}}else o===27?(o=fn,ma(i.type)?(i=Dv,Dv=null,fn=i):fn=o):fn=cr?_s(i.stateNode.nextSibling):null;return!0}function Wc(){fn=cr=null,Pt=!1}function h1(){var i=ro;return i!==null&&(_r===null?_r=i:_r.push.apply(_r,i),ro=null),i}function Qc(i){ro===null?ro=[i]:ro.push(i)}var pg=ne(null),io=null,vi=null;function Ji(i,o,d){P(pg,o._currentValue),o._currentValue=d}function xi(i){i._currentValue=pg.current,ie(pg)}function gg(i,o,d){for(;i!==null;){var m=i.alternate;if((i.childLanes&o)!==o?(i.childLanes|=o,m!==null&&(m.childLanes|=o)):m!==null&&(m.childLanes&o)!==o&&(m.childLanes|=o),i===d)break;i=i.return}}function vg(i,o,d,m){var v=i.child;for(v!==null&&(v.return=i);v!==null;){var b=v.dependencies;if(b!==null){var O=v.child;b=b.firstContext;e:for(;b!==null;){var $=b;b=v;for(var Y=0;Y<o.length;Y++)if($.context===o[Y]){b.lanes|=d,$=b.alternate,$!==null&&($.lanes|=d),gg(b.return,d,i),m||(O=null);break e}b=$.next}}else if(v.tag===18){if(O=v.return,O===null)throw Error(r(341));O.lanes|=d,b=O.alternate,b!==null&&(b.lanes|=d),gg(O,d,i),O=null}else O=v.child;if(O!==null)O.return=v;else for(O=v;O!==null;){if(O===i){O=null;break}if(v=O.sibling,v!==null){v.return=O.return,O=v;break}O=O.return}v=O}}function Xc(i,o,d,m){i=null;for(var v=o,b=!1;v!==null;){if(!b){if((v.flags&524288)!==0)b=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var O=v.alternate;if(O===null)throw Error(r(387));if(O=O.memoizedProps,O!==null){var $=v.type;Rr(v.pendingProps.value,O.value)||(i!==null?i.push($):i=[$])}}else if(v===ge.current){if(O=v.alternate,O===null)throw Error(r(387));O.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(i!==null?i.push(Cu):i=[Cu])}v=v.return}i!==null&&vg(o,i,d,m),o.flags|=262144}function xf(i){for(i=i.firstContext;i!==null;){if(!Rr(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function ao(i){io=i,vi=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Qn(i){return m1(io,i)}function yf(i,o){return io===null&&ao(i),m1(i,o)}function m1(i,o){var d=o._currentValue;if(o={context:o,memoizedValue:d,next:null},vi===null){if(i===null)throw Error(r(308));vi=o,i.dependencies={lanes:0,firstContext:o},i.flags|=524288}else vi=vi.next=o;return d}var c4=typeof AbortController<"u"?AbortController:function(){var i=[],o=this.signal={aborted:!1,addEventListener:function(d,m){i.push(m)}};this.abort=function(){o.aborted=!0,i.forEach(function(d){return d()})}},u4=t.unstable_scheduleCallback,d4=t.unstable_NormalPriority,Mn={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function xg(){return{controller:new c4,data:new Map,refCount:0}}function Jc(i){i.refCount--,i.refCount===0&&u4(d4,function(){i.controller.abort()})}var eu=null,yg=0,ll=0,cl=null;function f4(i,o){if(eu===null){var d=eu=[];yg=0,ll=wv(),cl={status:"pending",value:void 0,then:function(m){d.push(m)}}}return yg++,o.then(p1,p1),o}function p1(){if(--yg===0&&eu!==null){cl!==null&&(cl.status="fulfilled");var i=eu;eu=null,ll=0,cl=null;for(var o=0;o<i.length;o++)(0,i[o])()}}function h4(i,o){var d=[],m={status:"pending",value:null,reason:null,then:function(v){d.push(v)}};return i.then(function(){m.status="fulfilled",m.value=o;for(var v=0;v<d.length;v++)(0,d[v])(o)},function(v){for(m.status="rejected",m.reason=v,v=0;v<d.length;v++)(0,d[v])(void 0)}),m}var g1=M.S;M.S=function(i,o){typeof o=="object"&&o!==null&&typeof o.then=="function"&&f4(i,o),g1!==null&&g1(i,o)};var oo=ne(null);function bg(){var i=oo.current;return i!==null?i:Zt.pooledCache}function bf(i,o){o===null?P(oo,oo.current):P(oo,o.pool)}function v1(){var i=bg();return i===null?null:{parent:Mn._currentValue,pool:i}}var tu=Error(r(460)),x1=Error(r(474)),wf=Error(r(542)),wg={then:function(){}};function y1(i){return i=i.status,i==="fulfilled"||i==="rejected"}function _f(){}function b1(i,o,d){switch(d=i[d],d===void 0?i.push(o):d!==o&&(o.then(_f,_f),o=d),o.status){case"fulfilled":return o.value;case"rejected":throw i=o.reason,_1(i),i;default:if(typeof o.status=="string")o.then(_f,_f);else{if(i=Zt,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=o,i.status="pending",i.then(function(m){if(o.status==="pending"){var v=o;v.status="fulfilled",v.value=m}},function(m){if(o.status==="pending"){var v=o;v.status="rejected",v.reason=m}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw i=o.reason,_1(i),i}throw nu=o,tu}}var nu=null;function w1(){if(nu===null)throw Error(r(459));var i=nu;return nu=null,i}function _1(i){if(i===tu||i===wf)throw Error(r(483))}var ea=!1;function _g(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function kg(i,o){i=i.updateQueue,o.updateQueue===i&&(o.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function ta(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function na(i,o,d){var m=i.updateQueue;if(m===null)return null;if(m=m.shared,(zt&2)!==0){var v=m.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),m.pending=o,o=mf(i),l1(i,null,d),o}return hf(i,m,o,d),mf(i)}function ru(i,o,d){if(o=o.updateQueue,o!==null&&(o=o.shared,(d&4194048)!==0)){var m=o.lanes;m&=i.pendingLanes,d|=m,o.lanes=d,Wi(i,d)}}function Sg(i,o){var d=i.updateQueue,m=i.alternate;if(m!==null&&(m=m.updateQueue,d===m)){var v=null,b=null;if(d=d.firstBaseUpdate,d!==null){do{var O={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};b===null?v=b=O:b=b.next=O,d=d.next}while(d!==null);b===null?v=b=o:b=b.next=o}else v=b=o;d={baseState:m.baseState,firstBaseUpdate:v,lastBaseUpdate:b,shared:m.shared,callbacks:m.callbacks},i.updateQueue=d;return}i=d.lastBaseUpdate,i===null?d.firstBaseUpdate=o:i.next=o,d.lastBaseUpdate=o}var jg=!1;function su(){if(jg){var i=cl;if(i!==null)throw i}}function iu(i,o,d,m){jg=!1;var v=i.updateQueue;ea=!1;var b=v.firstBaseUpdate,O=v.lastBaseUpdate,$=v.shared.pending;if($!==null){v.shared.pending=null;var Y=$,ee=Y.next;Y.next=null,O===null?b=ee:O.next=ee,O=Y;var oe=i.alternate;oe!==null&&(oe=oe.updateQueue,$=oe.lastBaseUpdate,$!==O&&($===null?oe.firstBaseUpdate=ee:$.next=ee,oe.lastBaseUpdate=Y))}if(b!==null){var fe=v.baseState;O=0,oe=ee=Y=null,$=b;do{var te=$.lane&-536870913,re=te!==$.lane;if(re?(At&te)===te:(m&te)===te){te!==0&&te===ll&&(jg=!0),oe!==null&&(oe=oe.next={lane:0,tag:$.tag,payload:$.payload,callback:null,next:null});e:{var at=i,tt=$;te=o;var Ht=d;switch(tt.tag){case 1:if(at=tt.payload,typeof at=="function"){fe=at.call(Ht,fe,te);break e}fe=at;break e;case 3:at.flags=at.flags&-65537|128;case 0:if(at=tt.payload,te=typeof at=="function"?at.call(Ht,fe,te):at,te==null)break e;fe=g({},fe,te);break e;case 2:ea=!0}}te=$.callback,te!==null&&(i.flags|=64,re&&(i.flags|=8192),re=v.callbacks,re===null?v.callbacks=[te]:re.push(te))}else re={lane:te,tag:$.tag,payload:$.payload,callback:$.callback,next:null},oe===null?(ee=oe=re,Y=fe):oe=oe.next=re,O|=te;if($=$.next,$===null){if($=v.shared.pending,$===null)break;re=$,$=re.next,re.next=null,v.lastBaseUpdate=re,v.shared.pending=null}}while(!0);oe===null&&(Y=fe),v.baseState=Y,v.firstBaseUpdate=ee,v.lastBaseUpdate=oe,b===null&&(v.shared.lanes=0),ua|=O,i.lanes=O,i.memoizedState=fe}}function k1(i,o){if(typeof i!="function")throw Error(r(191,i));i.call(o)}function S1(i,o){var d=i.callbacks;if(d!==null)for(i.callbacks=null,i=0;i<d.length;i++)k1(d[i],o)}var ul=ne(null),kf=ne(0);function j1(i,o){i=ji,P(kf,i),P(ul,o),ji=i|o.baseLanes}function Ng(){P(kf,ji),P(ul,ul.current)}function Cg(){ji=kf.current,ie(ul),ie(kf)}var ra=0,vt=null,Ut=null,jn=null,Sf=!1,dl=!1,lo=!1,jf=0,au=0,fl=null,m4=0;function gn(){throw Error(r(321))}function Eg(i,o){if(o===null)return!1;for(var d=0;d<o.length&&d<i.length;d++)if(!Rr(i[d],o[d]))return!1;return!0}function Tg(i,o,d,m,v,b){return ra=b,vt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,M.H=i===null||i.memoizedState===null?l_:c_,lo=!1,b=d(m,v),lo=!1,dl&&(b=C1(o,d,m,v)),N1(i),b}function N1(i){M.H=Of;var o=Ut!==null&&Ut.next!==null;if(ra=0,jn=Ut=vt=null,Sf=!1,au=0,fl=null,o)throw Error(r(300));i===null||Fn||(i=i.dependencies,i!==null&&xf(i)&&(Fn=!0))}function C1(i,o,d,m){vt=i;var v=0;do{if(dl&&(fl=null),au=0,dl=!1,25<=v)throw Error(r(301));if(v+=1,jn=Ut=null,i.updateQueue!=null){var b=i.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}M.H=w4,b=o(d,m)}while(dl);return b}function p4(){var i=M.H,o=i.useState()[0];return o=typeof o.then=="function"?ou(o):o,i=i.useState()[0],(Ut!==null?Ut.memoizedState:null)!==i&&(vt.flags|=1024),o}function Ag(){var i=jf!==0;return jf=0,i}function Og(i,o,d){o.updateQueue=i.updateQueue,o.flags&=-2053,i.lanes&=~d}function Rg(i){if(Sf){for(i=i.memoizedState;i!==null;){var o=i.queue;o!==null&&(o.pending=null),i=i.next}Sf=!1}ra=0,jn=Ut=vt=null,dl=!1,au=jf=0,fl=null}function br(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jn===null?vt.memoizedState=jn=i:jn=jn.next=i,jn}function Nn(){if(Ut===null){var i=vt.alternate;i=i!==null?i.memoizedState:null}else i=Ut.next;var o=jn===null?vt.memoizedState:jn.next;if(o!==null)jn=o,Ut=i;else{if(i===null)throw vt.alternate===null?Error(r(467)):Error(r(310));Ut=i,i={memoizedState:Ut.memoizedState,baseState:Ut.baseState,baseQueue:Ut.baseQueue,queue:Ut.queue,next:null},jn===null?vt.memoizedState=jn=i:jn=jn.next=i}return jn}function Mg(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ou(i){var o=au;return au+=1,fl===null&&(fl=[]),i=b1(fl,i,o),o=vt,(jn===null?o.memoizedState:jn.next)===null&&(o=o.alternate,M.H=o===null||o.memoizedState===null?l_:c_),i}function Nf(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return ou(i);if(i.$$typeof===j)return Qn(i)}throw Error(r(438,String(i)))}function Dg(i){var o=null,d=vt.updateQueue;if(d!==null&&(o=d.memoCache),o==null){var m=vt.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(o={data:m.data.map(function(v){return v.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),d===null&&(d=Mg(),vt.updateQueue=d),d.memoCache=o,d=o.data[o.index],d===void 0)for(d=o.data[o.index]=Array(i),m=0;m<i;m++)d[m]=D;return o.index++,d}function yi(i,o){return typeof o=="function"?o(i):o}function Cf(i){var o=Nn();return Ig(o,Ut,i)}function Ig(i,o,d){var m=i.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=d;var v=i.baseQueue,b=m.pending;if(b!==null){if(v!==null){var O=v.next;v.next=b.next,b.next=O}o.baseQueue=v=b,m.pending=null}if(b=i.baseState,v===null)i.memoizedState=b;else{o=v.next;var $=O=null,Y=null,ee=o,oe=!1;do{var fe=ee.lane&-536870913;if(fe!==ee.lane?(At&fe)===fe:(ra&fe)===fe){var te=ee.revertLane;if(te===0)Y!==null&&(Y=Y.next={lane:0,revertLane:0,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),fe===ll&&(oe=!0);else if((ra&te)===te){ee=ee.next,te===ll&&(oe=!0);continue}else fe={lane:0,revertLane:ee.revertLane,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},Y===null?($=Y=fe,O=b):Y=Y.next=fe,vt.lanes|=te,ua|=te;fe=ee.action,lo&&d(b,fe),b=ee.hasEagerState?ee.eagerState:d(b,fe)}else te={lane:fe,revertLane:ee.revertLane,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},Y===null?($=Y=te,O=b):Y=Y.next=te,vt.lanes|=fe,ua|=fe;ee=ee.next}while(ee!==null&&ee!==o);if(Y===null?O=b:Y.next=$,!Rr(b,i.memoizedState)&&(Fn=!0,oe&&(d=cl,d!==null)))throw d;i.memoizedState=b,i.baseState=O,i.baseQueue=Y,m.lastRenderedState=b}return v===null&&(m.lanes=0),[i.memoizedState,m.dispatch]}function Lg(i){var o=Nn(),d=o.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=i;var m=d.dispatch,v=d.pending,b=o.memoizedState;if(v!==null){d.pending=null;var O=v=v.next;do b=i(b,O.action),O=O.next;while(O!==v);Rr(b,o.memoizedState)||(Fn=!0),o.memoizedState=b,o.baseQueue===null&&(o.baseState=b),d.lastRenderedState=b}return[b,m]}function E1(i,o,d){var m=vt,v=Nn(),b=Pt;if(b){if(d===void 0)throw Error(r(407));d=d()}else d=o();var O=!Rr((Ut||v).memoizedState,d);O&&(v.memoizedState=d,Fn=!0),v=v.queue;var $=O1.bind(null,m,v,i);if(lu(2048,8,$,[i]),v.getSnapshot!==o||O||jn!==null&&jn.memoizedState.tag&1){if(m.flags|=2048,hl(9,Ef(),A1.bind(null,m,v,d,o),null),Zt===null)throw Error(r(349));b||(ra&124)!==0||T1(m,o,d)}return d}function T1(i,o,d){i.flags|=16384,i={getSnapshot:o,value:d},o=vt.updateQueue,o===null?(o=Mg(),vt.updateQueue=o,o.stores=[i]):(d=o.stores,d===null?o.stores=[i]:d.push(i))}function A1(i,o,d,m){o.value=d,o.getSnapshot=m,R1(o)&&M1(i)}function O1(i,o,d){return d(function(){R1(o)&&M1(i)})}function R1(i){var o=i.getSnapshot;i=i.value;try{var d=o();return!Rr(i,d)}catch{return!0}}function M1(i){var o=sl(i,2);o!==null&&$r(o,i,2)}function Pg(i){var o=br();if(typeof i=="function"){var d=i;if(i=d(),lo){Ae(!0);try{d()}finally{Ae(!1)}}}return o.memoizedState=o.baseState=i,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:yi,lastRenderedState:i},o}function D1(i,o,d,m){return i.baseState=d,Ig(i,Ut,typeof m=="function"?m:yi)}function g4(i,o,d,m,v){if(Af(i))throw Error(r(485));if(i=o.action,i!==null){var b={payload:v,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){b.listeners.push(O)}};M.T!==null?d(!0):b.isTransition=!1,m(b),d=o.pending,d===null?(b.next=o.pending=b,I1(o,b)):(b.next=d.next,o.pending=d.next=b)}}function I1(i,o){var d=o.action,m=o.payload,v=i.state;if(o.isTransition){var b=M.T,O={};M.T=O;try{var $=d(v,m),Y=M.S;Y!==null&&Y(O,$),L1(i,o,$)}catch(ee){$g(i,o,ee)}finally{M.T=b}}else try{b=d(v,m),L1(i,o,b)}catch(ee){$g(i,o,ee)}}function L1(i,o,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(m){P1(i,o,m)},function(m){return $g(i,o,m)}):P1(i,o,d)}function P1(i,o,d){o.status="fulfilled",o.value=d,$1(o),i.state=d,o=i.pending,o!==null&&(d=o.next,d===o?i.pending=null:(d=d.next,o.next=d,I1(i,d)))}function $g(i,o,d){var m=i.pending;if(i.pending=null,m!==null){m=m.next;do o.status="rejected",o.reason=d,$1(o),o=o.next;while(o!==m)}i.action=null}function $1(i){i=i.listeners;for(var o=0;o<i.length;o++)(0,i[o])()}function z1(i,o){return o}function F1(i,o){if(Pt){var d=Zt.formState;if(d!==null){e:{var m=vt;if(Pt){if(fn){t:{for(var v=fn,b=Us;v.nodeType!==8;){if(!b){v=null;break t}if(v=_s(v.nextSibling),v===null){v=null;break t}}b=v.data,v=b==="F!"||b==="F"?v:null}if(v){fn=_s(v.nextSibling),m=v.data==="F!";break e}}so(m)}m=!1}m&&(o=d[0])}}return d=br(),d.memoizedState=d.baseState=o,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:z1,lastRenderedState:o},d.queue=m,d=i_.bind(null,vt,m),m.dispatch=d,m=Pg(!1),b=qg.bind(null,vt,!1,m.queue),m=br(),v={state:o,dispatch:null,action:i,pending:null},m.queue=v,d=g4.bind(null,vt,v,b,d),v.dispatch=d,m.memoizedState=i,[o,d,!1]}function B1(i){var o=Nn();return U1(o,Ut,i)}function U1(i,o,d){if(o=Ig(i,o,z1)[0],i=Cf(yi)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var m=ou(o)}catch(O){throw O===tu?wf:O}else m=o;o=Nn();var v=o.queue,b=v.dispatch;return d!==o.memoizedState&&(vt.flags|=2048,hl(9,Ef(),v4.bind(null,v,d),null)),[m,b,i]}function v4(i,o){i.action=o}function q1(i){var o=Nn(),d=Ut;if(d!==null)return U1(o,d,i);Nn(),o=o.memoizedState,d=Nn();var m=d.queue.dispatch;return d.memoizedState=i,[o,m,!1]}function hl(i,o,d,m){return i={tag:i,create:d,deps:m,inst:o,next:null},o=vt.updateQueue,o===null&&(o=Mg(),vt.updateQueue=o),d=o.lastEffect,d===null?o.lastEffect=i.next=i:(m=d.next,d.next=i,i.next=m,o.lastEffect=i),i}function Ef(){return{destroy:void 0,resource:void 0}}function H1(){return Nn().memoizedState}function Tf(i,o,d,m){var v=br();m=m===void 0?null:m,vt.flags|=i,v.memoizedState=hl(1|o,Ef(),d,m)}function lu(i,o,d,m){var v=Nn();m=m===void 0?null:m;var b=v.memoizedState.inst;Ut!==null&&m!==null&&Eg(m,Ut.memoizedState.deps)?v.memoizedState=hl(o,b,d,m):(vt.flags|=i,v.memoizedState=hl(1|o,b,d,m))}function V1(i,o){Tf(8390656,8,i,o)}function K1(i,o){lu(2048,8,i,o)}function Y1(i,o){return lu(4,2,i,o)}function G1(i,o){return lu(4,4,i,o)}function Z1(i,o){if(typeof o=="function"){i=i();var d=o(i);return function(){typeof d=="function"?d():o(null)}}if(o!=null)return i=i(),o.current=i,function(){o.current=null}}function W1(i,o,d){d=d!=null?d.concat([i]):null,lu(4,4,Z1.bind(null,o,i),d)}function zg(){}function Q1(i,o){var d=Nn();o=o===void 0?null:o;var m=d.memoizedState;return o!==null&&Eg(o,m[1])?m[0]:(d.memoizedState=[i,o],i)}function X1(i,o){var d=Nn();o=o===void 0?null:o;var m=d.memoizedState;if(o!==null&&Eg(o,m[1]))return m[0];if(m=i(),lo){Ae(!0);try{i()}finally{Ae(!1)}}return d.memoizedState=[m,o],m}function Fg(i,o,d){return d===void 0||(ra&1073741824)!==0?i.memoizedState=o:(i.memoizedState=d,i=tk(),vt.lanes|=i,ua|=i,d)}function J1(i,o,d,m){return Rr(d,o)?d:ul.current!==null?(i=Fg(i,d,m),Rr(i,o)||(Fn=!0),i):(ra&42)===0?(Fn=!0,i.memoizedState=d):(i=tk(),vt.lanes|=i,ua|=i,o)}function e_(i,o,d,m,v){var b=V.p;V.p=b!==0&&8>b?b:8;var O=M.T,$={};M.T=$,qg(i,!1,o,d);try{var Y=v(),ee=M.S;if(ee!==null&&ee($,Y),Y!==null&&typeof Y=="object"&&typeof Y.then=="function"){var oe=h4(Y,m);cu(i,o,oe,Pr(i))}else cu(i,o,m,Pr(i))}catch(fe){cu(i,o,{then:function(){},status:"rejected",reason:fe},Pr())}finally{V.p=b,M.T=O}}function x4(){}function Bg(i,o,d,m){if(i.tag!==5)throw Error(r(476));var v=t_(i).queue;e_(i,v,o,U,d===null?x4:function(){return n_(i),d(m)})}function t_(i){var o=i.memoizedState;if(o!==null)return o;o={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yi,lastRenderedState:U},next:null};var d={};return o.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yi,lastRenderedState:d},next:null},i.memoizedState=o,i=i.alternate,i!==null&&(i.memoizedState=o),o}function n_(i){var o=t_(i).next.queue;cu(i,o,{},Pr())}function Ug(){return Qn(Cu)}function r_(){return Nn().memoizedState}function s_(){return Nn().memoizedState}function y4(i){for(var o=i.return;o!==null;){switch(o.tag){case 24:case 3:var d=Pr();i=ta(d);var m=na(o,i,d);m!==null&&($r(m,o,d),ru(m,o,d)),o={cache:xg()},i.payload=o;return}o=o.return}}function b4(i,o,d){var m=Pr();d={lane:m,revertLane:0,action:d,hasEagerState:!1,eagerState:null,next:null},Af(i)?a_(o,d):(d=lg(i,o,d,m),d!==null&&($r(d,i,m),o_(d,o,m)))}function i_(i,o,d){var m=Pr();cu(i,o,d,m)}function cu(i,o,d,m){var v={lane:m,revertLane:0,action:d,hasEagerState:!1,eagerState:null,next:null};if(Af(i))a_(o,v);else{var b=i.alternate;if(i.lanes===0&&(b===null||b.lanes===0)&&(b=o.lastRenderedReducer,b!==null))try{var O=o.lastRenderedState,$=b(O,d);if(v.hasEagerState=!0,v.eagerState=$,Rr($,O))return hf(i,o,v,0),Zt===null&&ff(),!1}catch{}finally{}if(d=lg(i,o,v,m),d!==null)return $r(d,i,m),o_(d,o,m),!0}return!1}function qg(i,o,d,m){if(m={lane:2,revertLane:wv(),action:m,hasEagerState:!1,eagerState:null,next:null},Af(i)){if(o)throw Error(r(479))}else o=lg(i,d,m,2),o!==null&&$r(o,i,2)}function Af(i){var o=i.alternate;return i===vt||o!==null&&o===vt}function a_(i,o){dl=Sf=!0;var d=i.pending;d===null?o.next=o:(o.next=d.next,d.next=o),i.pending=o}function o_(i,o,d){if((d&4194048)!==0){var m=o.lanes;m&=i.pendingLanes,d|=m,o.lanes=d,Wi(i,d)}}var Of={readContext:Qn,use:Nf,useCallback:gn,useContext:gn,useEffect:gn,useImperativeHandle:gn,useLayoutEffect:gn,useInsertionEffect:gn,useMemo:gn,useReducer:gn,useRef:gn,useState:gn,useDebugValue:gn,useDeferredValue:gn,useTransition:gn,useSyncExternalStore:gn,useId:gn,useHostTransitionStatus:gn,useFormState:gn,useActionState:gn,useOptimistic:gn,useMemoCache:gn,useCacheRefresh:gn},l_={readContext:Qn,use:Nf,useCallback:function(i,o){return br().memoizedState=[i,o===void 0?null:o],i},useContext:Qn,useEffect:V1,useImperativeHandle:function(i,o,d){d=d!=null?d.concat([i]):null,Tf(4194308,4,Z1.bind(null,o,i),d)},useLayoutEffect:function(i,o){return Tf(4194308,4,i,o)},useInsertionEffect:function(i,o){Tf(4,2,i,o)},useMemo:function(i,o){var d=br();o=o===void 0?null:o;var m=i();if(lo){Ae(!0);try{i()}finally{Ae(!1)}}return d.memoizedState=[m,o],m},useReducer:function(i,o,d){var m=br();if(d!==void 0){var v=d(o);if(lo){Ae(!0);try{d(o)}finally{Ae(!1)}}}else v=o;return m.memoizedState=m.baseState=v,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:v},m.queue=i,i=i.dispatch=b4.bind(null,vt,i),[m.memoizedState,i]},useRef:function(i){var o=br();return i={current:i},o.memoizedState=i},useState:function(i){i=Pg(i);var o=i.queue,d=i_.bind(null,vt,o);return o.dispatch=d,[i.memoizedState,d]},useDebugValue:zg,useDeferredValue:function(i,o){var d=br();return Fg(d,i,o)},useTransition:function(){var i=Pg(!1);return i=e_.bind(null,vt,i.queue,!0,!1),br().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,o,d){var m=vt,v=br();if(Pt){if(d===void 0)throw Error(r(407));d=d()}else{if(d=o(),Zt===null)throw Error(r(349));(At&124)!==0||T1(m,o,d)}v.memoizedState=d;var b={value:d,getSnapshot:o};return v.queue=b,V1(O1.bind(null,m,b,i),[i]),m.flags|=2048,hl(9,Ef(),A1.bind(null,m,b,d,o),null),d},useId:function(){var i=br(),o=Zt.identifierPrefix;if(Pt){var d=gi,m=pi;d=(m&~(1<<32-He(m)-1)).toString(32)+d,o="ยซ"+o+"R"+d,d=jf++,0<d&&(o+="H"+d.toString(32)),o+="ยป"}else d=m4++,o="ยซ"+o+"r"+d.toString(32)+"ยป";return i.memoizedState=o},useHostTransitionStatus:Ug,useFormState:F1,useActionState:F1,useOptimistic:function(i){var o=br();o.memoizedState=o.baseState=i;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=d,o=qg.bind(null,vt,!0,d),d.dispatch=o,[i,o]},useMemoCache:Dg,useCacheRefresh:function(){return br().memoizedState=y4.bind(null,vt)}},c_={readContext:Qn,use:Nf,useCallback:Q1,useContext:Qn,useEffect:K1,useImperativeHandle:W1,useInsertionEffect:Y1,useLayoutEffect:G1,useMemo:X1,useReducer:Cf,useRef:H1,useState:function(){return Cf(yi)},useDebugValue:zg,useDeferredValue:function(i,o){var d=Nn();return J1(d,Ut.memoizedState,i,o)},useTransition:function(){var i=Cf(yi)[0],o=Nn().memoizedState;return[typeof i=="boolean"?i:ou(i),o]},useSyncExternalStore:E1,useId:r_,useHostTransitionStatus:Ug,useFormState:B1,useActionState:B1,useOptimistic:function(i,o){var d=Nn();return D1(d,Ut,i,o)},useMemoCache:Dg,useCacheRefresh:s_},w4={readContext:Qn,use:Nf,useCallback:Q1,useContext:Qn,useEffect:K1,useImperativeHandle:W1,useInsertionEffect:Y1,useLayoutEffect:G1,useMemo:X1,useReducer:Lg,useRef:H1,useState:function(){return Lg(yi)},useDebugValue:zg,useDeferredValue:function(i,o){var d=Nn();return Ut===null?Fg(d,i,o):J1(d,Ut.memoizedState,i,o)},useTransition:function(){var i=Lg(yi)[0],o=Nn().memoizedState;return[typeof i=="boolean"?i:ou(i),o]},useSyncExternalStore:E1,useId:r_,useHostTransitionStatus:Ug,useFormState:q1,useActionState:q1,useOptimistic:function(i,o){var d=Nn();return Ut!==null?D1(d,Ut,i,o):(d.baseState=i,[i,d.queue.dispatch])},useMemoCache:Dg,useCacheRefresh:s_},ml=null,uu=0;function Rf(i){var o=uu;return uu+=1,ml===null&&(ml=[]),b1(ml,i,o)}function du(i,o){o=o.props.ref,i.ref=o!==void 0?o:null}function Mf(i,o){throw o.$$typeof===p?Error(r(525)):(i=Object.prototype.toString.call(o),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":i)))}function u_(i){var o=i._init;return o(i._payload)}function d_(i){function o(W,Z){if(i){var X=W.deletions;X===null?(W.deletions=[Z],W.flags|=16):X.push(Z)}}function d(W,Z){if(!i)return null;for(;Z!==null;)o(W,Z),Z=Z.sibling;return null}function m(W){for(var Z=new Map;W!==null;)W.key!==null?Z.set(W.key,W):Z.set(W.index,W),W=W.sibling;return Z}function v(W,Z){return W=mi(W,Z),W.index=0,W.sibling=null,W}function b(W,Z,X){return W.index=X,i?(X=W.alternate,X!==null?(X=X.index,X<Z?(W.flags|=67108866,Z):X):(W.flags|=67108866,Z)):(W.flags|=1048576,Z)}function O(W){return i&&W.alternate===null&&(W.flags|=67108866),W}function $(W,Z,X,ce){return Z===null||Z.tag!==6?(Z=ug(X,W.mode,ce),Z.return=W,Z):(Z=v(Z,X),Z.return=W,Z)}function Y(W,Z,X,ce){var Ve=X.type;return Ve===k?oe(W,Z,X.props.children,ce,X.key):Z!==null&&(Z.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===R&&u_(Ve)===Z.type)?(Z=v(Z,X.props),du(Z,X),Z.return=W,Z):(Z=pf(X.type,X.key,X.props,null,W.mode,ce),du(Z,X),Z.return=W,Z)}function ee(W,Z,X,ce){return Z===null||Z.tag!==4||Z.stateNode.containerInfo!==X.containerInfo||Z.stateNode.implementation!==X.implementation?(Z=dg(X,W.mode,ce),Z.return=W,Z):(Z=v(Z,X.children||[]),Z.return=W,Z)}function oe(W,Z,X,ce,Ve){return Z===null||Z.tag!==7?(Z=eo(X,W.mode,ce,Ve),Z.return=W,Z):(Z=v(Z,X),Z.return=W,Z)}function fe(W,Z,X){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Z=ug(""+Z,W.mode,X),Z.return=W,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case x:return X=pf(Z.type,Z.key,Z.props,null,W.mode,X),du(X,Z),X.return=W,X;case y:return Z=dg(Z,W.mode,X),Z.return=W,Z;case R:var ce=Z._init;return Z=ce(Z._payload),fe(W,Z,X)}if(F(Z)||q(Z))return Z=eo(Z,W.mode,X,null),Z.return=W,Z;if(typeof Z.then=="function")return fe(W,Rf(Z),X);if(Z.$$typeof===j)return fe(W,yf(W,Z),X);Mf(W,Z)}return null}function te(W,Z,X,ce){var Ve=Z!==null?Z.key:null;if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return Ve!==null?null:$(W,Z,""+X,ce);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case x:return X.key===Ve?Y(W,Z,X,ce):null;case y:return X.key===Ve?ee(W,Z,X,ce):null;case R:return Ve=X._init,X=Ve(X._payload),te(W,Z,X,ce)}if(F(X)||q(X))return Ve!==null?null:oe(W,Z,X,ce,null);if(typeof X.then=="function")return te(W,Z,Rf(X),ce);if(X.$$typeof===j)return te(W,Z,yf(W,X),ce);Mf(W,X)}return null}function re(W,Z,X,ce,Ve){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return W=W.get(X)||null,$(Z,W,""+ce,Ve);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case x:return W=W.get(ce.key===null?X:ce.key)||null,Y(Z,W,ce,Ve);case y:return W=W.get(ce.key===null?X:ce.key)||null,ee(Z,W,ce,Ve);case R:var wt=ce._init;return ce=wt(ce._payload),re(W,Z,X,ce,Ve)}if(F(ce)||q(ce))return W=W.get(X)||null,oe(Z,W,ce,Ve,null);if(typeof ce.then=="function")return re(W,Z,X,Rf(ce),Ve);if(ce.$$typeof===j)return re(W,Z,X,yf(Z,ce),Ve);Mf(Z,ce)}return null}function at(W,Z,X,ce){for(var Ve=null,wt=null,Ze=Z,rt=Z=0,Un=null;Ze!==null&&rt<X.length;rt++){Ze.index>rt?(Un=Ze,Ze=null):Un=Ze.sibling;var Mt=te(W,Ze,X[rt],ce);if(Mt===null){Ze===null&&(Ze=Un);break}i&&Ze&&Mt.alternate===null&&o(W,Ze),Z=b(Mt,Z,rt),wt===null?Ve=Mt:wt.sibling=Mt,wt=Mt,Ze=Un}if(rt===X.length)return d(W,Ze),Pt&&no(W,rt),Ve;if(Ze===null){for(;rt<X.length;rt++)Ze=fe(W,X[rt],ce),Ze!==null&&(Z=b(Ze,Z,rt),wt===null?Ve=Ze:wt.sibling=Ze,wt=Ze);return Pt&&no(W,rt),Ve}for(Ze=m(Ze);rt<X.length;rt++)Un=re(Ze,W,rt,X[rt],ce),Un!==null&&(i&&Un.alternate!==null&&Ze.delete(Un.key===null?rt:Un.key),Z=b(Un,Z,rt),wt===null?Ve=Un:wt.sibling=Un,wt=Un);return i&&Ze.forEach(function(ya){return o(W,ya)}),Pt&&no(W,rt),Ve}function tt(W,Z,X,ce){if(X==null)throw Error(r(151));for(var Ve=null,wt=null,Ze=Z,rt=Z=0,Un=null,Mt=X.next();Ze!==null&&!Mt.done;rt++,Mt=X.next()){Ze.index>rt?(Un=Ze,Ze=null):Un=Ze.sibling;var ya=te(W,Ze,Mt.value,ce);if(ya===null){Ze===null&&(Ze=Un);break}i&&Ze&&ya.alternate===null&&o(W,Ze),Z=b(ya,Z,rt),wt===null?Ve=ya:wt.sibling=ya,wt=ya,Ze=Un}if(Mt.done)return d(W,Ze),Pt&&no(W,rt),Ve;if(Ze===null){for(;!Mt.done;rt++,Mt=X.next())Mt=fe(W,Mt.value,ce),Mt!==null&&(Z=b(Mt,Z,rt),wt===null?Ve=Mt:wt.sibling=Mt,wt=Mt);return Pt&&no(W,rt),Ve}for(Ze=m(Ze);!Mt.done;rt++,Mt=X.next())Mt=re(Ze,W,rt,Mt.value,ce),Mt!==null&&(i&&Mt.alternate!==null&&Ze.delete(Mt.key===null?rt:Mt.key),Z=b(Mt,Z,rt),wt===null?Ve=Mt:wt.sibling=Mt,wt=Mt);return i&&Ze.forEach(function(_3){return o(W,_3)}),Pt&&no(W,rt),Ve}function Ht(W,Z,X,ce){if(typeof X=="object"&&X!==null&&X.type===k&&X.key===null&&(X=X.props.children),typeof X=="object"&&X!==null){switch(X.$$typeof){case x:e:{for(var Ve=X.key;Z!==null;){if(Z.key===Ve){if(Ve=X.type,Ve===k){if(Z.tag===7){d(W,Z.sibling),ce=v(Z,X.props.children),ce.return=W,W=ce;break e}}else if(Z.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===R&&u_(Ve)===Z.type){d(W,Z.sibling),ce=v(Z,X.props),du(ce,X),ce.return=W,W=ce;break e}d(W,Z);break}else o(W,Z);Z=Z.sibling}X.type===k?(ce=eo(X.props.children,W.mode,ce,X.key),ce.return=W,W=ce):(ce=pf(X.type,X.key,X.props,null,W.mode,ce),du(ce,X),ce.return=W,W=ce)}return O(W);case y:e:{for(Ve=X.key;Z!==null;){if(Z.key===Ve)if(Z.tag===4&&Z.stateNode.containerInfo===X.containerInfo&&Z.stateNode.implementation===X.implementation){d(W,Z.sibling),ce=v(Z,X.children||[]),ce.return=W,W=ce;break e}else{d(W,Z);break}else o(W,Z);Z=Z.sibling}ce=dg(X,W.mode,ce),ce.return=W,W=ce}return O(W);case R:return Ve=X._init,X=Ve(X._payload),Ht(W,Z,X,ce)}if(F(X))return at(W,Z,X,ce);if(q(X)){if(Ve=q(X),typeof Ve!="function")throw Error(r(150));return X=Ve.call(X),tt(W,Z,X,ce)}if(typeof X.then=="function")return Ht(W,Z,Rf(X),ce);if(X.$$typeof===j)return Ht(W,Z,yf(W,X),ce);Mf(W,X)}return typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint"?(X=""+X,Z!==null&&Z.tag===6?(d(W,Z.sibling),ce=v(Z,X),ce.return=W,W=ce):(d(W,Z),ce=ug(X,W.mode,ce),ce.return=W,W=ce),O(W)):d(W,Z)}return function(W,Z,X,ce){try{uu=0;var Ve=Ht(W,Z,X,ce);return ml=null,Ve}catch(Ze){if(Ze===tu||Ze===wf)throw Ze;var wt=Mr(29,Ze,null,W.mode);return wt.lanes=ce,wt.return=W,wt}finally{}}}var pl=d_(!0),f_=d_(!1),es=ne(null),qs=null;function sa(i){var o=i.alternate;P(Dn,Dn.current&1),P(es,i),qs===null&&(o===null||ul.current!==null||o.memoizedState!==null)&&(qs=i)}function h_(i){if(i.tag===22){if(P(Dn,Dn.current),P(es,i),qs===null){var o=i.alternate;o!==null&&o.memoizedState!==null&&(qs=i)}}else ia()}function ia(){P(Dn,Dn.current),P(es,es.current)}function bi(i){ie(es),qs===i&&(qs=null),ie(Dn)}var Dn=ne(0);function Df(i){for(var o=i;o!==null;){if(o.tag===13){var d=o.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||Mv(d)))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===i)break;for(;o.sibling===null;){if(o.return===null||o.return===i)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}function Hg(i,o,d,m){o=i.memoizedState,d=d(m,o),d=d==null?o:g({},o,d),i.memoizedState=d,i.lanes===0&&(i.updateQueue.baseState=d)}var Vg={enqueueSetState:function(i,o,d){i=i._reactInternals;var m=Pr(),v=ta(m);v.payload=o,d!=null&&(v.callback=d),o=na(i,v,m),o!==null&&($r(o,i,m),ru(o,i,m))},enqueueReplaceState:function(i,o,d){i=i._reactInternals;var m=Pr(),v=ta(m);v.tag=1,v.payload=o,d!=null&&(v.callback=d),o=na(i,v,m),o!==null&&($r(o,i,m),ru(o,i,m))},enqueueForceUpdate:function(i,o){i=i._reactInternals;var d=Pr(),m=ta(d);m.tag=2,o!=null&&(m.callback=o),o=na(i,m,d),o!==null&&($r(o,i,d),ru(o,i,d))}};function m_(i,o,d,m,v,b,O){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(m,b,O):o.prototype&&o.prototype.isPureReactComponent?!Yc(d,m)||!Yc(v,b):!0}function p_(i,o,d,m){i=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(d,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(d,m),o.state!==i&&Vg.enqueueReplaceState(o,o.state,null)}function co(i,o){var d=o;if("ref"in o){d={};for(var m in o)m!=="ref"&&(d[m]=o[m])}if(i=i.defaultProps){d===o&&(d=g({},d));for(var v in i)d[v]===void 0&&(d[v]=i[v])}return d}var If=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)};function g_(i){If(i)}function v_(i){console.error(i)}function x_(i){If(i)}function Lf(i,o){try{var d=i.onUncaughtError;d(o.value,{componentStack:o.stack})}catch(m){setTimeout(function(){throw m})}}function y_(i,o,d){try{var m=i.onCaughtError;m(d.value,{componentStack:d.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function Kg(i,o,d){return d=ta(d),d.tag=3,d.payload={element:null},d.callback=function(){Lf(i,o)},d}function b_(i){return i=ta(i),i.tag=3,i}function w_(i,o,d,m){var v=d.type.getDerivedStateFromError;if(typeof v=="function"){var b=m.value;i.payload=function(){return v(b)},i.callback=function(){y_(o,d,m)}}var O=d.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(i.callback=function(){y_(o,d,m),typeof v!="function"&&(da===null?da=new Set([this]):da.add(this));var $=m.stack;this.componentDidCatch(m.value,{componentStack:$!==null?$:""})})}function _4(i,o,d,m,v){if(d.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(o=d.alternate,o!==null&&Xc(o,d,v,!0),d=es.current,d!==null){switch(d.tag){case 13:return qs===null?gv():d.alternate===null&&hn===0&&(hn=3),d.flags&=-257,d.flags|=65536,d.lanes=v,m===wg?d.flags|=16384:(o=d.updateQueue,o===null?d.updateQueue=new Set([m]):o.add(m),xv(i,m,v)),!1;case 22:return d.flags|=65536,m===wg?d.flags|=16384:(o=d.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([m])},d.updateQueue=o):(d=o.retryQueue,d===null?o.retryQueue=new Set([m]):d.add(m)),xv(i,m,v)),!1}throw Error(r(435,d.tag))}return xv(i,m,v),gv(),!1}if(Pt)return o=es.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=v,m!==mg&&(i=Error(r(422),{cause:m}),Qc(Wr(i,d)))):(m!==mg&&(o=Error(r(423),{cause:m}),Qc(Wr(o,d))),i=i.current.alternate,i.flags|=65536,v&=-v,i.lanes|=v,m=Wr(m,d),v=Kg(i.stateNode,m,v),Sg(i,v),hn!==4&&(hn=2)),!1;var b=Error(r(520),{cause:m});if(b=Wr(b,d),xu===null?xu=[b]:xu.push(b),hn!==4&&(hn=2),o===null)return!0;m=Wr(m,d),d=o;do{switch(d.tag){case 3:return d.flags|=65536,i=v&-v,d.lanes|=i,i=Kg(d.stateNode,m,i),Sg(d,i),!1;case 1:if(o=d.type,b=d.stateNode,(d.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(da===null||!da.has(b))))return d.flags|=65536,v&=-v,d.lanes|=v,v=b_(v),w_(v,i,d,m),Sg(d,v),!1}d=d.return}while(d!==null);return!1}var __=Error(r(461)),Fn=!1;function Vn(i,o,d,m){o.child=i===null?f_(o,null,d,m):pl(o,i.child,d,m)}function k_(i,o,d,m,v){d=d.render;var b=o.ref;if("ref"in m){var O={};for(var $ in m)$!=="ref"&&(O[$]=m[$])}else O=m;return ao(o),m=Tg(i,o,d,O,b,v),$=Ag(),i!==null&&!Fn?(Og(i,o,v),wi(i,o,v)):(Pt&&$&&fg(o),o.flags|=1,Vn(i,o,m,v),o.child)}function S_(i,o,d,m,v){if(i===null){var b=d.type;return typeof b=="function"&&!cg(b)&&b.defaultProps===void 0&&d.compare===null?(o.tag=15,o.type=b,j_(i,o,b,m,v)):(i=pf(d.type,null,m,o,o.mode,v),i.ref=o.ref,i.return=o,o.child=i)}if(b=i.child,!ev(i,v)){var O=b.memoizedProps;if(d=d.compare,d=d!==null?d:Yc,d(O,m)&&i.ref===o.ref)return wi(i,o,v)}return o.flags|=1,i=mi(b,m),i.ref=o.ref,i.return=o,o.child=i}function j_(i,o,d,m,v){if(i!==null){var b=i.memoizedProps;if(Yc(b,m)&&i.ref===o.ref)if(Fn=!1,o.pendingProps=m=b,ev(i,v))(i.flags&131072)!==0&&(Fn=!0);else return o.lanes=i.lanes,wi(i,o,v)}return Yg(i,o,d,m,v)}function N_(i,o,d){var m=o.pendingProps,v=m.children,b=i!==null?i.memoizedState:null;if(m.mode==="hidden"){if((o.flags&128)!==0){if(m=b!==null?b.baseLanes|d:d,i!==null){for(v=o.child=i.child,b=0;v!==null;)b=b|v.lanes|v.childLanes,v=v.sibling;o.childLanes=b&~m}else o.childLanes=0,o.child=null;return C_(i,o,m,d)}if((d&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},i!==null&&bf(o,b!==null?b.cachePool:null),b!==null?j1(o,b):Ng(),h_(o);else return o.lanes=o.childLanes=536870912,C_(i,o,b!==null?b.baseLanes|d:d,d)}else b!==null?(bf(o,b.cachePool),j1(o,b),ia(),o.memoizedState=null):(i!==null&&bf(o,null),Ng(),ia());return Vn(i,o,v,d),o.child}function C_(i,o,d,m){var v=bg();return v=v===null?null:{parent:Mn._currentValue,pool:v},o.memoizedState={baseLanes:d,cachePool:v},i!==null&&bf(o,null),Ng(),h_(o),i!==null&&Xc(i,o,m,!0),null}function Pf(i,o){var d=o.ref;if(d===null)i!==null&&i.ref!==null&&(o.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(r(284));(i===null||i.ref!==d)&&(o.flags|=4194816)}}function Yg(i,o,d,m,v){return ao(o),d=Tg(i,o,d,m,void 0,v),m=Ag(),i!==null&&!Fn?(Og(i,o,v),wi(i,o,v)):(Pt&&m&&fg(o),o.flags|=1,Vn(i,o,d,v),o.child)}function E_(i,o,d,m,v,b){return ao(o),o.updateQueue=null,d=C1(o,m,d,v),N1(i),m=Ag(),i!==null&&!Fn?(Og(i,o,b),wi(i,o,b)):(Pt&&m&&fg(o),o.flags|=1,Vn(i,o,d,b),o.child)}function T_(i,o,d,m,v){if(ao(o),o.stateNode===null){var b=il,O=d.contextType;typeof O=="object"&&O!==null&&(b=Qn(O)),b=new d(m,b),o.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=Vg,o.stateNode=b,b._reactInternals=o,b=o.stateNode,b.props=m,b.state=o.memoizedState,b.refs={},_g(o),O=d.contextType,b.context=typeof O=="object"&&O!==null?Qn(O):il,b.state=o.memoizedState,O=d.getDerivedStateFromProps,typeof O=="function"&&(Hg(o,d,O,m),b.state=o.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(O=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),O!==b.state&&Vg.enqueueReplaceState(b,b.state,null),iu(o,m,b,v),su(),b.state=o.memoizedState),typeof b.componentDidMount=="function"&&(o.flags|=4194308),m=!0}else if(i===null){b=o.stateNode;var $=o.memoizedProps,Y=co(d,$);b.props=Y;var ee=b.context,oe=d.contextType;O=il,typeof oe=="object"&&oe!==null&&(O=Qn(oe));var fe=d.getDerivedStateFromProps;oe=typeof fe=="function"||typeof b.getSnapshotBeforeUpdate=="function",$=o.pendingProps!==$,oe||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||($||ee!==O)&&p_(o,b,m,O),ea=!1;var te=o.memoizedState;b.state=te,iu(o,m,b,v),su(),ee=o.memoizedState,$||te!==ee||ea?(typeof fe=="function"&&(Hg(o,d,fe,m),ee=o.memoizedState),(Y=ea||m_(o,d,Y,m,te,ee,O))?(oe||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(o.flags|=4194308)):(typeof b.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=ee),b.props=m,b.state=ee,b.context=O,m=Y):(typeof b.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{b=o.stateNode,kg(i,o),O=o.memoizedProps,oe=co(d,O),b.props=oe,fe=o.pendingProps,te=b.context,ee=d.contextType,Y=il,typeof ee=="object"&&ee!==null&&(Y=Qn(ee)),$=d.getDerivedStateFromProps,(ee=typeof $=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(O!==fe||te!==Y)&&p_(o,b,m,Y),ea=!1,te=o.memoizedState,b.state=te,iu(o,m,b,v),su();var re=o.memoizedState;O!==fe||te!==re||ea||i!==null&&i.dependencies!==null&&xf(i.dependencies)?(typeof $=="function"&&(Hg(o,d,$,m),re=o.memoizedState),(oe=ea||m_(o,d,oe,m,te,re,Y)||i!==null&&i.dependencies!==null&&xf(i.dependencies))?(ee||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(m,re,Y),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(m,re,Y)),typeof b.componentDidUpdate=="function"&&(o.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof b.componentDidUpdate!="function"||O===i.memoizedProps&&te===i.memoizedState||(o.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||O===i.memoizedProps&&te===i.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=re),b.props=m,b.state=re,b.context=Y,m=oe):(typeof b.componentDidUpdate!="function"||O===i.memoizedProps&&te===i.memoizedState||(o.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||O===i.memoizedProps&&te===i.memoizedState||(o.flags|=1024),m=!1)}return b=m,Pf(i,o),m=(o.flags&128)!==0,b||m?(b=o.stateNode,d=m&&typeof d.getDerivedStateFromError!="function"?null:b.render(),o.flags|=1,i!==null&&m?(o.child=pl(o,i.child,null,v),o.child=pl(o,null,d,v)):Vn(i,o,d,v),o.memoizedState=b.state,i=o.child):i=wi(i,o,v),i}function A_(i,o,d,m){return Wc(),o.flags|=256,Vn(i,o,d,m),o.child}var Gg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zg(i){return{baseLanes:i,cachePool:v1()}}function Wg(i,o,d){return i=i!==null?i.childLanes&~d:0,o&&(i|=ts),i}function O_(i,o,d){var m=o.pendingProps,v=!1,b=(o.flags&128)!==0,O;if((O=b)||(O=i!==null&&i.memoizedState===null?!1:(Dn.current&2)!==0),O&&(v=!0,o.flags&=-129),O=(o.flags&32)!==0,o.flags&=-33,i===null){if(Pt){if(v?sa(o):ia(),Pt){var $=fn,Y;if(Y=$){e:{for(Y=$,$=Us;Y.nodeType!==8;){if(!$){$=null;break e}if(Y=_s(Y.nextSibling),Y===null){$=null;break e}}$=Y}$!==null?(o.memoizedState={dehydrated:$,treeContext:to!==null?{id:pi,overflow:gi}:null,retryLane:536870912,hydrationErrors:null},Y=Mr(18,null,null,0),Y.stateNode=$,Y.return=o,o.child=Y,cr=o,fn=null,Y=!0):Y=!1}Y||so(o)}if($=o.memoizedState,$!==null&&($=$.dehydrated,$!==null))return Mv($)?o.lanes=32:o.lanes=536870912,null;bi(o)}return $=m.children,m=m.fallback,v?(ia(),v=o.mode,$=$f({mode:"hidden",children:$},v),m=eo(m,v,d,null),$.return=o,m.return=o,$.sibling=m,o.child=$,v=o.child,v.memoizedState=Zg(d),v.childLanes=Wg(i,O,d),o.memoizedState=Gg,m):(sa(o),Qg(o,$))}if(Y=i.memoizedState,Y!==null&&($=Y.dehydrated,$!==null)){if(b)o.flags&256?(sa(o),o.flags&=-257,o=Xg(i,o,d)):o.memoizedState!==null?(ia(),o.child=i.child,o.flags|=128,o=null):(ia(),v=m.fallback,$=o.mode,m=$f({mode:"visible",children:m.children},$),v=eo(v,$,d,null),v.flags|=2,m.return=o,v.return=o,m.sibling=v,o.child=m,pl(o,i.child,null,d),m=o.child,m.memoizedState=Zg(d),m.childLanes=Wg(i,O,d),o.memoizedState=Gg,o=v);else if(sa(o),Mv($)){if(O=$.nextSibling&&$.nextSibling.dataset,O)var ee=O.dgst;O=ee,m=Error(r(419)),m.stack="",m.digest=O,Qc({value:m,source:null,stack:null}),o=Xg(i,o,d)}else if(Fn||Xc(i,o,d,!1),O=(d&i.childLanes)!==0,Fn||O){if(O=Zt,O!==null&&(m=d&-d,m=(m&42)!==0?1:ys(m),m=(m&(O.suspendedLanes|d))!==0?0:m,m!==0&&m!==Y.retryLane))throw Y.retryLane=m,sl(i,m),$r(O,i,m),__;$.data==="$?"||gv(),o=Xg(i,o,d)}else $.data==="$?"?(o.flags|=192,o.child=i.child,o=null):(i=Y.treeContext,fn=_s($.nextSibling),cr=o,Pt=!0,ro=null,Us=!1,i!==null&&(Xr[Jr++]=pi,Xr[Jr++]=gi,Xr[Jr++]=to,pi=i.id,gi=i.overflow,to=o),o=Qg(o,m.children),o.flags|=4096);return o}return v?(ia(),v=m.fallback,$=o.mode,Y=i.child,ee=Y.sibling,m=mi(Y,{mode:"hidden",children:m.children}),m.subtreeFlags=Y.subtreeFlags&65011712,ee!==null?v=mi(ee,v):(v=eo(v,$,d,null),v.flags|=2),v.return=o,m.return=o,m.sibling=v,o.child=m,m=v,v=o.child,$=i.child.memoizedState,$===null?$=Zg(d):(Y=$.cachePool,Y!==null?(ee=Mn._currentValue,Y=Y.parent!==ee?{parent:ee,pool:ee}:Y):Y=v1(),$={baseLanes:$.baseLanes|d,cachePool:Y}),v.memoizedState=$,v.childLanes=Wg(i,O,d),o.memoizedState=Gg,m):(sa(o),d=i.child,i=d.sibling,d=mi(d,{mode:"visible",children:m.children}),d.return=o,d.sibling=null,i!==null&&(O=o.deletions,O===null?(o.deletions=[i],o.flags|=16):O.push(i)),o.child=d,o.memoizedState=null,d)}function Qg(i,o){return o=$f({mode:"visible",children:o},i.mode),o.return=i,i.child=o}function $f(i,o){return i=Mr(22,i,null,o),i.lanes=0,i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},i}function Xg(i,o,d){return pl(o,i.child,null,d),i=Qg(o,o.pendingProps.children),i.flags|=2,o.memoizedState=null,i}function R_(i,o,d){i.lanes|=o;var m=i.alternate;m!==null&&(m.lanes|=o),gg(i.return,o,d)}function Jg(i,o,d,m,v){var b=i.memoizedState;b===null?i.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:d,tailMode:v}:(b.isBackwards=o,b.rendering=null,b.renderingStartTime=0,b.last=m,b.tail=d,b.tailMode=v)}function M_(i,o,d){var m=o.pendingProps,v=m.revealOrder,b=m.tail;if(Vn(i,o,m.children,d),m=Dn.current,(m&2)!==0)m=m&1|2,o.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=o.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&R_(i,d,o);else if(i.tag===19)R_(i,d,o);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===o)break e;for(;i.sibling===null;){if(i.return===null||i.return===o)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}m&=1}switch(P(Dn,m),v){case"forwards":for(d=o.child,v=null;d!==null;)i=d.alternate,i!==null&&Df(i)===null&&(v=d),d=d.sibling;d=v,d===null?(v=o.child,o.child=null):(v=d.sibling,d.sibling=null),Jg(o,!1,v,d,b);break;case"backwards":for(d=null,v=o.child,o.child=null;v!==null;){if(i=v.alternate,i!==null&&Df(i)===null){o.child=v;break}i=v.sibling,v.sibling=d,d=v,v=i}Jg(o,!0,d,null,b);break;case"together":Jg(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function wi(i,o,d){if(i!==null&&(o.dependencies=i.dependencies),ua|=o.lanes,(d&o.childLanes)===0)if(i!==null){if(Xc(i,o,d,!1),(d&o.childLanes)===0)return null}else return null;if(i!==null&&o.child!==i.child)throw Error(r(153));if(o.child!==null){for(i=o.child,d=mi(i,i.pendingProps),o.child=d,d.return=o;i.sibling!==null;)i=i.sibling,d=d.sibling=mi(i,i.pendingProps),d.return=o;d.sibling=null}return o.child}function ev(i,o){return(i.lanes&o)!==0?!0:(i=i.dependencies,!!(i!==null&&xf(i)))}function k4(i,o,d){switch(o.tag){case 3:Fe(o,o.stateNode.containerInfo),Ji(o,Mn,i.memoizedState.cache),Wc();break;case 27:case 5:$e(o);break;case 4:Fe(o,o.stateNode.containerInfo);break;case 10:Ji(o,o.type,o.memoizedProps.value);break;case 13:var m=o.memoizedState;if(m!==null)return m.dehydrated!==null?(sa(o),o.flags|=128,null):(d&o.child.childLanes)!==0?O_(i,o,d):(sa(o),i=wi(i,o,d),i!==null?i.sibling:null);sa(o);break;case 19:var v=(i.flags&128)!==0;if(m=(d&o.childLanes)!==0,m||(Xc(i,o,d,!1),m=(d&o.childLanes)!==0),v){if(m)return M_(i,o,d);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),P(Dn,Dn.current),m)break;return null;case 22:case 23:return o.lanes=0,N_(i,o,d);case 24:Ji(o,Mn,i.memoizedState.cache)}return wi(i,o,d)}function D_(i,o,d){if(i!==null)if(i.memoizedProps!==o.pendingProps)Fn=!0;else{if(!ev(i,d)&&(o.flags&128)===0)return Fn=!1,k4(i,o,d);Fn=(i.flags&131072)!==0}else Fn=!1,Pt&&(o.flags&1048576)!==0&&u1(o,vf,o.index);switch(o.lanes=0,o.tag){case 16:e:{i=o.pendingProps;var m=o.elementType,v=m._init;if(m=v(m._payload),o.type=m,typeof m=="function")cg(m)?(i=co(m,i),o.tag=1,o=T_(null,o,m,i,d)):(o.tag=0,o=Yg(null,o,m,i,d));else{if(m!=null){if(v=m.$$typeof,v===A){o.tag=11,o=k_(null,o,m,i,d);break e}else if(v===E){o.tag=14,o=S_(null,o,m,i,d);break e}}throw o=G(m)||m,Error(r(306,o,""))}}return o;case 0:return Yg(i,o,o.type,o.pendingProps,d);case 1:return m=o.type,v=co(m,o.pendingProps),T_(i,o,m,v,d);case 3:e:{if(Fe(o,o.stateNode.containerInfo),i===null)throw Error(r(387));m=o.pendingProps;var b=o.memoizedState;v=b.element,kg(i,o),iu(o,m,null,d);var O=o.memoizedState;if(m=O.cache,Ji(o,Mn,m),m!==b.cache&&vg(o,[Mn],d,!0),su(),m=O.element,b.isDehydrated)if(b={element:m,isDehydrated:!1,cache:O.cache},o.updateQueue.baseState=b,o.memoizedState=b,o.flags&256){o=A_(i,o,m,d);break e}else if(m!==v){v=Wr(Error(r(424)),o),Qc(v),o=A_(i,o,m,d);break e}else{switch(i=o.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(fn=_s(i.firstChild),cr=o,Pt=!0,ro=null,Us=!0,d=f_(o,null,m,d),o.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling}else{if(Wc(),m===v){o=wi(i,o,d);break e}Vn(i,o,m,d)}o=o.child}return o;case 26:return Pf(i,o),i===null?(d=$k(o.type,null,o.pendingProps,null))?o.memoizedState=d:Pt||(d=o.type,i=o.pendingProps,m=Xf(Ne.current).createElement(d),m[We]=o,m[ft]=i,Yn(m,d,i),un(m),o.stateNode=m):o.memoizedState=$k(o.type,i.memoizedProps,o.pendingProps,i.memoizedState),null;case 27:return $e(o),i===null&&Pt&&(m=o.stateNode=Ik(o.type,o.pendingProps,Ne.current),cr=o,Us=!0,v=fn,ma(o.type)?(Dv=v,fn=_s(m.firstChild)):fn=v),Vn(i,o,o.pendingProps.children,d),Pf(i,o),i===null&&(o.flags|=4194304),o.child;case 5:return i===null&&Pt&&((v=m=fn)&&(m=Q4(m,o.type,o.pendingProps,Us),m!==null?(o.stateNode=m,cr=o,fn=_s(m.firstChild),Us=!1,v=!0):v=!1),v||so(o)),$e(o),v=o.type,b=o.pendingProps,O=i!==null?i.memoizedProps:null,m=b.children,Av(v,b)?m=null:O!==null&&Av(v,O)&&(o.flags|=32),o.memoizedState!==null&&(v=Tg(i,o,p4,null,null,d),Cu._currentValue=v),Pf(i,o),Vn(i,o,m,d),o.child;case 6:return i===null&&Pt&&((i=d=fn)&&(d=X4(d,o.pendingProps,Us),d!==null?(o.stateNode=d,cr=o,fn=null,i=!0):i=!1),i||so(o)),null;case 13:return O_(i,o,d);case 4:return Fe(o,o.stateNode.containerInfo),m=o.pendingProps,i===null?o.child=pl(o,null,m,d):Vn(i,o,m,d),o.child;case 11:return k_(i,o,o.type,o.pendingProps,d);case 7:return Vn(i,o,o.pendingProps,d),o.child;case 8:return Vn(i,o,o.pendingProps.children,d),o.child;case 12:return Vn(i,o,o.pendingProps.children,d),o.child;case 10:return m=o.pendingProps,Ji(o,o.type,m.value),Vn(i,o,m.children,d),o.child;case 9:return v=o.type._context,m=o.pendingProps.children,ao(o),v=Qn(v),m=m(v),o.flags|=1,Vn(i,o,m,d),o.child;case 14:return S_(i,o,o.type,o.pendingProps,d);case 15:return j_(i,o,o.type,o.pendingProps,d);case 19:return M_(i,o,d);case 31:return m=o.pendingProps,d=o.mode,m={mode:m.mode,children:m.children},i===null?(d=$f(m,d),d.ref=o.ref,o.child=d,d.return=o,o=d):(d=mi(i.child,m),d.ref=o.ref,o.child=d,d.return=o,o=d),o;case 22:return N_(i,o,d);case 24:return ao(o),m=Qn(Mn),i===null?(v=bg(),v===null&&(v=Zt,b=xg(),v.pooledCache=b,b.refCount++,b!==null&&(v.pooledCacheLanes|=d),v=b),o.memoizedState={parent:m,cache:v},_g(o),Ji(o,Mn,v)):((i.lanes&d)!==0&&(kg(i,o),iu(o,null,null,d),su()),v=i.memoizedState,b=o.memoizedState,v.parent!==m?(v={parent:m,cache:m},o.memoizedState=v,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=v),Ji(o,Mn,m)):(m=b.cache,Ji(o,Mn,m),m!==v.cache&&vg(o,[Mn],d,!0))),Vn(i,o,o.pendingProps.children,d),o.child;case 29:throw o.pendingProps}throw Error(r(156,o.tag))}function _i(i){i.flags|=4}function I_(i,o){if(o.type!=="stylesheet"||(o.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!qk(o)){if(o=es.current,o!==null&&((At&4194048)===At?qs!==null:(At&62914560)!==At&&(At&536870912)===0||o!==qs))throw nu=wg,x1;i.flags|=8192}}function zf(i,o){o!==null&&(i.flags|=4),i.flags&16384&&(o=i.tag!==22?gs():536870912,i.lanes|=o,yl|=o)}function fu(i,o){if(!Pt)switch(i.tailMode){case"hidden":o=i.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?i.tail=null:d.sibling=null;break;case"collapsed":d=i.tail;for(var m=null;d!==null;)d.alternate!==null&&(m=d),d=d.sibling;m===null?o||i.tail===null?i.tail=null:i.tail.sibling=null:m.sibling=null}}function sn(i){var o=i.alternate!==null&&i.alternate.child===i.child,d=0,m=0;if(o)for(var v=i.child;v!==null;)d|=v.lanes|v.childLanes,m|=v.subtreeFlags&65011712,m|=v.flags&65011712,v.return=i,v=v.sibling;else for(v=i.child;v!==null;)d|=v.lanes|v.childLanes,m|=v.subtreeFlags,m|=v.flags,v.return=i,v=v.sibling;return i.subtreeFlags|=m,i.childLanes=d,o}function S4(i,o,d){var m=o.pendingProps;switch(hg(o),o.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sn(o),null;case 1:return sn(o),null;case 3:return d=o.stateNode,m=null,i!==null&&(m=i.memoizedState.cache),o.memoizedState.cache!==m&&(o.flags|=2048),xi(Mn),Qe(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(i===null||i.child===null)&&(Zc(o)?_i(o):i===null||i.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,h1())),sn(o),null;case 26:return d=o.memoizedState,i===null?(_i(o),d!==null?(sn(o),I_(o,d)):(sn(o),o.flags&=-16777217)):d?d!==i.memoizedState?(_i(o),sn(o),I_(o,d)):(sn(o),o.flags&=-16777217):(i.memoizedProps!==m&&_i(o),sn(o),o.flags&=-16777217),null;case 27:Q(o),d=Ne.current;var v=o.type;if(i!==null&&o.stateNode!=null)i.memoizedProps!==m&&_i(o);else{if(!m){if(o.stateNode===null)throw Error(r(166));return sn(o),null}i=pe.current,Zc(o)?d1(o):(i=Ik(v,m,d),o.stateNode=i,_i(o))}return sn(o),null;case 5:if(Q(o),d=o.type,i!==null&&o.stateNode!=null)i.memoizedProps!==m&&_i(o);else{if(!m){if(o.stateNode===null)throw Error(r(166));return sn(o),null}if(i=pe.current,Zc(o))d1(o);else{switch(v=Xf(Ne.current),i){case 1:i=v.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:i=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":i=v.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":i=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":i=v.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof m.is=="string"?v.createElement("select",{is:m.is}):v.createElement("select"),m.multiple?i.multiple=!0:m.size&&(i.size=m.size);break;default:i=typeof m.is=="string"?v.createElement(d,{is:m.is}):v.createElement(d)}}i[We]=o,i[ft]=m;e:for(v=o.child;v!==null;){if(v.tag===5||v.tag===6)i.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===o)break e;for(;v.sibling===null;){if(v.return===null||v.return===o)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}o.stateNode=i;e:switch(Yn(i,d,m),d){case"button":case"input":case"select":case"textarea":i=!!m.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&_i(o)}}return sn(o),o.flags&=-16777217,null;case 6:if(i&&o.stateNode!=null)i.memoizedProps!==m&&_i(o);else{if(typeof m!="string"&&o.stateNode===null)throw Error(r(166));if(i=Ne.current,Zc(o)){if(i=o.stateNode,d=o.memoizedProps,m=null,v=cr,v!==null)switch(v.tag){case 27:case 5:m=v.memoizedProps}i[We]=o,i=!!(i.nodeValue===d||m!==null&&m.suppressHydrationWarning===!0||Ek(i.nodeValue,d)),i||so(o)}else i=Xf(i).createTextNode(m),i[We]=o,o.stateNode=i}return sn(o),null;case 13:if(m=o.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(v=Zc(o),m!==null&&m.dehydrated!==null){if(i===null){if(!v)throw Error(r(318));if(v=o.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(r(317));v[We]=o}else Wc(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;sn(o),v=!1}else v=h1(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=v),v=!0;if(!v)return o.flags&256?(bi(o),o):(bi(o),null)}if(bi(o),(o.flags&128)!==0)return o.lanes=d,o;if(d=m!==null,i=i!==null&&i.memoizedState!==null,d){m=o.child,v=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(v=m.alternate.memoizedState.cachePool.pool);var b=null;m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(b=m.memoizedState.cachePool.pool),b!==v&&(m.flags|=2048)}return d!==i&&d&&(o.child.flags|=8192),zf(o,o.updateQueue),sn(o),null;case 4:return Qe(),i===null&&jv(o.stateNode.containerInfo),sn(o),null;case 10:return xi(o.type),sn(o),null;case 19:if(ie(Dn),v=o.memoizedState,v===null)return sn(o),null;if(m=(o.flags&128)!==0,b=v.rendering,b===null)if(m)fu(v,!1);else{if(hn!==0||i!==null&&(i.flags&128)!==0)for(i=o.child;i!==null;){if(b=Df(i),b!==null){for(o.flags|=128,fu(v,!1),i=b.updateQueue,o.updateQueue=i,zf(o,i),o.subtreeFlags=0,i=d,d=o.child;d!==null;)c1(d,i),d=d.sibling;return P(Dn,Dn.current&1|2),o.child}i=i.sibling}v.tail!==null&&De()>Uf&&(o.flags|=128,m=!0,fu(v,!1),o.lanes=4194304)}else{if(!m)if(i=Df(b),i!==null){if(o.flags|=128,m=!0,i=i.updateQueue,o.updateQueue=i,zf(o,i),fu(v,!0),v.tail===null&&v.tailMode==="hidden"&&!b.alternate&&!Pt)return sn(o),null}else 2*De()-v.renderingStartTime>Uf&&d!==536870912&&(o.flags|=128,m=!0,fu(v,!1),o.lanes=4194304);v.isBackwards?(b.sibling=o.child,o.child=b):(i=v.last,i!==null?i.sibling=b:o.child=b,v.last=b)}return v.tail!==null?(o=v.tail,v.rendering=o,v.tail=o.sibling,v.renderingStartTime=De(),o.sibling=null,i=Dn.current,P(Dn,m?i&1|2:i&1),o):(sn(o),null);case 22:case 23:return bi(o),Cg(),m=o.memoizedState!==null,i!==null?i.memoizedState!==null!==m&&(o.flags|=8192):m&&(o.flags|=8192),m?(d&536870912)!==0&&(o.flags&128)===0&&(sn(o),o.subtreeFlags&6&&(o.flags|=8192)):sn(o),d=o.updateQueue,d!==null&&zf(o,d.retryQueue),d=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),m=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(m=o.memoizedState.cachePool.pool),m!==d&&(o.flags|=2048),i!==null&&ie(oo),null;case 24:return d=null,i!==null&&(d=i.memoizedState.cache),o.memoizedState.cache!==d&&(o.flags|=2048),xi(Mn),sn(o),null;case 25:return null;case 30:return null}throw Error(r(156,o.tag))}function j4(i,o){switch(hg(o),o.tag){case 1:return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 3:return xi(Mn),Qe(),i=o.flags,(i&65536)!==0&&(i&128)===0?(o.flags=i&-65537|128,o):null;case 26:case 27:case 5:return Q(o),null;case 13:if(bi(o),i=o.memoizedState,i!==null&&i.dehydrated!==null){if(o.alternate===null)throw Error(r(340));Wc()}return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 19:return ie(Dn),null;case 4:return Qe(),null;case 10:return xi(o.type),null;case 22:case 23:return bi(o),Cg(),i!==null&&ie(oo),i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 24:return xi(Mn),null;case 25:return null;default:return null}}function L_(i,o){switch(hg(o),o.tag){case 3:xi(Mn),Qe();break;case 26:case 27:case 5:Q(o);break;case 4:Qe();break;case 13:bi(o);break;case 19:ie(Dn);break;case 10:xi(o.type);break;case 22:case 23:bi(o),Cg(),i!==null&&ie(oo);break;case 24:xi(Mn)}}function hu(i,o){try{var d=o.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var v=m.next;d=v;do{if((d.tag&i)===i){m=void 0;var b=d.create,O=d.inst;m=b(),O.destroy=m}d=d.next}while(d!==v)}}catch($){Yt(o,o.return,$)}}function aa(i,o,d){try{var m=o.updateQueue,v=m!==null?m.lastEffect:null;if(v!==null){var b=v.next;m=b;do{if((m.tag&i)===i){var O=m.inst,$=O.destroy;if($!==void 0){O.destroy=void 0,v=o;var Y=d,ee=$;try{ee()}catch(oe){Yt(v,Y,oe)}}}m=m.next}while(m!==b)}}catch(oe){Yt(o,o.return,oe)}}function P_(i){var o=i.updateQueue;if(o!==null){var d=i.stateNode;try{S1(o,d)}catch(m){Yt(i,i.return,m)}}}function $_(i,o,d){d.props=co(i.type,i.memoizedProps),d.state=i.memoizedState;try{d.componentWillUnmount()}catch(m){Yt(i,o,m)}}function mu(i,o){try{var d=i.ref;if(d!==null){switch(i.tag){case 26:case 27:case 5:var m=i.stateNode;break;case 30:m=i.stateNode;break;default:m=i.stateNode}typeof d=="function"?i.refCleanup=d(m):d.current=m}}catch(v){Yt(i,o,v)}}function Hs(i,o){var d=i.ref,m=i.refCleanup;if(d!==null)if(typeof m=="function")try{m()}catch(v){Yt(i,o,v)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(v){Yt(i,o,v)}else d.current=null}function z_(i){var o=i.type,d=i.memoizedProps,m=i.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":d.autoFocus&&m.focus();break e;case"img":d.src?m.src=d.src:d.srcSet&&(m.srcset=d.srcSet)}}catch(v){Yt(i,i.return,v)}}function tv(i,o,d){try{var m=i.stateNode;K4(m,i.type,d,o),m[ft]=o}catch(v){Yt(i,i.return,v)}}function F_(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&ma(i.type)||i.tag===4}function nv(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||F_(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&ma(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function rv(i,o,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,o?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(i,o):(o=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,o.appendChild(i),d=d._reactRootContainer,d!=null||o.onclick!==null||(o.onclick=Qf));else if(m!==4&&(m===27&&ma(i.type)&&(d=i.stateNode,o=null),i=i.child,i!==null))for(rv(i,o,d),i=i.sibling;i!==null;)rv(i,o,d),i=i.sibling}function Ff(i,o,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,o?d.insertBefore(i,o):d.appendChild(i);else if(m!==4&&(m===27&&ma(i.type)&&(d=i.stateNode),i=i.child,i!==null))for(Ff(i,o,d),i=i.sibling;i!==null;)Ff(i,o,d),i=i.sibling}function B_(i){var o=i.stateNode,d=i.memoizedProps;try{for(var m=i.type,v=o.attributes;v.length;)o.removeAttributeNode(v[0]);Yn(o,m,d),o[We]=i,o[ft]=d}catch(b){Yt(i,i.return,b)}}var ki=!1,vn=!1,sv=!1,U_=typeof WeakSet=="function"?WeakSet:Set,Bn=null;function N4(i,o){if(i=i.containerInfo,Ev=sh,i=Jw(i),ng(i)){if("selectionStart"in i)var d={start:i.selectionStart,end:i.selectionEnd};else e:{d=(d=i.ownerDocument)&&d.defaultView||window;var m=d.getSelection&&d.getSelection();if(m&&m.rangeCount!==0){d=m.anchorNode;var v=m.anchorOffset,b=m.focusNode;m=m.focusOffset;try{d.nodeType,b.nodeType}catch{d=null;break e}var O=0,$=-1,Y=-1,ee=0,oe=0,fe=i,te=null;t:for(;;){for(var re;fe!==d||v!==0&&fe.nodeType!==3||($=O+v),fe!==b||m!==0&&fe.nodeType!==3||(Y=O+m),fe.nodeType===3&&(O+=fe.nodeValue.length),(re=fe.firstChild)!==null;)te=fe,fe=re;for(;;){if(fe===i)break t;if(te===d&&++ee===v&&($=O),te===b&&++oe===m&&(Y=O),(re=fe.nextSibling)!==null)break;fe=te,te=fe.parentNode}fe=re}d=$===-1||Y===-1?null:{start:$,end:Y}}else d=null}d=d||{start:0,end:0}}else d=null;for(Tv={focusedElem:i,selectionRange:d},sh=!1,Bn=o;Bn!==null;)if(o=Bn,i=o.child,(o.subtreeFlags&1024)!==0&&i!==null)i.return=o,Bn=i;else for(;Bn!==null;){switch(o=Bn,b=o.alternate,i=o.flags,o.tag){case 0:break;case 11:case 15:break;case 1:if((i&1024)!==0&&b!==null){i=void 0,d=o,v=b.memoizedProps,b=b.memoizedState,m=d.stateNode;try{var at=co(d.type,v,d.elementType===d.type);i=m.getSnapshotBeforeUpdate(at,b),m.__reactInternalSnapshotBeforeUpdate=i}catch(tt){Yt(d,d.return,tt)}}break;case 3:if((i&1024)!==0){if(i=o.stateNode.containerInfo,d=i.nodeType,d===9)Rv(i);else if(d===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Rv(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(r(163))}if(i=o.sibling,i!==null){i.return=o.return,Bn=i;break}Bn=o.return}}function q_(i,o,d){var m=d.flags;switch(d.tag){case 0:case 11:case 15:oa(i,d),m&4&&hu(5,d);break;case 1:if(oa(i,d),m&4)if(i=d.stateNode,o===null)try{i.componentDidMount()}catch(O){Yt(d,d.return,O)}else{var v=co(d.type,o.memoizedProps);o=o.memoizedState;try{i.componentDidUpdate(v,o,i.__reactInternalSnapshotBeforeUpdate)}catch(O){Yt(d,d.return,O)}}m&64&&P_(d),m&512&&mu(d,d.return);break;case 3:if(oa(i,d),m&64&&(i=d.updateQueue,i!==null)){if(o=null,d.child!==null)switch(d.child.tag){case 27:case 5:o=d.child.stateNode;break;case 1:o=d.child.stateNode}try{S1(i,o)}catch(O){Yt(d,d.return,O)}}break;case 27:o===null&&m&4&&B_(d);case 26:case 5:oa(i,d),o===null&&m&4&&z_(d),m&512&&mu(d,d.return);break;case 12:oa(i,d);break;case 13:oa(i,d),m&4&&K_(i,d),m&64&&(i=d.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(d=I4.bind(null,d),J4(i,d))));break;case 22:if(m=d.memoizedState!==null||ki,!m){o=o!==null&&o.memoizedState!==null||vn,v=ki;var b=vn;ki=m,(vn=o)&&!b?la(i,d,(d.subtreeFlags&8772)!==0):oa(i,d),ki=v,vn=b}break;case 30:break;default:oa(i,d)}}function H_(i){var o=i.alternate;o!==null&&(i.alternate=null,H_(o)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(o=i.stateNode,o!==null&&Go(o)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var rn=null,wr=!1;function Si(i,o,d){for(d=d.child;d!==null;)V_(i,o,d),d=d.sibling}function V_(i,o,d){if(me&&typeof me.onCommitFiberUnmount=="function")try{me.onCommitFiberUnmount(J,d)}catch{}switch(d.tag){case 26:vn||Hs(d,o),Si(i,o,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:vn||Hs(d,o);var m=rn,v=wr;ma(d.type)&&(rn=d.stateNode,wr=!1),Si(i,o,d),ku(d.stateNode),rn=m,wr=v;break;case 5:vn||Hs(d,o);case 6:if(m=rn,v=wr,rn=null,Si(i,o,d),rn=m,wr=v,rn!==null)if(wr)try{(rn.nodeType===9?rn.body:rn.nodeName==="HTML"?rn.ownerDocument.body:rn).removeChild(d.stateNode)}catch(b){Yt(d,o,b)}else try{rn.removeChild(d.stateNode)}catch(b){Yt(d,o,b)}break;case 18:rn!==null&&(wr?(i=rn,Mk(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,d.stateNode),Ou(i)):Mk(rn,d.stateNode));break;case 4:m=rn,v=wr,rn=d.stateNode.containerInfo,wr=!0,Si(i,o,d),rn=m,wr=v;break;case 0:case 11:case 14:case 15:vn||aa(2,d,o),vn||aa(4,d,o),Si(i,o,d);break;case 1:vn||(Hs(d,o),m=d.stateNode,typeof m.componentWillUnmount=="function"&&$_(d,o,m)),Si(i,o,d);break;case 21:Si(i,o,d);break;case 22:vn=(m=vn)||d.memoizedState!==null,Si(i,o,d),vn=m;break;default:Si(i,o,d)}}function K_(i,o){if(o.memoizedState===null&&(i=o.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Ou(i)}catch(d){Yt(o,o.return,d)}}function C4(i){switch(i.tag){case 13:case 19:var o=i.stateNode;return o===null&&(o=i.stateNode=new U_),o;case 22:return i=i.stateNode,o=i._retryCache,o===null&&(o=i._retryCache=new U_),o;default:throw Error(r(435,i.tag))}}function iv(i,o){var d=C4(i);o.forEach(function(m){var v=L4.bind(null,i,m);d.has(m)||(d.add(m),m.then(v,v))})}function Dr(i,o){var d=o.deletions;if(d!==null)for(var m=0;m<d.length;m++){var v=d[m],b=i,O=o,$=O;e:for(;$!==null;){switch($.tag){case 27:if(ma($.type)){rn=$.stateNode,wr=!1;break e}break;case 5:rn=$.stateNode,wr=!1;break e;case 3:case 4:rn=$.stateNode.containerInfo,wr=!0;break e}$=$.return}if(rn===null)throw Error(r(160));V_(b,O,v),rn=null,wr=!1,b=v.alternate,b!==null&&(b.return=null),v.return=null}if(o.subtreeFlags&13878)for(o=o.child;o!==null;)Y_(o,i),o=o.sibling}var ws=null;function Y_(i,o){var d=i.alternate,m=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Dr(o,i),Ir(i),m&4&&(aa(3,i,i.return),hu(3,i),aa(5,i,i.return));break;case 1:Dr(o,i),Ir(i),m&512&&(vn||d===null||Hs(d,d.return)),m&64&&ki&&(i=i.updateQueue,i!==null&&(m=i.callbacks,m!==null&&(d=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=d===null?m:d.concat(m))));break;case 26:var v=ws;if(Dr(o,i),Ir(i),m&512&&(vn||d===null||Hs(d,d.return)),m&4){var b=d!==null?d.memoizedState:null;if(m=i.memoizedState,d===null)if(m===null)if(i.stateNode===null){e:{m=i.type,d=i.memoizedProps,v=v.ownerDocument||v;t:switch(m){case"title":b=v.getElementsByTagName("title")[0],(!b||b[mn]||b[We]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=v.createElement(m),v.head.insertBefore(b,v.querySelector("head > title"))),Yn(b,m,d),b[We]=i,un(b),m=b;break e;case"link":var O=Bk("link","href",v).get(m+(d.href||""));if(O){for(var $=0;$<O.length;$++)if(b=O[$],b.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&b.getAttribute("rel")===(d.rel==null?null:d.rel)&&b.getAttribute("title")===(d.title==null?null:d.title)&&b.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){O.splice($,1);break t}}b=v.createElement(m),Yn(b,m,d),v.head.appendChild(b);break;case"meta":if(O=Bk("meta","content",v).get(m+(d.content||""))){for($=0;$<O.length;$++)if(b=O[$],b.getAttribute("content")===(d.content==null?null:""+d.content)&&b.getAttribute("name")===(d.name==null?null:d.name)&&b.getAttribute("property")===(d.property==null?null:d.property)&&b.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&b.getAttribute("charset")===(d.charSet==null?null:d.charSet)){O.splice($,1);break t}}b=v.createElement(m),Yn(b,m,d),v.head.appendChild(b);break;default:throw Error(r(468,m))}b[We]=i,un(b),m=b}i.stateNode=m}else Uk(v,i.type,i.stateNode);else i.stateNode=Fk(v,m,i.memoizedProps);else b!==m?(b===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):b.count--,m===null?Uk(v,i.type,i.stateNode):Fk(v,m,i.memoizedProps)):m===null&&i.stateNode!==null&&tv(i,i.memoizedProps,d.memoizedProps)}break;case 27:Dr(o,i),Ir(i),m&512&&(vn||d===null||Hs(d,d.return)),d!==null&&m&4&&tv(i,i.memoizedProps,d.memoizedProps);break;case 5:if(Dr(o,i),Ir(i),m&512&&(vn||d===null||Hs(d,d.return)),i.flags&32){v=i.stateNode;try{Qo(v,"")}catch(re){Yt(i,i.return,re)}}m&4&&i.stateNode!=null&&(v=i.memoizedProps,tv(i,v,d!==null?d.memoizedProps:v)),m&1024&&(sv=!0);break;case 6:if(Dr(o,i),Ir(i),m&4){if(i.stateNode===null)throw Error(r(162));m=i.memoizedProps,d=i.stateNode;try{d.nodeValue=m}catch(re){Yt(i,i.return,re)}}break;case 3:if(th=null,v=ws,ws=Jf(o.containerInfo),Dr(o,i),ws=v,Ir(i),m&4&&d!==null&&d.memoizedState.isDehydrated)try{Ou(o.containerInfo)}catch(re){Yt(i,i.return,re)}sv&&(sv=!1,G_(i));break;case 4:m=ws,ws=Jf(i.stateNode.containerInfo),Dr(o,i),Ir(i),ws=m;break;case 12:Dr(o,i),Ir(i);break;case 13:Dr(o,i),Ir(i),i.child.flags&8192&&i.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(dv=De()),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,iv(i,m)));break;case 22:v=i.memoizedState!==null;var Y=d!==null&&d.memoizedState!==null,ee=ki,oe=vn;if(ki=ee||v,vn=oe||Y,Dr(o,i),vn=oe,ki=ee,Ir(i),m&8192)e:for(o=i.stateNode,o._visibility=v?o._visibility&-2:o._visibility|1,v&&(d===null||Y||ki||vn||uo(i)),d=null,o=i;;){if(o.tag===5||o.tag===26){if(d===null){Y=d=o;try{if(b=Y.stateNode,v)O=b.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{$=Y.stateNode;var fe=Y.memoizedProps.style,te=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;$.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(re){Yt(Y,Y.return,re)}}}else if(o.tag===6){if(d===null){Y=o;try{Y.stateNode.nodeValue=v?"":Y.memoizedProps}catch(re){Yt(Y,Y.return,re)}}}else if((o.tag!==22&&o.tag!==23||o.memoizedState===null||o===i)&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===i)break e;for(;o.sibling===null;){if(o.return===null||o.return===i)break e;d===o&&(d=null),o=o.return}d===o&&(d=null),o.sibling.return=o.return,o=o.sibling}m&4&&(m=i.updateQueue,m!==null&&(d=m.retryQueue,d!==null&&(m.retryQueue=null,iv(i,d))));break;case 19:Dr(o,i),Ir(i),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,iv(i,m)));break;case 30:break;case 21:break;default:Dr(o,i),Ir(i)}}function Ir(i){var o=i.flags;if(o&2){try{for(var d,m=i.return;m!==null;){if(F_(m)){d=m;break}m=m.return}if(d==null)throw Error(r(160));switch(d.tag){case 27:var v=d.stateNode,b=nv(i);Ff(i,b,v);break;case 5:var O=d.stateNode;d.flags&32&&(Qo(O,""),d.flags&=-33);var $=nv(i);Ff(i,$,O);break;case 3:case 4:var Y=d.stateNode.containerInfo,ee=nv(i);rv(i,ee,Y);break;default:throw Error(r(161))}}catch(oe){Yt(i,i.return,oe)}i.flags&=-3}o&4096&&(i.flags&=-4097)}function G_(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var o=i;G_(o),o.tag===5&&o.flags&1024&&o.stateNode.reset(),i=i.sibling}}function oa(i,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)q_(i,o.alternate,o),o=o.sibling}function uo(i){for(i=i.child;i!==null;){var o=i;switch(o.tag){case 0:case 11:case 14:case 15:aa(4,o,o.return),uo(o);break;case 1:Hs(o,o.return);var d=o.stateNode;typeof d.componentWillUnmount=="function"&&$_(o,o.return,d),uo(o);break;case 27:ku(o.stateNode);case 26:case 5:Hs(o,o.return),uo(o);break;case 22:o.memoizedState===null&&uo(o);break;case 30:uo(o);break;default:uo(o)}i=i.sibling}}function la(i,o,d){for(d=d&&(o.subtreeFlags&8772)!==0,o=o.child;o!==null;){var m=o.alternate,v=i,b=o,O=b.flags;switch(b.tag){case 0:case 11:case 15:la(v,b,d),hu(4,b);break;case 1:if(la(v,b,d),m=b,v=m.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(ee){Yt(m,m.return,ee)}if(m=b,v=m.updateQueue,v!==null){var $=m.stateNode;try{var Y=v.shared.hiddenCallbacks;if(Y!==null)for(v.shared.hiddenCallbacks=null,v=0;v<Y.length;v++)k1(Y[v],$)}catch(ee){Yt(m,m.return,ee)}}d&&O&64&&P_(b),mu(b,b.return);break;case 27:B_(b);case 26:case 5:la(v,b,d),d&&m===null&&O&4&&z_(b),mu(b,b.return);break;case 12:la(v,b,d);break;case 13:la(v,b,d),d&&O&4&&K_(v,b);break;case 22:b.memoizedState===null&&la(v,b,d),mu(b,b.return);break;case 30:break;default:la(v,b,d)}o=o.sibling}}function av(i,o){var d=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),i=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(i=o.memoizedState.cachePool.pool),i!==d&&(i!=null&&i.refCount++,d!=null&&Jc(d))}function ov(i,o){i=null,o.alternate!==null&&(i=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==i&&(o.refCount++,i!=null&&Jc(i))}function Vs(i,o,d,m){if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Z_(i,o,d,m),o=o.sibling}function Z_(i,o,d,m){var v=o.flags;switch(o.tag){case 0:case 11:case 15:Vs(i,o,d,m),v&2048&&hu(9,o);break;case 1:Vs(i,o,d,m);break;case 3:Vs(i,o,d,m),v&2048&&(i=null,o.alternate!==null&&(i=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==i&&(o.refCount++,i!=null&&Jc(i)));break;case 12:if(v&2048){Vs(i,o,d,m),i=o.stateNode;try{var b=o.memoizedProps,O=b.id,$=b.onPostCommit;typeof $=="function"&&$(O,o.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(Y){Yt(o,o.return,Y)}}else Vs(i,o,d,m);break;case 13:Vs(i,o,d,m);break;case 23:break;case 22:b=o.stateNode,O=o.alternate,o.memoizedState!==null?b._visibility&2?Vs(i,o,d,m):pu(i,o):b._visibility&2?Vs(i,o,d,m):(b._visibility|=2,gl(i,o,d,m,(o.subtreeFlags&10256)!==0)),v&2048&&av(O,o);break;case 24:Vs(i,o,d,m),v&2048&&ov(o.alternate,o);break;default:Vs(i,o,d,m)}}function gl(i,o,d,m,v){for(v=v&&(o.subtreeFlags&10256)!==0,o=o.child;o!==null;){var b=i,O=o,$=d,Y=m,ee=O.flags;switch(O.tag){case 0:case 11:case 15:gl(b,O,$,Y,v),hu(8,O);break;case 23:break;case 22:var oe=O.stateNode;O.memoizedState!==null?oe._visibility&2?gl(b,O,$,Y,v):pu(b,O):(oe._visibility|=2,gl(b,O,$,Y,v)),v&&ee&2048&&av(O.alternate,O);break;case 24:gl(b,O,$,Y,v),v&&ee&2048&&ov(O.alternate,O);break;default:gl(b,O,$,Y,v)}o=o.sibling}}function pu(i,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var d=i,m=o,v=m.flags;switch(m.tag){case 22:pu(d,m),v&2048&&av(m.alternate,m);break;case 24:pu(d,m),v&2048&&ov(m.alternate,m);break;default:pu(d,m)}o=o.sibling}}var gu=8192;function vl(i){if(i.subtreeFlags&gu)for(i=i.child;i!==null;)W_(i),i=i.sibling}function W_(i){switch(i.tag){case 26:vl(i),i.flags&gu&&i.memoizedState!==null&&f3(ws,i.memoizedState,i.memoizedProps);break;case 5:vl(i);break;case 3:case 4:var o=ws;ws=Jf(i.stateNode.containerInfo),vl(i),ws=o;break;case 22:i.memoizedState===null&&(o=i.alternate,o!==null&&o.memoizedState!==null?(o=gu,gu=16777216,vl(i),gu=o):vl(i));break;default:vl(i)}}function Q_(i){var o=i.alternate;if(o!==null&&(i=o.child,i!==null)){o.child=null;do o=i.sibling,i.sibling=null,i=o;while(i!==null)}}function vu(i){var o=i.deletions;if((i.flags&16)!==0){if(o!==null)for(var d=0;d<o.length;d++){var m=o[d];Bn=m,J_(m,i)}Q_(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)X_(i),i=i.sibling}function X_(i){switch(i.tag){case 0:case 11:case 15:vu(i),i.flags&2048&&aa(9,i,i.return);break;case 3:vu(i);break;case 12:vu(i);break;case 22:var o=i.stateNode;i.memoizedState!==null&&o._visibility&2&&(i.return===null||i.return.tag!==13)?(o._visibility&=-3,Bf(i)):vu(i);break;default:vu(i)}}function Bf(i){var o=i.deletions;if((i.flags&16)!==0){if(o!==null)for(var d=0;d<o.length;d++){var m=o[d];Bn=m,J_(m,i)}Q_(i)}for(i=i.child;i!==null;){switch(o=i,o.tag){case 0:case 11:case 15:aa(8,o,o.return),Bf(o);break;case 22:d=o.stateNode,d._visibility&2&&(d._visibility&=-3,Bf(o));break;default:Bf(o)}i=i.sibling}}function J_(i,o){for(;Bn!==null;){var d=Bn;switch(d.tag){case 0:case 11:case 15:aa(8,d,o);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var m=d.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:Jc(d.memoizedState.cache)}if(m=d.child,m!==null)m.return=d,Bn=m;else e:for(d=i;Bn!==null;){m=Bn;var v=m.sibling,b=m.return;if(H_(m),m===d){Bn=null;break e}if(v!==null){v.return=b,Bn=v;break e}Bn=b}}}var E4={getCacheForType:function(i){var o=Qn(Mn),d=o.data.get(i);return d===void 0&&(d=i(),o.data.set(i,d)),d}},T4=typeof WeakMap=="function"?WeakMap:Map,zt=0,Zt=null,_t=null,At=0,Ft=0,Lr=null,ca=!1,xl=!1,lv=!1,ji=0,hn=0,ua=0,fo=0,cv=0,ts=0,yl=0,xu=null,_r=null,uv=!1,dv=0,Uf=1/0,qf=null,da=null,Kn=0,fa=null,bl=null,wl=0,fv=0,hv=null,ek=null,yu=0,mv=null;function Pr(){if((zt&2)!==0&&At!==0)return At&-At;if(M.T!==null){var i=ll;return i!==0?i:wv()}return Te()}function tk(){ts===0&&(ts=(At&536870912)===0||Pt?ps():536870912);var i=es.current;return i!==null&&(i.flags|=32),ts}function $r(i,o,d){(i===Zt&&(Ft===2||Ft===9)||i.cancelPendingCommit!==null)&&(_l(i,0),ha(i,At,ts,!1)),ci(i,d),((zt&2)===0||i!==Zt)&&(i===Zt&&((zt&2)===0&&(fo|=d),hn===4&&ha(i,At,ts,!1)),Ks(i))}function nk(i,o,d){if((zt&6)!==0)throw Error(r(327));var m=!d&&(o&124)===0&&(o&i.expiredLanes)===0||Sn(i,o),v=m?R4(i,o):vv(i,o,!0),b=m;do{if(v===0){xl&&!m&&ha(i,o,0,!1);break}else{if(d=i.current.alternate,b&&!A4(d)){v=vv(i,o,!1),b=!1;continue}if(v===2){if(b=o,i.errorRecoveryDisabledLanes&b)var O=0;else O=i.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){o=O;e:{var $=i;v=xu;var Y=$.current.memoizedState.isDehydrated;if(Y&&(_l($,O).flags|=256),O=vv($,O,!1),O!==2){if(lv&&!Y){$.errorRecoveryDisabledLanes|=b,fo|=b,v=4;break e}b=_r,_r=v,b!==null&&(_r===null?_r=b:_r.push.apply(_r,b))}v=O}if(b=!1,v!==2)continue}}if(v===1){_l(i,0),ha(i,o,0,!0);break}e:{switch(m=i,b=v,b){case 0:case 1:throw Error(r(345));case 4:if((o&4194048)!==o)break;case 6:ha(m,o,ts,!ca);break e;case 2:_r=null;break;case 3:case 5:break;default:throw Error(r(329))}if((o&62914560)===o&&(v=dv+300-De(),10<v)){if(ha(m,o,ts,!ca),ln(m,0,!0)!==0)break e;m.timeoutHandle=Ok(rk.bind(null,m,d,_r,qf,uv,o,ts,fo,yl,ca,b,2,-0,0),v);break e}rk(m,d,_r,qf,uv,o,ts,fo,yl,ca,b,0,-0,0)}}break}while(!0);Ks(i)}function rk(i,o,d,m,v,b,O,$,Y,ee,oe,fe,te,re){if(i.timeoutHandle=-1,fe=o.subtreeFlags,(fe&8192||(fe&16785408)===16785408)&&(Nu={stylesheets:null,count:0,unsuspend:d3},W_(o),fe=h3(),fe!==null)){i.cancelPendingCommit=fe(uk.bind(null,i,o,b,d,m,v,O,$,Y,oe,1,te,re)),ha(i,b,O,!ee);return}uk(i,o,b,d,m,v,O,$,Y)}function A4(i){for(var o=i;;){var d=o.tag;if((d===0||d===11||d===15)&&o.flags&16384&&(d=o.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var m=0;m<d.length;m++){var v=d[m],b=v.getSnapshot;v=v.value;try{if(!Rr(b(),v))return!1}catch{return!1}}if(d=o.child,o.subtreeFlags&16384&&d!==null)d.return=o,o=d;else{if(o===i)break;for(;o.sibling===null;){if(o.return===null||o.return===i)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function ha(i,o,d,m){o&=~cv,o&=~fo,i.suspendedLanes|=o,i.pingedLanes&=~o,m&&(i.warmLanes|=o),m=i.expirationTimes;for(var v=o;0<v;){var b=31-He(v),O=1<<b;m[b]=-1,v&=~O}d!==0&&xs(i,d,o)}function Hf(){return(zt&6)===0?(bu(0),!1):!0}function pv(){if(_t!==null){if(Ft===0)var i=_t.return;else i=_t,vi=io=null,Rg(i),ml=null,uu=0,i=_t;for(;i!==null;)L_(i.alternate,i),i=i.return;_t=null}}function _l(i,o){var d=i.timeoutHandle;d!==-1&&(i.timeoutHandle=-1,G4(d)),d=i.cancelPendingCommit,d!==null&&(i.cancelPendingCommit=null,d()),pv(),Zt=i,_t=d=mi(i.current,null),At=o,Ft=0,Lr=null,ca=!1,xl=Sn(i,o),lv=!1,yl=ts=cv=fo=ua=hn=0,_r=xu=null,uv=!1,(o&8)!==0&&(o|=o&32);var m=i.entangledLanes;if(m!==0)for(i=i.entanglements,m&=o;0<m;){var v=31-He(m),b=1<<v;o|=i[v],m&=~b}return ji=o,ff(),d}function sk(i,o){vt=null,M.H=Of,o===tu||o===wf?(o=w1(),Ft=3):o===x1?(o=w1(),Ft=4):Ft=o===__?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,Lr=o,_t===null&&(hn=1,Lf(i,Wr(o,i.current)))}function ik(){var i=M.H;return M.H=Of,i===null?Of:i}function ak(){var i=M.A;return M.A=E4,i}function gv(){hn=4,ca||(At&4194048)!==At&&es.current!==null||(xl=!0),(ua&134217727)===0&&(fo&134217727)===0||Zt===null||ha(Zt,At,ts,!1)}function vv(i,o,d){var m=zt;zt|=2;var v=ik(),b=ak();(Zt!==i||At!==o)&&(qf=null,_l(i,o)),o=!1;var O=hn;e:do try{if(Ft!==0&&_t!==null){var $=_t,Y=Lr;switch(Ft){case 8:pv(),O=6;break e;case 3:case 2:case 9:case 6:es.current===null&&(o=!0);var ee=Ft;if(Ft=0,Lr=null,kl(i,$,Y,ee),d&&xl){O=0;break e}break;default:ee=Ft,Ft=0,Lr=null,kl(i,$,Y,ee)}}O4(),O=hn;break}catch(oe){sk(i,oe)}while(!0);return o&&i.shellSuspendCounter++,vi=io=null,zt=m,M.H=v,M.A=b,_t===null&&(Zt=null,At=0,ff()),O}function O4(){for(;_t!==null;)ok(_t)}function R4(i,o){var d=zt;zt|=2;var m=ik(),v=ak();Zt!==i||At!==o?(qf=null,Uf=De()+500,_l(i,o)):xl=Sn(i,o);e:do try{if(Ft!==0&&_t!==null){o=_t;var b=Lr;t:switch(Ft){case 1:Ft=0,Lr=null,kl(i,o,b,1);break;case 2:case 9:if(y1(b)){Ft=0,Lr=null,lk(o);break}o=function(){Ft!==2&&Ft!==9||Zt!==i||(Ft=7),Ks(i)},b.then(o,o);break e;case 3:Ft=7;break e;case 4:Ft=5;break e;case 7:y1(b)?(Ft=0,Lr=null,lk(o)):(Ft=0,Lr=null,kl(i,o,b,7));break;case 5:var O=null;switch(_t.tag){case 26:O=_t.memoizedState;case 5:case 27:var $=_t;if(!O||qk(O)){Ft=0,Lr=null;var Y=$.sibling;if(Y!==null)_t=Y;else{var ee=$.return;ee!==null?(_t=ee,Vf(ee)):_t=null}break t}}Ft=0,Lr=null,kl(i,o,b,5);break;case 6:Ft=0,Lr=null,kl(i,o,b,6);break;case 8:pv(),hn=6;break e;default:throw Error(r(462))}}M4();break}catch(oe){sk(i,oe)}while(!0);return vi=io=null,M.H=m,M.A=v,zt=d,_t!==null?0:(Zt=null,At=0,ff(),hn)}function M4(){for(;_t!==null&&!he();)ok(_t)}function ok(i){var o=D_(i.alternate,i,ji);i.memoizedProps=i.pendingProps,o===null?Vf(i):_t=o}function lk(i){var o=i,d=o.alternate;switch(o.tag){case 15:case 0:o=E_(d,o,o.pendingProps,o.type,void 0,At);break;case 11:o=E_(d,o,o.pendingProps,o.type.render,o.ref,At);break;case 5:Rg(o);default:L_(d,o),o=_t=c1(o,ji),o=D_(d,o,ji)}i.memoizedProps=i.pendingProps,o===null?Vf(i):_t=o}function kl(i,o,d,m){vi=io=null,Rg(o),ml=null,uu=0;var v=o.return;try{if(_4(i,v,o,d,At)){hn=1,Lf(i,Wr(d,i.current)),_t=null;return}}catch(b){if(v!==null)throw _t=v,b;hn=1,Lf(i,Wr(d,i.current)),_t=null;return}o.flags&32768?(Pt||m===1?i=!0:xl||(At&536870912)!==0?i=!1:(ca=i=!0,(m===2||m===9||m===3||m===6)&&(m=es.current,m!==null&&m.tag===13&&(m.flags|=16384))),ck(o,i)):Vf(o)}function Vf(i){var o=i;do{if((o.flags&32768)!==0){ck(o,ca);return}i=o.return;var d=S4(o.alternate,o,ji);if(d!==null){_t=d;return}if(o=o.sibling,o!==null){_t=o;return}_t=o=i}while(o!==null);hn===0&&(hn=5)}function ck(i,o){do{var d=j4(i.alternate,i);if(d!==null){d.flags&=32767,_t=d;return}if(d=i.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!o&&(i=i.sibling,i!==null)){_t=i;return}_t=i=d}while(i!==null);hn=6,_t=null}function uk(i,o,d,m,v,b,O,$,Y){i.cancelPendingCommit=null;do Kf();while(Kn!==0);if((zt&6)!==0)throw Error(r(327));if(o!==null){if(o===i.current)throw Error(r(177));if(b=o.lanes|o.childLanes,b|=og,vs(i,d,b,O,$,Y),i===Zt&&(_t=Zt=null,At=0),bl=o,fa=i,wl=d,fv=b,hv=v,ek=m,(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,P4(ze,function(){return pk(),null})):(i.callbackNode=null,i.callbackPriority=0),m=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||m){m=M.T,M.T=null,v=V.p,V.p=2,O=zt,zt|=4;try{N4(i,o,d)}finally{zt=O,V.p=v,M.T=m}}Kn=1,dk(),fk(),hk()}}function dk(){if(Kn===1){Kn=0;var i=fa,o=bl,d=(o.flags&13878)!==0;if((o.subtreeFlags&13878)!==0||d){d=M.T,M.T=null;var m=V.p;V.p=2;var v=zt;zt|=4;try{Y_(o,i);var b=Tv,O=Jw(i.containerInfo),$=b.focusedElem,Y=b.selectionRange;if(O!==$&&$&&$.ownerDocument&&Xw($.ownerDocument.documentElement,$)){if(Y!==null&&ng($)){var ee=Y.start,oe=Y.end;if(oe===void 0&&(oe=ee),"selectionStart"in $)$.selectionStart=ee,$.selectionEnd=Math.min(oe,$.value.length);else{var fe=$.ownerDocument||document,te=fe&&fe.defaultView||window;if(te.getSelection){var re=te.getSelection(),at=$.textContent.length,tt=Math.min(Y.start,at),Ht=Y.end===void 0?tt:Math.min(Y.end,at);!re.extend&&tt>Ht&&(O=Ht,Ht=tt,tt=O);var W=Qw($,tt),Z=Qw($,Ht);if(W&&Z&&(re.rangeCount!==1||re.anchorNode!==W.node||re.anchorOffset!==W.offset||re.focusNode!==Z.node||re.focusOffset!==Z.offset)){var X=fe.createRange();X.setStart(W.node,W.offset),re.removeAllRanges(),tt>Ht?(re.addRange(X),re.extend(Z.node,Z.offset)):(X.setEnd(Z.node,Z.offset),re.addRange(X))}}}}for(fe=[],re=$;re=re.parentNode;)re.nodeType===1&&fe.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$<fe.length;$++){var ce=fe[$];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}sh=!!Ev,Tv=Ev=null}finally{zt=v,V.p=m,M.T=d}}i.current=o,Kn=2}}function fk(){if(Kn===2){Kn=0;var i=fa,o=bl,d=(o.flags&8772)!==0;if((o.subtreeFlags&8772)!==0||d){d=M.T,M.T=null;var m=V.p;V.p=2;var v=zt;zt|=4;try{q_(i,o.alternate,o)}finally{zt=v,V.p=m,M.T=d}}Kn=3}}function hk(){if(Kn===4||Kn===3){Kn=0,Ee();var i=fa,o=bl,d=wl,m=ek;(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?Kn=5:(Kn=0,bl=fa=null,mk(i,i.pendingLanes));var v=i.pendingLanes;if(v===0&&(da=null),de(d),o=o.stateNode,me&&typeof me.onCommitFiberRoot=="function")try{me.onCommitFiberRoot(J,o,void 0,(o.current.flags&128)===128)}catch{}if(m!==null){o=M.T,v=V.p,V.p=2,M.T=null;try{for(var b=i.onRecoverableError,O=0;O<m.length;O++){var $=m[O];b($.value,{componentStack:$.stack})}}finally{M.T=o,V.p=v}}(wl&3)!==0&&Kf(),Ks(i),v=i.pendingLanes,(d&4194090)!==0&&(v&42)!==0?i===mv?yu++:(yu=0,mv=i):yu=0,bu(0)}}function mk(i,o){(i.pooledCacheLanes&=o)===0&&(o=i.pooledCache,o!=null&&(i.pooledCache=null,Jc(o)))}function Kf(i){return dk(),fk(),hk(),pk()}function pk(){if(Kn!==5)return!1;var i=fa,o=fv;fv=0;var d=de(wl),m=M.T,v=V.p;try{V.p=32>d?32:d,M.T=null,d=hv,hv=null;var b=fa,O=wl;if(Kn=0,bl=fa=null,wl=0,(zt&6)!==0)throw Error(r(331));var $=zt;if(zt|=4,X_(b.current),Z_(b,b.current,O,d),zt=$,bu(0,!1),me&&typeof me.onPostCommitFiberRoot=="function")try{me.onPostCommitFiberRoot(J,b)}catch{}return!0}finally{V.p=v,M.T=m,mk(i,o)}}function gk(i,o,d){o=Wr(d,o),o=Kg(i.stateNode,o,2),i=na(i,o,2),i!==null&&(ci(i,2),Ks(i))}function Yt(i,o,d){if(i.tag===3)gk(i,i,d);else for(;o!==null;){if(o.tag===3){gk(o,i,d);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(da===null||!da.has(m))){i=Wr(d,i),d=b_(2),m=na(o,d,2),m!==null&&(w_(d,m,o,i),ci(m,2),Ks(m));break}}o=o.return}}function xv(i,o,d){var m=i.pingCache;if(m===null){m=i.pingCache=new T4;var v=new Set;m.set(o,v)}else v=m.get(o),v===void 0&&(v=new Set,m.set(o,v));v.has(d)||(lv=!0,v.add(d),i=D4.bind(null,i,o,d),o.then(i,i))}function D4(i,o,d){var m=i.pingCache;m!==null&&m.delete(o),i.pingedLanes|=i.suspendedLanes&d,i.warmLanes&=~d,Zt===i&&(At&d)===d&&(hn===4||hn===3&&(At&62914560)===At&&300>De()-dv?(zt&2)===0&&_l(i,0):cv|=d,yl===At&&(yl=0)),Ks(i)}function vk(i,o){o===0&&(o=gs()),i=sl(i,o),i!==null&&(ci(i,o),Ks(i))}function I4(i){var o=i.memoizedState,d=0;o!==null&&(d=o.retryLane),vk(i,d)}function L4(i,o){var d=0;switch(i.tag){case 13:var m=i.stateNode,v=i.memoizedState;v!==null&&(d=v.retryLane);break;case 19:m=i.stateNode;break;case 22:m=i.stateNode._retryCache;break;default:throw Error(r(314))}m!==null&&m.delete(o),vk(i,d)}function P4(i,o){return Oe(i,o)}var Yf=null,Sl=null,yv=!1,Gf=!1,bv=!1,ho=0;function Ks(i){i!==Sl&&i.next===null&&(Sl===null?Yf=Sl=i:Sl=Sl.next=i),Gf=!0,yv||(yv=!0,z4())}function bu(i,o){if(!bv&&Gf){bv=!0;do for(var d=!1,m=Yf;m!==null;){if(i!==0){var v=m.pendingLanes;if(v===0)var b=0;else{var O=m.suspendedLanes,$=m.pingedLanes;b=(1<<31-He(42|i)+1)-1,b&=v&~(O&~$),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(d=!0,wk(m,b))}else b=At,b=ln(m,m===Zt?b:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(b&3)===0||Sn(m,b)||(d=!0,wk(m,b));m=m.next}while(d);bv=!1}}function $4(){xk()}function xk(){Gf=yv=!1;var i=0;ho!==0&&(Y4()&&(i=ho),ho=0);for(var o=De(),d=null,m=Yf;m!==null;){var v=m.next,b=yk(m,o);b===0?(m.next=null,d===null?Yf=v:d.next=v,v===null&&(Sl=d)):(d=m,(i!==0||(b&3)!==0)&&(Gf=!0)),m=v}bu(i)}function yk(i,o){for(var d=i.suspendedLanes,m=i.pingedLanes,v=i.expirationTimes,b=i.pendingLanes&-62914561;0<b;){var O=31-He(b),$=1<<O,Y=v[O];Y===-1?(($&d)===0||($&m)!==0)&&(v[O]=$n($,o)):Y<=o&&(i.expiredLanes|=$),b&=~$}if(o=Zt,d=At,d=ln(i,i===o?d:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),m=i.callbackNode,d===0||i===o&&(Ft===2||Ft===9)||i.cancelPendingCommit!==null)return m!==null&&m!==null&&le(m),i.callbackNode=null,i.callbackPriority=0;if((d&3)===0||Sn(i,d)){if(o=d&-d,o===i.callbackPriority)return o;switch(m!==null&&le(m),de(d)){case 2:case 8:d=Ce;break;case 32:d=ze;break;case 268435456:d=Se;break;default:d=ze}return m=bk.bind(null,i),d=Oe(d,m),i.callbackPriority=o,i.callbackNode=d,o}return m!==null&&m!==null&&le(m),i.callbackPriority=2,i.callbackNode=null,2}function bk(i,o){if(Kn!==0&&Kn!==5)return i.callbackNode=null,i.callbackPriority=0,null;var d=i.callbackNode;if(Kf()&&i.callbackNode!==d)return null;var m=At;return m=ln(i,i===Zt?m:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),m===0?null:(nk(i,m,o),yk(i,De()),i.callbackNode!=null&&i.callbackNode===d?bk.bind(null,i):null)}function wk(i,o){if(Kf())return null;nk(i,o,!0)}function z4(){Z4(function(){(zt&6)!==0?Oe(ue,$4):xk()})}function wv(){return ho===0&&(ho=ps()),ho}function _k(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:sf(""+i)}function kk(i,o){var d=o.ownerDocument.createElement("input");return d.name=o.name,d.value=o.value,i.id&&d.setAttribute("form",i.id),o.parentNode.insertBefore(d,o),i=new FormData(i),d.parentNode.removeChild(d),i}function F4(i,o,d,m,v){if(o==="submit"&&d&&d.stateNode===v){var b=_k((v[ft]||null).action),O=m.submitter;O&&(o=(o=O[ft]||null)?_k(o.formAction):O.getAttribute("formAction"),o!==null&&(b=o,O=null));var $=new cf("action","action",null,m,v);i.push({event:$,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(ho!==0){var Y=O?kk(v,O):new FormData(v);Bg(d,{pending:!0,data:Y,method:v.method,action:b},null,Y)}}else typeof b=="function"&&($.preventDefault(),Y=O?kk(v,O):new FormData(v),Bg(d,{pending:!0,data:Y,method:v.method,action:b},b,Y))},currentTarget:v}]})}}for(var _v=0;_v<ag.length;_v++){var kv=ag[_v],B4=kv.toLowerCase(),U4=kv[0].toUpperCase()+kv.slice(1);bs(B4,"on"+U4)}bs(n1,"onAnimationEnd"),bs(r1,"onAnimationIteration"),bs(s1,"onAnimationStart"),bs("dblclick","onDoubleClick"),bs("focusin","onFocus"),bs("focusout","onBlur"),bs(i4,"onTransitionRun"),bs(a4,"onTransitionStart"),bs(o4,"onTransitionCancel"),bs(i1,"onTransitionEnd"),Tt("onMouseEnter",["mouseout","mouseover"]),Tt("onMouseLeave",["mouseout","mouseover"]),Tt("onPointerEnter",["pointerout","pointerover"]),Tt("onPointerLeave",["pointerout","pointerover"]),je("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),je("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),je("onBeforeInput",["compositionend","keypress","textInput","paste"]),je("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),je("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),je("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wu="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(" "),q4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(wu));function Sk(i,o){o=(o&4)!==0;for(var d=0;d<i.length;d++){var m=i[d],v=m.event;m=m.listeners;e:{var b=void 0;if(o)for(var O=m.length-1;0<=O;O--){var $=m[O],Y=$.instance,ee=$.currentTarget;if($=$.listener,Y!==b&&v.isPropagationStopped())break e;b=$,v.currentTarget=ee;try{b(v)}catch(oe){If(oe)}v.currentTarget=null,b=Y}else for(O=0;O<m.length;O++){if($=m[O],Y=$.instance,ee=$.currentTarget,$=$.listener,Y!==b&&v.isPropagationStopped())break e;b=$,v.currentTarget=ee;try{b(v)}catch(oe){If(oe)}v.currentTarget=null,b=Y}}}}function kt(i,o){var d=o[zn];d===void 0&&(d=o[zn]=new Set);var m=i+"__bubble";d.has(m)||(jk(o,i,2,!1),d.add(m))}function Sv(i,o,d){var m=0;o&&(m|=4),jk(d,i,m,o)}var Zf="_reactListening"+Math.random().toString(36).slice(2);function jv(i){if(!i[Zf]){i[Zf]=!0,Jd.forEach(function(d){d!=="selectionchange"&&(q4.has(d)||Sv(d,!1,i),Sv(d,!0,i))});var o=i.nodeType===9?i:i.ownerDocument;o===null||o[Zf]||(o[Zf]=!0,Sv("selectionchange",!1,o))}}function jk(i,o,d,m){switch(Zk(o)){case 2:var v=g3;break;case 8:v=v3;break;default:v=zv}d=v.bind(null,o,d,i),v=void 0,!Yp||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),m?v!==void 0?i.addEventListener(o,d,{capture:!0,passive:v}):i.addEventListener(o,d,!0):v!==void 0?i.addEventListener(o,d,{passive:v}):i.addEventListener(o,d,!1)}function Nv(i,o,d,m,v){var b=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var O=m.tag;if(O===3||O===4){var $=m.stateNode.containerInfo;if($===v)break;if(O===4)for(O=m.return;O!==null;){var Y=O.tag;if((Y===3||Y===4)&&O.stateNode.containerInfo===v)return;O=O.return}for(;$!==null;){if(O=di($),O===null)return;if(Y=O.tag,Y===5||Y===6||Y===26||Y===27){m=b=O;continue e}$=$.parentNode}}m=m.return}Rw(function(){var ee=b,oe=Vp(d),fe=[];e:{var te=a1.get(i);if(te!==void 0){var re=cf,at=i;switch(i){case"keypress":if(of(d)===0)break e;case"keydown":case"keyup":re=PM;break;case"focusin":at="focus",re=Qp;break;case"focusout":at="blur",re=Qp;break;case"beforeblur":case"afterblur":re=Qp;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":re=Iw;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=jM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=FM;break;case n1:case r1:case s1:re=EM;break;case i1:re=UM;break;case"scroll":case"scrollend":re=kM;break;case"wheel":re=HM;break;case"copy":case"cut":case"paste":re=AM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=Pw;break;case"toggle":case"beforetoggle":re=KM}var tt=(o&4)!==0,Ht=!tt&&(i==="scroll"||i==="scrollend"),W=tt?te!==null?te+"Capture":null:te;tt=[];for(var Z=ee,X;Z!==null;){var ce=Z;if(X=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||X===null||W===null||(ce=Fc(Z,W),ce!=null&&tt.push(_u(Z,ce,X))),Ht)break;Z=Z.return}0<tt.length&&(te=new re(te,at,null,d,oe),fe.push({event:te,listeners:tt}))}}if((o&7)===0){e:{if(te=i==="mouseover"||i==="pointerover",re=i==="mouseout"||i==="pointerout",te&&d!==Hp&&(at=d.relatedTarget||d.fromElement)&&(di(at)||at[Kt]))break e;if((re||te)&&(te=oe.window===oe?oe:(te=oe.ownerDocument)?te.defaultView||te.parentWindow:window,re?(at=d.relatedTarget||d.toElement,re=ee,at=at?di(at):null,at!==null&&(Ht=a(at),tt=at.tag,at!==Ht||tt!==5&&tt!==27&&tt!==6)&&(at=null)):(re=null,at=ee),re!==at)){if(tt=Iw,ce="onMouseLeave",W="onMouseEnter",Z="mouse",(i==="pointerout"||i==="pointerover")&&(tt=Pw,ce="onPointerLeave",W="onPointerEnter",Z="pointer"),Ht=re==null?te:Fs(re),X=at==null?te:Fs(at),te=new tt(ce,Z+"leave",re,d,oe),te.target=Ht,te.relatedTarget=X,ce=null,di(oe)===ee&&(tt=new tt(W,Z+"enter",at,d,oe),tt.target=X,tt.relatedTarget=Ht,ce=tt),Ht=ce,re&&at)t:{for(tt=re,W=at,Z=0,X=tt;X;X=jl(X))Z++;for(X=0,ce=W;ce;ce=jl(ce))X++;for(;0<Z-X;)tt=jl(tt),Z--;for(;0<X-Z;)W=jl(W),X--;for(;Z--;){if(tt===W||W!==null&&tt===W.alternate)break t;tt=jl(tt),W=jl(W)}tt=null}else tt=null;re!==null&&Nk(fe,te,re,tt,!1),at!==null&&Ht!==null&&Nk(fe,Ht,at,tt,!0)}}e:{if(te=ee?Fs(ee):window,re=te.nodeName&&te.nodeName.toLowerCase(),re==="select"||re==="input"&&te.type==="file")var Ve=Vw;else if(qw(te))if(Kw)Ve=n4;else{Ve=e4;var wt=JM}else re=te.nodeName,!re||re.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?ee&&qp(ee.elementType)&&(Ve=Vw):Ve=t4;if(Ve&&(Ve=Ve(i,ee))){Hw(fe,Ve,d,oe);break e}wt&&wt(i,te,ee),i==="focusout"&&ee&&te.type==="number"&&ee.memoizedProps.value!=null&&Up(te,"number",te.value)}switch(wt=ee?Fs(ee):window,i){case"focusin":(qw(wt)||wt.contentEditable==="true")&&(tl=wt,rg=ee,Gc=null);break;case"focusout":Gc=rg=tl=null;break;case"mousedown":sg=!0;break;case"contextmenu":case"mouseup":case"dragend":sg=!1,e1(fe,d,oe);break;case"selectionchange":if(s4)break;case"keydown":case"keyup":e1(fe,d,oe)}var Ze;if(Jp)e:{switch(i){case"compositionstart":var rt="onCompositionStart";break e;case"compositionend":rt="onCompositionEnd";break e;case"compositionupdate":rt="onCompositionUpdate";break e}rt=void 0}else el?Bw(i,d)&&(rt="onCompositionEnd"):i==="keydown"&&d.keyCode===229&&(rt="onCompositionStart");rt&&($w&&d.locale!=="ko"&&(el||rt!=="onCompositionStart"?rt==="onCompositionEnd"&&el&&(Ze=Mw()):(Xi=oe,Gp="value"in Xi?Xi.value:Xi.textContent,el=!0)),wt=Wf(ee,rt),0<wt.length&&(rt=new Lw(rt,i,null,d,oe),fe.push({event:rt,listeners:wt}),Ze?rt.data=Ze:(Ze=Uw(d),Ze!==null&&(rt.data=Ze)))),(Ze=GM?ZM(i,d):WM(i,d))&&(rt=Wf(ee,"onBeforeInput"),0<rt.length&&(wt=new Lw("onBeforeInput","beforeinput",null,d,oe),fe.push({event:wt,listeners:rt}),wt.data=Ze)),F4(fe,i,ee,d,oe)}Sk(fe,o)})}function _u(i,o,d){return{instance:i,listener:o,currentTarget:d}}function Wf(i,o){for(var d=o+"Capture",m=[];i!==null;){var v=i,b=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||b===null||(v=Fc(i,d),v!=null&&m.unshift(_u(i,v,b)),v=Fc(i,o),v!=null&&m.push(_u(i,v,b))),i.tag===3)return m;i=i.return}return[]}function jl(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function Nk(i,o,d,m,v){for(var b=o._reactName,O=[];d!==null&&d!==m;){var $=d,Y=$.alternate,ee=$.stateNode;if($=$.tag,Y!==null&&Y===m)break;$!==5&&$!==26&&$!==27||ee===null||(Y=ee,v?(ee=Fc(d,b),ee!=null&&O.unshift(_u(d,ee,Y))):v||(ee=Fc(d,b),ee!=null&&O.push(_u(d,ee,Y)))),d=d.return}O.length!==0&&i.push({event:o,listeners:O})}var H4=/\r\n?/g,V4=/\u0000|\uFFFD/g;function Ck(i){return(typeof i=="string"?i:""+i).replace(H4,`
|
|
25
|
-
`).replace(V4,"")}function Ek(i,o){return o=Ck(o),Ck(i)===o}function Qf(){}function qt(i,o,d,m,v,b){switch(d){case"children":typeof m=="string"?o==="body"||o==="textarea"&&m===""||Qo(i,m):(typeof m=="number"||typeof m=="bigint")&&o!=="body"&&Qo(i,""+m);break;case"className":tf(i,"class",m);break;case"tabIndex":tf(i,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":tf(i,d,m);break;case"style":Aw(i,m,b);break;case"data":if(o!=="object"){tf(i,"data",m);break}case"src":case"href":if(m===""&&(o!=="a"||d!=="href")){i.removeAttribute(d);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){i.removeAttribute(d);break}m=sf(""+m),i.setAttribute(d,m);break;case"action":case"formAction":if(typeof m=="function"){i.setAttribute(d,"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 b=="function"&&(d==="formAction"?(o!=="input"&&qt(i,o,"name",v.name,v,null),qt(i,o,"formEncType",v.formEncType,v,null),qt(i,o,"formMethod",v.formMethod,v,null),qt(i,o,"formTarget",v.formTarget,v,null)):(qt(i,o,"encType",v.encType,v,null),qt(i,o,"method",v.method,v,null),qt(i,o,"target",v.target,v,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){i.removeAttribute(d);break}m=sf(""+m),i.setAttribute(d,m);break;case"onClick":m!=null&&(i.onclick=Qf);break;case"onScroll":m!=null&&kt("scroll",i);break;case"onScrollEnd":m!=null&&kt("scrollend",i);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(d=m.__html,d!=null){if(v.children!=null)throw Error(r(60));i.innerHTML=d}}break;case"multiple":i.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":i.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){i.removeAttribute("xlink:href");break}d=sf(""+m),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(d,""+m):i.removeAttribute(d);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":m&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(d,""):i.removeAttribute(d);break;case"capture":case"download":m===!0?i.setAttribute(d,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(d,m):i.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?i.setAttribute(d,m):i.removeAttribute(d);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?i.removeAttribute(d):i.setAttribute(d,m);break;case"popover":kt("beforetoggle",i),kt("toggle",i),ef(i,"popover",m);break;case"xlinkActuate":fi(i,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":fi(i,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":fi(i,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":fi(i,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":fi(i,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":fi(i,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":fi(i,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":fi(i,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":fi(i,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":ef(i,"is",m);break;case"innerText":case"textContent":break;default:(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(d=wM.get(d)||d,ef(i,d,m))}}function Cv(i,o,d,m,v,b){switch(d){case"style":Aw(i,m,b);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(d=m.__html,d!=null){if(v.children!=null)throw Error(r(60));i.innerHTML=d}}break;case"children":typeof m=="string"?Qo(i,m):(typeof m=="number"||typeof m=="bigint")&&Qo(i,""+m);break;case"onScroll":m!=null&&kt("scroll",i);break;case"onScrollEnd":m!=null&&kt("scrollend",i);break;case"onClick":m!=null&&(i.onclick=Qf);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xe.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(v=d.endsWith("Capture"),o=d.slice(2,v?d.length-7:void 0),b=i[ft]||null,b=b!=null?b[d]:null,typeof b=="function"&&i.removeEventListener(o,b,v),typeof m=="function")){typeof b!="function"&&b!==null&&(d in i?i[d]=null:i.hasAttribute(d)&&i.removeAttribute(d)),i.addEventListener(o,m,v);break e}d in i?i[d]=m:m===!0?i.setAttribute(d,""):ef(i,d,m)}}}function Yn(i,o,d){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":kt("error",i),kt("load",i);var m=!1,v=!1,b;for(b in d)if(d.hasOwnProperty(b)){var O=d[b];if(O!=null)switch(b){case"src":m=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,o));default:qt(i,o,b,O,d,null)}}v&&qt(i,o,"srcSet",d.srcSet,d,null),m&&qt(i,o,"src",d.src,d,null);return;case"input":kt("invalid",i);var $=b=O=v=null,Y=null,ee=null;for(m in d)if(d.hasOwnProperty(m)){var oe=d[m];if(oe!=null)switch(m){case"name":v=oe;break;case"type":O=oe;break;case"checked":Y=oe;break;case"defaultChecked":ee=oe;break;case"value":b=oe;break;case"defaultValue":$=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(r(137,o));break;default:qt(i,o,m,oe,d,null)}}Nw(i,b,$,Y,ee,O,v,!1),nf(i);return;case"select":kt("invalid",i),m=O=b=null;for(v in d)if(d.hasOwnProperty(v)&&($=d[v],$!=null))switch(v){case"value":b=$;break;case"defaultValue":O=$;break;case"multiple":m=$;default:qt(i,o,v,$,d,null)}o=b,d=O,i.multiple=!!m,o!=null?Wo(i,!!m,o,!1):d!=null&&Wo(i,!!m,d,!0);return;case"textarea":kt("invalid",i),b=v=m=null;for(O in d)if(d.hasOwnProperty(O)&&($=d[O],$!=null))switch(O){case"value":m=$;break;case"defaultValue":v=$;break;case"children":b=$;break;case"dangerouslySetInnerHTML":if($!=null)throw Error(r(91));break;default:qt(i,o,O,$,d,null)}Ew(i,m,v,b),nf(i);return;case"option":for(Y in d)if(d.hasOwnProperty(Y)&&(m=d[Y],m!=null))switch(Y){case"selected":i.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:qt(i,o,Y,m,d,null)}return;case"dialog":kt("beforetoggle",i),kt("toggle",i),kt("cancel",i),kt("close",i);break;case"iframe":case"object":kt("load",i);break;case"video":case"audio":for(m=0;m<wu.length;m++)kt(wu[m],i);break;case"image":kt("error",i),kt("load",i);break;case"details":kt("toggle",i);break;case"embed":case"source":case"link":kt("error",i),kt("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in d)if(d.hasOwnProperty(ee)&&(m=d[ee],m!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,o));default:qt(i,o,ee,m,d,null)}return;default:if(qp(o)){for(oe in d)d.hasOwnProperty(oe)&&(m=d[oe],m!==void 0&&Cv(i,o,oe,m,d,void 0));return}}for($ in d)d.hasOwnProperty($)&&(m=d[$],m!=null&&qt(i,o,$,m,d,null))}function K4(i,o,d,m){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,b=null,O=null,$=null,Y=null,ee=null,oe=null;for(re in d){var fe=d[re];if(d.hasOwnProperty(re)&&fe!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":Y=fe;default:m.hasOwnProperty(re)||qt(i,o,re,null,m,fe)}}for(var te in m){var re=m[te];if(fe=d[te],m.hasOwnProperty(te)&&(re!=null||fe!=null))switch(te){case"type":b=re;break;case"name":v=re;break;case"checked":ee=re;break;case"defaultChecked":oe=re;break;case"value":O=re;break;case"defaultValue":$=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(r(137,o));break;default:re!==fe&&qt(i,o,te,re,m,fe)}}Bp(i,O,$,Y,ee,oe,b,v);return;case"select":re=O=$=te=null;for(b in d)if(Y=d[b],d.hasOwnProperty(b)&&Y!=null)switch(b){case"value":break;case"multiple":re=Y;default:m.hasOwnProperty(b)||qt(i,o,b,null,m,Y)}for(v in m)if(b=m[v],Y=d[v],m.hasOwnProperty(v)&&(b!=null||Y!=null))switch(v){case"value":te=b;break;case"defaultValue":$=b;break;case"multiple":O=b;default:b!==Y&&qt(i,o,v,b,m,Y)}o=$,d=O,m=re,te!=null?Wo(i,!!d,te,!1):!!m!=!!d&&(o!=null?Wo(i,!!d,o,!0):Wo(i,!!d,d?[]:"",!1));return;case"textarea":re=te=null;for($ in d)if(v=d[$],d.hasOwnProperty($)&&v!=null&&!m.hasOwnProperty($))switch($){case"value":break;case"children":break;default:qt(i,o,$,null,m,v)}for(O in m)if(v=m[O],b=d[O],m.hasOwnProperty(O)&&(v!=null||b!=null))switch(O){case"value":te=v;break;case"defaultValue":re=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:v!==b&&qt(i,o,O,v,m,b)}Cw(i,te,re);return;case"option":for(var at in d)if(te=d[at],d.hasOwnProperty(at)&&te!=null&&!m.hasOwnProperty(at))switch(at){case"selected":i.selected=!1;break;default:qt(i,o,at,null,m,te)}for(Y in m)if(te=m[Y],re=d[Y],m.hasOwnProperty(Y)&&te!==re&&(te!=null||re!=null))switch(Y){case"selected":i.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:qt(i,o,Y,te,m,re)}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 tt in d)te=d[tt],d.hasOwnProperty(tt)&&te!=null&&!m.hasOwnProperty(tt)&&qt(i,o,tt,null,m,te);for(ee in m)if(te=m[ee],re=d[ee],m.hasOwnProperty(ee)&&te!==re&&(te!=null||re!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(r(137,o));break;default:qt(i,o,ee,te,m,re)}return;default:if(qp(o)){for(var Ht in d)te=d[Ht],d.hasOwnProperty(Ht)&&te!==void 0&&!m.hasOwnProperty(Ht)&&Cv(i,o,Ht,void 0,m,te);for(oe in m)te=m[oe],re=d[oe],!m.hasOwnProperty(oe)||te===re||te===void 0&&re===void 0||Cv(i,o,oe,te,m,re);return}}for(var W in d)te=d[W],d.hasOwnProperty(W)&&te!=null&&!m.hasOwnProperty(W)&&qt(i,o,W,null,m,te);for(fe in m)te=m[fe],re=d[fe],!m.hasOwnProperty(fe)||te===re||te==null&&re==null||qt(i,o,fe,te,m,re)}var Ev=null,Tv=null;function Xf(i){return i.nodeType===9?i:i.ownerDocument}function Tk(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Ak(i,o){if(i===0)switch(o){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&o==="foreignObject"?0:i}function Av(i,o){return i==="textarea"||i==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.children=="bigint"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Ov=null;function Y4(){var i=window.event;return i&&i.type==="popstate"?i===Ov?!1:(Ov=i,!0):(Ov=null,!1)}var Ok=typeof setTimeout=="function"?setTimeout:void 0,G4=typeof clearTimeout=="function"?clearTimeout:void 0,Rk=typeof Promise=="function"?Promise:void 0,Z4=typeof queueMicrotask=="function"?queueMicrotask:typeof Rk<"u"?function(i){return Rk.resolve(null).then(i).catch(W4)}:Ok;function W4(i){setTimeout(function(){throw i})}function ma(i){return i==="head"}function Mk(i,o){var d=o,m=0,v=0;do{var b=d.nextSibling;if(i.removeChild(d),b&&b.nodeType===8)if(d=b.data,d==="/$"){if(0<m&&8>m){d=m;var O=i.ownerDocument;if(d&1&&ku(O.documentElement),d&2&&ku(O.body),d&4)for(d=O.head,ku(d),O=d.firstChild;O;){var $=O.nextSibling,Y=O.nodeName;O[mn]||Y==="SCRIPT"||Y==="STYLE"||Y==="LINK"&&O.rel.toLowerCase()==="stylesheet"||d.removeChild(O),O=$}}if(v===0){i.removeChild(b),Ou(o);return}v--}else d==="$"||d==="$?"||d==="$!"?v++:m=d.charCodeAt(0)-48;else m=0;d=b}while(d);Ou(o)}function Rv(i){var o=i.firstChild;for(o&&o.nodeType===10&&(o=o.nextSibling);o;){var d=o;switch(o=o.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":Rv(d),Go(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}i.removeChild(d)}}function Q4(i,o,d,m){for(;i.nodeType===1;){var v=d;if(i.nodeName.toLowerCase()!==o.toLowerCase()){if(!m&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(m){if(!i[mn])switch(o){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(b=i.getAttribute("rel"),b==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(b!==v.rel||i.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||i.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||i.getAttribute("title")!==(v.title==null?null:v.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(b=i.getAttribute("src"),(b!==(v.src==null?null:v.src)||i.getAttribute("type")!==(v.type==null?null:v.type)||i.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&b&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(o==="input"&&i.type==="hidden"){var b=v.name==null?null:""+v.name;if(v.type==="hidden"&&i.getAttribute("name")===b)return i}else return i;if(i=_s(i.nextSibling),i===null)break}return null}function X4(i,o,d){if(o==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!d||(i=_s(i.nextSibling),i===null))return null;return i}function Mv(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState==="complete"}function J4(i,o){var d=i.ownerDocument;if(i.data!=="$?"||d.readyState==="complete")o();else{var m=function(){o(),d.removeEventListener("DOMContentLoaded",m)};d.addEventListener("DOMContentLoaded",m),i._reactRetry=m}}function _s(i){for(;i!=null;i=i.nextSibling){var o=i.nodeType;if(o===1||o===3)break;if(o===8){if(o=i.data,o==="$"||o==="$!"||o==="$?"||o==="F!"||o==="F")break;if(o==="/$")return null}}return i}var Dv=null;function Dk(i){i=i.previousSibling;for(var o=0;i;){if(i.nodeType===8){var d=i.data;if(d==="$"||d==="$!"||d==="$?"){if(o===0)return i;o--}else d==="/$"&&o++}i=i.previousSibling}return null}function Ik(i,o,d){switch(o=Xf(d),i){case"html":if(i=o.documentElement,!i)throw Error(r(452));return i;case"head":if(i=o.head,!i)throw Error(r(453));return i;case"body":if(i=o.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function ku(i){for(var o=i.attributes;o.length;)i.removeAttributeNode(o[0]);Go(i)}var ns=new Map,Lk=new Set;function Jf(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Ni=V.d;V.d={f:e3,r:t3,D:n3,C:r3,L:s3,m:i3,X:o3,S:a3,M:l3};function e3(){var i=Ni.f(),o=Hf();return i||o}function t3(i){var o=zs(i);o!==null&&o.tag===5&&o.type==="form"?n_(o):Ni.r(i)}var Nl=typeof document>"u"?null:document;function Pk(i,o,d){var m=Nl;if(m&&typeof o=="string"&&o){var v=Zr(o);v='link[rel="'+i+'"][href="'+v+'"]',typeof d=="string"&&(v+='[crossorigin="'+d+'"]'),Lk.has(v)||(Lk.add(v),i={rel:i,crossOrigin:d,href:o},m.querySelector(v)===null&&(o=m.createElement("link"),Yn(o,"link",i),un(o),m.head.appendChild(o)))}}function n3(i){Ni.D(i),Pk("dns-prefetch",i,null)}function r3(i,o){Ni.C(i,o),Pk("preconnect",i,o)}function s3(i,o,d){Ni.L(i,o,d);var m=Nl;if(m&&i&&o){var v='link[rel="preload"][as="'+Zr(o)+'"]';o==="image"&&d&&d.imageSrcSet?(v+='[imagesrcset="'+Zr(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(v+='[imagesizes="'+Zr(d.imageSizes)+'"]')):v+='[href="'+Zr(i)+'"]';var b=v;switch(o){case"style":b=Cl(i);break;case"script":b=El(i)}ns.has(b)||(i=g({rel:"preload",href:o==="image"&&d&&d.imageSrcSet?void 0:i,as:o},d),ns.set(b,i),m.querySelector(v)!==null||o==="style"&&m.querySelector(Su(b))||o==="script"&&m.querySelector(ju(b))||(o=m.createElement("link"),Yn(o,"link",i),un(o),m.head.appendChild(o)))}}function i3(i,o){Ni.m(i,o);var d=Nl;if(d&&i){var m=o&&typeof o.as=="string"?o.as:"script",v='link[rel="modulepreload"][as="'+Zr(m)+'"][href="'+Zr(i)+'"]',b=v;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=El(i)}if(!ns.has(b)&&(i=g({rel:"modulepreload",href:i},o),ns.set(b,i),d.querySelector(v)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(ju(b)))return}m=d.createElement("link"),Yn(m,"link",i),un(m),d.head.appendChild(m)}}}function a3(i,o,d){Ni.S(i,o,d);var m=Nl;if(m&&i){var v=Bs(m).hoistableStyles,b=Cl(i);o=o||"default";var O=v.get(b);if(!O){var $={loading:0,preload:null};if(O=m.querySelector(Su(b)))$.loading=5;else{i=g({rel:"stylesheet",href:i,"data-precedence":o},d),(d=ns.get(b))&&Iv(i,d);var Y=O=m.createElement("link");un(Y),Yn(Y,"link",i),Y._p=new Promise(function(ee,oe){Y.onload=ee,Y.onerror=oe}),Y.addEventListener("load",function(){$.loading|=1}),Y.addEventListener("error",function(){$.loading|=2}),$.loading|=4,eh(O,o,m)}O={type:"stylesheet",instance:O,count:1,state:$},v.set(b,O)}}}function o3(i,o){Ni.X(i,o);var d=Nl;if(d&&i){var m=Bs(d).hoistableScripts,v=El(i),b=m.get(v);b||(b=d.querySelector(ju(v)),b||(i=g({src:i,async:!0},o),(o=ns.get(v))&&Lv(i,o),b=d.createElement("script"),un(b),Yn(b,"link",i),d.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},m.set(v,b))}}function l3(i,o){Ni.M(i,o);var d=Nl;if(d&&i){var m=Bs(d).hoistableScripts,v=El(i),b=m.get(v);b||(b=d.querySelector(ju(v)),b||(i=g({src:i,async:!0,type:"module"},o),(o=ns.get(v))&&Lv(i,o),b=d.createElement("script"),un(b),Yn(b,"link",i),d.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},m.set(v,b))}}function $k(i,o,d,m){var v=(v=Ne.current)?Jf(v):null;if(!v)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(o=Cl(d.href),d=Bs(v).hoistableStyles,m=d.get(o),m||(m={type:"style",instance:null,count:0,state:null},d.set(o,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){i=Cl(d.href);var b=Bs(v).hoistableStyles,O=b.get(i);if(O||(v=v.ownerDocument||v,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(i,O),(b=v.querySelector(Su(i)))&&!b._p&&(O.instance=b,O.state.loading=5),ns.has(i)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},ns.set(i,d),b||c3(v,i,d,O.state))),o&&m===null)throw Error(r(528,""));return O}if(o&&m!==null)throw Error(r(529,""));return null;case"script":return o=d.async,d=d.src,typeof d=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(o=El(d),d=Bs(v).hoistableScripts,m=d.get(o),m||(m={type:"script",instance:null,count:0,state:null},d.set(o,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Cl(i){return'href="'+Zr(i)+'"'}function Su(i){return'link[rel="stylesheet"]['+i+"]"}function zk(i){return g({},i,{"data-precedence":i.precedence,precedence:null})}function c3(i,o,d,m){i.querySelector('link[rel="preload"][as="style"]['+o+"]")?m.loading=1:(o=i.createElement("link"),m.preload=o,o.addEventListener("load",function(){return m.loading|=1}),o.addEventListener("error",function(){return m.loading|=2}),Yn(o,"link",d),un(o),i.head.appendChild(o))}function El(i){return'[src="'+Zr(i)+'"]'}function ju(i){return"script[async]"+i}function Fk(i,o,d){if(o.count++,o.instance===null)switch(o.type){case"style":var m=i.querySelector('style[data-href~="'+Zr(d.href)+'"]');if(m)return o.instance=m,un(m),m;var v=g({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return m=(i.ownerDocument||i).createElement("style"),un(m),Yn(m,"style",v),eh(m,d.precedence,i),o.instance=m;case"stylesheet":v=Cl(d.href);var b=i.querySelector(Su(v));if(b)return o.state.loading|=4,o.instance=b,un(b),b;m=zk(d),(v=ns.get(v))&&Iv(m,v),b=(i.ownerDocument||i).createElement("link"),un(b);var O=b;return O._p=new Promise(function($,Y){O.onload=$,O.onerror=Y}),Yn(b,"link",m),o.state.loading|=4,eh(b,d.precedence,i),o.instance=b;case"script":return b=El(d.src),(v=i.querySelector(ju(b)))?(o.instance=v,un(v),v):(m=d,(v=ns.get(b))&&(m=g({},d),Lv(m,v)),i=i.ownerDocument||i,v=i.createElement("script"),un(v),Yn(v,"link",m),i.head.appendChild(v),o.instance=v);case"void":return null;default:throw Error(r(443,o.type))}else o.type==="stylesheet"&&(o.state.loading&4)===0&&(m=o.instance,o.state.loading|=4,eh(m,d.precedence,i));return o.instance}function eh(i,o,d){for(var m=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=m.length?m[m.length-1]:null,b=v,O=0;O<m.length;O++){var $=m[O];if($.dataset.precedence===o)b=$;else if(b!==v)break}b?b.parentNode.insertBefore(i,b.nextSibling):(o=d.nodeType===9?d.head:d,o.insertBefore(i,o.firstChild))}function Iv(i,o){i.crossOrigin==null&&(i.crossOrigin=o.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=o.referrerPolicy),i.title==null&&(i.title=o.title)}function Lv(i,o){i.crossOrigin==null&&(i.crossOrigin=o.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=o.referrerPolicy),i.integrity==null&&(i.integrity=o.integrity)}var th=null;function Bk(i,o,d){if(th===null){var m=new Map,v=th=new Map;v.set(d,m)}else v=th,m=v.get(d),m||(m=new Map,v.set(d,m));if(m.has(i))return m;for(m.set(i,null),d=d.getElementsByTagName(i),v=0;v<d.length;v++){var b=d[v];if(!(b[mn]||b[We]||i==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var O=b.getAttribute(o)||"";O=i+O;var $=m.get(O);$?$.push(b):m.set(O,[b])}}return m}function Uk(i,o,d){i=i.ownerDocument||i,i.head.insertBefore(d,o==="title"?i.querySelector("head > title"):null)}function u3(i,o,d){if(d===1||o.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;switch(o.rel){case"stylesheet":return i=o.disabled,typeof o.precedence=="string"&&i==null;default:return!0}case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function qk(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}var Nu=null;function d3(){}function f3(i,o,d){if(Nu===null)throw Error(r(475));var m=Nu;if(o.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var v=Cl(d.href),b=i.querySelector(Su(v));if(b){i=b._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(m.count++,m=nh.bind(m),i.then(m,m)),o.state.loading|=4,o.instance=b,un(b);return}b=i.ownerDocument||i,d=zk(d),(v=ns.get(v))&&Iv(d,v),b=b.createElement("link"),un(b);var O=b;O._p=new Promise(function($,Y){O.onload=$,O.onerror=Y}),Yn(b,"link",d),o.instance=b}m.stylesheets===null&&(m.stylesheets=new Map),m.stylesheets.set(o,i),(i=o.state.preload)&&(o.state.loading&3)===0&&(m.count++,o=nh.bind(m),i.addEventListener("load",o),i.addEventListener("error",o))}}function h3(){if(Nu===null)throw Error(r(475));var i=Nu;return i.stylesheets&&i.count===0&&Pv(i,i.stylesheets),0<i.count?function(o){var d=setTimeout(function(){if(i.stylesheets&&Pv(i,i.stylesheets),i.unsuspend){var m=i.unsuspend;i.unsuspend=null,m()}},6e4);return i.unsuspend=o,function(){i.unsuspend=null,clearTimeout(d)}}:null}function nh(){if(this.count--,this.count===0){if(this.stylesheets)Pv(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var rh=null;function Pv(i,o){i.stylesheets=null,i.unsuspend!==null&&(i.count++,rh=new Map,o.forEach(m3,i),rh=null,nh.call(i))}function m3(i,o){if(!(o.state.loading&4)){var d=rh.get(i);if(d)var m=d.get(null);else{d=new Map,rh.set(i,d);for(var v=i.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<v.length;b++){var O=v[b];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(d.set(O.dataset.precedence,O),m=O)}m&&d.set(null,m)}v=o.instance,O=v.getAttribute("data-precedence"),b=d.get(O)||m,b===m&&d.set(null,v),d.set(O,v),this.count++,m=nh.bind(this),v.addEventListener("load",m),v.addEventListener("error",m),b?b.parentNode.insertBefore(v,b.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(v,i.firstChild)),o.state.loading|=4}}var Cu={$$typeof:j,Provider:null,Consumer:null,_currentValue:U,_currentValue2:U,_threadCount:0};function p3(i,o,d,m,v,b,O,$){this.tag=1,this.containerInfo=i,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=Zi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zi(0),this.hiddenUpdates=Zi(null),this.identifierPrefix=m,this.onUncaughtError=v,this.onCaughtError=b,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.incompleteTransitions=new Map}function Hk(i,o,d,m,v,b,O,$,Y,ee,oe,fe){return i=new p3(i,o,d,O,$,Y,ee,fe),o=1,b===!0&&(o|=24),b=Mr(3,null,null,o),i.current=b,b.stateNode=i,o=xg(),o.refCount++,i.pooledCache=o,o.refCount++,b.memoizedState={element:m,isDehydrated:d,cache:o},_g(b),i}function Vk(i){return i?(i=il,i):il}function Kk(i,o,d,m,v,b){v=Vk(v),m.context===null?m.context=v:m.pendingContext=v,m=ta(o),m.payload={element:d},b=b===void 0?null:b,b!==null&&(m.callback=b),d=na(i,m,o),d!==null&&($r(d,i,o),ru(d,i,o))}function Yk(i,o){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var d=i.retryLane;i.retryLane=d!==0&&d<o?d:o}}function $v(i,o){Yk(i,o),(i=i.alternate)&&Yk(i,o)}function Gk(i){if(i.tag===13){var o=sl(i,67108864);o!==null&&$r(o,i,67108864),$v(i,67108864)}}var sh=!0;function g3(i,o,d,m){var v=M.T;M.T=null;var b=V.p;try{V.p=2,zv(i,o,d,m)}finally{V.p=b,M.T=v}}function v3(i,o,d,m){var v=M.T;M.T=null;var b=V.p;try{V.p=8,zv(i,o,d,m)}finally{V.p=b,M.T=v}}function zv(i,o,d,m){if(sh){var v=Fv(m);if(v===null)Nv(i,o,m,ih,d),Wk(i,m);else if(y3(v,i,o,d,m))m.stopPropagation();else if(Wk(i,m),o&4&&-1<x3.indexOf(i)){for(;v!==null;){var b=zs(v);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var O=Rn(b.pendingLanes);if(O!==0){var $=b;for($.pendingLanes|=2,$.entangledLanes|=2;O;){var Y=1<<31-He(O);$.entanglements[1]|=Y,O&=~Y}Ks(b),(zt&6)===0&&(Uf=De()+500,bu(0))}}break;case 13:$=sl(b,2),$!==null&&$r($,b,2),Hf(),$v(b,2)}if(b=Fv(m),b===null&&Nv(i,o,m,ih,d),b===v)break;v=b}v!==null&&m.stopPropagation()}else Nv(i,o,m,null,d)}}function Fv(i){return i=Vp(i),Bv(i)}var ih=null;function Bv(i){if(ih=null,i=di(i),i!==null){var o=a(i);if(o===null)i=null;else{var d=o.tag;if(d===13){if(i=l(o),i!==null)return i;i=null}else if(d===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;i=null}else o!==i&&(i=null)}}return ih=i,null}function Zk(i){switch(i){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(ve()){case ue:return 2;case Ce:return 8;case ze:case be:return 32;case Se:return 268435456;default:return 32}default:return 32}}var Uv=!1,pa=null,ga=null,va=null,Eu=new Map,Tu=new Map,xa=[],x3="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 Wk(i,o){switch(i){case"focusin":case"focusout":pa=null;break;case"dragenter":case"dragleave":ga=null;break;case"mouseover":case"mouseout":va=null;break;case"pointerover":case"pointerout":Eu.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Tu.delete(o.pointerId)}}function Au(i,o,d,m,v,b){return i===null||i.nativeEvent!==b?(i={blockedOn:o,domEventName:d,eventSystemFlags:m,nativeEvent:b,targetContainers:[v]},o!==null&&(o=zs(o),o!==null&&Gk(o)),i):(i.eventSystemFlags|=m,o=i.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),i)}function y3(i,o,d,m,v){switch(o){case"focusin":return pa=Au(pa,i,o,d,m,v),!0;case"dragenter":return ga=Au(ga,i,o,d,m,v),!0;case"mouseover":return va=Au(va,i,o,d,m,v),!0;case"pointerover":var b=v.pointerId;return Eu.set(b,Au(Eu.get(b)||null,i,o,d,m,v)),!0;case"gotpointercapture":return b=v.pointerId,Tu.set(b,Au(Tu.get(b)||null,i,o,d,m,v)),!0}return!1}function Qk(i){var o=di(i.target);if(o!==null){var d=a(o);if(d!==null){if(o=d.tag,o===13){if(o=l(d),o!==null){i.blockedOn=o,it(i.priority,function(){if(d.tag===13){var m=Pr();m=ys(m);var v=sl(d,m);v!==null&&$r(v,d,m),$v(d,m)}});return}}else if(o===3&&d.stateNode.current.memoizedState.isDehydrated){i.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}i.blockedOn=null}function ah(i){if(i.blockedOn!==null)return!1;for(var o=i.targetContainers;0<o.length;){var d=Fv(i.nativeEvent);if(d===null){d=i.nativeEvent;var m=new d.constructor(d.type,d);Hp=m,d.target.dispatchEvent(m),Hp=null}else return o=zs(d),o!==null&&Gk(o),i.blockedOn=d,!1;o.shift()}return!0}function Xk(i,o,d){ah(i)&&d.delete(o)}function b3(){Uv=!1,pa!==null&&ah(pa)&&(pa=null),ga!==null&&ah(ga)&&(ga=null),va!==null&&ah(va)&&(va=null),Eu.forEach(Xk),Tu.forEach(Xk)}function oh(i,o){i.blockedOn===o&&(i.blockedOn=null,Uv||(Uv=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,b3)))}var lh=null;function Jk(i){lh!==i&&(lh=i,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){lh===i&&(lh=null);for(var o=0;o<i.length;o+=3){var d=i[o],m=i[o+1],v=i[o+2];if(typeof m!="function"){if(Bv(m||d)===null)continue;break}var b=zs(d);b!==null&&(i.splice(o,3),o-=3,Bg(b,{pending:!0,data:v,method:d.method,action:m},m,v))}}))}function Ou(i){function o(Y){return oh(Y,i)}pa!==null&&oh(pa,i),ga!==null&&oh(ga,i),va!==null&&oh(va,i),Eu.forEach(o),Tu.forEach(o);for(var d=0;d<xa.length;d++){var m=xa[d];m.blockedOn===i&&(m.blockedOn=null)}for(;0<xa.length&&(d=xa[0],d.blockedOn===null);)Qk(d),d.blockedOn===null&&xa.shift();if(d=(i.ownerDocument||i).$$reactFormReplay,d!=null)for(m=0;m<d.length;m+=3){var v=d[m],b=d[m+1],O=v[ft]||null;if(typeof b=="function")O||Jk(d);else if(O){var $=null;if(b&&b.hasAttribute("formAction")){if(v=b,O=b[ft]||null)$=O.formAction;else if(Bv(v)!==null)continue}else $=O.action;typeof $=="function"?d[m+1]=$:(d.splice(m,3),m-=3),Jk(d)}}}function qv(i){this._internalRoot=i}ch.prototype.render=qv.prototype.render=function(i){var o=this._internalRoot;if(o===null)throw Error(r(409));var d=o.current,m=Pr();Kk(d,m,i,o,null,null)},ch.prototype.unmount=qv.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var o=i.containerInfo;Kk(i.current,2,null,i,null,null),Hf(),o[Kt]=null}};function ch(i){this._internalRoot=i}ch.prototype.unstable_scheduleHydration=function(i){if(i){var o=Te();i={blockedOn:null,target:i,priority:o};for(var d=0;d<xa.length&&o!==0&&o<xa[d].priority;d++);xa.splice(d,0,i),d===0&&Qk(i)}};var eS=e.version;if(eS!=="19.1.1")throw Error(r(527,eS,"19.1.1"));V.findDOMNode=function(i){var o=i._reactInternals;if(o===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=f(o),i=i!==null?h(i):null,i=i===null?null:i.stateNode,i};var w3={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uh.isDisabled&&uh.supportsFiber)try{J=uh.inject(w3),me=uh}catch{}}return Ru.createRoot=function(i,o){if(!s(i))throw Error(r(299));var d=!1,m="",v=g_,b=v_,O=x_,$=null;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onUncaughtError!==void 0&&(v=o.onUncaughtError),o.onCaughtError!==void 0&&(b=o.onCaughtError),o.onRecoverableError!==void 0&&(O=o.onRecoverableError),o.unstable_transitionCallbacks!==void 0&&($=o.unstable_transitionCallbacks)),o=Hk(i,1,!1,null,null,d,m,v,b,O,$,null),i[Kt]=o.current,jv(i),new qv(o)},Ru.hydrateRoot=function(i,o,d){if(!s(i))throw Error(r(299));var m=!1,v="",b=g_,O=v_,$=x_,Y=null,ee=null;return d!=null&&(d.unstable_strictMode===!0&&(m=!0),d.identifierPrefix!==void 0&&(v=d.identifierPrefix),d.onUncaughtError!==void 0&&(b=d.onUncaughtError),d.onCaughtError!==void 0&&(O=d.onCaughtError),d.onRecoverableError!==void 0&&($=d.onRecoverableError),d.unstable_transitionCallbacks!==void 0&&(Y=d.unstable_transitionCallbacks),d.formState!==void 0&&(ee=d.formState)),o=Hk(i,1,!0,o,d??null,m,v,b,O,$,Y,ee),o.context=Vk(null),d=o.current,m=Pr(),m=ys(m),v=ta(m),v.callback=null,na(d,v,m),d=m,o.current.lanes=d,ci(o,d),Ks(o),i[Kt]=o.current,jv(i),new ch(o)},Ru.version="19.1.1",Ru}var sS;function $3(){if(sS)return Hv.exports;sS=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Hv.exports=P3(),Hv.exports}var z3=$3();const F3=kc(z3);var Yv,iS;function B3(){if(iS)return Yv;iS=1;var t=typeof Element<"u",e=typeof Map=="function",n=typeof Set=="function",r=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function s(a,l){if(a===l)return!0;if(a&&l&&typeof a=="object"&&typeof l=="object"){if(a.constructor!==l.constructor)return!1;var u,f,h;if(Array.isArray(a)){if(u=a.length,u!=l.length)return!1;for(f=u;f--!==0;)if(!s(a[f],l[f]))return!1;return!0}var g;if(e&&a instanceof Map&&l instanceof Map){if(a.size!==l.size)return!1;for(g=a.entries();!(f=g.next()).done;)if(!l.has(f.value[0]))return!1;for(g=a.entries();!(f=g.next()).done;)if(!s(f.value[1],l.get(f.value[0])))return!1;return!0}if(n&&a instanceof Set&&l instanceof Set){if(a.size!==l.size)return!1;for(g=a.entries();!(f=g.next()).done;)if(!l.has(f.value[0]))return!1;return!0}if(r&&ArrayBuffer.isView(a)&&ArrayBuffer.isView(l)){if(u=a.length,u!=l.length)return!1;for(f=u;f--!==0;)if(a[f]!==l[f])return!1;return!0}if(a.constructor===RegExp)return a.source===l.source&&a.flags===l.flags;if(a.valueOf!==Object.prototype.valueOf&&typeof a.valueOf=="function"&&typeof l.valueOf=="function")return a.valueOf()===l.valueOf();if(a.toString!==Object.prototype.toString&&typeof a.toString=="function"&&typeof l.toString=="function")return a.toString()===l.toString();if(h=Object.keys(a),u=h.length,u!==Object.keys(l).length)return!1;for(f=u;f--!==0;)if(!Object.prototype.hasOwnProperty.call(l,h[f]))return!1;if(t&&a instanceof Element)return!1;for(f=u;f--!==0;)if(!((h[f]==="_owner"||h[f]==="__v"||h[f]==="__o")&&a.$$typeof)&&!s(a[h[f]],l[h[f]]))return!1;return!0}return a!==a&&l!==l}return Yv=function(l,u){try{return s(l,u)}catch(f){if((f.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw f}},Yv}var U3=B3();const q3=kc(U3);var Gv,aS;function H3(){if(aS)return Gv;aS=1;var t=function(e,n,r,s,a,l,u,f){if(!e){var h;if(n===void 0)h=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var g=[r,s,a,l,u,f],p=0;h=new Error(n.replace(/%s/g,function(){return g[p++]})),h.name="Invariant Violation"}throw h.framesToPop=1,h}};return Gv=t,Gv}var V3=H3();const oS=kc(V3);var Zv,lS;function K3(){return lS||(lS=1,Zv=function(e,n,r,s){var a=r?r.call(s,e,n):void 0;if(a!==void 0)return!!a;if(e===n)return!0;if(typeof e!="object"||!e||typeof n!="object"||!n)return!1;var l=Object.keys(e),u=Object.keys(n);if(l.length!==u.length)return!1;for(var f=Object.prototype.hasOwnProperty.bind(n),h=0;h<l.length;h++){var g=l[h];if(!f(g))return!1;var p=e[g],x=n[g];if(a=r?r.call(s,p,x,g):void 0,a===!1||a===void 0&&p!==x)return!1}return!0}),Zv}var Y3=K3();const G3=kc(Y3);var IC=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(IC||{}),Wv={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}},cS=Object.values(IC),Ub={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},Z3=Object.entries(Ub).reduce((t,[e,n])=>(t[n]=e,t),{}),Cs="data-rh",Ql={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},Xl=(t,e)=>{for(let n=t.length-1;n>=0;n-=1){const r=t[n];if(Object.prototype.hasOwnProperty.call(r,e))return r[e]}return null},W3=t=>{let e=Xl(t,"title");const n=Xl(t,Ql.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),n&&e)return n.replace(/%s/g,()=>e);const r=Xl(t,Ql.DEFAULT_TITLE);return e||r||void 0},Q3=t=>Xl(t,Ql.ON_CHANGE_CLIENT_STATE)||(()=>{}),Qv=(t,e)=>e.filter(n=>typeof n[t]<"u").map(n=>n[t]).reduce((n,r)=>({...n,...r}),{}),X3=(t,e)=>e.filter(n=>typeof n.base<"u").map(n=>n.base).reverse().reduce((n,r)=>{if(!n.length){const s=Object.keys(r);for(let a=0;a<s.length;a+=1){const u=s[a].toLowerCase();if(t.indexOf(u)!==-1&&r[u])return n.concat(r)}}return n},[]),J3=t=>console&&typeof console.warn=="function"&&console.warn(t),Mu=(t,e,n)=>{const r={};return n.filter(s=>Array.isArray(s[t])?!0:(typeof s[t]<"u"&&J3(`Helmet: ${t} should be of type "Array". Instead found type "${typeof s[t]}"`),!1)).map(s=>s[t]).reverse().reduce((s,a)=>{const l={};a.filter(f=>{let h;const g=Object.keys(f);for(let x=0;x<g.length;x+=1){const y=g[x],k=y.toLowerCase();e.indexOf(k)!==-1&&!(h==="rel"&&f[h].toLowerCase()==="canonical")&&!(k==="rel"&&f[k].toLowerCase()==="stylesheet")&&(h=k),e.indexOf(y)!==-1&&(y==="innerHTML"||y==="cssText"||y==="itemprop")&&(h=y)}if(!h||!f[h])return!1;const p=f[h].toLowerCase();return r[h]||(r[h]={}),l[h]||(l[h]={}),r[h][p]?!1:(l[h][p]=!0,!0)}).reverse().forEach(f=>s.push(f));const u=Object.keys(l);for(let f=0;f<u.length;f+=1){const h=u[f],g={...r[h],...l[h]};r[h]=g}return s},[]).reverse()},eD=(t,e)=>{if(Array.isArray(t)&&t.length){for(let n=0;n<t.length;n+=1)if(t[n][e])return!0}return!1},tD=t=>({baseTag:X3(["href"],t),bodyAttributes:Qv("bodyAttributes",t),defer:Xl(t,Ql.DEFER),encode:Xl(t,Ql.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:Qv("htmlAttributes",t),linkTags:Mu("link",["rel","href"],t),metaTags:Mu("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:Mu("noscript",["innerHTML"],t),onChangeClientState:Q3(t),scriptTags:Mu("script",["src","innerHTML"],t),styleTags:Mu("style",["cssText"],t),title:W3(t),titleAttributes:Qv("titleAttributes",t),prioritizeSeoTags:eD(t,Ql.PRIORITIZE_SEO_TAGS)}),LC=t=>Array.isArray(t)?t.join(""):t,nD=(t,e)=>{const n=Object.keys(t);for(let r=0;r<n.length;r+=1)if(e[n[r]]&&e[n[r]].includes(t[n[r]]))return!0;return!1},Xv=(t,e)=>Array.isArray(t)?t.reduce((n,r)=>(nD(r,e)?n.priority.push(r):n.default.push(r),n),{priority:[],default:[]}):{default:t,priority:[]},uS=(t,e)=>({...t,[e]:void 0}),rD=["noscript","script","style"],gy=(t,e=!0)=>e===!1?String(t):String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),PC=t=>Object.keys(t).reduce((e,n)=>{const r=typeof t[n]<"u"?`${n}="${t[n]}"`:`${n}`;return e?`${e} ${r}`:r},""),sD=(t,e,n,r)=>{const s=PC(n),a=LC(e);return s?`<${t} ${Cs}="true" ${s}>${gy(a,r)}</${t}>`:`<${t} ${Cs}="true">${gy(a,r)}</${t}>`},iD=(t,e,n=!0)=>e.reduce((r,s)=>{const a=s,l=Object.keys(a).filter(h=>!(h==="innerHTML"||h==="cssText")).reduce((h,g)=>{const p=typeof a[g]>"u"?g:`${g}="${gy(a[g],n)}"`;return h?`${h} ${p}`:p},""),u=a.innerHTML||a.cssText||"",f=rD.indexOf(t)===-1;return`${r}<${t} ${Cs}="true" ${l}${f?"/>":`>${u}</${t}>`}`},""),$C=(t,e={})=>Object.keys(t).reduce((n,r)=>{const s=Ub[r];return n[s||r]=t[r],n},e),aD=(t,e,n)=>{const r={key:e,[Cs]:!0},s=$C(n,r);return[nt.createElement("title",s,e)]},Uh=(t,e)=>e.map((n,r)=>{const s={key:r,[Cs]:!0};return Object.keys(n).forEach(a=>{const u=Ub[a]||a;if(u==="innerHTML"||u==="cssText"){const f=n.innerHTML||n.cssText;s.dangerouslySetInnerHTML={__html:f}}else s[u]=n[a]}),nt.createElement(t,s)}),rs=(t,e,n=!0)=>{switch(t){case"title":return{toComponent:()=>aD(t,e.title,e.titleAttributes),toString:()=>sD(t,e.title,e.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>$C(e),toString:()=>PC(e)};default:return{toComponent:()=>Uh(t,e),toString:()=>iD(t,e,n)}}},oD=({metaTags:t,linkTags:e,scriptTags:n,encode:r})=>{const s=Xv(t,Wv.meta),a=Xv(e,Wv.link),l=Xv(n,Wv.script);return{priorityMethods:{toComponent:()=>[...Uh("meta",s.priority),...Uh("link",a.priority),...Uh("script",l.priority)],toString:()=>`${rs("meta",s.priority,r)} ${rs("link",a.priority,r)} ${rs("script",l.priority,r)}`},metaTags:s.default,linkTags:a.default,scriptTags:l.default}},lD=t=>{const{baseTag:e,bodyAttributes:n,encode:r=!0,htmlAttributes:s,noscriptTags:a,styleTags:l,title:u="",titleAttributes:f,prioritizeSeoTags:h}=t;let{linkTags:g,metaTags:p,scriptTags:x}=t,y={toComponent:()=>{},toString:()=>""};return h&&({priorityMethods:y,linkTags:g,metaTags:p,scriptTags:x}=oD(t)),{priority:y,base:rs("base",e,r),bodyAttributes:rs("bodyAttributes",n,r),htmlAttributes:rs("htmlAttributes",s,r),link:rs("link",g,r),meta:rs("meta",p,r),noscript:rs("noscript",a,r),script:rs("script",x,r),style:rs("style",l,r),title:rs("title",{title:u,titleAttributes:f},r)}},vy=lD,dh=[],zC=!!(typeof window<"u"&&window.document&&window.document.createElement),xy=class{constructor(t,e){Xn(this,"instances",[]);Xn(this,"canUseDOM",zC);Xn(this,"context");Xn(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?dh:this.instances,add:t=>{(this.canUseDOM?dh:this.instances).push(t)},remove:t=>{const e=(this.canUseDOM?dh:this.instances).indexOf(t);(this.canUseDOM?dh:this.instances).splice(e,1)}}});this.context=t,this.canUseDOM=e||!1,e||(t.helmet=vy({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},cD={},FC=nt.createContext(cD),No,BC=(No=class extends _.Component{constructor(n){super(n);Xn(this,"helmetData");this.helmetData=new xy(this.props.context||{},No.canUseDOM)}render(){return nt.createElement(FC.Provider,{value:this.helmetData.value},this.props.children)}},Xn(No,"canUseDOM",zC),No),Tl=(t,e)=>{const n=document.head||document.querySelector("head"),r=n.querySelectorAll(`${t}[${Cs}]`),s=[].slice.call(r),a=[];let l;return e&&e.length&&e.forEach(u=>{const f=document.createElement(t);for(const h in u)if(Object.prototype.hasOwnProperty.call(u,h))if(h==="innerHTML")f.innerHTML=u.innerHTML;else if(h==="cssText")f.styleSheet?f.styleSheet.cssText=u.cssText:f.appendChild(document.createTextNode(u.cssText));else{const g=h,p=typeof u[g]>"u"?"":u[g];f.setAttribute(h,p)}f.setAttribute(Cs,"true"),s.some((h,g)=>(l=g,f.isEqualNode(h)))?s.splice(l,1):a.push(f)}),s.forEach(u=>{var f;return(f=u.parentNode)==null?void 0:f.removeChild(u)}),a.forEach(u=>n.appendChild(u)),{oldTags:s,newTags:a}},yy=(t,e)=>{const n=document.getElementsByTagName(t)[0];if(!n)return;const r=n.getAttribute(Cs),s=r?r.split(","):[],a=[...s],l=Object.keys(e);for(const u of l){const f=e[u]||"";n.getAttribute(u)!==f&&n.setAttribute(u,f),s.indexOf(u)===-1&&s.push(u);const h=a.indexOf(u);h!==-1&&a.splice(h,1)}for(let u=a.length-1;u>=0;u-=1)n.removeAttribute(a[u]);s.length===a.length?n.removeAttribute(Cs):n.getAttribute(Cs)!==l.join(",")&&n.setAttribute(Cs,l.join(","))},uD=(t,e)=>{typeof t<"u"&&document.title!==t&&(document.title=LC(t)),yy("title",e)},dS=(t,e)=>{const{baseTag:n,bodyAttributes:r,htmlAttributes:s,linkTags:a,metaTags:l,noscriptTags:u,onChangeClientState:f,scriptTags:h,styleTags:g,title:p,titleAttributes:x}=t;yy("body",r),yy("html",s),uD(p,x);const y={baseTag:Tl("base",n),linkTags:Tl("link",a),metaTags:Tl("meta",l),noscriptTags:Tl("noscript",u),scriptTags:Tl("script",h),styleTags:Tl("style",g)},k={},w={};Object.keys(y).forEach(S=>{const{newTags:N,oldTags:C}=y[S];N.length&&(k[S]=N),C.length&&(w[S]=y[S].oldTags)}),e&&e(),f(t,k,w)},Du=null,dD=t=>{Du&&cancelAnimationFrame(Du),t.defer?Du=requestAnimationFrame(()=>{dS(t,()=>{Du=null})}):(dS(t),Du=null)},fD=dD,fS=class extends _.Component{constructor(){super(...arguments);Xn(this,"rendered",!1)}shouldComponentUpdate(e){return!G3(e,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:e}=this.props.context;e.remove(this),this.emitChange()}emitChange(){const{helmetInstances:e,setHelmet:n}=this.props.context;let r=null;const s=tD(e.get().map(a=>{const l={...a.props};return delete l.context,l}));BC.canUseDOM?fD(s):vy&&(r=vy(s)),n(r)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:e}=this.props.context;e.add(this),this.emitChange()}render(){return this.init(),null}},my,qb=(my=class extends _.Component{shouldComponentUpdate(t){return!q3(uS(this.props,"helmetData"),uS(t,"helmetData"))}mapNestedChildrenToProps(t,e){if(!e)return null;switch(t.type){case"script":case"noscript":return{innerHTML:e};case"style":return{cssText:e};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,e,n,r){return{...e,[t.type]:[...e[t.type]||[],{...n,...this.mapNestedChildrenToProps(t,r)}]}}mapObjectTypeChildren(t,e,n,r){switch(t.type){case"title":return{...e,[t.type]:r,titleAttributes:{...n}};case"body":return{...e,bodyAttributes:{...n}};case"html":return{...e,htmlAttributes:{...n}};default:return{...e,[t.type]:{...n}}}}mapArrayTypeChildrenToProps(t,e){let n={...e};return Object.keys(t).forEach(r=>{n={...n,[r]:t[r]}}),n}warnOnInvalidChildren(t,e){return oS(cS.some(n=>t.type===n),typeof t.type=="function"?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${cS.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),oS(!e||typeof e=="string"||Array.isArray(e)&&!e.some(n=>typeof n!="string"),`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`}</${t.type}> ) Refer to our API for more information.`),!0}mapChildrenToProps(t,e){let n={};return nt.Children.forEach(t,r=>{if(!r||!r.props)return;const{children:s,...a}=r.props,l=Object.keys(a).reduce((f,h)=>(f[Z3[h]||h]=a[h],f),{});let{type:u}=r;switch(typeof u=="symbol"?u=u.toString():this.warnOnInvalidChildren(r,s),u){case"Symbol(react.fragment)":e=this.mapChildrenToProps(s,e);break;case"link":case"meta":case"noscript":case"script":case"style":n=this.flattenArrayTypeChildren(r,n,l,s);break;default:e=this.mapObjectTypeChildren(r,e,l,s);break}}),this.mapArrayTypeChildrenToProps(n,e)}render(){const{children:t,...e}=this.props;let n={...e},{helmetData:r}=e;if(t&&(n=this.mapChildrenToProps(t,n)),r&&!(r instanceof xy)){const s=r;r=new xy(s.context,!0),delete n.helmetData}return r?nt.createElement(fS,{...n,context:r.value}):nt.createElement(FC.Consumer,null,s=>nt.createElement(fS,{...n,context:s}))}},Xn(my,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),my);function hD({children:t}){const[e]=_.useState(()=>new j3({defaultOptions:{queries:{staleTime:6e4,gcTime:3e5,retry:1,refetchOnWindowFocus:!1}}}));return c.jsx(N3,{client:e,children:t})}var se=typeof window<"u"?window:void 0,Nr=typeof globalThis<"u"?globalThis:se,UC=Array.prototype,hS=UC.forEach,mS=UC.indexOf,qr=Nr==null?void 0:Nr.navigator,Le=Nr==null?void 0:Nr.document,jr=Nr==null?void 0:Nr.location,by=Nr==null?void 0:Nr.fetch,wy=Nr!=null&&Nr.XMLHttpRequest&&"withCredentials"in new Nr.XMLHttpRequest?Nr.XMLHttpRequest:void 0,pS=Nr==null?void 0:Nr.AbortController,Sr=qr==null?void 0:qr.userAgent,ct=se??{},Ai={DEBUG:!1,LIB_VERSION:"1.281.0"};function gS(t,e,n,r,s,a,l){try{var u=t[a](l),f=u.value}catch(h){return void n(h)}u.done?e(f):Promise.resolve(f).then(r,s)}function vS(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function l(f){gS(a,r,s,l,u,"next",f)}function u(f){gS(a,r,s,l,u,"throw",f)}l(void 0)}))}}function qe(){return qe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},qe.apply(null,arguments)}function qC(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var mD=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function St(t,e){return t.indexOf(e)!==-1}var Km=function(t){return t.trim()},_y=function(t){return t.replace(/^\$/,"")},pD=Array.isArray,HC=Object.prototype,VC=HC.hasOwnProperty,Ym=HC.toString,tn=pD||function(t){return Ym.call(t)==="[object Array]"},Ra=t=>typeof t=="function",er=t=>t===Object(t)&&!tn(t),ql=t=>{if(er(t)){for(var e in t)if(VC.call(t,e))return!1;return!0}return!1},Me=t=>t===void 0,Pn=t=>Ym.call(t)=="[object String]",ky=t=>Pn(t)&&t.trim().length===0,Ki=t=>t===null,en=t=>Me(t)||Ki(t),ni=t=>Ym.call(t)=="[object Number]",Ma=t=>Ym.call(t)==="[object Boolean]",gD=t=>t instanceof FormData,vD=t=>St(mD,t);function Sy(t){return t===null||typeof t!="object"}function sm(t,e){return Object.prototype.toString.call(t)==="[object "+e+"]"}function KC(t){return!Me(Event)&&(function(e,n){try{return e instanceof n}catch{return!1}})(t,Event)}var xD=[!0,"true",1,"1","yes"],Jv=t=>St(xD,t),yD=[!1,"false",0,"0","no"];function Zs(t,e,n,r,s){return e>n&&(r.warn("min cannot be greater than max."),e=n),ni(t)?t>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t<e?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+s),Zs(s||n,e,n,r))}let bD=class{constructor(e){this.t={},this.i=e.i,this.o=Zs(e.bucketSize,0,100,e.h),this.m=Zs(e.refillRate,0,this.o,e.h),this.S=Zs(e.refillInterval,0,864e5,e.h)}$(e,n){var r=n-e.lastAccess,s=Math.floor(r/this.S);if(s>0){var a=s*this.m;e.tokens=Math.min(e.tokens+a,this.o),e.lastAccess=e.lastAccess+s*this.S}}consumeRateLimit(e){var n,r=Date.now(),s=String(e),a=this.t[s];return a?this.$(a,r):(a={tokens:this.o,lastAccess:r},this.t[s]=a),a.tokens===0||(a.tokens--,a.tokens===0&&((n=this.i)==null||n.call(this,e)),a.tokens===0)}stop(){this.t={}}};var fh,xS,ex,wD=t=>t instanceof Error;function _D(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return ex&&n.length===xS||(xS=n.length,ex=n.reduce(((r,s)=>{fh||(fh={});var a=fh[s];if(a)r[a[0]]=a[1];else for(var l=t(s),u=l.length-1;u>=0;u--){var f=l[u],h=f==null?void 0:f.filename,g=e[s];if(h&&g){r[h]=g,fh[s]=[h,g];break}}return r}),{})),ex}}var cc="?";function jy(t,e,n,r){var s={platform:"web:javascript",filename:t,function:e==="<anonymous>"?cc:e,in_app:!0};return Me(n)||(s.lineno=n),Me(r)||(s.colno=r),s}var YC=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:cc,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},kD=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,SD=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,jD=/\((\S*)(?::(\d+))(?::(\d+))\)/,ND=t=>{var e=kD.exec(t);if(e){var[,n,r,s]=e;return jy(n,cc,+r,+s)}var a=SD.exec(t);if(a){if(a[2]&&a[2].indexOf("eval")===0){var l=jD.exec(a[2]);l&&(a[2]=l[1],a[3]=l[2],a[4]=l[3])}var[u,f]=YC(a[1]||cc,a[2]);return jy(f,u,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},CD=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ED=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,TD=t=>{var e=CD.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var n=ED.exec(e[3]);n&&(e[1]=e[1]||"eval",e[3]=n[1],e[4]=n[2],e[5]="")}var r=e[3],s=e[1]||cc;return[s,r]=YC(s,r),jy(r,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},yS=/\(error: (.*)\)/,bS=50;function AD(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(r,s){s===void 0&&(s=0);for(var a=[],l=r.split(`
|
|
26
|
-
`),u=s;u<l.length;u++){var f=l[u];if(!(f.length>1024)){var h=yS.test(f)?f.replace(yS,"$1"):f;if(!h.match(/\S*Error: /)){for(var g of e){var p=g(h);if(p){a.push(p);break}}if(a.length>=bS)break}}}return(function(x){if(!x.length)return[];var y=Array.from(x);return y.reverse(),y.slice(0,bS).map((k=>{return qe({},k,{filename:k.filename||(w=y,w[w.length-1]||{}).filename,function:k.function||cc});var w}))})(a)}}class OD{constructor(e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r=[]),this.coercers=e,this.modifiers=r,this.stackParser=AD(...n)}buildFromUnknown(e,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(r,n,0).apply(e),a=this.buildParsingContext(),l=this.parseStacktrace(s,a);return{$exception_list:this.convertToExceptionList(l,r),$exception_level:"error"}}modifyFrames(e){var n=this;return vS((function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&tn(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return e}))()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var r,s;return e.cause!=null&&(r=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),n.chunkIdMap)),qe({},e,{cause:r,stack:s})}applyChunkIds(e,n){return e.map((r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r)))}applyCoercers(e,n){for(var r of this.coercers)if(r.match(e))return r.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return vS((function*(){var r=e;for(var s of n.modifiers)r=yield s(r);return r}))()}convertToExceptionList(e,n){var r,s,a,l={type:e.type,value:e.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(s=n.handled)===null||s===void 0||s,synthetic:(a=e.synthetic)!==null&&a!==void 0&&a}};e.stack&&(l.stacktrace={type:"raw",frames:e.stack});var u=[l];return e.cause!=null&&u.push(...this.convertToExceptionList(e.cause,qe({},n,{handled:!0}))),u}buildParsingContext(){return{chunkIdMap:_D(this.stackParser)}}buildCoercingContext(e,n,r){r===void 0&&(r=0);var s=(a,l)=>{if(l<=4){var u=this.buildCoercingContext(e,n,l);return this.applyCoercers(a,u)}};return qe({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:e,apply:a=>s(a,r),next:a=>s(a,r+1)})}}class RD{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var r=Pn(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?n+": "+e.message:n}isDOMException(e){return sm(e,"DOMException")}isDOMError(e){return sm(e,"DOMError")}}class MD{match(e){return(n=>n instanceof Error)(e)}coerce(e,n){return{type:this.getType(e),value:this.getMessage(e,n),stack:this.getStack(e),cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,n){var r=e.message;return r.error&&typeof r.error.message=="string"?String(r.error.message):String(r)}getStack(e){return e.stacktrace||e.stack||void 0}}class DD{constructor(){}match(e){return sm(e,"ErrorEvent")&&e.error!=null}coerce(e,n){var r,s=n.apply(e.error);return s||{type:"ErrorEvent",value:e.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var ID=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class LD{match(e){return typeof e=="string"}coerce(e,n){var r,[s,a]=this.getInfos(e);return{type:s??"Error",value:a??e,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var n="Error",r=e,s=e.match(ID);return s&&(n=s[1],r=s[2]),[n,r]}}var PD=["fatal","error","warning","log","info","debug"];function GC(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var s=n.slice(0,r).join(", ");if(!(s.length>e))return r===n.length||s.length<=e?s:s.slice(0,e)+"..."}return""}class $D{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var r,s=this.getErrorPropertyFromObject(e);return s?n.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return KC(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var n="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(n+=" with message: '"+e.message+"'"),n}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+GC(e)}isSeverityLevel(e){return Pn(e)&&!ky(e)&&PD.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];if(wD(r))return r}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class zD{match(e){return KC(e)}coerce(e,n){var r,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+GC(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class FD{match(e){return Sy(e)}coerce(e,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class BD{match(e){return sm(e,"PromiseRejectionEvent")}coerce(e,n){var r,s=this.getUnhandledRejectionReason(e);return Sy(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(s)}getUnhandledRejectionReason(e){if(Sy(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var ZC=t=>{var e={k:function(n){if(se&&(Ai.DEBUG||ct.POSTHOG_DEBUG)&&!Me(se.console)&&se.console){for(var r=("__rrweb_original__"in se.console[n])?se.console[n].__rrweb_original__:se.console[n],s=arguments.length,a=new Array(s>1?s-1:0),l=1;l<s;l++)a[l-1]=arguments[l];r(t,...a)}},info:function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];e.k("log",...r)},warn:function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];e.k("warn",...r)},error:function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];e.k("error",...r)},critical:function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];console.error(t,...r)},uninitializedWarning:n=>{e.error("You must initialize PostHog before calling "+n)},createLogger:n=>ZC(t+" "+n)};return e},Be=ZC("[PostHog.js]"),qn=Be.createLogger,UD=qn("[ExternalScriptsLoader]"),wS=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return UD.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=Le==null?void 0:Le.querySelectorAll("script");if(r){for(var s,a=function(){if(r[l].src===e){var f=r[l];return f.__posthog_loading_callback_fired?{v:n()}:(f.addEventListener("load",(h=>{f.__posthog_loading_callback_fired=!0,n(void 0,h)})),f.onerror=h=>n(h),{v:void 0})}},l=0;l<r.length;l++)if(s=a())return s.v}var u=()=>{if(!Le)return n("document not found");var f=Le.createElement("script");if(f.type="text/javascript",f.crossOrigin="anonymous",f.src=e,f.onload=p=>{f.__posthog_loading_callback_fired=!0,n(void 0,p)},f.onerror=p=>n(p),t.config.prepare_external_dependency_script&&(f=t.config.prepare_external_dependency_script(f)),!f)return n("prepare_external_dependency_script returned null");var h,g=Le.querySelectorAll("body > script");g.length>0?(h=g[0].parentNode)==null||h.insertBefore(f,g[0]):Le.body.appendChild(f)};Le!=null&&Le.body?u():Le==null||Le.addEventListener("DOMContentLoaded",u)};ct.__PosthogExtensions__=ct.__PosthogExtensions__||{},ct.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{var r="/static/"+e+".js?v="+t.version;if(e==="remote-config"&&(r="/array/"+t.config.token+"/config.js"),e==="toolbar"){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var a=t.requestRouter.endpointFor("assets",r);wS(t,a,n)},ct.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var r=t.requestRouter.endpointFor("api",e);wS(t,r,n)};var im={};function Da(t,e,n){if(tn(t)){if(hS&&t.forEach===hS)t.forEach(e,n);else if("length"in t&&t.length===+t.length){for(var r=0,s=t.length;r<s;r++)if(r in t&&e.call(n,t[r],r)===im)return}}}function Xt(t,e,n){if(!en(t)){if(tn(t))return Da(t,e,n);if(gD(t)){for(var r of t.entries())if(e.call(n,r[1],r[0])===im)return}else for(var s in t)if(VC.call(t,s)&&e.call(n,t[s],s)===im)return}}var xn=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Da(n,(function(s){for(var a in s)s[a]!==void 0&&(t[a]=s[a])})),t},Sc=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Da(n,(function(s){Da(s,(function(a){t.push(a)}))})),t};function qh(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r}var _S=function(t){try{return t()}catch{return}},qD=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.apply(this,n)}catch(s){Be.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Be.critical(s)}}},Hb=function(t){var e={};return Xt(t,(function(n,r){(Pn(n)&&n.length>0||ni(n))&&(e[r]=n)})),e};function HD(t,e){return n=t,r=a=>Pn(a)&&!Ki(e)?a.slice(0,e):a,s=new Set,(function a(l,u){return l!==Object(l)?r?r(l,u):l:s.has(l)?void 0:(s.add(l),tn(l)?(f=[],Da(l,(h=>{f.push(a(h))}))):(f={},Xt(l,((h,g)=>{s.has(h)||(f[g]=a(h,g))}))),f);var f})(n);var n,r,s}var VD=["herokuapp.com","vercel.app","netlify.app"];function KD(t){var e=t==null?void 0:t.hostname;if(!Pn(e))return!1;var n=e.split(".").slice(-2).join(".");for(var r of VD)if(n===r)return!1;return!0}function WC(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return t[n]}function Tn(t,e,n,r){var{capture:s=!1,passive:a=!0}=r??{};t==null||t.addEventListener(e,n,{capture:s,passive:a})}var QC="$people_distinct_id",Zu="__alias",Wu="__timers",kS="$autocapture_disabled_server_side",Ny="$heatmaps_enabled_server_side",SS="$exception_capture_enabled_server_side",Cy="$error_tracking_suppression_rules",jS="$error_tracking_capture_extension_exceptions",NS="$web_vitals_enabled_server_side",XC="$dead_clicks_enabled_server_side",CS="$web_vitals_allowed_metrics",tx="$session_recording_remote_config",am="$sesid",JC="$session_is_sampled",Hl="$enabled_feature_flags",Qu="$early_access_features",Ey="$feature_flag_details",Xu="$stored_person_properties",bo="$stored_group_properties",Ty="$surveys",hh="$surveys_activated",om="$flag_call_reported",Oi="$user_state",Ay="$client_session_props",Oy="$capture_rate_limit",Ry="$initial_campaign_params",My="$initial_referrer_info",lm="$initial_person_info",cm="$epp",e2="__POSTHOG_TOOLBAR__",Iu="$posthog_cookieless",YD=[QC,Zu,"__cmpns",Wu,"$session_recording_enabled_server_side",Ny,am,Hl,Cy,Oi,Qu,Ey,bo,Xu,Ty,om,Ay,Oy,Ry,My,cm,lm];function ES(t){return t instanceof Element&&(t.id===e2||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function Gm(t){return!!t&&t.nodeType===1}function Ia(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function t2(t){return!!t&&t.nodeType===3}function n2(t){return!!t&&t.nodeType===11}function Vb(t){return t?Km(t).split(/\s+/):[]}function TS(t){var e=se==null?void 0:se.location.href;return!!(e&&t&&t.some((n=>e.match(n))))}function um(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Vb(e)}function r2(t){return en(t)?null:Km(t).split(/(\s+)/).filter((e=>vd(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Zm(t){var e="";return Dy(t)&&!l2(t)&&t.childNodes&&t.childNodes.length&&Xt(t.childNodes,(function(n){var r;t2(n)&&n.textContent&&(e+=(r=r2(n.textContent))!==null&&r!==void 0?r:"")})),Km(e)}function s2(t){return Me(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var Kb=["a","button","form","input","select","textarea","label"];function i2(t,e){if(Me(e))return!0;var n,r=function(a){if(e.some((l=>a.matches(l))))return{v:!0}};for(var s of t)if(n=r(s))return n.v;return!1}function a2(t){var e=t.parentNode;return!(!e||!Gm(e))&&e}var AS=[".ph-no-rageclick",".ph-no-capture"],Yb=t=>!t||Ia(t,"html")||!Gm(t),o2=(t,e)=>{if(!se||Yb(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[t],s=t;s.parentNode&&!Ia(s,"body");)if(n2(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var a=a2(s);if(!a)break;if(e||Kb.indexOf(a.tagName.toLowerCase())>-1)n=!0;else{var l=se.getComputedStyle(a);l&&l.getPropertyValue("cursor")==="pointer"&&(n=!0)}r.push(a),s=a}return{parentIsUsefulElement:n,targetElementList:r}};function GD(t,e,n,r,s){var a,l,u,f;if(n===void 0&&(n=void 0),!se||Yb(t)||(a=n)!=null&&a.url_allowlist&&!TS(n.url_allowlist)||(l=n)!=null&&l.url_ignorelist&&TS(n.url_ignorelist))return!1;if((u=n)!=null&&u.dom_event_allowlist){var h=n.dom_event_allowlist;if(h&&!h.some((k=>e.type===k)))return!1}var{parentIsUsefulElement:g,targetElementList:p}=o2(t,r);if(!(function(k,w){var S=w==null?void 0:w.element_allowlist;if(Me(S))return!0;var N,C=function(A){if(S.some((I=>A.tagName.toLowerCase()===I)))return{v:!0}};for(var j of k)if(N=C(j))return N.v;return!1})(p,n)||!i2(p,(f=n)==null?void 0:f.css_selector_allowlist))return!1;var x=se.getComputedStyle(t);if(x&&x.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var y=t.tagName.toLowerCase();switch(y){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return g?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(Kb.indexOf(y)>-1||t.getAttribute("contenteditable")==="true")}}function Dy(t){for(var e=t;e.parentNode&&!Ia(e,"body");e=e.parentNode){var n=um(e);if(St(n,"ph-sensitive")||St(n,"ph-no-capture"))return!1}if(St(um(t),"ph-include"))return!0;var r=t.type||"";if(Pn(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!(Pn(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function l2(t){return!!(Ia(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Ia(t,"select")||Ia(t,"textarea")||t.getAttribute("contenteditable")==="true")}var c2="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",ZD=new RegExp("^(?:"+c2+")$"),WD=new RegExp(c2),u2="\\d{3}-?\\d{2}-?\\d{4}",QD=new RegExp("^("+u2+")$"),XD=new RegExp("("+u2+")");function vd(t,e){return e===void 0&&(e=!0),!(en(t)||Pn(t)&&(t=Km(t),(e?ZD:WD).test((t||"").replace(/[- ]/g,""))||(e?QD:XD).test(t)))}function d2(t){var e=Zm(t);return vd(e=(e+" "+f2(t)).trim())?e:""}function f2(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Xt(t.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var s=Zm(n);e=(e+" "+s).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+f2(n)).trim())}catch(a){Be.error("[AutoCapture]",a)}})),e}function JD(t){return(function(e){var n=e.map((r=>{var s,a,l="";if(r.tag_name&&(l+=r.tag_name),r.attr_class)for(var u of(r.attr_class.sort(),r.attr_class))l+="."+u.replace(/"/g,"");var f=qe({},r.text?{text:r.text}:{},{"nth-child":(s=r.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(a=r.nth_of_type)!==null&&a!==void 0?a:0},r.href?{href:r.href}:{},r.attr_id?{attr_id:r.attr_id}:{},r.attributes),h={};return qh(f).sort(((g,p)=>{var[x]=g,[y]=p;return x.localeCompare(y)})).forEach((g=>{var[p,x]=g;return h[OS(p.toString())]=OS(x.toString())})),l+=":",l+=qh(h).map((g=>{var[p,x]=g;return p+'="'+x+'"'})).join("")}));return n.join(";")})((function(e){return e.map((n=>{var r,s,a={text:(r=n.$el_text)==null?void 0:r.slice(0,400),tag_name:n.tag_name,href:(s=n.attr__href)==null?void 0:s.slice(0,2048),attr_class:eI(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return qh(n).filter((l=>{var[u]=l;return u.indexOf("attr__")===0})).forEach((l=>{var[u,f]=l;return a.attributes[u]=f})),a}))})(t))}function OS(t){return t.replace(/"|\\"/g,'\\"')}function eI(t){var e=t.attr__class;return e?tn(e)?e:Vb(e):void 0}class h2{constructor(){this.clicks=[]}isRageClick(e,n,r){var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(n-s.y)<30&&r-s.timestamp<1e3){if(this.clicks.push({x:e,y:n,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:n,timestamp:r}];return!1}}var nx="$copy_autocapture",Mi=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({}),dm=t=>{var e=Le==null?void 0:Le.createElement("a");return Me(e)?null:(e.href=t,e)},tI=function(t,e){var n,r;e===void 0&&(e="&");var s=[];return Xt(t,(function(a,l){Me(a)||Me(l)||l==="undefined"||(n=encodeURIComponent((u=>u instanceof File)(a)?a.name:a.toString()),r=encodeURIComponent(l),s[s.length]=r+"="+n)})),s.join(e)},fm=function(t,e){for(var n,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var a=r[s].split("=");if(a[0]===e){n=a;break}}if(!tn(n)||n.length<2)return"";var l=n[1];try{l=decodeURIComponent(l)}catch{Be.error("Skipping decoding for malformed query param: "+l)}return l.replace(/\+/g," ")},Dd=function(t,e,n){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[0]||"",a=r[1],l=s.split("?"),u=l[1],f=l[0],h=(u||"").split("&"),g=[],p=0;p<h.length;p++){var x=h[p].split("=");tn(x)&&(e.includes(x[0])?g.push(x[0]+"="+n):g.push(h[p]))}var y=f;return u!=null&&(y+="?"+g.join("&")),a!=null&&(y+="#"+a),y},hm=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},RS=qn("[AutoCapture]");function rx(t,e){return e.length>t?e.slice(0,t)+"...":e}function nI(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!Gm(e));return e}function rI(t,e,n,r){var s=t.tagName.toLowerCase(),a={tag_name:s};Kb.indexOf(s)>-1&&!n&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?a.$el_text=rx(1024,d2(t)):a.$el_text=rx(1024,Zm(t)));var l=um(t);l.length>0&&(a.classes=l.filter((function(g){return g!==""}))),Xt(t.attributes,(function(g){var p;if((!l2(t)||["name","id","class","aria-label"].indexOf(g.name)!==-1)&&(r==null||!r.includes(g.name))&&!e&&vd(g.value)&&(p=g.name,!Pn(p)||p.substring(0,10)!=="_ngcontent"&&p.substring(0,7)!=="_nghost")){var x=g.value;g.name==="class"&&(x=Vb(x).join(" ")),a["attr__"+g.name]=rx(1024,x)}}));for(var u=1,f=1,h=t;h=nI(h);)u++,h.tagName===t.tagName&&f++;return a.nth_child=u,a.nth_of_type=f,a}function sI(t,e){for(var n,r,{e:s,maskAllElementAttributes:a,maskAllText:l,elementAttributeIgnoreList:u,elementsChainAsString:f}=e,h=[t],g=t;g.parentNode&&!Ia(g,"body");)n2(g.parentNode)?(h.push(g.parentNode.host),g=g.parentNode.host):(h.push(g.parentNode),g=g.parentNode);var p,x=[],y={},k=!1,w=!1;if(Xt(h,(A=>{var I=Dy(A);A.tagName.toLowerCase()==="a"&&(k=A.getAttribute("href"),k=I&&k&&vd(k)&&k),St(um(A),"ph-no-capture")&&(w=!0),x.push(rI(A,a,l,u));var T=(function(E){if(!Dy(E))return{};var R={};return Xt(E.attributes,(function(z){if(z.name&&z.name.indexOf("data-ph-capture-attribute")===0){var D=z.name.replace("data-ph-capture-attribute-",""),B=z.value;D&&B&&vd(B)&&(R[D]=B)}})),R})(A);xn(y,T)})),w)return{props:{},explicitNoCapture:w};if(l||(t.tagName.toLowerCase()==="a"||t.tagName.toLowerCase()==="button"?x[0].$el_text=d2(t):x[0].$el_text=Zm(t)),k){var S,N;x[0].attr__href=k;var C=(S=dm(k))==null?void 0:S.host,j=se==null||(N=se.location)==null?void 0:N.host;C&&j&&C!==j&&(p=k)}return{props:xn({$event_type:s.type,$ce_version:1},f?{}:{$elements:x},{$elements_chain:JD(x)},(n=x[0])!=null&&n.$el_text?{$el_text:(r=x[0])==null?void 0:r.$el_text}:{},p&&s.type==="click"?{$external_click_url:p}:{},y)}}class iI{constructor(e){this.P=!1,this.T=null,this.rageclicks=new h2,this.R=!1,this.instance=e,this.I=null}get C(){var e,n,r=er(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(e=r.url_allowlist)==null?void 0:e.map((s=>new RegExp(s))),r.url_ignorelist=(n=r.url_ignorelist)==null?void 0:n.map((s=>new RegExp(s))),r}O(){if(this.isBrowserSupported()){if(se&&Le){var e=r=>{r=r||(se==null?void 0:se.event);try{this.F(r)}catch(s){RS.error("Failed to capture event",s)}};if(Tn(Le,"submit",e,{capture:!0}),Tn(Le,"change",e,{capture:!0}),Tn(Le,"click",e,{capture:!0}),this.C.capture_copied_text){var n=r=>{r=r||(se==null?void 0:se.event),this.F(r,nx)};Tn(Le,"copy",n,{capture:!0}),Tn(Le,"cut",n,{capture:!0})}}}else RS.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.O(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.R=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[kS]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.I=e}getElementSelectors(e){var n,r=[];return(n=this.I)==null||n.forEach((s=>{var a=Le==null?void 0:Le.querySelectorAll(s);a==null||a.forEach((l=>{e===l&&r.push(s)}))})),r}get isEnabled(){var e,n,r=(e=this.instance.persistence)==null?void 0:e.props[kS],s=this.T;if(Ki(s)&&!Ma(r)&&!this.instance.M())return!1;var a=(n=this.T)!==null&&n!==void 0?n:!!r;return!!this.instance.config.autocapture&&!a}F(e,n){if(n===void 0&&(n="$autocapture"),this.isEnabled){var r,s=s2(e);t2(s)&&(s=s.parentNode||null),n==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&(function(x,y){if(!se||Yb(x))return!1;var k,w;if((k=Ma(y)?!!y&&AS:(w=y==null?void 0:y.css_selector_ignorelist)!==null&&w!==void 0?w:AS)===!1)return!1;var{targetElementList:S}=o2(x,!1);return!i2(S,k)})(s,this.instance.config.rageclick)&&this.F(e,"$rageclick");var a=n===nx;if(s&&GD(s,e,this.C,a,a?["copy","cut"]:void 0)){var{props:l,explicitNoCapture:u}=sI(s,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.C.element_attribute_ignorelist,elementsChainAsString:this.R});if(u)return!1;var f=this.getElementSelectors(s);if(f&&f.length>0&&(l.$element_selectors=f),n===nx){var h,g=r2(se==null||(h=se.getSelection())==null?void 0:h.toString()),p=e.type||"clipboard";if(!g)return!1;l.$selected_content=g,l.$copy_type=p}return this.instance.capture(n,l),!0}}}isBrowserSupported(){return Ra(Le==null?void 0:Le.querySelectorAll)}}Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return ni(t)&&isFinite(t)&&Math.floor(t)===t});var MS="0123456789abcdef";class mm{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,r,s){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(s)||e<0||n<0||r<0||s<0||e>0xffffffffffff||n>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var a=new Uint8Array(16);return a[0]=e/Math.pow(2,40),a[1]=e/Math.pow(2,32),a[2]=e/Math.pow(2,24),a[3]=e/Math.pow(2,16),a[4]=e/Math.pow(2,8),a[5]=e,a[6]=112|n>>>8,a[7]=n,a[8]=128|r>>>24,a[9]=r>>>16,a[10]=r>>>8,a[11]=r,a[12]=s>>>24,a[13]=s>>>16,a[14]=s>>>8,a[15]=s,new mm(a)}toString(){for(var e="",n=0;n<this.bytes.length;n++)e=e+MS.charAt(this.bytes[n]>>>4)+MS.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new mm(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;n<16;n++){var r=this.bytes[n]-e.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class aI{constructor(){this.A=0,this.D=0,this.j=new oI}generate(){var e=this.generateOrAbort();if(Me(e)){this.A=0;var n=this.generateOrAbort();if(Me(n))throw new Error("Could not generate UUID after timestamp reset");return n}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return mm.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var DS,m2=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<t.length;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};se&&!Me(se.crypto)&&crypto.getRandomValues&&(m2=t=>crypto.getRandomValues(t));class oI{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(m2(this.N),this.U=0),this.N[this.U++]}}var Oa=()=>lI().toString(),lI=()=>(DS||(DS=new aI)).generate(),Lu="",cI=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function uI(t,e){if(e){var n=(function(s,a){if(a===void 0&&(a=Le),Lu)return Lu;if(!a||["localhost","127.0.0.1"].includes(s))return"";for(var l=s.split("."),u=Math.min(l.length,8),f="dmn_chk_"+Oa();!Lu&&u--;){var h=l.slice(u).join("."),g=f+"=1;domain=."+h+";path=/";a.cookie=g+";max-age=3",a.cookie.includes(f)&&(a.cookie=g+";max-age=0",Lu=h)}return Lu})(t);if(!n){var r=(s=>{var a=s.match(cI);return a?a[0]:""})(t);r!==n&&Be.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Js={H:()=>!!Le,B:function(t){Be.error("cookieStore error: "+t)},q:function(t){if(Le){try{for(var e=t+"=",n=Le.cookie.split(";").filter((a=>a.length)),r=0;r<n.length;r++){for(var s=n[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},W:function(t){var e;try{e=JSON.parse(Js.q(t))||{}}catch{}return e},G:function(t,e,n,r,s){if(Le)try{var a="",l="",u=uI(Le.location.hostname,r);if(n){var f=new Date;f.setTime(f.getTime()+24*n*60*60*1e3),a="; expires="+f.toUTCString()}s&&(l="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+a+"; SameSite=Lax; path=/"+u+l;return h.length>3686.4&&Be.warn("cookieStore warning: large cookie, len="+h.length),Le.cookie=h,h}catch{return}},V:function(t,e){if(Le!=null&&Le.cookie)try{Js.G(t,"",-1,e)}catch{return}}},sx=null,an={H:function(){if(!Ki(sx))return sx;var t=!0;if(Me(se))t=!1;else try{var e="__mplssupport__";an.G(e,"xyz"),an.q(e)!=='"xyz"'&&(t=!1),an.V(e)}catch{t=!1}return t||Be.error("localStorage unsupported; falling back to cookie store"),sx=t,t},B:function(t){Be.error("localStorage error: "+t)},q:function(t){try{return se==null?void 0:se.localStorage.getItem(t)}catch(e){an.B(e)}return null},W:function(t){try{return JSON.parse(an.q(t))||{}}catch{}return null},G:function(t,e){try{se==null||se.localStorage.setItem(t,JSON.stringify(e))}catch(n){an.B(n)}},V:function(t){try{se==null||se.localStorage.removeItem(t)}catch(e){an.B(e)}}},dI=["distinct_id",am,JC,cm,lm],mh=qe({},an,{W:function(t){try{var e={};try{e=Js.W(t)||{}}catch{}var n=xn(e,JSON.parse(an.q(t)||"{}"));return an.G(t,n),n}catch{}return null},G:function(t,e,n,r,s,a){try{an.G(t,e,void 0,void 0,a);var l={};dI.forEach((u=>{e[u]&&(l[u]=e[u])})),Object.keys(l).length&&Js.G(t,l,n,r,s,a)}catch(u){an.B(u)}},V:function(t,e){try{se==null||se.localStorage.removeItem(t),Js.V(t,e)}catch(n){an.B(n)}}}),ph={},fI={H:function(){return!0},B:function(t){Be.error("memoryStorage error: "+t)},q:function(t){return ph[t]||null},W:function(t){return ph[t]||null},G:function(t,e){ph[t]=e},V:function(t){delete ph[t]}},mo=null,Gn={H:function(){if(!Ki(mo))return mo;if(mo=!0,Me(se))mo=!1;else try{var t="__support__";Gn.G(t,"xyz"),Gn.q(t)!=='"xyz"'&&(mo=!1),Gn.V(t)}catch{mo=!1}return mo},B:function(t){Be.error("sessionStorage error: ",t)},q:function(t){try{return se==null?void 0:se.sessionStorage.getItem(t)}catch(e){Gn.B(e)}return null},W:function(t){try{return JSON.parse(Gn.q(t))||null}catch{}return null},G:function(t,e){try{se==null||se.sessionStorage.setItem(t,JSON.stringify(e))}catch(n){Gn.B(n)}},V:function(t){try{se==null||se.sessionStorage.removeItem(t)}catch(e){Gn.B(e)}}},Ri=(function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t})({});class hI{constructor(e){this._instance=e}get C(){return this._instance.config}get consent(){return this.J()?Ri.DENIED:this.K}isOptedOut(){return this.C.cookieless_mode==="always"||this.consent===Ri.DENIED||this.consent===Ri.PENDING&&(this.C.opt_out_capturing_by_default||this.C.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Ri.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.C.cookie_expiration,this.C.cross_subdomain_cookie,this.C.secure_cookie)}reset(){this.Y.V(this.X,this.C.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:r}=this._instance.config;return r||(n?n+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return Jv(e)?Ri.GRANTED:St(yD,e)?Ri.DENIED:Ri.PENDING}get Y(){if(!this.Z){var e=this.C.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?an:Js;var n=e==="localStorage"?Js:an;n.q(this.X)&&(this.Z.q(this.X)||this.optInOut(Jv(n.q(this.X))),n.V(this.X,this.C.cross_subdomain_cookie))}return this.Z}J(){return!!this.C.respect_dnt&&!!WC([qr==null?void 0:qr.doNotTrack,qr==null?void 0:qr.msDoNotTrack,ct.doNotTrack],(e=>Jv(e)))}}var gh=qn("[Dead Clicks]"),mI=()=>!0,pI=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(XC)),r=t.instance.config.capture_dead_clicks;return Ma(r)?r:n};class p2{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,n,r){this.instance=e,this.isEnabled=n,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[XC]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(e){var n,r;(n=ct.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&e(),(r=ct.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(s=>{s?gh.error("failed to load script",s):e()}))}et(){var e;if(Le){if(!this.tt&&(e=ct.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=er(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.tt=ct.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.tt.start(Le),gh.info("starting...")}}else gh.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,gh.info("stopping..."))}}var Pu=qn("[ExceptionAutocapture]");class gI{constructor(e){var n,r,s;this.rt=()=>{var a;if(se&&this.isEnabled&&(a=ct.__PosthogExtensions__)!=null&&a.errorWrappingFunctions){var l=ct.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,u=ct.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,f=ct.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.C.capture_unhandled_errors&&(this.st=l(this.captureException.bind(this))),!this.nt&&this.C.capture_unhandled_rejections&&(this.nt=u(this.captureException.bind(this))),!this.ot&&this.C.capture_console_errors&&(this.ot=f(this.captureException.bind(this)))}catch(h){Pu.error("failed to start",h),this.lt()}}},this._instance=e,this.ut=!((n=this._instance.persistence)==null||!n.props[SS]),this.C=this.ht(),this.dt=new bD({refillRate:(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,h:Pu}),this.startIfEnabled()}ht(){var e=this._instance.config.capture_exceptions,n={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return er(e)?n=qe({},n,e):(Me(e)?this.ut:e)&&(n=qe({},n,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.C.capture_console_errors||this.C.capture_unhandled_errors||this.C.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(Pu.info("enabled"),this.it(this.rt))}it(e){var n,r;(n=ct.__PosthogExtensions__)!=null&&n.errorWrappingFunctions&&e(),(r=ct.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return Pu.error("failed to load script",s);e()}))}lt(){var e,n,r;(e=this.st)==null||e.call(this),this.st=void 0,(n=this.nt)==null||n.call(this),this.nt=void 0,(r=this.ot)==null||r.call(this),this.ot=void 0}onRemoteConfig(e){var n=e.autocaptureExceptions;this.ut=!!n||!1,this.C=this.ht(),this._instance.persistence&&this._instance.persistence.register({[SS]:this.ut}),this.startIfEnabled()}captureException(e){var n,r,s=(n=e==null||(r=e.$exception_list)==null||(r=r[0])==null?void 0:r.type)!==null&&n!==void 0?n:"Exception";this.dt.consumeRateLimit(s)?Pu.info("Skipping exception capture because of client rate limiting.",{exception:s}):this._instance.exceptions.sendExceptionEvent(e)}}function IS(t,e,n){try{if(!(e in t))return()=>{};var r=t[e],s=n(r);return Ra(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]=r}}catch{return()=>{}}}class vI{constructor(e){var n;this._instance=e,this.vt=(se==null||(n=se.location)==null?void 0:n.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Be.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ct&&this.ct(),this.ct=void 0,Be.info("History API monitoring stopped")}monitorHistoryChanges(){var e,n;if(se&&se.history){var r=this;(e=se.history.pushState)!=null&&e.__posthog_wrapped__||IS(se.history,"pushState",(s=>function(a,l,u){s.call(this,a,l,u),r.ft("pushState")})),(n=se.history.replaceState)!=null&&n.__posthog_wrapped__||IS(se.history,"replaceState",(s=>function(a,l,u){s.call(this,a,l,u),r.ft("replaceState")})),this.gt()}}ft(e){try{var n,r=se==null||(n=se.location)==null?void 0:n.pathname;if(!r)return;r!==this.vt&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.vt=r}catch(s){Be.error("Error capturing "+e+" pageview",s)}}gt(){if(!this.ct){var e=()=>{this.ft("popstate")};Tn(se,"popstate",e),this.ct=()=>{se&&se.removeEventListener("popstate",e)}}}}var ix=qn("[SegmentIntegration]");function xI(t,e){var n=t.config.segment;if(!n)return e();(function(r,s){var a=r.config.segment;if(!a)return s();var l=f=>{var h=()=>f.anonymousId()||Oa();r.config.get_device_id=h,f.id()&&(r.register({distinct_id:f.id(),$device_id:h()}),r.persistence.set_property(Oi,"identified")),s()},u=a.user();"then"in u&&Ra(u.then)?u.then((f=>l(f))):l(u)})(t,(()=>{n.register((r=>{Promise&&Promise.resolve||ix.warn("This browser does not have Promise support, and can not use the segment integration");var s=(a,l)=>{if(!l)return a;a.event.userId||a.event.anonymousId===r.get_distinct_id()||(ix.info("No userId set, resetting PostHog"),r.reset()),a.event.userId&&a.event.userId!==r.get_distinct_id()&&(ix.info("UserId set, identifying with PostHog"),r.identify(a.event.userId));var u=r.calculateEventProperties(l,a.event.properties);return a.event.properties=Object.assign({},u,a.event.properties),a};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:a=>s(a,a.event.event),page:a=>s(a,"$pageview"),identify:a=>s(a,"$identify"),screen:a=>s(a,"$screen")}})(t)).then((()=>{e()}))}))}var g2="posthog-js";function v2(t,e){var{organization:n,projectId:r,prefix:s,severityAllowList:a=["error"],sendExceptionsToPostHog:l=!0}=e===void 0?{}:e;return u=>{var f,h,g,p,x;if(!(a==="*"||a.includes(u.level))||!t.__loaded)return u;u.tags||(u.tags={});var y=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());u.tags["PostHog Person URL"]=y,t.sessionRecordingStarted()&&(u.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var k=((f=u.exception)==null?void 0:f.values)||[],w=k.map((N=>qe({},N,{stacktrace:N.stacktrace?qe({},N.stacktrace,{type:"raw",frames:(N.stacktrace.frames||[]).map((C=>qe({},C,{platform:"web:javascript"})))}):void 0}))),S={$exception_message:((h=k[0])==null?void 0:h.value)||u.message,$exception_type:(g=k[0])==null?void 0:g.type,$exception_level:u.level,$exception_list:w,$sentry_event_id:u.event_id,$sentry_exception:u.exception,$sentry_exception_message:((p=k[0])==null?void 0:p.value)||u.message,$sentry_exception_type:(x=k[0])==null?void 0:x.type,$sentry_tags:u.tags};return n&&r&&(S.$sentry_url=(s||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+u.event_id),l&&t.exceptions.sendExceptionEvent(S),u}}class yI{constructor(e,n,r,s,a,l){this.name=g2,this.setupOnce=function(u){u(v2(e,{organization:n,projectId:r,prefix:s,severityAllowList:a,sendExceptionsToPostHog:l==null||l}))}}}var bI=se!=null&&se.location?hm(se.location.hash,"__posthog")||hm(location.hash,"state"):null,LS="_postHogToolbarParams",PS=qn("[Toolbar]"),Sa=(function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t})(Sa||{});class wI{constructor(e){this.instance=e}_t(e){ct.ph_toolbar_state=e}yt(){var e;return(e=ct.ph_toolbar_state)!==null&&e!==void 0?e:Sa.UNINITIALIZED}maybeLoadToolbar(e,n,r){if(e===void 0&&(e=void 0),n===void 0&&(n=void 0),r===void 0&&(r=void 0),!se||!Le)return!1;e=e??se.location,r=r??se.history;try{if(!n){try{se.localStorage.setItem("test","test"),se.localStorage.removeItem("test")}catch{return!1}n=se==null?void 0:se.localStorage}var s,a=bI||hm(e.hash,"__posthog")||hm(e.hash,"state"),l=a?_S((()=>JSON.parse(atob(decodeURIComponent(a)))))||_S((()=>JSON.parse(decodeURIComponent(a)))):null;return l&&l.action==="ph_authorize"?((s=l).source="url",s&&Object.keys(s).length>0&&(l.desiredHash?e.hash=l.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(n.getItem(LS)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch{return!1}}bt(e){var n=ct.ph_load_toolbar||ct.ph_load_editor;!en(n)&&Ra(n)?n(e,this.instance):PS.warn("No toolbar load function found")}loadToolbar(e){var n=!(Le==null||!Le.getElementById(e2));if(!se||n)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=qe({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(se.localStorage.setItem(LS,JSON.stringify(qe({},s,{source:void 0}))),this.yt()===Sa.LOADED)this.bt(s);else if(this.yt()===Sa.UNINITIALIZED){var a;this._t(Sa.LOADING),(a=ct.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(l=>{if(l)return PS.error("[Toolbar] Failed to load",l),void this._t(Sa.UNINITIALIZED);this._t(Sa.LOADED),this.bt(s)})),Tn(se,"turbolinks:load",(()=>{this._t(Sa.UNINITIALIZED),this.loadToolbar(s)}))}return!0}wt(e){return this.loadToolbar(e)}maybeLoadEditor(e,n,r){return e===void 0&&(e=void 0),n===void 0&&(n=void 0),r===void 0&&(r=void 0),this.maybeLoadToolbar(e,n,r)}}var _I=qn("[TracingHeaders]");class kI{constructor(e){this.xt=void 0,this.St=void 0,this.rt=()=>{var n,r;Me(this.xt)&&((n=ct.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),Me(this.St)&&((r=ct.__PosthogExtensions__)==null||(r=r.tracingHeadersPatchFns)==null||r._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var n,r;(n=ct.__PosthogExtensions__)!=null&&n.tracingHeadersPatchFns&&e(),(r=ct.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return _I.error("failed to load script",s);e()}))}startIfEnabledOrStop(){var e,n;this._instance.config.__add_tracing_headers?this.it(this.rt):((e=this.xt)==null||e.call(this),(n=this.St)==null||n.call(this),this.xt=void 0,this.St=void 0)}}var as="Mobile",pm="iOS",Ws="Android",xd="Tablet",x2=Ws+" "+xd,y2="iPad",b2="Apple",w2=b2+" Watch",yd="Safari",uc="BlackBerry",_2="Samsung",k2=_2+"Browser",S2=_2+" Internet",Co="Chrome",SI=Co+" OS",j2=Co+" "+pm,Gb="Internet Explorer",N2=Gb+" "+as,Zb="Opera",jI=Zb+" Mini",Wb="Edge",C2="Microsoft "+Wb,Jl="Firefox",E2=Jl+" "+pm,bd="Nintendo",wd="PlayStation",ec="Xbox",T2=Ws+" "+as,A2=as+" "+yd,Ju="Windows",Iy=Ju+" Phone",$S="Nokia",Ly="Ouya",O2="Generic",NI=O2+" "+as.toLowerCase(),R2=O2+" "+xd.toLowerCase(),Py="Konqueror",dr="(\\d+(\\.\\d+)?)",ax=new RegExp("Version/"+dr),CI=new RegExp(ec,"i"),EI=new RegExp(wd+" \\w+","i"),TI=new RegExp(bd+" \\w+","i"),Qb=new RegExp(uc+"|PlayBook|BB10","i"),AI={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},OI=(t,e)=>e&&St(e,b2)||(function(n){return St(n,yd)&&!St(n,Co)&&!St(n,Ws)})(t),M2=function(t,e){return e=e||"",St(t," OPR/")&&St(t,"Mini")?jI:St(t," OPR/")?Zb:Qb.test(t)?uc:St(t,"IE"+as)||St(t,"WPDesktop")?N2:St(t,k2)?S2:St(t,Wb)||St(t,"Edg/")?C2:St(t,"FBIOS")?"Facebook "+as:St(t,"UCWEB")||St(t,"UCBrowser")?"UC Browser":St(t,"CriOS")?j2:St(t,"CrMo")||St(t,Co)?Co:St(t,Ws)&&St(t,yd)?T2:St(t,"FxiOS")?E2:St(t.toLowerCase(),Py.toLowerCase())?Py:OI(t,e)?St(t,as)?A2:yd:St(t,Jl)?Jl:St(t,"MSIE")||St(t,"Trident/")?Gb:St(t,"Gecko")?Jl:""},RI={[N2]:[new RegExp("rv:"+dr)],[C2]:[new RegExp(Wb+"?\\/"+dr)],[Co]:[new RegExp("("+Co+"|CrMo)\\/"+dr)],[j2]:[new RegExp("CriOS\\/"+dr)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+dr)],[yd]:[ax],[A2]:[ax],[Zb]:[new RegExp("(Opera|OPR)\\/"+dr)],[Jl]:[new RegExp(Jl+"\\/"+dr)],[E2]:[new RegExp("FxiOS\\/"+dr)],[Py]:[new RegExp("Konqueror[:/]?"+dr,"i")],[uc]:[new RegExp(uc+" "+dr),ax],[T2]:[new RegExp("android\\s"+dr,"i")],[S2]:[new RegExp(k2+"\\/"+dr)],[Gb]:[new RegExp("(rv:|MSIE )"+dr)],Mozilla:[new RegExp("rv:"+dr)]},MI=function(t,e){var n=M2(t,e),r=RI[n];if(Me(r))return null;for(var s=0;s<r.length;s++){var a=r[s],l=t.match(a);if(l)return parseFloat(l[l.length-2])}return null},zS=[[new RegExp(ec+"; "+ec+" (.*?)[);]","i"),t=>[ec,t&&t[1]||""]],[new RegExp(bd,"i"),[bd,""]],[new RegExp(wd,"i"),[wd,""]],[Qb,[uc,""]],[new RegExp(Ju,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Iy,""];if(new RegExp(as).test(e)&&!/IEMobile\b/.test(e))return[Ju+" "+as,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=n[1],s=AI[r]||"";return/arm/i.test(e)&&(s="RT"),[Ju,s]}return[Ju,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var e=[t[3],t[4],t[5]||"0"];return[pm,e.join(".")]}return[pm,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=Me(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Ws+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ws+")","i"),t=>{if(t&&t[2]){var e=[t[2],t[3],t[4]||"0"];return[Ws,e.join(".")]}return[Ws,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];if(t&&t[1]){var n=[t[1],t[2],t[3]||"0"];e[1]=n.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[SI,""]],[/Linux|debian/i,["Linux",""]]],FS=function(t){return TI.test(t)?bd:EI.test(t)?wd:CI.test(t)?ec:new RegExp(Ly,"i").test(t)?Ly:new RegExp("("+Iy+"|WPDesktop)","i").test(t)?Iy:/iPad/.test(t)?y2:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?w2:Qb.test(t)?uc:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp($S,"i").test(t)?$S:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?!new RegExp(as).test(t)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)?/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Ws:x2:Ws:new RegExp("(pda|"+as+")","i").test(t)?NI:new RegExp(xd,"i").test(t)&&!new RegExp(xd+" pc","i").test(t)?R2:""},vh="https?://(.*)",jc=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],DI=Sc(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],jc),Id="<masked>",II=["li_fat_id"];function D2(t,e,n){if(!Le)return{};var r,s=e?Sc([],jc,n||[]):[],a=I2(Dd(Le.URL,s,Id),t),l=(r={},Xt(II,(function(u){var f=Js.q(u);r[u]=f||null})),r);return xn(l,a)}function I2(t,e){var n=DI.concat(e||[]),r={};return Xt(n,(function(s){var a=fm(t,s);r[s]=a||null})),r}function L2(t){var e=(function(a){return a?a.search(vh+"google.([^/?]*)")===0?"google":a.search(vh+"bing.com")===0?"bing":a.search(vh+"yahoo.com")===0?"yahoo":a.search(vh+"duckduckgo.com")===0?"duckduckgo":null:null})(t),n=e!="yahoo"?"q":"p",r={};if(!Ki(e)){r.$search_engine=e;var s=Le?fm(Le.referrer,n):"";s.length&&(r.ph_keyword=s)}return r}function BS(){return navigator.language||navigator.userLanguage}function P2(){return(Le==null?void 0:Le.referrer)||"$direct"}function $2(t,e){var n=t?Sc([],jc,e||[]):[],r=jr==null?void 0:jr.href.substring(0,1e3);return{r:P2().substring(0,1e3),u:r?Dd(r,n,Id):void 0}}function z2(t){var e,{r:n,u:r}=t,s={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(e=dm(n))==null?void 0:e.host};if(r){s.$current_url=r;var a=dm(r);s.$host=a==null?void 0:a.host,s.$pathname=a==null?void 0:a.pathname;var l=I2(r);xn(s,l)}if(n){var u=L2(n);xn(s,u)}return s}function F2(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function LI(){try{return new Date().getTimezoneOffset()}catch{return}}function PI(t,e){if(!Sr)return{};var n,r,s,a=t?Sc([],jc,e||[]):[],[l,u]=(function(f){for(var h=0;h<zS.length;h++){var[g,p]=zS[h],x=g.exec(f),y=x&&(Ra(p)?p(x,f):p);if(y)return y}return["",""]})(Sr);return xn(Hb({$os:l,$os_version:u,$browser:M2(Sr,navigator.vendor),$device:FS(Sr),$device_type:(r=Sr,s=FS(r),s===y2||s===x2||s==="Kobo"||s==="Kindle Fire"||s===R2?xd:s===bd||s===ec||s===wd||s===Ly?"Console":s===w2?"Wearable":s?as:"Desktop"),$timezone:F2(),$timezone_offset:LI()}),{$current_url:Dd(jr==null?void 0:jr.href,a,Id),$host:jr==null?void 0:jr.host,$pathname:jr==null?void 0:jr.pathname,$raw_user_agent:Sr.length>1e3?Sr.substring(0,997)+"...":Sr,$browser_version:MI(Sr,navigator.vendor),$browser_language:BS(),$browser_language_prefix:(n=BS(),typeof n=="string"?n.split("-")[0]:void 0),$screen_height:se==null?void 0:se.screen.height,$screen_width:se==null?void 0:se.screen.width,$viewport_height:se==null?void 0:se.innerHeight,$viewport_width:se==null?void 0:se.innerWidth,$lib:"web",$lib_version:Ai.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var ba=qn("[Web Vitals]"),US=9e5;class $I{constructor(e){var n;this.Et=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.$t=()=>{clearTimeout(this.kt),this.N.metrics.length!==0&&(this._instance.capture("$web_vitals",this.N.metrics.reduce(((r,s)=>qe({},r,{["$web_vitals_"+s.name+"_event"]:qe({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Pt=r=>{var s,a=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0);if(Me(a))ba.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var l=this.Tt();Me(l)||(en(r==null?void 0:r.name)||en(r==null?void 0:r.value)?ba.error("Invalid metric received",r):this.Rt&&r.value>=this.Rt?ba.error("Ignoring metric with value >= "+this.Rt,r):(this.N.url!==l&&(this.$t(),this.kt=setTimeout(this.$t,this.flushToCaptureTimeoutMs)),Me(this.N.url)&&(this.N.url=l),this.N.firstMetricTimestamp=Me(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.N.metrics.push(qe({},r,{$current_url:l,$session_id:a.sessionId,$window_id:a.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.$t()))}},this.rt=()=>{var r,s,a,l,u=ct.__PosthogExtensions__;Me(u)||Me(u.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:s,onFCP:a,onINP:l}=u.postHogWebVitalsCallbacks),r&&s&&a&&l?(this.allowedMetrics.indexOf("LCP")>-1&&r(this.Pt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.Pt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Pt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&l(this.Pt.bind(this)),this.P=!0):ba.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.Et=!((n=this._instance.persistence)==null||!n.props[NS]),this.startIfEnabled()}get allowedMetrics(){var e,n,r=er(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return Me(r)?((n=this._instance.persistence)==null?void 0:n.props[CS])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(er(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Rt(){var e=er(this._instance.config.capture_performance)&&ni(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:US;return 0<e&&e<=6e4?US:e}get isEnabled(){var e=jr==null?void 0:jr.protocol;if(e!=="http:"&&e!=="https:")return ba.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=er(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Ma(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Ma(n)?n:this.Et}startIfEnabled(){this.isEnabled&&!this.P&&(ba.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var n=er(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=er(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[NS]:n}),this._instance.persistence.register({[CS]:r})),this.Et=n,this.startIfEnabled()}it(e){var n,r;(n=ct.__PosthogExtensions__)!=null&&n.postHogWebVitalsCallbacks&&e(),(r=ct.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"web-vitals",(s=>{s?ba.error("failed to load script",s):e()}))}Tt(){var e=se?se.location.href:void 0;if(e){var n=this._instance.config.mask_personal_data_properties,r=this._instance.config.custom_personal_data_properties,s=n?Sc([],jc,r||[]):[];return Dd(e,s,Id)}ba.error("Could not determine current URL")}}var zI=qn("[Heatmaps]");function qS(t){return er(t)&&"clientX"in t&&"clientY"in t&&ni(t.clientX)&&ni(t.clientY)}class FI{constructor(e){var n;this.rageclicks=new h2,this.Et=!1,this.P=!1,this.It=null,this.instance=e,this.Et=!((n=this.instance.persistence)==null||!n.props[Ny])}get flushIntervalMilliseconds(){var e=5e3;return er(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Me(this.instance.config.capture_heatmaps)?Me(this.instance.config.enable_heatmaps)?this.Et:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.P)return;zI.info("starting..."),this.Ct(),this.Ot()}else{var e;clearInterval((e=this.It)!==null&&e!==void 0?e:void 0),this.Ft(),this.getAndClearBuffer()}}onRemoteConfig(e){var n=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ny]:n}),this.Et=n,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}Mt(e){this.At(e.originalEvent,"deadclick")}Ot(){this.It&&clearInterval(this.It),this.It=(function(e){return(e==null?void 0:e.visibilityState)==="visible"})(Le)?setInterval(this.Dt.bind(this),this.flushIntervalMilliseconds):null}Ct(){se&&Le&&(this.jt=this.Dt.bind(this),Tn(se,"beforeunload",this.jt),this.Lt=e=>this.At(e||(se==null?void 0:se.event)),Tn(Le,"click",this.Lt,{capture:!0}),this.Nt=e=>this.Ut(e||(se==null?void 0:se.event)),Tn(Le,"mousemove",this.Nt,{capture:!0}),this.zt=new p2(this.instance,mI,this.Mt.bind(this)),this.zt.startIfEnabled(),this.Ht=this.Ot.bind(this),Tn(Le,"visibilitychange",this.Ht),this.P=!0)}Ft(){var e;se&&Le&&(this.jt&&se.removeEventListener("beforeunload",this.jt),this.Lt&&Le.removeEventListener("click",this.Lt,{capture:!0}),this.Nt&&Le.removeEventListener("mousemove",this.Nt,{capture:!0}),this.Ht&&Le.removeEventListener("visibilitychange",this.Ht),clearTimeout(this.Bt),(e=this.zt)==null||e.stop(),this.P=!1)}qt(e,n){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),l=(function(u,f,h){for(var g=u;g&&Gm(g)&&!Ia(g,"body");){if(g===h)return!1;if(St(f,se==null?void 0:se.getComputedStyle(g).position))return!0;g=a2(g)}return!1})(s2(e),["fixed","sticky"],a);return{x:e.clientX+(l?0:s),y:e.clientY+(l?0:r),target_fixed:l,type:n}}At(e,n){var r;if(n===void 0&&(n="click"),!ES(e.target)&&qS(e)){var s=this.qt(e,n);(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Wt(qe({},s,{type:"rageclick"})),this.Wt(s)}}Ut(e){!ES(e.target)&&qS(e)&&(clearTimeout(this.Bt),this.Bt=setTimeout((()=>{this.Wt(this.qt(e,"mousemove"))}),500))}Wt(e){if(se){var n=se.location.href,r=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,a=r?Sc([],jc,s||[]):[],l=Dd(n,a,Id);this.N=this.N||{},this.N[l]||(this.N[l]=[]),this.N[l].push(e)}}Dt(){this.N&&!ql(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class BI{constructor(e){this._instance=e}doPageView(e,n){var r,s=this.Gt(e,n);return this.Vt={pathname:(r=se==null?void 0:se.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var n;return this.Gt(e,(n=this.Vt)==null?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Vt)==null?void 0:e.pageViewId}}Gt(e,n){var r=this.Vt;if(!r)return{$pageview_id:n};var s={$pageview_id:n,$prev_pageview_id:r.pageViewId},a=this._instance.scrollManager.getContext();if(a&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:l,lastScrollY:u,maxScrollY:f,maxContentHeight:h,lastContentY:g,maxContentY:p}=a;if(!(Me(l)||Me(u)||Me(f)||Me(h)||Me(g)||Me(p))){l=Math.ceil(l),u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h),g=Math.ceil(g),p=Math.ceil(p);var x=l<=1?1:Zs(u/l,0,1,Be),y=l<=1?1:Zs(f/l,0,1,Be),k=h<=1?1:Zs(g/h,0,1,Be),w=h<=1?1:Zs(p/h,0,1,Be);s=xn(s,{$prev_pageview_last_scroll:u,$prev_pageview_last_scroll_percentage:x,$prev_pageview_max_scroll:f,$prev_pageview_max_scroll_percentage:y,$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:k,$prev_pageview_max_content:p,$prev_pageview_max_content_percentage:w})}}return r.pathname&&(s.$prev_pageview_pathname=r.pathname),r.timestamp&&(s.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),s}}var os=Uint8Array,Cr=Uint16Array,dc=Uint32Array,Xb=new os([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Jb=new os([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),HS=new os([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),B2=function(t,e){for(var n=new Cr(31),r=0;r<31;++r)n[r]=e+=1<<t[r-1];var s=new dc(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)s[a]=a-n[r]<<5|r;return[n,s]},U2=B2(Xb,2),UI=U2[0],$y=U2[1];UI[28]=258,$y[258]=28;for(var VS=B2(Jb,0)[1],q2=new Cr(32768),nn=0;nn<32768;++nn){var po=(43690&nn)>>>1|(21845&nn)<<1;po=(61680&(po=(52428&po)>>>2|(13107&po)<<2))>>>4|(3855&po)<<4,q2[nn]=((65280&po)>>>8|(255&po)<<8)>>>1}var od=function(t,e,n){for(var r=t.length,s=0,a=new Cr(e);s<r;++s)++a[t[s]-1];var l,u=new Cr(e);for(s=0;s<e;++s)u[s]=u[s-1]+a[s-1]<<1;for(l=new Cr(r),s=0;s<r;++s)l[s]=q2[u[t[s]-1]++]>>>15-t[s];return l},Eo=new os(288);for(nn=0;nn<144;++nn)Eo[nn]=8;for(nn=144;nn<256;++nn)Eo[nn]=9;for(nn=256;nn<280;++nn)Eo[nn]=7;for(nn=280;nn<288;++nn)Eo[nn]=8;var gm=new os(32);for(nn=0;nn<32;++nn)gm[nn]=5;var qI=od(Eo,9),HI=od(gm,5),H2=function(t){return(t/8>>0)+(7&t&&1)},V2=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof Cr?Cr:t instanceof dc?dc:os)(n-e);return r.set(t.subarray(e,n)),r},Ci=function(t,e,n){n<<=7&e;var r=e/8>>0;t[r]|=n,t[r+1]|=n>>>8},$u=function(t,e,n){n<<=7&e;var r=e/8>>0;t[r]|=n,t[r+1]|=n>>>8,t[r+2]|=n>>>16},ox=function(t,e){for(var n=[],r=0;r<t.length;++r)t[r]&&n.push({s:r,f:t[r]});var s=n.length,a=n.slice();if(!s)return[new os(0),0];if(s==1){var l=new os(n[0].s+1);return l[n[0].s]=1,[l,1]}n.sort((function(I,T){return I.f-T.f})),n.push({s:-1,f:25001});var u=n[0],f=n[1],h=0,g=1,p=2;for(n[0]={s:-1,f:u.f+f.f,l:u,r:f};g!=s-1;)u=n[n[h].f<n[p].f?h++:p++],f=n[h!=g&&n[h].f<n[p].f?h++:p++],n[g++]={s:-1,f:u.f+f.f,l:u,r:f};var x=a[0].s;for(r=1;r<s;++r)a[r].s>x&&(x=a[r].s);var y=new Cr(x+1),k=zy(n[g-1],y,0);if(k>e){r=0;var w=0,S=k-e,N=1<<S;for(a.sort((function(I,T){return y[T.s]-y[I.s]||I.f-T.f}));r<s;++r){var C=a[r].s;if(!(y[C]>e))break;w+=N-(1<<k-y[C]),y[C]=e}for(w>>>=S;w>0;){var j=a[r].s;y[j]<e?w-=1<<e-y[j]++-1:++r}for(;r>=0&&w;--r){var A=a[r].s;y[A]==e&&(--y[A],++w)}k=e}return[new os(y),k]},zy=function(t,e,n){return t.s==-1?Math.max(zy(t.l,e,n+1),zy(t.r,e,n+1)):e[t.s]=n},KS=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new Cr(++e),r=0,s=t[0],a=1,l=function(f){n[r++]=f},u=1;u<=e;++u)if(t[u]==s&&u!=e)++a;else{if(!s&&a>2){for(;a>138;a-=138)l(32754);a>2&&(l(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(l(s),--a;a>6;a-=6)l(8304);a>2&&(l(a-3<<5|8208),a=0)}for(;a--;)l(s);a=1,s=t[u]}return[n.subarray(0,r),e]},zu=function(t,e){for(var n=0,r=0;r<e.length;++r)n+=t[r]*e[r];return n},Fy=function(t,e,n){var r=n.length,s=H2(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var a=0;a<r;++a)t[s+a+4]=n[a];return 8*(s+4+r)},YS=function(t,e,n,r,s,a,l,u,f,h,g){Ci(e,g++,n),++s[256];for(var p=ox(s,15),x=p[0],y=p[1],k=ox(a,15),w=k[0],S=k[1],N=KS(x),C=N[0],j=N[1],A=KS(w),I=A[0],T=A[1],E=new Cr(19),R=0;R<C.length;++R)E[31&C[R]]++;for(R=0;R<I.length;++R)E[31&I[R]]++;for(var z=ox(E,7),D=z[0],B=z[1],q=19;q>4&&!D[HS[q-1]];--q);var K,G,F,M,V=h+5<<3,U=zu(s,Eo)+zu(a,gm)+l,H=zu(s,x)+zu(a,w)+l+14+3*q+zu(E,D)+(2*E[16]+3*E[17]+7*E[18]);if(V<=U&&V<=H)return Fy(e,g,t.subarray(f,f+h));if(Ci(e,g,1+(H<U)),g+=2,H<U){K=od(x,y),G=x,F=od(w,S),M=w;var L=od(D,B);for(Ci(e,g,j-257),Ci(e,g+5,T-1),Ci(e,g+10,q-4),g+=14,R=0;R<q;++R)Ci(e,g+3*R,D[HS[R]]);g+=3*q;for(var ne=[C,I],ie=0;ie<2;++ie){var P=ne[ie];for(R=0;R<P.length;++R){var pe=31&P[R];Ci(e,g,L[pe]),g+=D[pe],pe>15&&(Ci(e,g,P[R]>>>5&127),g+=P[R]>>>12)}}}else K=qI,G=Eo,F=HI,M=gm;for(R=0;R<u;++R)if(r[R]>255){pe=r[R]>>>18&31,$u(e,g,K[pe+257]),g+=G[pe+257],pe>7&&(Ci(e,g,r[R]>>>23&31),g+=Xb[pe]);var Pe=31&r[R];$u(e,g,F[Pe]),g+=M[Pe],Pe>3&&($u(e,g,r[R]>>>5&8191),g+=Jb[Pe])}else $u(e,g,K[r[R]]),g+=G[r[R]];return $u(e,g,K[256]),g+G[256]},VI=new dc([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),KI=(function(){for(var t=new dc(256),e=0;e<256;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),YI=function(t,e,n,r,s){return(function(a,l,u,f,h,g){var p=a.length,x=new os(f+p+5*(1+Math.floor(p/7e3))+h),y=x.subarray(f,x.length-h),k=0;if(!l||p<8)for(var w=0;w<=p;w+=65535){var S=w+65535;S<p?k=Fy(y,k,a.subarray(w,S)):(y[w]=g,k=Fy(y,k,a.subarray(w,p)))}else{for(var N=VI[l-1],C=N>>>13,j=8191&N,A=(1<<u)-1,I=new Cr(32768),T=new Cr(A+1),E=Math.ceil(u/3),R=2*E,z=function(De){return(a[De]^a[De+1]<<E^a[De+2]<<R)&A},D=new dc(25e3),B=new Cr(288),q=new Cr(32),K=0,G=0,F=(w=0,0),M=0,V=0;w<p;++w){var U=z(w),H=32767&w,L=T[U];if(I[H]=L,T[U]=H,M<=w){var ne=p-w;if((K>7e3||F>24576)&&ne>423){k=YS(a,y,0,D,B,q,G,F,V,w-V,k),F=K=G=0,V=w;for(var ie=0;ie<286;++ie)B[ie]=0;for(ie=0;ie<30;++ie)q[ie]=0}var P=2,pe=0,Pe=j,Ne=H-L&32767;if(ne>2&&U==z(w-Ne))for(var ge=Math.min(C,ne)-1,Fe=Math.min(32767,w),Qe=Math.min(258,ne);Ne<=Fe&&--Pe&&H!=L;){if(a[w+P]==a[w+P-Ne]){for(var $e=0;$e<Qe&&a[w+$e]==a[w+$e-Ne];++$e);if($e>P){if(P=$e,pe=Ne,$e>ge)break;var Q=Math.min(Ne,$e-2),_e=0;for(ie=0;ie<Q;++ie){var Oe=w-Ne+ie+32768&32767,le=Oe-I[Oe]+32768&32767;le>_e&&(_e=le,L=Oe)}}}Ne+=(H=L)-(L=I[H])+32768&32767}if(pe){D[F++]=268435456|$y[P]<<18|VS[pe];var he=31&$y[P],Ee=31&VS[pe];G+=Xb[he]+Jb[Ee],++B[257+he],++q[Ee],M=w+P,++K}else D[F++]=a[w],++B[a[w]]}}k=YS(a,y,g,D,B,q,G,F,V,w-V,k)}return V2(x,0,f+H2(k)+h)})(t,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,n,r,!0)},lx=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function GI(t,e){e===void 0&&(e={});var n=(function(){var u=4294967295;return{p:function(f){for(var h=u,g=0;g<f.length;++g)h=KI[255&h^f[g]]^h>>>8;u=h},d:function(){return 4294967295^u}}})(),r=t.length;n.p(t);var s,a=YI(t,e,10+((s=e).filename&&s.filename.length+1||0),8),l=a.length;return(function(u,f){var h=f.filename;if(u[0]=31,u[1]=139,u[2]=8,u[8]=f.level<2?4:f.level==9?2:0,u[9]=3,f.mtime!=0&&lx(u,4,Math.floor(new Date(f.mtime||Date.now())/1e3)),h){u[3]=8;for(var g=0;g<=h.length;++g)u[g+10]=h.charCodeAt(g)}})(a,e),lx(a,l-8,n.d()),lx(a,l-4,r),a}var ZI=function(t){var e,n,r,s,a="";for(e=n=0,r=(t=(t+"").replace(/\r\n/g,`
|
|
27
|
-
`).replace(/\r/g,`
|
|
28
|
-
`)).length,s=0;s<r;s++){var l=t.charCodeAt(s),u=null;l<128?n++:u=l>127&&l<2048?String.fromCharCode(l>>6|192,63&l|128):String.fromCharCode(l>>12|224,l>>6&63|128,63&l|128),Ki(u)||(n>e&&(a+=t.substring(e,n)),a+=u,e=n=s+1)}return n>e&&(a+=t.substring(e,t.length)),a},WI=!!wy||!!by,GS="text/plain",vm=function(t,e,n){var r;n===void 0&&(n=!0);var[s,a]=t.split("?"),l=qe({},e),u=(r=a==null?void 0:a.split("&").map((h=>{var g,[p,x]=h.split("="),y=n&&(g=l[p])!==null&&g!==void 0?g:x;return delete l[p],p+"="+y})))!==null&&r!==void 0?r:[],f=tI(l);return f&&u.push(f),s+"?"+u.join("&")},ed=(t,e)=>JSON.stringify(t,((n,r)=>typeof r=="bigint"?r.toString():r),e),cx=t=>{var{data:e,compression:n}=t;if(e){if(n===Mi.GZipJS){var r=GI((function(f,h){var g=f.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(f);for(var p=new os(f.length+(f.length>>>1)),x=0,y=function(N){p[x++]=N},k=0;k<g;++k){if(x+5>p.length){var w=new os(x+8+(g-k<<1));w.set(p),p=w}var S=f.charCodeAt(k);S<128||h?y(S):S<2048?(y(192|S>>>6),y(128|63&S)):S>55295&&S<57344?(y(240|(S=65536+(1047552&S)|1023&f.charCodeAt(++k))>>>18),y(128|S>>>12&63),y(128|S>>>6&63),y(128|63&S)):(y(224|S>>>12),y(128|S>>>6&63),y(128|63&S))}return V2(p,0,x)})(ed(e)),{mtime:0}),s=new Blob([r],{type:GS});return{contentType:GS,body:s,estimatedSize:s.size}}if(n===Mi.Base64){var a=(function(f){var h,g,p,x,y,k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",w=0,S=0,N="",C=[];if(!f)return f;f=ZI(f);do h=(y=f.charCodeAt(w++)<<16|f.charCodeAt(w++)<<8|f.charCodeAt(w++))>>18&63,g=y>>12&63,p=y>>6&63,x=63&y,C[S++]=k.charAt(h)+k.charAt(g)+k.charAt(p)+k.charAt(x);while(w<f.length);switch(N=C.join(""),f.length%3){case 1:N=N.slice(0,-2)+"==";break;case 2:N=N.slice(0,-1)+"="}return N})(ed(e)),l=(f=>"data="+encodeURIComponent(typeof f=="string"?f:ed(f)))(a);return{contentType:"application/x-www-form-urlencoded",body:l,estimatedSize:new Blob([l]).size}}var u=ed(e);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},Hh=[];by&&Hh.push({transport:"fetch",method:t=>{var e,n,{contentType:r,body:s,estimatedSize:a}=(e=cx(t))!==null&&e!==void 0?e:{},l=new Headers;Xt(t.headers,(function(g,p){l.append(p,g)})),r&&l.append("Content-Type",r);var u=t.url,f=null;if(pS){var h=new pS;f={signal:h.signal,timeout:setTimeout((()=>h.abort()),t.timeout)}}by(u,qe({method:(t==null?void 0:t.method)||"GET",headers:l,keepalive:t.method==="POST"&&(a||0)<52428.8,body:s,signal:(n=f)==null?void 0:n.signal},t.fetchOptions)).then((g=>g.text().then((p=>{var x={statusCode:g.status,text:p};if(g.status===200)try{x.json=JSON.parse(p)}catch(y){Be.error(y)}t.callback==null||t.callback(x)})))).catch((g=>{Be.error(g),t.callback==null||t.callback({statusCode:0,text:g})})).finally((()=>f?clearTimeout(f.timeout):null))}}),wy&&Hh.push({transport:"XHR",method:t=>{var e,n=new wy;n.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=(e=cx(t))!==null&&e!==void 0?e:{};Xt(t.headers,(function(a,l){n.setRequestHeader(l,a)})),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),t.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var a={statusCode:n.status,text:n.responseText};if(n.status===200)try{a.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(a)}},n.send(s)}}),qr!=null&&qr.sendBeacon&&Hh.push({transport:"sendBeacon",method:t=>{var e=vm(t.url,{beacon:"1"});try{var n,{contentType:r,body:s}=(n=cx(t))!==null&&n!==void 0?n:{},a=typeof s=="string"?new Blob([s],{type:r}):s;qr.sendBeacon(e,a)}catch{}}});var fc=function(t,e){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function ZS(t,e,n){return ed({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var K2={exact:(t,e)=>e.some((n=>t.some((r=>n===r)))),is_not:(t,e)=>e.every((n=>t.every((r=>n!==r)))),regex:(t,e)=>e.some((n=>t.some((r=>fc(n,r))))),not_regex:(t,e)=>e.every((n=>t.every((r=>!fc(n,r))))),icontains:(t,e)=>e.map(xh).some((n=>t.map(xh).some((r=>n.includes(r))))),not_icontains:(t,e)=>e.map(xh).every((n=>t.map(xh).every((r=>!n.includes(r)))))},xh=t=>t.toLowerCase(),ux=qn("[Error tracking]");let QI=class{constructor(e){var n,r;this.Jt=[],this.Kt=new OD([new RD,new BD,new DD,new MD,new zD,new $D,new LD,new FD],[ND,TD]),this._instance=e,this.Jt=(n=(r=this._instance.persistence)==null?void 0:r.get_property(Cy))!==null&&n!==void 0?n:[]}onRemoteConfig(e){var n,r,s,a=(n=(r=e.errorTracking)==null?void 0:r.suppressionRules)!==null&&n!==void 0?n:[],l=(s=e.errorTracking)==null?void 0:s.captureExtensionExceptions;this.Jt=a,this._instance.persistence&&this._instance.persistence.register({[Cy]:this.Jt,[jS]:l})}get Yt(){var e,n=!!this._instance.get_property(jS),r=this._instance.config.error_tracking.captureExtensionExceptions;return(e=r??n)!==null&&e!==void 0&&e}buildProperties(e,n){return this.Kt.buildFromUnknown(e,{syntheticException:n==null?void 0:n.syntheticException,mechanism:{handled:n==null?void 0:n.handled}})}sendExceptionEvent(e){var n=e.$exception_list;if(this.Xt(n)){if(this.Qt(n))return void ux.info("Skipping exception capture because a suppression rule matched");if(!this.Yt&&this.Zt(n))return void ux.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ti(n))return void ux.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}Qt(e){if(e.length===0)return!1;var n=e.reduce(((r,s)=>{var{type:a,value:l}=s;return Pn(a)&&a.length>0&&r.$exception_types.push(a),Pn(l)&&l.length>0&&r.$exception_values.push(l),r}),{$exception_types:[],$exception_values:[]});return this.Jt.some((r=>{var s=r.values.map((a=>{var l,u=K2[a.operator],f=tn(a.value)?a.value:[a.value],h=(l=n[a.key])!==null&&l!==void 0?l:[];return f.length>0&&u(f,h)}));return r.type==="OR"?s.some(Boolean):s.every(Boolean)}))}Zt(e){return e.flatMap((n=>{var r,s;return(r=(s=n.stacktrace)==null?void 0:s.frames)!==null&&r!==void 0?r:[]})).some((n=>n.filename&&n.filename.startsWith("chrome-extension://")))}ti(e){if(e.length>0){var n,r,s,a,l=(n=(r=e[0].stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[],u=l[l.length-1];return(s=u==null||(a=u.filename)==null?void 0:a.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}Xt(e){return!en(e)&&tn(e)}};var Ss=qn("[FeatureFlags]"),dx="$active_feature_flags",Al="$override_feature_flags",WS="$feature_flag_payloads",Fu="$override_feature_flag_payloads",QS="$feature_flag_request_id",XS=t=>{var e={};for(var[n,r]of qh(t||{}))r&&(e[n]=r);return e},XI=t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map((n=>{var r;return[n,(r=e[n].variant)!==null&&r!==void 0?r:e[n].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((n=>e[n].enabled)).filter((n=>{var r;return(r=e[n].metadata)==null?void 0:r.payload})).map((n=>{var r;return[n,(r=e[n].metadata)==null?void 0:r.payload]})))):Ss.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},JI=(function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t})({});class e5{constructor(e){this.ii=!1,this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this._instance=e,this.featureFlagEventHandlers=[]}li(){var e=this._instance.config.evaluation_environments;return e!=null&&e.length?e.filter((n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||Ss.error("Invalid evaluation environment found:",n,"Expected non-empty string"),r})):[]}ui(){return this.li().length>0}flags(){if(this._instance.config.__preview_remote_config)this.oi=!0;else{var e=!this.hi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.di({disableFlags:e})}}get hasLoadedFlags(){return this.ei}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(Ey),n=this._instance.get_property(Al),r=this._instance.get_property(Fu);if(!r&&!n)return e||{};var s=xn({},e||{}),a=[...new Set([...Object.keys(r||{}),...Object.keys(n||{})])];for(var l of a){var u,f,h=s[l],g=n==null?void 0:n[l],p=Me(g)?(u=h==null?void 0:h.enabled)!==null&&u!==void 0&&u:!!g,x=Me(g)?h.variant:typeof g=="string"?g:void 0,y=r==null?void 0:r[l],k=qe({},h,{enabled:p,variant:p?x??(h==null?void 0:h.variant):void 0});p!==(h==null?void 0:h.enabled)&&(k.original_enabled=h==null?void 0:h.enabled),x!==(h==null?void 0:h.variant)&&(k.original_variant=h==null?void 0:h.variant),y&&(k.metadata=qe({},h==null?void 0:h.metadata,{payload:y,original_payload:h==null||(f=h.metadata)==null?void 0:f.payload})),s[l]=k}return this.ii||(Ss.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:s}),this.ii=!0),s}getFlagVariants(){var e=this._instance.get_property(Hl),n=this._instance.get_property(Al);if(!n)return e||{};for(var r=xn({},e),s=Object.keys(n),a=0;a<s.length;a++)r[s[a]]=n[s[a]];return this.ii||(Ss.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:n,finalFlags:r}),this.ii=!0),r}getFlagPayloads(){var e=this._instance.get_property(WS),n=this._instance.get_property(Fu);if(!n)return e||{};for(var r=xn({},e||{}),s=Object.keys(n),a=0;a<s.length;a++)r[s[a]]=n[s[a]];return this.ii||(Ss.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:n,finalPayloads:r}),this.ii=!0),r}reloadFeatureFlags(){this.si||this._instance.config.advanced_disable_feature_flags||this.hi||(this.hi=setTimeout((()=>{this.di()}),5))}vi(){clearTimeout(this.hi),this.hi=void 0}ensureFlagsLoaded(){this.ei||this.ri||this.hi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.si=e}di(e){var n;if(this.vi(),!this._instance.M())if(this.ri)this.ni=!0;else{var r={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:qe({},((n=this._instance.persistence)==null?void 0:n.get_initial_props())||{},this._instance.get_property(Xu)||{}),group_properties:this._instance.get_property(bo)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.ui()&&(r.evaluation_environments=this.li());var s=this._instance.config.__preview_remote_config,a=s?"/flags/?v=2":"/flags/?v=2&config=true",l=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",u=this._instance.requestRouter.endpointFor("api",a+l);s&&(r.timezone=F2()),this.ri=!0,this._instance.ci({method:"POST",url:u,data:r,compression:this._instance.config.disable_compression?void 0:Mi.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:f=>{var h,g,p=!0;if(f.statusCode===200&&(this.ni||(this.$anon_distinct_id=void 0),p=!1),this.ri=!1,this.oi||(this.oi=!0,this._instance.fi((g=f.json)!==null&&g!==void 0?g:{})),!r.disable_flags||this.ni)if(this.ai=!p,f.json&&(h=f.json.quotaLimited)!=null&&h.includes(JI.FeatureFlags))Ss.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var x;r.disable_flags||this.receivedFeatureFlags((x=f.json)!==null&&x!==void 0?x:{},p),this.ni&&(this.ni=!1,this.di())}}})}}getFeatureFlag(e,n){if(n===void 0&&(n={}),this.ei||this.getFlags()&&this.getFlags().length>0){var r=this.getFlagVariants()[e],s=""+r,a=this._instance.get_property(QS)||void 0,l=this._instance.get_property(om)||{};if((n.send_event||!("send_event"in n))&&(!(e in l)||!l[e].includes(s))){var u,f,h,g,p,x,y,k,w;tn(l[e])?l[e].push(s):l[e]=[s],(u=this._instance.persistence)==null||u.register({[om]:l});var S=this.getFeatureFlagDetails(e),N={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:a,$feature_flag_bootstrapped_response:((f=this._instance.config.bootstrap)==null||(f=f.featureFlags)==null?void 0:f[e])||null,$feature_flag_bootstrapped_payload:((h=this._instance.config.bootstrap)==null||(h=h.featureFlagPayloads)==null?void 0:h[e])||null,$used_bootstrap_value:!this.ai};Me(S==null||(g=S.metadata)==null?void 0:g.version)||(N.$feature_flag_version=S.metadata.version);var C,j=(p=S==null||(x=S.reason)==null?void 0:x.description)!==null&&p!==void 0?p:S==null||(y=S.reason)==null?void 0:y.code;j&&(N.$feature_flag_reason=j),S!=null&&(k=S.metadata)!=null&&k.id&&(N.$feature_flag_id=S.metadata.id),Me(S==null?void 0:S.original_variant)&&Me(S==null?void 0:S.original_enabled)||(N.$feature_flag_original_response=Me(S.original_variant)?S.original_enabled:S.original_variant),S!=null&&(w=S.metadata)!=null&&w.original_payload&&(N.$feature_flag_original_payload=S==null||(C=S.metadata)==null?void 0:C.original_payload),this._instance.capture("$feature_flag_called",N)}return r}Ss.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,n){var r=this._instance.config.token,s={distinct_id:this._instance.get_distinct_id(),token:r};this.ui()&&(s.evaluation_environments=this.li()),this._instance.ci({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:s,compression:this._instance.config.disable_compression?void 0:Mi.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:a=>{var l,u=(l=a.json)==null?void 0:l.featureFlagPayloads;n((u==null?void 0:u[e])||void 0)}})}isFeatureEnabled(e,n){if(n===void 0&&(n={}),this.ei||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(e,n);return Me(r)?void 0:!!r}Ss.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((n=>n!==e))}receivedFeatureFlags(e,n){if(this._instance.persistence){this.ei=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),a=this.getFlagsWithDetails();(function(l,u,f,h,g){f===void 0&&(f={}),h===void 0&&(h={}),g===void 0&&(g={});var p=XI(l),x=p.flags,y=p.featureFlags,k=p.featureFlagPayloads;if(y){var w=l.requestId;if(tn(y)){Ss.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var S={};if(y)for(var N=0;N<y.length;N++)S[y[N]]=!0;u&&u.register({[dx]:y,[Hl]:S})}else{var C=y,j=k,A=x;l.errorsWhileComputingFlags&&(C=qe({},f,C),j=qe({},h,j),A=qe({},g,A)),u&&u.register(qe({[dx]:Object.keys(XS(C)),[Hl]:C||{},[WS]:j||{},[Ey]:A||{}},w?{[QS]:w}:{}))}}})(e,this._instance.persistence,r,s,a),this.pi(n)}}override(e,n){n===void 0&&(n=!1),Ss.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:n})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Ss.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Al),this._instance.persistence.unregister(Fu),void this.pi();if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,r=e;if(this.ii=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this._instance.persistence.unregister(Al);else if(r.flags)if(tn(r.flags)){for(var s={},a=0;a<r.flags.length;a++)s[r.flags[a]]=!0;this._instance.persistence.register({[Al]:s})}else this._instance.persistence.register({[Al]:r.flags})}return"payloads"in r&&(r.payloads===!1?this._instance.persistence.unregister(Fu):r.payloads&&this._instance.persistence.register({[Fu]:r.payloads})),void this.pi()}this.pi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ei){var{flags:n,flagVariants:r}=this.gi();e(n,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,n,r){var s,a=(this._instance.get_property(Qu)||[]).find((h=>h.flagKey===e)),l={["$feature_enrollment/"+e]:n},u={$feature_flag:e,$feature_enrollment:n,$set:l};a&&(u.$early_access_feature_name=a.name),r&&(u.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",u),this.setPersonPropertiesForFlags(l,!1);var f=qe({},this.getFlagVariants(),{[e]:n});(s=this._instance.persistence)==null||s.register({[dx]:Object.keys(XS(f)),[Hl]:f}),this.pi()}getEarlyAccessFeatures(e,n,r){n===void 0&&(n=!1);var s=this._instance.get_property(Qu),a=r?"&"+r.map((l=>"stage="+l)).join("&"):"";if(s&&!n)return e(s);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+a),method:"GET",callback:l=>{var u,f;if(l.json){var h=l.json.earlyAccessFeatures;return(u=this._instance.persistence)==null||u.unregister(Qu),(f=this._instance.persistence)==null||f.register({[Qu]:h}),e(h)}}})}gi(){var e=this.getFlags(),n=this.getFlagVariants();return{flags:e.filter((r=>n[r])),flagVariants:Object.keys(n).filter((r=>n[r])).reduce(((r,s)=>(r[s]=n[s],r)),{})}}pi(e){var{flags:n,flagVariants:r}=this.gi();this.featureFlagEventHandlers.forEach((s=>s(n,r,{errorsLoading:e})))}setPersonPropertiesForFlags(e,n){n===void 0&&(n=!0);var r=this._instance.get_property(Xu)||{};this._instance.register({[Xu]:qe({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Xu)}setGroupPropertiesForFlags(e,n){n===void 0&&(n=!0);var r=this._instance.get_property(bo)||{};Object.keys(r).length!==0&&Object.keys(r).forEach((s=>{r[s]=qe({},r[s],e[s]),delete e[s]})),this._instance.register({[bo]:qe({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var n=this._instance.get_property(bo)||{};this._instance.register({[bo]:qe({},n,{[e]:{}})})}else this._instance.unregister(bo)}reset(){this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.$anon_distinct_id=void 0,this.vi(),this.ii=!1}}var t5=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class fx{constructor(e,n){this.C=e,this.props={},this.mi=!1,this.yi=(r=>{var s="";return r.token&&(s=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+s+"_posthog"})(e),this.Y=this.bi(e),this.load(),e.debug&&Be.info("Persistence loaded",e.persistence,qe({},this.props)),this.update_config(e,e,n),this.save()}isDisabled(){return!!this.wi}bi(e){t5.indexOf(e.persistence.toLowerCase())===-1&&(Be.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n=e.persistence.toLowerCase();return n==="localstorage"&&an.H()?an:n==="localstorage+cookie"&&mh.H()?mh:n==="sessionstorage"&&Gn.H()?Gn:n==="memory"?fI:n==="cookie"?Js:mh.H()?mh:Js}properties(){var e={};return Xt(this.props,(function(n,r){if(r===Hl&&er(n))for(var s=Object.keys(n),a=0;a<s.length;a++)e["$feature/"+s[a]]=n[s[a]];else u=r,f=!1,(Ki(l=YD)?f:mS&&l.indexOf===mS?l.indexOf(u)!=-1:(Xt(l,(function(h){if(f||(f=h===u))return im})),f))||(e[r]=n);var l,u,f})),e}load(){if(!this.wi){var e=this.Y.W(this.yi);e&&(this.props=xn({},e))}}save(){this.wi||this.Y.G(this.yi,this.props,this.xi,this.Si,this.Ei,this.C.debug)}remove(){this.Y.V(this.yi,!1),this.Y.V(this.yi,!0)}clear(){this.remove(),this.props={}}register_once(e,n,r){if(er(e)){Me(n)&&(n="None"),this.xi=Me(r)?this.$i:r;var s=!1;if(Xt(e,((a,l)=>{this.props.hasOwnProperty(l)&&this.props[l]!==n||(this.props[l]=a,s=!0)})),s)return this.save(),!0}return!1}register(e,n){if(er(e)){this.xi=Me(n)?this.$i:n;var r=!1;if(Xt(e,((s,a)=>{e.hasOwnProperty(a)&&this.props[a]!==s&&(this.props[a]=s,r=!0)})),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.mi){var e=D2(this.C.custom_campaign_params,this.C.mask_personal_data_properties,this.C.custom_personal_data_properties);ql(Hb(e))||this.register(e),this.mi=!0}}update_search_keyword(){var e;this.register((e=Le==null?void 0:Le.referrer)?L2(e):{})}update_referrer_info(){var e;this.register_once({$referrer:P2(),$referring_domain:Le!=null&&Le.referrer&&((e=dm(Le.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Ry]||this.props[My]||this.register_once({[lm]:$2(this.C.mask_personal_data_properties,this.C.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Xt([My,Ry],(l=>{var u=this.props[l];u&&Xt(u,(function(f,h){e["$initial_"+_y(h)]=f}))}));var n,r,s=this.props[lm];if(s){var a=(n=z2(s),r={},Xt(n,(function(l,u){r["$initial_"+_y(u)]=l})),r);xn(e,a)}return e}safe_merge(e){return Xt(this.props,(function(n,r){r in e||(e[r]=n)})),e}update_config(e,n,r){if(this.$i=this.xi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==n.persistence){var s=this.bi(e),a=this.props;this.clear(),this.Y=s,this.props=a,this.save()}}set_disabled(e){this.wi=e,this.wi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Si&&(this.Si=e,this.remove(),this.save())}set_secure(e){e!==this.Ei&&(this.Ei=e,this.remove(),this.save())}set_event_timer(e,n){var r=this.props[Wu]||{};r[e]=n,this.props[Wu]=r,this.save()}remove_event_timer(e){var n=(this.props[Wu]||{})[e];return Me(n)||(delete this.props[Wu][e],this.save()),n}get_property(e){return this.props[e]}set_property(e,n){this.props[e]=n,this.save()}}(function(t){return t.Button="button",t.Tab="tab",t.Selector="selector",t})({});(function(t){return t.TopLeft="top_left",t.TopRight="top_right",t.TopCenter="top_center",t.MiddleLeft="middle_left",t.MiddleRight="middle_right",t.MiddleCenter="middle_center",t.Left="left",t.Center="center",t.Right="right",t.NextToTrigger="next_to_trigger",t})({});var hx=(function(t){return t.Popover="popover",t.API="api",t.Widget="widget",t.ExternalSurvey="external_survey",t})({});(function(t){return t.Open="open",t.MultipleChoice="multiple_choice",t.SingleChoice="single_choice",t.Rating="rating",t.Link="link",t})({});(function(t){return t.NextQuestion="next_question",t.End="end",t.ResponseBased="response_based",t.SpecificQuestion="specific_question",t})({});(function(t){return t.Once="once",t.Recurring="recurring",t.Always="always",t})({});var Vh=(function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t})({}),JS=(function(t){return t.SURVEY_ID="$survey_id",t.SURVEY_NAME="$survey_name",t.SURVEY_RESPONSE="$survey_response",t.SURVEY_ITERATION="$survey_iteration",t.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",t.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",t.SURVEY_SUBMISSION_ID="$survey_submission_id",t.SURVEY_QUESTIONS="$survey_questions",t.SURVEY_COMPLETED="$survey_completed",t})({}),Y2=(function(t){return t.Popover="popover",t.Inline="inline",t})({});class e0{constructor(){this.ki={},this.ki={}}on(e,n){return this.ki[e]||(this.ki[e]=[]),this.ki[e].push(n),()=>{this.ki[e]=this.ki[e].filter((r=>r!==n))}}emit(e,n){for(var r of this.ki[e]||[])r(n);for(var s of this.ki["*"]||[])s(e,n)}}class _o{constructor(e){this.Pi=new e0,this.Ti=(n,r)=>this.Ri(n,r)&&this.Ii(n,r)&&this.Ci(n,r),this.Ri=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=e,this.Oi=new Set,this.Fi=new Set}init(){var e;if(!Me((e=this._instance)==null?void 0:e.Mi)){var n;(n=this._instance)==null||n.Mi(((r,s)=>{this.on(r,s)}))}}register(e){var n,r;if(!Me((n=this._instance)==null?void 0:n.Mi)&&(e.forEach((l=>{var u,f;(u=this.Fi)==null||u.add(l),(f=l.steps)==null||f.forEach((h=>{var g;(g=this.Oi)==null||g.add((h==null?void 0:h.event)||"")}))})),(r=this._instance)!=null&&r.autocapture)){var s,a=new Set;e.forEach((l=>{var u;(u=l.steps)==null||u.forEach((f=>{f!=null&&f.selector&&a.add(f==null?void 0:f.selector)}))})),(s=this._instance)==null||s.autocapture.setElementSelectors(a)}}on(e,n){var r;n!=null&&e.length!=0&&(this.Oi.has(e)||this.Oi.has(n==null?void 0:n.event))&&this.Fi&&((r=this.Fi)==null?void 0:r.size)>0&&this.Fi.forEach((s=>{this.Ai(n,s)&&this.Pi.emit("actionCaptured",s.name)}))}Di(e){this.onAction("actionCaptured",(n=>e(n)))}Ai(e,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Ti(e,r))return!0;return!1}onAction(e,n){return this.Pi.on(e,n)}Ii(e,n){if(n!=null&&n.url){var r,s=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!s||typeof s!="string"||!_o.ji(s,n==null?void 0:n.url,(n==null?void 0:n.url_matching)||"contains"))return!1}return!0}static ji(e,n,r){switch(r){case"regex":return!!se&&fc(e,n);case"exact":return n===e;case"contains":var s=_o.Li(n).replace(/_/g,".").replace(/%/g,".*");return fc(e,s);default:return!1}}static Li(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Ci(e,n){if((n!=null&&n.href||n!=null&&n.tag_name||n!=null&&n.text)&&!this.Ni(e).some((a=>!(n!=null&&n.href&&!_o.ji(a.href||"",n==null?void 0:n.href,(n==null?void 0:n.href_matching)||"exact"))&&(n==null||!n.tag_name||a.tag_name===(n==null?void 0:n.tag_name))&&!(n!=null&&n.text&&!_o.ji(a.text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact")&&!_o.ji(a.$el_text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact")))))return!1;if(n!=null&&n.selector){var r,s=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(!s||!s.includes(n==null?void 0:n.selector))return!1}return!0}Ni(e){return(e==null?void 0:e.properties.$elements)==null?[]:e==null?void 0:e.properties.$elements}}var Vt=qn("[Surveys]"),By="seenSurvey_",n5=(t,e)=>{var n="$survey_"+e+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(n="$survey_"+e+"/"+t.id+"/"+t.current_iteration),n},ej=t=>{var e=""+By+t.id;return t.current_iteration&&t.current_iteration>0&&(e=""+By+t.id+"_"+t.current_iteration),e},r5=[hx.Popover,hx.Widget,hx.API],s5={ignoreConditions:!1,ignoreDelay:!1,displayType:Y2.Popover};class i5{constructor(e){this._instance=e,this.Ui=new Map,this.zi=new Map}register(e){var n;Me((n=this._instance)==null?void 0:n.Mi)||(this.Hi(e),this.Bi(e))}Bi(e){var n=e.filter((r=>{var s,a;return((s=r.conditions)==null?void 0:s.actions)&&((a=r.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0}));n.length!==0&&(this.qi==null&&(this.qi=new _o(this._instance),this.qi.init(),this.qi.Di((r=>{this.onAction(r)}))),n.forEach((r=>{var s,a,l,u,f;r.conditions&&(s=r.conditions)!=null&&s.actions&&(a=r.conditions)!=null&&(a=a.actions)!=null&&a.values&&((l=r.conditions)==null||(l=l.actions)==null||(l=l.values)==null?void 0:l.length)>0&&((u=this.qi)==null||u.register(r.conditions.actions.values),(f=r.conditions)==null||(f=f.actions)==null||(f=f.values)==null||f.forEach((h=>{if(h&&h.name){var g=this.zi.get(h.name);g&&g.push(r.id),this.zi.set(h.name,g||[r.id])}})))})))}Hi(e){var n;e.filter((r=>{var s,a;return((s=r.conditions)==null?void 0:s.events)&&((a=r.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})).length!==0&&((n=this._instance)==null||n.Mi(((r,s)=>{this.onEvent(r,s)})),e.forEach((r=>{var s;(s=r.conditions)==null||(s=s.events)==null||(s=s.values)==null||s.forEach((a=>{if(a&&a.name){var l=this.Ui.get(a.name);l&&l.push(r.id),this.Ui.set(a.name,l||[r.id])}}))})))}onEvent(e,n){var r,s,a=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[hh])||[];if(Vh.SHOWN===e&&n&&a.length>0){var l;Vt.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:n,existingActivatedSurveys:a});var u=n==null||(l=n.properties)==null?void 0:l.$survey_id;if(u){var f=a.indexOf(u);f>=0&&(a.splice(f,1),this.Wi(a))}}else if(this.Ui.has(e)){Vt.info("survey event name matched",{event:e,eventPayload:n,surveys:this.Ui.get(e)});var h=[];(s=this._instance)==null||s.getSurveys((p=>{h=p.filter((x=>{var y;return(y=this.Ui.get(e))==null?void 0:y.includes(x.id)}))}));var g=h.filter((p=>{var x,y=(x=p.conditions)==null||(x=x.events)==null||(x=x.values)==null?void 0:x.find((k=>k.name===e));return!!y&&(!y.propertyFilters||Object.entries(y.propertyFilters).every((k=>{var w,[S,N]=k,C=n==null||(w=n.properties)==null?void 0:w[S];if(Me(C)||Ki(C))return!1;var j=[String(C)],A=K2[N.operator];return A?A(N.values,j):(Vt.warn("Unknown property comparison operator: "+N.operator),!1)})))}));this.Wi(a.concat(g.map((p=>p.id))||[]))}}onAction(e){var n,r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[hh])||[];this.zi.has(e)&&this.Wi(r.concat(this.zi.get(e)||[]))}Wi(e){var n;Vt.info("updating activated surveys",{activatedSurveys:e}),(n=this._instance)==null||(n=n.persistence)==null||n.register({[hh]:[...new Set(e)]})}getSurveys(){var e,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[hh];return n||[]}getEventToSurveys(){return this.Ui}Gi(){return this.qi}}class a5{constructor(e){this.Vi=void 0,this._surveyManager=null,this.Ji=!1,this.Ki=!1,this.Yi=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var n=e.surveys;if(en(n))return Vt.warn("Flags not loaded yet. Not loading surveys.");var r=tn(n);this.Vi=r?n.length>0:n,Vt.info("flags response received, isSurveysEnabled: "+this.Vi),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);(r!=null&&r.startsWith(By)||r!=null&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((s=>localStorage.removeItem(s)))}loadIfEnabled(){if(!this._surveyManager)if(this.Ki)Vt.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Vt.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Vt.info("Not loading surveys in cookieless mode without consent.");else{var e=ct==null?void 0:ct.__PosthogExtensions__;if(e){if(!Me(this.Vi)||this._instance.config.advanced_enable_surveys){var n=this.Vi||this._instance.config.advanced_enable_surveys;this.Ki=!0;try{var r=e.generateSurveys;if(r)return void this.Xi(r,n);var s=e.loadExternalDependency;if(!s)return void this.Qi("PostHog loadExternalDependency extension not found.");s(this._instance,"surveys",(a=>{a||!e.generateSurveys?this.Qi("Could not load surveys script",a):this.Xi(e.generateSurveys,n)}))}catch(a){throw this.Qi("Error initializing surveys",a),a}finally{this.Ki=!1}}}else Vt.error("PostHog Extensions not found.")}}Xi(e,n){this._surveyManager=e(this._instance,n),this._surveyEventReceiver=new i5(this._instance),Vt.info("Surveys loaded successfully"),this.Zi({isLoaded:!0})}Qi(e,n){Vt.error(e,n),this.Zi({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Yi.push(e),this._surveyManager&&this.Zi({isLoaded:!0}),()=>{this.Yi=this.Yi.filter((n=>n!==e))}}getSurveys(e,n){if(n===void 0&&(n=!1),this._instance.config.disable_surveys)return Vt.info("Disabled. Not loading surveys."),e([]);var r=this._instance.get_property(Ty);if(r&&!n)return e(r,{isLoaded:!0});if(this.Ji)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.Ji=!0,this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:s=>{var a;this.Ji=!1;var l=s.statusCode;if(l!==200||!s.json){var u="Surveys API could not be loaded, status: "+l;return Vt.error(u),e([],{isLoaded:!1,error:u})}var f,h=s.json.surveys||[],g=h.filter((p=>(function(x){return!(!x.start_date||x.end_date)})(p)&&((function(x){var y;return!((y=x.conditions)==null||(y=y.events)==null||(y=y.values)==null||!y.length)})(p)||(function(x){var y;return!((y=x.conditions)==null||(y=y.actions)==null||(y=y.values)==null||!y.length)})(p))));return g.length>0&&((f=this._surveyEventReceiver)==null||f.register(g)),(a=this._instance.persistence)==null||a.register({[Ty]:h}),e(h,{isLoaded:!0})}})}catch(s){throw this.Ji=!1,s}}Zi(e){for(var n of this.Yi)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(r){Vt.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,n){if(n===void 0&&(n=!1),!en(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);Vt.warn("init was not called")}te(e){var n=null;return this.getSurveys((r=>{var s;n=(s=r.find((a=>a.id===e)))!==null&&s!==void 0?s:null})),n}ie(e){if(en(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var n=typeof e=="string"?this.te(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(en(this._surveyManager))return Vt.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var n=this.ie(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return en(this._surveyManager)?(Vt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((r=>{this.getSurveys((s=>{var a,l=(a=s.find((f=>f.id===e)))!==null&&a!==void 0?a:null;if(l){var u=this.ie(l);r({visible:u.eligible,disabledReason:u.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),n)}))}renderSurvey(e,n){var r;if(en(this._surveyManager))Vt.warn("init was not called");else{var s=typeof e=="string"?this.te(e):e;if(s!=null&&s.id)if(r5.includes(s.type)){var a=Le==null?void 0:Le.querySelector(n);if(a)return(r=s.appearance)!=null&&r.surveyPopupDelaySeconds?(Vt.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var l,u;Vt.info("Rendering survey "+s.id+" with delay of "+((l=s.appearance)==null?void 0:l.surveyPopupDelaySeconds)+" seconds"),(u=this._surveyManager)==null||u.renderSurvey(s,a),Vt.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,a);Vt.warn("Survey element not found")}else Vt.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Vt.warn("Survey not found")}}displaySurvey(e,n){var r;if(en(this._surveyManager))Vt.warn("init was not called");else{var s=this.te(e);if(s){var a=s;if((r=s.appearance)!=null&&r.surveyPopupDelaySeconds&&n.ignoreDelay&&(a=qe({},s,{appearance:qe({},s.appearance,{surveyPopupDelaySeconds:0})})),n.ignoreConditions===!1){var l=this.canRenderSurvey(s);if(!l.visible)return void Vt.warn("Survey is not eligible to be displayed: ",l.disabledReason)}n.displayType!==Y2.Inline?this._surveyManager.handlePopoverSurvey(a):this.renderSurvey(a,n.selector)}else Vt.warn("Survey not found")}}}var tj=qn("[RateLimiter]");class o5{constructor(e){var n,r;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=s=>{var a=s.text;if(a&&a.length)try{(JSON.parse(a).quota_limited||[]).forEach((l=>{tj.info((l||"events")+" is quota limited."),this.serverLimits[l]=new Date().getTime()+6e4}))}catch(l){return void tj.warn('could not rate limit - continuing. Error: "'+(l==null?void 0:l.message)+'"',{text:a})}},this.instance=e,this.captureEventsPerSecond=((n=e.config.rate_limiting)==null?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((r=e.config.rate_limiting)==null?void 0:r.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var n,r,s;e===void 0&&(e=!1);var a=new Date().getTime(),l=(n=(r=this.instance.persistence)==null?void 0:r.get_property(Oy))!==null&&n!==void 0?n:{tokens:this.captureEventsBurstLimit,last:a};l.tokens+=(a-l.last)/1e3*this.captureEventsPerSecond,l.last=a,l.tokens>this.captureEventsBurstLimit&&(l.tokens=this.captureEventsBurstLimit);var u=l.tokens<1;return u||e||(l.tokens=Math.max(0,l.tokens-1)),!u||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=u,(s=this.instance.persistence)==null||s.set_property(Oy,l),{isRateLimited:u,remainingTokens:l.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var go=qn("[RemoteConfig]");class l5{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=ct._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}ee(e){var n,r;(n=ct.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=ct.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(go.error("PostHog Extensions not found. Cannot load remote config."),e())}re(e){this._instance.ci({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:n=>{e(n.json)}})}load(){try{if(this.remoteConfig)return go.info("Using preloaded remote config",this.remoteConfig),void this.fi(this.remoteConfig);if(this._instance.M())return void go.warn("Remote config is disabled. Falling back to local config.");this.ee((e=>{if(!e)return go.info("No config found after loading remote JS config. Falling back to JSON."),void this.re((n=>{this.fi(n)}));this.fi(e)}))}catch(e){go.error("Error loading remote config",e)}}fi(e){e?this._instance.config.__preview_remote_config?(this._instance.fi(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):go.info("__preview_remote_config is disabled. Logging config instead",e):go.error("Failed to fetch remote config from PostHog.")}}var Uy=3e3;class c5{constructor(e,n){this.se=!0,this.ne=[],this.oe=Zs((n==null?void 0:n.flush_interval_ms)||Uy,250,5e3,Be.createLogger("flush interval"),Uy),this.ae=e}enqueue(e){this.ne.push(e),this.le||this.ue()}unload(){this.he();var e=this.ne.length>0?this.de():{},n=Object.values(e);[...n.filter((r=>r.url.indexOf("/e")===0)),...n.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.ae(qe({},r,{transport:"sendBeacon"}))}))}enable(){this.se=!1,this.ue()}ue(){var e=this;this.se||(this.le=setTimeout((()=>{if(this.he(),this.ne.length>0){var n=this.de(),r=function(){var a=n[s],l=new Date().getTime();a.data&&tn(a.data)&&Xt(a.data,(u=>{u.offset=Math.abs(u.timestamp-l),delete u.timestamp})),e.ae(a)};for(var s in n)r()}}),this.oe))}he(){clearTimeout(this.le),this.le=void 0}de(){var e={};return Xt(this.ne,(n=>{var r,s=n,a=(s?s.batchKey:null)||s.url;Me(e[a])&&(e[a]=qe({},s,{data:[]})),(r=e[a].data)==null||r.push(s.data)})),this.ne=[],e}}var u5=["retriesPerformedSoFar"];class d5{constructor(e){this.ve=!1,this.ce=3e3,this.ne=[],this._instance=e,this.ne=[],this.fe=!0,!Me(se)&&"onLine"in se.navigator&&(this.fe=se.navigator.onLine,this.pe=()=>{this.fe=!0,this.Dt()},this.ge=()=>{this.fe=!1},Tn(se,"online",this.pe),Tn(se,"offline",this.ge))}get length(){return this.ne.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=qC(e,u5);ni(n)&&n>0&&(r.url=vm(r.url,{retry_count:n})),this._instance.ci(qe({},r,{callback:s=>{s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(n??0)<10?this._e(qe({retriesPerformedSoFar:n},r)):r.callback==null||r.callback(s)}}))}_e(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var r=(function(l){var u=3e3*Math.pow(2,l),f=u/2,h=Math.min(18e5,u),g=(Math.random()-.5)*(h-f);return Math.ceil(h+g)})(n),s=Date.now()+r;this.ne.push({retryAt:s,requestOptions:e});var a="Enqueued failed request for retry in "+r;navigator.onLine||(a+=" (Browser is offline)"),Be.warn(a),this.ve||(this.ve=!0,this.me())}me(){if(this.ye&&clearTimeout(this.ye),this.ne.length===0)return this.ve=!1,void(this.ye=void 0);this.ye=setTimeout((()=>{this.fe&&this.ne.length>0&&this.Dt(),this.me()}),this.ce)}Dt(){var e=Date.now(),n=[],r=this.ne.filter((a=>a.retryAt<e||(n.push(a),!1)));if(this.ne=n,r.length>0)for(var{requestOptions:s}of r)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.ye&&(clearTimeout(this.ye),this.ye=void 0),this.ve=!1,Me(se)||(this.pe&&(se.removeEventListener("online",this.pe),this.pe=void 0),this.ge&&(se.removeEventListener("offline",this.ge),this.ge=void 0)),this.ne))try{this._instance.ci(qe({},e,{transport:"sendBeacon"}))}catch(n){Be.error(n)}this.ne=[]}}class f5{constructor(e){this.be=()=>{var n,r,s,a;this.we||(this.we={});var l=this.scrollElement(),u=this.scrollY(),f=l?Math.max(0,l.scrollHeight-l.clientHeight):0,h=u+((l==null?void 0:l.clientHeight)||0),g=(l==null?void 0:l.scrollHeight)||0;this.we.lastScrollY=Math.ceil(u),this.we.maxScrollY=Math.max(u,(n=this.we.maxScrollY)!==null&&n!==void 0?n:0),this.we.maxScrollHeight=Math.max(f,(r=this.we.maxScrollHeight)!==null&&r!==void 0?r:0),this.we.lastContentY=h,this.we.maxContentY=Math.max(h,(s=this.we.maxContentY)!==null&&s!==void 0?s:0),this.we.maxContentHeight=Math.max(g,(a=this.we.maxContentHeight)!==null&&a!==void 0?a:0)},this._instance=e}getContext(){return this.we}resetContext(){var e=this.we;return setTimeout(this.be,0),e}startMeasuringScrollPosition(){Tn(se,"scroll",this.be,{capture:!0}),Tn(se,"scrollend",this.be,{capture:!0}),Tn(se,"resize",this.be)}scrollElement(){if(!this._instance.config.scroll_root_selector)return se==null?void 0:se.document.documentElement;var e=tn(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var n of e){var r=se==null?void 0:se.document.querySelector(n);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return se&&(se.scrollY||se.pageYOffset||se.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return se&&(se.scrollX||se.pageXOffset||se.document.documentElement.scrollLeft)||0}}var h5=t=>$2(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties);class nj{constructor(e,n,r,s){this.xe=a=>{var l=this.Se();if(!l||l.sessionId!==a){var u={sessionId:a,props:this.Ee(this._instance)};this.$e.register({[Ay]:u})}},this._instance=e,this.ke=n,this.$e=r,this.Ee=s||h5,this.ke.onSessionId(this.xe)}Se(){return this.$e.props[Ay]}getSetOnceProps(){var e,n=(e=this.Se())==null?void 0:e.props;return n?"r"in n?z2(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var e={};return Xt(Hb(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+_y(r)]=n})),e}}var mx=qn("[SessionId]");class rj{on(e,n){return this.Pe.on(e,n)}constructor(e,n,r){var s;if(this.Te=[],this.Re=void 0,this.Pe=new e0,this.Ie=(g,p)=>Math.abs(g-p)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.C=e.config,this.$e=e.persistence,this.Ce=void 0,this.Oe=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Fe=n||Oa,this.Me=r||Oa;var a=this.C.persistence_name||this.C.token,l=this.C.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Zs(l,60,36e3,mx.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ae(),this.De="ph_"+a+"_window_id",this.je="ph_"+a+"_primary_window_exists",this.Le()){var u=Gn.W(this.De),f=Gn.W(this.je);u&&!f?this.Ce=u:Gn.V(this.De),Gn.G(this.je,!0)}if((s=this.C.bootstrap)!=null&&s.sessionID)try{var h=(g=>{var p=g.replace(/-/g,"");if(p.length!==32)throw new Error("Not a valid UUID");if(p[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(p.substring(0,12),16)})(this.C.bootstrap.sessionID);this.Ne(this.C.bootstrap.sessionID,new Date().getTime(),h)}catch(g){mx.error("Invalid sessionID in bootstrap",g)}this.Ue()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Me(this.Te)&&(this.Te=[]),this.Te.push(e),this.Oe&&e(this.Oe,this.Ce),()=>{this.Te=this.Te.filter((n=>n!==e))}}Le(){return this.C.persistence!=="memory"&&!this.$e.wi&&Gn.H()}ze(e){e!==this.Ce&&(this.Ce=e,this.Le()&&Gn.G(this.De,e))}He(){return this.Ce?this.Ce:this.Le()?Gn.W(this.De):null}Ne(e,n,r){e===this.Oe&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Oe=e,this.$e.register({[am]:[n,e,r]}))}Be(){if(this.Oe&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Oe,this._sessionStartTimestamp];var e=this.$e.props[am];return tn(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ne(null,null,null)}destroy(){clearTimeout(this.qe),this.qe=void 0,this.Re&&se&&(se.removeEventListener("beforeunload",this.Re,{capture:!1}),this.Re=void 0),this.Te=[]}Ue(){this.Re=()=>{this.Le()&&Gn.V(this.je)},Tn(se,"beforeunload",this.Re,{capture:!1})}checkAndGetSessionAndWindowId(e,n){if(e===void 0&&(e=!1),n===void 0&&(n=null),this.C.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[s,a,l]=this.Be(),u=this.He(),f=ni(l)&&l>0&&Math.abs(r-l)>864e5,h=!1,g=!a,p=!e&&this.Ie(r,s);g||p||f?(a=this.Fe(),u=this.Me(),mx.info("new session ID generated",{sessionId:a,windowId:u,changeReason:{noSessionId:g,activityTimeout:p,sessionPastMaximumLength:f}}),l=r,h=!0):u||(u=this.Me(),h=!0);var x=s===0||!e||f?r:s,y=l===0?new Date().getTime():l;return this.ze(u),this.Ne(a,x,y),e||this.Ae(),h&&this.Te.forEach((k=>k(a,u,h?{noSessionId:g,activityTimeout:p,sessionPastMaximumLength:f}:void 0))),{sessionId:a,windowId:u,sessionStartTimestamp:y,changeReason:h?{noSessionId:g,activityTimeout:p,sessionPastMaximumLength:f}:void 0,lastActivityTimestamp:s}}Ae(){clearTimeout(this.qe),this.qe=setTimeout((()=>{var[e]=this.Be();if(this.Ie(new Date().getTime(),e)){var n=this.Oe;this.resetSessionId(),this.Pe.emit("forcedIdleReset",{idleSessionId:n})}}),1.1*this.sessionTimeoutMs)}}var m5=["$set_once","$set"],wa=qn("[SiteApps]");class p5{constructor(e){this._instance=e,this.We=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ge(e,n){if(n){var r=this.globalsForEvent(n);this.We.push(r),this.We.length>1e3&&(this.We=this.We.slice(10))}}get siteAppLoaders(){var e;return(e=ct._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Mi(this.Ge.bind(this));this.Ve=()=>{e(),this.We=[],this.Ve=void 0}}}globalsForEvent(e){var n,r,s,a,l,u,f;if(!e)throw new Error("Event payload is required");var h={},g=this._instance.get_property("$groups")||[],p=this._instance.get_property("$stored_group_properties")||{};for(var[x,y]of Object.entries(p))h[x]={id:g[x],type:x,properties:y};var{$set_once:k,$set:w}=e;return{event:qe({},qC(e,m5),{properties:qe({},e.properties,w?{$set:qe({},(n=(r=e.properties)==null?void 0:r.$set)!==null&&n!==void 0?n:{},w)}:{},k?{$set_once:qe({},(s=(a=e.properties)==null?void 0:a.$set_once)!==null&&s!==void 0?s:{},k)}:{}),elements_chain:(l=(u=e.properties)==null?void 0:u.$elements_chain)!==null&&l!==void 0?l:"",distinct_id:(f=e.properties)==null?void 0:f.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}setupSiteApp(e){var n=this.apps[e.id],r=()=>{var u;!n.errored&&this.We.length&&(wa.info("Processing "+this.We.length+" events for site app with id "+e.id),this.We.forEach((f=>n.processEvent==null?void 0:n.processEvent(f))),n.processedBuffer=!0),Object.values(this.apps).every((f=>f.processedBuffer||f.errored))&&((u=this.Ve)==null||u.call(this))},s=!1,a=u=>{n.errored=!u,n.loaded=!0,wa.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),s&&r()};try{var{processEvent:l}=e.init({posthog:this._instance,callback:u=>{a(u)}});l&&(n.processEvent=l),s=!0}catch(u){wa.error("Error while initializing PostHog app with config id "+e.id,u),a(!1)}if(s&&n.loaded)try{r()}catch(u){wa.error("Error while processing buffered events PostHog app with config id "+e.id,u),n.errored=!0}}Je(){var e=this.siteAppLoaders||[];for(var n of e)this.apps[n.id]={id:n.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}Ke(e){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e);for(var r of Object.values(this.apps))try{r.processEvent==null||r.processEvent(n)}catch(s){wa.error("Error while processing event "+e.event+" for site app "+r.id,s)}}}onRemoteConfig(e){var n,r,s,a=this;if((n=this.siteAppLoaders)!=null&&n.length)return this.isEnabled?(this.Je(),void this._instance.on("eventCaptured",(h=>this.Ke(h)))):void wa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.Ve)==null||r.call(this),(s=e.siteApps)!=null&&s.length)if(this.isEnabled){var l=function(h){var g;ct["__$$ph_site_app_"+h]=a._instance,(g=ct.__PosthogExtensions__)==null||g.loadSiteApp==null||g.loadSiteApp(a._instance,f,(p=>{if(p)return wa.error("Error while initializing PostHog app with config id "+h,p)}))};for(var{id:u,url:f}of e.siteApps)l(u)}else wa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var g5=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],sj=function(t,e){if(!t)return!1;var n=t.toLowerCase();return g5.concat(e||[]).some((r=>{var s=r.toLowerCase();return n.indexOf(s)!==-1}))},G2=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&sj(n,e))return!0;try{var r=t==null?void 0:t.userAgentData;if(r!=null&&r.brands&&r.brands.some((s=>sj(s==null?void 0:s.brand,e))))return!0}catch{}return!!t.webdriver},td=(function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t})({}),ij="i.posthog.com";class v5{constructor(e){this.Ye={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+ij,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.Ye[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Ye[this.apiHost]=td.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Ye[this.apiHost]=td.EU:this.Ye[this.apiHost]=td.CUSTOM),this.Ye[this.apiHost]}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.uiHost+n;if(this.region===td.CUSTOM)return this.apiHost+n;var r=ij+n;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var x5={icontains:(t,e)=>!!se&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!se&&e.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>!!se&&fc(e.href,t),not_regex:(t,e)=>!!se&&!fc(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class Jn{constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((s=>{Jn.Xe("retrieved web experiments from the server"),n.Qe=new Map,s.forEach((a=>{if(a.feature_flag_key){var l;n.Qe&&(Jn.Xe("setting flag key ",a.feature_flag_key," to web experiment ",a),(l=n.Qe)==null||l.set(a.feature_flag_key,a));var u=n._instance.getFeatureFlag(a.feature_flag_key);Pn(u)&&a.variants[u]&&n.Ze(a.name,u,a.variants[u].transforms)}else if(a.variants)for(var f in a.variants){var h=a.variants[f];Jn.tr(h)&&n.Ze(a.name,f,h.transforms)}}))}),r)},this._instance=e,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}onFeatureFlags(e){if(this._is_bot())Jn.Xe("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(en(this.Qe))return this.Qe=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Jn.Xe("applying feature flags",e),e.forEach((n=>{var r;if(this.Qe&&(r=this.Qe)!=null&&r.has(n)){var s,a=this._instance.getFeatureFlag(n),l=(s=this.Qe)==null?void 0:s.get(n);a&&l!=null&&l.variants[a]&&this.Ze(l.name,a,l.variants[a].transforms)}}))}}previewWebExperiment(){var e=Jn.getWindowLocation();if(e!=null&&e.search){var n=fm(e==null?void 0:e.search,"__experiment_id"),r=fm(e==null?void 0:e.search,"__experiment_variant");n&&r&&(Jn.Xe("previewing web experiments "+n+" && "+r),this.getWebExperiments((s=>{this.ir(parseInt(n),r,s)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,r){if(this._instance.config.disable_web_experiments&&!r)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!n)return e(s);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:a=>{if(a.statusCode!==200||!a.json)return e([]);var l=a.json.experiments||[];return e(l)}})}ir(e,n,r){var s=r.filter((a=>a.id===e));s&&s.length>0&&(Jn.Xe("Previewing web experiment ["+s[0].name+"] with variant ["+n+"]"),this.Ze(s[0].name,n,s[0].variants[n].transforms))}static tr(e){return!en(e.conditions)&&Jn.er(e)&&Jn.rr(e)}static er(e){var n;if(en(e.conditions)||en((n=e.conditions)==null?void 0:n.url))return!0;var r,s,a,l=Jn.getWindowLocation();return!!l&&((r=e.conditions)==null||!r.url||x5[(s=(a=e.conditions)==null?void 0:a.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,l))}static getWindowLocation(){return se==null?void 0:se.location}static rr(e){var n;if(en(e.conditions)||en((n=e.conditions)==null?void 0:n.utm))return!0;var r=D2();if(r.utm_source){var s,a,l,u,f,h,g,p,x=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_campaign)==r.utm_campaign,y=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_source||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_source)==r.utm_source,k=(f=e.conditions)==null||(f=f.utm)==null||!f.utm_medium||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_medium)==r.utm_medium,w=(g=e.conditions)==null||(g=g.utm)==null||!g.utm_term||((p=e.conditions)==null||(p=p.utm)==null?void 0:p.utm_term)==r.utm_term;return x&&k&&w&&y}return!1}static Xe(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];Be.info("[WebExperiments] "+e,r)}Ze(e,n,r){this._is_bot()?Jn.Xe("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach((s=>{if(s.selector){var a;Jn.Xe("applying transform of variant "+n+" for experiment "+e+" ",s);var l=(a=document)==null?void 0:a.querySelectorAll(s.selector);l==null||l.forEach((u=>{var f=u;s.html&&(f.innerHTML=s.html),s.css&&f.setAttribute("style",s.css)}))}})):Jn.Xe("Control variants leave the page unmodified.")}_is_bot(){return qr&&this._instance?G2(qr,this._instance.config.custom_blocked_useragents):void 0}}var y5=qn("[PostHog ExternalIntegrations]"),b5={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class w5{constructor(e){this._instance=e}it(e,n){var r;(r=ct.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,(s=>{if(s)return y5.error("failed to load script",s);n()}))}startIfEnabledOrStop(){var e=this,n=function(l){var u,f,h;!s||(u=ct.__PosthogExtensions__)!=null&&(u=u.integrations)!=null&&u[l]||e.it(b5[l],(()=>{var g;(g=ct.__PosthogExtensions__)==null||(g=g.integrations)==null||(g=g[l])==null||g.start(e._instance)})),!s&&(f=ct.__PosthogExtensions__)!=null&&(f=f.integrations)!=null&&f[l]&&((h=ct.__PosthogExtensions__)==null||(h=h.integrations)==null||(h=h[l])==null||h.stop())};for(var[r,s]of Object.entries((a=this._instance.config.integrations)!==null&&a!==void 0?a:{})){var a;n(r)}}}var qy="[SessionRecording]",Bu=qn(qy);class aj{get started(){var e;return!((e=this.sr)==null||!e.isStarted)}get status(){return this.sr?this.sr.status:this.nr&&!this.ar?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.nr=!1,this.lr=void 0,this._instance=e,!this._instance.sessionManager)throw Bu.error("started without valid sessionManager"),new Error(qy+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(qy+' cannot be used with cookieless_mode="always"')}get ar(){var e,n=!((e=this._instance.get_property(tx))==null||!e.enabled),r=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return se&&n&&r&&!s}startIfEnabledOrStop(e){var n;if(!this.ar||(n=this.sr)==null||!n.isStarted){var r=!Me(Object.assign)&&!Me(Array.from);this.ar&&r?(this.ur(e),Bu.info("starting")):this.stopRecording()}}ur(e){var n,r,s;this.ar&&(ct!=null&&(n=ct.__PosthogExtensions__)!=null&&(n=n.rrweb)!=null&&n.record&&(r=ct.__PosthogExtensions__)!=null&&r.initSessionRecording?this.hr(e):(s=ct.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.dr,(a=>{if(a)return Bu.error("could not load recorder",a);this.hr(e)})))}stopRecording(){var e,n;(e=this.lr)==null||e.call(this),this.lr=void 0,(n=this.sr)==null||n.stop()}vr(){var e;(e=this._instance.persistence)==null||e.unregister(JC)}cr(e){if(this._instance.persistence){var n,r,s=this._instance.persistence,a=()=>{var l=e.sessionRecording===!1?void 0:e.sessionRecording,u=l==null?void 0:l.sampleRate,f=en(u)?null:parseFloat(u);en(f)&&this.vr();var h=l==null?void 0:l.minimumDurationMilliseconds;s.register({[tx]:qe({enabled:!!l},l,{networkPayloadCapture:qe({capturePerformance:e.capturePerformance},l==null?void 0:l.networkPayloadCapture),canvasRecording:{enabled:l==null?void 0:l.recordCanvas,fps:l==null?void 0:l.canvasFps,quality:l==null?void 0:l.canvasQuality},sampleRate:f,minimumDurationMilliseconds:Me(h)?null:h,endpoint:l==null?void 0:l.endpoint,triggerMatchType:l==null?void 0:l.triggerMatchType,masking:l==null?void 0:l.masking,urlTriggers:l==null?void 0:l.urlTriggers})})};a(),(n=this.lr)==null||n.call(this),this.lr=(r=this._instance.sessionManager)==null?void 0:r.onSessionId(a)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.cr(e),this.nr=!0,this.startIfEnabledOrStop()):this.nr=!0:Bu.info("skipping remote config with no sessionRecording",e)}log(e,n){var r;n===void 0&&(n="log"),(r=this.sr)!=null&&r.log?this.sr.log(e,n):Bu.warn("log called before recorder was ready")}get dr(){var e,n,r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(tx);return(r==null||(n=r.scriptConfig)==null?void 0:n.script)||"lazy-recorder"}hr(e){var n,r;if((n=ct.__PosthogExtensions__)==null||!n.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.sr||(this.sr=(r=ct.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance),this.sr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.sr.start(e)}onRRwebEmit(e){var n;(n=this.sr)==null||n.onRRwebEmit==null||n.onRRwebEmit(e)}overrideLinkedFlag(){var e;(e=this.sr)==null||e.overrideLinkedFlag()}overrideSampling(){var e;(e=this.sr)==null||e.overrideSampling()}overrideTrigger(e){var n;(n=this.sr)==null||n.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.sr)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,n){var r;return!((r=this.sr)==null||!r.tryAddCustomEvent(e,n))}}var ld={},Hy=()=>{},zl="posthog",Z2=!WI&&(Sr==null?void 0:Sr.indexOf("MSIE"))===-1&&(Sr==null?void 0:Sr.indexOf("Mozilla"))===-1,oj=t=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:KD(Le==null?void 0:Le.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Hy,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:t!=="2025-05-24"||"history_change",capture_pageleave:"if_capture_pageview",defaults:t??"unset",debug:jr&&Pn(jr==null?void 0:jr.search)&&jr.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(se==null||(e=se.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:n=>{var r="Bad HTTP status: "+n.statusCode+" "+n.text;Be.error(r)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Uy},error_tracking:{},_onCapture:Hy,__preview_eager_load_replay:!1}},lj=t=>{var e={};Me(t.process_person)||(e.person_profiles=t.process_person),Me(t.xhr_headers)||(e.request_headers=t.xhr_headers),Me(t.cookie_name)||(e.persistence_name=t.cookie_name),Me(t.disable_cookie)||(e.disable_persistence=t.disable_cookie),Me(t.store_google)||(e.save_campaign_params=t.store_google),Me(t.verbose)||(e.debug=t.verbose);var n=xn({},e,t);return tn(t.property_blacklist)&&(Me(t.property_denylist)?n.property_denylist=t.property_blacklist:tn(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Be.error("Invalid value for property_denylist config: "+t.property_denylist)),n};class _5{constructor(){this.__forceAllowLocalhost=!1}get pr(){return this.__forceAllowLocalhost}set pr(e){Be.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Wm{get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new _5,this.gr=!1,this.version=Ai.LIB_VERSION,this._r=new e0,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=oj(),this.SentryIntegration=yI,this.sentryIntegration=e=>(function(n,r){var s=v2(n,r);return{name:g2,processEvent:a=>s(a)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.mr=!1,this.yr=null,this.br=null,this.wr=null,this.featureFlags=new e5(this),this.toolbar=new wI(this),this.scrollManager=new f5(this),this.pageViewManager=new BI(this),this.surveys=new a5(this),this.experiments=new Jn(this),this.exceptions=new QI(this),this.rateLimiter=new o5(this),this.requestRouter=new v5(this),this.consent=new hI(this),this.externalIntegrations=new w5(this),this.people={set:(e,n,r)=>{var s=Pn(e)?{[e]:n}:e;this.setPersonProperties(s),r==null||r({})},set_once:(e,n,r)=>{var s=Pn(e)?{[e]:n}:e;this.setPersonProperties(void 0,s),r==null||r({})}},this.on("eventCaptured",(e=>Be.info('send "'+(e==null?void 0:e.event)+'"',e)))}init(e,n,r){if(r&&r!==zl){var s,a=(s=ld[r])!==null&&s!==void 0?s:new Wm;return a._init(e,n,r),ld[r]=a,ld[zl][r]=a,a}return this._init(e,n,r)}_init(e,n,r){var s,a;if(n===void 0&&(n={}),Me(e)||ky(e))return Be.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.Sr(n.debug),this.Er=n,this.$r=[],n.person_profiles&&(this.br=n.person_profiles),this.set_config(xn({},oj(n.defaults),lj(n),{name:r,token:e})),this.config.on_xhr_error&&Be.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Mi.GZipJS;var l=this.kr();this.persistence=new fx(this.config,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new fx(qe({},this.config,{persistence:"sessionStorage"}),l);var u=qe({},this.persistence.props),f=qe({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Pr=new c5((j=>this.Tr(j)),this.config.request_queue_config),this.Rr=new d5(this),this.__request_queue=[];var h=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(h||(this.sessionManager=new rj(this),this.sessionPropsManager=new nj(this,this.sessionManager,this.persistence)),new kI(this).startIfEnabledOrStop(),this.siteApps=new p5(this),(s=this.siteApps)==null||s.init(),h||(this.sessionRecording=new aj(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new iI(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new FI(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new $I(this),this.exceptionObserver=new gI(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new p2(this,pI),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new vI(this),this.historyAutocapture.startIfEnabled(),Ai.DEBUG=Ai.DEBUG||this.config.debug,Ai.DEBUG&&Be.info("Starting in debug mode",{this:this,config:n,thisC:qe({},this.config),p:u,s:f}),((a=n.bootstrap)==null?void 0:a.distinctID)!==void 0){var g,p,x=this.config.get_device_id(Oa()),y=(g=n.bootstrap)!=null&&g.isIdentifiedID?x:n.bootstrap.distinctID;this.persistence.set_property(Oi,(p=n.bootstrap)!=null&&p.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:y})}if(this.Ir()){var k,w,S=Object.keys(((k=n.bootstrap)==null?void 0:k.featureFlags)||{}).filter((j=>{var A;return!((A=n.bootstrap)==null||(A=A.featureFlags)==null||!A[j])})).reduce(((j,A)=>{var I;return j[A]=((I=n.bootstrap)==null||(I=I.featureFlags)==null?void 0:I[A])||!1,j}),{}),N=Object.keys(((w=n.bootstrap)==null?void 0:w.featureFlagPayloads)||{}).filter((j=>S[j])).reduce(((j,A)=>{var I,T;return(I=n.bootstrap)!=null&&(I=I.featureFlagPayloads)!=null&&I[A]&&(j[A]=(T=n.bootstrap)==null||(T=T.featureFlagPayloads)==null?void 0:T[A]),j}),{});this.featureFlags.receivedFeatureFlags({featureFlags:S,featureFlagPayloads:N})}if(h)this.register_once({distinct_id:Iu,$device_id:null},"");else if(!this.get_distinct_id()){var C=this.config.get_device_id(Oa());this.register_once({distinct_id:C,$device_id:C},""),this.persistence.set_property(Oi,"anonymous")}return Tn(se,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?xI(this,(()=>this.Cr())):this.Cr(),Ra(this.config._onCapture)&&this.config._onCapture!==Hy&&(Be.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(j=>this.config._onCapture(j.event,j)))),this.config.ip&&Be.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}fi(e){var n,r,s,a,l,u,f,h;if(!Le||!Le.body)return Be.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.fi(e)}),500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=St(e.supportedCompression,Mi.GZipJS)?Mi.GZipJS:St(e.supportedCompression,Mi.Base64)?Mi.Base64:void 0),(n=e.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.br?this.br:"identified_only"}),(r=this.siteApps)==null||r.onRemoteConfig(e),(s=this.sessionRecording)==null||s.onRemoteConfig(e),(a=this.autocapture)==null||a.onRemoteConfig(e),(l=this.heatmaps)==null||l.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(u=this.webVitalsAutocapture)==null||u.onRemoteConfig(e),(f=this.exceptionObserver)==null||f.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(h=this.deadClicksAutocapture)==null||h.onRemoteConfig(e)}Cr(){try{this.config.loaded(this)}catch(e){Be.critical("`loaded` function failed",e)}this.Or(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Fr()}),1),new l5(this).load(),this.featureFlags.flags()}Or(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Pr)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Da(this.__request_queue,(e=>this.Tr(e))),this.__request_queue=[],this.Or()}_handle_unload(){var e,n;this.config.request_batching?(this.Mr()&&this.capture("$pageleave"),(e=this.Pr)==null||e.unload(),(n=this.Rr)==null||n.unload()):this.Mr()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}ci(e){this.__loaded&&(Z2?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=vm(e.url,{ip:this.config.ip?1:0}),e.headers=qe({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var r,s,a,l=qe({},n);l.timeout=l.timeout||6e4,l.url=vm(l.url,{_:new Date().getTime().toString(),ver:Ai.LIB_VERSION,compression:l.compression});var u=(r=l.transport)!==null&&r!==void 0?r:"fetch",f=Hh.filter((g=>!l.disableTransport||!g.transport||!l.disableTransport.includes(g.transport))),h=(s=(a=WC(f,(g=>g.transport===u)))==null?void 0:a.method)!==null&&s!==void 0?s:f[0].method;if(!h)throw new Error("No available transport method");h(l)})(qe({},e,{callback:n=>{var r,s;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((r=(s=this.config).on_request_error)==null||r.call(s,n)),e.callback==null||e.callback(n)}}))))}Tr(e){this.Rr?this.Rr.retriableRequest(e):this.ci(e)}_execute_array(e){var n,r=[],s=[],a=[];Da(e,(u=>{u&&(n=u[0],tn(n)?a.push(u):Ra(u)?u.call(this):tn(u)&&n==="alias"?r.push(u):tn(u)&&n.indexOf("capture")!==-1&&Ra(this[n])?a.push(u):s.push(u))}));var l=function(u,f){Da(u,(function(h){if(tn(h[0])){var g=f;Xt(h,(function(p){g=g[p[0]].apply(g,p.slice(1))}))}else this[h[0]].apply(this,h.slice(1))}),f)};l(r,this),l(s,this),l(a,this)}Ir(){var e,n;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((n=this.config.bootstrap)==null?void 0:n.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,n,r){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Pr){if(this.is_capturing())if(!Me(e)&&Pn(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var a=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a==null||!a.isRateLimited){n!=null&&n.$current_url&&!Pn(n==null?void 0:n.$current_url)&&(Be.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var l=new Date,u=(r==null?void 0:r.timestamp)||l,f=Oa(),h={uuid:f,event:e,properties:this.calculateEventProperties(e,n||{},u,f)};a&&(h.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens),r!=null&&r.$set&&(h.$set=r==null?void 0:r.$set);var g,p=this.Ar(r==null?void 0:r.$set_once);if(p&&(h.$set_once=p),(h=HD(h,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=u,Me(r==null?void 0:r.timestamp)||(h.properties.$event_time_override_provided=!0,h.properties.$event_time_override_system_time=l),e===Vh.DISMISSED||e===Vh.SENT){var x=n==null?void 0:n[JS.SURVEY_ID],y=n==null?void 0:n[JS.SURVEY_ITERATION];g={id:x,current_iteration:y},localStorage.getItem(ej(g))||localStorage.setItem(ej(g),"true"),h.$set=qe({},h.$set,{[n5({id:x,current_iteration:y},e===Vh.SENT?"responded":"dismissed")]:!0})}var k=qe({},h.properties.$set,h.$set);if(ql(k)||this.setPersonPropertiesForFlags(k),!en(this.config.before_send)){var w=this.Dr(h);if(!w)return;h=w}this._r.emit("eventCaptured",h);var S={method:"POST",url:(s=r==null?void 0:r._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:h,compression:"best-available",batchKey:r==null?void 0:r._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Tr(S):this.Pr.enqueue(S),h}Be.critical("This capture call is ignored due to client rate limiting.")}}else Be.error("No event name provided to posthog.capture")}else Be.uninitializedWarning("posthog.capture")}Mi(e){return this.on("eventCaptured",(n=>e(n.event,n)))}calculateEventProperties(e,n,r,s,a){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var l=a?void 0:this.persistence.remove_event_timer(e),u=qe({},n);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(u.$cookieless_mode=!0),e==="$snapshot"){var f=qe({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=f.distinct_id,(!Pn(u.distinct_id)&&!ni(u.distinct_id)||ky(u.distinct_id))&&Be.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var h,g=PI(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:p,windowId:x}=this.sessionManager.checkAndGetSessionAndWindowId(a,r.getTime());u.$session_id=p,u.$window_id=x}this.sessionPropsManager&&xn(u,this.sessionPropsManager.getSessionProps());try{var y;this.sessionRecording&&xn(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=(y=this.Rr)==null?void 0:y.length}catch(N){u.$sdk_debug_error_capturing_properties=String(N)}if(this.requestRouter.region===td.CUSTOM&&(u.$lib_custom_api_host=this.config.api_host),h=e!=="$pageview"||a?e!=="$pageleave"||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),u=xn(u,h),e==="$pageview"&&Le&&(u.title=Le.title),!Me(l)){var k=r.getTime()-l;u.$duration=parseFloat((k/1e3).toFixed(3))}Sr&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser"),(u=xn({},g,this.persistence.properties(),this.sessionPersistence.properties(),u)).$is_identified=this._isIdentified(),tn(this.config.property_denylist)?Xt(this.config.property_denylist,(function(N){delete u[N]})):Be.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var w=this.config.sanitize_properties;w&&(Be.error("sanitize_properties is deprecated. Use before_send instead"),u=w(u,e));var S=this.jr();return u.$process_person_profile=S,S&&!a&&this.Lr("_calculate_event_properties"),u}Ar(e){var n;if(!this.persistence||!this.jr()||this.gr)return e;var r=this.persistence.get_initial_props(),s=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),a=xn({},r,s||{},e||{}),l=this.config.sanitize_properties;return l&&(Be.error("sanitize_properties is deprecated. Use before_send instead"),a=l(a,"$set_once")),this.gr=!0,ql(a)?void 0:a}register(e,n){var r;(r=this.persistence)==null||r.register(e,n)}register_once(e,n,r){var s;(s=this.persistence)==null||s.register_once(e,n,r)}register_for_session(e){var n;(n=this.sessionPersistence)==null||n.register(e)}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e)}Nr(e,n){this.register({[e]:n})}getFeatureFlag(e,n){return this.featureFlags.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(n)}catch{return n}}isFeatureEnabled(e,n){return this.featureFlags.isFeatureEnabled(e,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,n,r){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,n,r)}getEarlyAccessFeatures(e,n,r){return n===void 0&&(n=!1),this.featureFlags.getEarlyAccessFeatures(e,n,r)}on(e,n){return this._r.on(e,n)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys.getSurveys(e,n)}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys.getActiveMatchingSurveys(e,n)}renderSurvey(e,n){this.surveys.renderSurvey(e,n)}displaySurvey(e,n){n===void 0&&(n=s5),this.surveys.displaySurvey(e,n)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,n){return n===void 0&&(n=!1),this.surveys.canRenderSurveyAsync(e,n)}identify(e,n,r){if(!this.__loaded||!this.persistence)return Be.uninitializedWarning("posthog.identify");if(ni(e)&&(e=e.toString(),Be.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))Be.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==Iu){if(this.Lr("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var a=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:a},"")}e!==s&&e!==this.get_property(Zu)&&(this.unregister(Zu),this.register({distinct_id:e}));var l=(this.persistence.get_property(Oi)||"anonymous")==="anonymous";e!==s&&l?(this.persistence.set_property(Oi,"identified"),this.setPersonPropertiesForFlags(qe({},r||{},n||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:n||{},$set_once:r||{}}),this.wr=ZS(e,n,r),this.featureFlags.setAnonymousDistinctId(s)):(n||r)&&this.setPersonProperties(n,r),e!==s&&(this.reloadFeatureFlags(),this.unregister(om))}}else Be.critical('The string "'+Iu+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Be.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,n){if((e||n)&&this.Lr("posthog.setPersonProperties")){var r=ZS(this.get_distinct_id(),e,n);this.wr!==r?(this.setPersonPropertiesForFlags(qe({},n||{},e||{})),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.wr=r):Be.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,n,r){if(e&&n){if(this.Lr("posthog.group")){var s=this.getGroups();s[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:qe({},s,{[e]:n})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),s[e]===n||r||this.reloadFeatureFlags()}}else Be.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){n===void 0&&(n=!0),this.featureFlags.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,n){n===void 0&&(n=!0),this.Lr("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,n)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var n,r,s,a;if(Be.info("reset"),!this.__loaded)return Be.uninitializedWarning("posthog.reset");var l=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),this.surveys.reset(),this.featureFlags.reset(),(s=this.persistence)==null||s.set_property(Oi,"anonymous"),(a=this.sessionManager)==null||a.resetSessionId(),this.wr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Iu,$device_id:null},"");else{var u=this.config.get_device_id(Oa());this.register_once({distinct_id:u,$device_id:e?u:l},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(e!=null&&e.withTimestamp&&r){var a,l=(a=e.timestampLookBack)!==null&&a!==void 0?a:10;if(!r)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-l,0)}return s}alias(e,n){return e===this.get_property(QC)?(Be.critical("Attempting to create alias for existing People user - aborting."),-2):this.Lr("posthog.alias")?(Me(n)&&(n=this.get_distinct_id()),e!==n?(this.Nr(Zu,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(Be.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=qe({},this.config);if(er(e)){var r,s,a,l,u;xn(this.config,lj(e));var f=this.kr();(r=this.persistence)==null||r.update_config(this.config,n,f),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new fx(qe({},this.config,{persistence:"sessionStorage"}),f);var h=this.Sr(this.config.debug);Ma(h)&&(this.config.debug=h),Ma(this.config.debug)&&(this.config.debug?(Ai.DEBUG=!0,an.H()&&an.G("ph_debug","true"),Be.info("set_config",{config:e,oldConfig:n,newConfig:qe({},this.config)})):(Ai.DEBUG=!1,an.H()&&an.V("ph_debug"))),(s=this.sessionRecording)==null||s.startIfEnabledOrStop(),(a=this.autocapture)==null||a.startIfEnabled(),(l=this.heatmaps)==null||l.startIfEnabled(),this.surveys.loadIfEnabled(),this.Ur(),(u=this.externalIntegrations)==null||u.startIfEnabledOrStop()}}startSessionRecording(e){var n=e===!0,r={sampling:n||!(e==null||!e.sampling),linked_flag:n||!(e==null||!e.linked_flag),url_trigger:n||!(e==null||!e.url_trigger),event_trigger:n||!(e==null||!e.event_trigger)};if(Object.values(r).some(Boolean)){var s,a,l,u,f;(s=this.sessionManager)==null||s.checkAndGetSessionAndWindowId(),r.sampling&&((a=this.sessionRecording)==null||a.overrideSampling()),r.linked_flag&&((l=this.sessionRecording)==null||l.overrideLinkedFlag()),r.url_trigger&&((u=this.sessionRecording)==null||u.overrideTrigger("url")),r.event_trigger&&((f=this.sessionRecording)==null||f.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,n){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(qe({},s,n))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:zl;return n!==zl&&(n=zl+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(Oi))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(Oi))==="identified"}jr(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&ql(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Zu])&&((n=this.persistence)==null||(n=n.props)==null||!n[cm]))}Mr(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.jr()||this.Lr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Lr(e){return this.config.person_profiles==="never"?(Be.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Nr(cm,!0),!0)}kr(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),n=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!n}Ur(){var e,n,r,s,a=this.kr();return((e=this.persistence)==null?void 0:e.wi)!==a&&((r=this.persistence)==null||r.set_disabled(a)),((n=this.sessionPersistence)==null?void 0:n.wi)!==a&&((s=this.sessionPersistence)==null||s.set_disabled(a)),a}opt_in_capturing(e){if(this.config.cookieless_mode!=="always"){var n,r;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(n=this.sessionManager)==null||n.destroy(),this.sessionManager=new rj(this),this.persistence&&(this.sessionPropsManager=new nj(this,this.sessionManager,this.persistence)),this.sessionRecording=new aj(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Ur(),this.Or(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(Me(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((r=e==null?void 0:e.captureEventName)!==null&&r!==void 0?r:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Fr()}else Be.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,n;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Ur(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:Iu,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(n=this.sessionRecording)==null||n.stopRecording(),this.sessionRecording=void 0,this.Fr())):Be.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===Ri.GRANTED?"granted":e===Ri.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Ur()}_is_bot(){return qr?G2(qr,this.config.custom_blocked_useragents):void 0}Fr(){Le&&(Le.visibilityState==="visible"?this.mr||(this.mr=!0,this.capture("$pageview",{title:Le.title},{send_instantly:!0}),this.yr&&(Le.removeEventListener("visibilitychange",this.yr),this.yr=null)):this.yr||(this.yr=this.Fr.bind(this),Tn(Le,"visibilitychange",this.yr)))}debug(e){e===!1?(se==null||se.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(se==null||se.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}M(){var e,n,r,s,a,l,u,f=this.Er||{};return"advanced_disable_flags"in f?!!f.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Be.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",s=!1,a=Be,l=(n="advanced_disable_flags")in(e=f)&&!Me(e[n]),u=r in e&&!Me(e[r]),l?e[n]:u?(a&&a.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[r]):s)}Dr(e){if(en(this.config.before_send))return e;var n=tn(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var s of n){if(r=s(r),en(r)){var a="Event '"+e.event+"' was rejected in beforeSend function";return vD(e.event)?Be.warn(a+". This can cause unexpected behavior."):Be.info(a),null}r.properties&&!ql(r.properties)||Be.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var e;return(e=this.pageViewManager.Vt)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(r)})}Sr(e){var n=Ma(e)&&!e,r=an.H()&&an.q("ph_debug")==="true";return!n&&(!!r||e)}}(function(t,e){for(var n=0;n<e.length;n++)t.prototype[e[n]]=qD(t.prototype[e[n]])})(Wm,["identify"]);var cj,px=(cj=ld[zl]=new Wm,(function(){function t(){t.done||(t.done=!0,Z2=!1,Xt(ld,(function(e){e._dom_loaded()})))}Le!=null&&Le.addEventListener?Le.readyState==="complete"?t():Tn(Le,"DOMContentLoaded",t,{capture:!1}):se&&Be.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),cj);const W2=_.createContext(void 0);function Q2(){return typeof window>"u"?null:window.__DEXTO_ANALYTICS__??null}function k5(){var t,e,n;return typeof window>"u"?{app:"dexto-webui"}:{app:"dexto-webui",app_version:((t=Q2())==null?void 0:t.appVersion)??"unknown",browser:(e=navigator.userAgent.split(" ").pop())==null?void 0:e.split("/")[0],browser_version:(n=navigator.userAgent.split(" ").pop())==null?void 0:n.split("/")[1],os:navigator.platform,screen_width:window.screen.width,screen_height:window.screen.height}}function S5({children:t}){const[e,n]=_.useState(!1),[r,s]=_.useState(!1);_.useEffect(()=>{const l=Q2();if(!l){n(!1),s(!0);return}try{px.init(l.posthogKey,{api_host:l.posthogHost,person_profiles:"identified_only",loaded:u=>{u.identify(l.distinctId),n(!0),s(!0)},autocapture:!1,capture_pageview:!1,disable_session_recording:!0,disable_surveys:!0,opt_out_capturing_by_default:!1})}catch(u){console.error("Failed to initialize analytics:",u),n(!1),s(!0)}return()=>{try{px.reset()}catch{}}},[]);const a=(l,u)=>{if(!(!e||!r))try{px.capture(l,{...k5(),...u})}catch(f){console.error("Failed to capture analytics event:",f)}};return c.jsx(W2.Provider,{value:{capture:a,enabled:e,isReady:r},children:t})}function j5(){const t=_.useContext(W2);if(!t)throw new Error("useAnalyticsContext must be used within an AnalyticsProvider");return t}const X2="dexto_first_message_sent";function N5(){if(typeof window>"u")return!1;try{return!localStorage.getItem(X2)}catch{return!1}}function C5(){if(!(typeof window>"u"))try{localStorage.setItem(X2,"true")}catch{}}function Nc(){const{capture:t,enabled:e,isReady:n}=j5(),r=_.useRef({}),s=_.useCallback(k=>{if(e)try{const w=k.sessionId;if(r.current[w]=(r.current[w]||0)+1,N5()){const C={provider:k.provider,model:k.model,hasImage:k.hasImage,hasFile:k.hasFile,messageLength:k.messageLength};t("dexto_webui_first_message",C),C5()}const N={...k,messageCount:r.current[w]};t("dexto_webui_message_sent",N)}catch(w){console.warn("Analytics tracking failed:",w)}},[t,e]),a=_.useCallback(k=>{if(e)try{t("dexto_webui_session_created",k)}catch(w){console.warn("Analytics tracking failed:",w)}},[t,e]),l=_.useCallback(k=>{if(e)try{t("dexto_webui_session_switched",k)}catch(w){console.warn("Analytics tracking failed:",w)}},[t,e]),u=_.useCallback(k=>{if(e)try{r.current[k.sessionId]=0,t("dexto_webui_conversation_reset",k)}catch(w){console.warn("Analytics tracking failed:",w)}},[t,e]),f=_.useCallback(k=>{if(e)try{t("dexto_webui_agent_switched",k)}catch(w){console.warn("Analytics tracking failed:",w)}},[t,e]),h=_.useCallback(k=>{if(e)try{t("dexto_webui_tool_called",k)}catch(w){console.warn("Analytics tracking failed:",w)}},[t,e]),g=_.useCallback(k=>{if(e)try{t("dexto_webui_llm_switched",k)}catch(w){console.warn("Analytics tracking failed:",w)}},[t,e]),p=_.useCallback(k=>{if(e)try{t("dexto_webui_file_uploaded",k)}catch(w){console.warn("Analytics tracking failed:",w)}},[t,e]),x=_.useCallback(k=>{if(e)try{t("dexto_webui_image_uploaded",k)}catch(w){console.warn("Analytics tracking failed:",w)}},[t,e]),y=_.useCallback(k=>{if(e)try{t("dexto_webui_mcp_server_connected",k)}catch(w){console.warn("Analytics tracking failed:",w)}},[t,e]);return{capture:t,enabled:e,isReady:n,trackMessageSent:s,trackSessionCreated:a,trackSessionSwitched:l,trackConversationReset:u,trackAgentSwitched:f,trackToolCalled:h,trackLLMSwitched:g,trackFileUploaded:p,trackImageUploaded:x,trackMCPServerConnected:y}}const J2=_.createContext(void 0);function E5({children:t}){const[e,n]=_.useState(null),[,r]=_.useState([]),s=_.useCallback(()=>{r(f=>{if(f.length>0){const[h,...g]=f;return setTimeout(()=>n(h),0),g}return f})},[]),a=_.useCallback(f=>{n(h=>h?(r(g=>[...g,f]),h):f)},[]),l=_.useCallback(f=>{n(h=>(h==null?void 0:h.approvalId)===f.approvalId&&(f.status==="approved"||f.status==="denied"||f.status==="cancelled")?(f.status==="cancelled"&&console.debug(`[ApprovalContext] Approval ${f.approvalId} cancelled: ${f.reason}`),s(),null):h)},[s]),u=_.useCallback(()=>{n(null),s()},[s]);return c.jsx(J2.Provider,{value:{pendingApproval:e,handleApprovalRequest:a,handleApprovalResponse:l,clearApproval:u},children:t})}function eE(){const t=_.useContext(J2);if(!t)throw new Error("useApproval must be used within ApprovalProvider");return t}var T5=(t,e,n={})=>{let r=`${t}=${e}`;if(t.startsWith("__Secure-")&&!n.secure)throw new Error("__Secure- Cookie must have Secure attributes");if(t.startsWith("__Host-")){if(!n.secure)throw new Error("__Host- Cookie must have Secure attributes");if(n.path!=="/")throw new Error('__Host- Cookie must have Path attributes with "/"');if(n.domain)throw new Error("__Host- Cookie must not have Domain attributes")}if(n&&typeof n.maxAge=="number"&&n.maxAge>=0){if(n.maxAge>3456e4)throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!=="host"&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+="; HttpOnly"),n.secure&&(r+="; Secure"),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw new Error("Partitioned Cookie must have Secure attributes");r+="; Partitioned"}return r},A5=(t,e,n)=>(e=encodeURIComponent(e),T5(t,e,n)),O5=(t,e)=>(t=t.replace(/\/+$/,""),t=t+"/",e=e.replace(/^\/+/,""),t+e),Vy=(t,e)=>{for(const[n,r]of Object.entries(e)){const s=new RegExp("/:"+n+"(?:{[^/]+})?\\??");t=t.replace(s,r?`/${r}`:"")}return t},tE=t=>{const e=new URLSearchParams;for(const[n,r]of Object.entries(t))if(r!==void 0)if(Array.isArray(r))for(const s of r)e.append(n,s);else e.set(n,r);return e},R5=(t,e)=>{switch(e){case"ws":return t.replace(/^http/,"ws");case"http":return t.replace(/^ws/,"http")}},nE=t=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(t)?t.replace(/\/index(?=\?|$)/,"/"):t.replace(/\/index(?=\?|$)/,"");function yh(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function rE(t,e){if(!yh(t)&&!yh(e))return e;const n={...t};for(const r in e){const s=e[r];yh(n[r])&&yh(s)?n[r]=rE(n[r],s):n[r]=s}return n}var sE=(t,e)=>new Proxy(()=>{},{get(r,s){if(!(typeof s!="string"||s==="then"))return sE(t,[...e,s])},apply(r,s,a){return t({path:e,args:a})}}),M5=class{constructor(t,e){Xn(this,"url");Xn(this,"method");Xn(this,"queryParams");Xn(this,"pathParams",{});Xn(this,"rBody");Xn(this,"cType");Xn(this,"fetch",async(t,e)=>{if(t){if(t.query&&(this.queryParams=tE(t.query)),t.form){const u=new FormData;for(const[f,h]of Object.entries(t.form))if(Array.isArray(h))for(const g of h)u.append(f,g);else u.append(f,h);this.rBody=u}t.json&&(this.rBody=JSON.stringify(t.json),this.cType="application/json"),t.param&&(this.pathParams=t.param)}let n=this.method.toUpperCase();const r={...t==null?void 0:t.header,...typeof(e==null?void 0:e.headers)=="function"?await e.headers():e==null?void 0:e.headers};if(t!=null&&t.cookie){const u=[];for(const[f,h]of Object.entries(t.cookie))u.push(A5(f,h,{path:"/"}));r.Cookie=u.join(",")}this.cType&&(r["Content-Type"]=this.cType);const s=new Headers(r??void 0);let a=this.url;a=nE(a),a=Vy(a,this.pathParams),this.queryParams&&(a=a+"?"+this.queryParams.toString()),n=this.method.toUpperCase();const l=!(n==="GET"||n==="HEAD");return((e==null?void 0:e.fetch)||fetch)(a,{body:l?this.rBody:void 0,method:n,headers:s,...e==null?void 0:e.init})});this.url=t,this.method=e}},D5=(t,e)=>sE(function n(r){var g;const s=[...r.path],a=s.slice(-3).reverse();if(a[0]==="toString")return a[1]==="name"?a[2]||"":n.toString();if(a[0]==="valueOf")return a[1]==="name"?a[2]||"":n;let l="";if(/^\$/.test(a[0])){const p=s.pop();p&&(l=p.replace(/^\$/,""))}const u=s.join("/"),f=O5(t,u);if(l==="url"){let p=f;return r.args[0]&&(r.args[0].param&&(p=Vy(f,r.args[0].param)),r.args[0].query&&(p=p+"?"+tE(r.args[0].query).toString())),p=nE(p),new URL(p)}if(l==="ws"){const p=R5(r.args[0]&&r.args[0].param?Vy(f,r.args[0].param):f,"ws"),x=new URL(p),y=(g=r.args[0])==null?void 0:g.query;return y&&Object.entries(y).forEach(([w,S])=>{Array.isArray(S)?S.forEach(N=>x.searchParams.append(w,N)):x.searchParams.set(w,S)}),((...w)=>(e==null?void 0:e.webSocket)!==void 0&&typeof e.webSocket=="function"?e.webSocket(...w):new WebSocket(...w))(x.toString())}const h=new M5(f,l);if(l){e??(e={});const p=rE(e,{...r.args[1]});return h.fetch(r.args[0],p)}return h},[]),I5=class extends Error{constructor(t,e){super(`SSE Error: ${t}`),this.status=t,this.body=e,this.name="SSEError"}};async function*L5(t,e){var n;if(!t.ok){const h=t.headers.get("content-type");let g;try{h&&h.includes("application/json")?g=await t.json():g=await t.text()}catch{g="Unknown error"}throw new I5(t.status,g)}const r=(n=t.body)==null?void 0:n.getReader();if(!r)throw new Error("Response body is null");const s=new globalThis.TextDecoder;let a="";const l=e==null?void 0:e.signal;let u=!1;const f=()=>{u=!0,r.cancel().catch(()=>{})};if(l){if(l.aborted){r.cancel().catch(()=>{});return}l.addEventListener("abort",f)}try{for(;;){if(u||l!=null&&l.aborted)return;const h=a.split(`
|
|
29
|
-
|
|
30
|
-
`);if(h.length>1){const x=h.shift();a=h.join(`
|
|
31
|
-
|
|
32
|
-
`);const y=uj(x);y&&(yield y);continue}const{done:g,value:p}=await r.read();if(g){if(a.trim()){const x=uj(a);x&&(yield x)}return}a+=s.decode(p,{stream:!0}).replace(/\r\n/g,`
|
|
33
|
-
`)}}finally{l&&l.removeEventListener("abort",f),r.cancel().catch(()=>{})}}async function*P5(t,e){const n=await t;yield*L5(n,e)}async function*$5(t,e){const n=P5(t,e);for await(const r of n)if(r.data)try{const s=JSON.parse(r.data);r.event&&(s.name=r.event),yield s}catch{}}function uj(t){const e=t.split(`
|
|
34
|
-
`).map(s=>s.replace(/\r$/,"")),n={};let r=!1;for(const s of e)if(!s.startsWith(":"))if(s.startsWith("data: ")){const a=s.slice(6);n.data=n.data?n.data+`
|
|
35
|
-
`+a:a,r=!0}else s.startsWith("event: ")?n.event=s.slice(7):s.startsWith("id: ")?n.id=s.slice(4):s.startsWith("retry: ")&&(n.retry=parseInt(s.slice(7),10));return!r&&!n.event&&!n.id?null:n}function z5(t){const e={};return t.apiKey&&(e.headers={Authorization:`Bearer ${t.apiKey}`}),D5(t.baseUrl,e)}function F5(){if(typeof window>"u")return"http://localhost:3001";const{protocol:t,hostname:e,port:n}=window.location;return`${t}//${e}${n?`:${n}`:""}`}const mt=z5({baseUrl:F5()}),Xe={agents:{all:["agents"],path:["agentPath"]},agent:{config:["agent","config"]},llm:{current:t=>["llm","current",t??null],catalog:["llm","catalog"]},sessions:{all:["sessions"],detail:t=>["sessions","detail",t],history:t=>["sessions","history",t]},search:{messages:(t,e,n)=>["search","messages",t,e,n],sessions:t=>["search","sessions",t]},greeting:t=>["greeting",t??"default"],memories:{all:["memories"]},resources:{all:["resources"]},serverRegistry:t=>["serverRegistry",t],prompts:{all:["prompts"]},servers:{all:["servers"],detail:t=>["servers","detail",t],tools:t=>["servers","tools",t]}};function gx(t){return typeof t=="object"&&t!==null&&"error"in t}function bh(t){return typeof t=="object"&&t!==null&&"content"in t&&Array.isArray(t.content)}function vx(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="text"}function xx(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="image"}function dj(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="audio"}function wh(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="file"}const vo=()=>`msg-${Date.now()}-${Math.random().toString(36).substring(2,9)}`;function B5(t,e){const n=Nc(),r=_.useRef(n),s=An(),{handleApprovalRequest:a,handleApprovalResponse:l}=eE(),[u,f]=_.useState([]),h=_.useCallback((R,z=!0)=>{s.setQueryData(Xe.sessions.all,(D=[])=>D.some(q=>q.id===R)?D.map(q=>q.id===R?{...q,...z&&{messageCount:q.messageCount+1},lastActivity:Date.now()}:q):[{id:R,createdAt:Date.now(),lastActivity:Date.now(),messageCount:1,title:null},...D])},[s]),g=_.useCallback((R,z)=>{s.setQueryData(Xe.sessions.all,(D=[])=>D.map(B=>B.id===R?{...B,title:z}:B))},[s]),p=_.useRef(null),x=_.useRef(!1),y=_.useRef(new Map);_.useEffect(()=>{r.current=n},[n]);const k=_.useCallback((R,z)=>{e.setSessionError(R,z)},[e]),w=_.useCallback((R,z)=>{e.setSessionProcessing(R,z)},[e]),S=_.useCallback((R,z)=>{e.setSessionStatus(R,z)},[e]),N=_.useCallback(R=>e.getSessionAbortController(R),[e]),C=_.useCallback(R=>{e.abortSession(R)},[e]),j=_.useCallback(R=>{if(!R)return!1;const z=t.current;return!!z&&R===z},[t]),A=_.useCallback(R=>{if(!R.sessionId){console.error(`Event missing sessionId: ${JSON.stringify(R)}`);return}if(j(R.sessionId))switch(R.name){case"llm:thinking":w(R.sessionId,!0),S(R.sessionId,"open");break;case"llm:chunk":{const z=R.content||"",D=R.chunkType;f(B=>{if(D==="reasoning"){const q=B[B.length-1];if(q&&q.role==="assistant"){const K={...q,reasoning:(q.reasoning||"")+z,createdAt:Date.now()};return[...B.slice(0,-1),K]}return[...B,{id:vo(),role:"assistant",content:"",reasoning:z,createdAt:Date.now()}]}else{const q=B[B.length-1];if(q&&q.role==="assistant"){const G=(typeof q.content=="string"?q.content:"")+z,F={...q,content:G,createdAt:Date.now()};return[...B.slice(0,-1),F]}return[...B,{id:vo(),role:"assistant",content:z,createdAt:Date.now()}]}});break}case"llm:response":{w(R.sessionId,!1);const z=R.content||"",D=R.tokenUsage,B=R.model,q=R.provider,K=R.router;f(G=>{const F=G[G.length-1];if(F&&F.role==="assistant"){const V={...F,content:typeof z=="string"?z:"",tokenUsage:D,...B&&{model:B},...q&&{provider:q},...K&&{router:K},createdAt:Date.now()};return[...G.slice(0,-1),V]}return G}),h(R.sessionId);break}case"llm:tool-call":{const{toolName:z,args:D,callId:B}=R;f(q=>{const K=q.length,G=[...q,{id:vo(),role:"tool",content:null,toolName:z,toolArgs:D,toolCallId:B,createdAt:Date.now()}];return B&&y.current.set(B,K),G});break}case"llm:tool-result":{const{callId:z,success:D,sanitized:B,toolName:q}=R,K=B;q&&r.current.trackToolCalled({toolName:q,success:D!==!1,sessionId:R.sessionId}),f(G=>{let F=-1;if(z&&y.current.has(z)?(F=y.current.get(z),y.current.delete(z)):F=G.findIndex(M=>M.role==="tool"&&M.toolResult===void 0&&M.toolName===q),F!==-1&&F<G.length){const M={...G[F],toolResult:K,toolResultSuccess:D};return[...G.slice(0,F),M,...G.slice(F+1)]}return G});break}case"approval:request":{const{name:z,...D}=R;a(D);break}case"approval:response":{const{name:z,...D}=R;l(D);break}case"llm:error":{if(x.current){x.current=!1;break}const D=(R.error||{}).message||"Unknown error";k(R.sessionId,{id:vo(),message:D,timestamp:Date.now(),context:R.context,recoverable:R.recoverable,sessionId:R.sessionId,anchorMessageId:p.current||void 0}),w(R.sessionId,!1),S(R.sessionId,"closed");break}case"session:title-updated":{g(R.sessionId,R.title);break}}},[j,w,S,k,a,l,h,g]),I=_.useCallback(async(R,z,D,B,q=!0)=>{if(!B){console.error("Session ID required for sending message");return}C(B);const K=N(B)||new AbortController;w(B,!0),S(B,"connecting");const G=vo();p.current=G,f(F=>[...F,{id:G,role:"user",content:R,createdAt:Date.now(),sessionId:B,imageData:z,fileData:D}]),h(B);try{if(q){const F=mt.api["message-stream"].$post({json:{message:R,sessionId:B,imageData:z,fileData:D}}),M=$5(F,{signal:K.signal});S(B,"open");for await(const V of M)A(V);S(B,"closed"),w(B,!1)}else{const F=await mt.api["message-sync"].$post({json:{message:R,sessionId:B,imageData:z,fileData:D}});if(!F.ok){const V=await F.text();throw new Error(`Failed to send message: ${F.status} ${F.statusText}. ${V}`)}let M;try{M=await F.json()}catch(V){const U=V instanceof Error?V.message:String(V);throw new Error(`Failed to parse response: ${U}`)}f(V=>[...V,{id:vo(),role:"assistant",content:M.response||"",createdAt:Date.now(),sessionId:B,...M.tokenUsage&&{tokenUsage:M.tokenUsage},...M.reasoning&&{reasoning:M.reasoning},...M.model&&{model:M.model},...M.provider&&{provider:M.provider},...M.router&&{router:M.router}}]),S(B,"closed"),w(B,!1),h(B)}}catch(F){if(F instanceof Error&&F.name==="AbortError"){console.log("Stream aborted by user");return}console.error(`Stream error: ${F instanceof Error?F.message:String(F)}`),S(B,"closed"),w(B,!1);const M=F instanceof Error?F.message:"Failed to send message";k(B,{id:vo(),message:M,timestamp:Date.now(),context:"stream",recoverable:!0,sessionId:B,anchorMessageId:G})}},[A,C,N,w,S,k,h]),T=_.useCallback(async R=>{if(R){try{await mt.api.reset.$post({json:{sessionId:R}})}catch(z){console.error(`Failed to reset session: ${z instanceof Error?z.message:String(z)}`)}f([]),k(R,null),p.current=null,y.current.clear(),w(R,!1)}},[k,w]),E=_.useCallback(R=>{R&&(C(R),w(R,!1),S(R,"closed"),y.current.clear(),x.current=!0)},[C,w,S]);return{messages:u,sendMessage:I,reset:T,setMessages:f,cancel:E}}async function U5(t){const e=await mt.api.greeting.$get({query:t?{sessionId:t}:{}});if(!e.ok)throw new Error(`Failed to fetch greeting: ${e.status}`);return(await e.json()).greeting??null}function q5(t){const{data:e=null,isLoading:n,error:r}=Tr({queryKey:Xe.greeting(t),queryFn:()=>U5(t),staleTime:3e5});return{greeting:e,isLoading:n,error:(r==null?void 0:r.message)??null}}var Rt;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const a={};for(const l of s)a[l]=l;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(u=>typeof s[s[u]]!="number"),l={};for(const u of a)l[u]=s[u];return t.objectValues(l)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const l in s)Object.prototype.hasOwnProperty.call(s,l)&&a.push(l);return a},t.find=(s,a)=>{for(const l of s)if(a(l))return l},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,a=" | "){return s.map(l=>typeof l=="string"?`'${l}'`:l).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(Rt||(Rt={}));var fj;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(fj||(fj={}));const Ue=Rt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ca=t=>{switch(typeof t){case"undefined":return Ue.undefined;case"string":return Ue.string;case"number":return Number.isNaN(t)?Ue.nan:Ue.number;case"boolean":return Ue.boolean;case"function":return Ue.function;case"bigint":return Ue.bigint;case"symbol":return Ue.symbol;case"object":return Array.isArray(t)?Ue.array:t===null?Ue.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ue.promise:typeof Map<"u"&&t instanceof Map?Ue.map:typeof Set<"u"&&t instanceof Set?Ue.set:typeof Date<"u"&&t instanceof Date?Ue.date:Ue.object;default:return Ue.unknown}},we=Rt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class qi extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},s=a=>{for(const l of a.issues)if(l.code==="invalid_union")l.unionErrors.map(s);else if(l.code==="invalid_return_type")s(l.returnTypeError);else if(l.code==="invalid_arguments")s(l.argumentsError);else if(l.path.length===0)r._errors.push(n(l));else{let u=r,f=0;for(;f<l.path.length;){const h=l.path[f];f===l.path.length-1?(u[h]=u[h]||{_errors:[]},u[h]._errors.push(n(l))):u[h]=u[h]||{_errors:[]},u=u[h],f++}}};return s(this),r}static assert(e){if(!(e instanceof qi))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Rt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];n[a]=n[a]||[],n[a].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}qi.create=t=>new qi(t);const Ky=(t,e)=>{let n;switch(t.code){case we.invalid_type:t.received===Ue.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case we.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Rt.jsonStringifyReplacer)}`;break;case we.unrecognized_keys:n=`Unrecognized key(s) in object: ${Rt.joinValues(t.keys,", ")}`;break;case we.invalid_union:n="Invalid input";break;case we.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Rt.joinValues(t.options)}`;break;case we.invalid_enum_value:n=`Invalid enum value. Expected ${Rt.joinValues(t.options)}, received '${t.received}'`;break;case we.invalid_arguments:n="Invalid function arguments";break;case we.invalid_return_type:n="Invalid function return type";break;case we.invalid_date:n="Invalid date";break;case we.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Rt.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case we.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case we.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case we.custom:n="Invalid input";break;case we.invalid_intersection_types:n="Intersection results could not be merged";break;case we.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case we.not_finite:n="Number must be finite";break;default:n=e.defaultError,Rt.assertNever(t)}return{message:n}};let H5=Ky;function V5(){return H5}const K5=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,a=[...n,...s.path||[]],l={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let u="";const f=r.filter(h=>!!h).slice().reverse();for(const h of f)u=h(l,{data:e,defaultError:u}).message;return{...s,path:a,message:u}};function Ie(t,e){const n=V5(),r=K5({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Ky?void 0:Ky].filter(s=>!!s)});t.common.issues.push(r)}class vr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return lt;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const a=await s.key,l=await s.value;r.push({key:a,value:l})}return vr.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:a,value:l}=s;if(a.status==="aborted"||l.status==="aborted")return lt;a.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof l.value<"u"||s.alwaysSet)&&(r[a.value]=l.value)}return{status:e.value,value:r}}}const lt=Object.freeze({status:"aborted"}),nd=t=>({status:"dirty",value:t}),ms=t=>({status:"valid",value:t}),hj=t=>t.status==="aborted",mj=t=>t.status==="dirty",hc=t=>t.status==="valid",xm=t=>typeof Promise<"u"&&t instanceof Promise;var Ge;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ge||(Ge={}));class ri{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const pj=(t,e)=>{if(hc(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new qi(t.common.issues);return this._error=n,this._error}}};function gt(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(l,u)=>{const{message:f}=t;return l.code==="invalid_enum_value"?{message:f??u.defaultError}:typeof u.data>"u"?{message:f??r??u.defaultError}:l.code!=="invalid_type"?{message:u.defaultError}:{message:f??n??u.defaultError}},description:s}}class Nt{get description(){return this._def.description}_getType(e){return Ca(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Ca(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new vr,ctx:{common:e.parent.common,data:e.data,parsedType:Ca(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(xm(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ca(e)},s=this._parseSync({data:e,path:r.path,parent:r});return pj(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ca(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:n});return hc(a)?{value:a.value}:{issues:n.common.issues}}catch(a){(s=(r=a==null?void 0:a.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(a=>hc(a)?{value:a.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ca(e)},s=this._parse({data:e,path:r.path,parent:r}),a=await(xm(s)?s:Promise.resolve(s));return pj(r,a)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,a)=>{const l=e(s),u=()=>a.addIssue({code:we.custom,...r(s)});return typeof Promise<"u"&&l instanceof Promise?l.then(f=>f?!0:(u(),!1)):l?!0:(u(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new Mo({schema:this,typeName:ut.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return zi.create(this,this._def)}nullable(){return Do.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ei.create(this)}promise(){return Sm.create(this,this._def)}or(e){return bm.create([this,e],this._def)}and(e){return wm.create(this,e,this._def)}transform(e){return new Mo({...gt(this._def),schema:this,typeName:ut.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new jm({...gt(this._def),innerType:this,defaultValue:n,typeName:ut.ZodDefault})}brand(){return new lE({typeName:ut.ZodBranded,type:this,...gt(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Nm({...gt(this._def),innerType:this,catchValue:n,typeName:ut.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return n0.create(this,e)}readonly(){return Cm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Y5=/^c[^\s-]{8,}$/i,G5=/^[0-9a-z]+$/,Z5=/^[0-9A-HJKMNP-TV-Z]{26}$/i,W5=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Q5=/^[a-z0-9_-]{21}$/i,X5=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,J5=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,eL=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let yx;const nL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,sL=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,iL=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,aL=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,oL=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,iE="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",lL=new RegExp(`^${iE}$`);function aE(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function cL(t){return new RegExp(`^${aE(t)}$`)}function uL(t){let e=`${iE}T${aE(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function dL(t,e){return!!((e==="v4"||!e)&&nL.test(t)||(e==="v6"||!e)&&sL.test(t))}function fL(t,e){if(!X5.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function hL(t,e){return!!((e==="v4"||!e)&&rL.test(t)||(e==="v6"||!e)&&iL.test(t))}class Qs extends Nt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ue.string){const a=this._getOrReturnCtx(e);return Ie(a,{code:we.invalid_type,expected:Ue.string,received:a.parsedType}),lt}const r=new vr;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),Ie(s,{code:we.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),Ie(s,{code:we.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const l=e.data.length>a.value,u=e.data.length<a.value;(l||u)&&(s=this._getOrReturnCtx(e,s),l?Ie(s,{code:we.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):u&&Ie(s,{code:we.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")eL.test(e.data)||(s=this._getOrReturnCtx(e,s),Ie(s,{validation:"email",code:we.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")yx||(yx=new RegExp(tL,"u")),yx.test(e.data)||(s=this._getOrReturnCtx(e,s),Ie(s,{validation:"emoji",code:we.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")W5.test(e.data)||(s=this._getOrReturnCtx(e,s),Ie(s,{validation:"uuid",code:we.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")Q5.test(e.data)||(s=this._getOrReturnCtx(e,s),Ie(s,{validation:"nanoid",code:we.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Y5.test(e.data)||(s=this._getOrReturnCtx(e,s),Ie(s,{validation:"cuid",code:we.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")G5.test(e.data)||(s=this._getOrReturnCtx(e,s),Ie(s,{validation:"cuid2",code:we.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Z5.test(e.data)||(s=this._getOrReturnCtx(e,s),Ie(s,{validation:"ulid",code:we.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),Ie(s,{validation:"url",code:we.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),Ie(s,{validation:"regex",code:we.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),Ie(s,{code:we.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),Ie(s,{code:we.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),Ie(s,{code:we.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?uL(a).test(e.data)||(s=this._getOrReturnCtx(e,s),Ie(s,{code:we.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?lL.test(e.data)||(s=this._getOrReturnCtx(e,s),Ie(s,{code:we.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?cL(a).test(e.data)||(s=this._getOrReturnCtx(e,s),Ie(s,{code:we.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?J5.test(e.data)||(s=this._getOrReturnCtx(e,s),Ie(s,{validation:"duration",code:we.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?dL(e.data,a.version)||(s=this._getOrReturnCtx(e,s),Ie(s,{validation:"ip",code:we.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?fL(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),Ie(s,{validation:"jwt",code:we.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?hL(e.data,a.version)||(s=this._getOrReturnCtx(e,s),Ie(s,{validation:"cidr",code:we.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?aL.test(e.data)||(s=this._getOrReturnCtx(e,s),Ie(s,{validation:"base64",code:we.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?oL.test(e.data)||(s=this._getOrReturnCtx(e,s),Ie(s,{validation:"base64url",code:we.invalid_string,message:a.message}),r.dirty()):Rt.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:we.invalid_string,...Ge.errToObj(r)})}_addCheck(e){return new Qs({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ge.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ge.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ge.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ge.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ge.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ge.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ge.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ge.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ge.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ge.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ge.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ge.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ge.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...Ge.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Ge.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ge.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Ge.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Ge.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Ge.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Ge.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Ge.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Ge.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Ge.errToObj(n)})}nonempty(e){return this.min(1,Ge.errToObj(e))}trim(){return new Qs({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Qs({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Qs({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Qs.create=t=>new Qs({checks:[],typeName:ut.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...gt(t)});function mL(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,a=Number.parseInt(t.toFixed(s).replace(".","")),l=Number.parseInt(e.toFixed(s).replace(".",""));return a%l/10**s}class To extends Nt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ue.number){const a=this._getOrReturnCtx(e);return Ie(a,{code:we.invalid_type,expected:Ue.number,received:a.parsedType}),lt}let r;const s=new vr;for(const a of this._def.checks)a.kind==="int"?Rt.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{code:we.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),Ie(r,{code:we.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),Ie(r,{code:we.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?mL(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),Ie(r,{code:we.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{code:we.not_finite,message:a.message}),s.dirty()):Rt.assertNever(a);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Ge.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ge.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ge.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ge.toString(n))}setLimit(e,n,r,s){return new To({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ge.toString(s)}]})}_addCheck(e){return new To({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ge.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ge.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ge.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ge.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ge.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ge.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Ge.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ge.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ge.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Rt.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}To.create=t=>new To({checks:[],typeName:ut.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...gt(t)});class Ao extends Nt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Ue.bigint)return this._getInvalidInput(e);let r;const s=new vr;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),Ie(r,{code:we.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),Ie(r,{code:we.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Ie(r,{code:we.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):Rt.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return Ie(n,{code:we.invalid_type,expected:Ue.bigint,received:n.parsedType}),lt}gte(e,n){return this.setLimit("min",e,!0,Ge.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ge.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ge.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ge.toString(n))}setLimit(e,n,r,s){return new Ao({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ge.toString(s)}]})}_addCheck(e){return new Ao({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ge.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ge.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ge.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ge.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ge.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Ao.create=t=>new Ao({checks:[],typeName:ut.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...gt(t)});class ym extends Nt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ue.boolean){const r=this._getOrReturnCtx(e);return Ie(r,{code:we.invalid_type,expected:Ue.boolean,received:r.parsedType}),lt}return ms(e.data)}}ym.create=t=>new ym({typeName:ut.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...gt(t)});class mc extends Nt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ue.date){const a=this._getOrReturnCtx(e);return Ie(a,{code:we.invalid_type,expected:Ue.date,received:a.parsedType}),lt}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return Ie(a,{code:we.invalid_date}),lt}const r=new vr;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),Ie(s,{code:we.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),Ie(s,{code:we.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):Rt.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new mc({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Ge.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Ge.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}mc.create=t=>new mc({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:ut.ZodDate,...gt(t)});class gj extends Nt{_parse(e){if(this._getType(e)!==Ue.symbol){const r=this._getOrReturnCtx(e);return Ie(r,{code:we.invalid_type,expected:Ue.symbol,received:r.parsedType}),lt}return ms(e.data)}}gj.create=t=>new gj({typeName:ut.ZodSymbol,...gt(t)});class Yy extends Nt{_parse(e){if(this._getType(e)!==Ue.undefined){const r=this._getOrReturnCtx(e);return Ie(r,{code:we.invalid_type,expected:Ue.undefined,received:r.parsedType}),lt}return ms(e.data)}}Yy.create=t=>new Yy({typeName:ut.ZodUndefined,...gt(t)});class Gy extends Nt{_parse(e){if(this._getType(e)!==Ue.null){const r=this._getOrReturnCtx(e);return Ie(r,{code:we.invalid_type,expected:Ue.null,received:r.parsedType}),lt}return ms(e.data)}}Gy.create=t=>new Gy({typeName:ut.ZodNull,...gt(t)});class Zy extends Nt{constructor(){super(...arguments),this._any=!0}_parse(e){return ms(e.data)}}Zy.create=t=>new Zy({typeName:ut.ZodAny,...gt(t)});class vj extends Nt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ms(e.data)}}vj.create=t=>new vj({typeName:ut.ZodUnknown,...gt(t)});class Ba extends Nt{_parse(e){const n=this._getOrReturnCtx(e);return Ie(n,{code:we.invalid_type,expected:Ue.never,received:n.parsedType}),lt}}Ba.create=t=>new Ba({typeName:ut.ZodNever,...gt(t)});class xj extends Nt{_parse(e){if(this._getType(e)!==Ue.undefined){const r=this._getOrReturnCtx(e);return Ie(r,{code:we.invalid_type,expected:Ue.void,received:r.parsedType}),lt}return ms(e.data)}}xj.create=t=>new xj({typeName:ut.ZodVoid,...gt(t)});class ei extends Nt{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==Ue.array)return Ie(n,{code:we.invalid_type,expected:Ue.array,received:n.parsedType}),lt;if(s.exactLength!==null){const l=n.data.length>s.exactLength.value,u=n.data.length<s.exactLength.value;(l||u)&&(Ie(n,{code:l?we.too_big:we.too_small,minimum:u?s.exactLength.value:void 0,maximum:l?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(Ie(n,{code:we.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(Ie(n,{code:we.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((l,u)=>s.type._parseAsync(new ri(n,l,n.path,u)))).then(l=>vr.mergeArray(r,l));const a=[...n.data].map((l,u)=>s.type._parseSync(new ri(n,l,n.path,u)));return vr.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new ei({...this._def,minLength:{value:e,message:Ge.toString(n)}})}max(e,n){return new ei({...this._def,maxLength:{value:e,message:Ge.toString(n)}})}length(e,n){return new ei({...this._def,exactLength:{value:e,message:Ge.toString(n)}})}nonempty(e){return this.min(1,e)}}ei.create=(t,e)=>new ei({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ut.ZodArray,...gt(e)});function Fl(t){if(t instanceof En){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=zi.create(Fl(r))}return new En({...t._def,shape:()=>e})}else return t instanceof ei?new ei({...t._def,type:Fl(t.element)}):t instanceof zi?zi.create(Fl(t.unwrap())):t instanceof Do?Do.create(Fl(t.unwrap())):t instanceof Oo?Oo.create(t.items.map(e=>Fl(e))):t}class En extends Nt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Rt.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Ue.object){const h=this._getOrReturnCtx(e);return Ie(h,{code:we.invalid_type,expected:Ue.object,received:h.parsedType}),lt}const{status:r,ctx:s}=this._processInputParams(e),{shape:a,keys:l}=this._getCached(),u=[];if(!(this._def.catchall instanceof Ba&&this._def.unknownKeys==="strip"))for(const h in s.data)l.includes(h)||u.push(h);const f=[];for(const h of l){const g=a[h],p=s.data[h];f.push({key:{status:"valid",value:h},value:g._parse(new ri(s,p,s.path,h)),alwaysSet:h in s.data})}if(this._def.catchall instanceof Ba){const h=this._def.unknownKeys;if(h==="passthrough")for(const g of u)f.push({key:{status:"valid",value:g},value:{status:"valid",value:s.data[g]}});else if(h==="strict")u.length>0&&(Ie(s,{code:we.unrecognized_keys,keys:u}),r.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const h=this._def.catchall;for(const g of u){const p=s.data[g];f.push({key:{status:"valid",value:g},value:h._parse(new ri(s,p,s.path,g)),alwaysSet:g in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const h=[];for(const g of f){const p=await g.key,x=await g.value;h.push({key:p,value:x,alwaysSet:g.alwaysSet})}return h}).then(h=>vr.mergeObjectSync(r,h)):vr.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(e){return Ge.errToObj,new En({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var a,l;const s=((l=(a=this._def).errorMap)==null?void 0:l.call(a,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:Ge.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new En({...this._def,unknownKeys:"strip"})}passthrough(){return new En({...this._def,unknownKeys:"passthrough"})}extend(e){return new En({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new En({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ut.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new En({...this._def,catchall:e})}pick(e){const n={};for(const r of Rt.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new En({...this._def,shape:()=>n})}omit(e){const n={};for(const r of Rt.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new En({...this._def,shape:()=>n})}deepPartial(){return Fl(this)}partial(e){const n={};for(const r of Rt.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new En({...this._def,shape:()=>n})}required(e){const n={};for(const r of Rt.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof zi;)a=a._def.innerType;n[r]=a}return new En({...this._def,shape:()=>n})}keyof(){return oE(Rt.objectKeys(this.shape))}}En.create=(t,e)=>new En({shape:()=>t,unknownKeys:"strip",catchall:Ba.create(),typeName:ut.ZodObject,...gt(e)});En.strictCreate=(t,e)=>new En({shape:()=>t,unknownKeys:"strict",catchall:Ba.create(),typeName:ut.ZodObject,...gt(e)});En.lazycreate=(t,e)=>new En({shape:t,unknownKeys:"strip",catchall:Ba.create(),typeName:ut.ZodObject,...gt(e)});class bm extends Nt{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(a){for(const u of a)if(u.result.status==="valid")return u.result;for(const u of a)if(u.result.status==="dirty")return n.common.issues.push(...u.ctx.common.issues),u.result;const l=a.map(u=>new qi(u.ctx.common.issues));return Ie(n,{code:we.invalid_union,unionErrors:l}),lt}if(n.common.async)return Promise.all(r.map(async a=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(s);{let a;const l=[];for(const f of r){const h={...n,common:{...n.common,issues:[]},parent:null},g=f._parseSync({data:n.data,path:n.path,parent:h});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:h}),h.common.issues.length&&l.push(h.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const u=l.map(f=>new qi(f));return Ie(n,{code:we.invalid_union,unionErrors:u}),lt}}get options(){return this._def.options}}bm.create=(t,e)=>new bm({options:t,typeName:ut.ZodUnion,...gt(e)});const Ti=t=>t instanceof Qy?Ti(t.schema):t instanceof Mo?Ti(t.innerType()):t instanceof km?[t.value]:t instanceof Ro?t.options:t instanceof Xy?Rt.objectValues(t.enum):t instanceof jm?Ti(t._def.innerType):t instanceof Yy?[void 0]:t instanceof Gy?[null]:t instanceof zi?[void 0,...Ti(t.unwrap())]:t instanceof Do?[null,...Ti(t.unwrap())]:t instanceof lE||t instanceof Cm?Ti(t.unwrap()):t instanceof Nm?Ti(t._def.innerType):[];class t0 extends Nt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ue.object)return Ie(n,{code:we.invalid_type,expected:Ue.object,received:n.parsedType}),lt;const r=this.discriminator,s=n.data[r],a=this.optionsMap.get(s);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(Ie(n,{code:we.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),lt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const a of n){const l=Ti(a.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const u of l){if(s.has(u))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(u)}`);s.set(u,a)}}return new t0({typeName:ut.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...gt(r)})}}function Wy(t,e){const n=Ca(t),r=Ca(e);if(t===e)return{valid:!0,data:t};if(n===Ue.object&&r===Ue.object){const s=Rt.objectKeys(e),a=Rt.objectKeys(t).filter(u=>s.indexOf(u)!==-1),l={...t,...e};for(const u of a){const f=Wy(t[u],e[u]);if(!f.valid)return{valid:!1};l[u]=f.data}return{valid:!0,data:l}}else if(n===Ue.array&&r===Ue.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const l=t[a],u=e[a],f=Wy(l,u);if(!f.valid)return{valid:!1};s.push(f.data)}return{valid:!0,data:s}}else return n===Ue.date&&r===Ue.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class wm extends Nt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(a,l)=>{if(hj(a)||hj(l))return lt;const u=Wy(a.value,l.value);return u.valid?((mj(a)||mj(l))&&n.dirty(),{status:n.value,value:u.data}):(Ie(r,{code:we.invalid_intersection_types}),lt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,l])=>s(a,l)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}wm.create=(t,e,n)=>new wm({left:t,right:e,typeName:ut.ZodIntersection,...gt(n)});class Oo extends Nt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ue.array)return Ie(r,{code:we.invalid_type,expected:Ue.array,received:r.parsedType}),lt;if(r.data.length<this._def.items.length)return Ie(r,{code:we.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),lt;!this._def.rest&&r.data.length>this._def.items.length&&(Ie(r,{code:we.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const a=[...r.data].map((l,u)=>{const f=this._def.items[u]||this._def.rest;return f?f._parse(new ri(r,l,r.path,u)):null}).filter(l=>!!l);return r.common.async?Promise.all(a).then(l=>vr.mergeArray(n,l)):vr.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new Oo({...this._def,rest:e})}}Oo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Oo({items:t,typeName:ut.ZodTuple,rest:null,...gt(e)})};class _m extends Nt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ue.object)return Ie(r,{code:we.invalid_type,expected:Ue.object,received:r.parsedType}),lt;const s=[],a=this._def.keyType,l=this._def.valueType;for(const u in r.data)s.push({key:a._parse(new ri(r,u,r.path,u)),value:l._parse(new ri(r,r.data[u],r.path,u)),alwaysSet:u in r.data});return r.common.async?vr.mergeObjectAsync(n,s):vr.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Nt?new _m({keyType:e,valueType:n,typeName:ut.ZodRecord,...gt(r)}):new _m({keyType:Qs.create(),valueType:e,typeName:ut.ZodRecord,...gt(n)})}}class yj extends Nt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ue.map)return Ie(r,{code:we.invalid_type,expected:Ue.map,received:r.parsedType}),lt;const s=this._def.keyType,a=this._def.valueType,l=[...r.data.entries()].map(([u,f],h)=>({key:s._parse(new ri(r,u,r.path,[h,"key"])),value:a._parse(new ri(r,f,r.path,[h,"value"]))}));if(r.common.async){const u=new Map;return Promise.resolve().then(async()=>{for(const f of l){const h=await f.key,g=await f.value;if(h.status==="aborted"||g.status==="aborted")return lt;(h.status==="dirty"||g.status==="dirty")&&n.dirty(),u.set(h.value,g.value)}return{status:n.value,value:u}})}else{const u=new Map;for(const f of l){const h=f.key,g=f.value;if(h.status==="aborted"||g.status==="aborted")return lt;(h.status==="dirty"||g.status==="dirty")&&n.dirty(),u.set(h.value,g.value)}return{status:n.value,value:u}}}}yj.create=(t,e,n)=>new yj({valueType:e,keyType:t,typeName:ut.ZodMap,...gt(n)});class _d extends Nt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ue.set)return Ie(r,{code:we.invalid_type,expected:Ue.set,received:r.parsedType}),lt;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(Ie(r,{code:we.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(Ie(r,{code:we.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const a=this._def.valueType;function l(f){const h=new Set;for(const g of f){if(g.status==="aborted")return lt;g.status==="dirty"&&n.dirty(),h.add(g.value)}return{status:n.value,value:h}}const u=[...r.data.values()].map((f,h)=>a._parse(new ri(r,f,r.path,h)));return r.common.async?Promise.all(u).then(f=>l(f)):l(u)}min(e,n){return new _d({...this._def,minSize:{value:e,message:Ge.toString(n)}})}max(e,n){return new _d({...this._def,maxSize:{value:e,message:Ge.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}_d.create=(t,e)=>new _d({valueType:t,minSize:null,maxSize:null,typeName:ut.ZodSet,...gt(e)});class Qy extends Nt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Qy.create=(t,e)=>new Qy({getter:t,typeName:ut.ZodLazy,...gt(e)});class km extends Nt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Ie(n,{received:n.data,code:we.invalid_literal,expected:this._def.value}),lt}return{status:"valid",value:e.data}}get value(){return this._def.value}}km.create=(t,e)=>new km({value:t,typeName:ut.ZodLiteral,...gt(e)});function oE(t,e){return new Ro({values:t,typeName:ut.ZodEnum,...gt(e)})}class Ro extends Nt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return Ie(n,{expected:Rt.joinValues(r),received:n.parsedType,code:we.invalid_type}),lt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return Ie(n,{received:n.data,code:we.invalid_enum_value,options:r}),lt}return ms(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Ro.create(e,{...this._def,...n})}exclude(e,n=this._def){return Ro.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Ro.create=oE;class Xy extends Nt{_parse(e){const n=Rt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ue.string&&r.parsedType!==Ue.number){const s=Rt.objectValues(n);return Ie(r,{expected:Rt.joinValues(s),received:r.parsedType,code:we.invalid_type}),lt}if(this._cache||(this._cache=new Set(Rt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=Rt.objectValues(n);return Ie(r,{received:r.data,code:we.invalid_enum_value,options:s}),lt}return ms(e.data)}get enum(){return this._def.values}}Xy.create=(t,e)=>new Xy({values:t,typeName:ut.ZodNativeEnum,...gt(e)});class Sm extends Nt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ue.promise&&n.common.async===!1)return Ie(n,{code:we.invalid_type,expected:Ue.promise,received:n.parsedType}),lt;const r=n.parsedType===Ue.promise?n.data:Promise.resolve(n.data);return ms(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Sm.create=(t,e)=>new Sm({type:t,typeName:ut.ZodPromise,...gt(e)});class Mo extends Nt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:l=>{Ie(r,l),l.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const l=s.transform(r.data,a);if(r.common.async)return Promise.resolve(l).then(async u=>{if(n.value==="aborted")return lt;const f=await this._def.schema._parseAsync({data:u,path:r.path,parent:r});return f.status==="aborted"?lt:f.status==="dirty"||n.value==="dirty"?nd(f.value):f});{if(n.value==="aborted")return lt;const u=this._def.schema._parseSync({data:l,path:r.path,parent:r});return u.status==="aborted"?lt:u.status==="dirty"||n.value==="dirty"?nd(u.value):u}}if(s.type==="refinement"){const l=u=>{const f=s.refinement(u,a);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(r.common.async===!1){const u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return u.status==="aborted"?lt:(u.status==="dirty"&&n.dirty(),l(u.value),{status:n.value,value:u.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>u.status==="aborted"?lt:(u.status==="dirty"&&n.dirty(),l(u.value).then(()=>({status:n.value,value:u.value}))))}if(s.type==="transform")if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!hc(l))return lt;const u=s.transform(l.value,a);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:u}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>hc(l)?Promise.resolve(s.transform(l.value,a)).then(u=>({status:n.value,value:u})):lt);Rt.assertNever(s)}}Mo.create=(t,e,n)=>new Mo({schema:t,typeName:ut.ZodEffects,effect:e,...gt(n)});Mo.createWithPreprocess=(t,e,n)=>new Mo({schema:e,effect:{type:"preprocess",transform:t},typeName:ut.ZodEffects,...gt(n)});class zi extends Nt{_parse(e){return this._getType(e)===Ue.undefined?ms(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}zi.create=(t,e)=>new zi({innerType:t,typeName:ut.ZodOptional,...gt(e)});class Do extends Nt{_parse(e){return this._getType(e)===Ue.null?ms(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Do.create=(t,e)=>new Do({innerType:t,typeName:ut.ZodNullable,...gt(e)});class jm extends Nt{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Ue.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}jm.create=(t,e)=>new jm({innerType:t,typeName:ut.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...gt(e)});class Nm extends Nt{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return xm(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new qi(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new qi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Nm.create=(t,e)=>new Nm({innerType:t,typeName:ut.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...gt(e)});class bj extends Nt{_parse(e){if(this._getType(e)!==Ue.nan){const r=this._getOrReturnCtx(e);return Ie(r,{code:we.invalid_type,expected:Ue.nan,received:r.parsedType}),lt}return{status:"valid",value:e.data}}}bj.create=t=>new bj({typeName:ut.ZodNaN,...gt(t)});class lE extends Nt{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class n0 extends Nt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?lt:a.status==="dirty"?(n.dirty(),nd(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?lt:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new n0({in:e,out:n,typeName:ut.ZodPipeline})}}class Cm extends Nt{_parse(e){const n=this._def.innerType._parse(e),r=s=>(hc(s)&&(s.value=Object.freeze(s.value)),s);return xm(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Cm.create=(t,e)=>new Cm({innerType:t,typeName:ut.ZodReadonly,...gt(e)});var ut;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ut||(ut={}));const ls=Qs.create,nr=To.create;Ao.create;const pL=ym.create;mc.create;const cE=Zy.create;Ba.create;const Em=ei.create,Ls=En.create;bm.create;const Qm=t0.create;wm.create;Oo.create;const Cc=_m.create,ai=km.create,pc=Ro.create;Sm.create;zi.create;Do.create;const r0={string:(t=>Qs.create({...t,coerce:!0})),number:(t=>To.create({...t,coerce:!0})),boolean:(t=>ym.create({...t,coerce:!0})),bigint:(t=>Ao.create({...t,coerce:!0})),date:(t=>mc.create({...t,coerce:!0}))};var Xm=(t=>(t.LLM="llm",t.AGENT="agent",t.CONFIG="config",t.CONTEXT="context",t.SESSION="session",t.MCP="mcp",t.TOOLS="tools",t.STORAGE="storage",t.LOGGER="logger",t.SYSTEM_PROMPT="system_prompt",t.RESOURCE="resource",t.PROMPT="prompt",t.MEMORY="memory",t.PLUGIN="plugin",t.FILESYSTEM="filesystem",t.PROCESS="process",t.TELEMETRY="telemetry",t))(Xm||{}),Jm=(t=>(t.USER="user",t.NOT_FOUND="not_found",t.FORBIDDEN="forbidden",t.TIMEOUT="timeout",t.CONFLICT="conflict",t.RATE_LIMIT="rate_limit",t.SYSTEM="system",t.THIRD_PARTY="third_party",t.UNKNOWN="unknown",t))(Jm||{}),gL={};ls().transform(t=>t.trim()).refine(t=>t.length>0,{message:"Required"});function vL(t){try{const e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}ls().transform(t=>t.trim()).refine(t=>t===""||vL(t),{message:"Invalid URL"}).transform(t=>t===""?void 0:t).optional();const Fi=t=>ls().transform(e=>{if(typeof e!="string")return"";const n=t??gL;return e.replace(/\$([A-Z_][A-Z0-9_]*)|\${([A-Z_][A-Z0-9_]*)}/gi,(s,a,l)=>n[a||l]??"").trim()}),uE=t=>Fi(t).refine(e=>{try{const n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}},{message:"Invalid URL"});function cd(t){return t!=null&&t.startsWith("audio/")?"audio":t!=null&&t.startsWith("video/")?"video":"binary"}function xL(t){return t!=null&&t.startsWith("image/")?"image":t!=null&&t.startsWith("audio/")?"audio":t!=null&&t.startsWith("video/")?"video":"binary"}const Kh=["openai","openai-compatible","anthropic","google","groq","xai","cohere"],yL=["vercel","in-built"];var dE=(t=>(t.SCHEMA_VALIDATION="mcp_schema_validation",t.COMMAND_MISSING="mcp_command_missing",t.DUPLICATE_NAME="mcp_duplicate_name",t.CONNECTION_FAILED="mcp_connection_failed",t.PROTOCOL_ERROR="mcp_protocol_error",t.SERVER_NOT_FOUND="mcp_server_not_found",t.TOOL_NOT_FOUND="mcp_tool_not_found",t.PROMPT_NOT_FOUND="mcp_prompt_not_found",t.RESOURCE_NOT_FOUND="mcp_resource_not_found",t))(dE||{}),fE={};const bL=["stdio","sse","http"],ep=["strict","lenient"],tp="lenient",wL=Ls({type:ai("stdio"),command:Fi().superRefine((t,e)=>{t.length===0&&e.addIssue({code:we.custom,message:"Stdio server requires a non-empty command",params:{code:dE.COMMAND_MISSING,scope:Xm.MCP,type:Jm.USER}})}),args:Em(Fi()).default([]).describe("Array of arguments for the command (e.g., ['script.js'])"),env:Cc(Fi()).default({}).describe("Optional environment variables for the server process"),timeout:r0.number().int().positive().default(3e4),connectionMode:pc(ep).default(tp)}).strict(),_L=Ls({type:ai("sse"),url:uE(fE).describe("URL for the SSE server endpoint"),headers:Cc(Fi()).default({}),timeout:r0.number().int().positive().default(3e4),connectionMode:pc(ep).default(tp)}).strict(),kL=Ls({type:ai("http"),url:uE(fE).describe("URL for the HTTP server"),headers:Cc(Fi()).default({}),timeout:r0.number().int().positive().default(3e4),connectionMode:pc(ep).default(tp)}).strict(),SL=Qm("type",[wL,_L,kL]).superRefine((t,e)=>{}).brand();Cc(SL).describe("A dictionary of server configurations, keyed by server name").brand();var s0=(t=>(t.MANAGER_NOT_INITIALIZED="storage_manager_not_initialized",t.MANAGER_NOT_CONNECTED="storage_manager_not_connected",t.DEPENDENCY_NOT_INSTALLED="storage_dependency_not_installed",t.CONNECTION_FAILED="storage_connection_failed",t.CONNECTION_CONFIG_MISSING="storage_connection_config_missing",t.READ_FAILED="storage_read_failed",t.WRITE_FAILED="storage_write_failed",t.DELETE_FAILED="storage_delete_failed",t.MIGRATION_FAILED="storage_migration_failed",t.DATABASE_INVALID_CONFIG="storage_database_invalid_config",t.BLOB_INVALID_CONFIG="BLOB_INVALID_CONFIG",t.BLOB_SIZE_EXCEEDED="BLOB_SIZE_EXCEEDED",t.BLOB_TOTAL_SIZE_EXCEEDED="BLOB_TOTAL_SIZE_EXCEEDED",t.BLOB_INVALID_INPUT="BLOB_INVALID_INPUT",t.BLOB_ENCODING_ERROR="BLOB_ENCODING_ERROR",t.BLOB_NOT_FOUND="BLOB_NOT_FOUND",t.BLOB_INVALID_REFERENCE="BLOB_INVALID_REFERENCE",t.BLOB_ACCESS_DENIED="BLOB_ACCESS_DENIED",t.BLOB_CORRUPTED="BLOB_CORRUPTED",t.BLOB_BACKEND_NOT_CONNECTED="BLOB_BACKEND_NOT_CONNECTED",t.BLOB_BACKEND_UNAVAILABLE="BLOB_BACKEND_UNAVAILABLE",t.BLOB_CLEANUP_FAILED="BLOB_CLEANUP_FAILED",t.BLOB_OPERATION_FAILED="BLOB_OPERATION_FAILED",t))(s0||{});const jL=["in-memory","redis"],hE=Ls({maxConnections:nr().int().positive().optional().describe("Maximum connections"),idleTimeoutMillis:nr().int().positive().optional().describe("Idle timeout in milliseconds"),connectionTimeoutMillis:nr().int().positive().optional().describe("Connection timeout in milliseconds"),options:Cc(cE()).optional().describe("Backend-specific options")}),NL=hE.extend({type:ai("in-memory")}).strict(),CL=hE.extend({type:ai("redis"),url:Fi().optional().describe("Redis connection URL (redis://...)"),host:ls().optional().describe("Redis host"),port:nr().int().positive().optional().describe("Redis port"),password:ls().optional().describe("Redis password"),database:nr().int().nonnegative().optional().describe("Redis database number")}).strict(),EL=Qm("type",[NL,CL],{errorMap:(t,e)=>t.code===we.invalid_union_discriminator?{message:"Invalid cache type. Expected 'in-memory' or 'redis'."}:{message:e.defaultError}}).describe("Cache configuration").superRefine((t,e)=>{t.type==="redis"&&!t.url&&!t.host&&e.addIssue({code:we.custom,message:"Redis cache requires either 'url' or 'host' to be specified",path:["url"],params:{code:s0.CONNECTION_CONFIG_MISSING,scope:Xm.STORAGE,type:Jm.USER}})}),TL=["in-memory","sqlite","postgres"],i0=Ls({maxConnections:nr().int().positive().optional().describe("Maximum connections"),idleTimeoutMillis:nr().int().positive().optional().describe("Idle timeout in milliseconds"),connectionTimeoutMillis:nr().int().positive().optional().describe("Connection timeout in milliseconds"),options:Cc(cE()).optional().describe("Backend-specific options")}),AL=i0.extend({type:ai("in-memory")}).strict(),OL=i0.extend({type:ai("sqlite"),path:ls().describe("SQLite database file path (required for SQLite - CLI enrichment provides per-agent path)")}).strict(),RL=i0.extend({type:ai("postgres"),url:Fi().optional().describe("PostgreSQL connection URL (postgresql://...)"),connectionString:Fi().optional().describe("PostgreSQL connection string"),host:ls().optional().describe("PostgreSQL host"),port:nr().int().positive().optional().describe("PostgreSQL port"),database:ls().optional().describe("PostgreSQL database name"),password:ls().optional().describe("PostgreSQL password")}).strict(),ML=Qm("type",[AL,OL,RL],{errorMap:(t,e)=>t.code===we.invalid_union_discriminator?{message:"Invalid database type. Expected 'in-memory', 'sqlite', or 'postgres'."}:{message:e.defaultError}}).describe("Database configuration").superRefine((t,e)=>{t.type==="postgres"&&!t.url&&!t.connectionString&&!t.host&&e.addIssue({code:we.custom,message:"PostgreSQL database requires one of 'url', 'connectionString', or 'host' to be specified",path:["url"],params:{code:s0.CONNECTION_CONFIG_MISSING,scope:Xm.STORAGE,type:Jm.USER}})}),DL=Ls({type:ai("in-memory").describe("Blob store type identifier"),maxBlobSize:nr().int().positive().optional().default(10*1024*1024).describe("Maximum size per blob in bytes"),maxTotalSize:nr().int().positive().optional().default(100*1024*1024).describe("Maximum total storage size in bytes")}).strict(),IL=Ls({type:ai("local").describe("Blob store type identifier"),storePath:ls().describe("Blob storage directory path (required for local storage - CLI enrichment provides per-agent default)"),maxBlobSize:nr().int().positive().optional().default(50*1024*1024).describe("Maximum size per blob in bytes"),maxTotalSize:nr().int().positive().optional().default(1024*1024*1024).describe("Maximum total storage size in bytes"),cleanupAfterDays:nr().int().positive().optional().default(30).describe("Auto-cleanup blobs older than N days")}).strict(),LL=Qm("type",[DL,IL],{errorMap:(t,e)=>t.code===we.invalid_union_discriminator?{message:"Invalid blob store type. Expected 'in-memory' or 'local'."}:{message:e.defaultError}}).describe("Blob store configuration");Ls({cache:EL.describe("Cache configuration (fast, ephemeral)"),database:ML.describe("Database configuration (persistent, reliable)"),blob:LL.describe("Blob store configuration (for large, unstructured data)")}).strict().describe("Storage configuration with cache, database, and blob store").brand();const wj=["search_history","ask_user","read_file","glob_files","grep_content","write_file","edit_file","bash_exec","bash_output","kill_process","delegate_to_url"],mE=["manual","auto-approve","auto-deny"],pE=["memory","storage"],gE="auto-approve",vE="storage";Em(pc(wj).describe("Available internal tool names")).default([]).describe(`Array of internal tool names to enable. Empty array = disabled. Available tools: ${wj.join(", ")}`);const PL=Ls({alwaysAllow:Em(ls()).default([]).describe('Tools that never require approval (low-risk). Use full qualified names (e.g., "internal--ask_user", "mcp--filesystem--read_file")'),alwaysDeny:Em(ls()).default([]).describe('Tools that are always denied (high-risk). Takes precedence over alwaysAllow. Use full qualified names (e.g., "mcp--filesystem--delete_file")')}).strict().default({alwaysAllow:[],alwaysDeny:[]}).describe("Static tool policies for allow/deny lists");Ls({mode:pc(mE).default(gE).describe("Tool confirmation mode: manual (interactive), auto-approve (all tools), auto-deny (no tools)"),timeout:nr().int().positive().default(12e4).describe("Timeout for tool confirmation requests in milliseconds, defaults to 120000ms (2 mins)"),allowedToolsStorage:pc(pE).default(vE).describe("Storage type for remembered tool approvals: memory (session-only) or storage (persistent)"),toolPolicies:PL.describe("Static tool policies for fine-grained allow/deny control. Deny list takes precedence over allow list.")}).strict().describe("Tool confirmation and approval configuration");Ls({enabled:pL().default(!1).describe("Enable elicitation support (ask_user tool and MCP server elicitations). When disabled, elicitation requests will be rejected."),timeout:nr().int().positive().default(12e4).describe("Timeout for elicitation requests in milliseconds, defaults to 120000ms (2 mins)")}).strict().describe("Elicitation configuration for user input requests. Independent from tool confirmation mode, allowing auto-approve for tools while still supporting elicitation.");var ja=(t=>(t.TOOL_CONFIRMATION="tool_confirmation",t.COMMAND_CONFIRMATION="command_confirmation",t.ELICITATION="elicitation",t.CUSTOM="custom",t))(ja||{}),Jy=(t=>(t.APPROVED="approved",t.DENIED="denied",t.CANCELLED="cancelled",t))(Jy||{});const $L=["dateTime","resources"];function zL(t){const e=[],n=new RegExp("(?:^|(?<=\\s))@(?:(<[^>]+>)|([a-zA-Z0-9_-]+):([a-zA-Z0-9._/-]+)|([a-zA-Z0-9._/-]+))(?![a-zA-Z0-9@.])","g");let r;for(;(r=n.exec(t))!==null;){const[s,a,l,u,f]=r;a?e.push({originalRef:s,type:"uri",identifier:a.slice(1,-1)}):l&&u?e.push({originalRef:s,type:"server-scoped",serverName:l,identifier:u}):f&&e.push({originalRef:s,type:"name",identifier:f})}return e}function FL(t,e){const n=t.map(r=>({...r}));for(const r of n)switch(r.type){case"uri":{if(e[r.identifier])r.resourceUri=r.identifier;else{const s=BL(e,r.identifier);s&&(r.resourceUri=s)}break}case"server-scoped":{const s=UL(e,r.serverName,r.identifier);s&&(r.resourceUri=s);break}case"name":{const s=qL(e,r.identifier);s&&(r.resourceUri=s);break}}return n}function BL(t,e){var r,s;const n=e.trim().toLowerCase();for(const[a,l]of Object.entries(t)){const u=typeof((r=l.metadata)==null?void 0:r.originalUri)=="string"?l.metadata.originalUri:void 0;if(u&&u.toLowerCase()===n)return a}for(const[a,l]of Object.entries(t)){const u=typeof((s=l.metadata)==null?void 0:s.originalUri)=="string"?l.metadata.originalUri:void 0;if(u&&u.toLowerCase().includes(n))return a}}function UL(t,e,n){var a;const r=n.trim().toLowerCase(),s=Object.entries(t).filter(([,l])=>l.serverName===e);for(const[l,u]of s){if(!u.name)continue;const f=u.name.trim().toLowerCase();if(f===r||f.includes(r))return l}for(const[l,u]of s){const f=typeof((a=u.metadata)==null?void 0:a.originalUri)=="string"?u.metadata.originalUri:void 0;if(f!=null&&f.toLowerCase().includes(r)||l.toLowerCase().includes(r))return l}}function qL(t,e){var r;const n=e.trim().toLowerCase();for(const[s,a]of Object.entries(t)){if(!a.name)continue;const l=a.name.trim().toLowerCase();if(l===n||l.includes(n))return s}for(const[s,a]of Object.entries(t)){const l=typeof((r=a.metadata)==null?void 0:r.originalUri)=="string"?a.metadata.originalUri:void 0;if(l!=null&&l.toLowerCase().includes(n)||s.toLowerCase().includes(n))return s}}async function _j(t){const e=await mt.api.sessions[":sessionId"].history.$get({param:{sessionId:t}});if(!e.ok)throw new Error("Failed to fetch session history");const r=(await e.json()).history||[];return HL(r,t)}function HL(t,e){const n=[],r=new Map;for(let s=0;s<t.length;s++){const a=t[s],l={id:`session-${e}-${s}`,role:a.role,content:a.content,createdAt:Date.now()-(t.length-s)*1e3,sessionId:e,tokenUsage:a.tokenUsage,reasoning:a.reasoning,model:a.model,router:a.router,provider:a.provider},u=f=>{const h=[];for(const g of f){if(g.type==="image"&&typeof g.image=="string"&&g.image.startsWith("@blob:")){const p=g.image.substring(1);h.push({uri:p,kind:"image",mimeType:g.mimeType??"image/jpeg"})}if(g.type==="file"&&typeof g.data=="string"&&g.data.startsWith("@blob:")){const p=g.data.substring(1),x=g.mimeType??"application/octet-stream",y=xL(x);h.push({uri:p,kind:y,mimeType:x,...g.filename?{filename:g.filename}:{}})}}return h.length>0?h:void 0};if(a.role==="assistant"){a.content&&n.push(l),a.toolCalls&&a.toolCalls.length>0&&a.toolCalls.forEach((f,h)=>{var y,k;let g={};if(f!=null&&f.function)try{g=JSON.parse(f.function.arguments||"{}")}catch(w){console.warn(`Failed to parse toolCall arguments for ${((y=f.function)==null?void 0:y.name)||"unknown"}: ${w}`),g={}}const p=((k=f.function)==null?void 0:k.name)||"unknown",x={id:`session-${e}-${s}-tool-${h}`,role:"tool",content:null,createdAt:Date.now()-(t.length-s)*1e3+h,sessionId:e,toolName:p,toolArgs:g,toolResult:void 0,toolResultMeta:void 0,toolResultSuccess:void 0};typeof f.id=="string"&&f.id.length>0&&r.set(f.id,n.length),n.push(x)});continue}if(a.role==="tool"){const f=typeof a.toolCallId=="string"?a.toolCallId:void 0,h=typeof a.name=="string"?a.name:"unknown",g=Array.isArray(a.content)?a.content:typeof a.content=="string"?[{type:"text",text:a.content}]:[],p=u(g),x={content:g,...p?{resources:p}:{},meta:{toolName:h,toolCallId:f??`tool-${s}`}};if(f&&r.has(f)){const y=r.get(f);n[y]={...n[y],toolResult:x,toolResultMeta:x.meta}}else n.push({...l,role:"tool",content:null,toolName:h,toolResult:x,toolResultMeta:x.meta});continue}n.push(l)}return n}const xE=_.createContext(void 0);function VL({children:t}){const e=Fb(),n=Nc(),r=An(),[s,a]=_.useState(null),[l,u]=_.useState(!0),[f,h]=_.useState(!0),[g,p]=_.useState(!1),[x,y]=_.useState(!1),k=_.useRef(null),w=_.useRef(null),S=_.useRef(null),[N,C]=_.useState(new Map),[j,A]=_.useState(new Set),[I,T]=_.useState(new Map),E=_.useRef(new Map),R=_.useCallback((le,he)=>{C(Ee=>{const De=new Map(Ee);return he?De.set(le,he):De.delete(le),De})},[]),z=_.useCallback((le,he)=>{A(Ee=>{const De=new Set(Ee);return he?De.add(le):De.delete(le),De})},[]),D=_.useCallback((le,he)=>{T(Ee=>{const De=new Map(Ee);return De.set(le,he),De})},[]),B=_.useCallback(le=>{const he=E.current.get(le);if(he)return he;const Ee=new AbortController;return E.current.set(le,Ee),Ee},[]),q=_.useCallback(le=>{const he=E.current.get(le);he&&(he.abort(),E.current.delete(le))},[]),K=s&&N.get(s)||null,G=s?j.has(s):!1,F=s&&I.get(s)||"idle",{messages:M,sendMessage:V,reset:U,setMessages:H,cancel:L}=B5(S,{setSessionError:R,setSessionProcessing:z,setSessionStatus:D,getSessionAbortController:B,abortSession:q}),{data:ne,refetch:ie}=Tr({queryKey:Xe.llm.current(s),queryFn:async()=>{const le=await mt.api.llm.current.$get({query:s?{sessionId:s}:{}});if(!le.ok)throw new Error("Failed to fetch current LLM config");const he=await le.json(),Ee=he.config||he;return{provider:Ee.provider,model:Ee.model,displayName:Ee.displayName,router:Ee.router,baseURL:Ee.baseURL}},enabled:!0,retry:!1}),P=ne??null,{greeting:pe}=q5(s),{mutate:Pe}=On({mutationFn:async le=>{const he=await mt.api.sessions[":sessionId"]["generate-title"].$post({param:{sessionId:le}});if(!he.ok)throw new Error("Failed to generate title");return(await he.json()).title},onSuccess:(le,he)=>{r.invalidateQueries({queryKey:Xe.sessions.all}),r.invalidateQueries({queryKey:Xe.sessions.detail(he)})}}),Ne=_.useCallback(async()=>{var De;const le=await mt.api.sessions.$post({json:{}});if(!le.ok)throw new Error("Failed to create session");const he=await le.json();if(!((De=he.session)!=null&&De.id))throw new Error("Session ID not found in server response");const Ee=he.session.id;return n.trackSessionCreated({sessionId:Ee,trigger:"first_message"}),Ee},[n]),ge=_.useCallback(async(le,he,Ee)=>{let De=s,ve=!1;if(!De&&l){if(x)return;try{y(!0),De=await Ne(),ve=!0,w.current=De,S.current=De,V(le,he,Ee,De,f),e({to:`/chat/${De}`,replace:!0}),setTimeout(()=>{De&&Pe(De)},0)}catch(ue){console.error("Failed to create session:",ue);return}finally{y(!1)}}if(De&&!ve&&V(le,he,Ee,De,f),De){const ue=(P==null?void 0:P.provider)||"unknown",Ce=(P==null?void 0:P.model)||"unknown";n.trackMessageSent({sessionId:De,provider:ue,model:Ce,hasImage:!!he,hasFile:!!Ee,messageLength:le.length})}else console.error("No session available for sending message")},[V,s,l,x,Ne,f,e,n,P,Pe]),Fe=_.useCallback(()=>{if(s){const le=M.filter(he=>he.sessionId===s).length;n.trackConversationReset({sessionId:s,messageCount:le}),U(s)}},[U,s,n,M]),Qe=_.useCallback(()=>{s&&R(s,null)},[s,R]),{data:$e}=Tr({queryKey:Xe.sessions.history(s||""),queryFn:async()=>{if(!s)return[];try{return await _j(s)}catch{return[]}},enabled:!1,retry:!1});_.useEffect(()=>{$e&&s&&H(le=>le.some(Ee=>Ee.sessionId===s)?le:$e)},[$e,s,H]);const Q=_.useCallback(async le=>{try{const he=await r.fetchQuery({queryKey:Xe.sessions.history(le),queryFn:async()=>{try{return await _j(le)}catch{return[]}},retry:!1});H(Ee=>Ee.some(ve=>ve.sessionId===le)?Ee:he)}catch(he){console.error("Error loading session history:",he),H([])}},[H,r]),_e=_.useCallback(async le=>{if(!(le===s||le===k.current||g)){p(!0);try{try{n.trackSessionSwitched({fromSessionId:s,toSessionId:le})}catch(Ee){console.error("Failed to track session switch:",Ee)}const he=w.current===le;he&&(w.current=null),S.current=le,a(le),u(!1),k.current=le,he||await Q(le)}catch(he){throw console.error("Error switching session:",he),he}finally{p(!1)}}},[s,g,Q,n]),Oe=_.useCallback(()=>{S.current=null,a(null),u(!0),H([])},[H]);return c.jsx(xE.Provider,{value:{messages:M,sendMessage:ge,status:F,reset:Fe,currentSessionId:s,switchSession:_e,loadSessionHistory:Q,isWelcomeState:l,returnToWelcome:Oe,isStreaming:f,setStreaming:h,currentLLM:P,refreshCurrentLLM:async()=>{await ie()},processing:G,cancel:L,activeError:K,clearError:Qe,greeting:pe},children:t})}function Ld(){const t=_.useContext(xE);if(!t)throw new Error("useChatContext must be used within a ChatProvider");return t}function KL(){return _.useEffect(()=>{const t=()=>{try{typeof window<"u"&&"speechSynthesis"in window&&window.speechSynthesis.cancel()}catch{}};t();const e=()=>{document.visibilityState==="hidden"&&t()};return window.addEventListener("pagehide",t),window.addEventListener("beforeunload",t),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("pagehide",t),window.removeEventListener("beforeunload",t),document.removeEventListener("visibilitychange",e)}},[]),null}function YL(){return c.jsxs(BC,{children:[c.jsxs(qb,{children:[c.jsx("title",{children:"Dexto Web UI"}),c.jsx("meta",{name:"description",content:"Interactive playground for testing MCP tools and talking to AI agents"})]}),c.jsx(hD,{children:c.jsx(S5,{children:c.jsx(E5,{children:c.jsxs(VL,{children:[c.jsx(KL,{}),c.jsx("div",{className:"flex h-screen w-screen flex-col supports-[height:100svh]:h-[100svh] supports-[height:100dvh]:h-[100dvh]",children:c.jsx(C3,{})})]})})})})]})}const yE=["shift","alt","meta","mod","ctrl","control"],GL={esc:"escape",return:"enter",left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function La(t){return(GL[t.trim()]||t.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function bE(t){return yE.includes(t)}function bx(t,e=","){return t.toLowerCase().split(e)}function wx(t,e="+",n=">",r=!1,s){let a=[],l=!1;t=t.trim(),t.includes(n)?(l=!0,a=t.toLocaleLowerCase().split(n).map(h=>La(h))):a=t.toLocaleLowerCase().split(e).map(h=>La(h));const u={alt:a.includes("alt"),ctrl:a.includes("ctrl")||a.includes("control"),shift:a.includes("shift"),meta:a.includes("meta"),mod:a.includes("mod"),useKey:r},f=a.filter(h=>!yE.includes(h));return{...u,keys:f,description:s,isSequence:l,hotkey:t}}typeof document<"u"&&(document.addEventListener("keydown",t=>{t.code!==void 0&&wE([La(t.code)])}),document.addEventListener("keyup",t=>{t.code!==void 0&&_E([La(t.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{Di.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{Di.clear()},0)}));const Di=new Set;function a0(t){return Array.isArray(t)}function ZL(t,e=","){return(a0(t)?t:t.split(e)).every(n=>Di.has(n.trim().toLowerCase()))}function wE(t){const e=Array.isArray(t)?t:[t];Di.has("meta")&&Di.forEach(n=>!bE(n)&&Di.delete(n.toLowerCase())),e.forEach(n=>Di.add(n.toLowerCase()))}function _E(t){const e=Array.isArray(t)?t:[t];t==="meta"?Di.clear():e.forEach(n=>Di.delete(n.toLowerCase()))}function WL(t,e,n){(typeof n=="function"&&n(t,e)||n===!0)&&t.preventDefault()}function QL(t,e,n){return typeof n=="function"?n(t,e):n===!0||n===void 0}const XL=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"];function JL(t){return kE(t,XL)}function kE(t,e=!1){const{target:n,composed:r}=t;let s,a;return eP(n)&&r?(s=t.composedPath()[0]&&t.composedPath()[0].tagName,a=t.composedPath()[0]&&t.composedPath()[0].role):(s=n&&n.tagName,a=n&&n.role),a0(e)?!!(s&&e&&e.some(l=>l.toLowerCase()===s.toLowerCase()||l===a)):!!(s&&e&&e)}function eP(t){return!!t.tagName&&!t.tagName.startsWith("-")&&t.tagName.includes("-")}function tP(t,e){return t.length===0&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):e?t.some(n=>e.includes(n))||t.includes("*"):!0}const nP=(t,e,n=!1)=>{const{alt:r,meta:s,mod:a,shift:l,ctrl:u,keys:f,useKey:h}=e,{code:g,key:p,ctrlKey:x,metaKey:y,shiftKey:k,altKey:w}=t,S=La(g);if(h&&(f==null?void 0:f.length)===1&&f.includes(p))return!0;if(!(f!=null&&f.includes(S))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(S))return!1;if(!n){if(r!==w&&S!=="alt"||l!==k&&S!=="shift")return!1;if(a){if(!y&&!x)return!1}else if(s!==y&&S!=="meta"&&S!=="os"||u!==x&&S!=="ctrl"&&S!=="control")return!1}return f&&f.length===1&&f.includes(S)?!0:f?ZL(f):!f},rP=_.createContext(void 0),sP=()=>_.useContext(rP);function SE(t,e){return t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(t).length===Object.keys(e).length&&Object.keys(t).reduce((n,r)=>n&&SE(t[r],e[r]),!0):t===e}const iP=_.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),aP=()=>_.useContext(iP);function oP(t){const e=_.useRef(void 0);return SE(e.current,t)||(e.current=t),e.current}const kj=t=>{t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},lP=typeof window<"u"?_.useLayoutEffect:_.useEffect;function fr(t,e,n,r){const s=_.useRef(null),a=_.useRef(!1),l=Array.isArray(n)?Array.isArray(r)?void 0:r:n,u=a0(t)?t.join(l==null?void 0:l.delimiter):t,f=Array.isArray(n)?n:Array.isArray(r)?r:void 0,h=_.useCallback(e,f??[]),g=_.useRef(h);f?g.current=h:g.current=e;const p=oP(l),{activeScopes:x}=aP(),y=sP();return lP(()=>{if((p==null?void 0:p.enabled)===!1||!tP(x,p==null?void 0:p.scopes))return;let k=[],w;const S=(A,I=!1)=>{var T;if(!(JL(A)&&!kE(A,p==null?void 0:p.enableOnFormTags))){if(s.current!==null){const E=s.current.getRootNode();if((E instanceof Document||E instanceof ShadowRoot)&&E.activeElement!==s.current&&!s.current.contains(E.activeElement)){kj(A);return}}(T=A.target)!=null&&T.isContentEditable&&!(p!=null&&p.enableOnContentEditable)||bx(u,p==null?void 0:p.delimiter).forEach(E=>{var z,D,B,q;if(E.includes((p==null?void 0:p.splitKey)??"+")&&E.includes((p==null?void 0:p.sequenceSplitKey)??">")){console.warn(`Hotkey ${E} contains both ${(p==null?void 0:p.splitKey)??"+"} and ${(p==null?void 0:p.sequenceSplitKey)??">"} which is not supported.`);return}const R=wx(E,p==null?void 0:p.splitKey,p==null?void 0:p.sequenceSplitKey,p==null?void 0:p.useKey,p==null?void 0:p.description);if(R.isSequence){w=setTimeout(()=>{k=[]},(p==null?void 0:p.sequenceTimeoutMs)??1e3);const K=R.useKey?A.key:La(A.code);if(bE(K.toLowerCase()))return;k.push(K);const G=(z=R.keys)==null?void 0:z[k.length-1];if(K!==G){k=[],w&&clearTimeout(w);return}k.length===((D=R.keys)==null?void 0:D.length)&&(g.current(A,R),w&&clearTimeout(w),k=[])}else if(nP(A,R,p==null?void 0:p.ignoreModifiers)||(B=R.keys)!=null&&B.includes("*")){if((q=p==null?void 0:p.ignoreEventWhen)!=null&&q.call(p,A)||I&&a.current)return;if(WL(A,R,p==null?void 0:p.preventDefault),!QL(A,R,p==null?void 0:p.enabled)){kj(A);return}g.current(A,R),I||(a.current=!0)}})}},N=A=>{A.code!==void 0&&(wE(La(A.code)),((p==null?void 0:p.keydown)===void 0&&(p==null?void 0:p.keyup)!==!0||p!=null&&p.keydown)&&S(A))},C=A=>{A.code!==void 0&&(_E(La(A.code)),a.current=!1,p!=null&&p.keyup&&S(A,!0))},j=s.current||(l==null?void 0:l.document)||document;return j.addEventListener("keyup",C,l==null?void 0:l.eventListenerOptions),j.addEventListener("keydown",N,l==null?void 0:l.eventListenerOptions),y&&bx(u,p==null?void 0:p.delimiter).forEach(A=>y.addHotkey(wx(A,p==null?void 0:p.splitKey,p==null?void 0:p.sequenceSplitKey,p==null?void 0:p.useKey,p==null?void 0:p.description))),()=>{j.removeEventListener("keyup",C,l==null?void 0:l.eventListenerOptions),j.removeEventListener("keydown",N,l==null?void 0:l.eventListenerOptions),y&&bx(u,p==null?void 0:p.delimiter).forEach(A=>y.removeHotkey(wx(A,p==null?void 0:p.splitKey,p==null?void 0:p.sequenceSplitKey,p==null?void 0:p.useKey,p==null?void 0:p.description))),k=[],w&&clearTimeout(w)}},[u,p,x]),s}function jE(){const[t,e]=_.useState(()=>typeof document<"u"?document.documentElement.classList.contains("dark")?"dark":"light":"dark");return _.useEffect(()=>{var r;if(!(typeof document>"u")){document.documentElement.classList.toggle("dark",t==="dark");try{localStorage.setItem("theme",t);const s=typeof window<"u"&&((r=window.location)==null?void 0:r.protocol)==="https:";document.cookie=`theme=${encodeURIComponent(t)}; path=/; max-age=31536000; SameSite=Lax${s?"; Secure":""}`}catch{}}},[t]),{theme:t,toggleTheme:r=>{e(r?"dark":"light")},hasMounted:!0}}function NE(t){return Tr({queryKey:Xe.prompts.all,queryFn:async()=>(await(await mt.api.prompts.$get()).json()).prompts,staleTime:300*1e3,gcTime:1800*1e3,...t})}function cP(){const t=An();return On({mutationFn:async e=>{const n=await mt.api.prompts.custom.$post({json:e});if(!n.ok)throw new Error(`Failed to create prompt: ${n.status}`);return await n.json()},onSuccess:()=>{t.invalidateQueries({queryKey:Xe.prompts.all})}})}function CE(){return On({mutationFn:async t=>{const{name:e,...n}=t,r=await mt.api.prompts[":name"].resolve.$get({param:{name:encodeURIComponent(e)},query:n});if(!r.ok)throw new Error(`Failed to resolve prompt: ${r.status}`);return await r.json()}})}function uP(t=!0){return Tr({queryKey:Xe.sessions.all,queryFn:async()=>{const e=await mt.api.sessions.$get();if(!e.ok)throw new Error(`Failed to fetch sessions: ${e.status}`);return(await e.json()).sessions},enabled:t,staleTime:30*1e3})}function dP(){const t=An();return On({mutationFn:async({sessionId:e})=>{const n=await mt.api.sessions.$post({json:{sessionId:(e==null?void 0:e.trim())||void 0}});if(!n.ok)throw new Error(`Failed to create session: ${n.status}`);return(await n.json()).session},onSuccess:()=>{t.invalidateQueries({queryKey:Xe.sessions.all})}})}function EE(){const t=An();return On({mutationFn:async({sessionId:e})=>{const n=await mt.api.sessions[":sessionId"].$delete({param:{sessionId:e}});if(!n.ok)throw new Error(`Failed to delete session: ${n.status}`)},onSuccess:()=>{t.invalidateQueries({queryKey:Xe.sessions.all})}})}function fP(){const t=An();return On({mutationFn:async({sessionId:e,title:n})=>{const r=await mt.api.sessions[":sessionId"].$patch({param:{sessionId:e},json:{title:n}});if(!r.ok)throw new Error("Failed to rename session");return(await r.json()).session},onSuccess:()=>{t.invalidateQueries({queryKey:Xe.sessions.all})}})}function TE(t=!0){return Tr({queryKey:Xe.servers.all,queryFn:async()=>{const e=await mt.api.mcp.servers.$get();if(!e.ok)throw new Error("Failed to fetch servers");return(await e.json()).servers},enabled:t,staleTime:30*1e3})}function AE(t,e=!0){return Tr({queryKey:Xe.servers.tools(t||""),queryFn:async()=>{if(!t)return[];const n=await mt.api.mcp.servers[":serverId"].tools.$get({param:{serverId:t}});if(!n.ok)throw new Error("Failed to fetch tools");return(await n.json()).tools},enabled:e&&!!t,staleTime:120*1e3})}function o0(){const t=An();return On({mutationFn:async e=>{const n=await mt.api.mcp.servers.$post({json:e});if(!n.ok){const r=await n.text();throw new Error(r||"Failed to add server")}},onSuccess:()=>{t.invalidateQueries({queryKey:Xe.servers.all}),t.invalidateQueries({queryKey:Xe.prompts.all}),t.invalidateQueries({queryKey:Xe.resources.all})}})}function hP(){const t=An();return On({mutationFn:async e=>{if(!(await mt.api.mcp.servers[":serverId"].$delete({param:{serverId:e}})).ok)throw new Error("Failed to delete server")},onSuccess:()=>{t.invalidateQueries({queryKey:Xe.servers.all}),t.invalidateQueries({queryKey:Xe.prompts.all}),t.invalidateQueries({queryKey:Xe.resources.all})}})}function mP(){const t=An();return On({mutationFn:async e=>{if(!(await mt.api.mcp.servers[":serverId"].restart.$post({param:{serverId:e}})).ok)throw new Error("Failed to restart server");return e},onSuccess:e=>{t.invalidateQueries({queryKey:Xe.servers.all}),t.invalidateQueries({queryKey:Xe.prompts.all}),t.invalidateQueries({queryKey:Xe.resources.all}),t.invalidateQueries({queryKey:Xe.servers.tools(e)})}})}function OE(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=OE(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function RE(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=OE(t))&&(r&&(r+=" "),r+=e);return r}const l0="-",pP=t=>{const e=vP(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:l=>{const u=l.split(l0);return u[0]===""&&u.length!==1&&u.shift(),ME(u,e)||gP(l)},getConflictingClassGroupIds:(l,u)=>{const f=n[l]||[];return u&&r[l]?[...f,...r[l]]:f}}},ME=(t,e)=>{var l;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),s=r?ME(t.slice(1),r):void 0;if(s)return s;if(e.validators.length===0)return;const a=t.join(l0);return(l=e.validators.find(({validator:u})=>u(a)))==null?void 0:l.classGroupId},Sj=/^\[(.+)\]$/,gP=t=>{if(Sj.test(t)){const e=Sj.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},vP=t=>{const{theme:e,classGroups:n}=t,r={nextPart:new Map,validators:[]};for(const s in n)eb(n[s],r,s,e);return r},eb=(t,e,n,r)=>{t.forEach(s=>{if(typeof s=="string"){const a=s===""?e:jj(e,s);a.classGroupId=n;return}if(typeof s=="function"){if(xP(s)){eb(s(r),e,n,r);return}e.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([a,l])=>{eb(l,jj(e,a),n,r)})})},jj=(t,e)=>{let n=t;return e.split(l0).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},xP=t=>t.isThemeGetter,yP=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const s=(a,l)=>{n.set(a,l),e++,e>t&&(e=0,r=n,n=new Map)};return{get(a){let l=n.get(a);if(l!==void 0)return l;if((l=r.get(a))!==void 0)return s(a,l),l},set(a,l){n.has(a)?n.set(a,l):s(a,l)}}},tb="!",nb=":",bP=nb.length,wP=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const a=[];let l=0,u=0,f=0,h;for(let k=0;k<s.length;k++){let w=s[k];if(l===0&&u===0){if(w===nb){a.push(s.slice(f,k)),f=k+bP;continue}if(w==="/"){h=k;continue}}w==="["?l++:w==="]"?l--:w==="("?u++:w===")"&&u--}const g=a.length===0?s:s.substring(f),p=_P(g),x=p!==g,y=h&&h>f?h-f:void 0;return{modifiers:a,hasImportantModifier:x,baseClassName:p,maybePostfixModifierPosition:y}};if(e){const s=e+nb,a=r;r=l=>l.startsWith(s)?a(l.substring(s.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:l,maybePostfixModifierPosition:void 0}}if(n){const s=r;r=a=>n({className:a,parseClassName:s})}return r},_P=t=>t.endsWith(tb)?t.substring(0,t.length-1):t.startsWith(tb)?t.substring(1):t,kP=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const s=[];let a=[];return r.forEach(l=>{l[0]==="["||e[l]?(s.push(...a.sort(),l),a=[]):a.push(l)}),s.push(...a.sort()),s}},SP=t=>({cache:yP(t.cacheSize),parseClassName:wP(t),sortModifiers:kP(t),...pP(t)}),jP=/\s+/,NP=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a}=e,l=[],u=t.trim().split(jP);let f="";for(let h=u.length-1;h>=0;h-=1){const g=u[h],{isExternal:p,modifiers:x,hasImportantModifier:y,baseClassName:k,maybePostfixModifierPosition:w}=n(g);if(p){f=g+(f.length>0?" "+f:f);continue}let S=!!w,N=r(S?k.substring(0,w):k);if(!N){if(!S){f=g+(f.length>0?" "+f:f);continue}if(N=r(k),!N){f=g+(f.length>0?" "+f:f);continue}S=!1}const C=a(x).join(":"),j=y?C+tb:C,A=j+N;if(l.includes(A))continue;l.push(A);const I=s(N,S);for(let T=0;T<I.length;++T){const E=I[T];l.push(j+E)}f=g+(f.length>0?" "+f:f)}return f};function CP(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=DE(e))&&(r&&(r+=" "),r+=n);return r}const DE=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=DE(t[r]))&&(n&&(n+=" "),n+=e);return n};function EP(t,...e){let n,r,s,a=l;function l(f){const h=e.reduce((g,p)=>p(g),t());return n=SP(h),r=n.cache.get,s=n.cache.set,a=u,u(f)}function u(f){const h=r(f);if(h)return h;const g=NP(f,n);return s(f,g),g}return function(){return a(CP.apply(null,arguments))}}const In=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},IE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,LE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,TP=/^\d+\/\d+$/,AP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,OP=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,RP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,MP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,DP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ol=t=>TP.test(t),xt=t=>!!t&&!Number.isNaN(Number(t)),_a=t=>!!t&&Number.isInteger(Number(t)),_x=t=>t.endsWith("%")&&xt(t.slice(0,-1)),Ei=t=>AP.test(t),IP=()=>!0,LP=t=>OP.test(t)&&!RP.test(t),PE=()=>!1,PP=t=>MP.test(t),$P=t=>DP.test(t),zP=t=>!Ke(t)&&!Ye(t),FP=t=>Ec(t,FE,PE),Ke=t=>IE.test(t),xo=t=>Ec(t,BE,LP),kx=t=>Ec(t,VP,xt),Nj=t=>Ec(t,$E,PE),BP=t=>Ec(t,zE,$P),_h=t=>Ec(t,UE,PP),Ye=t=>LE.test(t),Uu=t=>Tc(t,BE),UP=t=>Tc(t,KP),Cj=t=>Tc(t,$E),qP=t=>Tc(t,FE),HP=t=>Tc(t,zE),kh=t=>Tc(t,UE,!0),Ec=(t,e,n)=>{const r=IE.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Tc=(t,e,n=!1)=>{const r=LE.exec(t);return r?r[1]?e(r[1]):n:!1},$E=t=>t==="position"||t==="percentage",zE=t=>t==="image"||t==="url",FE=t=>t==="length"||t==="size"||t==="bg-size",BE=t=>t==="length",VP=t=>t==="number",KP=t=>t==="family-name",UE=t=>t==="shadow",YP=()=>{const t=In("color"),e=In("font"),n=In("text"),r=In("font-weight"),s=In("tracking"),a=In("leading"),l=In("breakpoint"),u=In("container"),f=In("spacing"),h=In("radius"),g=In("shadow"),p=In("inset-shadow"),x=In("text-shadow"),y=In("drop-shadow"),k=In("blur"),w=In("perspective"),S=In("aspect"),N=In("ease"),C=In("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...A(),Ye,Ke],T=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],R=()=>[Ye,Ke,f],z=()=>[Ol,"full","auto",...R()],D=()=>[_a,"none","subgrid",Ye,Ke],B=()=>["auto",{span:["full",_a,Ye,Ke]},_a,Ye,Ke],q=()=>[_a,"auto",Ye,Ke],K=()=>["auto","min","max","fr",Ye,Ke],G=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...R()],V=()=>[Ol,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],U=()=>[t,Ye,Ke],H=()=>[...A(),Cj,Nj,{position:[Ye,Ke]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ne=()=>["auto","cover","contain",qP,FP,{size:[Ye,Ke]}],ie=()=>[_x,Uu,xo],P=()=>["","none","full",h,Ye,Ke],pe=()=>["",xt,Uu,xo],Pe=()=>["solid","dashed","dotted","double"],Ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ge=()=>[xt,_x,Cj,Nj],Fe=()=>["","none",k,Ye,Ke],Qe=()=>["none",xt,Ye,Ke],$e=()=>["none",xt,Ye,Ke],Q=()=>[xt,Ye,Ke],_e=()=>[Ol,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ei],breakpoint:[Ei],color:[IP],container:[Ei],"drop-shadow":[Ei],ease:["in","out","in-out"],font:[zP],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ei],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ei],shadow:[Ei],spacing:["px",xt],text:[Ei],"text-shadow":[Ei],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ol,Ke,Ye,S]}],container:["container"],columns:[{columns:[xt,Ke,Ye,u]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:I()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[_a,"auto",Ye,Ke]}],basis:[{basis:[Ol,"full","auto",u,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[xt,Ol,"auto","initial","none",Ke]}],grow:[{grow:["",xt,Ye,Ke]}],shrink:[{shrink:["",xt,Ye,Ke]}],order:[{order:[_a,"first","last","none",Ye,Ke]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":K()}],"auto-rows":[{"auto-rows":K()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...G(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...G()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":G()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],w:[{w:[u,"screen",...V()]}],"min-w":[{"min-w":[u,"screen","none",...V()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[l]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",n,Uu,xo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ye,kx]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",_x,Ke]}],"font-family":[{font:[UP,Ke,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ye,Ke]}],"line-clamp":[{"line-clamp":[xt,"none",Ye,kx]}],leading:[{leading:[a,...R()]}],"list-image":[{"list-image":["none",Ye,Ke]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ye,Ke]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Pe(),"wavy"]}],"text-decoration-thickness":[{decoration:[xt,"from-font","auto",Ye,xo]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[xt,"auto",Ye,Ke]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ye,Ke]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ye,Ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:ne()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},_a,Ye,Ke],radial:["",Ye,Ke],conic:[_a,Ye,Ke]},HP,BP]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:pe()}],"border-w-x":[{"border-x":pe()}],"border-w-y":[{"border-y":pe()}],"border-w-s":[{"border-s":pe()}],"border-w-e":[{"border-e":pe()}],"border-w-t":[{"border-t":pe()}],"border-w-r":[{"border-r":pe()}],"border-w-b":[{"border-b":pe()}],"border-w-l":[{"border-l":pe()}],"divide-x":[{"divide-x":pe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":pe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Pe(),"hidden","none"]}],"divide-style":[{divide:[...Pe(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...Pe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[xt,Ye,Ke]}],"outline-w":[{outline:["",xt,Uu,xo]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",g,kh,_h]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",p,kh,_h]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:pe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[xt,xo]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":pe()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",x,kh,_h]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[xt,Ye,Ke]}],"mix-blend":[{"mix-blend":[...Ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[xt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ge()}],"mask-image-linear-to-pos":[{"mask-linear-to":ge()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":ge()}],"mask-image-t-to-pos":[{"mask-t-to":ge()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":ge()}],"mask-image-r-to-pos":[{"mask-r-to":ge()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":ge()}],"mask-image-b-to-pos":[{"mask-b-to":ge()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":ge()}],"mask-image-l-to-pos":[{"mask-l-to":ge()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":ge()}],"mask-image-x-to-pos":[{"mask-x-to":ge()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":ge()}],"mask-image-y-to-pos":[{"mask-y-to":ge()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Ye,Ke]}],"mask-image-radial-from-pos":[{"mask-radial-from":ge()}],"mask-image-radial-to-pos":[{"mask-radial-to":ge()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[xt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ge()}],"mask-image-conic-to-pos":[{"mask-conic-to":ge()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:ne()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ye,Ke]}],filter:[{filter:["","none",Ye,Ke]}],blur:[{blur:Fe()}],brightness:[{brightness:[xt,Ye,Ke]}],contrast:[{contrast:[xt,Ye,Ke]}],"drop-shadow":[{"drop-shadow":["","none",y,kh,_h]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",xt,Ye,Ke]}],"hue-rotate":[{"hue-rotate":[xt,Ye,Ke]}],invert:[{invert:["",xt,Ye,Ke]}],saturate:[{saturate:[xt,Ye,Ke]}],sepia:[{sepia:["",xt,Ye,Ke]}],"backdrop-filter":[{"backdrop-filter":["","none",Ye,Ke]}],"backdrop-blur":[{"backdrop-blur":Fe()}],"backdrop-brightness":[{"backdrop-brightness":[xt,Ye,Ke]}],"backdrop-contrast":[{"backdrop-contrast":[xt,Ye,Ke]}],"backdrop-grayscale":[{"backdrop-grayscale":["",xt,Ye,Ke]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[xt,Ye,Ke]}],"backdrop-invert":[{"backdrop-invert":["",xt,Ye,Ke]}],"backdrop-opacity":[{"backdrop-opacity":[xt,Ye,Ke]}],"backdrop-saturate":[{"backdrop-saturate":[xt,Ye,Ke]}],"backdrop-sepia":[{"backdrop-sepia":["",xt,Ye,Ke]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ye,Ke]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[xt,"initial",Ye,Ke]}],ease:[{ease:["linear","initial",N,Ye,Ke]}],delay:[{delay:[xt,Ye,Ke]}],animate:[{animate:["none",C,Ye,Ke]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Ye,Ke]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:Qe()}],"rotate-x":[{"rotate-x":Qe()}],"rotate-y":[{"rotate-y":Qe()}],"rotate-z":[{"rotate-z":Qe()}],scale:[{scale:$e()}],"scale-x":[{"scale-x":$e()}],"scale-y":[{"scale-y":$e()}],"scale-z":[{"scale-z":$e()}],"scale-3d":["scale-3d"],skew:[{skew:Q()}],"skew-x":[{"skew-x":Q()}],"skew-y":[{"skew-y":Q()}],transform:[{transform:[Ye,Ke,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:_e()}],"translate-x":[{"translate-x":_e()}],"translate-y":[{"translate-y":_e()}],"translate-z":[{"translate-z":_e()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ye,Ke]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ye,Ke]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[xt,Uu,xo,kx]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},GP=EP(YP);function ae(...t){return GP(RE(t))}function qE(t,e,n=25){const r=e.toLowerCase(),s=l=>{if(!l)return 0;const u=new Date(l).getTime();return isNaN(u)?0:u};return[...t].sort((l,u)=>{const f=s(l.lastModified);return s(u.lastModified)-f}).filter(l=>(l.name||"").toLowerCase().includes(r)||l.uri.toLowerCase().includes(r)||(l.serverName||"").toLowerCase().includes(r)).slice(0,n)}/**
|
|
36
|
-
* @license lucide-react v0.507.0 - ISC
|
|
37
|
-
*
|
|
38
|
-
* This source code is licensed under the ISC license.
|
|
39
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
40
|
-
*/const ZP=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),WP=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),Ej=t=>{const e=WP(t);return e.charAt(0).toUpperCase()+e.slice(1)},HE=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),QP=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
|
|
41
|
-
* @license lucide-react v0.507.0 - ISC
|
|
42
|
-
*
|
|
43
|
-
* This source code is licensed under the ISC license.
|
|
44
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/var XP={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
46
|
-
* @license lucide-react v0.507.0 - ISC
|
|
47
|
-
*
|
|
48
|
-
* This source code is licensed under the ISC license.
|
|
49
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
50
|
-
*/const JP=_.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:a,iconNode:l,...u},f)=>_.createElement("svg",{ref:f,...XP,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:HE("lucide",s),...!a&&!QP(u)&&{"aria-hidden":"true"},...u},[...l.map(([h,g])=>_.createElement(h,g)),...Array.isArray(a)?a:[a]]));/**
|
|
51
|
-
* @license lucide-react v0.507.0 - ISC
|
|
52
|
-
*
|
|
53
|
-
* This source code is licensed under the ISC license.
|
|
54
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
55
|
-
*/const Re=(t,e)=>{const n=_.forwardRef(({className:r,...s},a)=>_.createElement(JP,{ref:a,iconNode:e,className:HE(`lucide-${ZP(Ej(t))}`,`lucide-${t}`,r),...s}));return n.displayName=Ej(t),n};/**
|
|
56
|
-
* @license lucide-react v0.507.0 - ISC
|
|
57
|
-
*
|
|
58
|
-
* This source code is licensed under the ISC license.
|
|
59
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
60
|
-
*/const e$=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Tj=Re("arrow-left",e$);/**
|
|
61
|
-
* @license lucide-react v0.507.0 - ISC
|
|
62
|
-
*
|
|
63
|
-
* This source code is licensed under the ISC license.
|
|
64
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/const t$=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],n$=Re("badge-check",t$);/**
|
|
66
|
-
* @license lucide-react v0.507.0 - ISC
|
|
67
|
-
*
|
|
68
|
-
* This source code is licensed under the ISC license.
|
|
69
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
-
*/const r$=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],tc=Re("bot",r$);/**
|
|
71
|
-
* @license lucide-react v0.507.0 - ISC
|
|
72
|
-
*
|
|
73
|
-
* This source code is licensed under the ISC license.
|
|
74
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/const s$=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]],Io=Re("brain",s$);/**
|
|
76
|
-
* @license lucide-react v0.507.0 - ISC
|
|
77
|
-
*
|
|
78
|
-
* This source code is licensed under the ISC license.
|
|
79
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
-
*/const i$=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],a$=Re("calendar",i$);/**
|
|
81
|
-
* @license lucide-react v0.507.0 - ISC
|
|
82
|
-
*
|
|
83
|
-
* This source code is licensed under the ISC license.
|
|
84
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
-
*/const o$=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Es=Re("check",o$);/**
|
|
86
|
-
* @license lucide-react v0.507.0 - ISC
|
|
87
|
-
*
|
|
88
|
-
* This source code is licensed under the ISC license.
|
|
89
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
-
*/const l$=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ar=Re("chevron-down",l$);/**
|
|
91
|
-
* @license lucide-react v0.507.0 - ISC
|
|
92
|
-
*
|
|
93
|
-
* This source code is licensed under the ISC license.
|
|
94
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
-
*/const c$=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],u$=Re("chevron-left",c$);/**
|
|
96
|
-
* @license lucide-react v0.507.0 - ISC
|
|
97
|
-
*
|
|
98
|
-
* This source code is licensed under the ISC license.
|
|
99
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
-
*/const d$=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],VE=Re("chevron-right",d$);/**
|
|
101
|
-
* @license lucide-react v0.507.0 - ISC
|
|
102
|
-
*
|
|
103
|
-
* This source code is licensed under the ISC license.
|
|
104
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
-
*/const f$=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ua=Re("chevron-up",f$);/**
|
|
106
|
-
* @license lucide-react v0.507.0 - ISC
|
|
107
|
-
*
|
|
108
|
-
* This source code is licensed under the ISC license.
|
|
109
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
-
*/const h$=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],qa=Re("circle-alert",h$);/**
|
|
111
|
-
* @license lucide-react v0.507.0 - ISC
|
|
112
|
-
*
|
|
113
|
-
* This source code is licensed under the ISC license.
|
|
114
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
115
|
-
*/const m$=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ts=Re("circle-check-big",m$);/**
|
|
116
|
-
* @license lucide-react v0.507.0 - ISC
|
|
117
|
-
*
|
|
118
|
-
* This source code is licensed under the ISC license.
|
|
119
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
-
*/const p$=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],KE=Re("circle-help",p$);/**
|
|
121
|
-
* @license lucide-react v0.507.0 - ISC
|
|
122
|
-
*
|
|
123
|
-
* This source code is licensed under the ISC license.
|
|
124
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
125
|
-
*/const g$=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],v$=Re("circle-plus",g$);/**
|
|
126
|
-
* @license lucide-react v0.507.0 - ISC
|
|
127
|
-
*
|
|
128
|
-
* This source code is licensed under the ISC license.
|
|
129
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
-
*/const x$=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],y$=Re("circle-stop",x$);/**
|
|
131
|
-
* @license lucide-react v0.507.0 - ISC
|
|
132
|
-
*
|
|
133
|
-
* This source code is licensed under the ISC license.
|
|
134
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
-
*/const b$=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],rb=Re("circle-x",b$);/**
|
|
136
|
-
* @license lucide-react v0.507.0 - ISC
|
|
137
|
-
*
|
|
138
|
-
* This source code is licensed under the ISC license.
|
|
139
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
-
*/const w$=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],_$=Re("clock",w$);/**
|
|
141
|
-
* @license lucide-react v0.507.0 - ISC
|
|
142
|
-
*
|
|
143
|
-
* This source code is licensed under the ISC license.
|
|
144
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
-
*/const k$=[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]],S$=Re("cloud-download",k$);/**
|
|
146
|
-
* @license lucide-react v0.507.0 - ISC
|
|
147
|
-
*
|
|
148
|
-
* This source code is licensed under the ISC license.
|
|
149
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
-
*/const j$=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Pd=Re("copy",j$);/**
|
|
151
|
-
* @license lucide-react v0.507.0 - ISC
|
|
152
|
-
*
|
|
153
|
-
* This source code is licensed under the ISC license.
|
|
154
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
-
*/const N$=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],Sh=Re("download",N$);/**
|
|
156
|
-
* @license lucide-react v0.507.0 - ISC
|
|
157
|
-
*
|
|
158
|
-
* This source code is licensed under the ISC license.
|
|
159
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
-
*/const C$=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],YE=Re("ellipsis",C$);/**
|
|
161
|
-
* @license lucide-react v0.507.0 - ISC
|
|
162
|
-
*
|
|
163
|
-
* This source code is licensed under the ISC license.
|
|
164
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
-
*/const E$=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],sb=Re("external-link",E$);/**
|
|
166
|
-
* @license lucide-react v0.507.0 - ISC
|
|
167
|
-
*
|
|
168
|
-
* This source code is licensed under the ISC license.
|
|
169
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
-
*/const T$=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],GE=Re("eye-off",T$);/**
|
|
171
|
-
* @license lucide-react v0.507.0 - ISC
|
|
172
|
-
*
|
|
173
|
-
* This source code is licensed under the ISC license.
|
|
174
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
-
*/const A$=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],c0=Re("eye",A$);/**
|
|
176
|
-
* @license lucide-react v0.507.0 - ISC
|
|
177
|
-
*
|
|
178
|
-
* This source code is licensed under the ISC license.
|
|
179
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
-
*/const O$=[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]],ko=Re("file-audio",O$);/**
|
|
181
|
-
* @license lucide-react v0.507.0 - ISC
|
|
182
|
-
*
|
|
183
|
-
* This source code is licensed under the ISC license.
|
|
184
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
-
*/const R$=[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]],Aj=Re("file-pen",R$);/**
|
|
186
|
-
* @license lucide-react v0.507.0 - ISC
|
|
187
|
-
*
|
|
188
|
-
* This source code is licensed under the ISC license.
|
|
189
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
-
*/const M$=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ZE=Re("file-text",M$);/**
|
|
191
|
-
* @license lucide-react v0.507.0 - ISC
|
|
192
|
-
*
|
|
193
|
-
* This source code is licensed under the ISC license.
|
|
194
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
-
*/const D$=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]],Yh=Re("file-video",D$);/**
|
|
196
|
-
* @license lucide-react v0.507.0 - ISC
|
|
197
|
-
*
|
|
198
|
-
* This source code is licensed under the ISC license.
|
|
199
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
-
*/const I$=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],nc=Re("file",I$);/**
|
|
201
|
-
* @license lucide-react v0.507.0 - ISC
|
|
202
|
-
*
|
|
203
|
-
* This source code is licensed under the ISC license.
|
|
204
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
-
*/const L$=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],Tm=Re("flask-conical",L$);/**
|
|
206
|
-
* @license lucide-react v0.507.0 - ISC
|
|
207
|
-
*
|
|
208
|
-
* This source code is licensed under the ISC license.
|
|
209
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
-
*/const P$=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],$$=Re("funnel",P$);/**
|
|
211
|
-
* @license lucide-react v0.507.0 - ISC
|
|
212
|
-
*
|
|
213
|
-
* This source code is licensed under the ISC license.
|
|
214
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
-
*/const z$=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],F$=Re("grid-3x3",z$);/**
|
|
216
|
-
* @license lucide-react v0.507.0 - ISC
|
|
217
|
-
*
|
|
218
|
-
* This source code is licensed under the ISC license.
|
|
219
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
-
*/const B$=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],WE=Re("history",B$);/**
|
|
221
|
-
* @license lucide-react v0.507.0 - ISC
|
|
222
|
-
*
|
|
223
|
-
* This source code is licensed under the ISC license.
|
|
224
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
-
*/const U$=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],q$=Re("house",U$);/**
|
|
226
|
-
* @license lucide-react v0.507.0 - ISC
|
|
227
|
-
*
|
|
228
|
-
* This source code is licensed under the ISC license.
|
|
229
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
-
*/const H$=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],ud=Re("image",H$);/**
|
|
231
|
-
* @license lucide-react v0.507.0 - ISC
|
|
232
|
-
*
|
|
233
|
-
* This source code is licensed under the ISC license.
|
|
234
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
-
*/const V$=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],K$=Re("info",V$);/**
|
|
236
|
-
* @license lucide-react v0.507.0 - ISC
|
|
237
|
-
*
|
|
238
|
-
* This source code is licensed under the ISC license.
|
|
239
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
240
|
-
*/const Y$=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],Sx=Re("keyboard",Y$);/**
|
|
241
|
-
* @license lucide-react v0.507.0 - ISC
|
|
242
|
-
*
|
|
243
|
-
* This source code is licensed under the ISC license.
|
|
244
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
-
*/const G$=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],Oj=Re("list-checks",G$);/**
|
|
246
|
-
* @license lucide-react v0.507.0 - ISC
|
|
247
|
-
*
|
|
248
|
-
* This source code is licensed under the ISC license.
|
|
249
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
250
|
-
*/const Z$=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],W$=Re("list",Z$);/**
|
|
251
|
-
* @license lucide-react v0.507.0 - ISC
|
|
252
|
-
*
|
|
253
|
-
* This source code is licensed under the ISC license.
|
|
254
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
-
*/const Q$=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ms=Re("loader-circle",Q$);/**
|
|
256
|
-
* @license lucide-react v0.507.0 - ISC
|
|
257
|
-
*
|
|
258
|
-
* This source code is licensed under the ISC license.
|
|
259
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
260
|
-
*/const X$=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],QE=Re("lock",X$);/**
|
|
261
|
-
* @license lucide-react v0.507.0 - ISC
|
|
262
|
-
*
|
|
263
|
-
* This source code is licensed under the ISC license.
|
|
264
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
-
*/const J$=[["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 18h16",key:"19g7jn"}],["path",{d:"M4 6h16",key:"1o0s65"}]],ez=Re("menu",J$);/**
|
|
266
|
-
* @license lucide-react v0.507.0 - ISC
|
|
267
|
-
*
|
|
268
|
-
* This source code is licensed under the ISC license.
|
|
269
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
-
*/const tz=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],nz=Re("message-square",tz);/**
|
|
271
|
-
* @license lucide-react v0.507.0 - ISC
|
|
272
|
-
*
|
|
273
|
-
* This source code is licensed under the ISC license.
|
|
274
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
-
*/const rz=[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]],XE=Re("mic",rz);/**
|
|
276
|
-
* @license lucide-react v0.507.0 - ISC
|
|
277
|
-
*
|
|
278
|
-
* This source code is licensed under the ISC license.
|
|
279
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
-
*/const sz=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],iz=Re("moon",sz);/**
|
|
281
|
-
* @license lucide-react v0.507.0 - ISC
|
|
282
|
-
*
|
|
283
|
-
* This source code is licensed under the ISC license.
|
|
284
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
-
*/const az=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Rj=Re("package",az);/**
|
|
286
|
-
* @license lucide-react v0.507.0 - ISC
|
|
287
|
-
*
|
|
288
|
-
* This source code is licensed under the ISC license.
|
|
289
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
-
*/const oz=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],lz=Re("panel-left-close",oz);/**
|
|
291
|
-
* @license lucide-react v0.507.0 - ISC
|
|
292
|
-
*
|
|
293
|
-
* This source code is licensed under the ISC license.
|
|
294
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
-
*/const cz=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],ib=Re("panel-left",cz);/**
|
|
296
|
-
* @license lucide-react v0.507.0 - ISC
|
|
297
|
-
*
|
|
298
|
-
* This source code is licensed under the ISC license.
|
|
299
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
-
*/const uz=[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]],Mj=Re("paperclip",uz);/**
|
|
301
|
-
* @license lucide-react v0.507.0 - ISC
|
|
302
|
-
*
|
|
303
|
-
* This source code is licensed under the ISC license.
|
|
304
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
305
|
-
*/const dz=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Dj=Re("pencil",dz);/**
|
|
306
|
-
* @license lucide-react v0.507.0 - ISC
|
|
307
|
-
*
|
|
308
|
-
* This source code is licensed under the ISC license.
|
|
309
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
310
|
-
*/const fz=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],us=Re("plus",fz);/**
|
|
311
|
-
* @license lucide-react v0.507.0 - ISC
|
|
312
|
-
*
|
|
313
|
-
* This source code is licensed under the ISC license.
|
|
314
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
315
|
-
*/const hz=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],hr=Re("refresh-cw",hz);/**
|
|
316
|
-
* @license lucide-react v0.507.0 - ISC
|
|
317
|
-
*
|
|
318
|
-
* This source code is licensed under the ISC license.
|
|
319
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
320
|
-
*/const mz=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Ij=Re("rotate-cw",mz);/**
|
|
321
|
-
* @license lucide-react v0.507.0 - ISC
|
|
322
|
-
*
|
|
323
|
-
* This source code is licensed under the ISC license.
|
|
324
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
325
|
-
*/const pz=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],gz=Re("save",pz);/**
|
|
326
|
-
* @license lucide-react v0.507.0 - ISC
|
|
327
|
-
*
|
|
328
|
-
* This source code is licensed under the ISC license.
|
|
329
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
330
|
-
*/const vz=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],As=Re("search",vz);/**
|
|
331
|
-
* @license lucide-react v0.507.0 - ISC
|
|
332
|
-
*
|
|
333
|
-
* This source code is licensed under the ISC license.
|
|
334
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
335
|
-
*/const xz=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],yz=Re("send-horizontal",xz);/**
|
|
336
|
-
* @license lucide-react v0.507.0 - ISC
|
|
337
|
-
*
|
|
338
|
-
* This source code is licensed under the ISC license.
|
|
339
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
340
|
-
*/const bz=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Bi=Re("server",bz);/**
|
|
341
|
-
* @license lucide-react v0.507.0 - ISC
|
|
342
|
-
*
|
|
343
|
-
* This source code is licensed under the ISC license.
|
|
344
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
345
|
-
*/const wz=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ab=Re("settings",wz);/**
|
|
346
|
-
* @license lucide-react v0.507.0 - ISC
|
|
347
|
-
*
|
|
348
|
-
* This source code is licensed under the ISC license.
|
|
349
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
350
|
-
*/const _z=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],kz=Re("share-2",_z);/**
|
|
351
|
-
* @license lucide-react v0.507.0 - ISC
|
|
352
|
-
*
|
|
353
|
-
* This source code is licensed under the ISC license.
|
|
354
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
355
|
-
*/const Sz=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],JE=Re("sparkles",Sz);/**
|
|
356
|
-
* @license lucide-react v0.507.0 - ISC
|
|
357
|
-
*
|
|
358
|
-
* This source code is licensed under the ISC license.
|
|
359
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
360
|
-
*/const jz=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],eT=Re("square",jz);/**
|
|
361
|
-
* @license lucide-react v0.507.0 - ISC
|
|
362
|
-
*
|
|
363
|
-
* This source code is licensed under the ISC license.
|
|
364
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
365
|
-
*/const Nz=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],kd=Re("star",Nz);/**
|
|
366
|
-
* @license lucide-react v0.507.0 - ISC
|
|
367
|
-
*
|
|
368
|
-
* This source code is licensed under the ISC license.
|
|
369
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
370
|
-
*/const Cz=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Ez=Re("sun",Cz);/**
|
|
371
|
-
* @license lucide-react v0.507.0 - ISC
|
|
372
|
-
*
|
|
373
|
-
* This source code is licensed under the ISC license.
|
|
374
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
375
|
-
*/const Tz=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Az=Re("tag",Tz);/**
|
|
376
|
-
* @license lucide-react v0.507.0 - ISC
|
|
377
|
-
*
|
|
378
|
-
* This source code is licensed under the ISC license.
|
|
379
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
380
|
-
*/const Oz=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],Zn=Re("trash-2",Oz);/**
|
|
381
|
-
* @license lucide-react v0.507.0 - ISC
|
|
382
|
-
*
|
|
383
|
-
* This source code is licensed under the ISC license.
|
|
384
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
385
|
-
*/const Rz=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ln=Re("triangle-alert",Rz);/**
|
|
386
|
-
* @license lucide-react v0.507.0 - ISC
|
|
387
|
-
*
|
|
388
|
-
* This source code is licensed under the ISC license.
|
|
389
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
390
|
-
*/const Mz=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],Dz=Re("upload",Mz);/**
|
|
391
|
-
* @license lucide-react v0.507.0 - ISC
|
|
392
|
-
*
|
|
393
|
-
* This source code is licensed under the ISC license.
|
|
394
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
395
|
-
*/const Iz=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],tT=Re("user",Iz);/**
|
|
396
|
-
* @license lucide-react v0.507.0 - ISC
|
|
397
|
-
*
|
|
398
|
-
* This source code is licensed under the ISC license.
|
|
399
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
400
|
-
*/const Lz=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Lj=Re("users",Lz);/**
|
|
401
|
-
* @license lucide-react v0.507.0 - ISC
|
|
402
|
-
*
|
|
403
|
-
* This source code is licensed under the ISC license.
|
|
404
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
405
|
-
*/const Pz=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],Pj=Re("video",Pz);/**
|
|
406
|
-
* @license lucide-react v0.507.0 - ISC
|
|
407
|
-
*
|
|
408
|
-
* This source code is licensed under the ISC license.
|
|
409
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
410
|
-
*/const $z=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],ob=Re("volume-2",$z);/**
|
|
411
|
-
* @license lucide-react v0.507.0 - ISC
|
|
412
|
-
*
|
|
413
|
-
* This source code is licensed under the ISC license.
|
|
414
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
415
|
-
*/const zz=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]],Ii=Re("wrench",zz);/**
|
|
416
|
-
* @license lucide-react v0.507.0 - ISC
|
|
417
|
-
*
|
|
418
|
-
* This source code is licensed under the ISC license.
|
|
419
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
420
|
-
*/const Fz=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Er=Re("x",Fz);/**
|
|
421
|
-
* @license lucide-react v0.507.0 - ISC
|
|
422
|
-
*
|
|
423
|
-
* This source code is licensed under the ISC license.
|
|
424
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
425
|
-
*/const Bz=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],np=Re("zap",Bz);/**
|
|
426
|
-
* @license lucide-react v0.507.0 - ISC
|
|
427
|
-
*
|
|
428
|
-
* This source code is licensed under the ISC license.
|
|
429
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
430
|
-
*/const Uz=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],qz=Re("zoom-in",Uz);function bt(t,e,{checkForDefaultPrevented:n=!0}={}){return function(s){if(t==null||t(s),n===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function $j(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function nT(...t){return e=>{let n=!1;const r=t.map(s=>{const a=$j(s,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<r.length;s++){const a=r[s];typeof a=="function"?a():$j(t[s],null)}}}}function Bt(...t){return _.useCallback(nT(...t),t)}function Hz(t,e){const n=_.createContext(e),r=a=>{const{children:l,...u}=a,f=_.useMemo(()=>u,Object.values(u));return c.jsx(n.Provider,{value:f,children:l})};r.displayName=t+"Provider";function s(a){const l=_.useContext(n);if(l)return l;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${t}\``)}return[r,s]}function Ka(t,e=[]){let n=[];function r(a,l){const u=_.createContext(l),f=n.length;n=[...n,l];const h=p=>{var N;const{scope:x,children:y,...k}=p,w=((N=x==null?void 0:x[t])==null?void 0:N[f])||u,S=_.useMemo(()=>k,Object.values(k));return c.jsx(w.Provider,{value:S,children:y})};h.displayName=a+"Provider";function g(p,x){var w;const y=((w=x==null?void 0:x[t])==null?void 0:w[f])||u,k=_.useContext(y);if(k)return k;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${a}\``)}return[h,g]}const s=()=>{const a=n.map(l=>_.createContext(l));return function(u){const f=(u==null?void 0:u[t])||a;return _.useMemo(()=>({[`__scope${t}`]:{...u,[t]:f}}),[u,f])}};return s.scopeName=t,[r,Vz(s,...e)]}function Vz(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const l=r.reduce((u,{useScope:f,scopeName:h})=>{const p=f(a)[`__scope${h}`];return{...u,...p}},{});return _.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return n.scopeName=e.scopeName,n}function Lo(t){const e=Yz(t),n=_.forwardRef((r,s)=>{const{children:a,...l}=r,u=_.Children.toArray(a),f=u.find(Zz);if(f){const h=f.props.children,g=u.map(p=>p===f?_.Children.count(h)>1?_.Children.only(null):_.isValidElement(h)?h.props.children:null:p);return c.jsx(e,{...l,ref:s,children:_.isValidElement(h)?_.cloneElement(h,void 0,g):null})}return c.jsx(e,{...l,ref:s,children:a})});return n.displayName=`${t}.Slot`,n}var Kz=Lo("Slot");function Yz(t){const e=_.forwardRef((n,r)=>{const{children:s,...a}=n;if(_.isValidElement(s)){const l=Qz(s),u=Wz(a,s.props);return s.type!==_.Fragment&&(u.ref=r?nT(r,l):l),_.cloneElement(s,u)}return _.Children.count(s)>1?_.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var rT=Symbol("radix.slottable");function Gz(t){const e=({children:n})=>c.jsx(c.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=rT,e}function Zz(t){return _.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===rT}function Wz(t,e){const n={...e};for(const r in e){const s=t[r],a=e[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...u)=>{const f=a(...u);return s(...u),f}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...t,...n}}function Qz(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Xz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ct=Xz.reduce((t,e)=>{const n=Lo(`Primitive.${e}`),r=_.forwardRef((s,a)=>{const{asChild:l,...u}=s,f=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(f,{...u,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Jz(t,e){t&&Vm.flushSync(()=>t.dispatchEvent(e))}function Po(t){const e=_.useRef(t);return _.useEffect(()=>{e.current=t}),_.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function e6(t,e=globalThis==null?void 0:globalThis.document){const n=Po(t);_.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var t6="DismissableLayer",lb="dismissableLayer.update",n6="dismissableLayer.pointerDownOutside",r6="dismissableLayer.focusOutside",zj,sT=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$d=_.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:l,onDismiss:u,...f}=t,h=_.useContext(sT),[g,p]=_.useState(null),x=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=_.useState({}),k=Bt(e,E=>p(E)),w=Array.from(h.layers),[S]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),N=w.indexOf(S),C=g?w.indexOf(g):-1,j=h.layersWithOutsidePointerEventsDisabled.size>0,A=C>=N,I=a6(E=>{const R=E.target,z=[...h.branches].some(D=>D.contains(R));!A||z||(s==null||s(E),l==null||l(E),E.defaultPrevented||u==null||u())},x),T=o6(E=>{const R=E.target;[...h.branches].some(D=>D.contains(R))||(a==null||a(E),l==null||l(E),E.defaultPrevented||u==null||u())},x);return e6(E=>{C===h.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&u&&(E.preventDefault(),u()))},x),_.useEffect(()=>{if(g)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(zj=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(g)),h.layers.add(g),Fj(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=zj)}},[g,x,n,h]),_.useEffect(()=>()=>{g&&(h.layers.delete(g),h.layersWithOutsidePointerEventsDisabled.delete(g),Fj())},[g,h]),_.useEffect(()=>{const E=()=>y({});return document.addEventListener(lb,E),()=>document.removeEventListener(lb,E)},[]),c.jsx(Ct.div,{...f,ref:k,style:{pointerEvents:j?A?"auto":"none":void 0,...t.style},onFocusCapture:bt(t.onFocusCapture,T.onFocusCapture),onBlurCapture:bt(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:bt(t.onPointerDownCapture,I.onPointerDownCapture)})});$d.displayName=t6;var s6="DismissableLayerBranch",i6=_.forwardRef((t,e)=>{const n=_.useContext(sT),r=_.useRef(null),s=Bt(e,r);return _.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),c.jsx(Ct.div,{...t,ref:s})});i6.displayName=s6;function a6(t,e=globalThis==null?void 0:globalThis.document){const n=Po(t),r=_.useRef(!1),s=_.useRef(()=>{});return _.useEffect(()=>{const a=u=>{if(u.target&&!r.current){let f=function(){iT(n6,n,h,{discrete:!0})};const h={originalEvent:u};u.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=f,e.addEventListener("click",s.current,{once:!0})):f()}else e.removeEventListener("click",s.current);r.current=!1},l=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),e.removeEventListener("pointerdown",a),e.removeEventListener("click",s.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function o6(t,e=globalThis==null?void 0:globalThis.document){const n=Po(t),r=_.useRef(!1);return _.useEffect(()=>{const s=a=>{a.target&&!r.current&&iT(r6,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Fj(){const t=new CustomEvent(lb);document.dispatchEvent(t)}function iT(t,e,n,{discrete:r}){const s=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?Jz(s,a):s.dispatchEvent(a)}var or=globalThis!=null&&globalThis.document?_.useLayoutEffect:()=>{},l6=MC[" useId ".trim().toString()]||(()=>{}),c6=0;function Pa(t){const[e,n]=_.useState(l6());return or(()=>{n(r=>r??String(c6++))},[t]),e?`radix-${e}`:""}const u6=["top","right","bottom","left"],Ha=Math.min,Ur=Math.max,Am=Math.round,jh=Math.floor,ti=t=>({x:t,y:t}),d6={left:"right",right:"left",bottom:"top",top:"bottom"},f6={start:"end",end:"start"};function cb(t,e,n){return Ur(t,Ha(e,n))}function Hi(t,e){return typeof t=="function"?t(e):t}function Vi(t){return t.split("-")[0]}function Ac(t){return t.split("-")[1]}function u0(t){return t==="x"?"y":"x"}function d0(t){return t==="y"?"height":"width"}const h6=new Set(["top","bottom"]);function Xs(t){return h6.has(Vi(t))?"y":"x"}function f0(t){return u0(Xs(t))}function m6(t,e,n){n===void 0&&(n=!1);const r=Ac(t),s=f0(t),a=d0(s);let l=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(l=Om(l)),[l,Om(l)]}function p6(t){const e=Om(t);return[ub(t),e,ub(e)]}function ub(t){return t.replace(/start|end/g,e=>f6[e])}const Bj=["left","right"],Uj=["right","left"],g6=["top","bottom"],v6=["bottom","top"];function x6(t,e,n){switch(t){case"top":case"bottom":return n?e?Uj:Bj:e?Bj:Uj;case"left":case"right":return e?g6:v6;default:return[]}}function y6(t,e,n,r){const s=Ac(t);let a=x6(Vi(t),n==="start",r);return s&&(a=a.map(l=>l+"-"+s),e&&(a=a.concat(a.map(ub)))),a}function Om(t){return t.replace(/left|right|bottom|top/g,e=>d6[e])}function b6(t){return{top:0,right:0,bottom:0,left:0,...t}}function aT(t){return typeof t!="number"?b6(t):{top:t,right:t,bottom:t,left:t}}function Rm(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function qj(t,e,n){let{reference:r,floating:s}=t;const a=Xs(e),l=f0(e),u=d0(l),f=Vi(e),h=a==="y",g=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,x=r[u]/2-s[u]/2;let y;switch(f){case"top":y={x:g,y:r.y-s.height};break;case"bottom":y={x:g,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:p};break;case"left":y={x:r.x-s.width,y:p};break;default:y={x:r.x,y:r.y}}switch(Ac(e)){case"start":y[l]-=x*(n&&h?-1:1);break;case"end":y[l]+=x*(n&&h?-1:1);break}return y}const w6=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:a=[],platform:l}=n,u=a.filter(Boolean),f=await(l.isRTL==null?void 0:l.isRTL(e));let h=await l.getElementRects({reference:t,floating:e,strategy:s}),{x:g,y:p}=qj(h,r,f),x=r,y={},k=0;for(let w=0;w<u.length;w++){const{name:S,fn:N}=u[w],{x:C,y:j,data:A,reset:I}=await N({x:g,y:p,initialPlacement:r,placement:x,strategy:s,middlewareData:y,rects:h,platform:l,elements:{reference:t,floating:e}});g=C??g,p=j??p,y={...y,[S]:{...y[S],...A}},I&&k<=50&&(k++,typeof I=="object"&&(I.placement&&(x=I.placement),I.rects&&(h=I.rects===!0?await l.getElementRects({reference:t,floating:e,strategy:s}):I.rects),{x:g,y:p}=qj(h,x,f)),w=-1)}return{x:g,y:p,placement:x,strategy:s,middlewareData:y}};async function Sd(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:a,rects:l,elements:u,strategy:f}=t,{boundary:h="clippingAncestors",rootBoundary:g="viewport",elementContext:p="floating",altBoundary:x=!1,padding:y=0}=Hi(e,t),k=aT(y),S=u[x?p==="floating"?"reference":"floating":p],N=Rm(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(S)))==null||n?S:S.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(u.floating)),boundary:h,rootBoundary:g,strategy:f})),C=p==="floating"?{x:r,y:s,width:l.floating.width,height:l.floating.height}:l.reference,j=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u.floating)),A=await(a.isElement==null?void 0:a.isElement(j))?await(a.getScale==null?void 0:a.getScale(j))||{x:1,y:1}:{x:1,y:1},I=Rm(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:C,offsetParent:j,strategy:f}):C);return{top:(N.top-I.top+k.top)/A.y,bottom:(I.bottom-N.bottom+k.bottom)/A.y,left:(N.left-I.left+k.left)/A.x,right:(I.right-N.right+k.right)/A.x}}const _6=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:a,platform:l,elements:u,middlewareData:f}=e,{element:h,padding:g=0}=Hi(t,e)||{};if(h==null)return{};const p=aT(g),x={x:n,y:r},y=f0(s),k=d0(y),w=await l.getDimensions(h),S=y==="y",N=S?"top":"left",C=S?"bottom":"right",j=S?"clientHeight":"clientWidth",A=a.reference[k]+a.reference[y]-x[y]-a.floating[k],I=x[y]-a.reference[y],T=await(l.getOffsetParent==null?void 0:l.getOffsetParent(h));let E=T?T[j]:0;(!E||!await(l.isElement==null?void 0:l.isElement(T)))&&(E=u.floating[j]||a.floating[k]);const R=A/2-I/2,z=E/2-w[k]/2-1,D=Ha(p[N],z),B=Ha(p[C],z),q=D,K=E-w[k]-B,G=E/2-w[k]/2+R,F=cb(q,G,K),M=!f.arrow&&Ac(s)!=null&&G!==F&&a.reference[k]/2-(G<q?D:B)-w[k]/2<0,V=M?G<q?G-q:G-K:0;return{[y]:x[y]+V,data:{[y]:F,centerOffset:G-F-V,...M&&{alignmentOffset:V}},reset:M}}}),k6=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:a,rects:l,initialPlacement:u,platform:f,elements:h}=e,{mainAxis:g=!0,crossAxis:p=!0,fallbackPlacements:x,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:k="none",flipAlignment:w=!0,...S}=Hi(t,e);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const N=Vi(s),C=Xs(u),j=Vi(u)===u,A=await(f.isRTL==null?void 0:f.isRTL(h.floating)),I=x||(j||!w?[Om(u)]:p6(u)),T=k!=="none";!x&&T&&I.push(...y6(u,w,k,A));const E=[u,...I],R=await Sd(e,S),z=[];let D=((r=a.flip)==null?void 0:r.overflows)||[];if(g&&z.push(R[N]),p){const G=m6(s,l,A);z.push(R[G[0]],R[G[1]])}if(D=[...D,{placement:s,overflows:z}],!z.every(G=>G<=0)){var B,q;const G=(((B=a.flip)==null?void 0:B.index)||0)+1,F=E[G];if(F&&(!(p==="alignment"?C!==Xs(F):!1)||D.every(U=>Xs(U.placement)===C?U.overflows[0]>0:!0)))return{data:{index:G,overflows:D},reset:{placement:F}};let M=(q=D.filter(V=>V.overflows[0]<=0).sort((V,U)=>V.overflows[1]-U.overflows[1])[0])==null?void 0:q.placement;if(!M)switch(y){case"bestFit":{var K;const V=(K=D.filter(U=>{if(T){const H=Xs(U.placement);return H===C||H==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(H=>H>0).reduce((H,L)=>H+L,0)]).sort((U,H)=>U[1]-H[1])[0])==null?void 0:K[0];V&&(M=V);break}case"initialPlacement":M=u;break}if(s!==M)return{reset:{placement:M}}}return{}}}};function Hj(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Vj(t){return u6.some(e=>t[e]>=0)}const S6=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...s}=Hi(t,e);switch(r){case"referenceHidden":{const a=await Sd(e,{...s,elementContext:"reference"}),l=Hj(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Vj(l)}}}case"escaped":{const a=await Sd(e,{...s,altBoundary:!0}),l=Hj(a,n.floating);return{data:{escapedOffsets:l,escaped:Vj(l)}}}default:return{}}}}},oT=new Set(["left","top"]);async function j6(t,e){const{placement:n,platform:r,elements:s}=t,a=await(r.isRTL==null?void 0:r.isRTL(s.floating)),l=Vi(n),u=Ac(n),f=Xs(n)==="y",h=oT.has(l)?-1:1,g=a&&f?-1:1,p=Hi(e,t);let{mainAxis:x,crossAxis:y,alignmentAxis:k}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof k=="number"&&(y=u==="end"?k*-1:k),f?{x:y*g,y:x*h}:{x:x*h,y:y*g}}const N6=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:a,placement:l,middlewareData:u}=e,f=await j6(e,t);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+f.x,y:a+f.y,data:{...f,placement:l}}}}},C6=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s}=e,{mainAxis:a=!0,crossAxis:l=!1,limiter:u={fn:S=>{let{x:N,y:C}=S;return{x:N,y:C}}},...f}=Hi(t,e),h={x:n,y:r},g=await Sd(e,f),p=Xs(Vi(s)),x=u0(p);let y=h[x],k=h[p];if(a){const S=x==="y"?"top":"left",N=x==="y"?"bottom":"right",C=y+g[S],j=y-g[N];y=cb(C,y,j)}if(l){const S=p==="y"?"top":"left",N=p==="y"?"bottom":"right",C=k+g[S],j=k-g[N];k=cb(C,k,j)}const w=u.fn({...e,[x]:y,[p]:k});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[x]:a,[p]:l}}}}}},E6=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:s,rects:a,middlewareData:l}=e,{offset:u=0,mainAxis:f=!0,crossAxis:h=!0}=Hi(t,e),g={x:n,y:r},p=Xs(s),x=u0(p);let y=g[x],k=g[p];const w=Hi(u,e),S=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(f){const j=x==="y"?"height":"width",A=a.reference[x]-a.floating[j]+S.mainAxis,I=a.reference[x]+a.reference[j]-S.mainAxis;y<A?y=A:y>I&&(y=I)}if(h){var N,C;const j=x==="y"?"width":"height",A=oT.has(Vi(s)),I=a.reference[p]-a.floating[j]+(A&&((N=l.offset)==null?void 0:N[p])||0)+(A?0:S.crossAxis),T=a.reference[p]+a.reference[j]+(A?0:((C=l.offset)==null?void 0:C[p])||0)-(A?S.crossAxis:0);k<I?k=I:k>T&&(k=T)}return{[x]:y,[p]:k}}}},T6=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:a,platform:l,elements:u}=e,{apply:f=()=>{},...h}=Hi(t,e),g=await Sd(e,h),p=Vi(s),x=Ac(s),y=Xs(s)==="y",{width:k,height:w}=a.floating;let S,N;p==="top"||p==="bottom"?(S=p,N=x===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(N=p,S=x==="end"?"top":"bottom");const C=w-g.top-g.bottom,j=k-g.left-g.right,A=Ha(w-g[S],C),I=Ha(k-g[N],j),T=!e.middlewareData.shift;let E=A,R=I;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(R=j),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(E=C),T&&!x){const D=Ur(g.left,0),B=Ur(g.right,0),q=Ur(g.top,0),K=Ur(g.bottom,0);y?R=k-2*(D!==0||B!==0?D+B:Ur(g.left,g.right)):E=w-2*(q!==0||K!==0?q+K:Ur(g.top,g.bottom))}await f({...e,availableWidth:R,availableHeight:E});const z=await l.getDimensions(u.floating);return k!==z.width||w!==z.height?{reset:{rects:!0}}:{}}}};function rp(){return typeof window<"u"}function Oc(t){return lT(t)?(t.nodeName||"").toLowerCase():"#document"}function Hr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function oi(t){var e;return(e=(lT(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function lT(t){return rp()?t instanceof Node||t instanceof Hr(t).Node:!1}function Ds(t){return rp()?t instanceof Element||t instanceof Hr(t).Element:!1}function si(t){return rp()?t instanceof HTMLElement||t instanceof Hr(t).HTMLElement:!1}function Kj(t){return!rp()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Hr(t).ShadowRoot}const A6=new Set(["inline","contents"]);function zd(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Is(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!A6.has(s)}const O6=new Set(["table","td","th"]);function R6(t){return O6.has(Oc(t))}const M6=[":popover-open",":modal"];function sp(t){return M6.some(e=>{try{return t.matches(e)}catch{return!1}})}const D6=["transform","translate","scale","rotate","perspective"],I6=["transform","translate","scale","rotate","perspective","filter"],L6=["paint","layout","strict","content"];function h0(t){const e=m0(),n=Ds(t)?Is(t):t;return D6.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||I6.some(r=>(n.willChange||"").includes(r))||L6.some(r=>(n.contain||"").includes(r))}function P6(t){let e=Va(t);for(;si(e)&&!gc(e);){if(h0(e))return e;if(sp(e))return null;e=Va(e)}return null}function m0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const $6=new Set(["html","body","#document"]);function gc(t){return $6.has(Oc(t))}function Is(t){return Hr(t).getComputedStyle(t)}function ip(t){return Ds(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Va(t){if(Oc(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Kj(t)&&t.host||oi(t);return Kj(e)?e.host:e}function cT(t){const e=Va(t);return gc(e)?t.ownerDocument?t.ownerDocument.body:t.body:si(e)&&zd(e)?e:cT(e)}function jd(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=cT(t),a=s===((r=t.ownerDocument)==null?void 0:r.body),l=Hr(s);if(a){const u=db(l);return e.concat(l,l.visualViewport||[],zd(s)?s:[],u&&n?jd(u):[])}return e.concat(s,jd(s,[],n))}function db(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function uT(t){const e=Is(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=si(t),a=s?t.offsetWidth:n,l=s?t.offsetHeight:r,u=Am(n)!==a||Am(r)!==l;return u&&(n=a,r=l),{width:n,height:r,$:u}}function p0(t){return Ds(t)?t:t.contextElement}function rc(t){const e=p0(t);if(!si(e))return ti(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:a}=uT(e);let l=(a?Am(n.width):n.width)/r,u=(a?Am(n.height):n.height)/s;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const z6=ti(0);function dT(t){const e=Hr(t);return!m0()||!e.visualViewport?z6:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function F6(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Hr(t)?!1:e}function $o(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),a=p0(t);let l=ti(1);e&&(r?Ds(r)&&(l=rc(r)):l=rc(t));const u=F6(a,n,r)?dT(a):ti(0);let f=(s.left+u.x)/l.x,h=(s.top+u.y)/l.y,g=s.width/l.x,p=s.height/l.y;if(a){const x=Hr(a),y=r&&Ds(r)?Hr(r):r;let k=x,w=db(k);for(;w&&r&&y!==k;){const S=rc(w),N=w.getBoundingClientRect(),C=Is(w),j=N.left+(w.clientLeft+parseFloat(C.paddingLeft))*S.x,A=N.top+(w.clientTop+parseFloat(C.paddingTop))*S.y;f*=S.x,h*=S.y,g*=S.x,p*=S.y,f+=j,h+=A,k=Hr(w),w=db(k)}}return Rm({width:g,height:p,x:f,y:h})}function ap(t,e){const n=ip(t).scrollLeft;return e?e.left+n:$o(oi(t)).left+n}function fT(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-ap(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function B6(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const a=s==="fixed",l=oi(r),u=e?sp(e.floating):!1;if(r===l||u&&a)return n;let f={scrollLeft:0,scrollTop:0},h=ti(1);const g=ti(0),p=si(r);if((p||!p&&!a)&&((Oc(r)!=="body"||zd(l))&&(f=ip(r)),si(r))){const y=$o(r);h=rc(r),g.x=y.x+r.clientLeft,g.y=y.y+r.clientTop}const x=l&&!p&&!a?fT(l,f):ti(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-f.scrollLeft*h.x+g.x+x.x,y:n.y*h.y-f.scrollTop*h.y+g.y+x.y}}function U6(t){return Array.from(t.getClientRects())}function q6(t){const e=oi(t),n=ip(t),r=t.ownerDocument.body,s=Ur(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=Ur(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+ap(t);const u=-n.scrollTop;return Is(r).direction==="rtl"&&(l+=Ur(e.clientWidth,r.clientWidth)-s),{width:s,height:a,x:l,y:u}}const Yj=25;function H6(t,e){const n=Hr(t),r=oi(t),s=n.visualViewport;let a=r.clientWidth,l=r.clientHeight,u=0,f=0;if(s){a=s.width,l=s.height;const g=m0();(!g||g&&e==="fixed")&&(u=s.offsetLeft,f=s.offsetTop)}const h=ap(r);if(h<=0){const g=r.ownerDocument,p=g.body,x=getComputedStyle(p),y=g.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,k=Math.abs(r.clientWidth-p.clientWidth-y);k<=Yj&&(a-=k)}else h<=Yj&&(a+=h);return{width:a,height:l,x:u,y:f}}const V6=new Set(["absolute","fixed"]);function K6(t,e){const n=$o(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,a=si(t)?rc(t):ti(1),l=t.clientWidth*a.x,u=t.clientHeight*a.y,f=s*a.x,h=r*a.y;return{width:l,height:u,x:f,y:h}}function Gj(t,e,n){let r;if(e==="viewport")r=H6(t,n);else if(e==="document")r=q6(oi(t));else if(Ds(e))r=K6(e,n);else{const s=dT(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Rm(r)}function hT(t,e){const n=Va(t);return n===e||!Ds(n)||gc(n)?!1:Is(n).position==="fixed"||hT(n,e)}function Y6(t,e){const n=e.get(t);if(n)return n;let r=jd(t,[],!1).filter(u=>Ds(u)&&Oc(u)!=="body"),s=null;const a=Is(t).position==="fixed";let l=a?Va(t):t;for(;Ds(l)&&!gc(l);){const u=Is(l),f=h0(l);!f&&u.position==="fixed"&&(s=null),(a?!f&&!s:!f&&u.position==="static"&&!!s&&V6.has(s.position)||zd(l)&&!f&&hT(t,l))?r=r.filter(g=>g!==l):s=u,l=Va(l)}return e.set(t,r),r}function G6(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const l=[...n==="clippingAncestors"?sp(e)?[]:Y6(e,this._c):[].concat(n),r],u=l[0],f=l.reduce((h,g)=>{const p=Gj(e,g,s);return h.top=Ur(p.top,h.top),h.right=Ha(p.right,h.right),h.bottom=Ha(p.bottom,h.bottom),h.left=Ur(p.left,h.left),h},Gj(e,u,s));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function Z6(t){const{width:e,height:n}=uT(t);return{width:e,height:n}}function W6(t,e,n){const r=si(e),s=oi(e),a=n==="fixed",l=$o(t,!0,a,e);let u={scrollLeft:0,scrollTop:0};const f=ti(0);function h(){f.x=ap(s)}if(r||!r&&!a)if((Oc(e)!=="body"||zd(s))&&(u=ip(e)),r){const y=$o(e,!0,a,e);f.x=y.x+e.clientLeft,f.y=y.y+e.clientTop}else s&&h();a&&!r&&s&&h();const g=s&&!r&&!a?fT(s,u):ti(0),p=l.left+u.scrollLeft-f.x-g.x,x=l.top+u.scrollTop-f.y-g.y;return{x:p,y:x,width:l.width,height:l.height}}function jx(t){return Is(t).position==="static"}function Zj(t,e){if(!si(t)||Is(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return oi(t)===n&&(n=n.ownerDocument.body),n}function mT(t,e){const n=Hr(t);if(sp(t))return n;if(!si(t)){let s=Va(t);for(;s&&!gc(s);){if(Ds(s)&&!jx(s))return s;s=Va(s)}return n}let r=Zj(t,e);for(;r&&R6(r)&&jx(r);)r=Zj(r,e);return r&&gc(r)&&jx(r)&&!h0(r)?n:r||P6(t)||n}const Q6=async function(t){const e=this.getOffsetParent||mT,n=this.getDimensions,r=await n(t.floating);return{reference:W6(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function X6(t){return Is(t).direction==="rtl"}const J6={convertOffsetParentRelativeRectToViewportRelativeRect:B6,getDocumentElement:oi,getClippingRect:G6,getOffsetParent:mT,getElementRects:Q6,getClientRects:U6,getDimensions:Z6,getScale:rc,isElement:Ds,isRTL:X6};function pT(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function eF(t,e){let n=null,r;const s=oi(t);function a(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),a();const h=t.getBoundingClientRect(),{left:g,top:p,width:x,height:y}=h;if(u||e(),!x||!y)return;const k=jh(p),w=jh(s.clientWidth-(g+x)),S=jh(s.clientHeight-(p+y)),N=jh(g),j={rootMargin:-k+"px "+-w+"px "+-S+"px "+-N+"px",threshold:Ur(0,Ha(1,f))||1};let A=!0;function I(T){const E=T[0].intersectionRatio;if(E!==f){if(!A)return l();E?l(!1,E):r=setTimeout(()=>{l(!1,1e-7)},1e3)}E===1&&!pT(h,t.getBoundingClientRect())&&l(),A=!1}try{n=new IntersectionObserver(I,{...j,root:s.ownerDocument})}catch{n=new IntersectionObserver(I,j)}n.observe(t)}return l(!0),a}function tF(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:f=!1}=r,h=p0(t),g=s||a?[...h?jd(h):[],...jd(e)]:[];g.forEach(N=>{s&&N.addEventListener("scroll",n,{passive:!0}),a&&N.addEventListener("resize",n)});const p=h&&u?eF(h,n):null;let x=-1,y=null;l&&(y=new ResizeObserver(N=>{let[C]=N;C&&C.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var j;(j=y)==null||j.observe(e)})),n()}),h&&!f&&y.observe(h),y.observe(e));let k,w=f?$o(t):null;f&&S();function S(){const N=$o(t);w&&!pT(w,N)&&n(),w=N,k=requestAnimationFrame(S)}return n(),()=>{var N;g.forEach(C=>{s&&C.removeEventListener("scroll",n),a&&C.removeEventListener("resize",n)}),p==null||p(),(N=y)==null||N.disconnect(),y=null,f&&cancelAnimationFrame(k)}}const nF=N6,rF=C6,sF=k6,iF=T6,aF=S6,Wj=_6,oF=E6,lF=(t,e,n)=>{const r=new Map,s={platform:J6,...n},a={...s.platform,_c:r};return w6(t,e,{...s,platform:a})};var cF=typeof document<"u",uF=function(){},Gh=cF?_.useLayoutEffect:uF;function Mm(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Mm(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(!(a==="_owner"&&t.$$typeof)&&!Mm(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function gT(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Qj(t,e){const n=gT(t);return Math.round(e*n)/n}function Nx(t){const e=_.useRef(t);return Gh(()=>{e.current=t}),e}function dF(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:a,floating:l}={},transform:u=!0,whileElementsMounted:f,open:h}=t,[g,p]=_.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[x,y]=_.useState(r);Mm(x,r)||y(r);const[k,w]=_.useState(null),[S,N]=_.useState(null),C=_.useCallback(U=>{U!==T.current&&(T.current=U,w(U))},[]),j=_.useCallback(U=>{U!==E.current&&(E.current=U,N(U))},[]),A=a||k,I=l||S,T=_.useRef(null),E=_.useRef(null),R=_.useRef(g),z=f!=null,D=Nx(f),B=Nx(s),q=Nx(h),K=_.useCallback(()=>{if(!T.current||!E.current)return;const U={placement:e,strategy:n,middleware:x};B.current&&(U.platform=B.current),lF(T.current,E.current,U).then(H=>{const L={...H,isPositioned:q.current!==!1};G.current&&!Mm(R.current,L)&&(R.current=L,Vm.flushSync(()=>{p(L)}))})},[x,e,n,B,q]);Gh(()=>{h===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,p(U=>({...U,isPositioned:!1})))},[h]);const G=_.useRef(!1);Gh(()=>(G.current=!0,()=>{G.current=!1}),[]),Gh(()=>{if(A&&(T.current=A),I&&(E.current=I),A&&I){if(D.current)return D.current(A,I,K);K()}},[A,I,K,D,z]);const F=_.useMemo(()=>({reference:T,floating:E,setReference:C,setFloating:j}),[C,j]),M=_.useMemo(()=>({reference:A,floating:I}),[A,I]),V=_.useMemo(()=>{const U={position:n,left:0,top:0};if(!M.floating)return U;const H=Qj(M.floating,g.x),L=Qj(M.floating,g.y);return u?{...U,transform:"translate("+H+"px, "+L+"px)",...gT(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:L}},[n,u,M.floating,g.x,g.y]);return _.useMemo(()=>({...g,update:K,refs:F,elements:M,floatingStyles:V}),[g,K,F,M,V])}const fF=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Wj({element:r.current,padding:s}).fn(n):{}:r?Wj({element:r,padding:s}).fn(n):{}}}},hF=(t,e)=>({...nF(t),options:[t,e]}),mF=(t,e)=>({...rF(t),options:[t,e]}),pF=(t,e)=>({...oF(t),options:[t,e]}),gF=(t,e)=>({...sF(t),options:[t,e]}),vF=(t,e)=>({...iF(t),options:[t,e]}),xF=(t,e)=>({...aF(t),options:[t,e]}),yF=(t,e)=>({...fF(t),options:[t,e]});var bF="Arrow",vT=_.forwardRef((t,e)=>{const{children:n,width:r=10,height:s=5,...a}=t;return c.jsx(Ct.svg,{...a,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});vT.displayName=bF;var wF=vT;function g0(t){const[e,n]=_.useState(void 0);return or(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let l,u;if("borderBoxSize"in a){const f=a.borderBoxSize,h=Array.isArray(f)?f[0]:f;l=h.inlineSize,u=h.blockSize}else l=t.offsetWidth,u=t.offsetHeight;n({width:l,height:u})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var v0="Popper",[xT,Rc]=Ka(v0),[_F,yT]=xT(v0),bT=t=>{const{__scopePopper:e,children:n}=t,[r,s]=_.useState(null);return c.jsx(_F,{scope:e,anchor:r,onAnchorChange:s,children:n})};bT.displayName=v0;var wT="PopperAnchor",_T=_.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,a=yT(wT,n),l=_.useRef(null),u=Bt(e,l),f=_.useRef(null);return _.useEffect(()=>{const h=f.current;f.current=(r==null?void 0:r.current)||l.current,h!==f.current&&a.onAnchorChange(f.current)}),r?null:c.jsx(Ct.div,{...s,ref:u})});_T.displayName=wT;var x0="PopperContent",[kF,SF]=xT(x0),kT=_.forwardRef((t,e)=>{var ge,Fe,Qe,$e,Q,_e;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:a="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:f=!0,collisionBoundary:h=[],collisionPadding:g=0,sticky:p="partial",hideWhenDetached:x=!1,updatePositionStrategy:y="optimized",onPlaced:k,...w}=t,S=yT(x0,n),[N,C]=_.useState(null),j=Bt(e,Oe=>C(Oe)),[A,I]=_.useState(null),T=g0(A),E=(T==null?void 0:T.width)??0,R=(T==null?void 0:T.height)??0,z=r+(a!=="center"?"-"+a:""),D=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},B=Array.isArray(h)?h:[h],q=B.length>0,K={padding:D,boundary:B.filter(NF),altBoundary:q},{refs:G,floatingStyles:F,placement:M,isPositioned:V,middlewareData:U}=dF({strategy:"fixed",placement:z,whileElementsMounted:(...Oe)=>tF(...Oe,{animationFrame:y==="always"}),elements:{reference:S.anchor},middleware:[hF({mainAxis:s+R,alignmentAxis:l}),f&&mF({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?pF():void 0,...K}),f&&gF({...K}),vF({...K,apply:({elements:Oe,rects:le,availableWidth:he,availableHeight:Ee})=>{const{width:De,height:ve}=le.reference,ue=Oe.floating.style;ue.setProperty("--radix-popper-available-width",`${he}px`),ue.setProperty("--radix-popper-available-height",`${Ee}px`),ue.setProperty("--radix-popper-anchor-width",`${De}px`),ue.setProperty("--radix-popper-anchor-height",`${ve}px`)}}),A&&yF({element:A,padding:u}),CF({arrowWidth:E,arrowHeight:R}),x&&xF({strategy:"referenceHidden",...K})]}),[H,L]=NT(M),ne=Po(k);or(()=>{V&&(ne==null||ne())},[V,ne]);const ie=(ge=U.arrow)==null?void 0:ge.x,P=(Fe=U.arrow)==null?void 0:Fe.y,pe=((Qe=U.arrow)==null?void 0:Qe.centerOffset)!==0,[Pe,Ne]=_.useState();return or(()=>{N&&Ne(window.getComputedStyle(N).zIndex)},[N]),c.jsx("div",{ref:G.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:V?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Pe,"--radix-popper-transform-origin":[($e=U.transformOrigin)==null?void 0:$e.x,(Q=U.transformOrigin)==null?void 0:Q.y].join(" "),...((_e=U.hide)==null?void 0:_e.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:c.jsx(kF,{scope:n,placedSide:H,onArrowChange:I,arrowX:ie,arrowY:P,shouldHideArrow:pe,children:c.jsx(Ct.div,{"data-side":H,"data-align":L,...w,ref:j,style:{...w.style,animation:V?void 0:"none"}})})})});kT.displayName=x0;var ST="PopperArrow",jF={top:"bottom",right:"left",bottom:"top",left:"right"},jT=_.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,a=SF(ST,r),l=jF[a.placedSide];return c.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:c.jsx(wF,{...s,ref:n,style:{...s.style,display:"block"}})})});jT.displayName=ST;function NF(t){return t!==null}var CF=t=>({name:"transformOrigin",options:t,fn(e){var S,N,C;const{placement:n,rects:r,middlewareData:s}=e,l=((S=s.arrow)==null?void 0:S.centerOffset)!==0,u=l?0:t.arrowWidth,f=l?0:t.arrowHeight,[h,g]=NT(n),p={start:"0%",center:"50%",end:"100%"}[g],x=(((N=s.arrow)==null?void 0:N.x)??0)+u/2,y=(((C=s.arrow)==null?void 0:C.y)??0)+f/2;let k="",w="";return h==="bottom"?(k=l?p:`${x}px`,w=`${-f}px`):h==="top"?(k=l?p:`${x}px`,w=`${r.floating.height+f}px`):h==="right"?(k=`${-f}px`,w=l?p:`${y}px`):h==="left"&&(k=`${r.floating.width+f}px`,w=l?p:`${y}px`),{data:{x:k,y:w}}}});function NT(t){const[e,n="center"]=t.split("-");return[e,n]}var y0=bT,op=_T,b0=kT,w0=jT,EF="Portal",Fd=_.forwardRef((t,e)=>{var u;const{container:n,...r}=t,[s,a]=_.useState(!1);or(()=>a(!0),[]);const l=n||s&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return l?py.createPortal(c.jsx(Ct.div,{...r,ref:e}),l):null});Fd.displayName=EF;function TF(t,e){return _.useReducer((n,r)=>e[n][r]??n,t)}var Yi=t=>{const{present:e,children:n}=t,r=AF(e),s=typeof n=="function"?n({present:r.isPresent}):_.Children.only(n),a=Bt(r.ref,OF(s));return typeof n=="function"||r.isPresent?_.cloneElement(s,{ref:a}):null};Yi.displayName="Presence";function AF(t){const[e,n]=_.useState(),r=_.useRef(null),s=_.useRef(t),a=_.useRef("none"),l=t?"mounted":"unmounted",[u,f]=TF(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const h=Nh(r.current);a.current=u==="mounted"?h:"none"},[u]),or(()=>{const h=r.current,g=s.current;if(g!==t){const x=a.current,y=Nh(h);t?f("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?f("UNMOUNT"):f(g&&x!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,f]),or(()=>{if(e){let h;const g=e.ownerDocument.defaultView??window,p=y=>{const w=Nh(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&w&&(f("ANIMATION_END"),!s.current)){const S=e.style.animationFillMode;e.style.animationFillMode="forwards",h=g.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=S)})}},x=y=>{y.target===e&&(a.current=Nh(r.current))};return e.addEventListener("animationstart",x),e.addEventListener("animationcancel",p),e.addEventListener("animationend",p),()=>{g.clearTimeout(h),e.removeEventListener("animationstart",x),e.removeEventListener("animationcancel",p),e.removeEventListener("animationend",p)}}else f("ANIMATION_END")},[e,f]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:_.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function Nh(t){return(t==null?void 0:t.animationName)||"none"}function OF(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var RF=MC[" useInsertionEffect ".trim().toString()]||or;function zo({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[s,a,l]=MF({defaultProp:e,onChange:n}),u=t!==void 0,f=u?t:s;{const g=_.useRef(t!==void 0);_.useEffect(()=>{const p=g.current;p!==u&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=u},[u,r])}const h=_.useCallback(g=>{var p;if(u){const x=DF(g)?g(t):g;x!==t&&((p=l.current)==null||p.call(l,x))}else a(g)},[u,t,a,l]);return[f,h]}function MF({defaultProp:t,onChange:e}){const[n,r]=_.useState(t),s=_.useRef(n),a=_.useRef(e);return RF(()=>{a.current=e},[e]),_.useEffect(()=>{var l;s.current!==n&&((l=a.current)==null||l.call(a,n),s.current=n)},[n,s]),[n,r,a]}function DF(t){return typeof t=="function"}var CT=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),IF="VisuallyHidden",ET=_.forwardRef((t,e)=>c.jsx(Ct.span,{...t,ref:e,style:{...CT,...t.style}}));ET.displayName=IF;var LF=ET,[lp,ZQ]=Ka("Tooltip",[Rc]),cp=Rc(),TT="TooltipProvider",PF=700,fb="tooltip.open",[$F,_0]=lp(TT),AT=t=>{const{__scopeTooltip:e,delayDuration:n=PF,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:a}=t,l=_.useRef(!0),u=_.useRef(!1),f=_.useRef(0);return _.useEffect(()=>{const h=f.current;return()=>window.clearTimeout(h)},[]),c.jsx($F,{scope:e,isOpenDelayedRef:l,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(f.current),l.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:_.useCallback(h=>{u.current=h},[]),disableHoverableContent:s,children:a})};AT.displayName=TT;var Nd="Tooltip",[zF,Bd]=lp(Nd),OT=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:a,disableHoverableContent:l,delayDuration:u}=t,f=_0(Nd,t.__scopeTooltip),h=cp(e),[g,p]=_.useState(null),x=Pa(),y=_.useRef(0),k=l??f.disableHoverableContent,w=u??f.delayDuration,S=_.useRef(!1),[N,C]=zo({prop:r,defaultProp:s??!1,onChange:E=>{E?(f.onOpen(),document.dispatchEvent(new CustomEvent(fb))):f.onClose(),a==null||a(E)},caller:Nd}),j=_.useMemo(()=>N?S.current?"delayed-open":"instant-open":"closed",[N]),A=_.useCallback(()=>{window.clearTimeout(y.current),y.current=0,S.current=!1,C(!0)},[C]),I=_.useCallback(()=>{window.clearTimeout(y.current),y.current=0,C(!1)},[C]),T=_.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{S.current=!0,C(!0),y.current=0},w)},[w,C]);return _.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),c.jsx(y0,{...h,children:c.jsx(zF,{scope:e,contentId:x,open:N,stateAttribute:j,trigger:g,onTriggerChange:p,onTriggerEnter:_.useCallback(()=>{f.isOpenDelayedRef.current?T():A()},[f.isOpenDelayedRef,T,A]),onTriggerLeave:_.useCallback(()=>{k?I():(window.clearTimeout(y.current),y.current=0)},[I,k]),onOpen:A,onClose:I,disableHoverableContent:k,children:n})})};OT.displayName=Nd;var hb="TooltipTrigger",RT=_.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Bd(hb,n),a=_0(hb,n),l=cp(n),u=_.useRef(null),f=Bt(e,u,s.onTriggerChange),h=_.useRef(!1),g=_.useRef(!1),p=_.useCallback(()=>h.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),c.jsx(op,{asChild:!0,...l,children:c.jsx(Ct.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:f,onPointerMove:bt(t.onPointerMove,x=>{x.pointerType!=="touch"&&!g.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),g.current=!0)}),onPointerLeave:bt(t.onPointerLeave,()=>{s.onTriggerLeave(),g.current=!1}),onPointerDown:bt(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:bt(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:bt(t.onBlur,s.onClose),onClick:bt(t.onClick,s.onClose)})})});RT.displayName=hb;var k0="TooltipPortal",[FF,BF]=lp(k0,{forceMount:void 0}),MT=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,a=Bd(k0,e);return c.jsx(FF,{scope:e,forceMount:n,children:c.jsx(Yi,{present:n||a.open,children:c.jsx(Fd,{asChild:!0,container:s,children:r})})})};MT.displayName=k0;var vc="TooltipContent",DT=_.forwardRef((t,e)=>{const n=BF(vc,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...a}=t,l=Bd(vc,t.__scopeTooltip);return c.jsx(Yi,{present:r||l.open,children:l.disableHoverableContent?c.jsx(IT,{side:s,...a,ref:e}):c.jsx(UF,{side:s,...a,ref:e})})}),UF=_.forwardRef((t,e)=>{const n=Bd(vc,t.__scopeTooltip),r=_0(vc,t.__scopeTooltip),s=_.useRef(null),a=Bt(e,s),[l,u]=_.useState(null),{trigger:f,onClose:h}=n,g=s.current,{onPointerInTransitChange:p}=r,x=_.useCallback(()=>{u(null),p(!1)},[p]),y=_.useCallback((k,w)=>{const S=k.currentTarget,N={x:k.clientX,y:k.clientY},C=KF(N,S.getBoundingClientRect()),j=YF(N,C),A=GF(w.getBoundingClientRect()),I=WF([...j,...A]);u(I),p(!0)},[p]);return _.useEffect(()=>()=>x(),[x]),_.useEffect(()=>{if(f&&g){const k=S=>y(S,g),w=S=>y(S,f);return f.addEventListener("pointerleave",k),g.addEventListener("pointerleave",w),()=>{f.removeEventListener("pointerleave",k),g.removeEventListener("pointerleave",w)}}},[f,g,y,x]),_.useEffect(()=>{if(l){const k=w=>{const S=w.target,N={x:w.clientX,y:w.clientY},C=(f==null?void 0:f.contains(S))||(g==null?void 0:g.contains(S)),j=!ZF(N,l);C?x():j&&(x(),h())};return document.addEventListener("pointermove",k),()=>document.removeEventListener("pointermove",k)}},[f,g,l,h,x]),c.jsx(IT,{...t,ref:a})}),[qF,HF]=lp(Nd,{isInside:!1}),VF=Gz("TooltipContent"),IT=_.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:a,onPointerDownOutside:l,...u}=t,f=Bd(vc,n),h=cp(n),{onClose:g}=f;return _.useEffect(()=>(document.addEventListener(fb,g),()=>document.removeEventListener(fb,g)),[g]),_.useEffect(()=>{if(f.trigger){const p=x=>{const y=x.target;y!=null&&y.contains(f.trigger)&&g()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[f.trigger,g]),c.jsx($d,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:g,children:c.jsxs(b0,{"data-state":f.stateAttribute,...h,...u,ref:e,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(VF,{children:r}),c.jsx(qF,{scope:n,isInside:!0,children:c.jsx(LF,{id:f.contentId,role:"tooltip",children:s||r})})]})})});DT.displayName=vc;var LT="TooltipArrow",PT=_.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=cp(n);return HF(LT,n).isInside?null:c.jsx(w0,{...s,...r,ref:e})});PT.displayName=LT;function KF(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),a=Math.abs(e.left-t.x);switch(Math.min(n,r,s,a)){case a:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function YF(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function GF(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function ZF(t,e){const{x:n,y:r}=t;let s=!1;for(let a=0,l=e.length-1;a<e.length;l=a++){const u=e[a],f=e[l],h=u.x,g=u.y,p=f.x,x=f.y;g>r!=x>r&&n<(p-h)*(r-g)/(x-g)+h&&(s=!s)}return s}function WF(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),QF(e)}function QF(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const s=t[r];for(;e.length>=2;){const a=e[e.length-1],l=e[e.length-2];if((a.x-l.x)*(s.y-l.y)>=(a.y-l.y)*(s.x-l.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const a=n[n.length-1],l=n[n.length-2];if((a.x-l.x)*(s.y-l.y)>=(a.y-l.y)*(s.x-l.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var XF=AT,JF=OT,e8=RT,t8=MT,n8=DT,r8=PT;function Os({delayDuration:t=0,...e}){return c.jsx(XF,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function Dt({...t}){return c.jsx(Os,{children:c.jsx(JF,{"data-slot":"tooltip",...t})})}function It({...t}){return c.jsx(e8,{"data-slot":"tooltip-trigger",...t})}function Lt({className:t,sideOffset:e=0,children:n,...r}){return c.jsx(t8,{children:c.jsxs(n8,{"data-slot":"tooltip-content",sideOffset:e,className:ae("bg-popover text-popover-foreground border border-border/60 shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...r,children:[n,c.jsx(r8,{className:"bg-popover fill-popover z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] border-l border-b border-border/60"})]})})}const Xj=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Jj=RE,S0=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return Jj(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:a}=e,l=Object.keys(s).map(h=>{const g=n==null?void 0:n[h],p=a==null?void 0:a[h];if(g===null)return null;const x=Xj(g)||Xj(p);return s[h][x]}),u=n&&Object.entries(n).reduce((h,g)=>{let[p,x]=g;return x===void 0||(h[p]=x),h},{}),f=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,g)=>{let{class:p,className:x,...y}=g;return Object.entries(y).every(k=>{let[w,S]=k;return Array.isArray(S)?S.includes({...a,...u}[w]):{...a,...u}[w]===S})?[...h,p,x]:h},[]);return Jj(t,l,f,n==null?void 0:n.class,n==null?void 0:n.className)},s8=S0("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function ye({className:t,variant:e,size:n,asChild:r=!1,...s}){const a=r?Kz:"button";return c.jsx(a,{"data-slot":"button",className:ae(s8({variant:e,size:n,className:t})),...s})}const up=_.forwardRef(({children:t,tooltip:e,side:n="bottom",className:r,...s},a)=>c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsxs(ye,{variant:"ghost",size:"icon",...s,className:ae("size-6 p-1",r),ref:a,children:[t,c.jsx("span",{className:"sr-only",children:e})]})}),c.jsx(Lt,{side:n,children:e})]}));up.displayName="TooltipIconButton";function Zh({value:t,tooltip:e="Copy",copiedTooltip:n="Copied!",className:r,size:s=12}){const[a,l]=_.useState(!1),u=()=>{navigator.clipboard.writeText(t).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)}).catch(()=>{})};return c.jsx(up,{tooltip:a?n:e,onClick:u,className:r,children:a?c.jsx(Es,{size:s}):c.jsx(Pd,{size:s})})}class i8{constructor(){if(this._speaking=!1,this.subscribers=new Set,this.utterance=null,this.voices=[],this.voiceSubscribers=new Set,this.preferredVoiceName=null,this.supported){try{const n=window.localStorage.getItem("ttsVoiceName");this.preferredVoiceName=n&&n.length?n:null}catch{}const e=()=>{try{const n=window.speechSynthesis.getVoices()||[];(n.length!==this.voices.length||n.some((s,a)=>{var l;return s.name!==((l=this.voices[a])==null?void 0:l.name)}))&&(this.voices=n,this.voiceSubscribers.forEach(s=>s()))}catch{}};e();try{window.speechSynthesis.addEventListener("voiceschanged",e)}catch{}}}get supported(){return typeof window<"u"&&"speechSynthesis"in window&&"SpeechSynthesisUtterance"in window}isSpeaking(){return this._speaking}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}subscribeVoices(e){return this.voiceSubscribers.add(e),()=>{this.voiceSubscribers.delete(e)}}notify(){for(const e of this.subscribers)try{e()}catch{}}stop(){if(this.supported){try{window.speechSynthesis.cancel()}catch{}this.utterance=null,this._speaking&&(this._speaking=!1,this.notify())}}speak(e,n){if(!this.supported||!e||!e.trim())return;this.stop();const r=new window.SpeechSynthesisUtterance(e);(n==null?void 0:n.rate)!=null&&(r.rate=n.rate),(n==null?void 0:n.pitch)!=null&&(r.pitch=n.pitch);const s=this.resolveVoice();if(s)try{r.voice=s,n!=null&&n.lang?r.lang=n.lang:s.lang&&(r.lang=s.lang)}catch{}else n!=null&&n.lang&&(r.lang=n.lang);r.onstart=()=>{this.utterance===r&&(this._speaking=!0,this.notify())};const a=()=>{this.utterance===r&&(this._speaking=!1,this.utterance=null,this.notify())};r.onend=a,r.onerror=a;try{this.utterance=r,window.speechSynthesis.speak(r),this._speaking||(this._speaking=!0,this.notify())}catch{a()}}getVoices(){return this.voices}setPreferredVoice(e){this.preferredVoiceName=e&&e.length?e:null;try{this.preferredVoiceName?window.localStorage.setItem("ttsVoiceName",this.preferredVoiceName):window.localStorage.removeItem("ttsVoiceName")}catch{}this.voiceSubscribers.forEach(n=>n())}getPreferredVoiceName(){return this.preferredVoiceName}resolveVoice(){if(!this.voices.length)return null;const e=this.preferredVoiceName?this.voices.find(a=>a.name===this.preferredVoiceName):null;if(e)return e;const n=this.voices.find(a=>{var l;return a.name.toLowerCase()==="google uk english female"||a.name.toLowerCase().includes("google uk english female")&&((l=a.lang)==null?void 0:l.toLowerCase().startsWith("en-gb"))});if(n)return n;const r=a=>{const l=a.name.toLowerCase(),u=(a.lang??"").toLowerCase();let f=0;return(u==="en"||u.startsWith("en-"))&&(f+=3),l.includes("google")&&(f+=5),(l.includes("microsoft")||l.includes("azure"))&&(f+=4),(l.includes("natural")||l.includes("neural")||l.includes("premium"))&&(f+=4),l.includes("siri")&&(f+=3),l.includes("female")&&(f+=1),f};return[...this.voices].sort((a,l)=>r(l)-r(a))[0]||this.voices[0]||null}}const eN=globalThis,Fr=eN.__speechController??(eN.__speechController=new i8);function a8(){const[t,e]=_.useState(Fr.getVoices()),[n,r]=_.useState(Fr.getPreferredVoiceName());return _.useEffect(()=>{const a=Fr.subscribeVoices(()=>{e(Fr.getVoices()),r(Fr.getPreferredVoiceName())});return()=>a()},[]),{voices:t,selected:n,setSelected:a=>{Fr.setPreferredVoice(a),r(Fr.getPreferredVoiceName())}}}function Wh({value:t,tooltip:e="Speak",stopTooltip:n="Stop",className:r,rate:s=1,pitch:a=1,lang:l}){const[u,f]=_.useState(!1),h=Fr.supported,g=(t??"").trim().length>0;_.useEffect(()=>(f(Fr.isSpeaking()),Fr.subscribe(()=>f(Fr.isSpeaking()))),[]);const p=()=>{if(!(!h||!g)){if(u)return Fr.stop();Fr.speak(t,{rate:s,pitch:a,lang:l})}};return c.jsx(up,{tooltip:u?n:e,onClick:p,className:r,disabled:!h||!g,children:u?c.jsx(eT,{size:12}):c.jsx(ob,{size:12})})}function o8({error:t,onDismiss:e}){var u;const[n,r]=_.useState(!1),s=(u=t.detailedIssues)==null?void 0:u[0],a=s!=null&&s.context&&typeof s.context=="object"&&"detailedIssues"in s.context?s.context.detailedIssues:[],l=a.length>0?`${t.message}
|
|
431
|
-
|
|
432
|
-
Details:
|
|
433
|
-
${a.map(f=>{let h=f.message;if(f.context){const g=typeof f.context=="string"?f.context:JSON.stringify(f.context,null,2);h+=`
|
|
434
|
-
Context: ${g}`}return h}).join(`
|
|
435
|
-
|
|
436
|
-
`)}`:t.message;return c.jsx("div",{className:"w-full rounded-lg p-4 mb-4 border shadow-sm bg-destructive/10 border-destructive/40",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(Ln,{className:"h-5 w-5 text-destructive mt-0.5 flex-shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("h3",{className:"text-sm font-medium text-destructive",children:"Error"}),t.context&&c.jsx("span",{className:"text-xs bg-destructive/15 text-destructive px-2 py-0.5 rounded-full",children:t.context})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[a.length>0&&c.jsx("button",{onClick:()=>r(!n),className:"p-1 hover:bg-destructive/15 rounded text-destructive",title:n?"Collapse":"Expand",children:n?c.jsx(Ua,{className:"h-4 w-4"}):c.jsx(Ar,{className:"h-4 w-4"})}),c.jsx(Zh,{value:l,tooltip:"Copy error",className:"p-1 hover:bg-destructive/15 rounded text-destructive",size:16}),c.jsx(Wh,{value:l,tooltip:"Read error",className:"p-1 hover:bg-destructive/15 rounded text-destructive"}),c.jsx("button",{onClick:e,className:"p-1 hover:bg-destructive/15 rounded text-destructive",title:"Dismiss",children:c.jsx(Er,{className:"h-4 w-4"})})]})]}),c.jsx("div",{className:"mt-2 text-sm text-destructive",children:t.message}),n&&a.length>0&&c.jsx("div",{className:"mt-3",children:c.jsx("div",{className:"text-xs text-destructive bg-destructive/10 p-3 rounded border border-destructive/30 overflow-auto max-h-60",children:a.map((f,h)=>c.jsxs("div",{className:"mb-2 last:mb-0",children:[c.jsx("div",{className:"font-medium",children:f.message}),f.context!=null&&c.jsx("div",{className:"text-destructive/70 mt-1",children:typeof f.context=="string"?f.context:JSON.stringify(f.context,null,2)})]},h))})})]})]})})}function l8(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const c8=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,u8=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,d8={};function tN(t,e){return(d8.jsx?u8:c8).test(t)}const f8=/[ \t\n\f\r]/g;function h8(t){return typeof t=="object"?t.type==="text"?nN(t.value):!1:nN(t)}function nN(t){return t.replace(f8,"")===""}let Ud=class{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}};Ud.prototype.normal={};Ud.prototype.property={};Ud.prototype.space=void 0;function $T(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new Ud(n,r,e)}function mb(t){return t.toLowerCase()}class Or{constructor(e,n){this.attribute=n,this.property=e}}Or.prototype.attribute="";Or.prototype.booleanish=!1;Or.prototype.boolean=!1;Or.prototype.commaOrSpaceSeparated=!1;Or.prototype.commaSeparated=!1;Or.prototype.defined=!1;Or.prototype.mustUseProperty=!1;Or.prototype.number=!1;Or.prototype.overloadedBoolean=!1;Or.prototype.property="";Or.prototype.spaceSeparated=!1;Or.prototype.space=void 0;let m8=0;const pt=Vo(),Cn=Vo(),pb=Vo(),ke=Vo(),Wt=Vo(),sc=Vo(),zr=Vo();function Vo(){return 2**++m8}const gb=Object.freeze(Object.defineProperty({__proto__:null,boolean:pt,booleanish:Cn,commaOrSpaceSeparated:zr,commaSeparated:sc,number:ke,overloadedBoolean:pb,spaceSeparated:Wt},Symbol.toStringTag,{value:"Module"})),Cx=Object.keys(gb);class j0 extends Or{constructor(e,n,r,s){let a=-1;if(super(e,n),rN(this,"space",s),typeof r=="number")for(;++a<Cx.length;){const l=Cx[a];rN(this,Cx[a],(r&gb[l])===gb[l])}}}j0.prototype.defined=!0;function rN(t,e,n){n&&(t[e]=n)}function Mc(t){const e={},n={};for(const[r,s]of Object.entries(t.properties)){const a=new j0(r,t.transform(t.attributes||{},r),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),e[r]=a,n[mb(r)]=r,n[mb(a.attribute)]=r}return new Ud(e,n,t.space)}const zT=Mc({properties:{ariaActiveDescendant:null,ariaAtomic:Cn,ariaAutoComplete:null,ariaBusy:Cn,ariaChecked:Cn,ariaColCount:ke,ariaColIndex:ke,ariaColSpan:ke,ariaControls:Wt,ariaCurrent:null,ariaDescribedBy:Wt,ariaDetails:null,ariaDisabled:Cn,ariaDropEffect:Wt,ariaErrorMessage:null,ariaExpanded:Cn,ariaFlowTo:Wt,ariaGrabbed:Cn,ariaHasPopup:null,ariaHidden:Cn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Wt,ariaLevel:ke,ariaLive:null,ariaModal:Cn,ariaMultiLine:Cn,ariaMultiSelectable:Cn,ariaOrientation:null,ariaOwns:Wt,ariaPlaceholder:null,ariaPosInSet:ke,ariaPressed:Cn,ariaReadOnly:Cn,ariaRelevant:null,ariaRequired:Cn,ariaRoleDescription:Wt,ariaRowCount:ke,ariaRowIndex:ke,ariaRowSpan:ke,ariaSelected:Cn,ariaSetSize:ke,ariaSort:null,ariaValueMax:ke,ariaValueMin:ke,ariaValueNow:ke,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function FT(t,e){return e in t?t[e]:e}function BT(t,e){return FT(t,e.toLowerCase())}const p8=Mc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:sc,acceptCharset:Wt,accessKey:Wt,action:null,allow:null,allowFullScreen:pt,allowPaymentRequest:pt,allowUserMedia:pt,alt:null,as:null,async:pt,autoCapitalize:null,autoComplete:Wt,autoFocus:pt,autoPlay:pt,blocking:Wt,capture:null,charSet:null,checked:pt,cite:null,className:Wt,cols:ke,colSpan:null,content:null,contentEditable:Cn,controls:pt,controlsList:Wt,coords:ke|sc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:pt,defer:pt,dir:null,dirName:null,disabled:pt,download:pb,draggable:Cn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:pt,formTarget:null,headers:Wt,height:ke,hidden:pb,high:ke,href:null,hrefLang:null,htmlFor:Wt,httpEquiv:Wt,id:null,imageSizes:null,imageSrcSet:null,inert:pt,inputMode:null,integrity:null,is:null,isMap:pt,itemId:null,itemProp:Wt,itemRef:Wt,itemScope:pt,itemType:Wt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:pt,low:ke,manifest:null,max:null,maxLength:ke,media:null,method:null,min:null,minLength:ke,multiple:pt,muted:pt,name:null,nonce:null,noModule:pt,noValidate:pt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:pt,optimum:ke,pattern:null,ping:Wt,placeholder:null,playsInline:pt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:pt,referrerPolicy:null,rel:Wt,required:pt,reversed:pt,rows:ke,rowSpan:ke,sandbox:Wt,scope:null,scoped:pt,seamless:pt,selected:pt,shadowRootClonable:pt,shadowRootDelegatesFocus:pt,shadowRootMode:null,shape:null,size:ke,sizes:null,slot:null,span:ke,spellCheck:Cn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ke,step:null,style:null,tabIndex:ke,target:null,title:null,translate:null,type:null,typeMustMatch:pt,useMap:null,value:Cn,width:ke,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Wt,axis:null,background:null,bgColor:null,border:ke,borderColor:null,bottomMargin:ke,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:pt,declare:pt,event:null,face:null,frame:null,frameBorder:null,hSpace:ke,leftMargin:ke,link:null,longDesc:null,lowSrc:null,marginHeight:ke,marginWidth:ke,noResize:pt,noHref:pt,noShade:pt,noWrap:pt,object:null,profile:null,prompt:null,rev:null,rightMargin:ke,rules:null,scheme:null,scrolling:Cn,standby:null,summary:null,text:null,topMargin:ke,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ke,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:pt,disableRemotePlayback:pt,prefix:null,property:null,results:ke,security:null,unselectable:null},space:"html",transform:BT}),g8=Mc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:zr,accentHeight:ke,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ke,amplitude:ke,arabicForm:null,ascent:ke,attributeName:null,attributeType:null,azimuth:ke,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ke,by:null,calcMode:null,capHeight:ke,className:Wt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ke,diffuseConstant:ke,direction:null,display:null,dur:null,divisor:ke,dominantBaseline:null,download:pt,dx:null,dy:null,edgeMode:null,editable:null,elevation:ke,enableBackground:null,end:null,event:null,exponent:ke,externalResourcesRequired:null,fill:null,fillOpacity:ke,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:sc,g2:sc,glyphName:sc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ke,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ke,horizOriginX:ke,horizOriginY:ke,id:null,ideographic:ke,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ke,k:ke,k1:ke,k2:ke,k3:ke,k4:ke,kernelMatrix:zr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ke,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ke,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ke,overlineThickness:ke,paintOrder:null,panose1:null,path:null,pathLength:ke,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Wt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ke,pointsAtY:ke,pointsAtZ:ke,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:zr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:zr,rev:zr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:zr,requiredFeatures:zr,requiredFonts:zr,requiredFormats:zr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ke,specularExponent:ke,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ke,strikethroughThickness:ke,string:null,stroke:null,strokeDashArray:zr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ke,strokeOpacity:ke,strokeWidth:null,style:null,surfaceScale:ke,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:zr,tabIndex:ke,tableValues:null,target:null,targetX:ke,targetY:ke,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:zr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ke,underlineThickness:ke,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ke,values:null,vAlphabetic:ke,vMathematical:ke,vectorEffect:null,vHanging:ke,vIdeographic:ke,version:null,vertAdvY:ke,vertOriginX:ke,vertOriginY:ke,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ke,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:FT}),UT=Mc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),qT=Mc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:BT}),HT=Mc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),v8={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},x8=/[A-Z]/g,sN=/-[a-z]/g,y8=/^data[-\w.:]+$/i;function b8(t,e){const n=mb(e);let r=e,s=Or;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&y8.test(e)){if(e.charAt(4)==="-"){const a=e.slice(5).replace(sN,_8);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=e.slice(4);if(!sN.test(a)){let l=a.replace(x8,w8);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}s=j0}return new s(r,e)}function w8(t){return"-"+t.toLowerCase()}function _8(t){return t.charAt(1).toUpperCase()}const k8=$T([zT,p8,UT,qT,HT],"html"),N0=$T([zT,g8,UT,qT,HT],"svg");function S8(t){return t.join(" ").trim()}var Rl={},Ex,iN;function j8(){if(iN)return Ex;iN=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,u=/^\s+|\s+$/g,f=`
|
|
437
|
-
`,h="/",g="*",p="",x="comment",y="declaration";Ex=function(w,S){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];S=S||{};var N=1,C=1;function j(K){var G=K.match(e);G&&(N+=G.length);var F=K.lastIndexOf(f);C=~F?K.length-F:C+K.length}function A(){var K={line:N,column:C};return function(G){return G.position=new I(K),R(),G}}function I(K){this.start=K,this.end={line:N,column:C},this.source=S.source}I.prototype.content=w;function T(K){var G=new Error(S.source+":"+N+":"+C+": "+K);if(G.reason=K,G.filename=S.source,G.line=N,G.column=C,G.source=w,!S.silent)throw G}function E(K){var G=K.exec(w);if(G){var F=G[0];return j(F),w=w.slice(F.length),G}}function R(){E(n)}function z(K){var G;for(K=K||[];G=D();)G!==!1&&K.push(G);return K}function D(){var K=A();if(!(h!=w.charAt(0)||g!=w.charAt(1))){for(var G=2;p!=w.charAt(G)&&(g!=w.charAt(G)||h!=w.charAt(G+1));)++G;if(G+=2,p===w.charAt(G-1))return T("End of comment missing");var F=w.slice(2,G-2);return C+=2,j(F),w=w.slice(G),C+=2,K({type:x,comment:F})}}function B(){var K=A(),G=E(r);if(G){if(D(),!E(s))return T("property missing ':'");var F=E(a),M=K({type:y,property:k(G[0].replace(t,p)),value:F?k(F[0].replace(t,p)):p});return E(l),M}}function q(){var K=[];z(K);for(var G;G=B();)G!==!1&&(K.push(G),z(K));return K}return R(),q()};function k(w){return w?w.replace(u,p):p}return Ex}var aN;function N8(){if(aN)return Rl;aN=1;var t=Rl&&Rl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Rl,"__esModule",{value:!0}),Rl.default=n;var e=t(j8());function n(r,s){var a=null;if(!r||typeof r!="string")return a;var l=(0,e.default)(r),u=typeof s=="function";return l.forEach(function(f){if(f.type==="declaration"){var h=f.property,g=f.value;u?s(h,g,f):g&&(a=a||{},a[h]=g)}}),a}return Rl}var qu={},oN;function C8(){if(oN)return qu;oN=1,Object.defineProperty(qu,"__esModule",{value:!0}),qu.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,a=function(h){return!h||n.test(h)||t.test(h)},l=function(h,g){return g.toUpperCase()},u=function(h,g){return"".concat(g,"-")},f=function(h,g){return g===void 0&&(g={}),a(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(s,u):h=h.replace(r,u),h.replace(e,l))};return qu.camelCase=f,qu}var Hu,lN;function E8(){if(lN)return Hu;lN=1;var t=Hu&&Hu.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(N8()),n=C8();function r(s,a){var l={};return!s||typeof s!="string"||(0,e.default)(s,function(u,f){u&&f&&(l[(0,n.camelCase)(u,a)]=f)}),l}return r.default=r,Hu=r,Hu}var T8=E8();const A8=kc(T8),VT=KT("end"),C0=KT("start");function KT(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function O8(t){const e=C0(t),n=VT(t);if(e&&n)return{start:e,end:n}}function dd(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?cN(t.position):"start"in t||"end"in t?cN(t):"line"in t||"column"in t?vb(t):""}function vb(t){return uN(t&&t.line)+":"+uN(t&&t.column)}function cN(t){return vb(t&&t.start)+"-"+vb(t&&t.end)}function uN(t){return t&&typeof t=="number"?t:1}class lr extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",a={},l=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof e=="string"?s=e:!a.cause&&e&&(l=!0,s=e.message,a.cause=e),!a.ruleId&&!a.source&&typeof r=="string"){const f=r.indexOf(":");f===-1?a.ruleId=r:(a.source=r.slice(0,f),a.ruleId=r.slice(f+1))}if(!a.place&&a.ancestors&&a.ancestors){const f=a.ancestors[a.ancestors.length-1];f&&(a.place=f.position)}const u=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=u?u.line:void 0,this.name=dd(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}lr.prototype.file="";lr.prototype.name="";lr.prototype.reason="";lr.prototype.message="";lr.prototype.stack="";lr.prototype.column=void 0;lr.prototype.line=void 0;lr.prototype.ancestors=void 0;lr.prototype.cause=void 0;lr.prototype.fatal=void 0;lr.prototype.place=void 0;lr.prototype.ruleId=void 0;lr.prototype.source=void 0;const E0={}.hasOwnProperty,R8=new Map,M8=/[A-Z]/g,D8=new Set(["table","tbody","thead","tfoot","tr"]),I8=new Set(["td","th"]),YT="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function L8(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=H8(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=q8(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?N0:k8,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},a=GT(s,t,void 0);return a&&typeof a!="string"?a:s.create(t,s.Fragment,{children:a||void 0},void 0)}function GT(t,e,n){if(e.type==="element")return P8(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return $8(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return F8(t,e,n);if(e.type==="mdxjsEsm")return z8(t,e);if(e.type==="root")return B8(t,e,n);if(e.type==="text")return U8(t,e)}function P8(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=N0,t.schema=s),t.ancestors.push(e);const a=WT(t,e.tagName,!1),l=V8(t,e);let u=A0(t,e);return D8.has(e.tagName)&&(u=u.filter(function(f){return typeof f=="string"?!h8(f):!0})),ZT(t,l,a,e),T0(l,u),t.ancestors.pop(),t.schema=r,t.create(e,a,l,n)}function $8(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}Cd(t,e.position)}function z8(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Cd(t,e.position)}function F8(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=N0,t.schema=s),t.ancestors.push(e);const a=e.name===null?t.Fragment:WT(t,e.name,!0),l=K8(t,e),u=A0(t,e);return ZT(t,l,a,e),T0(l,u),t.ancestors.pop(),t.schema=r,t.create(e,a,l,n)}function B8(t,e,n){const r={};return T0(r,A0(t,e)),t.create(e,t.Fragment,r,n)}function U8(t,e){return e.value}function ZT(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function T0(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function q8(t,e,n){return r;function r(s,a,l,u){const h=Array.isArray(l.children)?n:e;return u?h(a,l,u):h(a,l)}}function H8(t,e){return n;function n(r,s,a,l){const u=Array.isArray(a.children),f=C0(r);return e(s,a,l,u,{columnNumber:f?f.column-1:void 0,fileName:t,lineNumber:f?f.line:void 0},void 0)}}function V8(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&E0.call(e.properties,s)){const a=Y8(t,s,e.properties[s]);if(a){const[l,u]=a;t.tableCellAlignToStyle&&l==="align"&&typeof u=="string"&&I8.has(e.tagName)?r=u:n[l]=u}}if(r){const a=n.style||(n.style={});a[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function K8(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const a=r.data.estree.body[0];a.type;const l=a.expression;l.type;const u=l.properties[0];u.type,Object.assign(n,t.evaluater.evaluateExpression(u.argument))}else Cd(t,e.position);else{const s=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const u=r.value.data.estree.body[0];u.type,a=t.evaluater.evaluateExpression(u.expression)}else Cd(t,e.position);else a=r.value===null?!0:r.value;n[s]=a}return n}function A0(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:R8;for(;++r<e.children.length;){const a=e.children[r];let l;if(t.passKeys){const f=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(f){const h=s.get(f)||0;l=f+"-"+h,s.set(f,h+1)}}const u=GT(t,a,l);u!==void 0&&n.push(u)}return n}function Y8(t,e,n){const r=b8(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?l8(n):S8(n)),r.property==="style"){let s=typeof n=="object"?n:G8(t,String(n));return t.stylePropertyNameCase==="css"&&(s=Z8(s)),["style",s]}return[t.elementAttributeNameCase==="react"&&r.space?v8[r.property]||r.property:r.attribute,n]}}function G8(t,e){try{return A8(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,s=new lr("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=t.filePath||void 0,s.url=YT+"#cannot-parse-style-attribute",s}}function WT(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const s=e.split(".");let a=-1,l;for(;++a<s.length;){const u=tN(s[a])?{type:"Identifier",name:s[a]}:{type:"Literal",value:s[a]};l=l?{type:"MemberExpression",object:l,property:u,computed:!!(a&&u.type==="Literal"),optional:!1}:u}r=l}else r=tN(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const s=r.value;return E0.call(t.components,s)?t.components[s]:s}if(t.evaluater)return t.evaluater.evaluateExpression(r);Cd(t)}function Cd(t,e){const n=new lr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=YT+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Z8(t){const e={};let n;for(n in t)E0.call(t,n)&&(e[W8(n)]=t[n]);return e}function W8(t){let e=t.replace(M8,Q8);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function Q8(t){return"-"+t.toLowerCase()}const Tx={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},X8={};function O0(t,e){const n=X8,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return QT(t,r,s)}function QT(t,e,n){if(J8(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return dN(t.children,e,n)}return Array.isArray(t)?dN(t,e,n):""}function dN(t,e,n){const r=[];let s=-1;for(;++s<t.length;)r[s]=QT(t[s],e,n);return r.join("")}function J8(t){return!!(t&&typeof t=="object")}const fN=document.createElement("i");function R0(t){const e="&"+t+";";fN.innerHTML=e;const n=fN.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Vr(t,e,n,r){const s=t.length;let a=0,l;if(e<0?e=-e>s?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(e,n),t.splice(...l);else for(n&&t.splice(e,n);a<r.length;)l=r.slice(a,a+1e4),l.unshift(e,0),t.splice(...l),a+=1e4,e+=1e4}function ss(t,e){return t.length>0?(Vr(t,t.length,0,e),t):e}const hN={}.hasOwnProperty;function XT(t){const e={};let n=-1;for(;++n<t.length;)e9(e,t[n]);return e}function e9(t,e){let n;for(n in e){const s=(hN.call(t,n)?t[n]:void 0)||(t[n]={}),a=e[n];let l;if(a)for(l in a){hN.call(s,l)||(s[l]=[]);const u=a[l];t9(s[l],Array.isArray(u)?u:u?[u]:[])}}}function t9(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Vr(t,0,0,r)}function JT(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"๏ฟฝ":String.fromCodePoint(n)}function Rs(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const pr=Ya(/[A-Za-z]/),tr=Ya(/[\dA-Za-z]/),n9=Ya(/[#-'*+\--9=?A-Z^-~]/);function Dm(t){return t!==null&&(t<32||t===127)}const xb=Ya(/\d/),r9=Ya(/[\dA-Fa-f]/),s9=Ya(/[!-/:-@[-`{-~]/);function Je(t){return t!==null&&t<-2}function Gt(t){return t!==null&&(t<0||t===32)}function jt(t){return t===-2||t===-1||t===32}const dp=Ya(new RegExp("\\p{P}|\\p{S}","u")),Fo=Ya(/\s/);function Ya(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Dc(t){const e=[];let n=-1,r=0,s=0;for(;++n<t.length;){const a=t.charCodeAt(n);let l="";if(a===37&&tr(t.charCodeAt(n+1))&&tr(t.charCodeAt(n+2)))s=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(l=String.fromCharCode(a));else if(a>55295&&a<57344){const u=t.charCodeAt(n+1);a<56320&&u>56319&&u<57344?(l=String.fromCharCode(a,u),s=1):l="๏ฟฝ"}else l=String.fromCharCode(a);l&&(e.push(t.slice(r,n),encodeURIComponent(l)),r=n+s+1,l=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function Ot(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(f){return jt(f)?(t.enter(n),u(f)):e(f)}function u(f){return jt(f)&&a++<s?(t.consume(f),u):(t.exit(n),e(f))}}const i9={tokenize:a9};function a9(t){const e=t.attempt(this.parser.constructs.contentInitial,r,s);let n;return e;function r(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),Ot(t,e,"linePrefix")}function s(u){return t.enter("paragraph"),a(u)}function a(u){const f=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,l(u)}function l(u){if(u===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(u);return}return Je(u)?(t.consume(u),t.exit("chunkText"),a):(t.consume(u),l)}}const o9={tokenize:l9},mN={tokenize:c9};function l9(t){const e=this,n=[];let r=0,s,a,l;return u;function u(j){if(r<n.length){const A=n[r];return e.containerState=A[1],t.attempt(A[0].continuation,f,h)(j)}return h(j)}function f(j){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,s&&C();const A=e.events.length;let I=A,T;for(;I--;)if(e.events[I][0]==="exit"&&e.events[I][1].type==="chunkFlow"){T=e.events[I][1].end;break}N(r);let E=A;for(;E<e.events.length;)e.events[E][1].end={...T},E++;return Vr(e.events,I+1,0,e.events.slice(A)),e.events.length=E,h(j)}return u(j)}function h(j){if(r===n.length){if(!s)return x(j);if(s.currentConstruct&&s.currentConstruct.concrete)return k(j);e.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(mN,g,p)(j)}function g(j){return s&&C(),N(r),x(j)}function p(j){return e.parser.lazy[e.now().line]=r!==n.length,l=e.now().offset,k(j)}function x(j){return e.containerState={},t.attempt(mN,y,k)(j)}function y(j){return r++,n.push([e.currentConstruct,e.containerState]),x(j)}function k(j){if(j===null){s&&C(),N(0),t.consume(j);return}return s=s||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:a}),w(j)}function w(j){if(j===null){S(t.exit("chunkFlow"),!0),N(0),t.consume(j);return}return Je(j)?(t.consume(j),S(t.exit("chunkFlow")),r=0,e.interrupt=void 0,u):(t.consume(j),w)}function S(j,A){const I=e.sliceStream(j);if(A&&I.push(null),j.previous=a,a&&(a.next=j),a=j,s.defineSkip(j.start),s.write(I),e.parser.lazy[j.start.line]){let T=s.events.length;for(;T--;)if(s.events[T][1].start.offset<l&&(!s.events[T][1].end||s.events[T][1].end.offset>l))return;const E=e.events.length;let R=E,z,D;for(;R--;)if(e.events[R][0]==="exit"&&e.events[R][1].type==="chunkFlow"){if(z){D=e.events[R][1].end;break}z=!0}for(N(r),T=E;T<e.events.length;)e.events[T][1].end={...D},T++;Vr(e.events,R+1,0,e.events.slice(E)),e.events.length=T}}function N(j){let A=n.length;for(;A-- >j;){const I=n[A];e.containerState=I[1],I[0].exit.call(e,t)}n.length=j}function C(){s.write([null]),a=void 0,s=void 0,e.containerState._closeFlow=void 0}}function c9(t,e,n){return Ot(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function xc(t){if(t===null||Gt(t)||Fo(t))return 1;if(dp(t))return 2}function fp(t,e,n){const r=[];let s=-1;for(;++s<t.length;){const a=t[s].resolveAll;a&&!r.includes(a)&&(e=a(e,n),r.push(a))}return e}const yb={name:"attention",resolveAll:u9,tokenize:d9};function u9(t,e){let n=-1,r,s,a,l,u,f,h,g;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;f=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const p={...t[r][1].end},x={...t[n][1].start};pN(p,-f),pN(x,f),l={type:f>1?"strongSequence":"emphasisSequence",start:p,end:{...t[r][1].end}},u={type:f>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:x},a={type:f>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:f>1?"strong":"emphasis",start:{...l.start},end:{...u.end}},t[r][1].end={...l.start},t[n][1].start={...u.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=ss(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=ss(h,[["enter",s,e],["enter",l,e],["exit",l,e],["enter",a,e]]),h=ss(h,fp(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=ss(h,[["exit",a,e],["enter",u,e],["exit",u,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(g=2,h=ss(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):g=0,Vr(t,r-1,n-r+3,h),n=r+h.length-g-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function d9(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=xc(r);let a;return l;function l(f){return a=f,t.enter("attentionSequence"),u(f)}function u(f){if(f===a)return t.consume(f),u;const h=t.exit("attentionSequence"),g=xc(f),p=!g||g===2&&s||n.includes(f),x=!s||s===2&&g||n.includes(r);return h._open=!!(a===42?p:p&&(s||!x)),h._close=!!(a===42?x:x&&(g||!p)),e(f)}}function pN(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const f9={name:"autolink",tokenize:h9};function h9(t,e,n){let r=0;return s;function s(y){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(y),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),a}function a(y){return pr(y)?(t.consume(y),l):y===64?n(y):h(y)}function l(y){return y===43||y===45||y===46||tr(y)?(r=1,u(y)):h(y)}function u(y){return y===58?(t.consume(y),r=0,f):(y===43||y===45||y===46||tr(y))&&r++<32?(t.consume(y),u):(r=0,h(y))}function f(y){return y===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(y),t.exit("autolinkMarker"),t.exit("autolink"),e):y===null||y===32||y===60||Dm(y)?n(y):(t.consume(y),f)}function h(y){return y===64?(t.consume(y),g):n9(y)?(t.consume(y),h):n(y)}function g(y){return tr(y)?p(y):n(y)}function p(y){return y===46?(t.consume(y),r=0,g):y===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(y),t.exit("autolinkMarker"),t.exit("autolink"),e):x(y)}function x(y){if((y===45||tr(y))&&r++<63){const k=y===45?x:p;return t.consume(y),k}return n(y)}}const qd={partial:!0,tokenize:m9};function m9(t,e,n){return r;function r(a){return jt(a)?Ot(t,s,"linePrefix")(a):s(a)}function s(a){return a===null||Je(a)?e(a):n(a)}}const eA={continuation:{tokenize:g9},exit:v9,name:"blockQuote",tokenize:p9};function p9(t,e,n){const r=this;return s;function s(l){if(l===62){const u=r.containerState;return u.open||(t.enter("blockQuote",{_container:!0}),u.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(l),t.exit("blockQuoteMarker"),a}return n(l)}function a(l){return jt(l)?(t.enter("blockQuotePrefixWhitespace"),t.consume(l),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(l))}}function g9(t,e,n){const r=this;return s;function s(l){return jt(l)?Ot(t,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):a(l)}function a(l){return t.attempt(eA,e,n)(l)}}function v9(t){t.exit("blockQuote")}const tA={name:"characterEscape",tokenize:x9};function x9(t,e,n){return r;function r(a){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(a),t.exit("escapeMarker"),s}function s(a){return s9(a)?(t.enter("characterEscapeValue"),t.consume(a),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(a)}}const nA={name:"characterReference",tokenize:y9};function y9(t,e,n){const r=this;let s=0,a,l;return u;function u(p){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(p),t.exit("characterReferenceMarker"),f}function f(p){return p===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(p),t.exit("characterReferenceMarkerNumeric"),h):(t.enter("characterReferenceValue"),a=31,l=tr,g(p))}function h(p){return p===88||p===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(p),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),a=6,l=r9,g):(t.enter("characterReferenceValue"),a=7,l=xb,g(p))}function g(p){if(p===59&&s){const x=t.exit("characterReferenceValue");return l===tr&&!R0(r.sliceSerialize(x))?n(p):(t.enter("characterReferenceMarker"),t.consume(p),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return l(p)&&s++<a?(t.consume(p),g):n(p)}}const gN={partial:!0,tokenize:w9},vN={concrete:!0,name:"codeFenced",tokenize:b9};function b9(t,e,n){const r=this,s={partial:!0,tokenize:I};let a=0,l=0,u;return f;function f(T){return h(T)}function h(T){const E=r.events[r.events.length-1];return a=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,u=T,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),g(T)}function g(T){return T===u?(l++,t.consume(T),g):l<3?n(T):(t.exit("codeFencedFenceSequence"),jt(T)?Ot(t,p,"whitespace")(T):p(T))}function p(T){return T===null||Je(T)?(t.exit("codeFencedFence"),r.interrupt?e(T):t.check(gN,w,A)(T)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),x(T))}function x(T){return T===null||Je(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),p(T)):jt(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Ot(t,y,"whitespace")(T)):T===96&&T===u?n(T):(t.consume(T),x)}function y(T){return T===null||Je(T)?p(T):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),k(T))}function k(T){return T===null||Je(T)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),p(T)):T===96&&T===u?n(T):(t.consume(T),k)}function w(T){return t.attempt(s,A,S)(T)}function S(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),N}function N(T){return a>0&&jt(T)?Ot(t,C,"linePrefix",a+1)(T):C(T)}function C(T){return T===null||Je(T)?t.check(gN,w,A)(T):(t.enter("codeFlowValue"),j(T))}function j(T){return T===null||Je(T)?(t.exit("codeFlowValue"),C(T)):(t.consume(T),j)}function A(T){return t.exit("codeFenced"),e(T)}function I(T,E,R){let z=0;return D;function D(F){return T.enter("lineEnding"),T.consume(F),T.exit("lineEnding"),B}function B(F){return T.enter("codeFencedFence"),jt(F)?Ot(T,q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):q(F)}function q(F){return F===u?(T.enter("codeFencedFenceSequence"),K(F)):R(F)}function K(F){return F===u?(z++,T.consume(F),K):z>=l?(T.exit("codeFencedFenceSequence"),jt(F)?Ot(T,G,"whitespace")(F):G(F)):R(F)}function G(F){return F===null||Je(F)?(T.exit("codeFencedFence"),E(F)):R(F)}}}function w9(t,e,n){const r=this;return s;function s(l){return l===null?n(l):(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),a)}function a(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}const Ax={name:"codeIndented",tokenize:k9},_9={partial:!0,tokenize:S9};function k9(t,e,n){const r=this;return s;function s(h){return t.enter("codeIndented"),Ot(t,a,"linePrefix",5)(h)}function a(h){const g=r.events[r.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?l(h):n(h)}function l(h){return h===null?f(h):Je(h)?t.attempt(_9,l,f)(h):(t.enter("codeFlowValue"),u(h))}function u(h){return h===null||Je(h)?(t.exit("codeFlowValue"),l(h)):(t.consume(h),u)}function f(h){return t.exit("codeIndented"),e(h)}}function S9(t,e,n){const r=this;return s;function s(l){return r.parser.lazy[r.now().line]?n(l):Je(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s):Ot(t,a,"linePrefix",5)(l)}function a(l){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?e(l):Je(l)?s(l):n(l)}}const j9={name:"codeText",previous:C9,resolve:N9,tokenize:E9};function N9(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)s===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(s=r):(r===e||t[r][1].type==="lineEnding")&&(t[s][1].type="codeTextData",r!==s+2&&(t[s][1].end=t[r-1][1].end,t.splice(s+2,r-s-2),e-=r-s-2,r=s+2),s=void 0);return t}function C9(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function E9(t,e,n){let r=0,s,a;return l;function l(p){return t.enter("codeText"),t.enter("codeTextSequence"),u(p)}function u(p){return p===96?(t.consume(p),r++,u):(t.exit("codeTextSequence"),f(p))}function f(p){return p===null?n(p):p===32?(t.enter("space"),t.consume(p),t.exit("space"),f):p===96?(a=t.enter("codeTextSequence"),s=0,g(p)):Je(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),f):(t.enter("codeTextData"),h(p))}function h(p){return p===null||p===32||p===96||Je(p)?(t.exit("codeTextData"),f(p)):(t.consume(p),h)}function g(p){return p===96?(t.consume(p),s++,g):s===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(p)):(a.type="codeTextData",h(p))}}class T9{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const a=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Vu(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Vu(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Vu(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Vu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Vu(this.left,n.reverse())}}}function Vu(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function rA(t){const e={};let n=-1,r,s,a,l,u,f,h;const g=new T9(t);for(;++n<g.length;){for(;n in e;)n=e[n];if(r=g.get(n),n&&r[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(f=r[1]._tokenizer.events,a=0,a<f.length&&f[a][1].type==="lineEndingBlank"&&(a+=2),a<f.length&&f[a][1].type==="content"))for(;++a<f.length&&f[a][1].type!=="content";)f[a][1].type==="chunkText"&&(f[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,A9(g,n)),n=e[n],h=!0);else if(r[1]._container){for(a=n,s=void 0;a--;)if(l=g.get(a),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(s&&(g.get(s)[1].type="lineEndingBlank"),l[1].type="lineEnding",s=a);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;s&&(r[1].end={...g.get(s)[1].start},u=g.slice(s,n),u.unshift(r),g.splice(s,n-s+1,u))}}return Vr(t,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function A9(t,e){const n=t.get(e)[1],r=t.get(e)[2];let s=e-1;const a=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const u=l.events,f=[],h={};let g,p,x=-1,y=n,k=0,w=0;const S=[w];for(;y;){for(;t.get(++s)[1]!==y;);a.push(s),y._tokenizer||(g=r.sliceStream(y),y.next||g.push(null),p&&l.defineSkip(y.start),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(g),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),p=y,y=y.next}for(y=n;++x<u.length;)u[x][0]==="exit"&&u[x-1][0]==="enter"&&u[x][1].type===u[x-1][1].type&&u[x][1].start.line!==u[x][1].end.line&&(w=x+1,S.push(w),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(l.events=[],y?(y._tokenizer=void 0,y.previous=void 0):S.pop(),x=S.length;x--;){const N=u.slice(S[x],S[x+1]),C=a.pop();f.push([C,C+N.length-1]),t.splice(C,2,N)}for(f.reverse(),x=-1;++x<f.length;)h[k+f[x][0]]=k+f[x][1],k+=f[x][1]-f[x][0]-1;return h}const O9={resolve:M9,tokenize:D9},R9={partial:!0,tokenize:I9};function M9(t){return rA(t),t}function D9(t,e){let n;return r;function r(u){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),s(u)}function s(u){return u===null?a(u):Je(u)?t.check(R9,l,a)(u):(t.consume(u),s)}function a(u){return t.exit("chunkContent"),t.exit("content"),e(u)}function l(u){return t.consume(u),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function I9(t,e,n){const r=this;return s;function s(l){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),Ot(t,a,"linePrefix")}function a(l){if(l===null||Je(l))return n(l);const u=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?e(l):t.interrupt(r.parser.constructs.flow,n,e)(l)}}function sA(t,e,n,r,s,a,l,u,f){const h=f||Number.POSITIVE_INFINITY;let g=0;return p;function p(N){return N===60?(t.enter(r),t.enter(s),t.enter(a),t.consume(N),t.exit(a),x):N===null||N===32||N===41||Dm(N)?n(N):(t.enter(r),t.enter(l),t.enter(u),t.enter("chunkString",{contentType:"string"}),w(N))}function x(N){return N===62?(t.enter(a),t.consume(N),t.exit(a),t.exit(s),t.exit(r),e):(t.enter(u),t.enter("chunkString",{contentType:"string"}),y(N))}function y(N){return N===62?(t.exit("chunkString"),t.exit(u),x(N)):N===null||N===60||Je(N)?n(N):(t.consume(N),N===92?k:y)}function k(N){return N===60||N===62||N===92?(t.consume(N),y):y(N)}function w(N){return!g&&(N===null||N===41||Gt(N))?(t.exit("chunkString"),t.exit(u),t.exit(l),t.exit(r),e(N)):g<h&&N===40?(t.consume(N),g++,w):N===41?(t.consume(N),g--,w):N===null||N===32||N===40||Dm(N)?n(N):(t.consume(N),N===92?S:w)}function S(N){return N===40||N===41||N===92?(t.consume(N),w):w(N)}}function iA(t,e,n,r,s,a){const l=this;let u=0,f;return h;function h(y){return t.enter(r),t.enter(s),t.consume(y),t.exit(s),t.enter(a),g}function g(y){return u>999||y===null||y===91||y===93&&!f||y===94&&!u&&"_hiddenFootnoteSupport"in l.parser.constructs?n(y):y===93?(t.exit(a),t.enter(s),t.consume(y),t.exit(s),t.exit(r),e):Je(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),g):(t.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===null||y===91||y===93||Je(y)||u++>999?(t.exit("chunkString"),g(y)):(t.consume(y),f||(f=!jt(y)),y===92?x:p)}function x(y){return y===91||y===92||y===93?(t.consume(y),u++,p):p(y)}}function aA(t,e,n,r,s,a){let l;return u;function u(x){return x===34||x===39||x===40?(t.enter(r),t.enter(s),t.consume(x),t.exit(s),l=x===40?41:x,f):n(x)}function f(x){return x===l?(t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):(t.enter(a),h(x))}function h(x){return x===l?(t.exit(a),f(l)):x===null?n(x):Je(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),Ot(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===l||x===null||Je(x)?(t.exit("chunkString"),h(x)):(t.consume(x),x===92?p:g)}function p(x){return x===l||x===92?(t.consume(x),g):g(x)}}function fd(t,e){let n;return r;function r(s){return Je(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):jt(s)?Ot(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const L9={name:"definition",tokenize:$9},P9={partial:!0,tokenize:z9};function $9(t,e,n){const r=this;let s;return a;function a(y){return t.enter("definition"),l(y)}function l(y){return iA.call(r,t,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function u(y){return s=Rs(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),f):n(y)}function f(y){return Gt(y)?fd(t,h)(y):h(y)}function h(y){return sA(t,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function g(y){return t.attempt(P9,p,p)(y)}function p(y){return jt(y)?Ot(t,x,"whitespace")(y):x(y)}function x(y){return y===null||Je(y)?(t.exit("definition"),r.parser.defined.push(s),e(y)):n(y)}}function z9(t,e,n){return r;function r(u){return Gt(u)?fd(t,s)(u):n(u)}function s(u){return aA(t,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function a(u){return jt(u)?Ot(t,l,"whitespace")(u):l(u)}function l(u){return u===null||Je(u)?e(u):n(u)}}const F9={name:"hardBreakEscape",tokenize:B9};function B9(t,e,n){return r;function r(a){return t.enter("hardBreakEscape"),t.consume(a),s}function s(a){return Je(a)?(t.exit("hardBreakEscape"),e(a)):n(a)}}const U9={name:"headingAtx",resolve:q9,tokenize:H9};function q9(t,e){let n=t.length-2,r=3,s,a;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},a={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Vr(t,r,n-r+1,[["enter",s,e],["enter",a,e],["exit",a,e],["exit",s,e]])),t}function H9(t,e,n){let r=0;return s;function s(g){return t.enter("atxHeading"),a(g)}function a(g){return t.enter("atxHeadingSequence"),l(g)}function l(g){return g===35&&r++<6?(t.consume(g),l):g===null||Gt(g)?(t.exit("atxHeadingSequence"),u(g)):n(g)}function u(g){return g===35?(t.enter("atxHeadingSequence"),f(g)):g===null||Je(g)?(t.exit("atxHeading"),e(g)):jt(g)?Ot(t,u,"whitespace")(g):(t.enter("atxHeadingText"),h(g))}function f(g){return g===35?(t.consume(g),f):(t.exit("atxHeadingSequence"),u(g))}function h(g){return g===null||g===35||Gt(g)?(t.exit("atxHeadingText"),u(g)):(t.consume(g),h)}}const V9=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],xN=["pre","script","style","textarea"],K9={concrete:!0,name:"htmlFlow",resolveTo:Z9,tokenize:W9},Y9={partial:!0,tokenize:X9},G9={partial:!0,tokenize:Q9};function Z9(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function W9(t,e,n){const r=this;let s,a,l,u,f;return h;function h(P){return g(P)}function g(P){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(P),p}function p(P){return P===33?(t.consume(P),x):P===47?(t.consume(P),a=!0,w):P===63?(t.consume(P),s=3,r.interrupt?e:L):pr(P)?(t.consume(P),l=String.fromCharCode(P),S):n(P)}function x(P){return P===45?(t.consume(P),s=2,y):P===91?(t.consume(P),s=5,u=0,k):pr(P)?(t.consume(P),s=4,r.interrupt?e:L):n(P)}function y(P){return P===45?(t.consume(P),r.interrupt?e:L):n(P)}function k(P){const pe="CDATA[";return P===pe.charCodeAt(u++)?(t.consume(P),u===pe.length?r.interrupt?e:q:k):n(P)}function w(P){return pr(P)?(t.consume(P),l=String.fromCharCode(P),S):n(P)}function S(P){if(P===null||P===47||P===62||Gt(P)){const pe=P===47,Pe=l.toLowerCase();return!pe&&!a&&xN.includes(Pe)?(s=1,r.interrupt?e(P):q(P)):V9.includes(l.toLowerCase())?(s=6,pe?(t.consume(P),N):r.interrupt?e(P):q(P)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):a?C(P):j(P))}return P===45||tr(P)?(t.consume(P),l+=String.fromCharCode(P),S):n(P)}function N(P){return P===62?(t.consume(P),r.interrupt?e:q):n(P)}function C(P){return jt(P)?(t.consume(P),C):D(P)}function j(P){return P===47?(t.consume(P),D):P===58||P===95||pr(P)?(t.consume(P),A):jt(P)?(t.consume(P),j):D(P)}function A(P){return P===45||P===46||P===58||P===95||tr(P)?(t.consume(P),A):I(P)}function I(P){return P===61?(t.consume(P),T):jt(P)?(t.consume(P),I):j(P)}function T(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(t.consume(P),f=P,E):jt(P)?(t.consume(P),T):R(P)}function E(P){return P===f?(t.consume(P),f=null,z):P===null||Je(P)?n(P):(t.consume(P),E)}function R(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Gt(P)?I(P):(t.consume(P),R)}function z(P){return P===47||P===62||jt(P)?j(P):n(P)}function D(P){return P===62?(t.consume(P),B):n(P)}function B(P){return P===null||Je(P)?q(P):jt(P)?(t.consume(P),B):n(P)}function q(P){return P===45&&s===2?(t.consume(P),M):P===60&&s===1?(t.consume(P),V):P===62&&s===4?(t.consume(P),ne):P===63&&s===3?(t.consume(P),L):P===93&&s===5?(t.consume(P),H):Je(P)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Y9,ie,K)(P)):P===null||Je(P)?(t.exit("htmlFlowData"),K(P)):(t.consume(P),q)}function K(P){return t.check(G9,G,ie)(P)}function G(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),F}function F(P){return P===null||Je(P)?K(P):(t.enter("htmlFlowData"),q(P))}function M(P){return P===45?(t.consume(P),L):q(P)}function V(P){return P===47?(t.consume(P),l="",U):q(P)}function U(P){if(P===62){const pe=l.toLowerCase();return xN.includes(pe)?(t.consume(P),ne):q(P)}return pr(P)&&l.length<8?(t.consume(P),l+=String.fromCharCode(P),U):q(P)}function H(P){return P===93?(t.consume(P),L):q(P)}function L(P){return P===62?(t.consume(P),ne):P===45&&s===2?(t.consume(P),L):q(P)}function ne(P){return P===null||Je(P)?(t.exit("htmlFlowData"),ie(P)):(t.consume(P),ne)}function ie(P){return t.exit("htmlFlow"),e(P)}}function Q9(t,e,n){const r=this;return s;function s(l){return Je(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),a):n(l)}function a(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}function X9(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(qd,e,n)}}const J9={name:"htmlText",tokenize:eB};function eB(t,e,n){const r=this;let s,a,l;return u;function u(L){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(L),f}function f(L){return L===33?(t.consume(L),h):L===47?(t.consume(L),I):L===63?(t.consume(L),j):pr(L)?(t.consume(L),R):n(L)}function h(L){return L===45?(t.consume(L),g):L===91?(t.consume(L),a=0,k):pr(L)?(t.consume(L),C):n(L)}function g(L){return L===45?(t.consume(L),y):n(L)}function p(L){return L===null?n(L):L===45?(t.consume(L),x):Je(L)?(l=p,V(L)):(t.consume(L),p)}function x(L){return L===45?(t.consume(L),y):p(L)}function y(L){return L===62?M(L):L===45?x(L):p(L)}function k(L){const ne="CDATA[";return L===ne.charCodeAt(a++)?(t.consume(L),a===ne.length?w:k):n(L)}function w(L){return L===null?n(L):L===93?(t.consume(L),S):Je(L)?(l=w,V(L)):(t.consume(L),w)}function S(L){return L===93?(t.consume(L),N):w(L)}function N(L){return L===62?M(L):L===93?(t.consume(L),N):w(L)}function C(L){return L===null||L===62?M(L):Je(L)?(l=C,V(L)):(t.consume(L),C)}function j(L){return L===null?n(L):L===63?(t.consume(L),A):Je(L)?(l=j,V(L)):(t.consume(L),j)}function A(L){return L===62?M(L):j(L)}function I(L){return pr(L)?(t.consume(L),T):n(L)}function T(L){return L===45||tr(L)?(t.consume(L),T):E(L)}function E(L){return Je(L)?(l=E,V(L)):jt(L)?(t.consume(L),E):M(L)}function R(L){return L===45||tr(L)?(t.consume(L),R):L===47||L===62||Gt(L)?z(L):n(L)}function z(L){return L===47?(t.consume(L),M):L===58||L===95||pr(L)?(t.consume(L),D):Je(L)?(l=z,V(L)):jt(L)?(t.consume(L),z):M(L)}function D(L){return L===45||L===46||L===58||L===95||tr(L)?(t.consume(L),D):B(L)}function B(L){return L===61?(t.consume(L),q):Je(L)?(l=B,V(L)):jt(L)?(t.consume(L),B):z(L)}function q(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(t.consume(L),s=L,K):Je(L)?(l=q,V(L)):jt(L)?(t.consume(L),q):(t.consume(L),G)}function K(L){return L===s?(t.consume(L),s=void 0,F):L===null?n(L):Je(L)?(l=K,V(L)):(t.consume(L),K)}function G(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||Gt(L)?z(L):(t.consume(L),G)}function F(L){return L===47||L===62||Gt(L)?z(L):n(L)}function M(L){return L===62?(t.consume(L),t.exit("htmlTextData"),t.exit("htmlText"),e):n(L)}function V(L){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(L),t.exit("lineEnding"),U}function U(L){return jt(L)?Ot(t,H,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):H(L)}function H(L){return t.enter("htmlTextData"),l(L)}}const M0={name:"labelEnd",resolveAll:sB,resolveTo:iB,tokenize:aB},tB={tokenize:oB},nB={tokenize:lB},rB={tokenize:cB};function sB(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",e+=s}}return t.length!==n.length&&Vr(t,0,t.length,n),t}function iB(t,e){let n=t.length,r=0,s,a,l,u;for(;n--;)if(s=t[n][1],a){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;t[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(l){if(t[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(a=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(l=n);const f={type:t[a][1].type==="labelLink"?"link":"image",start:{...t[a][1].start},end:{...t[t.length-1][1].end}},h={type:"label",start:{...t[a][1].start},end:{...t[l][1].end}},g={type:"labelText",start:{...t[a+r+2][1].end},end:{...t[l-2][1].start}};return u=[["enter",f,e],["enter",h,e]],u=ss(u,t.slice(a+1,a+r+3)),u=ss(u,[["enter",g,e]]),u=ss(u,fp(e.parser.constructs.insideSpan.null,t.slice(a+r+4,l-3),e)),u=ss(u,[["exit",g,e],t[l-2],t[l-1],["exit",h,e]]),u=ss(u,t.slice(l+1)),u=ss(u,[["exit",f,e]]),Vr(t,a,t.length,u),t}function aB(t,e,n){const r=this;let s=r.events.length,a,l;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){a=r.events[s][1];break}return u;function u(x){return a?a._inactive?p(x):(l=r.parser.defined.includes(Rs(r.sliceSerialize({start:a.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(x),t.exit("labelMarker"),t.exit("labelEnd"),f):n(x)}function f(x){return x===40?t.attempt(tB,g,l?g:p)(x):x===91?t.attempt(nB,g,l?h:p)(x):l?g(x):p(x)}function h(x){return t.attempt(rB,g,p)(x)}function g(x){return e(x)}function p(x){return a._balanced=!0,n(x)}}function oB(t,e,n){return r;function r(p){return t.enter("resource"),t.enter("resourceMarker"),t.consume(p),t.exit("resourceMarker"),s}function s(p){return Gt(p)?fd(t,a)(p):a(p)}function a(p){return p===41?g(p):sA(t,l,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function l(p){return Gt(p)?fd(t,f)(p):g(p)}function u(p){return n(p)}function f(p){return p===34||p===39||p===40?aA(t,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):g(p)}function h(p){return Gt(p)?fd(t,g)(p):g(p)}function g(p){return p===41?(t.enter("resourceMarker"),t.consume(p),t.exit("resourceMarker"),t.exit("resource"),e):n(p)}}function lB(t,e,n){const r=this;return s;function s(u){return iA.call(r,t,a,l,"reference","referenceMarker","referenceString")(u)}function a(u){return r.parser.defined.includes(Rs(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(u):n(u)}function l(u){return n(u)}}function cB(t,e,n){return r;function r(a){return t.enter("reference"),t.enter("referenceMarker"),t.consume(a),t.exit("referenceMarker"),s}function s(a){return a===93?(t.enter("referenceMarker"),t.consume(a),t.exit("referenceMarker"),t.exit("reference"),e):n(a)}}const uB={name:"labelStartImage",resolveAll:M0.resolveAll,tokenize:dB};function dB(t,e,n){const r=this;return s;function s(u){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(u),t.exit("labelImageMarker"),a}function a(u){return u===91?(t.enter("labelMarker"),t.consume(u),t.exit("labelMarker"),t.exit("labelImage"),l):n(u)}function l(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):e(u)}}const fB={name:"labelStartLink",resolveAll:M0.resolveAll,tokenize:hB};function hB(t,e,n){const r=this;return s;function s(l){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelLink"),a}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):e(l)}}const Ox={name:"lineEnding",tokenize:mB};function mB(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Ot(t,e,"linePrefix")}}const Qh={name:"thematicBreak",tokenize:pB};function pB(t,e,n){let r=0,s;return a;function a(h){return t.enter("thematicBreak"),l(h)}function l(h){return s=h,u(h)}function u(h){return h===s?(t.enter("thematicBreakSequence"),f(h)):r>=3&&(h===null||Je(h))?(t.exit("thematicBreak"),e(h)):n(h)}function f(h){return h===s?(t.consume(h),r++,f):(t.exit("thematicBreakSequence"),jt(h)?Ot(t,u,"whitespace")(h):u(h))}}const kr={continuation:{tokenize:yB},exit:wB,name:"list",tokenize:xB},gB={partial:!0,tokenize:_B},vB={partial:!0,tokenize:bB};function xB(t,e,n){const r=this,s=r.events[r.events.length-1];let a=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return u;function u(y){const k=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:xb(y)){if(r.containerState.type||(r.containerState.type=k,t.enter(k,{_container:!0})),k==="listUnordered")return t.enter("listItemPrefix"),y===42||y===45?t.check(Qh,n,h)(y):h(y);if(!r.interrupt||y===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),f(y)}return n(y)}function f(y){return xb(y)&&++l<10?(t.consume(y),f):(!r.interrupt||l<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(t.exit("listItemValue"),h(y)):n(y)}function h(y){return t.enter("listItemMarker"),t.consume(y),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,t.check(qd,r.interrupt?n:g,t.attempt(gB,x,p))}function g(y){return r.containerState.initialBlankLine=!0,a++,x(y)}function p(y){return jt(y)?(t.enter("listItemPrefixWhitespace"),t.consume(y),t.exit("listItemPrefixWhitespace"),x):n(y)}function x(y){return r.containerState.size=a+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(y)}}function yB(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(qd,s,a);function s(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ot(t,e,"listItemIndent",r.containerState.size+1)(u)}function a(u){return r.containerState.furtherBlankLines||!jt(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(vB,e,l)(u))}function l(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ot(t,t.attempt(kr,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function bB(t,e,n){const r=this;return Ot(t,s,"listItemIndent",r.containerState.size+1);function s(a){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?e(a):n(a)}}function wB(t){t.exit(this.containerState.type)}function _B(t,e,n){const r=this;return Ot(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(a){const l=r.events[r.events.length-1];return!jt(a)&&l&&l[1].type==="listItemPrefixWhitespace"?e(a):n(a)}}const yN={name:"setextUnderline",resolveTo:kB,tokenize:SB};function kB(t,e){let n=t.length,r,s,a;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!a&&t[n][1].type==="definition"&&(a=n);const l={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",a?(t.splice(s,0,["enter",l,e]),t.splice(a+1,0,["exit",t[r][1],e]),t[r][1].end={...t[a][1].end}):t[r][1]=l,t.push(["exit",l,e]),t}function SB(t,e,n){const r=this;let s;return a;function a(h){let g=r.events.length,p;for(;g--;)if(r.events[g][1].type!=="lineEnding"&&r.events[g][1].type!=="linePrefix"&&r.events[g][1].type!=="content"){p=r.events[g][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(t.enter("setextHeadingLine"),s=h,l(h)):n(h)}function l(h){return t.enter("setextHeadingLineSequence"),u(h)}function u(h){return h===s?(t.consume(h),u):(t.exit("setextHeadingLineSequence"),jt(h)?Ot(t,f,"lineSuffix")(h):f(h))}function f(h){return h===null||Je(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const jB={tokenize:NB};function NB(t){const e=this,n=t.attempt(qd,r,t.attempt(this.parser.constructs.flowInitial,s,Ot(t,t.attempt(this.parser.constructs.flow,s,t.attempt(O9,s)),"linePrefix")));return n;function r(a){if(a===null){t.consume(a);return}return t.enter("lineEndingBlank"),t.consume(a),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const CB={resolveAll:lA()},EB=oA("string"),TB=oA("text");function oA(t){return{resolveAll:lA(t==="text"?AB:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],a=n.attempt(s,l,u);return l;function l(g){return h(g)?a(g):u(g)}function u(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),f}function f(g){return h(g)?(n.exit("data"),a(g)):(n.consume(g),f)}function h(g){if(g===null)return!0;const p=s[g];let x=-1;if(p)for(;++x<p.length;){const y=p[x];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function lA(t){return e;function e(n,r){let s=-1,a;for(;++s<=n.length;)a===void 0?n[s]&&n[s][1].type==="data"&&(a=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==a+2&&(n[a][1].end=n[s-1][1].end,n.splice(a+2,s-a-2),s=a+2),a=void 0);return t?t(n,r):n}}function AB(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],s=e.sliceStream(r);let a=s.length,l=-1,u=0,f;for(;a--;){const h=s[a];if(typeof h=="string"){for(l=h.length;h.charCodeAt(l-1)===32;)u++,l--;if(l)break;l=-1}else if(h===-2)f=!0,u++;else if(h!==-1){a++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(u=0),u){const h={type:n===t.length||f||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?l:r.start._bufferIndex+l,_index:r.start._index+a,line:r.end.line,column:r.end.column-u,offset:r.end.offset-u},end:{...r.end}};r.end={...h.start},r.start.offset===r.end.offset?Object.assign(r,h):(t.splice(n,0,["enter",h,e],["exit",h,e]),n+=2)}n++}return t}const OB={42:kr,43:kr,45:kr,48:kr,49:kr,50:kr,51:kr,52:kr,53:kr,54:kr,55:kr,56:kr,57:kr,62:eA},RB={91:L9},MB={[-2]:Ax,[-1]:Ax,32:Ax},DB={35:U9,42:Qh,45:[yN,Qh],60:K9,61:yN,95:Qh,96:vN,126:vN},IB={38:nA,92:tA},LB={[-5]:Ox,[-4]:Ox,[-3]:Ox,33:uB,38:nA,42:yb,60:[f9,J9],91:fB,92:[F9,tA],93:M0,95:yb,96:j9},PB={null:[yb,CB]},$B={null:[42,95]},zB={null:[]},FB=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:$B,contentInitial:RB,disable:zB,document:OB,flow:DB,flowInitial:MB,insideSpan:PB,string:IB,text:LB},Symbol.toStringTag,{value:"Module"}));function BB(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},a=[];let l=[],u=[];const f={attempt:E(I),check:E(T),consume:C,enter:j,exit:A,interrupt:E(T,{interrupt:!0})},h={code:null,containerState:{},defineSkip:w,events:[],now:k,parser:t,previous:null,sliceSerialize:x,sliceStream:y,write:p};let g=e.tokenize.call(h,f);return e.resolveAll&&a.push(e),h;function p(B){return l=ss(l,B),S(),l[l.length-1]!==null?[]:(R(e,0),h.events=fp(a,h.events,h),h.events)}function x(B,q){return qB(y(B),q)}function y(B){return UB(l,B)}function k(){const{_bufferIndex:B,_index:q,line:K,column:G,offset:F}=r;return{_bufferIndex:B,_index:q,line:K,column:G,offset:F}}function w(B){s[B.line]=B.column,D()}function S(){let B;for(;r._index<l.length;){const q=l[r._index];if(typeof q=="string")for(B=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===B&&r._bufferIndex<q.length;)N(q.charCodeAt(r._bufferIndex));else N(q)}}function N(B){g=g(B)}function C(B){Je(B)?(r.line++,r.column=1,r.offset+=B===-3?2:1,D()):B!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),h.previous=B}function j(B,q){const K=q||{};return K.type=B,K.start=k(),h.events.push(["enter",K,h]),u.push(K),K}function A(B){const q=u.pop();return q.end=k(),h.events.push(["exit",q,h]),q}function I(B,q){R(B,q.from)}function T(B,q){q.restore()}function E(B,q){return K;function K(G,F,M){let V,U,H,L;return Array.isArray(G)?ie(G):"tokenize"in G?ie([G]):ne(G);function ne(Ne){return ge;function ge(Fe){const Qe=Fe!==null&&Ne[Fe],$e=Fe!==null&&Ne.null,Q=[...Array.isArray(Qe)?Qe:Qe?[Qe]:[],...Array.isArray($e)?$e:$e?[$e]:[]];return ie(Q)(Fe)}}function ie(Ne){return V=Ne,U=0,Ne.length===0?M:P(Ne[U])}function P(Ne){return ge;function ge(Fe){return L=z(),H=Ne,Ne.partial||(h.currentConstruct=Ne),Ne.name&&h.parser.constructs.disable.null.includes(Ne.name)?Pe():Ne.tokenize.call(q?Object.assign(Object.create(h),q):h,f,pe,Pe)(Fe)}}function pe(Ne){return B(H,L),F}function Pe(Ne){return L.restore(),++U<V.length?P(V[U]):M}}}function R(B,q){B.resolveAll&&!a.includes(B)&&a.push(B),B.resolve&&Vr(h.events,q,h.events.length-q,B.resolve(h.events.slice(q),h)),B.resolveTo&&(h.events=B.resolveTo(h.events,h))}function z(){const B=k(),q=h.previous,K=h.currentConstruct,G=h.events.length,F=Array.from(u);return{from:G,restore:M};function M(){r=B,h.previous=q,h.currentConstruct=K,h.events.length=G,u=F,D()}}function D(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function UB(t,e){const n=e.start._index,r=e.start._bufferIndex,s=e.end._index,a=e.end._bufferIndex;let l;if(n===s)l=[t[n].slice(r,a)];else{if(l=t.slice(n,s),r>-1){const u=l[0];typeof u=="string"?l[0]=u.slice(r):l.shift()}a>0&&l.push(t[s].slice(0,a))}return l}function qB(t,e){let n=-1;const r=[];let s;for(;++n<t.length;){const a=t[n];let l;if(typeof a=="string")l=a;else switch(a){case-5:{l="\r";break}case-4:{l=`
|
|
438
|
-
`;break}case-3:{l=`\r
|
|
439
|
-
`;break}case-2:{l=e?" ":" ";break}case-1:{if(!e&&s)continue;l=" ";break}default:l=String.fromCharCode(a)}s=a===-2,r.push(l)}return r.join("")}function HB(t){const r={constructs:XT([FB,...(t||{}).extensions||[]]),content:s(i9),defined:[],document:s(o9),flow:s(jB),lazy:{},string:s(EB),text:s(TB)};return r;function s(a){return l;function l(u){return BB(r,a,u)}}}function VB(t){for(;!rA(t););return t}const bN=/[\0\t\n\r]/g;function KB(){let t=1,e="",n=!0,r;return s;function s(a,l,u){const f=[];let h,g,p,x,y;for(a=e+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),p=0,e="",n&&(a.charCodeAt(0)===65279&&p++,n=void 0);p<a.length;){if(bN.lastIndex=p,h=bN.exec(a),x=h&&h.index!==void 0?h.index:a.length,y=a.charCodeAt(x),!h){e=a.slice(p);break}if(y===10&&p===x&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),p<x&&(f.push(a.slice(p,x)),t+=x-p),y){case 0:{f.push(65533),t++;break}case 9:{for(g=Math.ceil(t/4)*4,f.push(-2);t++<g;)f.push(-1);break}case 10:{f.push(-4),t=1;break}default:r=!0,t=1}p=x+1}return u&&(r&&f.push(-5),e&&f.push(e),f.push(null)),f}}const YB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function GB(t){return t.replace(YB,ZB)}function ZB(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),a=s===120||s===88;return JT(n.slice(a?2:1),a?16:10)}return R0(n)||t}const cA={}.hasOwnProperty;function WB(t,e,n){return typeof e!="string"&&(n=e,e=void 0),QB(n)(VB(HB(n).document().write(KB()(t,e,!0))))}function QB(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(ue),autolinkProtocol:z,autolinkEmail:z,atxHeading:a(he),blockQuote:a($e),characterEscape:z,characterReference:z,codeFenced:a(Q),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(Q,l),codeText:a(_e,l),codeTextData:z,data:z,codeFlowValue:z,definition:a(Oe),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(le),hardBreakEscape:a(Ee),hardBreakTrailing:a(Ee),htmlFlow:a(De,l),htmlFlowData:z,htmlText:a(De,l),htmlTextData:z,image:a(ve),label:l,link:a(ue),listItem:a(ze),listItemValue:x,listOrdered:a(Ce,p),listUnordered:a(Ce),paragraph:a(be),reference:P,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a(he),strong:a(Se),thematicBreak:a(dt)},exit:{atxHeading:f(),atxHeadingSequence:I,autolink:f(),autolinkEmail:Qe,autolinkProtocol:Fe,blockQuote:f(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:Pe,characterReferenceMarkerNumeric:Pe,characterReferenceValue:Ne,characterReference:ge,codeFenced:f(S),codeFencedFence:w,codeFencedFenceInfo:y,codeFencedFenceMeta:k,codeFlowValue:D,codeIndented:f(N),codeText:f(F),codeTextData:D,data:D,definition:f(),definitionDestinationString:A,definitionLabelString:C,definitionTitleString:j,emphasis:f(),hardBreakEscape:f(q),hardBreakTrailing:f(q),htmlFlow:f(K),htmlFlowData:D,htmlText:f(G),htmlTextData:D,image:f(V),label:H,labelText:U,lineEnding:B,link:f(M),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:pe,resourceDestinationString:L,resourceTitleString:ne,resource:ie,setextHeading:f(R),setextHeadingLineSequence:E,setextHeadingText:T,strong:f(),thematicBreak:f()}};uA(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(J){let me={type:"root",children:[]};const Ae={stack:[me],tokenStack:[],config:e,enter:u,exit:h,buffer:l,resume:g,data:n},He=[];let Et=-1;for(;++Et<J.length;)if(J[Et][1].type==="listOrdered"||J[Et][1].type==="listUnordered")if(J[Et][0]==="enter")He.push(Et);else{const kn=He.pop();Et=s(J,kn,Et)}for(Et=-1;++Et<J.length;){const kn=e[J[Et][0]];cA.call(kn,J[Et][1].type)&&kn[J[Et][1].type].call(Object.assign({sliceSerialize:J[Et][2].sliceSerialize},Ae),J[Et][1])}if(Ae.tokenStack.length>0){const kn=Ae.tokenStack[Ae.tokenStack.length-1];(kn[1]||wN).call(Ae,void 0,kn[0])}for(me.position={start:ka(J.length>0?J[0][1].start:{line:1,column:1,offset:0}),end:ka(J.length>0?J[J.length-2][1].end:{line:1,column:1,offset:0})},Et=-1;++Et<e.transforms.length;)me=e.transforms[Et](me)||me;return me}function s(J,me,Ae){let He=me-1,Et=-1,kn=!1,xr,on,Hn,Rn;for(;++He<=Ae;){const ln=J[He];switch(ln[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ln[0]==="enter"?Et++:Et--,Rn=void 0;break}case"lineEndingBlank":{ln[0]==="enter"&&(xr&&!Rn&&!Et&&!Hn&&(Hn=He),Rn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Rn=void 0}if(!Et&&ln[0]==="enter"&&ln[1].type==="listItemPrefix"||Et===-1&&ln[0]==="exit"&&(ln[1].type==="listUnordered"||ln[1].type==="listOrdered")){if(xr){let Sn=He;for(on=void 0;Sn--;){const $n=J[Sn];if($n[1].type==="lineEnding"||$n[1].type==="lineEndingBlank"){if($n[0]==="exit")continue;on&&(J[on][1].type="lineEndingBlank",kn=!0),$n[1].type="lineEnding",on=Sn}else if(!($n[1].type==="linePrefix"||$n[1].type==="blockQuotePrefix"||$n[1].type==="blockQuotePrefixWhitespace"||$n[1].type==="blockQuoteMarker"||$n[1].type==="listItemIndent"))break}Hn&&(!on||Hn<on)&&(xr._spread=!0),xr.end=Object.assign({},on?J[on][1].start:ln[1].end),J.splice(on||He,0,["exit",xr,ln[2]]),He++,Ae++}if(ln[1].type==="listItemPrefix"){const Sn={type:"listItem",_spread:!1,start:Object.assign({},ln[1].start),end:void 0};xr=Sn,J.splice(He,0,["enter",Sn,ln[2]]),He++,Ae++,Hn=void 0,Rn=!0}}}return J[me][1]._spread=kn,Ae}function a(J,me){return Ae;function Ae(He){u.call(this,J(He),He),me&&me.call(this,He)}}function l(){this.stack.push({type:"fragment",children:[]})}function u(J,me,Ae){this.stack[this.stack.length-1].children.push(J),this.stack.push(J),this.tokenStack.push([me,Ae||void 0]),J.position={start:ka(me.start),end:void 0}}function f(J){return me;function me(Ae){J&&J.call(this,Ae),h.call(this,Ae)}}function h(J,me){const Ae=this.stack.pop(),He=this.tokenStack.pop();if(He)He[0].type!==J.type&&(me?me.call(this,J,He[0]):(He[1]||wN).call(this,J,He[0]));else throw new Error("Cannot close `"+J.type+"` ("+dd({start:J.start,end:J.end})+"): itโs not open");Ae.position.end=ka(J.end)}function g(){return O0(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function x(J){if(this.data.expectingFirstListItemValue){const me=this.stack[this.stack.length-2];me.start=Number.parseInt(this.sliceSerialize(J),10),this.data.expectingFirstListItemValue=void 0}}function y(){const J=this.resume(),me=this.stack[this.stack.length-1];me.lang=J}function k(){const J=this.resume(),me=this.stack[this.stack.length-1];me.meta=J}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const J=this.resume(),me=this.stack[this.stack.length-1];me.value=J.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function N(){const J=this.resume(),me=this.stack[this.stack.length-1];me.value=J.replace(/(\r?\n|\r)$/g,"")}function C(J){const me=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=me,Ae.identifier=Rs(this.sliceSerialize(J)).toLowerCase()}function j(){const J=this.resume(),me=this.stack[this.stack.length-1];me.title=J}function A(){const J=this.resume(),me=this.stack[this.stack.length-1];me.url=J}function I(J){const me=this.stack[this.stack.length-1];if(!me.depth){const Ae=this.sliceSerialize(J).length;me.depth=Ae}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function E(J){const me=this.stack[this.stack.length-1];me.depth=this.sliceSerialize(J).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function z(J){const Ae=this.stack[this.stack.length-1].children;let He=Ae[Ae.length-1];(!He||He.type!=="text")&&(He=ot(),He.position={start:ka(J.start),end:void 0},Ae.push(He)),this.stack.push(He)}function D(J){const me=this.stack.pop();me.value+=this.sliceSerialize(J),me.position.end=ka(J.end)}function B(J){const me=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ae=me.children[me.children.length-1];Ae.position.end=ka(J.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(me.type)&&(z.call(this,J),D.call(this,J))}function q(){this.data.atHardBreak=!0}function K(){const J=this.resume(),me=this.stack[this.stack.length-1];me.value=J}function G(){const J=this.resume(),me=this.stack[this.stack.length-1];me.value=J}function F(){const J=this.resume(),me=this.stack[this.stack.length-1];me.value=J}function M(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=me,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function V(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=me,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function U(J){const me=this.sliceSerialize(J),Ae=this.stack[this.stack.length-2];Ae.label=GB(me),Ae.identifier=Rs(me).toLowerCase()}function H(){const J=this.stack[this.stack.length-1],me=this.resume(),Ae=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ae.type==="link"){const He=J.children;Ae.children=He}else Ae.alt=me}function L(){const J=this.resume(),me=this.stack[this.stack.length-1];me.url=J}function ne(){const J=this.resume(),me=this.stack[this.stack.length-1];me.title=J}function ie(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function pe(J){const me=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=me,Ae.identifier=Rs(this.sliceSerialize(J)).toLowerCase(),this.data.referenceType="full"}function Pe(J){this.data.characterReferenceType=J.type}function Ne(J){const me=this.sliceSerialize(J),Ae=this.data.characterReferenceType;let He;Ae?(He=JT(me,Ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):He=R0(me);const Et=this.stack[this.stack.length-1];Et.value+=He}function ge(J){const me=this.stack.pop();me.position.end=ka(J.end)}function Fe(J){D.call(this,J);const me=this.stack[this.stack.length-1];me.url=this.sliceSerialize(J)}function Qe(J){D.call(this,J);const me=this.stack[this.stack.length-1];me.url="mailto:"+this.sliceSerialize(J)}function $e(){return{type:"blockquote",children:[]}}function Q(){return{type:"code",lang:null,meta:null,value:""}}function _e(){return{type:"inlineCode",value:""}}function Oe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function le(){return{type:"emphasis",children:[]}}function he(){return{type:"heading",depth:0,children:[]}}function Ee(){return{type:"break"}}function De(){return{type:"html",value:""}}function ve(){return{type:"image",title:null,url:"",alt:null}}function ue(){return{type:"link",title:null,url:"",children:[]}}function Ce(J){return{type:"list",ordered:J.type==="listOrdered",start:null,spread:J._spread,children:[]}}function ze(J){return{type:"listItem",spread:J._spread,checked:null,children:[]}}function be(){return{type:"paragraph",children:[]}}function Se(){return{type:"strong",children:[]}}function ot(){return{type:"text",value:""}}function dt(){return{type:"thematicBreak"}}}function ka(t){return{line:t.line,column:t.column,offset:t.offset}}function uA(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?uA(t,r):XB(t,r)}}function XB(t,e){let n;for(n in e)if(cA.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function wN(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+dd({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+dd({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+dd({start:e.start,end:e.end})+") is still open")}function JB(t){const e=this;e.parser=n;function n(r){return WB(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function eU(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function tU(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
440
|
-
`}]}function nU(t,e){const n=e.value?e.value+`
|
|
441
|
-
`:"",r={};e.lang&&(r.className=["language-"+e.lang]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function rU(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function sU(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function iU(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),s=Dc(r.toLowerCase()),a=t.footnoteOrder.indexOf(r);let l,u=t.footnoteCounts.get(r);u===void 0?(u=0,t.footnoteOrder.push(r),l=t.footnoteOrder.length):l=a+1,u+=1,t.footnoteCounts.set(r,u);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};t.patch(e,f);const h={type:"element",tagName:"sup",properties:{},children:[f]};return t.patch(e,h),t.applyData(e,h)}function aU(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function oU(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function dA(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),a=s[0];a&&a.type==="text"?a.value="["+a.value:s.unshift({type:"text",value:"["});const l=s[s.length-1];return l&&l.type==="text"?l.value+=r:s.push({type:"text",value:r}),s}function lU(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return dA(t,e);const s={src:Dc(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const a={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,a),t.applyData(e,a)}function cU(t,e){const n={src:Dc(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function uU(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function dU(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return dA(t,e);const s={href:Dc(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const a={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,a),t.applyData(e,a)}function fU(t,e){const n={href:Dc(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function hU(t,e,n){const r=t.all(e),s=n?mU(n):fA(e),a={},l=[];if(typeof e.checked=="boolean"){const g=r[0];let p;g&&g.type==="element"&&g.tagName==="p"?p=g:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let u=-1;for(;++u<r.length;){const g=r[u];(s||u!==0||g.type!=="element"||g.tagName!=="p")&&l.push({type:"text",value:`
|
|
442
|
-
`}),g.type==="element"&&g.tagName==="p"&&!s?l.push(...g.children):l.push(g)}const f=r[r.length-1];f&&(s||f.type!=="element"||f.tagName!=="p")&&l.push({type:"text",value:`
|
|
443
|
-
`});const h={type:"element",tagName:"li",properties:a,children:l};return t.patch(e,h),t.applyData(e,h)}function mU(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=fA(n[r])}return e}function fA(t){const e=t.spread;return e??t.children.length>1}function pU(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s<r.length;){const l=r[s];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const a={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,a),t.applyData(e,a)}function gU(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function vU(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function xU(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function yU(t,e){const n=t.all(e),r=n.shift(),s=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],l),s.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},u=C0(e.children[1]),f=VT(e.children[e.children.length-1]);u&&f&&(l.position={start:u,end:f}),s.push(l)}const a={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,a),t.applyData(e,a)}function bU(t,e,n){const r=n?n.children:void 0,a=(r?r.indexOf(e):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,u=l?l.length:e.children.length;let f=-1;const h=[];for(;++f<u;){const p=e.children[f],x={},y=l?l[f]:void 0;y&&(x.align=y);let k={type:"element",tagName:a,properties:x,children:[]};p&&(k.children=t.all(p),t.patch(p,k),k=t.applyData(p,k)),h.push(k)}const g={type:"element",tagName:"tr",properties:{},children:t.wrap(h,!0)};return t.patch(e,g),t.applyData(e,g)}function wU(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const _N=9,kN=32;function _U(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),s=0;const a=[];for(;r;)a.push(SN(e.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return a.push(SN(e.slice(s),s>0,!1)),a.join("")}function SN(t,e,n){let r=0,s=t.length;if(e){let a=t.codePointAt(r);for(;a===_N||a===kN;)r++,a=t.codePointAt(r)}if(n){let a=t.codePointAt(s-1);for(;a===_N||a===kN;)s--,a=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function kU(t,e){const n={type:"text",value:_U(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function SU(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const jU={blockquote:eU,break:tU,code:nU,delete:rU,emphasis:sU,footnoteReference:iU,heading:aU,html:oU,imageReference:lU,image:cU,inlineCode:uU,linkReference:dU,link:fU,listItem:hU,list:pU,paragraph:gU,root:vU,strong:xU,table:yU,tableCell:wU,tableRow:bU,text:kU,thematicBreak:SU,toml:Ch,yaml:Ch,definition:Ch,footnoteDefinition:Ch};function Ch(){}const hA=-1,hp=0,hd=1,Im=2,D0=3,I0=4,L0=5,P0=6,mA=7,pA=8,jN=typeof self=="object"?self:globalThis,NU=(t,e)=>{const n=(s,a)=>(t.set(a,s),s),r=s=>{if(t.has(s))return t.get(s);const[a,l]=e[s];switch(a){case hp:case hA:return n(l,s);case hd:{const u=n([],s);for(const f of l)u.push(r(f));return u}case Im:{const u=n({},s);for(const[f,h]of l)u[r(f)]=r(h);return u}case D0:return n(new Date(l),s);case I0:{const{source:u,flags:f}=l;return n(new RegExp(u,f),s)}case L0:{const u=n(new Map,s);for(const[f,h]of l)u.set(r(f),r(h));return u}case P0:{const u=n(new Set,s);for(const f of l)u.add(r(f));return u}case mA:{const{name:u,message:f}=l;return n(new jN[u](f),s)}case pA:return n(BigInt(l),s);case"BigInt":return n(Object(BigInt(l)),s);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:u}=new Uint8Array(l);return n(new DataView(u),l)}}return n(new jN[a](l),s)};return r},NN=t=>NU(new Map,t)(0),Ml="",{toString:CU}={},{keys:EU}=Object,Ku=t=>{const e=typeof t;if(e!=="object"||!t)return[hp,e];const n=CU.call(t).slice(8,-1);switch(n){case"Array":return[hd,Ml];case"Object":return[Im,Ml];case"Date":return[D0,Ml];case"RegExp":return[I0,Ml];case"Map":return[L0,Ml];case"Set":return[P0,Ml];case"DataView":return[hd,n]}return n.includes("Array")?[hd,n]:n.includes("Error")?[mA,n]:[Im,n]},Eh=([t,e])=>t===hp&&(e==="function"||e==="symbol"),TU=(t,e,n,r)=>{const s=(l,u)=>{const f=r.push(l)-1;return n.set(u,f),f},a=l=>{if(n.has(l))return n.get(l);let[u,f]=Ku(l);switch(u){case hp:{let g=l;switch(f){case"bigint":u=pA,g=l.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+f);g=null;break;case"undefined":return s([hA],l)}return s([u,g],l)}case hd:{if(f){let x=l;return f==="DataView"?x=new Uint8Array(l.buffer):f==="ArrayBuffer"&&(x=new Uint8Array(l)),s([f,[...x]],l)}const g=[],p=s([u,g],l);for(const x of l)g.push(a(x));return p}case Im:{if(f)switch(f){case"BigInt":return s([f,l.toString()],l);case"Boolean":case"Number":case"String":return s([f,l.valueOf()],l)}if(e&&"toJSON"in l)return a(l.toJSON());const g=[],p=s([u,g],l);for(const x of EU(l))(t||!Eh(Ku(l[x])))&&g.push([a(x),a(l[x])]);return p}case D0:return s([u,l.toISOString()],l);case I0:{const{source:g,flags:p}=l;return s([u,{source:g,flags:p}],l)}case L0:{const g=[],p=s([u,g],l);for(const[x,y]of l)(t||!(Eh(Ku(x))||Eh(Ku(y))))&&g.push([a(x),a(y)]);return p}case P0:{const g=[],p=s([u,g],l);for(const x of l)(t||!Eh(Ku(x)))&&g.push(a(x));return p}}const{message:h}=l;return s([u,{name:f,message:h}],l)};return a},CN=(t,{json:e,lossy:n}={})=>{const r=[];return TU(!(e||n),!!e,new Map,r)(t),r},Lm=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?NN(CN(t,e)):structuredClone(t):(t,e)=>NN(CN(t,e));function AU(t,e){const n=[{type:"text",value:"โฉ"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function OU(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function RU(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||AU,r=t.options.footnoteBackLabel||OU,s=t.options.footnoteLabel||"Footnotes",a=t.options.footnoteLabelTagName||"h2",l=t.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let f=-1;for(;++f<t.footnoteOrder.length;){const h=t.footnoteById.get(t.footnoteOrder[f]);if(!h)continue;const g=t.all(h),p=String(h.identifier).toUpperCase(),x=Dc(p.toLowerCase());let y=0;const k=[],w=t.footnoteCounts.get(p);for(;w!==void 0&&++y<=w;){k.length>0&&k.push({type:"text",value:" "});let C=typeof n=="string"?n:n(f,y);typeof C=="string"&&(C={type:"text",value:C}),k.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+x+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(f,y),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const S=g[g.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const C=S.children[S.children.length-1];C&&C.type==="text"?C.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...k)}else g.push(...k);const N={type:"element",tagName:"li",properties:{id:e+"fn-"+x},children:t.wrap(g,!0)};t.patch(h,N),u.push(N)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Lm(l),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
444
|
-
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(u,!0)},{type:"text",value:`
|
|
445
|
-
`}]}}const mp=(function(t){if(t==null)return LU;if(typeof t=="function")return pp(t);if(typeof t=="object")return Array.isArray(t)?MU(t):DU(t);if(typeof t=="string")return IU(t);throw new Error("Expected function, string, or object as test")});function MU(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=mp(t[n]);return pp(r);function r(...s){let a=-1;for(;++a<e.length;)if(e[a].apply(this,s))return!0;return!1}}function DU(t){const e=t;return pp(n);function n(r){const s=r;let a;for(a in t)if(s[a]!==e[a])return!1;return!0}}function IU(t){return pp(e);function e(n){return n&&n.type===t}}function pp(t){return e;function e(n,r,s){return!!(PU(n)&&t.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function LU(){return!0}function PU(t){return t!==null&&typeof t=="object"&&"type"in t}const gA=[],$U=!0,bb=!1,zU="skip";function vA(t,e,n,r){let s;typeof e=="function"&&typeof n!="function"?(r=n,n=e):s=e;const a=mp(s),l=r?-1:1;u(t,void 0,[])();function u(f,h,g){const p=f&&typeof f=="object"?f:{};if(typeof p.type=="string"){const y=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(f.type+(y?"<"+y+">":""))+")"})}return x;function x(){let y=gA,k,w,S;if((!e||a(f,h,g[g.length-1]||void 0))&&(y=FU(n(f,g)),y[0]===bb))return y;if("children"in f&&f.children){const N=f;if(N.children&&y[0]!==zU)for(w=(r?N.children.length:-1)+l,S=g.concat(N);w>-1&&w<N.children.length;){const C=N.children[w];if(k=u(C,w,S)(),k[0]===bb)return k;w=typeof k[1]=="number"?k[1]:w+l}}return y}}}function FU(t){return Array.isArray(t)?t:typeof t=="number"?[$U,t]:t==null?gA:[t]}function $0(t,e,n,r){let s,a,l;typeof e=="function"&&typeof n!="function"?(a=void 0,l=e,s=n):(a=e,l=n,s=r),vA(t,a,u,s);function u(f,h){const g=h[h.length-1],p=g?g.children.indexOf(f):void 0;return l(f,p,g)}}const wb={}.hasOwnProperty,BU={};function UU(t,e){const n=e||BU,r=new Map,s=new Map,a=new Map,l={...jU,...n.handlers},u={all:h,applyData:HU,definitionById:r,footnoteById:s,footnoteCounts:a,footnoteOrder:[],handlers:l,one:f,options:n,patch:qU,wrap:KU};return $0(t,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const p=g.type==="definition"?r:s,x=String(g.identifier).toUpperCase();p.has(x)||p.set(x,g)}}),u;function f(g,p){const x=g.type,y=u.handlers[x];if(wb.call(u.handlers,x)&&y)return y(u,g,p);if(u.options.passThrough&&u.options.passThrough.includes(x)){if("children"in g){const{children:w,...S}=g,N=Lm(S);return N.children=u.all(g),N}return Lm(g)}return(u.options.unknownHandler||VU)(u,g,p)}function h(g){const p=[];if("children"in g){const x=g.children;let y=-1;for(;++y<x.length;){const k=u.one(x[y],g);if(k){if(y&&x[y-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=EN(k.value)),!Array.isArray(k)&&k.type==="element")){const w=k.children[0];w&&w.type==="text"&&(w.value=EN(w.value))}Array.isArray(k)?p.push(...k):p.push(k)}}}return p}}function qU(t,e){t.position&&(e.position=O8(t))}function HU(t,e){let n=e;if(t&&t.data){const r=t.data.hName,s=t.data.hChildren,a=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&a&&Object.assign(n.properties,Lm(a)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function VU(t,e){const n=e.data||{},r="value"in e&&!(wb.call(n,"hProperties")||wb.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function KU(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
|
|
446
|
-
`});++r<t.length;)r&&n.push({type:"text",value:`
|
|
447
|
-
`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
|
|
448
|
-
`}),n}function EN(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function TN(t,e){const n=UU(t,e),r=n.one(t,void 0),s=RU(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&a.children.push({type:"text",value:`
|
|
449
|
-
`},s),a}function YU(t,e){return t&&"run"in t?async function(n,r){const s=TN(n,{file:r,...e});await t.run(s,r)}:function(n,r){return TN(n,{file:r,...t||e})}}function AN(t){if(t)throw t}var Rx,ON;function GU(){if(ON)return Rx;ON=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):e.call(h)==="[object Array]"},a=function(h){if(!h||e.call(h)!=="[object Object]")return!1;var g=t.call(h,"constructor"),p=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!p)return!1;var x;for(x in h);return typeof x>"u"||t.call(h,x)},l=function(h,g){n&&g.name==="__proto__"?n(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},u=function(h,g){if(g==="__proto__")if(t.call(h,g)){if(r)return r(h,g).value}else return;return h[g]};return Rx=function f(){var h,g,p,x,y,k,w=arguments[0],S=1,N=arguments.length,C=!1;for(typeof w=="boolean"&&(C=w,w=arguments[1]||{},S=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});S<N;++S)if(h=arguments[S],h!=null)for(g in h)p=u(w,g),x=u(h,g),w!==x&&(C&&x&&(a(x)||(y=s(x)))?(y?(y=!1,k=p&&s(p)?p:[]):k=p&&a(p)?p:{},l(w,{name:g,newValue:f(C,k,x)})):typeof x<"u"&&l(w,{name:g,newValue:x}));return w},Rx}var ZU=GU();const Mx=kc(ZU);function _b(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function WU(){const t=[],e={run:n,use:r};return e;function n(...s){let a=-1;const l=s.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...s);function u(f,...h){const g=t[++a];let p=-1;if(f){l(f);return}for(;++p<s.length;)(h[p]===null||h[p]===void 0)&&(h[p]=s[p]);s=h,g?QU(g,u)(...h):l(null,...h)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return t.push(s),e}}function QU(t,e){let n;return r;function r(...l){const u=t.length>l.length;let f;u&&l.push(s);try{f=t.apply(this,l)}catch(h){const g=h;if(u&&n)throw g;return s(g)}u||(f&&f.then&&typeof f.then=="function"?f.then(a,s):f instanceof Error?s(f):a(f))}function s(l,...u){n||(n=!0,e(l,...u))}function a(l){s(null,l)}}const Ys={basename:XU,dirname:JU,extname:e7,join:t7,sep:"/"};function XU(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Hd(t);let n=0,r=-1,s=t.length,a;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(a){n=s+1;break}}else r<0&&(a=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let l=-1,u=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(a){n=s+1;break}}else l<0&&(a=!0,l=s+1),u>-1&&(t.codePointAt(s)===e.codePointAt(u--)?u<0&&(r=s):(u=-1,r=l));return n===r?r=l:r<0&&(r=t.length),t.slice(n,r)}function JU(t){if(Hd(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function e7(t){Hd(t);let e=t.length,n=-1,r=0,s=-1,a=0,l;for(;e--;){const u=t.codePointAt(e);if(u===47){if(l){r=e+1;break}continue}n<0&&(l=!0,n=e+1),u===46?s<0?s=e:a!==1&&(a=1):s>-1&&(a=-1)}return s<0||n<0||a===0||a===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function t7(...t){let e=-1,n;for(;++e<t.length;)Hd(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":n7(n)}function n7(t){Hd(t);const e=t.codePointAt(0)===47;let n=r7(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function r7(t,e){let n="",r=0,s=-1,a=0,l=-1,u,f;for(;++l<=t.length;){if(l<t.length)u=t.codePointAt(l);else{if(u===47)break;u=47}if(u===47){if(!(s===l-1||a===1))if(s!==l-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),s=l,a=0;continue}}else if(n.length>0){n="",r=0,s=l,a=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,l):n=t.slice(s+1,l),r=l-s-1;s=l,a=0}else u===46&&a>-1?a++:a=-1}return n}function Hd(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const s7={cwd:i7};function i7(){return"/"}function kb(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function a7(t){if(typeof t=="string")t=new URL(t);else if(!kb(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return o7(t)}function o7(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(e)}const Dx=["history","path","basename","stem","extname","dirname"];class xA{constructor(e){let n;e?kb(e)?n={path:e}:typeof e=="string"||l7(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":s7.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Dx.length;){const a=Dx[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let s;for(s in n)Dx.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Ys.basename(this.path):void 0}set basename(e){Lx(e,"basename"),Ix(e,"basename"),this.path=Ys.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Ys.dirname(this.path):void 0}set dirname(e){RN(this.basename,"dirname"),this.path=Ys.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Ys.extname(this.path):void 0}set extname(e){if(Ix(e,"extname"),RN(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ys.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){kb(e)&&(e=a7(e)),Lx(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Ys.basename(this.path,this.extname):void 0}set stem(e){Lx(e,"stem"),Ix(e,"stem"),this.path=Ys.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const s=this.message(e,n,r);throw s.fatal=!0,s}info(e,n,r){const s=this.message(e,n,r);return s.fatal=void 0,s}message(e,n,r){const s=new lr(e,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Ix(t,e){if(t&&t.includes(Ys.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Ys.sep+"`")}function Lx(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function RN(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function l7(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const c7=(function(t){const r=this.constructor.prototype,s=r[t],a=function(){return s.apply(a,arguments)};return Object.setPrototypeOf(a,r),a}),u7={}.hasOwnProperty;class z0 extends c7{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=WU()}copy(){const e=new z0;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(Mx(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(zx("data",this.frozen),this.namespace[e]=n,this):u7.call(this.namespace,e)&&this.namespace[e]||void 0:e?(zx("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(e,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Th(e),r=this.parser||this.Parser;return Px("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),Px("process",this.parser||this.Parser),$x("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(a,l){const u=Th(e),f=r.parse(u);r.run(f,u,function(g,p,x){if(g||!p||!x)return h(g);const y=p,k=r.stringify(y,x);h7(k)?x.value=k:x.result=k,h(g,x)});function h(g,p){g||!p?l(g):a?a(p):n(void 0,p)}}}processSync(e){let n=!1,r;return this.freeze(),Px("processSync",this.parser||this.Parser),$x("processSync",this.compiler||this.Compiler),this.process(e,s),DN("processSync","process",n),r;function s(a,l){n=!0,AN(a),r=l}}run(e,n,r){MN(e),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(l,u){const f=Th(n);s.run(e,f,h);function h(g,p,x){const y=p||e;g?u(g):l?l(y):r(void 0,y,x)}}}runSync(e,n){let r=!1,s;return this.run(e,n,a),DN("runSync","run",r),s;function a(l,u){AN(l),s=u,r=!0}}stringify(e,n){this.freeze();const r=Th(n),s=this.compiler||this.Compiler;return $x("stringify",s),MN(e),s(e,r)}use(e,...n){const r=this.attachers,s=this.namespace;if(zx("use",this.frozen),e!=null)if(typeof e=="function")f(e,n);else if(typeof e=="object")Array.isArray(e)?u(e):l(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function a(h){if(typeof h=="function")f(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...p]=h;f(g,p)}else l(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function l(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(h.plugins),h.settings&&(s.settings=Mx(!0,s.settings,h.settings))}function u(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const p=h[g];a(p)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function f(h,g){let p=-1,x=-1;for(;++p<r.length;)if(r[p][0]===h){x=p;break}if(x===-1)r.push([h,...g]);else if(g.length>0){let[y,...k]=g;const w=r[x][1];_b(w)&&_b(y)&&(y=Mx(!0,w,y)),r[x]=[h,y,...k]}}}}const d7=new z0().freeze();function Px(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function $x(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function zx(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function MN(t){if(!_b(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function DN(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Th(t){return f7(t)?t:new xA(t)}function f7(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function h7(t){return typeof t=="string"||m7(t)}function m7(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const p7="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",IN=[],LN={allowDangerousHtml:!0},g7=/^(https?|ircs?|mailto|xmpp)$/i,v7=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function x7(t){const e=y7(t),n=b7(t);return w7(e.runSync(e.parse(n),n),t)}function y7(t){const e=t.rehypePlugins||IN,n=t.remarkPlugins||IN,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...LN}:LN;return d7().use(JB).use(n).use(YU,r).use(e)}function b7(t){const e=t.children||"",n=new xA;return typeof e=="string"&&(n.value=e),n}function w7(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,a=e.disallowedElements,l=e.skipHtml,u=e.unwrapDisallowed,f=e.urlTransform||_7;for(const g of v7)Object.hasOwn(e,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+p7+g.id,void 0);return $0(t,h),L8(t,{Fragment:c.Fragment,components:s,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function h(g,p,x){if(g.type==="raw"&&x&&typeof p=="number")return l?x.children.splice(p,1):x.children[p]={type:"text",value:g.value},p;if(g.type==="element"){let y;for(y in Tx)if(Object.hasOwn(Tx,y)&&Object.hasOwn(g.properties,y)){const k=g.properties[y],w=Tx[y];(w===null||w.includes(g.tagName))&&(g.properties[y]=f(String(k||""),y,g))}}if(g.type==="element"){let y=n?!n.includes(g.tagName):a?a.includes(g.tagName):!1;if(!y&&r&&typeof p=="number"&&(y=!r(g,p,x)),y&&x&&typeof p=="number")return u&&g.children?x.children.splice(p,1,...g.children):x.children.splice(p,1),p}}}function _7(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||g7.test(t.slice(0,e))?t:""}function PN(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function k7(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function yA(t,e,n){const s=mp((n||{}).ignore||[]),a=S7(e);let l=-1;for(;++l<a.length;)vA(t,"text",u);function u(h,g){let p=-1,x;for(;++p<g.length;){const y=g[p],k=x?x.children:void 0;if(s(y,k?k.indexOf(y):void 0,x))return;x=y}if(x)return f(h,g)}function f(h,g){const p=g[g.length-1],x=a[l][0],y=a[l][1];let k=0;const S=p.children.indexOf(h);let N=!1,C=[];x.lastIndex=0;let j=x.exec(h.value);for(;j;){const A=j.index,I={index:j.index,input:j.input,stack:[...g,h]};let T=y(...j,I);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?x.lastIndex=A+1:(k!==A&&C.push({type:"text",value:h.value.slice(k,A)}),Array.isArray(T)?C.push(...T):T&&C.push(T),k=A+j[0].length,N=!0),!x.global)break;j=x.exec(h.value)}return N?(k<h.value.length&&C.push({type:"text",value:h.value.slice(k)}),p.children.splice(S,1,...C)):C=[h],S+C.length}}function S7(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const s=n[r];e.push([j7(s[0]),N7(s[1])])}return e}function j7(t){return typeof t=="string"?new RegExp(k7(t),"g"):t}function N7(t){return typeof t=="function"?t:function(){return t}}const Fx="phrasing",Bx=["autolink","link","image","label"];function C7(){return{transforms:[D7],enter:{literalAutolink:T7,literalAutolinkEmail:Ux,literalAutolinkHttp:Ux,literalAutolinkWww:Ux},exit:{literalAutolink:M7,literalAutolinkEmail:R7,literalAutolinkHttp:A7,literalAutolinkWww:O7}}}function E7(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Fx,notInConstruct:Bx},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Fx,notInConstruct:Bx},{character:":",before:"[ps]",after:"\\/",inConstruct:Fx,notInConstruct:Bx}]}}function T7(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Ux(t){this.config.enter.autolinkProtocol.call(this,t)}function A7(t){this.config.exit.autolinkProtocol.call(this,t)}function O7(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function R7(t){this.config.exit.autolinkEmail.call(this,t)}function M7(t){this.exit(t)}function D7(t){yA(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,I7],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),L7]],{ignore:["link","linkReference"]})}function I7(t,e,n,r,s){let a="";if(!bA(s)||(/^w/i.test(e)&&(n=e+n,e="",a="http://"),!P7(n)))return!1;const l=$7(n+r);if(!l[0])return!1;const u={type:"link",title:null,url:a+e+l[0],children:[{type:"text",value:e+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function L7(t,e,n,r){return!bA(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function P7(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function $7(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=PN(t,"(");let a=PN(t,")");for(;r!==-1&&s>a;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),a++;return[t,n]}function bA(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Fo(n)||dp(n))&&(!e||n!==47)}wA.peek=Y7;function z7(){this.buffer()}function F7(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function B7(){this.buffer()}function U7(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function q7(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Rs(this.sliceSerialize(t)).toLowerCase(),n.label=e}function H7(t){this.exit(t)}function V7(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Rs(this.sliceSerialize(t)).toLowerCase(),n.label=e}function K7(t){this.exit(t)}function Y7(){return"["}function wA(t,e,n,r){const s=n.createTracker(r);let a=s.move("[^");const l=n.enter("footnoteReference"),u=n.enter("reference");return a+=s.move(n.safe(n.associationId(t),{after:"]",before:a})),u(),l(),a+=s.move("]"),a}function G7(){return{enter:{gfmFootnoteCallString:z7,gfmFootnoteCall:F7,gfmFootnoteDefinitionLabelString:B7,gfmFootnoteDefinition:U7},exit:{gfmFootnoteCallString:q7,gfmFootnoteCall:H7,gfmFootnoteDefinitionLabelString:V7,gfmFootnoteDefinition:K7}}}function Z7(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:wA},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,a,l){const u=a.createTracker(l);let f=u.move("[^");const h=a.enter("footnoteDefinition"),g=a.enter("label");return f+=u.move(a.safe(a.associationId(r),{before:f,after:"]"})),g(),f+=u.move("]:"),r.children&&r.children.length>0&&(u.shift(4),f+=u.move((e?`
|
|
450
|
-
`:" ")+a.indentLines(a.containerFlow(r,u.current()),e?_A:W7))),h(),f}}function W7(t,e,n){return e===0?t:_A(t,e,n)}function _A(t,e,n){return(n?"":" ")+t}const Q7=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];kA.peek=nq;function X7(){return{canContainEols:["delete"],enter:{strikethrough:eq},exit:{strikethrough:tq}}}function J7(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Q7}],handlers:{delete:kA}}}function eq(t){this.enter({type:"delete",children:[]},t)}function tq(t){this.exit(t)}function kA(t,e,n,r){const s=n.createTracker(r),a=n.enter("strikethrough");let l=s.move("~~");return l+=n.containerPhrasing(t,{...s.current(),before:l,after:"~"}),l+=s.move("~~"),a(),l}function nq(){return"~"}function rq(t){return t.length}function sq(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||rq,a=[],l=[],u=[],f=[];let h=0,g=-1;for(;++g<t.length;){const w=[],S=[];let N=-1;for(t[g].length>h&&(h=t[g].length);++N<t[g].length;){const C=iq(t[g][N]);if(n.alignDelimiters!==!1){const j=s(C);S[N]=j,(f[N]===void 0||j>f[N])&&(f[N]=j)}w.push(C)}l[g]=w,u[g]=S}let p=-1;if(typeof r=="object"&&"length"in r)for(;++p<h;)a[p]=$N(r[p]);else{const w=$N(r);for(;++p<h;)a[p]=w}p=-1;const x=[],y=[];for(;++p<h;){const w=a[p];let S="",N="";w===99?(S=":",N=":"):w===108?S=":":w===114&&(N=":");let C=n.alignDelimiters===!1?1:Math.max(1,f[p]-S.length-N.length);const j=S+"-".repeat(C)+N;n.alignDelimiters!==!1&&(C=S.length+C+N.length,C>f[p]&&(f[p]=C),y[p]=C),x[p]=j}l.splice(1,0,x),u.splice(1,0,y),g=-1;const k=[];for(;++g<l.length;){const w=l[g],S=u[g];p=-1;const N=[];for(;++p<h;){const C=w[p]||"";let j="",A="";if(n.alignDelimiters!==!1){const I=f[p]-(S[p]||0),T=a[p];T===114?j=" ".repeat(I):T===99?I%2?(j=" ".repeat(I/2+.5),A=" ".repeat(I/2-.5)):(j=" ".repeat(I/2),A=j):A=" ".repeat(I)}n.delimiterStart!==!1&&!p&&N.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||p)&&N.push(" "),n.alignDelimiters!==!1&&N.push(j),N.push(C),n.alignDelimiters!==!1&&N.push(A),n.padding!==!1&&N.push(" "),(n.delimiterEnd!==!1||p!==h-1)&&N.push("|")}k.push(n.delimiterEnd===!1?N.join("").replace(/ +$/,""):N.join(""))}return k.join(`
|
|
451
|
-
`)}function iq(t){return t==null?"":String(t)}function $N(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function aq(t,e,n,r){const s=n.enter("blockquote"),a=n.createTracker(r);a.move("> "),a.shift(2);const l=n.indentLines(n.containerFlow(t,a.current()),oq);return s(),l}function oq(t,e,n){return">"+(n?"":" ")+t}function lq(t,e){return zN(t,e.inConstruct,!0)&&!zN(t,e.notInConstruct,!1)}function zN(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function FN(t,e,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
|
|
452
|
-
`&&lq(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
453
|
-
`}function cq(t,e){const n=String(t);let r=n.indexOf(e),s=r,a=0,l=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++a>l&&(l=a):a=1,s=r+e.length,r=n.indexOf(e,s);return l}function uq(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function dq(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function fq(t,e,n,r){const s=dq(n),a=t.value||"",l=s==="`"?"GraveAccent":"Tilde";if(uq(t,n)){const p=n.enter("codeIndented"),x=n.indentLines(a,hq);return p(),x}const u=n.createTracker(r),f=s.repeat(Math.max(cq(a,s)+1,3)),h=n.enter("codeFenced");let g=u.move(f);if(t.lang){const p=n.enter(`codeFencedLang${l}`);g+=u.move(n.safe(t.lang,{before:g,after:" ",encode:["`"],...u.current()})),p()}if(t.lang&&t.meta){const p=n.enter(`codeFencedMeta${l}`);g+=u.move(" "),g+=u.move(n.safe(t.meta,{before:g,after:`
|
|
454
|
-
`,encode:["`"],...u.current()})),p()}return g+=u.move(`
|
|
455
|
-
`),a&&(g+=u.move(a+`
|
|
456
|
-
`)),g+=u.move(f),h(),g}function hq(t,e,n){return(n?"":" ")+t}function F0(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function mq(t,e,n,r){const s=F0(n),a=s==='"'?"Quote":"Apostrophe",l=n.enter("definition");let u=n.enter("label");const f=n.createTracker(r);let h=f.move("[");return h+=f.move(n.safe(n.associationId(t),{before:h,after:"]",...f.current()})),h+=f.move("]: "),u(),!t.url||/[\0- \u007F]/.test(t.url)?(u=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(t.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(u=n.enter("destinationRaw"),h+=f.move(n.safe(t.url,{before:h,after:t.title?" ":`
|
|
457
|
-
`,...f.current()}))),u(),t.title&&(u=n.enter(`title${a}`),h+=f.move(" "+s),h+=f.move(n.safe(t.title,{before:h,after:s,...f.current()})),h+=f.move(s),u()),l(),h}function pq(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Ed(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Pm(t,e,n){const r=xc(t),s=xc(e);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}SA.peek=gq;function SA(t,e,n,r){const s=pq(n),a=n.enter("emphasis"),l=n.createTracker(r),u=l.move(s);let f=l.move(n.containerPhrasing(t,{after:s,before:u,...l.current()}));const h=f.charCodeAt(0),g=Pm(r.before.charCodeAt(r.before.length-1),h,s);g.inside&&(f=Ed(h)+f.slice(1));const p=f.charCodeAt(f.length-1),x=Pm(r.after.charCodeAt(0),p,s);x.inside&&(f=f.slice(0,-1)+Ed(p));const y=l.move(s);return a(),n.attentionEncodeSurroundingInfo={after:x.outside,before:g.outside},u+f+y}function gq(t,e,n){return n.options.emphasis||"*"}function vq(t,e){let n=!1;return $0(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,bb}),!!((!t.depth||t.depth<3)&&O0(t)&&(e.options.setext||n))}function xq(t,e,n,r){const s=Math.max(Math.min(6,t.depth||1),1),a=n.createTracker(r);if(vq(t,n)){const g=n.enter("headingSetext"),p=n.enter("phrasing"),x=n.containerPhrasing(t,{...a.current(),before:`
|
|
458
|
-
`,after:`
|
|
459
|
-
`});return p(),g(),x+`
|
|
460
|
-
`+(s===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
461
|
-
`))+1))}const l="#".repeat(s),u=n.enter("headingAtx"),f=n.enter("phrasing");a.move(l+" ");let h=n.containerPhrasing(t,{before:"# ",after:`
|
|
462
|
-
`,...a.current()});return/^[\t ]/.test(h)&&(h=Ed(h.charCodeAt(0))+h.slice(1)),h=h?l+" "+h:l,n.options.closeAtx&&(h+=" "+l),f(),u(),h}jA.peek=yq;function jA(t){return t.value||""}function yq(){return"<"}NA.peek=bq;function NA(t,e,n,r){const s=F0(n),a=s==='"'?"Quote":"Apostrophe",l=n.enter("image");let u=n.enter("label");const f=n.createTracker(r);let h=f.move("![");return h+=f.move(n.safe(t.alt,{before:h,after:"]",...f.current()})),h+=f.move("]("),u(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(u=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(t.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(u=n.enter("destinationRaw"),h+=f.move(n.safe(t.url,{before:h,after:t.title?" ":")",...f.current()}))),u(),t.title&&(u=n.enter(`title${a}`),h+=f.move(" "+s),h+=f.move(n.safe(t.title,{before:h,after:s,...f.current()})),h+=f.move(s),u()),h+=f.move(")"),l(),h}function bq(){return"!"}CA.peek=wq;function CA(t,e,n,r){const s=t.referenceType,a=n.enter("imageReference");let l=n.enter("label");const u=n.createTracker(r);let f=u.move("![");const h=n.safe(t.alt,{before:f,after:"]",...u.current()});f+=u.move(h+"]["),l();const g=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(t),{before:f,after:"]",...u.current()});return l(),n.stack=g,a(),s==="full"||!h||h!==p?f+=u.move(p+"]"):s==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function wq(){return"!"}EA.peek=_q;function EA(t,e,n){let r=t.value||"",s="`",a=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){const l=n.unsafe[a],u=n.compilePattern(l);let f;if(l.atBreak)for(;f=u.exec(r);){let h=f.index;r.charCodeAt(h)===10&&r.charCodeAt(h-1)===13&&h--,r=r.slice(0,h)+" "+r.slice(f.index+1)}}return s+r+s}function _q(){return"`"}function TA(t,e){const n=O0(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}AA.peek=kq;function AA(t,e,n,r){const s=F0(n),a=s==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let u,f;if(TA(t,n)){const g=n.stack;n.stack=[],u=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(t,{before:p,after:">",...l.current()})),p+=l.move(">"),u(),n.stack=g,p}u=n.enter("link"),f=n.enter("label");let h=l.move("[");return h+=l.move(n.containerPhrasing(t,{before:h,after:"](",...l.current()})),h+=l.move("]("),f(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(f=n.enter("destinationLiteral"),h+=l.move("<"),h+=l.move(n.safe(t.url,{before:h,after:">",...l.current()})),h+=l.move(">")):(f=n.enter("destinationRaw"),h+=l.move(n.safe(t.url,{before:h,after:t.title?" ":")",...l.current()}))),f(),t.title&&(f=n.enter(`title${a}`),h+=l.move(" "+s),h+=l.move(n.safe(t.title,{before:h,after:s,...l.current()})),h+=l.move(s),f()),h+=l.move(")"),u(),h}function kq(t,e,n){return TA(t,n)?"<":"["}OA.peek=Sq;function OA(t,e,n,r){const s=t.referenceType,a=n.enter("linkReference");let l=n.enter("label");const u=n.createTracker(r);let f=u.move("[");const h=n.containerPhrasing(t,{before:f,after:"]",...u.current()});f+=u.move(h+"]["),l();const g=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(t),{before:f,after:"]",...u.current()});return l(),n.stack=g,a(),s==="full"||!h||h!==p?f+=u.move(p+"]"):s==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function Sq(){return"["}function B0(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function jq(t){const e=B0(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Nq(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function RA(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function Cq(t,e,n,r){const s=n.enter("list"),a=n.bulletCurrent;let l=t.ordered?Nq(n):B0(n);const u=t.ordered?l==="."?")":".":jq(n);let f=e&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!t.ordered){const g=t.children?t.children[0]:void 0;if((l==="*"||l==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),RA(n)===l&&g){let p=-1;for(;++p<t.children.length;){const x=t.children[p];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(l=u),n.bulletCurrent=l;const h=n.containerFlow(t,r);return n.bulletLastUsed=l,n.bulletCurrent=a,s(),h}function Eq(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function Tq(t,e,n,r){const s=Eq(n);let a=n.bulletCurrent||B0(n);e&&e.type==="list"&&e.ordered&&(a=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+a);let l=a.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(l=Math.ceil(l/4)*4);const u=n.createTracker(r);u.move(a+" ".repeat(l-a.length)),u.shift(l);const f=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,u.current()),g);return f(),h;function g(p,x,y){return x?(y?"":" ".repeat(l))+p:(y?a:a+" ".repeat(l-a.length))+p}}function Aq(t,e,n,r){const s=n.enter("paragraph"),a=n.enter("phrasing"),l=n.containerPhrasing(t,r);return a(),s(),l}const Oq=mp(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Rq(t,e,n,r){return(t.children.some(function(l){return Oq(l)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function Mq(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}MA.peek=Dq;function MA(t,e,n,r){const s=Mq(n),a=n.enter("strong"),l=n.createTracker(r),u=l.move(s+s);let f=l.move(n.containerPhrasing(t,{after:s,before:u,...l.current()}));const h=f.charCodeAt(0),g=Pm(r.before.charCodeAt(r.before.length-1),h,s);g.inside&&(f=Ed(h)+f.slice(1));const p=f.charCodeAt(f.length-1),x=Pm(r.after.charCodeAt(0),p,s);x.inside&&(f=f.slice(0,-1)+Ed(p));const y=l.move(s+s);return a(),n.attentionEncodeSurroundingInfo={after:x.outside,before:g.outside},u+f+y}function Dq(t,e,n){return n.options.strong||"*"}function Iq(t,e,n,r){return n.safe(t.value,r)}function Lq(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function Pq(t,e,n){const r=(RA(n)+(n.options.ruleSpaces?" ":"")).repeat(Lq(n));return n.options.ruleSpaces?r.slice(0,-1):r}const DA={blockquote:aq,break:FN,code:fq,definition:mq,emphasis:SA,hardBreak:FN,heading:xq,html:jA,image:NA,imageReference:CA,inlineCode:EA,link:AA,linkReference:OA,list:Cq,listItem:Tq,paragraph:Aq,root:Rq,strong:MA,text:Iq,thematicBreak:Pq};function $q(){return{enter:{table:zq,tableData:BN,tableHeader:BN,tableRow:Bq},exit:{codeText:Uq,table:Fq,tableData:qx,tableHeader:qx,tableRow:qx}}}function zq(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function Fq(t){this.exit(t),this.data.inTable=void 0}function Bq(t){this.enter({type:"tableRow",children:[]},t)}function qx(t){this.exit(t)}function BN(t){this.enter({type:"tableCell",children:[]},t)}function Uq(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,qq));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function qq(t,e){return e==="|"?e:t}function Hq(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,s=e.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
463
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:l,tableCell:f,tableRow:u}};function l(y,k,w,S){return h(g(y,w,S),y.align)}function u(y,k,w,S){const N=p(y,w,S),C=h([N]);return C.slice(0,C.indexOf(`
|
|
464
|
-
`))}function f(y,k,w,S){const N=w.enter("tableCell"),C=w.enter("phrasing"),j=w.containerPhrasing(y,{...S,before:a,after:a});return C(),N(),j}function h(y,k){return sq(y,{align:k,alignDelimiters:r,padding:n,stringLength:s})}function g(y,k,w){const S=y.children;let N=-1;const C=[],j=k.enter("table");for(;++N<S.length;)C[N]=p(S[N],k,w);return j(),C}function p(y,k,w){const S=y.children;let N=-1;const C=[],j=k.enter("tableRow");for(;++N<S.length;)C[N]=f(S[N],y,k,w);return j(),C}function x(y,k,w){let S=DA.inlineCode(y,k,w);return w.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function Vq(){return{exit:{taskListCheckValueChecked:UN,taskListCheckValueUnchecked:UN,paragraph:Yq}}}function Kq(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Gq}}}function UN(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function Yq(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=e.children;let a=-1,l;for(;++a<s.length;){const u=s[a];if(u.type==="paragraph"){l=u;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function Gq(t,e,n,r){const s=t.children[0],a=typeof t.checked=="boolean"&&s&&s.type==="paragraph",l="["+(t.checked?"x":" ")+"] ",u=n.createTracker(r);a&&u.move(l);let f=DA.listItem(t,e,n,{...r,...u.current()});return a&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),f;function h(g){return g+l}}function Zq(){return[C7(),G7(),X7(),$q(),Vq()]}function Wq(t){return{extensions:[E7(),Z7(t),J7(),Hq(t),Kq()]}}const Qq={tokenize:rH,partial:!0},IA={tokenize:sH,partial:!0},LA={tokenize:iH,partial:!0},PA={tokenize:aH,partial:!0},Xq={tokenize:oH,partial:!0},$A={name:"wwwAutolink",tokenize:tH,previous:FA},zA={name:"protocolAutolink",tokenize:nH,previous:BA},Gi={name:"emailAutolink",tokenize:eH,previous:UA},li={};function Jq(){return{text:li}}let yo=48;for(;yo<123;)li[yo]=Gi,yo++,yo===58?yo=65:yo===91&&(yo=97);li[43]=Gi;li[45]=Gi;li[46]=Gi;li[95]=Gi;li[72]=[Gi,zA];li[104]=[Gi,zA];li[87]=[Gi,$A];li[119]=[Gi,$A];function eH(t,e,n){const r=this;let s,a;return l;function l(p){return!Sb(p)||!UA.call(r,r.previous)||U0(r.events)?n(p):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(p))}function u(p){return Sb(p)?(t.consume(p),u):p===64?(t.consume(p),f):n(p)}function f(p){return p===46?t.check(Xq,g,h)(p):p===45||p===95||tr(p)?(a=!0,t.consume(p),f):g(p)}function h(p){return t.consume(p),s=!0,f}function g(p){return a&&s&&pr(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(p)):n(p)}}function tH(t,e,n){const r=this;return s;function s(l){return l!==87&&l!==119||!FA.call(r,r.previous)||U0(r.events)?n(l):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Qq,t.attempt(IA,t.attempt(LA,a),n),n)(l))}function a(l){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(l)}}function nH(t,e,n){const r=this;let s="",a=!1;return l;function l(p){return(p===72||p===104)&&BA.call(r,r.previous)&&!U0(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),s+=String.fromCodePoint(p),t.consume(p),u):n(p)}function u(p){if(pr(p)&&s.length<5)return s+=String.fromCodePoint(p),t.consume(p),u;if(p===58){const x=s.toLowerCase();if(x==="http"||x==="https")return t.consume(p),f}return n(p)}function f(p){return p===47?(t.consume(p),a?h:(a=!0,f)):n(p)}function h(p){return p===null||Dm(p)||Gt(p)||Fo(p)||dp(p)?n(p):t.attempt(IA,t.attempt(LA,g),n)(p)}function g(p){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(p)}}function rH(t,e,n){let r=0;return s;function s(l){return(l===87||l===119)&&r<3?(r++,t.consume(l),s):l===46&&r===3?(t.consume(l),a):n(l)}function a(l){return l===null?n(l):e(l)}}function sH(t,e,n){let r,s,a;return l;function l(h){return h===46||h===95?t.check(PA,f,u)(h):h===null||Gt(h)||Fo(h)||h!==45&&dp(h)?f(h):(a=!0,t.consume(h),l)}function u(h){return h===95?r=!0:(s=r,r=void 0),t.consume(h),l}function f(h){return s||r||!a?n(h):e(h)}}function iH(t,e){let n=0,r=0;return s;function s(l){return l===40?(n++,t.consume(l),s):l===41&&r<n?a(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?t.check(PA,e,a)(l):l===null||Gt(l)||Fo(l)?e(l):(t.consume(l),s)}function a(l){return l===41&&r++,t.consume(l),s}}function aH(t,e,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(t.consume(u),r):u===38?(t.consume(u),a):u===93?(t.consume(u),s):u===60||u===null||Gt(u)||Fo(u)?e(u):n(u)}function s(u){return u===null||u===40||u===91||Gt(u)||Fo(u)?e(u):r(u)}function a(u){return pr(u)?l(u):n(u)}function l(u){return u===59?(t.consume(u),r):pr(u)?(t.consume(u),l):n(u)}}function oH(t,e,n){return r;function r(a){return t.consume(a),s}function s(a){return tr(a)?n(a):e(a)}}function FA(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Gt(t)}function BA(t){return!pr(t)}function UA(t){return!(t===47||Sb(t))}function Sb(t){return t===43||t===45||t===46||t===95||tr(t)}function U0(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const lH={tokenize:gH,partial:!0};function cH(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:hH,continuation:{tokenize:mH},exit:pH}},text:{91:{name:"gfmFootnoteCall",tokenize:fH},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:uH,resolveTo:dH}}}}function uH(t,e,n){const r=this;let s=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;s--;){const f=r.events[s][1];if(f.type==="labelImage"){l=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return u;function u(f){if(!l||!l._balanced)return n(f);const h=Rs(r.sliceSerialize({start:l.end,end:r.now()}));return h.codePointAt(0)!==94||!a.includes(h.slice(1))?n(f):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),e(f))}}function dH(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},u=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",a,e],["enter",l,e],["exit",l,e],["exit",a,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...u),t}function fH(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,l;return u;function u(p){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),f}function f(p){return p!==94?n(p):(t.enter("gfmFootnoteCallMarker"),t.consume(p),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(p){if(a>999||p===93&&!l||p===null||p===91||Gt(p))return n(p);if(p===93){t.exit("chunkString");const x=t.exit("gfmFootnoteCallString");return s.includes(Rs(r.sliceSerialize(x)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(p)}return Gt(p)||(l=!0),a++,t.consume(p),p===92?g:h}function g(p){return p===91||p===92||p===93?(t.consume(p),a++,h):h(p)}}function hH(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,l=0,u;return f;function f(k){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",g):n(k)}function g(k){if(l>999||k===93&&!u||k===null||k===91||Gt(k))return n(k);if(k===93){t.exit("chunkString");const w=t.exit("gfmFootnoteDefinitionLabelString");return a=Rs(r.sliceSerialize(w)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),x}return Gt(k)||(u=!0),l++,t.consume(k),k===92?p:g}function p(k){return k===91||k===92||k===93?(t.consume(k),l++,g):g(k)}function x(k){return k===58?(t.enter("definitionMarker"),t.consume(k),t.exit("definitionMarker"),s.includes(a)||s.push(a),Ot(t,y,"gfmFootnoteDefinitionWhitespace")):n(k)}function y(k){return e(k)}}function mH(t,e,n){return t.check(qd,e,t.attempt(lH,e,n))}function pH(t){t.exit("gfmFootnoteDefinition")}function gH(t,e,n){const r=this;return Ot(t,s,"gfmFootnoteDefinitionIndent",5);function s(a){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?e(a):n(a)}}function vH(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(l,u){let f=-1;for(;++f<l.length;)if(l[f][0]==="enter"&&l[f][1].type==="strikethroughSequenceTemporary"&&l[f][1]._close){let h=f;for(;h--;)if(l[h][0]==="exit"&&l[h][1].type==="strikethroughSequenceTemporary"&&l[h][1]._open&&l[f][1].end.offset-l[f][1].start.offset===l[h][1].end.offset-l[h][1].start.offset){l[f][1].type="strikethroughSequence",l[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},l[h][1].start),end:Object.assign({},l[f][1].end)},p={type:"strikethroughText",start:Object.assign({},l[h][1].end),end:Object.assign({},l[f][1].start)},x=[["enter",g,u],["enter",l[h][1],u],["exit",l[h][1],u],["enter",p,u]],y=u.parser.constructs.insideSpan.null;y&&Vr(x,x.length,0,fp(y,l.slice(h+1,f),u)),Vr(x,x.length,0,[["exit",p,u],["enter",l[f][1],u],["exit",l[f][1],u],["exit",g,u]]),Vr(l,h-1,f-h+3,x),f=h+x.length-2;break}}for(f=-1;++f<l.length;)l[f][1].type==="strikethroughSequenceTemporary"&&(l[f][1].type="data");return l}function a(l,u,f){const h=this.previous,g=this.events;let p=0;return x;function x(k){return h===126&&g[g.length-1][1].type!=="characterEscape"?f(k):(l.enter("strikethroughSequenceTemporary"),y(k))}function y(k){const w=xc(h);if(k===126)return p>1?f(k):(l.consume(k),p++,y);if(p<2&&!n)return f(k);const S=l.exit("strikethroughSequenceTemporary"),N=xc(k);return S._open=!N||N===2&&!!w,S._close=!w||w===2&&!!N,u(k)}}}class xH{constructor(){this.map=[]}add(e,n,r){yH(this,e,n,r)}consume(e){if(this.map.sort(function(a,l){return a[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const a of s)e.push(a);s=r.pop()}this.map.length=0}}function yH(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<t.map.length;){if(t.map[s][0]===e){t.map[s][1]+=n,t.map[s][2].push(...r);return}s+=1}t.map.push([e,n,r])}}function bH(t,e){let n=!1;const r=[];for(;e<t.length;){const s=t[e];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const a=r.length-1;r[a]=r[a]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function wH(){return{flow:{null:{name:"table",tokenize:_H,resolveAll:kH}}}}function _H(t,e,n){const r=this;let s=0,a=0,l;return u;function u(D){let B=r.events.length-1;for(;B>-1;){const G=r.events[B][1].type;if(G==="lineEnding"||G==="linePrefix")B--;else break}const q=B>-1?r.events[B][1].type:null,K=q==="tableHead"||q==="tableRow"?T:f;return K===T&&r.parser.lazy[r.now().line]?n(D):K(D)}function f(D){return t.enter("tableHead"),t.enter("tableRow"),h(D)}function h(D){return D===124||(l=!0,a+=1),g(D)}function g(D){return D===null?n(D):Je(D)?a>1?(a=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),y):n(D):jt(D)?Ot(t,g,"whitespace")(D):(a+=1,l&&(l=!1,s+=1),D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),l=!0,g):(t.enter("data"),p(D)))}function p(D){return D===null||D===124||Gt(D)?(t.exit("data"),g(D)):(t.consume(D),D===92?x:p)}function x(D){return D===92||D===124?(t.consume(D),p):p(D)}function y(D){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(D):(t.enter("tableDelimiterRow"),l=!1,jt(D)?Ot(t,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):k(D))}function k(D){return D===45||D===58?S(D):D===124?(l=!0,t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),w):I(D)}function w(D){return jt(D)?Ot(t,S,"whitespace")(D):S(D)}function S(D){return D===58?(a+=1,l=!0,t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),N):D===45?(a+=1,N(D)):D===null||Je(D)?A(D):I(D)}function N(D){return D===45?(t.enter("tableDelimiterFiller"),C(D)):I(D)}function C(D){return D===45?(t.consume(D),C):D===58?(l=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),j):(t.exit("tableDelimiterFiller"),j(D))}function j(D){return jt(D)?Ot(t,A,"whitespace")(D):A(D)}function A(D){return D===124?k(D):D===null||Je(D)?!l||s!==a?I(D):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(D)):I(D)}function I(D){return n(D)}function T(D){return t.enter("tableRow"),E(D)}function E(D){return D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),E):D===null||Je(D)?(t.exit("tableRow"),e(D)):jt(D)?Ot(t,E,"whitespace")(D):(t.enter("data"),R(D))}function R(D){return D===null||D===124||Gt(D)?(t.exit("data"),E(D)):(t.consume(D),D===92?z:R)}function z(D){return D===92||D===124?(t.consume(D),R):R(D)}}function kH(t,e){let n=-1,r=!0,s=0,a=[0,0,0,0],l=[0,0,0,0],u=!1,f=0,h,g,p;const x=new xH;for(;++n<t.length;){const y=t[n],k=y[1];y[0]==="enter"?k.type==="tableHead"?(u=!1,f!==0&&(qN(x,e,f,h,g),g=void 0,f=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},x.add(n,0,[["enter",h,e]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(r=!0,p=void 0,a=[0,0,0,0],l=[0,n+1,0,0],u&&(u=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},x.add(n,0,[["enter",g,e]])),s=k.type==="tableDelimiterRow"?2:g?3:1):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(a[1]!==0&&(l[0]=l[1],p=Ah(x,e,a,s,void 0,p),a=[0,0,0,0]),l[2]=n)):k.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(l[0]=l[1],p=Ah(x,e,a,s,void 0,p)),a=l,l=[a[1],n,0,0])):k.type==="tableHead"?(u=!0,f=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(f=n,a[1]!==0?(l[0]=l[1],p=Ah(x,e,a,s,n,p)):l[1]!==0&&(p=Ah(x,e,l,s,n,p)),s=0):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(l[3]=n)}for(f!==0&&qN(x,e,f,h,g),x.consume(e.events),n=-1;++n<e.events.length;){const y=e.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=bH(e.events,n))}return t}function Ah(t,e,n,r,s,a){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(a.end=Object.assign({},Bl(e.events,n[0])),t.add(n[0],0,[["exit",a,e]]));const f=Bl(e.events,n[1]);if(a={type:l,start:Object.assign({},f),end:Object.assign({},f)},t.add(n[1],0,[["enter",a,e]]),n[2]!==0){const h=Bl(e.events,n[2]),g=Bl(e.events,n[3]),p={type:u,start:Object.assign({},h),end:Object.assign({},g)};if(t.add(n[2],0,[["enter",p,e]]),r!==2){const x=e.events[n[2]],y=e.events[n[3]];if(x[1].end=Object.assign({},y[1].end),x[1].type="chunkText",x[1].contentType="text",n[3]>n[2]+1){const k=n[2]+1,w=n[3]-n[2]-1;t.add(k,w,[])}}t.add(n[3]+1,0,[["exit",p,e]])}return s!==void 0&&(a.end=Object.assign({},Bl(e.events,s)),t.add(s,0,[["exit",a,e]]),a=void 0),a}function qN(t,e,n,r,s){const a=[],l=Bl(e.events,n);s&&(s.end=Object.assign({},l),a.push(["exit",s,e])),r.end=Object.assign({},l),a.push(["exit",r,e]),t.add(n+1,0,a)}function Bl(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const SH={name:"tasklistCheck",tokenize:NH};function jH(){return{text:{91:SH}}}function NH(t,e,n){const r=this;return s;function s(f){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(f):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(f),t.exit("taskListCheckMarker"),a)}function a(f){return Gt(f)?(t.enter("taskListCheckValueUnchecked"),t.consume(f),t.exit("taskListCheckValueUnchecked"),l):f===88||f===120?(t.enter("taskListCheckValueChecked"),t.consume(f),t.exit("taskListCheckValueChecked"),l):n(f)}function l(f){return f===93?(t.enter("taskListCheckMarker"),t.consume(f),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),u):n(f)}function u(f){return Je(f)?e(f):jt(f)?t.check({tokenize:CH},e,n)(f):n(f)}}function CH(t,e,n){return Ot(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function EH(t){return XT([Jq(),cH(),vH(t),wH(),jH()])}const TH={};function AH(t){const e=this,n=t||TH,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(EH(n)),a.push(Zq()),l.push(Wq(n))}function OH(t){yA(t,[/\r?\n|\r/g,RH])}function RH(){return{type:"break"}}function MH(){return function(t){OH(t)}}function HN(t,e){const n=e?`${e}/`:"[a-z0-9.+-]+/";return new RegExp(`^data:${n}[a-z0-9.+-]+;base64,[A-Za-z0-9+/]+={0,2}$`,"i").test(t)}function q0(t){try{const e=new URL(t),n=e.hostname.toLowerCase();if(e.protocol!=="https:"&&e.protocol!=="http:"||n==="localhost"||n==="::1")return!1;const r=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,s=n.match(r);if(s){const[,a,l,u,f]=s.map(Number);if(a>255||l>255||u>255||f>255||a===127||a===10||a===172&&l>=16&&l<=31||a===192&&l===168||a===169&&l===254||a===0&&l===0&&u===0&&f===0)return!1}return!(n.includes(":")&&(n==="::1"||n==="0:0:0:0:0:0:0:1"||n.startsWith("fc")||n.startsWith("fd")||n.startsWith("fe8")||n.startsWith("fe9")||n.startsWith("fea")||n.startsWith("feb")))}catch{return!1}}function Hx(t,e){return t.startsWith("blob:")||q0(t)?!0:t.startsWith("data:")?e?HN(t,e):HN(t):!1}function DH(t){return!!(t.match(/\.(mp4|webm|mov|m4v|avi|mkv)(\?.*)?$/i)||t.includes("/video/")||t.includes("video_"))}function IH(t){return!!(t.match(/\.(mp3|wav|ogg|m4a|aac|flac|wma)(\?.*)?$/i)||t.includes("/audio/")||t.includes("audio_"))}function LH(t){const e=/(https?:\/\/[^\s<]+)/g;return t.split(e).map((r,s)=>r.match(e)?q0(r)?c.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 underline-offset-2 hover:underline hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 font-medium break-all overflow-wrap-anywhere max-w-full inline",title:r,style:{wordBreak:"break-word",overflowWrap:"anywhere"},children:r},s):c.jsx("span",{className:"text-muted-foreground underline decoration-dotted",title:"Unsafe URL",children:r},s):r)}const PH=({className:t,children:e,...n})=>{const[r,s]=_.useState(!1),a=String(e??"").replace(/\n$/,"");return t?c.jsxs("div",{className:"relative group my-4 min-w-0 max-w-full",children:[c.jsx(up,{tooltip:r?"Copied!":"Copy code",onClick:()=>{navigator.clipboard.writeText(a).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)}).catch(()=>{})},className:"absolute right-2 top-2 z-10 opacity-70 hover:opacity-100 transition-opacity bg-background/80 hover:bg-background",children:r?c.jsx(Es,{size:14}):c.jsx(Pd,{size:14})}),c.jsx("pre",{className:"overflow-auto bg-muted p-3 rounded-lg text-sm max-w-full",children:c.jsx("code",{className:t,children:a})})]}):c.jsx("code",{className:"text-xs px-1.5 py-0.5 bg-muted rounded font-mono break-all overflow-wrap-anywhere",...n,children:e})},$H=({children:t})=>{const e=nt.useRef(new Set);return nt.useEffect(()=>{const n=e.current;return()=>{n.forEach(r=>{try{URL.revokeObjectURL(r)}catch{}})}},[]),c.jsx("div",{className:"prose max-w-none dark:prose-invert min-w-0 overflow-hidden break-words overflow-wrap-anywhere [&>p]:my-5 [&>p]:leading-7 [&>p]:first:mt-0 [&>p]:last:mb-0 [&>p]:break-words [&>p]:overflow-wrap-anywhere [&>h1]:mb-8 [&>h1]:text-4xl [&>h1]:font-extrabold [&>h1]:tracking-tight [&>h1]:last:mb-0 [&>h1]:break-words [&>h2]:mb-4 [&>h2]:mt-8 [&>h2]:text-3xl [&>h2]:font-semibold [&>h2]:tracking-tight [&>h2]:first:mt-0 [&>h2]:last:mb-0 [&>h2]:break-words [&>h3]:mb-4 [&>h3]:mt-6 [&>h3]:text-2xl [&>h3]:font-semibold [&>h3]:tracking-tight [&>h3]:first:mt-0 [&>h3]:last:mb-0 [&>h3]:break-words [&>h4]:mb-4 [&>h4]:mt-6 [&>h4]:text-xl [&>h4]:font-semibold [&>h4]:tracking-tight [&>h4]:first:mt-0 [&>h4]:last:mb-0 [&>h4]:break-words [&>ul]:my-5 [&>ul]:ml-6 [&>ul]:list-disc [&>ul>li]:mt-2 [&>ol]:my-5 [&>ol]:ml-6 [&>ol]:list-decimal [&>ol>li]:mt-2 [&_ul]:my-5 [&_ul]:ml-6 [&_ul]:list-disc [&_ul>li]:mt-2 [&_ol]:my-5 [&_ol]:ml-6 [&_ol]:list-decimal [&_ol>li]:mt-2 [&>blockquote]:border-l-2 [&>blockquote]:pl-6 [&>blockquote]:italic [&>blockquote]:break-words [&>hr]:my-5 [&>hr]:border-b",children:c.jsx(x7,{remarkPlugins:[AH,MH],skipHtml:!0,components:{a:({href:n,children:r,...s})=>{const a=n??"";return!/^https?:\/\//i.test(a)||!q0(a)?c.jsx("span",{className:"text-muted-foreground underline decoration-dotted",...s,children:r}):c.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 underline-offset-2 hover:underline hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 font-medium break-all overflow-wrap-anywhere max-w-full inline",title:a,style:{wordBreak:"break-word",overflowWrap:"anywhere"},...s,children:r})},img:({src:n,alt:r,...s})=>{if(!n)return c.jsx("span",{className:"text-xs text-muted-foreground",children:"No media source provided"});let a=null;if(typeof n=="string")a=n;else if(n instanceof Blob||n instanceof File)try{const l=URL.createObjectURL(n);a=l,e.current.add(l)}catch{a=null}else if(typeof n=="object"&&n!==null&&n instanceof MediaSource)try{const l=URL.createObjectURL(n);a=l,e.current.add(l)}catch{a=null}else a=null;return a?DH(a)&&Hx(a,"video")?c.jsxs("div",{className:"my-4 max-w-full overflow-hidden",children:[c.jsx("video",{controls:!0,src:a,className:"w-full max-h-[360px] rounded-lg bg-black",preload:"metadata",children:"Your browser does not support the video tag."}),r&&c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:r})]}):IH(a)&&Hx(a,"audio")?c.jsxs("div",{className:"my-4 max-w-full overflow-hidden",children:[c.jsx("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-border bg-muted/30",children:c.jsx("audio",{controls:!0,src:a,className:"flex-1 min-w-0 h-10",children:"Your browser does not support the audio tag."})}),r&&c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:r})]}):Hx(a,"image")?c.jsx("img",{src:a,alt:r||"Image",className:"max-w-full max-h-[500px] object-contain rounded-lg border border-border my-4",loading:"lazy",...s}):c.jsx("span",{className:"text-xs text-muted-foreground",children:"Invalid or unsafe media source"}):c.jsx("span",{className:"text-xs text-muted-foreground",children:"Invalid or unsafe media source"})},p:({children:n,...r})=>typeof n=="string"?c.jsx("p",{...r,children:LH(n)}):c.jsx("p",{...r,children:n}),table:({className:n,children:r,...s})=>c.jsx("div",{className:"my-4 overflow-x-auto -mx-1 px-1",children:c.jsx("table",{className:["w-full border-separate border-spacing-0",n].filter(Boolean).join(" "),...s,children:r})}),thead:({className:n,...r})=>c.jsx("thead",{className:n,...r}),tr:({className:n,...r})=>c.jsx("tr",{className:["m-0 border-b first:border-t","[&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",n].filter(Boolean).join(" "),...r}),th:({className:n,...r})=>c.jsx("th",{className:["bg-muted text-left font-bold align-top","px-4 py-2 first:rounded-tl-lg last:rounded-tr-lg","[&[align=center]]:text-center [&[align=right]]:text-right",n].filter(Boolean).join(" "),...r}),td:({className:n,...r})=>c.jsx("td",{className:["border-b border-l last:border-r text-left align-top","px-4 py-2 whitespace-normal break-words","[&[align=center]]:text-center [&[align=right]]:text-right",n].filter(Boolean).join(" "),...r}),code:PH},children:t})})},qA=_.memo($H);function zH(t,e){return`data:${e};base64,${t}`}function FH(t,e){const n=Array.isArray(e==null?void 0:e.contents)?e.contents:[],r=(e==null?void 0:e._meta)??{},s=(typeof r.originalName=="string"&&r.originalName.trim().length>0?r.originalName:void 0)||t,a=[];for(const l of n){if(!l||typeof l!="object")continue;if(typeof l.text=="string"){a.push({kind:"text",text:l.text,mimeType:typeof l.mimeType=="string"?l.mimeType:void 0});continue}const u=typeof l.blob=="string"?l.blob:void 0,f=typeof l.data=="string"?l.data:void 0,h=typeof l.mimeType=="string"?l.mimeType:void 0,g=typeof l.filename=="string"?l.filename:void 0;if((u||f)&&h){const x=zH(u??f,h);h.startsWith("image/")?a.push({kind:"image",src:x,mimeType:h,alt:g||s}):h.startsWith("audio/")?a.push({kind:"audio",src:x,mimeType:h,filename:g||s}):h.startsWith("video/")?a.push({kind:"video",src:x,mimeType:h,filename:g||s}):a.push({kind:"file",src:x,mimeType:h,filename:g||s});continue}h&&h.startsWith("text/")&&typeof l.value=="string"&&a.push({kind:"text",text:l.value,mimeType:h})}return{uri:t,name:s,meta:r,items:a}}async function BH(t){const n=await(await mt.api.resources[":resourceId"].content.$get({param:{resourceId:encodeURIComponent(t)}})).json(),r=n==null?void 0:n.content;if(!r)throw new Error("No content returned for resource");return FH(t,r)}function H0(t){const e=t.join("|"),n=_.useMemo(()=>{const a=new Set,l=[];for(const u of t){if(!u||typeof u!="string")continue;const f=u.trim();!f||a.has(f)||(a.add(f),l.push(f))}return l},[e]),r=E3({queries:n.map(a=>({queryKey:["resourceContent",a],queryFn:()=>BH(a),enabled:!!a,retry:!1}))});return _.useMemo(()=>{const a={};return r.forEach((l,u)=>{const f=n[u];f&&(l.isLoading?a[f]={status:"loading"}:l.error?a[f]={status:"error",error:l.error instanceof Error?l.error.message:String(l.error)}:l.data&&(a[f]={status:"loaded",data:l.data}))}),a},[r,n])}async function UH(){const e=await(await mt.api.resources.$get()).json();if(!e.ok||!Array.isArray(e.resources))throw new Error("Invalid response shape");return e.resources}function HA(){const{data:t=[],isLoading:e,error:n,refetch:r}=Tr({queryKey:Xe.resources.all,queryFn:UH,staleTime:6e4});return{resources:t,loading:e,error:(n==null?void 0:n.message)??null,refresh:async()=>{await r()}}}function V0(t){const e=_.useRef({value:t,previous:t});return _.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var gp="Checkbox",[qH,QQ]=Ka(gp),[HH,K0]=qH(gp);function VH(t){const{__scopeCheckbox:e,checked:n,children:r,defaultChecked:s,disabled:a,form:l,name:u,onCheckedChange:f,required:h,value:g="on",internal_do_not_use_render:p}=t,[x,y]=zo({prop:n,defaultProp:s??!1,onChange:f,caller:gp}),[k,w]=_.useState(null),[S,N]=_.useState(null),C=_.useRef(!1),j=k?!!l||!!k.closest("form"):!0,A={checked:x,disabled:a,setChecked:y,control:k,setControl:w,name:u,form:l,value:g,hasConsumerStoppedPropagationRef:C,required:h,defaultChecked:$a(s)?!1:s,isFormControl:j,bubbleInput:S,setBubbleInput:N};return c.jsx(HH,{scope:e,...A,children:KH(p)?p(A):r})}var VA="CheckboxTrigger",KA=_.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:n,...r},s)=>{const{control:a,value:l,disabled:u,checked:f,required:h,setControl:g,setChecked:p,hasConsumerStoppedPropagationRef:x,isFormControl:y,bubbleInput:k}=K0(VA,t),w=Bt(s,g),S=_.useRef(f);return _.useEffect(()=>{const N=a==null?void 0:a.form;if(N){const C=()=>p(S.current);return N.addEventListener("reset",C),()=>N.removeEventListener("reset",C)}},[a,p]),c.jsx(Ct.button,{type:"button",role:"checkbox","aria-checked":$a(f)?"mixed":f,"aria-required":h,"data-state":XA(f),"data-disabled":u?"":void 0,disabled:u,value:l,...r,ref:w,onKeyDown:bt(e,N=>{N.key==="Enter"&&N.preventDefault()}),onClick:bt(n,N=>{p(C=>$a(C)?!0:!C),k&&y&&(x.current=N.isPropagationStopped(),x.current||N.stopPropagation())})})});KA.displayName=VA;var YA=_.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:a,required:l,disabled:u,value:f,onCheckedChange:h,form:g,...p}=t;return c.jsx(VH,{__scopeCheckbox:n,checked:s,defaultChecked:a,disabled:u,required:l,onCheckedChange:h,name:r,form:g,value:f,internal_do_not_use_render:({isFormControl:x})=>c.jsxs(c.Fragment,{children:[c.jsx(KA,{...p,ref:e,__scopeCheckbox:n}),x&&c.jsx(QA,{__scopeCheckbox:n})]})})});YA.displayName=gp;var GA="CheckboxIndicator",ZA=_.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...s}=t,a=K0(GA,n);return c.jsx(Yi,{present:r||$a(a.checked)||a.checked===!0,children:c.jsx(Ct.span,{"data-state":XA(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:e,style:{pointerEvents:"none",...t.style}})})});ZA.displayName=GA;var WA="CheckboxBubbleInput",QA=_.forwardRef(({__scopeCheckbox:t,...e},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:a,defaultChecked:l,required:u,disabled:f,name:h,value:g,form:p,bubbleInput:x,setBubbleInput:y}=K0(WA,t),k=Bt(n,y),w=V0(a),S=g0(r);_.useEffect(()=>{const C=x;if(!C)return;const j=window.HTMLInputElement.prototype,I=Object.getOwnPropertyDescriptor(j,"checked").set,T=!s.current;if(w!==a&&I){const E=new Event("click",{bubbles:T});C.indeterminate=$a(a),I.call(C,$a(a)?!1:a),C.dispatchEvent(E)}},[x,w,a,s]);const N=_.useRef($a(a)?!1:a);return c.jsx(Ct.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??N.current,required:u,disabled:f,name:h,value:g,form:p,...e,tabIndex:-1,ref:k,style:{...e.style,...S,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});QA.displayName=WA;function KH(t){return typeof t=="function"}function $a(t){return t==="indeterminate"}function XA(t){return $a(t)?"indeterminate":t?"checked":"unchecked"}function $m({className:t,...e}){return c.jsx(YA,{"data-slot":"checkbox",className:ae("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:c.jsx(ZA,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:c.jsx(Es,{className:"size-3.5"})})})}function YH({approval:t,onApprove:e,onDeny:n}){const[r,s]=_.useState({}),[a,l]=_.useState({}),[u,f]=_.useState(!1),h=(x,y)=>{s(k=>({...k,[x]:y})),a[x]&&l(k=>{const w={...k};return delete w[x],w})},g=(x,y,k)=>{var C;const w=y.type||"string",S=r[x],N=!!a[x];return w==="boolean"?c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx($m,{id:x,checked:S===!0,onCheckedChange:j=>h(x,j===!0)}),c.jsxs("label",{htmlFor:x,className:"text-sm font-medium",children:[x,k&&c.jsx("span",{className:"text-red-500 ml-1",children:"*"})]})]}),y.description&&c.jsx("p",{className:"text-xs text-muted-foreground ml-6",children:y.description})]},x):w==="number"||w==="integer"?c.jsxs("div",{className:"space-y-1",children:[c.jsxs("label",{htmlFor:x,className:"text-sm font-medium block",children:[x,k&&c.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),y.description&&c.jsx("p",{className:"text-xs text-muted-foreground",children:y.description}),c.jsx("input",{id:x,type:"number",step:w==="integer"?"1":"any",value:typeof S=="number"?S:"",onChange:j=>{const A=j.target.value,I=A===""?void 0:Number(A);h(x,I)},className:`w-full px-3 py-2 border rounded-md text-sm bg-background ${N?"border-red-500":"border-border"}`,placeholder:k?"Required":"Optional"}),N&&c.jsx("p",{className:"text-xs text-red-500",children:a[x]})]},x):y.enum&&Array.isArray(y.enum)?c.jsxs("div",{className:"space-y-1",children:[c.jsxs("label",{htmlFor:x,className:"text-sm font-medium block",children:[x,k&&c.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),y.description&&c.jsx("p",{className:"text-xs text-muted-foreground",children:y.description}),c.jsxs("select",{id:x,value:S!=null?String(S):"",onChange:j=>{var T;const A=j.target.value;if(A===""){h(x,void 0);return}const I=(T=y.enum)==null?void 0:T.find(E=>String(E)===A);h(x,I??A)},className:`w-full px-3 py-2 border rounded-md text-sm bg-background ${N?"border-red-500":"border-border"}`,children:[c.jsx("option",{value:"",children:"Select an option..."}),(C=y.enum)==null?void 0:C.map(j=>c.jsx("option",{value:String(j),children:String(j)},String(j)))]}),N&&c.jsx("p",{className:"text-xs text-red-500",children:a[x]})]},x):c.jsxs("div",{className:"space-y-1",children:[c.jsxs("label",{htmlFor:x,className:"text-sm font-medium block",children:[x,k&&c.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),y.description&&c.jsx("p",{className:"text-xs text-muted-foreground",children:y.description}),c.jsx("input",{id:x,type:"text",value:S!=null&&typeof S!="object"?String(S):"",onChange:j=>h(x,j.target.value),className:`w-full px-3 py-2 border rounded-md text-sm bg-background ${N?"border-red-500":"border-border"}`,placeholder:k?"Required":"Optional"}),N&&c.jsx("p",{className:"text-xs text-red-500",children:a[x]})]},x)},p=()=>{if(t.type===ja.ELICITATION){const{schema:x}=t.metadata,y=x.required||[],k={};for(const w of y){const S=r[w],N=typeof S=="string"&&S.trim()==="";(S==null||N)&&(k[w]="This field is required")}if(Object.keys(k).length>0){l(k);return}e(r)}else e(void 0,u)};return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[c.jsx(Ln,{className:"h-4 w-4"}),c.jsx("span",{className:"font-medium text-sm",children:t.type===ja.ELICITATION?"Information Request":"Approval Required"})]}),t.type===ja.COMMAND_CONFIRMATION?c.jsxs("div",{className:"space-y-3 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx(Ii,{className:"h-4 w-4 flex-shrink-0"}),c.jsxs("span",{className:"font-medium text-sm break-words min-w-0",children:["Tool: ",t.metadata.toolName]})]}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("span",{className:"font-medium text-sm block mb-2",children:"Command:"}),c.jsx("pre",{className:"bg-muted/50 p-3 rounded-md text-xs overflow-auto max-h-40 border border-border break-words whitespace-pre-wrap max-w-full text-red-600 dark:text-red-400",children:t.metadata.command})]}),t.metadata.originalCommand&&t.metadata.originalCommand!==t.metadata.command&&c.jsx("div",{className:"min-w-0",children:c.jsxs("span",{className:"text-xs text-muted-foreground",children:["Original: ",t.metadata.originalCommand]})}),c.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md border border-yellow-200 dark:border-yellow-800",children:c.jsx("p",{className:"text-xs text-yellow-800 dark:text-yellow-200",children:"This command requires approval because it may modify your system."})})]}):t.type===ja.ELICITATION?c.jsxs("div",{className:"space-y-4 min-w-0",children:[c.jsxs("div",{className:"bg-muted/50 p-3 rounded-md border border-border min-w-0",children:[c.jsx("p",{className:"text-sm font-medium mb-1 break-words",children:t.metadata.prompt}),c.jsxs("p",{className:"text-xs text-muted-foreground break-words",children:["From: ",t.metadata.serverName||"Dexto Agent"]})]}),c.jsx("div",{children:(()=>{const{schema:x}=t.metadata;if(!(x!=null&&x.properties)||typeof x.properties!="object")return c.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:"Invalid form schema"});const y=x.required||[],k=x.properties;return c.jsx("div",{className:"space-y-4",children:Object.entries(k).map(([w,S])=>{const N=y.includes(w);return g(w,S,N)})})})()})]}):t.type===ja.TOOL_CONFIRMATION?c.jsxs("div",{className:"space-y-3 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx(Ii,{className:"h-4 w-4 flex-shrink-0"}),c.jsxs("span",{className:"font-medium text-sm break-words min-w-0",children:["Tool: ",t.metadata.toolName]})]}),t.metadata.description&&c.jsx("p",{className:"text-sm break-words",children:t.metadata.description}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("span",{className:"font-medium text-sm block mb-2",children:"Arguments:"}),c.jsx("pre",{className:"bg-muted/50 p-3 rounded-md text-xs overflow-auto max-h-40 border border-border break-words whitespace-pre-wrap max-w-full",children:JSON.stringify(t.metadata.args,null,2)})]}),c.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[c.jsx($m,{id:"remember",checked:u,onCheckedChange:x=>f(x===!0)}),c.jsx("label",{htmlFor:"remember",className:"text-sm",children:"Remember this choice for this session"})]})]}):null,c.jsxs("div",{className:"flex gap-2 justify-end pt-3 border-t border-border",children:[c.jsx(ye,{variant:"outline",onClick:n,size:"sm",children:t.type===ja.ELICITATION?"Decline":"Deny"}),c.jsx(ye,{onClick:p,size:"sm",children:t.type===ja.ELICITATION?"Submit":"Approve"})]})]})}const GH=t=>new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});function Vl(t,e){const n=e?`${e}/`:"[a-z0-9.+-]+/";return new RegExp(`^data:${n}[a-z0-9.+-]+;base64,[A-Za-z0-9+/]+={0,2}$`,"i").test(t)}function ZH(t){return!t||t.length<16||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("@blob:")?!1:/^[A-Za-z0-9+/=\r\n]+$/.test(t)}function WH(t){try{const e=new URL(t),n=e.hostname.toLowerCase();if(e.protocol!=="https:"&&e.protocol!=="http:"||n==="localhost"||n==="::1")return!1;const r=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,s=n.match(r);if(s){const[,a,l,u,f]=s.map(Number);if(a>255||l>255||u>255||f>255||a===127||a===10||a===172&&l>=16&&l<=31||a===192&&l===168||a===169&&l===254||a===0&&l===0&&u===0&&f===0)return!1}return!(n.includes(":")&&(n==="::1"||n==="0:0:0:0:0:0:0:1"||n.startsWith("fc")||n.startsWith("fd")||n.startsWith("fe8")||n.startsWith("fe9")||n.startsWith("fea")||n.startsWith("feb")))}catch{return!1}}function Li(t,e){return t.startsWith("blob:")||WH(t)?!0:t.startsWith("data:")?e?Vl(t,e):Vl(t):!1}function QH(t){return Li(t,"audio")}function Ul(t,e){var a,l,u;if(!t)return"";const n=t==null?void 0:t.mimeType,r=typeof t=="string"?t:(t==null?void 0:t.data)??(t==null?void 0:t.image)??(t==null?void 0:t.audio)??(t==null?void 0:t.video)??(t==null?void 0:t.uri)??(t==null?void 0:t.url);if(typeof r=="string"){if(r.startsWith("@blob:")){const f=r.substring(1);if(e&&f){const h=e[f];if(h&&h.status==="loaded"&&h.data){const g=[];if((t==null?void 0:t.type)==="image"&&g.push("image"),(t==null?void 0:t.type)==="file"){const x=cd(t.mimeType);x==="audio"?g.push("audio"):x==="video"&&g.push("video")}(a=t==null?void 0:t.mimeType)!=null&&a.startsWith("image/")&&g.push("image"),(l=t==null?void 0:t.mimeType)!=null&&l.startsWith("audio/")&&g.push("audio"),(u=t==null?void 0:t.mimeType)!=null&&u.startsWith("video/")&&g.push("video");const p=h.data.items.find(x=>g.includes(x.kind))??h.data.items.find(x=>x.kind==="image")??h.data.items.find(x=>x.kind==="video")??h.data.items.find(x=>x.kind==="audio")??h.data.items[0];if(p&&"src"in p&&typeof p.src=="string")return p.src}}return""}if(r.startsWith("data:"))return r;if(n&&ZH(r))return`data:${n};base64,${r}`;if(Li(r))return r}const s=(t==null?void 0:t.url)??(t==null?void 0:t.image)??(t==null?void 0:t.audio)??(t==null?void 0:t.video)??(t==null?void 0:t.uri);return typeof s=="string"?s:""}function Vx(t,e){if(!t||typeof t!="object")return null;const n=t,r=n.mimeType||n.mediaType,s=n.filename||n.name,a=n.type==="file"?cd(n.mimeType):null;if(!((r==null?void 0:r.startsWith("video/"))||a==="video"||n.type==="video"||(s==null?void 0:s.match(/\.(mp4|webm|mov|m4v|avi|mkv)$/i))))return null;const u=Ul(n,e);return u&&Li(u,"video")?{src:u,filename:s,mimeType:r}:null}function XH(){return c.jsx("div",{className:"flex items-center justify-center gap-2 py-1 text-xs text-muted-foreground",role:"status","aria-live":"polite",children:c.jsxs("span",{className:"flex items-center gap-1 uppercase tracking-wide text-muted-foreground/80",children:[c.jsx("span",{children:"Thinking"}),c.jsx("span",{className:"flex items-center gap-0.5",children:[0,1,2].map(t=>c.jsx("span",{className:"inline-flex h-1.5 w-1.5 rounded-full bg-primary/60 animate-[pulse_1.2s_ease-in-out_infinite]",style:{animationDelay:`${t*.18}s`}},t))})]})})}function JH({messages:t,processing:e=!1,activeError:n,onDismissError:r,outerRef:s,pendingApproval:a,onApprovalApprove:l,onApprovalDeny:u}){const f=_.useRef(null),[h,g]=_.useState({}),[p,x]=_.useState({}),[y,k]=_.useState({isOpen:!1,src:"",alt:""}),{resources:w}=HA(),S=_.useMemo(()=>{const E={};for(const R of w)E[R.uri]={...R};return E},[w]),N=_.useMemo(()=>{var D,B;const E=new Set,R=q=>{if(typeof q!="string")return;const K=q.startsWith("@")?q.substring(1):q;K.startsWith("blob:")&&E.add(K)},z=q=>{if(!q)return;if(typeof q=="string"){R(q);return}if(typeof q!="object")return;const K=q;typeof K.image=="string"&&R(K.image),typeof K.data=="string"&&R(K.data),typeof K.url=="string"&&R(K.url),typeof K.audio=="string"&&R(K.audio),typeof K.video=="string"&&R(K.video)};for(const q of t){const K=q.toolResult;K&&(bh(K)?((D=K.resources)==null||D.forEach(G=>{var F;(F=G==null?void 0:G.uri)!=null&&F.startsWith("blob:")&&E.add(G.uri)}),(B=K.content)==null||B.forEach(G=>z(G))):K!=null&&K.content&&Array.isArray(K.content)&&K.content.forEach(G=>z(G)))}return Array.from(E)},[t]),C=H0(N);_.useEffect(()=>{const E=document.createElement("style");return E.textContent=`
|
|
465
|
-
.audio-controls-container audio {
|
|
466
|
-
max-width: 100% !important;
|
|
467
|
-
width: 100% !important;
|
|
468
|
-
height: auto !important;
|
|
469
|
-
min-height: 32px;
|
|
470
|
-
}
|
|
471
|
-
.audio-controls-container audio::-webkit-media-controls-panel {
|
|
472
|
-
max-width: 100% !important;
|
|
473
|
-
}
|
|
474
|
-
.audio-controls-container audio::-webkit-media-controls-timeline {
|
|
475
|
-
max-width: 100% !important;
|
|
476
|
-
}
|
|
477
|
-
`,document.head.appendChild(E),()=>{document.head.removeChild(E)}},[]);const j=(E,R)=>{k({isOpen:!0,src:E,alt:R})},A=()=>{k({isOpen:!1,src:"",alt:""})};if(!t||t.length===0)return null;const I=E=>typeof E.content=="string"?E.content:Array.isArray(E.content)?E.content.map(R=>vx(R)?R.text:"").filter(Boolean).join(`
|
|
478
|
-
`):E.content&&typeof E.content=="object"?JSON.stringify(E.content,null,2):"",T=E=>E?gx(E)?typeof E.error=="object"?JSON.stringify(E.error,null,2):String(E.error):bh(E)?E.content.map(R=>vx(R)?R.text:typeof R=="object"?"":String(R)).filter(Boolean).join(`
|
|
479
|
-
`):typeof E=="object"?JSON.stringify(E,null,2):String(E):"";return c.jsxs("div",{id:"message-list-container",ref:s,className:"flex flex-col space-y-3 px-3 sm:px-4 py-2 min-w-0 w-full",children:[t.map((E,R)=>{var $e;const z=E.id??`msg-${R}`,D=E.role==="user",B=E.role==="assistant",q=E.role==="system",K=R===t.length-1,G=!!(E.toolName&&E.toolArgs),F=!!(E.toolName&&E.toolResult),M=G||F,V=M&&K||!!h[z],U=[],H=[],L=[];F&&E.toolResult&&bh(E.toolResult)&&E.toolResult.content.forEach((Q,_e)=>{var Oe;if(xx(Q)){const le=Ul(Q,C);le&&Li(le,"image")&&U.push({src:le,alt:`Tool result image ${_e+1}`,index:_e})}else if(dj(Q)){const le=Q,he=Ul(le,C);he&&Li(he,"audio")&&H.push({src:he,filename:le.filename,index:_e})}else if(wh(Q)&&(cd(Q.mimeType)==="audio"||(Oe=Q.mimeType)!=null&&Oe.startsWith("audio/"))){const le=Ul(Q,C);le&&Li(le,"audio")&&H.push({src:le,filename:Q.filename,index:_e})}else{const le=Vx(Q,C);le&&L.push({...le,index:_e})}});const ne=()=>{M&&g(Q=>({...Q,[z]:!Q[z]}))},ie=D?tT:tc,P=ae(D?"grid w-full grid-cols-[1fr_auto] gap-x-2 items-start":"grid w-full grid-cols-[auto_1fr] gap-x-2 items-start"),pe=ae(E.role==="tool"?"w-fit max-w-[90%] text-muted-foreground/70 bg-secondary border border-muted/30 rounded-md text-base overflow-hidden":D?"p-3 rounded-xl shadow-sm w-fit max-w-[75%] bg-primary text-primary-foreground rounded-br-none text-base break-words overflow-wrap-anywhere overflow-hidden":B?"p-3 rounded-xl shadow-sm w-fit max-w-[min(90%,calc(100vw-6rem))] bg-card text-card-foreground border border-border rounded-bl-none text-base break-normal hyphens-none":q?"p-3 shadow-none w-full bg-transparent text-xs text-muted-foreground italic text-center border-none":""),Pe="flex flex-col gap-2",Ne=GH(E.createdAt),ge=!!(n&&n.anchorMessageId===E.id),Qe=e&&(D&&K);return c.jsxs(nt.Fragment,{children:[c.jsxs("div",{className:"w-full","data-role":E.role,id:E.id?`message-${E.id}`:void 0,children:[c.jsxs("div",{className:P,children:[B&&c.jsx(ie,{className:"h-7 w-7 mt-1 text-muted-foreground col-start-1"}),E.role==="tool"&&c.jsx(Ii,{className:"h-7 w-7 p-1 mt-1 rounded-full border border-border text-muted-foreground col-start-1"}),c.jsxs("div",{className:ae("flex flex-col group w-full min-w-0",q?"col-span-2 items-center":D?"col-start-1 justify-self-end items-end":"col-start-2 justify-self-start items-start"),children:[c.jsx("div",{className:ae(pe,"min-w-0"),children:c.jsxs("div",{className:ae(Pe,"min-w-0"),children:[B&&typeof E.reasoning=="string"&&E.reasoning.trim().length>0&&c.jsxs("div",{className:"mb-3 border border-orange-200/50 dark:border-orange-400/20 rounded-lg bg-gradient-to-br from-orange-50/30 to-amber-50/20 dark:from-orange-900/20 dark:to-amber-900/10",children:[c.jsxs("div",{className:"px-3 py-2 border-b border-orange-200/30 dark:border-orange-400/20 bg-orange-100/50 dark:bg-orange-900/30 rounded-t-lg flex items-center justify-between",children:[c.jsxs("button",{type:"button",className:"flex items-center gap-2 text-xs font-medium text-orange-700 dark:text-orange-300 hover:text-orange-800 dark:hover:text-orange-200 transition-colors group",onClick:()=>x(Q=>({...Q,[z]:!(Q[z]??!0)})),children:[c.jsx(Io,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"AI Reasoning"}),p[z]??!0?c.jsx(Ua,{className:"h-3 w-3 group-hover:scale-110 transition-transform"}):c.jsx(Ar,{className:"h-3 w-3 group-hover:scale-110 transition-transform"})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(Zh,{value:E.reasoning,tooltip:"Copy reasoning",copiedTooltip:"Copied!",className:"opacity-70 hover:opacity-100 transition-opacity"}),c.jsx(Wh,{value:E.reasoning,tooltip:"Speak reasoning",stopTooltip:"Stop",className:"opacity-70 hover:opacity-100 transition-opacity"})]})]}),(p[z]??!0)&&c.jsx("div",{className:"px-3 py-2",children:c.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs text-orange-800/80 dark:text-orange-200/70 leading-relaxed font-mono",children:E.reasoning})})]}),E.toolName?c.jsxs("div",{className:"p-2 rounded border border-border bg-muted/30 hover:bg-muted/60 cursor-pointer",onClick:ne,children:[c.jsxs("div",{className:"flex items-center justify-between text-xs font-medium",children:[c.jsxs("span",{className:"flex items-center",children:[V?c.jsx(Ua,{className:"h-4 w-4 mr-2 text-primary"}):c.jsx(VE,{className:"h-4 w-4 mr-2 text-primary"}),"Tool: ",E.toolName]}),E.toolResult?gx(E.toolResult)||E.toolResultSuccess===!1?c.jsx(Ln,{className:"mx-2 h-4 w-4 text-red-500"}):c.jsx(Ts,{className:"mx-2 h-4 w-4 text-green-500"}):c.jsx(Ms,{className:"mx-2 h-4 w-4 animate-spin text-muted-foreground"})]}),V&&c.jsxs("div",{className:"mt-2 space-y-2",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-medium",children:"Arguments:"}),c.jsx("pre",{className:"whitespace-pre-wrap break-words overflow-auto bg-background/50 p-2 rounded text-xs text-muted-foreground",children:JSON.stringify(E.toolArgs,null,2)})]}),E.toolResult&&c.jsxs("div",{children:[c.jsxs("div",{className:"text-xs font-medium flex items-center justify-between",onClick:Q=>Q.stopPropagation(),children:[c.jsx("span",{children:"Result:"}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(Zh,{value:T(E.toolResult),tooltip:"Copy result",copiedTooltip:"Copied!",className:"opacity-70 hover:opacity-100 transition-opacity"}),c.jsx(Wh,{value:T(E.toolResult),tooltip:"Speak result",stopTooltip:"Stop",className:"opacity-70 hover:opacity-100 transition-opacity"})]})]}),gx(E.toolResult)?c.jsx("pre",{className:"whitespace-pre-wrap break-words overflow-auto bg-red-100 text-red-700 p-2 rounded text-xs",children:typeof E.toolResult.error=="object"?JSON.stringify(E.toolResult.error,null,2):String(E.toolResult.error)}):bh(E.toolResult)?E.toolResult.content.map((Q,_e)=>{var le,he,Ee;const Oe=Vx(Q,C);if(xx(Q)||dj(Q)||wh(Q)&&(cd(Q.mimeType)==="audio"||(le=Q.mimeType)!=null&&le.startsWith("audio/"))||Oe)return null;if(vx(Q))return c.jsx(Kx,{text:Q.text,isUser:!1,onOpenImage:j,resourceSet:S},`${z}-tool-text-${_e}`);if(wh(Q)){const De=cd(Q.mimeType),ve=De==="audio"||((he=Q.mimeType)==null?void 0:he.startsWith("audio/")),ue=De==="video"||((Ee=Q.mimeType)==null?void 0:Ee.startsWith("video/"));return c.jsxs("div",{className:"my-1 flex items-center gap-2 p-2 rounded border border-border bg-muted/50",children:[ve?c.jsx(ko,{className:"h-4 w-4 text-muted-foreground"}):ue?c.jsx(Yh,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(nc,{className:"h-4 w-4 text-muted-foreground"}),c.jsxs("span",{className:"text-xs text-muted-foreground",children:[Q.filename||"File attachment"," ","(",Q.mimeType,")"]})]},_e)}return c.jsx("pre",{className:"whitespace-pre-wrap break-words overflow-auto bg-background/50 p-2 rounded text-xs text-muted-foreground my-1",children:typeof Q=="object"?JSON.stringify(Q,null,2):String(Q)},_e)}):c.jsx("pre",{className:"whitespace-pre-wrap break-words overflow-auto bg-background/50 p-2 rounded text-xs text-muted-foreground",children:typeof E.toolResult=="string"&&E.toolResult.startsWith("data:image")?Vl(E.toolResult,"image")?c.jsx("img",{src:E.toolResult,alt:"Tool result image",className:"my-1 max-h-48 w-auto rounded border border-border"}):"Invalid image data":typeof E.toolResult=="object"?JSON.stringify(E.toolResult,null,2):String(E.toolResult)})]})]})]}):c.jsxs(c.Fragment,{children:[typeof E.content=="string"&&E.content.trim()!==""&&c.jsx("div",{className:"relative",children:c.jsx(Kx,{text:E.content,isUser:D,onOpenImage:j,resourceSet:S},`${z}-text-content`)}),E.content&&typeof E.content=="object"&&!Array.isArray(E.content)&&c.jsx("pre",{className:"whitespace-pre-wrap break-words overflow-auto bg-background/50 p-2 rounded text-xs text-muted-foreground",children:JSON.stringify(E.content,null,2)}),Array.isArray(E.content)&&E.content.map((Q,_e)=>{const Oe=`${z}-part-${_e}`;if(Q.type==="text")return c.jsx(Kx,{text:Q.text,isUser:D,onOpenImage:j,resourceSet:S},Oe);if(xx(Q)){const he=Ul(Q);return he&&Li(he,"image")?c.jsx("img",{src:he,alt:"Message attachment",className:"mt-2 max-h-60 w-full rounded-lg border border-border object-contain cursor-pointer",onClick:()=>j(he,"Message attachment")},Oe):null}const le=Vx(Q);if(le){const{src:he,filename:Ee,mimeType:De}=le;return c.jsxs("div",{className:"my-2 flex flex-col gap-2 p-3 rounded-lg border border-border bg-muted/50",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[c.jsx(Yh,{className:ae("h-4 w-4",D?void 0:"text-muted-foreground")}),c.jsx("span",{children:"Video attachment"})]}),c.jsx("div",{className:"w-full max-w-md",children:c.jsx("video",{controls:!0,src:he,className:"w-full max-h-[360px] rounded-lg bg-black",preload:"metadata"})}),(Ee||De)&&c.jsxs("div",{className:"flex flex-col text-xs",children:[Ee&&c.jsx("span",{className:ae("truncate",D?"text-primary-foreground/80":"text-muted-foreground"),children:Ee}),De&&c.jsx("span",{className:ae(D?"text-primary-foreground/70":"text-muted-foreground/80"),children:De})]})]},Oe)}if(wh(Q)){const he=Q;if(he.mimeType.startsWith("audio/")){const Ee=Ul(he);return c.jsxs("div",{className:"my-2 flex items-center gap-2 p-3 rounded-lg border border-border bg-muted/50",children:[c.jsx(ko,{className:ae("h-5 w-5",D?void 0:"text-muted-foreground")}),c.jsx("audio",{controls:!0,src:Ee,className:"flex-1 h-8"}),he.filename&&c.jsx("span",{className:ae("text-sm truncate max-w-[120px]",D?"text-primary-foreground/80":"text-muted-foreground"),children:he.filename})]},Oe)}else return c.jsxs("div",{className:"my-2 flex items-center gap-2 p-3 rounded-lg border border-border bg-muted/50",children:[c.jsx(nc,{className:ae("h-5 w-5",D?void 0:"text-muted-foreground")}),c.jsx("span",{className:ae("text-sm font-medium",void 0),children:he.filename||`${he.mimeType} file`}),c.jsx("span",{className:ae("text-xs",D?"text-primary-foreground/70":"text-muted-foreground"),children:he.mimeType})]},Oe)}return null}),q&&!E.content&&c.jsx("p",{className:"italic",children:"System message"})]}),E.imageData&&!Array.isArray(E.content)&&(()=>{const Q=`data:${E.imageData.mimeType};base64,${E.imageData.image}`;return Vl(Q,"image")?c.jsx("img",{src:Q,alt:"attachment",className:"mt-2 max-h-60 w-full rounded-lg border border-border object-contain"}):null})(),E.fileData&&!Array.isArray(E.content)&&c.jsx("div",{className:"mt-2",children:E.fileData.mimeType.startsWith("video/")?c.jsxs("div",{className:"flex flex-col gap-2 p-3 rounded-lg border border-border bg-muted/50 max-w-md",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[c.jsx(Yh,{className:"h-4 w-4"}),c.jsx("span",{children:"Video attachment"})]}),(()=>{const Q=`data:${E.fileData.mimeType};base64,${E.fileData.data}`;return Vl(Q,"video")?c.jsx("video",{controls:!0,src:Q,className:"w-full max-h-[360px] rounded-lg bg-black",preload:"metadata"}):c.jsx("div",{className:"text-xs text-red-500",children:"Invalid video data"})})(),c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground/90",children:[c.jsx("span",{className:"font-medium truncate",children:E.fileData.filename||`${E.fileData.mimeType} file`}),c.jsx("span",{className:"opacity-70",children:E.fileData.mimeType})]})]}):E.fileData.mimeType.startsWith("audio/")?c.jsxs("div",{className:"relative w-fit border border-border rounded-lg p-2 bg-muted/50 flex items-center gap-2 group",children:[c.jsx(ko,{className:"h-4 w-4"}),(()=>{const Q=`data:${E.fileData.mimeType};base64,${E.fileData.data}`;return Vl(Q,"audio")?c.jsx("audio",{controls:!0,src:Q,className:"h-8"}):c.jsx("span",{className:"text-xs text-red-500",children:"Invalid audio data"})})()]}):c.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg border border-border bg-muted/50",children:[c.jsx(nc,{className:"h-5 w-5"}),c.jsx("span",{className:"text-sm font-medium",children:E.fileData.filename||`${E.fileData.mimeType} file`}),c.jsx("span",{className:"text-xs text-primary-foreground/70",children:E.fileData.mimeType})]})})]})}),!q&&!M&&c.jsxs("div",{className:"text-xs text-muted-foreground mt-1 px-1 flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("span",{children:Ne}),B&&(($e=E.tokenUsage)==null?void 0:$e.totalTokens)!==void 0&&c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-muted/50 text-xs cursor-default",children:[c.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500"}),E.tokenUsage.totalTokens," ","tokens"]})}),c.jsx(Lt,{side:"bottom",children:c.jsxs("div",{className:"flex flex-col gap-0.5",children:[E.tokenUsage.inputTokens!==void 0&&c.jsxs("div",{children:["Input:"," ",E.tokenUsage.inputTokens]}),E.tokenUsage.outputTokens!==void 0&&c.jsxs("div",{children:["Output:"," ",E.tokenUsage.outputTokens]}),E.tokenUsage.reasoningTokens!==void 0&&c.jsxs("div",{children:["Reasoning:"," ",E.tokenUsage.reasoningTokens]}),c.jsxs("div",{className:"font-medium mt-0.5",children:["Total:"," ",E.tokenUsage.totalTokens]})]})})]}),B&&E.model&&c.jsxs(Dt,{children:[c.jsx(It,{children:c.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-muted/30 text-xs cursor-default",children:E.model})}),c.jsx(Lt,{side:"bottom",children:c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"font-medium",children:["Model: ",E.model]}),E.provider&&c.jsxs("div",{className:"font-medium",children:["Provider: ",E.provider]}),E.router&&c.jsxs("div",{className:"font-medium",children:["Router: ",E.router]})]})})]})]}),(B||D)&&c.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[c.jsx(Zh,{value:I(E),tooltip:"Copy message",copiedTooltip:"Copied!",className:"opacity-70 hover:opacity-100 transition-opacity"}),c.jsx(Wh,{value:I(E),tooltip:"Speak",stopTooltip:"Stop",className:"opacity-70 hover:opacity-100 transition-opacity"})]})]})]}),D&&c.jsx(ie,{className:"h-7 w-7 mt-1 text-muted-foreground col-start-2"})]}),U.map((Q,_e)=>c.jsx("div",{className:"w-full mt-2",children:c.jsxs("div",{className:"flex items-end w-full justify-start",children:[c.jsx(ud,{className:"h-7 w-7 mr-2 mb-1 text-muted-foreground self-start flex-shrink-0"}),c.jsxs("div",{className:"flex flex-col items-start",children:[c.jsx("div",{className:"p-3 rounded-xl shadow-sm max-w-[75%] bg-card text-card-foreground border border-border rounded-bl-none text-sm",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[c.jsx(ud,{className:"h-3 w-3"}),c.jsx("span",{children:"Tool Result Image"})]}),c.jsxs("div",{className:"relative group cursor-pointer",onClick:()=>j(Q.src,Q.alt),children:[c.jsx("img",{src:Q.src,alt:Q.alt,className:"max-h-80 w-auto rounded border border-border object-contain transition-transform group-hover:scale-[1.02]"}),c.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/10 transition-colors rounded border border-border flex items-center justify-center",children:c.jsx(qz,{className:"h-8 w-8 text-white opacity-0 group-hover:opacity-100 transition-opacity drop-shadow-lg"})})]})]})}),c.jsx("div",{className:"text-xs text-muted-foreground mt-1 px-1",children:c.jsx("span",{children:Ne})})]})]})},`${z}-image-${_e}`)),L.map((Q,_e)=>c.jsx("div",{className:"w-full mt-2",children:c.jsxs("div",{className:"flex items-end w-full justify-start",children:[c.jsx(Pj,{className:"h-7 w-7 mr-2 mb-1 text-muted-foreground self-start flex-shrink-0"}),c.jsxs("div",{className:"flex flex-col items-start",children:[c.jsx("div",{className:"p-3 rounded-xl shadow-sm max-w-[75%] bg-card text-card-foreground border border-border rounded-bl-none text-sm overflow-hidden",children:c.jsxs("div",{className:"flex flex-col gap-2 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[c.jsx(Pj,{className:"h-3 w-3"}),c.jsx("span",{children:"Tool Result Video"})]}),c.jsxs("div",{className:"flex flex-col gap-2 p-2 rounded border border-border bg-muted/30 min-w-0",children:[c.jsx("video",{controls:!0,src:Q.src,className:"w-full max-h-[360px] rounded-lg bg-black",preload:"metadata"}),(Q.filename||Q.mimeType)&&c.jsxs("div",{className:"flex flex-col text-xs text-muted-foreground",children:[Q.filename&&c.jsx("span",{className:"truncate",children:Q.filename}),Q.mimeType&&c.jsx("span",{className:"opacity-70",children:Q.mimeType})]})]})]})}),c.jsx("div",{className:"text-xs text-muted-foreground mt-1 px-1",children:c.jsx("span",{children:Ne})})]})]})},`${z}-video-${_e}`)),H.map((Q,_e)=>c.jsx("div",{className:"w-full mt-2",children:c.jsxs("div",{className:"flex items-end w-full justify-start",children:[c.jsx(ob,{className:"h-7 w-7 mr-2 mb-1 text-muted-foreground self-start flex-shrink-0"}),c.jsxs("div",{className:"flex flex-col items-start",children:[c.jsx("div",{className:"p-3 rounded-xl shadow-sm max-w-[75%] bg-card text-card-foreground border border-border rounded-bl-none text-sm overflow-hidden",children:c.jsxs("div",{className:"flex flex-col gap-2 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[c.jsx(ob,{className:"h-3 w-3"}),c.jsx("span",{children:"Tool Result Audio"})]}),c.jsxs("div",{className:"flex flex-col gap-2 p-2 rounded border border-border bg-muted/30 min-w-0 audio-controls-container",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx(ko,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),c.jsx("audio",{controls:!0,src:Q.src,className:"flex-1 min-w-0"})]}),Q.filename&&c.jsx("div",{className:"flex items-center gap-2 min-w-0",children:c.jsx("span",{className:"text-xs text-muted-foreground truncate",children:Q.filename})})]})]})}),c.jsx("div",{className:"text-xs text-muted-foreground mt-1 px-1",children:c.jsx("span",{children:Ne})})]})]})},`${z}-audio-${_e}`)),ge&&c.jsx("div",{className:"mt-2 ml-12 mr-4",children:c.jsx(o8,{error:n,onDismiss:r||(()=>{})})})]}),Qe&&c.jsx(XH,{})]},z)}),a&&l&&u&&c.jsx("div",{className:"w-full","data-role":"approval",children:c.jsxs("div",{className:"grid w-full grid-cols-[auto_1fr] gap-x-2 items-start",children:[c.jsx(tc,{className:"h-7 w-7 mt-1 text-muted-foreground col-start-1 flex-shrink-0"}),c.jsx("div",{className:"flex flex-col group w-full col-start-2 justify-self-start items-start min-w-0",children:c.jsx("div",{className:"p-3 rounded-xl shadow-sm w-full max-w-[90%] bg-card text-card-foreground border border-border rounded-bl-none text-base min-w-0",children:c.jsx(YH,{approval:a,onApprove:l,onDeny:u})})})]})}),c.jsx("div",{ref:f,className:"h-px"},"end-anchor"),y.isOpen&&c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:c.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh] bg-background rounded-lg shadow-2xl border border-border",children:[c.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[c.jsx("h3",{className:"text-lg font-semibold",children:"Tool Result Image"}),c.jsx("button",{onClick:A,className:"p-2 hover:bg-muted rounded-md transition-colors","aria-label":"Close modal",children:c.jsx(Er,{className:"h-5 w-5"})})]}),c.jsx("div",{className:"p-4 flex items-center justify-center",children:c.jsx("img",{src:y.src,alt:y.alt,className:"max-w-full max-h-[70vh] object-contain rounded"})}),c.jsx("div",{className:"p-4 border-t border-border text-sm text-muted-foreground",children:c.jsx("p",{children:y.alt})})]})})]})}function eV(t,e){if(!t)return{cleanedText:"",uris:[]};const n=zL(t),r=FL(n,e),s=Array.from(new Set(r.filter(l=>l.resourceUri).map(l=>l.resourceUri)));let a=t;for(const l of r)l.resourceUri&&(a=a.split(l.originalRef).join(""));return a=a.replace(/\\n/g,`
|
|
480
|
-
`).replace(/\\t/g," "),a=a.replace(/\n{3,}/g,`
|
|
481
|
-
|
|
482
|
-
`).replace(/[ \t]{2,}/g," ").trim(),{cleanedText:a,uris:s}}function Kx({text:t,isUser:e,onOpenImage:n,resourceSet:r}){const{cleanedText:s,uris:a}=_.useMemo(()=>eV(t,r),[t,r]),l=H0(a),u=s.length>0;return c.jsxs("div",{className:"space-y-3",children:[u&&c.jsx("div",{className:"relative min-w-0 overflow-hidden",children:e?c.jsx("p",{className:"text-base whitespace-pre-line break-words overflow-wrap-anywhere",children:s}):c.jsx(qA,{children:s})}),a.map(f=>c.jsx(tV,{uri:f,state:l[f],onOpenImage:n},f))]})}function tV({uri:t,state:e,onOpenImage:n}){var a;if(!e||e.status==="loading")return c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[c.jsx(Ms,{className:"h-3.5 w-3.5 animate-spin"}),c.jsx("span",{children:"Loading resourceโฆ"})]});if(e.status==="error")return c.jsxs("div",{className:"flex items-start gap-2 text-xs text-destructive",children:[c.jsx(Ln,{className:"mt-0.5 h-3.5 w-3.5"}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"font-medium",children:"Failed to load resource"}),c.jsx("p",{className:"break-all text-[11px] text-destructive/80",children:t}),c.jsx("p",{className:"text-[11px] text-destructive/70",children:e.error})]})]});const r=e.data;if(!r||r.items.length===0)return c.jsxs("div",{className:"text-xs text-muted-foreground",children:[c.jsx("p",{className:"font-medium",children:(r==null?void 0:r.name)||t}),c.jsx("p",{className:"text-[11px] text-muted-foreground/80",children:"No previewable content."})]});const s=(a=r.items.find(l=>"mimeType"in l&&typeof l.mimeType=="string"))==null?void 0:a.mimeType;return c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground/80",children:[c.jsx(K$,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"font-medium text-foreground",children:r.name||t}),s&&c.jsx("span",{className:"text-[10px]",children:s})]}),r.items.map((l,u)=>nV({item:l,index:u,onOpenImage:n}))]})}function nV({item:t,index:e,onOpenImage:n}){const r=`resource-item-${e}`;switch(t.kind){case"text":return t.mimeType&&t.mimeType.includes("markdown")?c.jsx("div",{className:"text-sm",children:c.jsx(qA,{children:t.text})},r):c.jsx("pre",{className:"whitespace-pre-wrap break-words rounded-md bg-background/60 p-2 text-sm text-foreground",children:t.text},r);case"image":return Li(t.src)?c.jsx("img",{src:t.src,alt:t.alt||"Resource image",onClick:()=>n(t.src,t.alt||"Resource image"),className:"max-h-60 w-full cursor-zoom-in rounded-lg border border-border object-contain"},r):c.jsx("div",{className:"text-xs text-muted-foreground",children:"Unsupported image source"},r);case"audio":return QH(t.src)?c.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-background/50 p-2",children:[c.jsx(ko,{className:"h-4 w-4"}),c.jsx("audio",{controls:!0,src:t.src,className:"h-8 flex-1"}),t.filename&&c.jsx("span",{className:"max-w-[140px] truncate text-xs text-muted-foreground",children:t.filename})]},r):c.jsx("div",{className:"text-xs text-muted-foreground",children:"Unsupported audio source"},r);case"video":return Li(t.src,"video")?c.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border border-border bg-background/50 p-3",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[c.jsx(Yh,{className:"h-4 w-4"}),c.jsx("span",{children:"Video"}),t.filename&&c.jsx("span",{className:"truncate font-medium",children:t.filename})]}),c.jsx("video",{controls:!0,src:t.src,className:"w-full max-h-[360px] rounded-lg bg-black",preload:"metadata",children:"Your browser does not support the video tag."})]},r):c.jsx("div",{className:"text-xs text-muted-foreground",children:"Unsupported video source"},r);case"file":return c.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-background/60 p-2",children:[c.jsx(nc,{className:"h-4 w-4 text-muted-foreground"}),c.jsxs("div",{className:"flex flex-1 flex-col",children:[c.jsx("span",{className:"text-sm font-medium text-foreground",children:t.filename||"Resource file"}),t.mimeType&&c.jsx("span",{className:"text-[11px] text-muted-foreground",children:t.mimeType})]}),t.src&&c.jsx("a",{href:t.src,download:t.filename||"resource.bin",className:"text-xs font-medium text-primary underline-offset-2 hover:underline",children:"Download"})]},r);default:return null}}function jb(){return jb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},jb.apply(null,arguments)}function rV(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var sV=_.useLayoutEffect,iV=function(e){var n=nt.useRef(e);return sV(function(){n.current=e}),n},VN=function(e,n){if(typeof e=="function"){e(n);return}e.current=n},aV=function(e,n){var r=nt.useRef();return nt.useCallback(function(s){e.current=s,r.current&&VN(r.current,null),r.current=n,n&&VN(n,s)},[n])},KN={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},oV=function(e){Object.keys(KN).forEach(function(n){e.style.setProperty(n,KN[n],"important")})},YN=oV,ur=null,GN=function(e,n){var r=e.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function lV(t,e,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),ur||(ur=document.createElement("textarea"),ur.setAttribute("tabindex","-1"),ur.setAttribute("aria-hidden","true"),YN(ur)),ur.parentNode===null&&document.body.appendChild(ur);var s=t.paddingSize,a=t.borderSize,l=t.sizingStyle,u=l.boxSizing;Object.keys(l).forEach(function(x){var y=x;ur.style[y]=l[y]}),YN(ur),ur.value=e;var f=GN(ur,t);ur.value=e,f=GN(ur,t),ur.value="x";var h=ur.scrollHeight-s,g=h*n;u==="border-box"&&(g=g+s+a),f=Math.max(g,f);var p=h*r;return u==="border-box"&&(p=p+s+a),f=Math.min(p,f),[f,h]}var ZN=function(){},cV=function(e,n){return e.reduce(function(r,s){return r[s]=n[s],r},{})},uV=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],dV=!!document.documentElement.currentStyle,fV=function(e){var n=window.getComputedStyle(e);if(n===null)return null;var r=cV(uV,n),s=r.boxSizing;if(s==="")return null;dV&&s==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var a=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),l=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:a,borderSize:l}},hV=fV;function Y0(t,e,n){var r=iV(n);_.useLayoutEffect(function(){var s=function(l){return r.current(l)};if(t)return t.addEventListener(e,s),function(){return t.removeEventListener(e,s)}},[])}var mV=function(e,n){Y0(document.body,"reset",function(r){e.current.form===r.target&&n(r)})},pV=function(e){Y0(window,"resize",e)},gV=function(e){Y0(document.fonts,"loadingdone",e)},vV=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],xV=function(e,n){var r=e.cacheMeasurements,s=e.maxRows,a=e.minRows,l=e.onChange,u=l===void 0?ZN:l,f=e.onHeightChange,h=f===void 0?ZN:f,g=rV(e,vV),p=g.value!==void 0,x=_.useRef(null),y=aV(x,n),k=_.useRef(0),w=_.useRef(),S=function(){var j=x.current,A=r&&w.current?w.current:hV(j);if(A){w.current=A;var I=lV(A,j.value||j.placeholder||"x",a,s),T=I[0],E=I[1];k.current!==T&&(k.current=T,j.style.setProperty("height",T+"px","important"),h(T,{rowHeight:E}))}},N=function(j){p||S(),u(j)};return _.useLayoutEffect(S),mV(x,function(){if(!p){var C=x.current.value;requestAnimationFrame(function(){var j=x.current;j&&C!==j.value&&S()})}}),pV(S),gV(S),_.createElement("textarea",jb({},g,{onChange:N,ref:y}))},yV=_.forwardRef(xV);function bV({children:t,className:e}){return c.jsx("div",{className:ae("relative","w-full","flex flex-col overflow-visible","max-h-[max(35svh,5rem)]","border-2 border-border/50","bg-background","rounded-3xl shadow-sm","transition-all duration-200",e),children:t})}function wV({leftButtons:t,rightButtons:e,className:n}){return c.jsxs("div",{className:ae("flex items-center justify-between","h-12 px-3 pr-4",n),children:[c.jsx("div",{className:"flex items-center gap-2",children:t}),c.jsx("div",{className:"flex items-center gap-2",children:e})]})}var vp="Switch",[_V,XQ]=Ka(vp),[kV,SV]=_V(vp),JA=_.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:a,required:l,disabled:u,value:f="on",onCheckedChange:h,form:g,...p}=t,[x,y]=_.useState(null),k=Bt(e,j=>y(j)),w=_.useRef(!1),S=x?g||!!x.closest("form"):!0,[N,C]=zo({prop:s,defaultProp:a??!1,onChange:h,caller:vp});return c.jsxs(kV,{scope:n,checked:N,disabled:u,children:[c.jsx(Ct.button,{type:"button",role:"switch","aria-checked":N,"aria-required":l,"data-state":rO(N),"data-disabled":u?"":void 0,disabled:u,value:f,...p,ref:k,onClick:bt(t.onClick,j=>{C(A=>!A),S&&(w.current=j.isPropagationStopped(),w.current||j.stopPropagation())})}),S&&c.jsx(nO,{control:x,bubbles:!w.current,name:r,value:f,checked:N,required:l,disabled:u,form:g,style:{transform:"translateX(-100%)"}})]})});JA.displayName=vp;var eO="SwitchThumb",tO=_.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=SV(eO,n);return c.jsx(Ct.span,{"data-state":rO(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});tO.displayName=eO;var jV="SwitchBubbleInput",nO=_.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},a)=>{const l=_.useRef(null),u=Bt(l,a),f=V0(n),h=g0(e);return _.useEffect(()=>{const g=l.current;if(!g)return;const p=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(p,"checked").set;if(f!==n&&y){const k=new Event("click",{bubbles:r});y.call(g,n),g.dispatchEvent(k)}},[f,n,r]),c.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:u,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});nO.displayName=jV;function rO(t){return t?"checked":"unchecked"}var G0=JA,sO=tO;const Z0=_.forwardRef(({className:t,...e},n)=>c.jsx(G0,{className:ae("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:c.jsx(sO,{className:ae("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Z0.displayName=G0.displayName;function NV({isStreaming:t,onStreamingChange:e,className:n}){return c.jsx(Os,{children:c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsxs("div",{className:`flex items-center gap-1.5 cursor-pointer ${n||""}`,children:[c.jsx(np,{className:`h-3 w-3 ${t?"text-blue-500":"text-muted-foreground"}`}),c.jsx(Z0,{checked:t,onCheckedChange:e,className:"scale-75","aria-label":"Toggle streaming"})]})}),c.jsxs(Lt,{side:"bottom",children:[c.jsx("p",{children:t?"Streaming enabled":"Streaming disabled"}),c.jsx("p",{className:"text-xs opacity-75",children:t?"Responses will stream in real-time":"Responses will arrive all at once"})]})]})})}var Yx=0;function W0(){_.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??WN()),document.body.insertAdjacentElement("beforeend",t[1]??WN()),Yx++,()=>{Yx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Yx--}},[])}function WN(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Gx="focusScope.autoFocusOnMount",Zx="focusScope.autoFocusOnUnmount",QN={bubbles:!1,cancelable:!0},CV="FocusScope",xp=_.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=t,[u,f]=_.useState(null),h=Po(s),g=Po(a),p=_.useRef(null),x=Bt(e,w=>f(w)),y=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let w=function(j){if(y.paused||!u)return;const A=j.target;u.contains(A)?p.current=A:Na(p.current,{select:!0})},S=function(j){if(y.paused||!u)return;const A=j.relatedTarget;A!==null&&(u.contains(A)||Na(p.current,{select:!0}))},N=function(j){if(document.activeElement===document.body)for(const I of j)I.removedNodes.length>0&&Na(u)};document.addEventListener("focusin",w),document.addEventListener("focusout",S);const C=new MutationObserver(N);return u&&C.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",S),C.disconnect()}}},[r,u,y.paused]),_.useEffect(()=>{if(u){JN.add(y);const w=document.activeElement;if(!u.contains(w)){const N=new CustomEvent(Gx,QN);u.addEventListener(Gx,h),u.dispatchEvent(N),N.defaultPrevented||(EV(MV(iO(u)),{select:!0}),document.activeElement===w&&Na(u))}return()=>{u.removeEventListener(Gx,h),setTimeout(()=>{const N=new CustomEvent(Zx,QN);u.addEventListener(Zx,g),u.dispatchEvent(N),N.defaultPrevented||Na(w??document.body,{select:!0}),u.removeEventListener(Zx,g),JN.remove(y)},0)}}},[u,h,g,y]);const k=_.useCallback(w=>{if(!n&&!r||y.paused)return;const S=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,N=document.activeElement;if(S&&N){const C=w.currentTarget,[j,A]=TV(C);j&&A?!w.shiftKey&&N===A?(w.preventDefault(),n&&Na(j,{select:!0})):w.shiftKey&&N===j&&(w.preventDefault(),n&&Na(A,{select:!0})):N===C&&w.preventDefault()}},[n,r,y.paused]);return c.jsx(Ct.div,{tabIndex:-1,...l,ref:x,onKeyDown:k})});xp.displayName=CV;function EV(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Na(r,{select:e}),document.activeElement!==n)return}function TV(t){const e=iO(t),n=XN(e,t),r=XN(e.reverse(),t);return[n,r]}function iO(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function XN(t,e){for(const n of t)if(!AV(n,{upTo:e}))return n}function AV(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function OV(t){return t instanceof HTMLInputElement&&"select"in t}function Na(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&OV(t)&&e&&t.select()}}var JN=RV();function RV(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=eC(t,e),t.unshift(e)},remove(e){var n;t=eC(t,e),(n=t[0])==null||n.resume()}}}function eC(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function MV(t){return t.filter(e=>e.tagName!=="A")}var DV=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Dl=new WeakMap,Oh=new WeakMap,Rh={},Wx=0,aO=function(t){return t&&(t.host||aO(t.parentNode))},IV=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=aO(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},LV=function(t,e,n,r){var s=IV(e,Array.isArray(t)?t:[t]);Rh[n]||(Rh[n]=new WeakMap);var a=Rh[n],l=[],u=new Set,f=new Set(s),h=function(p){!p||u.has(p)||(u.add(p),h(p.parentNode))};s.forEach(h);var g=function(p){!p||f.has(p)||Array.prototype.forEach.call(p.children,function(x){if(u.has(x))g(x);else try{var y=x.getAttribute(r),k=y!==null&&y!=="false",w=(Dl.get(x)||0)+1,S=(a.get(x)||0)+1;Dl.set(x,w),a.set(x,S),l.push(x),w===1&&k&&Oh.set(x,!0),S===1&&x.setAttribute(n,"true"),k||x.setAttribute(r,"true")}catch(N){console.error("aria-hidden: cannot operate on ",x,N)}})};return g(e),u.clear(),Wx++,function(){l.forEach(function(p){var x=Dl.get(p)-1,y=a.get(p)-1;Dl.set(p,x),a.set(p,y),x||(Oh.has(p)||p.removeAttribute(r),Oh.delete(p)),y||p.removeAttribute(n)}),Wx--,Wx||(Dl=new WeakMap,Dl=new WeakMap,Oh=new WeakMap,Rh={})}},Q0=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=DV(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),LV(r,s,n,"aria-hidden")):function(){return null}},Gs=function(){return Gs=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Gs.apply(this,arguments)};function oO(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function PV(t,e,n){if(n||arguments.length===2)for(var r=0,s=e.length,a;r<s;r++)(a||!(r in e))&&(a||(a=Array.prototype.slice.call(e,0,r)),a[r]=e[r]);return t.concat(a||Array.prototype.slice.call(e))}var Xh="right-scroll-bar-position",Jh="width-before-scroll-bar",$V="with-scroll-bars-hidden",zV="--removed-body-scroll-bar-size";function Qx(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function FV(t,e){var n=_.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=e,n.facade}var BV=typeof window<"u"?_.useLayoutEffect:_.useEffect,tC=new WeakMap;function UV(t,e){var n=FV(null,function(r){return t.forEach(function(s){return Qx(s,r)})});return BV(function(){var r=tC.get(n);if(r){var s=new Set(r),a=new Set(t),l=n.current;s.forEach(function(u){a.has(u)||Qx(u,null)}),a.forEach(function(u){s.has(u)||Qx(u,l)})}tC.set(n,t)},[t]),n}function qV(t){return t}function HV(t,e){e===void 0&&(e=qV);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(a){var l=e(a,r);return n.push(l),function(){n=n.filter(function(u){return u!==l})}},assignSyncMedium:function(a){for(r=!0;n.length;){var l=n;n=[],l.forEach(a)}n={push:function(u){return a(u)},filter:function(){return n}}},assignMedium:function(a){r=!0;var l=[];if(n.length){var u=n;n=[],u.forEach(a),l=n}var f=function(){var g=l;l=[],g.forEach(a)},h=function(){return Promise.resolve().then(f)};h(),n={push:function(g){l.push(g),h()},filter:function(g){return l=l.filter(g),n}}}};return s}function VV(t){t===void 0&&(t={});var e=HV(null);return e.options=Gs({async:!0,ssr:!1},t),e}var lO=function(t){var e=t.sideCar,n=oO(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return _.createElement(r,Gs({},n))};lO.isSideCarExport=!0;function KV(t,e){return t.useMedium(e),lO}var cO=VV(),Xx=function(){},yp=_.forwardRef(function(t,e){var n=_.useRef(null),r=_.useState({onScrollCapture:Xx,onWheelCapture:Xx,onTouchMoveCapture:Xx}),s=r[0],a=r[1],l=t.forwardProps,u=t.children,f=t.className,h=t.removeScrollBar,g=t.enabled,p=t.shards,x=t.sideCar,y=t.noRelative,k=t.noIsolation,w=t.inert,S=t.allowPinchZoom,N=t.as,C=N===void 0?"div":N,j=t.gapMode,A=oO(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=x,T=UV([n,e]),E=Gs(Gs({},A),s);return _.createElement(_.Fragment,null,g&&_.createElement(I,{sideCar:cO,removeScrollBar:h,shards:p,noRelative:y,noIsolation:k,inert:w,setCallbacks:a,allowPinchZoom:!!S,lockRef:n,gapMode:j}),l?_.cloneElement(_.Children.only(u),Gs(Gs({},E),{ref:T})):_.createElement(C,Gs({},E,{className:f,ref:T}),u))});yp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};yp.classNames={fullWidth:Jh,zeroRight:Xh};var YV=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function GV(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=YV();return e&&t.setAttribute("nonce",e),t}function ZV(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function WV(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var QV=function(){var t=0,e=null;return{add:function(n){t==0&&(e=GV())&&(ZV(e,n),WV(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},XV=function(){var t=QV();return function(e,n){_.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},uO=function(){var t=XV(),e=function(n){var r=n.styles,s=n.dynamic;return t(r,s),null};return e},JV={left:0,top:0,right:0,gap:0},Jx=function(t){return parseInt(t||"",10)||0},eK=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],s=e[t==="padding"?"paddingRight":"marginRight"];return[Jx(n),Jx(r),Jx(s)]},tK=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return JV;var e=eK(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},nK=uO(),ic="data-scroll-locked",rK=function(t,e,n,r){var s=t.left,a=t.top,l=t.right,u=t.gap;return n===void 0&&(n="margin"),`
|
|
483
|
-
.`.concat($V,` {
|
|
484
|
-
overflow: hidden `).concat(r,`;
|
|
485
|
-
padding-right: `).concat(u,"px ").concat(r,`;
|
|
486
|
-
}
|
|
487
|
-
body[`).concat(ic,`] {
|
|
488
|
-
overflow: hidden `).concat(r,`;
|
|
489
|
-
overscroll-behavior: contain;
|
|
490
|
-
`).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
491
|
-
padding-left: `.concat(s,`px;
|
|
492
|
-
padding-top: `).concat(a,`px;
|
|
493
|
-
padding-right: `).concat(l,`px;
|
|
494
|
-
margin-left:0;
|
|
495
|
-
margin-top:0;
|
|
496
|
-
margin-right: `).concat(u,"px ").concat(r,`;
|
|
497
|
-
`),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
.`).concat(Xh,` {
|
|
501
|
-
right: `).concat(u,"px ").concat(r,`;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
.`).concat(Jh,` {
|
|
505
|
-
margin-right: `).concat(u,"px ").concat(r,`;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
.`).concat(Xh," .").concat(Xh,` {
|
|
509
|
-
right: 0 `).concat(r,`;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
.`).concat(Jh," .").concat(Jh,` {
|
|
513
|
-
margin-right: 0 `).concat(r,`;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
body[`).concat(ic,`] {
|
|
517
|
-
`).concat(zV,": ").concat(u,`px;
|
|
518
|
-
}
|
|
519
|
-
`)},nC=function(){var t=parseInt(document.body.getAttribute(ic)||"0",10);return isFinite(t)?t:0},sK=function(){_.useEffect(function(){return document.body.setAttribute(ic,(nC()+1).toString()),function(){var t=nC()-1;t<=0?document.body.removeAttribute(ic):document.body.setAttribute(ic,t.toString())}},[])},iK=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;sK();var a=_.useMemo(function(){return tK(s)},[s]);return _.createElement(nK,{styles:rK(a,!e,s,n?"":"!important")})},Nb=!1;if(typeof window<"u")try{var Mh=Object.defineProperty({},"passive",{get:function(){return Nb=!0,!0}});window.addEventListener("test",Mh,Mh),window.removeEventListener("test",Mh,Mh)}catch{Nb=!1}var Il=Nb?{passive:!1}:!1,aK=function(t){return t.tagName==="TEXTAREA"},dO=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!aK(t)&&n[e]==="visible")},oK=function(t){return dO(t,"overflowY")},lK=function(t){return dO(t,"overflowX")},rC=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=fO(t,r);if(s){var a=hO(t,r),l=a[1],u=a[2];if(l>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},cK=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},uK=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},fO=function(t,e){return t==="v"?oK(e):lK(e)},hO=function(t,e){return t==="v"?cK(e):uK(e)},dK=function(t,e){return t==="h"&&e==="rtl"?-1:1},fK=function(t,e,n,r,s){var a=dK(t,window.getComputedStyle(e).direction),l=a*r,u=n.target,f=e.contains(u),h=!1,g=l>0,p=0,x=0;do{if(!u)break;var y=hO(t,u),k=y[0],w=y[1],S=y[2],N=w-S-a*k;(k||N)&&fO(t,u)&&(p+=N,x+=k);var C=u.parentNode;u=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!f&&u!==document.body||f&&(e.contains(u)||e===u));return(g&&Math.abs(p)<1||!g&&Math.abs(x)<1)&&(h=!0),h},Dh=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},sC=function(t){return[t.deltaX,t.deltaY]},iC=function(t){return t&&"current"in t?t.current:t},hK=function(t,e){return t[0]===e[0]&&t[1]===e[1]},mK=function(t){return`
|
|
520
|
-
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
521
|
-
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
522
|
-
`)},pK=0,Ll=[];function gK(t){var e=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),s=_.useState(pK++)[0],a=_.useState(uO)[0],l=_.useRef(t);_.useEffect(function(){l.current=t},[t]),_.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var w=PV([t.lockRef.current],(t.shards||[]).map(iC),!0).filter(Boolean);return w.forEach(function(S){return S.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),w.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var u=_.useCallback(function(w,S){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!l.current.allowPinchZoom;var N=Dh(w),C=n.current,j="deltaX"in w?w.deltaX:C[0]-N[0],A="deltaY"in w?w.deltaY:C[1]-N[1],I,T=w.target,E=Math.abs(j)>Math.abs(A)?"h":"v";if("touches"in w&&E==="h"&&T.type==="range")return!1;var R=rC(E,T);if(!R)return!0;if(R?I=E:(I=E==="v"?"h":"v",R=rC(E,T)),!R)return!1;if(!r.current&&"changedTouches"in w&&(j||A)&&(r.current=I),!I)return!0;var z=r.current||I;return fK(z,S,w,z==="h"?j:A)},[]),f=_.useCallback(function(w){var S=w;if(!(!Ll.length||Ll[Ll.length-1]!==a)){var N="deltaY"in S?sC(S):Dh(S),C=e.current.filter(function(I){return I.name===S.type&&(I.target===S.target||S.target===I.shadowParent)&&hK(I.delta,N)})[0];if(C&&C.should){S.cancelable&&S.preventDefault();return}if(!C){var j=(l.current.shards||[]).map(iC).filter(Boolean).filter(function(I){return I.contains(S.target)}),A=j.length>0?u(S,j[0]):!l.current.noIsolation;A&&S.cancelable&&S.preventDefault()}}},[]),h=_.useCallback(function(w,S,N,C){var j={name:w,delta:S,target:N,should:C,shadowParent:vK(N)};e.current.push(j),setTimeout(function(){e.current=e.current.filter(function(A){return A!==j})},1)},[]),g=_.useCallback(function(w){n.current=Dh(w),r.current=void 0},[]),p=_.useCallback(function(w){h(w.type,sC(w),w.target,u(w,t.lockRef.current))},[]),x=_.useCallback(function(w){h(w.type,Dh(w),w.target,u(w,t.lockRef.current))},[]);_.useEffect(function(){return Ll.push(a),t.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:x}),document.addEventListener("wheel",f,Il),document.addEventListener("touchmove",f,Il),document.addEventListener("touchstart",g,Il),function(){Ll=Ll.filter(function(w){return w!==a}),document.removeEventListener("wheel",f,Il),document.removeEventListener("touchmove",f,Il),document.removeEventListener("touchstart",g,Il)}},[]);var y=t.removeScrollBar,k=t.inert;return _.createElement(_.Fragment,null,k?_.createElement(a,{styles:mK(s)}):null,y?_.createElement(iK,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function vK(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const xK=KV(cO,gK);var bp=_.forwardRef(function(t,e){return _.createElement(yp,Gs({},t,{ref:e,sideCar:xK}))});bp.classNames=yp.classNames;var wp="Popover",[mO,JQ]=Ka(wp,[Rc]),Vd=Rc(),[yK,Ga]=mO(wp),pO=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:l=!1}=t,u=Vd(e),f=_.useRef(null),[h,g]=_.useState(!1),[p,x]=zo({prop:r,defaultProp:s??!1,onChange:a,caller:wp});return c.jsx(y0,{...u,children:c.jsx(yK,{scope:e,contentId:Pa(),triggerRef:f,open:p,onOpenChange:x,onOpenToggle:_.useCallback(()=>x(y=>!y),[x]),hasCustomAnchor:h,onCustomAnchorAdd:_.useCallback(()=>g(!0),[]),onCustomAnchorRemove:_.useCallback(()=>g(!1),[]),modal:l,children:n})})};pO.displayName=wp;var gO="PopoverAnchor",bK=_.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Ga(gO,n),a=Vd(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:u}=s;return _.useEffect(()=>(l(),()=>u()),[l,u]),c.jsx(op,{...a,...r,ref:e})});bK.displayName=gO;var vO="PopoverTrigger",xO=_.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Ga(vO,n),a=Vd(n),l=Bt(e,s.triggerRef),u=c.jsx(Ct.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":kO(s.open),...r,ref:l,onClick:bt(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?u:c.jsx(op,{asChild:!0,...a,children:u})});xO.displayName=vO;var X0="PopoverPortal",[wK,_K]=mO(X0,{forceMount:void 0}),yO=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,a=Ga(X0,e);return c.jsx(wK,{scope:e,forceMount:n,children:c.jsx(Yi,{present:n||a.open,children:c.jsx(Fd,{asChild:!0,container:s,children:r})})})};yO.displayName=X0;var yc="PopoverContent",bO=_.forwardRef((t,e)=>{const n=_K(yc,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,a=Ga(yc,t.__scopePopover);return c.jsx(Yi,{present:r||a.open,children:a.modal?c.jsx(SK,{...s,ref:e}):c.jsx(jK,{...s,ref:e})})});bO.displayName=yc;var kK=Lo("PopoverContent.RemoveScroll"),SK=_.forwardRef((t,e)=>{const n=Ga(yc,t.__scopePopover),r=_.useRef(null),s=Bt(e,r),a=_.useRef(!1);return _.useEffect(()=>{const l=r.current;if(l)return Q0(l)},[]),c.jsx(bp,{as:kK,allowPinchZoom:!0,children:c.jsx(wO,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:bt(t.onCloseAutoFocus,l=>{var u;l.preventDefault(),a.current||(u=n.triggerRef.current)==null||u.focus()}),onPointerDownOutside:bt(t.onPointerDownOutside,l=>{const u=l.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0,h=u.button===2||f;a.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:bt(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),jK=_.forwardRef((t,e)=>{const n=Ga(yc,t.__scopePopover),r=_.useRef(!1),s=_.useRef(!1);return c.jsx(wO,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,u;(l=t.onCloseAutoFocus)==null||l.call(t,a),a.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{var f,h;(f=t.onInteractOutside)==null||f.call(t,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=a.target;((h=n.triggerRef.current)==null?void 0:h.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),wO=_.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,...p}=t,x=Ga(yc,n),y=Vd(n);return W0(),c.jsx(xp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:c.jsx($d,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:g,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:h,onDismiss:()=>x.onOpenChange(!1),children:c.jsx(b0,{"data-state":kO(x.open),role:"dialog",id:x.contentId,...y,...p,ref:e,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),_O="PopoverClose",NK=_.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Ga(_O,n);return c.jsx(Ct.button,{type:"button",...r,ref:e,onClick:bt(t.onClick,()=>s.onOpenChange(!1))})});NK.displayName=_O;var CK="PopoverArrow",EK=_.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Vd(n);return c.jsx(w0,{...s,...r,ref:e})});EK.displayName=CK;function kO(t){return t?"open":"closed"}var TK=pO,AK=xO,OK=yO,RK=bO;function SO({...t}){return c.jsx(TK,{"data-slot":"popover",...t})}function jO({...t}){return c.jsx(AK,{"data-slot":"popover-trigger",...t})}function NO({className:t,align:e="center",sideOffset:n=4,...r}){return c.jsx(OK,{children:c.jsx(RK,{"data-slot":"popover-content",align:e,sideOffset:n,className:ae("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...r})})}const Td=({children:t,...e})=>c.jsx(SO,{...e,children:t}),Ad=jO,bc=_.forwardRef(({className:t,align:e="end",sideOffset:n=4,...r},s)=>c.jsx(NO,{ref:s,align:e,sideOffset:n,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r}));bc.displayName="DropdownMenuContent";const $t=_.forwardRef(({className:t,disabled:e,...n},r)=>c.jsx("div",{ref:r,className:ae("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pointer-events-none opacity-50",!e&&"hover:bg-accent hover:text-accent-foreground cursor-pointer",t),...n}));$t.displayName="DropdownMenuItem";const Pi=_.forwardRef(({className:t,...e},n)=>c.jsx("div",{ref:n,className:ae("-mx-1 my-1 h-px bg-muted",t),...e}));Pi.displayName="DropdownMenuSeparator";function MK({onImageAttach:t,onPdfAttach:e,onAudioAttach:n,className:r,supports:s,useLargeBreakpoint:a=!1}){const[l,u]=nt.useState(!1),f=(s==null?void 0:s.image)!==!1,h=(s==null?void 0:s.pdf)!==!1,g=(s==null?void 0:s.audio)!==!1;return c.jsxs(Td,{open:l,onOpenChange:u,children:[c.jsx(Ad,{asChild:!0,children:c.jsxs(ye,{variant:"ghost",size:"sm",className:ae("h-8 px-2 text-sm text-muted-foreground hover:text-foreground rounded-full",a?"lg:px-3":"md:px-3",r),"aria-label":"Attach File",children:[c.jsx(Mj,{className:ae("h-3 w-3",a?"lg:mr-1.5":"md:mr-1.5")}),c.jsx("span",{className:ae("hidden",a?"lg:inline":"md:inline"),children:"Attach"})]})}),c.jsxs(bc,{side:"top",align:"start",children:[c.jsx($t,{onClick:()=>{f&&(t(),u(!1))},className:f?void 0:"opacity-50 cursor-not-allowed","aria-disabled":!f,children:c.jsx(Os,{children:c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsxs("div",{className:"flex items-center",children:[c.jsx(Mj,{className:"h-4 w-4 mr-2"})," Image"]})}),!f&&c.jsx(Lt,{side:"bottom",children:"Unsupported for this model"})]})})}),c.jsx($t,{onClick:()=>{h&&(e(),u(!1))},className:h?void 0:"opacity-50 cursor-not-allowed","aria-disabled":!h,children:c.jsx(Os,{children:c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsxs("div",{className:"flex items-center",children:[c.jsx(nc,{className:"h-4 w-4 mr-2"})," PDF"]})}),!h&&c.jsx(Lt,{side:"bottom",children:"Unsupported for this model"})]})})}),c.jsx($t,{onClick:()=>{g&&(n(),u(!1))},className:g?void 0:"opacity-50 cursor-not-allowed","aria-disabled":!g,children:c.jsx(Os,{children:c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsxs("div",{className:"flex items-center",children:[c.jsx(ko,{className:"h-4 w-4 mr-2"})," Audio file"]})}),!g&&c.jsx(Lt,{side:"bottom",children:"Unsupported for this model"})]})})})]})]})}function DK({isRecording:t,onToggleRecording:e,className:n,disabled:r,useLargeBreakpoint:s=!1}){const a=c.jsxs(ye,{variant:"ghost",size:"sm",onClick:()=>{r||e()},className:ae("h-8 px-2 text-sm rounded-full",s?"lg:px-3":"md:px-3",r?"opacity-50 cursor-not-allowed":"text-muted-foreground hover:text-foreground",n),"aria-label":t?"Stop recording":"Record audio","aria-disabled":r?!0:void 0,children:[t?c.jsx(y$,{className:ae("h-3 w-3 text-red-500",s?"lg:mr-1.5":"md:mr-1.5")}):c.jsx(XE,{className:ae("h-3 w-3",s?"lg:mr-1.5":"md:mr-1.5")}),c.jsx("span",{className:ae("hidden",s?"lg:inline":"md:inline"),children:t?"Stop":"Record"})]});return r?c.jsx(Os,{children:c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:a}),c.jsx(Lt,{side:"bottom",children:"Unsupported for this model"})]})}):a}function CO(t){const e=(t==null?void 0:t.mode)??"grouped";return Tr({queryKey:[...Xe.llm.catalog,e],queryFn:async()=>{const n=await mt.api.llm.catalog.$get({query:{mode:e}});if(!n.ok)throw new Error(`Failed to fetch LLM catalog: ${n.status}`);return await n.json()},enabled:(t==null?void 0:t.enabled)??!0,staleTime:300*1e3})}function IK(){const t=An();return On({mutationFn:async e=>{const n=await mt.api.llm.switch.$post({json:e});if(!n.ok)throw new Error(`Failed to switch LLM: ${n.status}`);return await n.json()},onSuccess:()=>{t.invalidateQueries({queryKey:Xe.llm.catalog})}})}function LK(){const t=An();return On({mutationFn:async e=>{const n=await mt.api.llm.key.$post({json:e});if(!n.ok)throw new Error(`Failed to save API key: ${n.status}`);return await n.json()},onSuccess:()=>{t.invalidateQueries({queryKey:Xe.llm.catalog})}})}const PK=S0("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function ds({className:t,variant:e,...n}){return c.jsx("div",{"data-slot":"alert",role:"alert",className:ae(PK({variant:e}),t),...n})}function $K({className:t,...e}){return c.jsx("div",{"data-slot":"alert-title",className:ae("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...e})}function fs({className:t,...e}){return c.jsx("div",{"data-slot":"alert-description",className:ae("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...e})}var _p="Dialog",[EO,eX]=Ka(_p),[zK,Ps]=EO(_p),TO=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:l=!0}=t,u=_.useRef(null),f=_.useRef(null),[h,g]=zo({prop:r,defaultProp:s??!1,onChange:a,caller:_p});return c.jsx(zK,{scope:e,triggerRef:u,contentRef:f,contentId:Pa(),titleId:Pa(),descriptionId:Pa(),open:h,onOpenChange:g,onOpenToggle:_.useCallback(()=>g(p=>!p),[g]),modal:l,children:n})};TO.displayName=_p;var AO="DialogTrigger",FK=_.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Ps(AO,n),a=Bt(e,s.triggerRef);return c.jsx(Ct.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":tw(s.open),...r,ref:a,onClick:bt(t.onClick,s.onOpenToggle)})});FK.displayName=AO;var J0="DialogPortal",[BK,OO]=EO(J0,{forceMount:void 0}),RO=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:s}=t,a=Ps(J0,e);return c.jsx(BK,{scope:e,forceMount:n,children:_.Children.map(r,l=>c.jsx(Yi,{present:n||a.open,children:c.jsx(Fd,{asChild:!0,container:s,children:l})}))})};RO.displayName=J0;var zm="DialogOverlay",MO=_.forwardRef((t,e)=>{const n=OO(zm,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,a=Ps(zm,t.__scopeDialog);return a.modal?c.jsx(Yi,{present:r||a.open,children:c.jsx(qK,{...s,ref:e})}):null});MO.displayName=zm;var UK=Lo("DialogOverlay.RemoveScroll"),qK=_.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Ps(zm,n);return c.jsx(bp,{as:UK,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(Ct.div,{"data-state":tw(s.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Bo="DialogContent",DO=_.forwardRef((t,e)=>{const n=OO(Bo,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,a=Ps(Bo,t.__scopeDialog);return c.jsx(Yi,{present:r||a.open,children:a.modal?c.jsx(HK,{...s,ref:e}):c.jsx(VK,{...s,ref:e})})});DO.displayName=Bo;var HK=_.forwardRef((t,e)=>{const n=Ps(Bo,t.__scopeDialog),r=_.useRef(null),s=Bt(e,n.contentRef,r);return _.useEffect(()=>{const a=r.current;if(a)return Q0(a)},[]),c.jsx(IO,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:bt(t.onCloseAutoFocus,a=>{var l;a.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:bt(t.onPointerDownOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&a.preventDefault()}),onFocusOutside:bt(t.onFocusOutside,a=>a.preventDefault())})}),VK=_.forwardRef((t,e)=>{const n=Ps(Bo,t.__scopeDialog),r=_.useRef(!1),s=_.useRef(!1);return c.jsx(IO,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,u;(l=t.onCloseAutoFocus)==null||l.call(t,a),a.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{var f,h;(f=t.onInteractOutside)==null||f.call(t,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=a.target;((h=n.triggerRef.current)==null?void 0:h.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),IO=_.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,...l}=t,u=Ps(Bo,n),f=_.useRef(null),h=Bt(e,f);return W0(),c.jsxs(c.Fragment,{children:[c.jsx(xp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:c.jsx($d,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":tw(u.open),...l,ref:h,onDismiss:()=>u.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(KK,{titleId:u.titleId}),c.jsx(GK,{contentRef:f,descriptionId:u.descriptionId})]})]})}),ew="DialogTitle",LO=_.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Ps(ew,n);return c.jsx(Ct.h2,{id:s.titleId,...r,ref:e})});LO.displayName=ew;var PO="DialogDescription",$O=_.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Ps(PO,n);return c.jsx(Ct.p,{id:s.descriptionId,...r,ref:e})});$O.displayName=PO;var zO="DialogClose",FO=_.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Ps(zO,n);return c.jsx(Ct.button,{type:"button",...r,ref:e,onClick:bt(t.onClick,()=>s.onOpenChange(!1))})});FO.displayName=zO;function tw(t){return t?"open":"closed"}var BO="DialogTitleWarning",[tX,UO]=Hz(BO,{contentName:Bo,titleName:ew,docsSlug:"dialog"}),KK=({titleId:t})=>{const e=UO(BO),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
523
|
-
|
|
524
|
-
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
525
|
-
|
|
526
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return _.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},YK="DialogDescriptionWarning",GK=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${UO(YK).contentName}}.`;return _.useEffect(()=>{var a;const s=(a=t.current)==null?void 0:a.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},ZK=TO,WK=RO,QK=MO,XK=DO,JK=LO,eY=$O,qO=FO;function rr({...t}){return c.jsx(ZK,{"data-slot":"dialog",...t})}function tY({...t}){return c.jsx(WK,{"data-slot":"dialog-portal",...t})}function HO({...t}){return c.jsx(qO,{"data-slot":"dialog-close",...t})}function nY({className:t,...e}){return c.jsx(QK,{"data-slot":"dialog-overlay",className:ae("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",t),...e})}function sr({className:t,children:e,hideCloseButton:n=!1,...r}){return c.jsxs(tY,{"data-slot":"dialog-portal",children:[c.jsx(nY,{}),c.jsxs(XK,{"data-slot":"dialog-content",className:ae("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-150 sm:max-w-lg",t),...r,children:[e,!n&&c.jsxs(qO,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[c.jsx(Er,{}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ir({className:t,...e}){return c.jsx("div",{"data-slot":"dialog-header",className:ae("flex flex-col gap-2 text-center sm:text-left",t),...e})}function Kr({className:t,...e}){return c.jsx("div",{"data-slot":"dialog-footer",className:ae("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function ar({className:t,...e}){return c.jsx(JK,{"data-slot":"dialog-title",className:ae("text-lg leading-none font-semibold",t),...e})}function Yr({className:t,...e}){return c.jsx(eY,{"data-slot":"dialog-description",className:ae("text-muted-foreground text-sm",t),...e})}function st({className:t,type:e,...n}){return c.jsx("input",{type:e,"data-slot":"input",className:ae("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...n})}var rY="Label",VO=_.forwardRef((t,e)=>c.jsx(Ct.label,{...t,ref:e,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=t.onMouseDown)==null||s.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));VO.displayName=rY;var sY=VO;function Qt({className:t,...e}){return c.jsx(sY,{"data-slot":"label",className:ae("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}function iY({open:t,onOpenChange:e,provider:n,primaryEnvVar:r,onSaved:s}){const[a,l]=_.useState(""),[u,f]=_.useState(null),h=LK(),g=()=>{if(!a.trim()){f("API key is required");return}f(null),h.mutate({provider:n,apiKey:a},{onSuccess:p=>{s({provider:p.provider,envVar:p.envVar}),e(!1),l(""),f(null)},onError:p=>{f(p.message||"Failed to save API key")}})};return c.jsx(rr,{open:t,onOpenChange:e,children:c.jsxs(sr,{className:"max-w-md",children:[c.jsxs(ir,{children:[c.jsxs(ar,{children:["Set ",n," API Key"]}),c.jsxs(Yr,{children:["This key will be stored in your .env (env var ",r,"). It is not shared with the client."]})]}),u&&c.jsx(ds,{variant:"destructive",children:c.jsx(fs,{children:u})}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qt,{htmlFor:"apiKey",children:"API Key"}),c.jsx(st,{id:"apiKey",type:"password",value:a,onChange:p=>l(p.target.value),placeholder:`Enter ${n} API key`})]}),c.jsxs(Kr,{children:[c.jsx(ye,{variant:"outline",onClick:()=>e(!1),disabled:h.isPending,children:"Cancel"}),c.jsx(ye,{onClick:g,disabled:h.isPending,children:h.isPending?"Saving...":"Save"})]})]})})}function aY({value:t,onChange:e,placeholder:n="Search models...",autoFocus:r=!0}){const s=_.useRef(null);return _.useEffect(()=>{r&&s.current&&setTimeout(()=>{var a;(a=s.current)==null||a.focus()},100)},[r]),c.jsxs("div",{className:"relative",children:[c.jsx(As,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),c.jsx("input",{ref:s,type:"text",placeholder:n,value:t,onChange:a=>e(a.target.value),className:ae("w-full h-11 pl-10 pr-10 rounded-xl","bg-muted/50 border border-border/50","text-sm placeholder:text-muted-foreground/70","focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/50","transition-all duration-200")}),t&&c.jsx("button",{type:"button",onClick:()=>e(""),className:"absolute right-3 top-1/2 -translate-y-1/2 p-1 rounded-full hover:bg-accent transition-colors","aria-label":"Clear search",children:c.jsx(Er,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})}const Ea={openai:"/logos/openai.svg",anthropic:"/logos/claude-color.svg",google:"/logos/gemini-color.svg",groq:"/logos/groq.svg",xai:"/logos/grok.svg","openai-compatible":"/logos/openai.svg",cohere:"/logos/cohere-color.svg"};function oY(t){if(!t)return[];const n=(t.currency||"USD")==="USD"?"$":"",r=[];return r.push(`Cost: ${n}${t.inputPerM.toFixed(2)} in / ${n}${t.outputPerM.toFixed(2)} out per 1M tokens`),t.cacheReadPerM!=null&&r.push(`Cache read: ${n}${t.cacheReadPerM.toFixed(2)} per 1M tokens`),t.cacheWritePerM!=null&&r.push(`Cache write: ${n}${t.cacheWritePerM.toFixed(2)} per 1M tokens`),r}const lY=["google","cohere","anthropic"],em=t=>!lY.includes(t);function Yu({icon:t,label:e,variant:n="default"}){const r={default:"bg-muted/80 text-muted-foreground hover:bg-muted hover:text-foreground",warning:"bg-amber-500/10 text-amber-500 hover:bg-amber-500/20",success:"bg-emerald-500/10 text-emerald-500 hover:bg-emerald-500/20",info:"bg-blue-500/10 text-blue-500 hover:bg-blue-500/20"};return c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx("div",{className:ae("flex items-center justify-center w-7 h-7 rounded-lg transition-all duration-200 cursor-default",r[n]),children:t})}),c.jsx(Lt,{side:"top",className:"text-xs",children:e})]})}function cY({supportedFileTypes:t,hasApiKey:e,showReasoning:n,showLockIcon:r=!0,className:s,size:a="sm"}){const l=a==="sm"?"h-3.5 w-3.5":"h-4 w-4";return c.jsxs("div",{className:ae("flex items-center gap-1",s),children:[t.includes("image")&&c.jsx(Yu,{icon:c.jsx(c0,{className:l}),label:"Vision / Image support",variant:"success"}),t.includes("pdf")&&c.jsx(Yu,{icon:c.jsx(ZE,{className:l}),label:"PDF support",variant:"info"}),t.includes("audio")&&c.jsx(Yu,{icon:c.jsx(XE,{className:l}),label:"Audio support",variant:"info"}),n&&c.jsx(Yu,{icon:c.jsx(Io,{className:l}),label:"Extended thinking",variant:"default"}),r&&!e&&c.jsx(Yu,{icon:c.jsx(QE,{className:l}),label:"Click to add API key",variant:"warning"})]})}const uY={anthropic:"Claude",google:"Gemini",openai:"GPT",groq:"Groq",xai:"Grok",cohere:"Cohere","openai-compatible":"Custom"};function dY(t,e){const n=uY[e]||e,r=t.match(/\(([^)]+)\)$/),s=r?r[1]:void 0,a=s?t.replace(/\s*\([^)]+\)$/,""):t;let l=a;const u=a.toLowerCase(),f=n.toLowerCase();return u.startsWith(f)&&(l=a.slice(n.length).trim()),l=l.replace(/^[-\s]+/,"").replace(/^(claude|gemini|gpt|grok)\s*/i,""),{providerName:n,modelName:l||a,suffix:s}}function fY({provider:t,model:e,providerInfo:n,isFavorite:r,isActive:s,onClick:a,onToggleFavorite:l,size:u="md"}){const f=e.displayName||e.name,h=n.hasApiKey,{providerName:g,modelName:p,suffix:x}=dY(f,t),y=oY(e.pricing||void 0),k=[`Model: ${f}`,`Provider: ${n.name}`,`Max tokens: ${e.maxInputTokens.toLocaleString()}`,e.supportedFileTypes.length>0&&`Supports: ${e.supportedFileTypes.join(", ")}`,!h&&"API key required (click to add)",...y].filter(Boolean),w={sm:"px-2 py-4 h-[200px] w-full",md:"px-3 py-5 h-[230px] w-full",lg:"px-4 py-6 h-[275px] w-full"},S={sm:{width:36,height:36,container:"w-10 h-10"},md:{width:48,height:48,container:"w-14 h-14"},lg:{width:60,height:60,container:"w-16 h-16"}};return c.jsx(Os,{children:c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsxs("div",{onClick:a,onKeyDown:N=>{const C=N.target;if(C&&C.closest("button"))return;const j=N.key==="Enter",A=N.key===" "||N.key==="Spacebar"||N.code==="Space";!j&&!A||(A&&N.preventDefault(),a())},className:ae("relative flex flex-col items-center rounded-2xl border-2 transition-all duration-200 cursor-pointer group overflow-hidden",w[u],"hover:bg-accent/40 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/5 hover:-translate-y-0.5",s?"bg-primary/10 border-primary shadow-lg shadow-primary/10":"border-border/50 bg-card/60 backdrop-blur-sm",!h&&"opacity-70"),role:"button",tabIndex:0,children:[!h&&c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx("div",{className:"absolute top-2 left-2 p-1.5 rounded-full bg-amber-500/20 z-10",children:c.jsx(QE,{className:"h-3.5 w-3.5 text-amber-500"})})}),c.jsx(Lt,{side:"top",className:"text-xs",children:"Click to add API key"})]}),c.jsx("button",{onClick:N=>{N.stopPropagation(),l()},className:ae("absolute top-2 right-2 p-1.5 rounded-full transition-all duration-200 z-10","hover:bg-yellow-500/20 hover:scale-110 active:scale-95","opacity-0 group-hover:opacity-100",r&&"opacity-100"),"aria-label":r?"Remove from favorites":"Add to favorites",children:c.jsx(kd,{className:ae("h-4 w-4 transition-all duration-200",r?"fill-yellow-400 text-yellow-400 drop-shadow-[0_0_3px_rgba(250,204,21,0.5)]":"text-muted-foreground/60 hover:text-yellow-400")})}),c.jsx("div",{className:ae("flex items-center justify-center rounded-xl bg-muted/60 mb-1.5",S[u].container),children:Ea[t]?c.jsx("img",{src:Ea[t],alt:`${t} logo`,width:S[u].width,height:S[u].height,className:ae("object-contain",em(t)&&"dark:invert dark:brightness-0 dark:contrast-200")}):c.jsx(KE,{className:"h-6 w-6 text-muted-foreground"})}),c.jsxs("div",{className:"text-center flex-1 flex flex-col min-w-0 w-full",children:[c.jsx("div",{className:ae("font-bold text-foreground leading-tight",u==="sm"?"text-base":"text-lg"),children:g}),c.jsx("div",{className:ae("text-muted-foreground leading-tight mt-0.5 line-clamp-3",u==="sm"?"text-sm":"text-base"),children:p}),x&&c.jsxs("div",{className:"text-xs text-primary/90 font-medium mt-1",children:["(",x,")"]})]}),c.jsx("div",{className:"mt-auto pt-2 h-8 flex items-center justify-center",children:c.jsx(cY,{supportedFileTypes:e.supportedFileTypes,hasApiKey:h,showLockIcon:!1,size:u==="sm"?"sm":"md"})})]})}),c.jsx(Lt,{side:"bottom",className:"max-w-xs",children:c.jsx("div",{className:"text-xs space-y-0.5",children:k.map((N,C)=>c.jsx("div",{children:N},C))})})]})})}function ey(t,e){return`${t}|${e}`}function aC(t){const e=t.trim();if(!e.length)return{isValid:!0};try{const n=new URL(e);return["http:","https:"].includes(n.protocol)?n.pathname.includes("/v1")?{isValid:!0}:{isValid:!1,error:"URL must include /v1 for compatibility"}:{isValid:!1,error:"URL must use http:// or https://"}}catch{return{isValid:!1,error:"Invalid URL format"}}}const oC="dexto:modelFavorites",ty="dexto:customModels",hY=["anthropic|claude-sonnet-4-5-20250929","anthropic|claude-opus-4-5-20251101","openai|gpt-5.1-chat-latest","openai|gpt-5.1","google|gemini-3-pro-preview","google|gemini-3-pro-image-preview"];function mY(){var De;const[t,e]=_.useState(!1),[n,r]=_.useState({}),[s,a]=_.useState(""),[l,u]=_.useState(""),[f,h]=_.useState(""),[g,p]=_.useState(null),[x,y]=_.useState("all"),[k,w]=_.useState("all"),[S,N]=_.useState(!1),[C,j]=_.useState([]),[A,I]=_.useState({name:"",baseURL:"",maxInputTokens:"",maxOutputTokens:""}),[T,E]=_.useState(!1),[R,z]=_.useState(null),[D,B]=_.useState(null),{currentSessionId:q,currentLLM:K,refreshCurrentLLM:G}=Ld(),F=Nc(),M=_.useRef(F);_.useEffect(()=>{M.current=F},[F]);const{data:V,isLoading:U,error:H}=CO({enabled:t});_.useEffect(()=>{V&&"providers"in V&&r(V.providers)},[V]),_.useEffect(()=>{t&&K&&(u(K.router||"vercel"),h(K.baseURL||""))},[t,K]);const[L,ne]=_.useState([]);_.useEffect(()=>{if(t)try{const ve=localStorage.getItem(oC),ue=ve!==null?JSON.parse(ve):hY;ne(ue);const Ce=localStorage.getItem(ty),ze=Ce?JSON.parse(Ce):[];j(ze)}catch(ve){console.warn("Failed to load favorites/custom models from localStorage:",ve),ne([]),j([])}},[t]);const ie=_.useCallback((ve,ue)=>{const Ce=ey(ve,ue);ne(ze=>{const be=ze.includes(Ce)?ze.filter(Se=>Se!==Ce):[...ze,Ce];return localStorage.setItem(oC,JSON.stringify(be)),be})},[]),P=_.useCallback(()=>{const{name:ve,baseURL:ue,maxInputTokens:Ce,maxOutputTokens:ze}=A;if(!ve.trim()||!ue.trim()){p("Model name and Base URL are required");return}const be=aC(ue);if(!be.isValid){p(be.error||"Invalid Base URL");return}const Se={name:ve.trim(),baseURL:ue.trim(),maxInputTokens:Ce&&parseInt(Ce,10)||void 0,maxOutputTokens:ze&&parseInt(ze,10)||void 0},ot=[...C,Se];j(ot),localStorage.setItem(ty,JSON.stringify(ot)),I({name:"",baseURL:"",maxInputTokens:"",maxOutputTokens:""}),N(!1),p(null)},[A,C]),pe=_.useCallback(ve=>{const ue=C.filter(Ce=>Ce.name!==ve);j(ue),localStorage.setItem(ty,JSON.stringify(ue))},[C]),Pe=_.useCallback((ve,ue)=>{var ze,be;const Ce=s.trim().toLowerCase();return Ce?ue.name.toLowerCase().includes(Ce)||(((ze=ue.displayName)==null?void 0:ze.toLowerCase().includes(Ce))??!1)||ve.toLowerCase().includes(Ce)||(((be=n[ve])==null?void 0:be.name.toLowerCase().includes(Ce))??!1):!0},[s,n]);function Ne(ve,ue){var ot;const Ce=(K==null?void 0:K.router)||"vercel",ze=((ot=n[ve])==null?void 0:ot.supportedRouters)??["vercel"],be=ue.supportedRouters??ze,Se=l||Ce;return be.includes(Se)?Se:be[0]||ze[0]||"vercel"}const ge=IK();function Fe(ve,ue,Ce,ze=!1){const be=n[ve],Se=Ce||f,ot=(be==null?void 0:be.supportsBaseURL)??!!Se;if(ot&&Se){const me=aC(Se);if(!me.isValid){p(me.error||"Invalid base URL");return}}if(!ze&&be&&!be.hasApiKey){B({provider:ve,model:ue}),z(ve),E(!0);return}const dt=Ne(ve,ue),J={provider:ve,model:ue.name,router:dt,...ot&&Se&&{baseURL:Se},...q&&{sessionId:q}};ge.mutate(J,{onSuccess:async()=>{await G(),K&&M.current.trackLLMSwitched({fromProvider:K.provider,fromModel:K.model,toProvider:ve,toModel:ue.name,sessionId:q||void 0,trigger:"user_action"}),e(!1),p(null)},onError:me=>{p(me.message)}})}function Qe(ve){const ue={name:ve.name,displayName:ve.name,maxInputTokens:ve.maxInputTokens||128e3,supportedFileTypes:["pdf","image","audio"],supportedRouters:["vercel","in-built"]};Fe("openai-compatible",ue,ve.baseURL)}function $e(ve){const ue=ve.provider;if(r(Ce=>({...Ce,[ue]:Ce[ue]?{...Ce[ue],hasApiKey:!0}:Ce[ue]})),E(!1),D){const{provider:Ce,model:ze}=D;Fe(Ce,ze,void 0,!0),B(null)}}const Q=(K==null?void 0:K.displayName)||(K==null?void 0:K.model)||"Choose Model",_e=!q,Oe=_.useMemo(()=>L.map(ve=>{const[ue,Ce]=ve.split("|"),ze=ue;if(!Kh.includes(ze))return null;const be=n[ze],Se=be==null?void 0:be.models.find(ot=>ot.name===Ce);return!be||!Se?null:{providerId:ze,provider:be,model:Se}}).filter(Boolean),[L,n]),le=_.useMemo(()=>{const ve=[];for(const ue of Kh){if(x!=="all"&&ue!==x)continue;const Ce=n[ue];if(Ce)for(const ze of Ce.models)Pe(ue,ze)&&ve.push({providerId:ue,provider:Ce,model:ze})}return ve},[n,x,Pe]),he=_.useMemo(()=>Kh.filter(ve=>{var ue;return(ue=n[ve])==null?void 0:ue.models.length}),[n]),Ee=(ve,ue)=>(K==null?void 0:K.provider)===ve&&(K==null?void 0:K.model)===ue;return c.jsxs(c.Fragment,{children:[c.jsxs(SO,{open:t,onOpenChange:e,children:[c.jsx(jO,{asChild:!0,children:c.jsxs(ye,{variant:"ghost",size:"sm",className:"flex items-center gap-2 cursor-pointer",title:"Choose model",children:[K!=null&&K.provider&&Ea[K.provider]?c.jsx("img",{src:Ea[K.provider],alt:`${K.provider} logo`,width:16,height:16,className:ae("object-contain",em(K.provider)&&"dark:invert dark:brightness-0 dark:contrast-200")}):c.jsx(tc,{className:"h-4 w-4"}),c.jsx("span",{className:"text-sm",children:Q}),c.jsx(Ar,{className:ae("h-3 w-3 transition-transform",t&&"rotate-180")})]})}),c.jsxs(NO,{side:"top",align:"end",sideOffset:8,avoidCollisions:!0,collisionPadding:16,className:ae("w-[calc(100vw-32px)] max-w-[650px]",_e?"max-h-[min(400px,50vh)]":"max-h-[min(580px,75vh)]","flex flex-col p-0 overflow-hidden","rounded-xl border border-border/60 bg-popover/98 backdrop-blur-xl shadow-xl"),children:[c.jsxs("div",{className:"flex-shrink-0 px-3 pt-3 pb-2 border-b border-border/30 space-y-2",children:[(g||H)&&c.jsx(ds,{variant:"destructive",className:"py-2",children:c.jsx(fs,{className:"text-xs",children:g||(H==null?void 0:H.message)})}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"flex-1",children:c.jsx(aY,{value:s,onChange:a,placeholder:"Search models..."})}),c.jsx("button",{onClick:()=>N(!S),className:ae("p-2 rounded-lg transition-colors flex-shrink-0",S?"bg-primary text-primary-foreground":"bg-muted/50 text-muted-foreground hover:text-foreground hover:bg-muted"),title:"Add custom model",children:c.jsx(us,{className:"h-4 w-4"})})]}),k==="all"&&he.length>1&&c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap pt-1",children:[c.jsx($$,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"}),c.jsx("button",{onClick:()=>y("all"),className:ae("px-2 py-1 text-[11px] font-medium rounded-md transition-colors",x==="all"?"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30":"bg-muted/50 text-muted-foreground hover:bg-muted hover:text-foreground"),children:"All"}),he.map(ve=>{var ue;return c.jsxs("button",{onClick:()=>y(ve),className:ae("flex items-center gap-1 px-2 py-1 text-[11px] font-medium rounded-md transition-colors",x===ve?"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30":"bg-muted/50 text-muted-foreground hover:bg-muted hover:text-foreground"),children:[Ea[ve]&&c.jsx("img",{src:Ea[ve],alt:"",width:10,height:10,className:ae("object-contain",em(ve)&&x!==ve&&"dark:invert dark:brightness-0 dark:contrast-200")}),c.jsx("span",{className:"hidden sm:inline",children:((ue=n[ve])==null?void 0:ue.name)||ve})]},ve)})]})]}),S&&c.jsxs("div",{className:"flex-shrink-0 px-3 py-3 border-b border-border/30 bg-muted/10",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-xs font-medium text-foreground",children:"Add Custom Model"}),c.jsx("button",{onClick:()=>N(!1),className:"p-1 rounded hover:bg-muted transition-colors",children:c.jsx(Er,{className:"h-3 w-3 text-muted-foreground"})})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsx(st,{value:A.name,onChange:ve=>I(ue=>({...ue,name:ve.target.value})),placeholder:"Model name *",className:"h-8 text-xs"}),c.jsx(st,{value:A.baseURL,onChange:ve=>I(ue=>({...ue,baseURL:ve.target.value})),placeholder:"Base URL *",className:"h-8 text-xs"}),c.jsx(st,{value:A.maxInputTokens,onChange:ve=>I(ue=>({...ue,maxInputTokens:ve.target.value})),placeholder:"Max input tokens (default: 128k)",type:"number",className:"h-8 text-xs"}),c.jsx(st,{value:A.maxOutputTokens,onChange:ve=>I(ue=>({...ue,maxOutputTokens:ve.target.value})),placeholder:"Max output tokens (optional)",type:"number",className:"h-8 text-xs"})]}),c.jsxs(ye,{onClick:P,size:"sm",className:"w-full h-8 text-xs",children:[c.jsx(us,{className:"h-3 w-3 mr-1"}),"Add Model"]})]}),C.length>0&&c.jsxs("div",{className:"mt-3 pt-3 border-t border-border/30",children:[c.jsx("span",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wide",children:"Saved Custom Models"}),c.jsx("div",{className:"flex gap-1.5 mt-2 flex-wrap",children:C.map(ve=>c.jsxs("div",{className:"group flex items-center gap-1.5 px-2 py-1 rounded-md bg-card/60 border border-border/40 text-[11px]",children:[c.jsx(tc,{className:"h-2.5 w-2.5 text-muted-foreground"}),c.jsx("button",{className:"hover:text-primary transition-colors",onClick:()=>Qe(ve),children:ve.name}),c.jsx("button",{onClick:()=>pe(ve.name),className:"text-muted-foreground hover:text-destructive opacity-0 group-hover:opacity-100 transition-opacity",children:c.jsx(Er,{className:"h-2.5 w-2.5"})})]},ve.name))})]})]}),c.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-3",children:U?c.jsx("div",{className:"flex items-center justify-center py-8",children:c.jsx(Ms,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):k==="favorites"?Oe.length===0?c.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[c.jsx(kd,{className:"h-8 w-8 text-muted-foreground/30 mb-2"}),c.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"No favorites yet"}),c.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:'Click "Show all" to browse and add favorites'})]}):c.jsx("div",{className:"space-y-1",children:Oe.filter(({providerId:ve,model:ue})=>{var ze;if(!s.trim())return!0;const Ce=s.trim().toLowerCase();return ue.name.toLowerCase().includes(Ce)||(((ze=ue.displayName)==null?void 0:ze.toLowerCase().includes(Ce))??!1)||ve.toLowerCase().includes(Ce)}).map(({providerId:ve,model:ue})=>c.jsxs("div",{onClick:()=>Fe(ve,ue),onKeyDown:Ce=>{Ce.target===Ce.currentTarget&&(Ce.key==="Enter"||Ce.key===" ")&&(Ce.preventDefault(),Fe(ve,ue))},role:"button",tabIndex:0,className:ae("w-full flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors cursor-pointer","hover:bg-accent/50",Ee(ve,ue.name)?"bg-primary/10 border border-primary/30":"border border-transparent"),children:[c.jsx("div",{className:"w-8 h-8 flex items-center justify-center rounded-lg bg-muted/60 flex-shrink-0",children:Ea[ve]?c.jsx("img",{src:Ea[ve],alt:"",width:20,height:20,className:ae("object-contain",em(ve)&&"dark:invert dark:brightness-0 dark:contrast-200")}):c.jsx(tc,{className:"h-4 w-4 text-muted-foreground"})}),c.jsx("div",{className:"flex-1 text-left min-w-0",children:c.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:ue.displayName||ue.name})}),c.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[ue.supportedFileTypes.includes("image")&&c.jsx("span",{className:"w-5 h-5 rounded bg-emerald-500/20 flex items-center justify-center",title:"Vision",children:c.jsxs("svg",{className:"w-3 h-3 text-emerald-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})}),ue.supportedFileTypes.includes("pdf")&&c.jsx("span",{className:"w-5 h-5 rounded bg-blue-500/20 flex items-center justify-center",title:"PDF",children:c.jsx("svg",{className:"w-3 h-3 text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})})]}),c.jsx("button",{onClick:Ce=>{Ce.stopPropagation(),ie(ve,ue.name)},className:"p-1 rounded hover:bg-yellow-500/20 transition-colors flex-shrink-0",children:c.jsx(kd,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"})})]},ey(ve,ue.name)))}):c.jsx("div",{children:le.length===0?c.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[c.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"No models found"}),c.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"Try adjusting your search or filters"})]}):c.jsx("div",{className:"grid gap-2 justify-center",style:{gridTemplateColumns:"repeat(auto-fill, 140px)"},children:le.map(({providerId:ve,provider:ue,model:Ce})=>c.jsx(fY,{provider:ve,model:Ce,providerInfo:ue,isFavorite:L.includes(ey(ve,Ce.name)),isActive:Ee(ve,Ce.name),onClick:()=>Fe(ve,Ce),onToggleFavorite:()=>ie(ve,Ce.name),size:"sm"},`${ve}|${Ce.name}`))})})}),c.jsx("div",{className:"flex-shrink-0 border-t border-border/30 px-3 py-2 flex items-center justify-end",children:c.jsxs("button",{onClick:()=>w(k==="favorites"?"all":"favorites"),className:"flex items-center gap-1.5 text-sm font-medium text-primary hover:text-primary/80 transition-colors",children:[k==="favorites"?c.jsxs(c.Fragment,{children:["Show all",c.jsx(Ua,{className:"h-4 w-4"})]}):c.jsxs(c.Fragment,{children:["Favorites",c.jsx(u$,{className:"h-4 w-4 rotate-180"})]}),k==="favorites"&&Oe.length>0&&c.jsx("span",{className:"ml-1 w-2 h-2 rounded-full bg-primary"})]})})]})]}),R&&c.jsx(iY,{open:T,onOpenChange:E,provider:R,primaryEnvVar:((De=n[R])==null?void 0:De.primaryEnvVar)||"",onSaved:$e})]})}function pY(){const[t,e]=_.useState(!1);return _.useEffect(()=>{if(typeof document>"u")return;const n=document;if(!n.fonts||!n.fonts.ready){e(!0);return}let r=!1;return n.fonts.ready.then(()=>{r||e(!0)}),()=>{r=!0}},[]),t}function gY({resources:t,query:e,selectedIndex:n,onSelect:r,onHoverIndex:s,loading:a}){const l=nt.useMemo(()=>qE(t,e),[t,e]),u=nt.useMemo(()=>l.filter(x=>(x.mimeType||"").startsWith("image/")).map(x=>x.uri),[l]),f=H0(u),h=nt.useRef([]);if(nt.useEffect(()=>{const x=h.current[n];x&&x.scrollIntoView&&x.scrollIntoView({block:"nearest"})},[n,l.length]),!e&&l.length===0&&!a)return c.jsxs("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:[c.jsx("div",{children:"No resources available."}),c.jsx("div",{className:"text-xs mt-1 text-muted-foreground/80",children:"Connect an MCP server or enable internal resources to attach references."})]});const g=x=>`resource-option-${btoa(x).replace(/[^a-zA-Z0-9]/g,"")}`,p=l[n]?g(l[n].uri):void 0;return a?c.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"Loading resourcesโฆ"}):l.length===0?c.jsxs("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:[c.jsxs("div",{children:['No resources match "',e,'"']}),c.jsx("div",{className:"text-xs mt-1 text-muted-foreground/80",children:"Tip: @ references only work at start or after spaces"})]}):c.jsxs("ul",{role:"listbox","aria-label":"Resource suggestions","aria-activedescendant":p,className:"py-1 text-sm max-h-64 overflow-y-auto",children:[c.jsx("li",{className:"px-3 py-1.5 text-xs text-muted-foreground/80 border-b border-border",children:"@ references files/resources โข Works at start or after spaces"}),l.map((x,y)=>{const k=g(x.uri);return c.jsxs("li",{id:k,role:"option","aria-selected":y===n,ref:w=>{w&&(h.current[y]=w)},className:"px-3 py-2 cursor-pointer flex items-center gap-3 "+(y===n?"bg-accent text-accent-foreground":"hover:bg-accent hover:text-accent-foreground"),onMouseEnter:()=>s==null?void 0:s(y),onMouseDown:w=>{w.preventDefault(),r(x)},children:[(x.mimeType||"").startsWith("image/")&&c.jsx(vY,{resourceState:f[x.uri]}),c.jsxs("div",{className:"min-w-0 flex-1 mr-2",children:[c.jsx("div",{className:"truncate font-medium",children:x.name||x.uri.split("/").pop()||x.uri}),c.jsx("div",{className:"truncate text-xs text-muted-foreground",children:x.uri})]}),x.serverName&&c.jsx("span",{className:"ml-auto shrink-0 rounded bg-secondary px-2 py-0.5 text-xs text-secondary-foreground",children:x.serverName})]},x.uri)})]})}function vY({resourceState:t}){var r;const e="w-10 h-10 rounded-md border border-border bg-muted/40 flex items-center justify-center overflow-hidden flex-shrink-0";if(!t)return c.jsx("div",{className:e,children:c.jsx(ud,{className:"h-4 w-4 text-muted-foreground"})});if(t.status==="loading")return c.jsx("div",{className:e,children:c.jsx(Ms,{className:"h-4 w-4 animate-spin text-muted-foreground"})});if(t.status==="error")return c.jsx("div",{className:e,title:t.error,children:c.jsx(ud,{className:"h-4 w-4 text-destructive"})});const n=(r=t.data)==null?void 0:r.items.find(s=>s.kind==="image");return!n||!("src"in n)?c.jsx("div",{className:e,children:c.jsx(ud,{className:"h-4 w-4 text-muted-foreground"})}):c.jsx("div",{className:e,children:c.jsx("img",{src:n.src,alt:n.alt||"Resource preview",className:"w-full h-full object-cover"})})}const xY=S0("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function yn({className:t,variant:e,...n}){return c.jsx("div",{className:ae(xY({variant:e}),t),...n})}const yY=({prompt:t,isSelected:e,onClick:n,onMouseEnter:r,dataIndex:s})=>c.jsx("div",{className:`px-3 py-2 cursor-pointer transition-colors ${e?"bg-primary/20 ring-1 ring-primary/40":"hover:bg-primary/10"}`,onClick:n,onMouseEnter:r,"data-index":s,children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx("div",{className:"flex-shrink-0 mt-0.5",children:t.source==="mcp"?c.jsx(np,{className:"h-3 w-3 text-blue-400"}):t.source==="config"?c.jsx("span",{className:"text-xs",children:"๐"}):c.jsx(JE,{className:"h-3 w-3 text-purple-400"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsxs("span",{className:"font-medium text-xs text-foreground",children:["/",t.name]}),t.arguments&&t.arguments.length>0&&c.jsx("span",{className:"flex items-center gap-1",children:t.arguments.map(a=>c.jsxs("span",{className:"group relative inline-block",title:a.description||a.name,children:[c.jsxs("span",{className:"text-xs text-muted-foreground/70 hover:text-muted-foreground cursor-help transition-colors",children:["<",a.name,a.required?"":"?",">"]}),a.description&&c.jsx("span",{className:"invisible group-hover:visible absolute left-0 top-full mt-1 z-50 px-2 py-1 text-[10px] bg-popover text-popover-foreground border border-border rounded shadow-lg whitespace-nowrap pointer-events-none",children:a.description})]},a.name))})]}),t.source==="mcp"&&c.jsx(yn,{variant:"outline",className:"text-xs px-1.5 py-0.5 h-4",children:"MCP"}),t.source==="config"&&c.jsx(yn,{variant:"outline",className:"text-xs px-1.5 py-0.5 h-4",children:"Config"}),t.source==="custom"&&c.jsx(yn,{variant:"outline",className:"text-xs px-1.5 py-0.5 h-4 bg-primary/10 text-primary border-primary/20",children:"Custom"})]}),t.title&&c.jsx("div",{className:"text-xs font-medium text-foreground/90 mb-0.5",children:t.title}),t.description&&t.description!==t.title&&c.jsx("div",{className:"text-xs text-muted-foreground mb-1.5 line-clamp-2",children:t.description})]})]})});function bY({isVisible:t,searchQuery:e,onSelectPrompt:n,onClose:r,onCreatePrompt:s,refreshKey:a}){const[l,u]=_.useState(0),f=_.useRef(0),h=_.useRef(null),g=_.useRef(null),p=_.useRef(0),{data:x=[],isLoading:y,refetch:k}=NE({enabled:t});f.current=l,_.useEffect(()=>{if(!t)return;const j=a??0;j>0&&j!==p.current&&(k(),p.current=j)},[t,a,k]);const w=nt.useMemo(()=>{if(!e.trim()||e==="/")return x;const A=(e.startsWith("/")?e.slice(1):e).split(/\s+/)[0]||"";return x.filter(I=>I.name.toLowerCase().includes(A.toLowerCase())||I.description&&I.description.toLowerCase().includes(A.toLowerCase())||I.title&&I.title.toLowerCase().includes(A.toLowerCase()))},[e,x]),S=nt.useMemo(()=>{const j=e.trim();return j?!!(j==="/"||j.startsWith("/")&&w.length===0):!1},[e,w.length]),N=nt.useMemo(()=>{const j=[];return S&&j.push({kind:"create"}),w.forEach(A=>j.push({kind:"prompt",prompt:A})),j},[S,w]);_.useEffect(()=>{const A=e==="/"&&w.length>0?1:0;u(A)},[e,w.length]);const C=N.length;return _.useEffect(()=>{u(j=>C===0?0:j>=C?C-1:j)},[C]),_.useEffect(()=>{if(!t)return;const j=A=>{const I=N,T=()=>{A.preventDefault(),A.stopPropagation(),typeof A.stopImmediatePropagation=="function"&&A.stopImmediatePropagation()},R=(e.startsWith("/")?e.slice(1):e).split(/\s+/),z=R.length>1&&R.slice(1).some(D=>D.trim().length>0);switch(A.key){case"ArrowDown":if(I.length===0)return;T(),u(D=>(D+1)%I.length);break;case"ArrowUp":if(I.length===0)return;T(),u(D=>(D-1+I.length)%I.length);break;case"Enter":if(z)return;if(T(),I.length===0){s==null||s();return}{const D=I[f.current];D.kind==="create"?s==null||s():n(D.prompt)}break;case"Escape":T(),r();break;case"Tab":if(T(),I.length===0){s==null||s();return}{const D=I[f.current];D.kind==="create"?s==null||s():n(D.prompt)}break}};return document.addEventListener("keydown",j,!0),()=>document.removeEventListener("keydown",j,!0)},[t,N,n,r,s,e]),_.useEffect(()=>{if(!g.current)return;const j=g.current,A=j.querySelector(`[data-index="${l}"]`);if(A){const I=j.getBoundingClientRect(),T=A.getBoundingClientRect(),E=T.top<I.top,R=T.bottom>I.bottom;(E||R)&&A.scrollIntoView({behavior:"smooth",block:"nearest"})}},[l]),_.useEffect(()=>{const j=A=>{h.current&&!h.current.contains(A.target)&&r()};return t&&document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[t,r]),t?c.jsxs("div",{ref:h,className:"absolute left-0 right-0 mb-2 bg-background border border-border rounded-lg shadow-lg max-h-96 overflow-hidden z-[9999]",style:{position:"absolute",bottom:"calc(100% + 0px)",left:0,right:0,borderRadius:"8px",maxHeight:"320px",overflow:"visible",zIndex:9999,minWidth:"400px",background:"linear-gradient(135deg, hsl(var(--background)) 0%, hsl(var(--muted)) 100%)",border:"1px solid hsl(var(--border) / 0.3)",backdropFilter:"blur(8px)",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05)"},children:[c.jsx("div",{className:"px-3 py-2 border-b border-border bg-muted/50",children:c.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[c.jsx("span",{children:"Available Prompts (hover over arguments for more info)"}),c.jsx(yn,{variant:"secondary",className:"ml-auto text-xs px-2 py-0.5",children:x.length})]})}),c.jsx("div",{ref:g,className:"max-h-48 overflow-y-auto",children:y?c.jsx("div",{className:"p-3 text-center text-xs text-muted-foreground",children:"Loading prompts..."}):c.jsxs(c.Fragment,{children:[S&&c.jsxs("div",{className:`px-3 py-2 cursor-pointer transition-colors ${l===0?"bg-primary/20 ring-1 ring-primary/40":"hover:bg-primary/10"}`,onClick:()=>s==null?void 0:s(),onMouseEnter:()=>u(0),"data-index":0,children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-foreground",children:[c.jsx(us,{className:"h-3 w-3 text-primary"}),c.jsx("span",{children:"Create new prompt"})]}),c.jsx("div",{className:"text-[11px] text-muted-foreground mt-1",children:"Define a reusable prompt. Press Enter to continue."})]}),w.length===0?!S&&c.jsx("div",{className:"p-3 text-center text-xs text-muted-foreground",children:"No prompts available."}):w.map((j,A)=>{const I=S?A+1:A;return c.jsx(yY,{prompt:j,isSelected:I===l,onClick:()=>n(j),onMouseEnter:()=>u(I),dataIndex:I},j.name)})]})}),c.jsx("div",{className:"px-2 py-1.5 border-t border-border bg-muted/20 text-xs text-muted-foreground text-center",children:c.jsx("span",{children:"โโ Navigate โข Tab/Enter Select โข Esc Close"})})]}):null}function Kd({className:t,...e}){return c.jsx("textarea",{"data-slot":"textarea",className:ae("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),...e})}function wY({open:t,onClose:e,onCreated:n}){const[r,s]=_.useState(""),[a,l]=_.useState(""),[u,f]=_.useState(""),[h,g]=_.useState(""),[p,x]=_.useState(null),[y,k]=_.useState(null),[w,S]=_.useState(null),[N,C]=_.useState(!1),j=cP();_.useEffect(()=>{t&&(s(""),l(""),f(""),g(""),x(null),k(null),S(null),C(!1),j.reset())},[t]);const A=async B=>{try{const q=await _Y(B);x({data:q,mimeType:B.type||"application/octet-stream",filename:B.name}),k(q),S(B.name)}catch(q){console.error("Failed to read file:",q)}},I=async B=>{var K;const q=(K=B.target.files)==null?void 0:K[0];if(!q){x(null),k(null),S(null);return}await A(q)},T=B=>{B.preventDefault(),C(!0)},E=B=>{B.preventDefault(),C(!1)},R=async B=>{B.preventDefault(),C(!1);const q=Array.from(B.dataTransfer.files);q.length>0&&await A(q[0])},z=()=>{x(null),k(null),S(null)},D=async B=>{if(B.preventDefault(),!r.trim()||!h.trim())return;const q={name:r.trim(),title:a.trim()||void 0,description:u.trim()||void 0,content:h,resource:p||void 0};j.mutate(q,{onSuccess:K=>{K!=null&&K.prompt&&n({name:K.prompt.name}),e()}})};return c.jsx(rr,{open:t,onOpenChange:B=>!B&&e(),children:c.jsxs(sr,{className:"sm:max-w-3xl",children:[c.jsxs(ir,{children:[c.jsx(ar,{children:"Create Custom Prompt"}),c.jsx(Yr,{children:"Define reusable prompt text and optionally attach a supporting resource file."})]}),c.jsxs("form",{onSubmit:D,className:"space-y-4",children:[j.error&&c.jsx(ds,{variant:"destructive",children:c.jsx(fs,{children:j.error instanceof Error?j.error.message:"Failed to create prompt"})}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qt,{htmlFor:"prompt-name",children:"Prompt Name"}),c.jsx(st,{id:"prompt-name",value:r,onChange:B=>s(B.target.value),placeholder:"research-summary",required:!0}),c.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Use lowercase letters, numbers, or hyphens. This becomes your /prompt command."})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qt,{htmlFor:"prompt-title",children:"Title"}),c.jsx(st,{id:"prompt-title",value:a,onChange:B=>l(B.target.value),placeholder:"Research Summary"})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qt,{htmlFor:"prompt-description",children:"Description"}),c.jsx(st,{id:"prompt-description",value:u,onChange:B=>f(B.target.value),placeholder:"Summarize research papers with key findings"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qt,{htmlFor:"prompt-content",children:"Prompt Content"}),c.jsx(Kd,{id:"prompt-content",value:h,onChange:B=>g(B.target.value),placeholder:"Write the instructions for this prompt...",className:"min-h-[160px]",required:!0})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx(Qt,{children:"Attach resource (optional)"}),y?c.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-dashed border-border/60 bg-muted/40 px-4 py-3",children:[c.jsxs("div",{className:"flex items-center text-sm",children:[c.jsx(ZE,{className:"h-4 w-4 mr-2 text-muted-foreground"}),c.jsx(yn,{variant:"secondary",className:"mr-2",children:"Resource"}),w||"Attached file"]}),c.jsxs(ye,{variant:"ghost",size:"sm",onClick:z,children:[c.jsx(Zn,{className:"h-4 w-4 mr-1"})," Remove"]})]}):c.jsxs("div",{className:`relative rounded-lg border-2 border-dashed transition-colors ${N?"border-primary bg-primary/5":"border-border/60 hover:border-border/80"} px-6 py-8 text-center`,onDragOver:T,onDragLeave:E,onDrop:R,children:[c.jsx("input",{type:"file",onChange:I,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",accept:"*/*"}),c.jsxs("div",{className:"flex flex-col items-center justify-center space-y-2",children:[c.jsx(Dz,{className:`h-8 w-8 ${N?"text-primary":"text-muted-foreground"}`}),c.jsxs("div",{className:"text-sm",children:[c.jsx("span",{className:"font-medium",children:N?"Drop file here":"Click to upload"}),c.jsxs("span",{className:"text-muted-foreground",children:[" ","or drag and drop"]})]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Any file type supported"})]})]}),c.jsx("p",{className:"text-[11px] text-muted-foreground",children:"The resource will be stored securely and referenced when this prompt is used."})]}),c.jsxs(Kr,{className:"flex items-center justify-between gap-2",children:[c.jsx(ye,{type:"button",variant:"ghost",onClick:e,disabled:j.isPending,children:"Cancel"}),c.jsx(ye,{type:"submit",disabled:j.isPending,children:j.isPending?c.jsxs(c.Fragment,{children:[c.jsx(Ms,{className:"h-4 w-4 mr-2 animate-spin"})," Saving..."]}):"Save Prompt"})]})]})]})})}function _Y(t){return new Promise((e,n)=>{const r=new FileReader;r.onload=()=>{const s=r.result;typeof s=="string"?e(s):n(new Error("Failed to read file"))},r.onerror=s=>n(s),r.readAsDataURL(t)})}function kY(t=!0){return Tr({queryKey:Xe.memories.all,queryFn:async()=>{const e=await mt.api.memory.$get({query:{}});if(!e.ok)throw new Error(`Failed to fetch memories: ${e.status}`);return(await e.json()).memories},enabled:t,staleTime:30*1e3})}function SY(){const t=An();return On({mutationFn:async({memoryId:e})=>{const n=await mt.api.memory[":id"].$delete({param:{id:e}});if(!n.ok)throw new Error(`Failed to delete memory: ${n.status}`);return e},onSuccess:()=>{t.invalidateQueries({queryKey:Xe.memories.all})}})}function jY(){const t=An();return On({mutationFn:async e=>{const n=await mt.api.memory.$post({json:e});if(!n.ok)throw new Error(`Failed to create memory: ${n.status}`);return await n.json()},onSuccess:()=>{t.invalidateQueries({queryKey:Xe.memories.all})}})}function KO({open:t,onClose:e}){const[n,r]=_.useState(""),[s,a]=_.useState(""),l=jY(),u=()=>{r(""),a(""),e()},f=async()=>{if(!n.trim())return;const g={content:n.trim(),...s.trim()&&{tags:s.split(",").map(p=>p.trim()).filter(Boolean)},metadata:{source:"user"}};l.mutate(g,{onSuccess:u})},h=()=>{l.isPending||(r(""),a(""),l.reset(),e())};return c.jsx(rr,{open:t,onOpenChange:g=>{g||h()},children:c.jsxs(sr,{className:"sm:max-w-[500px]",children:[c.jsxs(ir,{children:[c.jsx(ar,{children:"Create Memory"}),c.jsx(Yr,{children:"Memories are automatically included in every conversation to help Dexto remember your preferences and important information."})]}),c.jsxs("div",{className:"grid gap-4 py-4",children:[l.error&&c.jsxs(ds,{variant:"destructive",children:[c.jsx(qa,{className:"h-4 w-4"}),c.jsx(fs,{children:l.error instanceof Error?l.error.message:"Failed to create memory"})]}),c.jsxs("div",{className:"grid gap-2",children:[c.jsx(Qt,{htmlFor:"memory-content",children:"Memory Content *"}),c.jsx(Kd,{id:"memory-content",placeholder:"e.g., I prefer concise responses without explanations",value:n,onChange:g=>r(g.target.value),className:"min-h-[100px] resize-none",disabled:l.isPending,autoFocus:!0}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:[n.length," / 10,000 characters"]})]}),c.jsxs("div",{className:"grid gap-2",children:[c.jsx(Qt,{htmlFor:"memory-tags",children:"Tags (optional)"}),c.jsx(st,{id:"memory-tags",placeholder:"e.g., preferences, work, coding-style",value:s,onChange:g=>a(g.target.value),disabled:l.isPending}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Comma-separated tags for organizing memories"})]})]}),c.jsxs(Kr,{children:[c.jsx(ye,{variant:"outline",onClick:h,disabled:l.isPending,children:"Cancel"}),c.jsx(ye,{onClick:f,disabled:l.isPending||!n.trim(),children:l.isPending?c.jsxs(c.Fragment,{children:[c.jsx(Ms,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Memory"})]})]})})}function NY(t){const e=[];let n="",r=!1,s="",a=0;for(;a<t.length;){const l=t[a],u=t[a+1];!r&&(l==='"'||l==="'")?(r=!0,s=l):r&&l===s?(r=!1,s=""):!r&&l===" "?n&&(e.push(n),n=""):l==="\\"&&u?(n+=u,a++):n+=l,a++}return n&&e.push(n),e.filter(Boolean)}function CY(t){const e=t.trim();if(!e.startsWith("/"))return{isSlash:!1,command:"",argsArray:[],argsText:""};const n=NY(e.slice(1)),r=n[0]||"",s=n.slice(1),a=s.join(" ");return{isSlash:!0,command:r,argsArray:s,argsText:a}}function EY(t){const e={},n=[];for(const r of t){const s=r.indexOf("=");if(s>0){const a=r.slice(0,s).trim(),l=r.slice(s+1);if(a.length>0){e[a]=l;continue}}n.push(r)}return{keyValues:e,positional:n}}function lC({onSend:t,isSending:e,isSessionsPanelOpen:n=!1}){const r=An(),[s,a]=_.useState(""),l=_.useRef(null),[u,f]=_.useState(null),[h,g]=_.useState(null),p=_.useRef(null),x=_.useRef(null),y=_.useRef(null),k=pY(),[w,S]=_.useState(!1),N=_.useRef(null),{currentSessionId:C,isStreaming:j,setStreaming:A,cancel:I,processing:T,currentLLM:E}=Ld(),R=Nc(),z=_.useRef(R);_.useEffect(()=>{z.current=R},[R]);const[D,B]=_.useState(null),[q,K]=_.useState(null),[G,F]=_.useState([]),{resources:M,loading:V,refresh:U}=HA(),[H,L]=_.useState(""),[ne,ie]=_.useState(!1),[P,pe]=_.useState(0),[Pe,Ne]=_.useState(null),ge=_.useMemo(()=>qE(M,H),[M,H]),Fe=(de,Te)=>{for(let it=Te-1;it>=0;it--){const et=de[it];if(et==="@"){if(it===0)return it;const We=de[it-1];return/\s/.test(We)?it:-1}if(/\s/.test(et))break}return-1},Qe=64*1024*1024,[$e,Q]=_.useState(!1),[_e,Oe]=_.useState(!1),[le,he]=_.useState(0),[Ee,De]=_.useState(!1),ve=CE(),ue=de=>{K(de),setTimeout(()=>K(null),5e3)},Ce=nt.useCallback(()=>{Q(!1),Oe(!0)},[]),ze=nt.useCallback(de=>{r.invalidateQueries({queryKey:Xe.prompts.all}),Oe(!1),he(it=>it+1);const Te=`/${de.name}`;a(Te),l.current&&(l.current.focus(),l.current.setSelectionRange(Te.length,Te.length))},[r]),be=nt.useCallback(()=>{Oe(!1),s==="/"&&a("")},[s]),{data:Se}=CO({mode:"flat"});_.useEffect(()=>{const de=E==null?void 0:E.provider,Te=E==null?void 0:E.model;if(!de||!Te||!Se){F([]);return}if(!("models"in Se)){F([]);return}const et=Se.models.find(We=>We.provider===de&&We.name===Te);F((et==null?void 0:et.supportedFileTypes)||[])},[E==null?void 0:E.provider,E==null?void 0:E.model,Se]);const ot=async()=>{let de=s.trim();if(!(!de&&!u&&!h)){if(de==="/"){Ce();return}else if(de.startsWith("/")){const Te=CY(de),it=Te.command,et=de.slice(1+it.length).trimStart();if(it)try{const We=await ve.mutateAsync({name:it,context:et||void 0,args:Te.argsArray&&Te.argsArray.length>0?(()=>{const{keyValues:ft,positional:Kt}=EY(Te.argsArray),zn={...ft};return Kt.length>0&&(zn._positional=Kt),Object.keys(zn).length>0?JSON.stringify(zn):void 0})():void 0});We.text.trim()&&(de=We.text)}catch{}}t(de,u??void 0,h??void 0),a(""),f(null),g(null),Q(!1)}},dt=(de,Te)=>{if(!Te&&ge.length===0)return;const it=Te??ge[Math.max(0,Math.min(de,ge.length-1))],et=l.current;if(!et)return;const We=et.selectionStart??s.length,ft=Fe(s,We);if(ft===-1)return;const Kt=s.slice(0,ft),zn=s.slice(We),Wn=it.name||it.uri.split("/").pop()||it.uri,cn=it.serverName?`@${it.serverName}:${Wn}`:`@${Wn}`,ui=Kt+cn+zn;a(ui),ie(!1),L(""),pe(0),requestAnimationFrame(()=>{const mn=(Kt+cn).length;et.setSelectionRange(mn,mn),et.focus()})},J=de=>{if(ne){if(de.key==="ArrowDown"){de.preventDefault(),pe(Te=>(Te+1)%Math.max(1,ge.length));return}if(de.key==="ArrowUp"){de.preventDefault(),pe(Te=>(Te-1+Math.max(1,ge.length))%Math.max(1,ge.length));return}if(de.key==="Enter"){de.preventDefault(),dt(P);return}if(de.key==="Tab"){de.preventDefault(),dt(P);return}if(de.key==="Escape"){ie(!1);return}}if(me&&de.key==="Escape"){de.preventDefault(),Ae(!1),a("");return}if(de.key==="Enter"&&!de.shiftKey){if(de.preventDefault(),s.trim()==="#"){a(""),Ae(!1),De(!0);return}ot()}},[me,Ae]=_.useState(!1),[He,Et]=_.useState(null),kn=de=>{const Te=de.target.value;if(a(Te),Te.startsWith("/")&&!Te.includes(`
|
|
527
|
-
`)?Q(!0):$e&&Q(!1),Te.trim()==="#"){Ae(!0);const it=l.current;if(it){const et=it.getBoundingClientRect(),We=16,ft=Math.max(8,et.left+window.scrollX+We),Kt=Math.max(280,et.width-We*2),Wn=Math.max(80,window.innerHeight-(et.bottom+window.scrollY)+64);Et({position:"fixed",left:ft,bottom:Wn,width:Kt,zIndex:9999})}}else Ae(!1),Et(null)},xr=de=>{const Te=`/${de.name}`;a(Te),Q(!1),l.current&&(l.current.focus(),l.current.setSelectionRange(Te.length,Te.length))},on=()=>{Q(!1)};_.useEffect(()=>{const de=l.current,Te=de?de.selectionStart??s.length:s.length,it=Fe(s,Te);if(it>=0){const et=s.slice(it+1,Te);L(et),ie(!0),pe(0);const We=de==null?void 0:de.getBoundingClientRect();if(We){const Kt=Math.max(8,We.left+window.scrollX+16),zn=Math.max(280,We.width-32),cn=Math.max(80,window.innerHeight-(We.bottom+window.scrollY)+64);Ne({position:"fixed",left:Kt,bottom:cn,width:zn,zIndex:9999})}}else ie(!1),L(""),Ne(null)},[s]);const Hn=nt.useRef(!1);_.useEffect(()=>{ne?Hn.current||(Hn.current=!0,U()):Hn.current=!1},[ne,U]);const Rn=2e4,ln=de=>{try{return btoa(unescape(encodeURIComponent(de)))}catch{return btoa(de)}},Sn=de=>{const Te=de.clipboardData.getData("text/plain");if(!Te||Te.length<=Rn)return;if(de.preventDefault(),window.confirm(`Large text detected. Attach as a file instead of inflating the input?
|
|
528
|
-
(OK = attach as file, Cancel = paste truncated preview)`))g({data:ln(Te),mimeType:"text/plain",filename:"pasted.txt"});else{const et=Te.slice(0,Rn);a(We=>We+et)}},$n=de=>{var et;const Te=(et=de.target.files)==null?void 0:et[0];if(!Te)return;if(Te.size>Qe){ue("PDF file too large. Maximum size is 64MB."),de.target.value="";return}if(Te.type!=="application/pdf"){ue("Please select a valid PDF file."),de.target.value="";return}const it=new FileReader;it.onloadend=()=>{try{const We=it.result,ft=We.indexOf(","),Kt=We.substring(ft+1);g({data:Kt,mimeType:"application/pdf",filename:Te.name}),K(null),C&&z.current.trackFileUploaded({fileType:"application/pdf",fileSizeBytes:Te.size,sessionId:C})}catch{ue("Failed to process PDF file. Please try again."),g(null)}},it.onerror=()=>{ue("Failed to read PDF file. Please try again."),g(null)},it.readAsDataURL(Te),de.target.value=""},ps=async()=>{try{const de=await navigator.mediaDevices.getUserMedia({audio:!0}),Te=new MediaRecorder(de);N.current=Te;const it=[];Te.ondataavailable=et=>{et.data.size>0&&it.push(et.data)},Te.onstop=()=>{const et=new Blob(it,{type:Te.mimeType}),We=new FileReader;We.onloadend=()=>{try{const ft=We.result,Kt=ft.indexOf(","),zn=ft.substring(Kt+1),Wn=Te.mimeType||"audio/webm",ui=(mn=>({"audio/mp3":"mp3","audio/mpeg":"mp3","audio/wav":"wav","audio/x-wav":"wav","audio/wave":"wav","audio/webm":"webm","audio/ogg":"ogg","audio/m4a":"m4a","audio/aac":"aac"})[mn]||mn.split("/")[1]||"webm")(Wn);g({data:zn,mimeType:Wn,filename:`recording.${ui}`}),C&&z.current.trackFileUploaded({fileType:Wn,fileSizeBytes:et.size,sessionId:C})}catch{ue("Failed to process audio recording. Please try again."),g(null)}},We.readAsDataURL(et),de.getTracks().forEach(ft=>ft.stop())},Te.start(),S(!0)}catch{ue("Failed to start audio recording. Please check microphone permissions.")}},gs=()=>{var de;(de=N.current)==null||de.stop(),S(!1)},Zi=de=>{var et;const Te=(et=de.target.files)==null?void 0:et[0];if(!Te)return;if(Te.size>Qe){ue("Image file too large. Maximum size is 64MB."),de.target.value="";return}if(!Te.type.startsWith("image/")){ue("Please select a valid image file."),de.target.value="";return}const it=new FileReader;it.onloadend=()=>{try{const We=it.result,ft=We.indexOf(",");if(ft===-1)throw new Error("Invalid Data URL format");const Kt=We.substring(0,ft),zn=We.substring(ft+1),Wn=Kt.match(/data:(.*);base64/),cn=Wn?Wn[1]:Te.type;if(!cn)throw new Error("Could not determine MIME type");f({image:zn,mimeType:cn}),K(null),C&&z.current.trackImageUploaded({imageType:cn,imageSizeBytes:Te.size,sessionId:C})}catch{ue("Failed to process image file. Please try again."),f(null)}},it.onerror=()=>{ue("Failed to read image file. Please try again."),f(null)},it.readAsDataURL(Te),de.target.value=""},ci=()=>f(null),vs=()=>{var de;return(de=p.current)==null?void 0:de.click()},xs=()=>{var de;return(de=x.current)==null?void 0:de.click()},Wi=()=>{var de;return(de=y.current)==null?void 0:de.click()};_.useEffect(()=>{s&&D&&B(null),s&&q&&K(null)},[s,D,q]);const ys=de=>{var et;const Te=(et=de.target.files)==null?void 0:et[0];if(!Te)return;if(Te.size>Qe){ue("Audio file too large. Maximum size is 64MB."),de.target.value="";return}if(!Te.type.startsWith("audio/")){ue("Please select a valid audio file."),de.target.value="";return}const it=new FileReader;it.onloadend=()=>{try{const We=it.result,ft=We.indexOf(","),Kt=We.substring(ft+1);g({data:Kt,mimeType:Te.type,filename:Te.name}),K(null),C&&z.current.trackFileUploaded({fileType:Te.type,fileSizeBytes:Te.size,sessionId:C})}catch{ue("Failed to process audio file. Please try again."),g(null)}},it.onerror=()=>{ue("Failed to read audio file. Please try again."),g(null)},it.readAsDataURL(Te),de.target.value=""};return c.jsxs("div",{id:"input-area",className:"flex flex-col gap-2 w-full",children:[D&&c.jsxs(ds,{variant:"destructive",className:"mb-2",children:[c.jsx(qa,{className:"h-4 w-4"}),c.jsxs(fs,{className:"flex items-center justify-between",children:[c.jsx("span",{children:D}),c.jsx(ye,{variant:"ghost",size:"sm",onClick:()=>B(null),className:"h-auto p-1 ml-2",children:c.jsx(Er,{className:"h-3 w-3"})})]})]}),q&&c.jsxs(ds,{variant:"destructive",className:"mb-2",children:[c.jsx(qa,{className:"h-4 w-4"}),c.jsxs(fs,{className:"flex items-center justify-between",children:[c.jsx("span",{children:q}),c.jsx(ye,{variant:"ghost",size:"sm",onClick:()=>K(null),className:"h-auto p-1 ml-2",children:c.jsx(Er,{className:"h-3 w-3"})})]})]}),c.jsxs("div",{className:"w-full",children:[c.jsx("form",{onSubmit:de=>{de.preventDefault(),ot()},children:c.jsxs(bV,{children:[(u||h)&&c.jsx("div",{className:"px-4 pt-4",children:c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[u&&c.jsxs("div",{className:"relative w-fit border border-border rounded-lg p-1 bg-muted/50 group",children:[c.jsx("img",{src:`data:${u.mimeType};base64,${u.image}`,alt:"preview",className:"h-12 w-auto rounded-md"}),c.jsx(ye,{variant:"destructive",size:"icon",onClick:ci,className:"absolute -top-1 -right-1 h-4 w-4 rounded-full bg-destructive text-destructive-foreground opacity-100 group-hover:opacity-100 transition-opacity duration-150 shadow-md","aria-label":"Remove image",children:c.jsx(Er,{className:"h-2 w-2"})})]}),h&&c.jsxs("div",{className:"relative w-fit border border-border rounded-lg p-2 bg-muted/50 flex items-center gap-2 group",children:[h.mimeType.startsWith("audio")?c.jsxs(c.Fragment,{children:[c.jsx(ko,{className:"h-4 w-4"}),c.jsx("audio",{controls:!0,src:`data:${h.mimeType};base64,${h.data}`,className:"h-8"})]}):c.jsxs(c.Fragment,{children:[c.jsx(nc,{className:"h-4 w-4"}),c.jsx("span",{className:"text-xs font-medium max-w-[160px] truncate",children:h.filename||"attachment"})]}),c.jsx(ye,{variant:"destructive",size:"icon",onClick:()=>g(null),className:"absolute -top-1 -right-1 h-4 w-4 rounded-full bg-destructive text-destructive-foreground opacity-100 group-hover:opacity-100 transition-opacity duration-150 shadow-md","aria-label":"Remove attachment",children:c.jsx(Er,{className:"h-2 w-2"})})]})]})}),c.jsxs("div",{className:"flex-auto overflow-y-auto relative",children:[k?c.jsx(yV,{ref:l,value:s,onChange:kn,onKeyDown:J,onPaste:Sn,placeholder:"Ask Dexto anything... Type @ for resources, / for prompts, # for memories",minRows:1,maxRows:8,className:"w-full px-4 pt-4 pb-1 text-lg leading-7 placeholder:text-lg bg-transparent border-none resize-none outline-none ring-0 ring-offset-0 focus:ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none max-h-full"}):c.jsx("textarea",{ref:l,rows:1,value:s,onChange:kn,onKeyDown:J,onPaste:Sn,placeholder:"Ask Dexto anything... Type @ for resources, / for prompts, # for memories",className:"w-full px-4 pt-4 pb-1 text-lg leading-7 placeholder:text-lg bg-transparent border-none resize-none outline-none ring-0 ring-offset-0 focus:ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none"}),ne&&Pe&&typeof window<"u"&&py.createPortal(c.jsx("div",{style:Pe,className:"max-h-64 overflow-y-auto rounded-md border border-border bg-popover text-popover-foreground shadow-md",children:c.jsx(gY,{resources:M,query:H,selectedIndex:P,onHoverIndex:de=>pe(de),onSelect:de=>dt(P,de),loading:V})}),document.body),me&&He&&typeof window<"u"&&py.createPortal(c.jsx("div",{style:He,className:"rounded-md border border-border bg-popover text-popover-foreground shadow-md",children:c.jsxs("div",{className:"p-2 flex items-center gap-2 text-sm text-muted-foreground",children:[c.jsx(Io,{className:"h-3.5 w-3.5"}),c.jsxs("span",{children:["Press"," ",c.jsx("kbd",{className:"px-1.5 py-0.5 text-xs bg-muted border border-border rounded",children:"Enter"})," ","to create a memory"]})]})}),document.body)]}),c.jsx(bY,{isVisible:$e,searchQuery:s,onSelectPrompt:xr,onClose:on,onCreatePrompt:Ce,refreshKey:le}),c.jsx(wV,{leftButtons:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(MK,{onImageAttach:vs,onPdfAttach:xs,onAudioAttach:Wi,supports:{image:G.length?G.includes("image"):void 0,pdf:G.length?G.includes("pdf"):void 0,audio:G.length?G.includes("audio"):void 0},useLargeBreakpoint:n}),c.jsx(DK,{isRecording:w,onToggleRecording:w?gs:ps,disabled:G.length>0&&!G.includes("audio"),useLargeBreakpoint:n})]}),rightButtons:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:ae("hidden",n?"lg:block":"md:block"),children:c.jsx(NV,{isStreaming:j,onStreamingChange:A})}),c.jsx(mY,{}),c.jsx(ye,{type:T?"button":"submit",onClick:T?()=>I(C||void 0):void 0,disabled:T?!1:!s.trim()&&!u&&!h||e,className:ae("h-10 w-10 p-0 rounded-full transition-all duration-200",T?"bg-secondary/80 text-secondary-foreground hover:bg-secondary shadow-sm hover:shadow-md border border-border/50":"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm hover:shadow-lg"),"aria-label":T?"Stop":"Send message",title:T?"Stop":"Send",children:T?c.jsx(eT,{className:"h-3.5 w-3.5 fill-current"}):e?c.jsx(Ms,{className:"h-4 w-4 animate-spin"}):c.jsx(yz,{className:"h-4 w-4"})})]})})]})}),c.jsx("input",{ref:p,type:"file",id:"image-upload",accept:"image/*",className:"hidden",onChange:Zi}),c.jsx("input",{ref:x,type:"file",id:"pdf-upload",accept:"application/pdf",className:"hidden",onChange:$n}),c.jsx("input",{ref:y,type:"file",id:"audio-upload",accept:"audio/*",className:"hidden",onChange:ys}),c.jsx(wY,{open:_e,onClose:be,onCreated:ze}),c.jsx(KO,{open:Ee,onClose:()=>De(!1)})]})]})}function cC(t,[e,n]){return Math.min(n,Math.max(e,t))}function TY(t){const e=t+"CollectionProvider",[n,r]=Ka(e),[s,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),l=w=>{const{scope:S,children:N}=w,C=nt.useRef(null),j=nt.useRef(new Map).current;return c.jsx(s,{scope:S,itemMap:j,collectionRef:C,children:N})};l.displayName=e;const u=t+"CollectionSlot",f=Lo(u),h=nt.forwardRef((w,S)=>{const{scope:N,children:C}=w,j=a(u,N),A=Bt(S,j.collectionRef);return c.jsx(f,{ref:A,children:C})});h.displayName=u;const g=t+"CollectionItemSlot",p="data-radix-collection-item",x=Lo(g),y=nt.forwardRef((w,S)=>{const{scope:N,children:C,...j}=w,A=nt.useRef(null),I=Bt(S,A),T=a(g,N);return nt.useEffect(()=>(T.itemMap.set(A,{ref:A,...j}),()=>void T.itemMap.delete(A))),c.jsx(x,{[p]:"",ref:I,children:C})});y.displayName=g;function k(w){const S=a(t+"CollectionConsumer",w);return nt.useCallback(()=>{const C=S.collectionRef.current;if(!C)return[];const j=Array.from(C.querySelectorAll(`[${p}]`));return Array.from(S.itemMap.values()).sort((T,E)=>j.indexOf(T.ref.current)-j.indexOf(E.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:l,Slot:h,ItemSlot:y},k,r]}var AY=_.createContext(void 0);function OY(t){const e=_.useContext(AY);return t||e||"ltr"}var RY=[" ","Enter","ArrowUp","ArrowDown"],MY=[" ","Enter"],Uo="Select",[kp,Sp,DY]=TY(Uo),[Ic,nX]=Ka(Uo,[DY,Rc]),jp=Rc(),[IY,Za]=Ic(Uo),[LY,PY]=Ic(Uo),YO=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:s,onOpenChange:a,value:l,defaultValue:u,onValueChange:f,dir:h,name:g,autoComplete:p,disabled:x,required:y,form:k}=t,w=jp(e),[S,N]=_.useState(null),[C,j]=_.useState(null),[A,I]=_.useState(!1),T=OY(h),[E,R]=zo({prop:r,defaultProp:s??!1,onChange:a,caller:Uo}),[z,D]=zo({prop:l,defaultProp:u,onChange:f,caller:Uo}),B=_.useRef(null),q=S?k||!!S.closest("form"):!0,[K,G]=_.useState(new Set),F=Array.from(K).map(M=>M.props.value).join(";");return c.jsx(y0,{...w,children:c.jsxs(IY,{required:y,scope:e,trigger:S,onTriggerChange:N,valueNode:C,onValueNodeChange:j,valueNodeHasChildren:A,onValueNodeHasChildrenChange:I,contentId:Pa(),value:z,onValueChange:D,open:E,onOpenChange:R,dir:T,triggerPointerDownPosRef:B,disabled:x,children:[c.jsx(kp.Provider,{scope:e,children:c.jsx(LY,{scope:t.__scopeSelect,onNativeOptionAdd:_.useCallback(M=>{G(V=>new Set(V).add(M))},[]),onNativeOptionRemove:_.useCallback(M=>{G(V=>{const U=new Set(V);return U.delete(M),U})},[]),children:n})}),q?c.jsxs(pR,{"aria-hidden":!0,required:y,tabIndex:-1,name:g,autoComplete:p,value:z,onChange:M=>D(M.target.value),disabled:x,form:k,children:[z===void 0?c.jsx("option",{value:""}):null,Array.from(K)]},F):null]})})};YO.displayName=Uo;var GO="SelectTrigger",ZO=_.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...s}=t,a=jp(n),l=Za(GO,n),u=l.disabled||r,f=Bt(e,l.onTriggerChange),h=Sp(n),g=_.useRef("touch"),[p,x,y]=vR(w=>{const S=h().filter(j=>!j.disabled),N=S.find(j=>j.value===l.value),C=xR(S,w,N);C!==void 0&&l.onValueChange(C.value)}),k=w=>{u||(l.onOpenChange(!0),y()),w&&(l.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)})};return c.jsx(op,{asChild:!0,...a,children:c.jsx(Ct.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":gR(l.value)?"":void 0,...s,ref:f,onClick:bt(s.onClick,w=>{w.currentTarget.focus(),g.current!=="mouse"&&k(w)}),onPointerDown:bt(s.onPointerDown,w=>{g.current=w.pointerType;const S=w.target;S.hasPointerCapture(w.pointerId)&&S.releasePointerCapture(w.pointerId),w.button===0&&w.ctrlKey===!1&&w.pointerType==="mouse"&&(k(w),w.preventDefault())}),onKeyDown:bt(s.onKeyDown,w=>{const S=p.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&x(w.key),!(S&&w.key===" ")&&RY.includes(w.key)&&(k(),w.preventDefault())})})})});ZO.displayName=GO;var WO="SelectValue",QO=_.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,children:a,placeholder:l="",...u}=t,f=Za(WO,n),{onValueNodeHasChildrenChange:h}=f,g=a!==void 0,p=Bt(e,f.onValueNodeChange);return or(()=>{h(g)},[h,g]),c.jsx(Ct.span,{...u,ref:p,style:{pointerEvents:"none"},children:gR(f.value)?c.jsx(c.Fragment,{children:l}):a})});QO.displayName=WO;var $Y="SelectIcon",XO=_.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...s}=t;return c.jsx(Ct.span,{"aria-hidden":!0,...s,ref:e,children:r||"โผ"})});XO.displayName=$Y;var zY="SelectPortal",JO=t=>c.jsx(Fd,{asChild:!0,...t});JO.displayName=zY;var qo="SelectContent",eR=_.forwardRef((t,e)=>{const n=Za(qo,t.__scopeSelect),[r,s]=_.useState();if(or(()=>{s(new DocumentFragment)},[]),!n.open){const a=r;return a?Vm.createPortal(c.jsx(tR,{scope:t.__scopeSelect,children:c.jsx(kp.Slot,{scope:t.__scopeSelect,children:c.jsx("div",{children:t.children})})}),a):null}return c.jsx(nR,{...t,ref:e})});eR.displayName=qo;var js=10,[tR,Wa]=Ic(qo),FY="SelectContentImpl",BY=Lo("SelectContent.RemoveScroll"),nR=_.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:l,side:u,sideOffset:f,align:h,alignOffset:g,arrowPadding:p,collisionBoundary:x,collisionPadding:y,sticky:k,hideWhenDetached:w,avoidCollisions:S,...N}=t,C=Za(qo,n),[j,A]=_.useState(null),[I,T]=_.useState(null),E=Bt(e,ge=>A(ge)),[R,z]=_.useState(null),[D,B]=_.useState(null),q=Sp(n),[K,G]=_.useState(!1),F=_.useRef(!1);_.useEffect(()=>{if(j)return Q0(j)},[j]),W0();const M=_.useCallback(ge=>{const[Fe,...Qe]=q().map(_e=>_e.ref.current),[$e]=Qe.slice(-1),Q=document.activeElement;for(const _e of ge)if(_e===Q||(_e==null||_e.scrollIntoView({block:"nearest"}),_e===Fe&&I&&(I.scrollTop=0),_e===$e&&I&&(I.scrollTop=I.scrollHeight),_e==null||_e.focus(),document.activeElement!==Q))return},[q,I]),V=_.useCallback(()=>M([R,j]),[M,R,j]);_.useEffect(()=>{K&&V()},[K,V]);const{onOpenChange:U,triggerPointerDownPosRef:H}=C;_.useEffect(()=>{if(j){let ge={x:0,y:0};const Fe=$e=>{var Q,_e;ge={x:Math.abs(Math.round($e.pageX)-(((Q=H.current)==null?void 0:Q.x)??0)),y:Math.abs(Math.round($e.pageY)-(((_e=H.current)==null?void 0:_e.y)??0))}},Qe=$e=>{ge.x<=10&&ge.y<=10?$e.preventDefault():j.contains($e.target)||U(!1),document.removeEventListener("pointermove",Fe),H.current=null};return H.current!==null&&(document.addEventListener("pointermove",Fe),document.addEventListener("pointerup",Qe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Fe),document.removeEventListener("pointerup",Qe,{capture:!0})}}},[j,U,H]),_.useEffect(()=>{const ge=()=>U(!1);return window.addEventListener("blur",ge),window.addEventListener("resize",ge),()=>{window.removeEventListener("blur",ge),window.removeEventListener("resize",ge)}},[U]);const[L,ne]=vR(ge=>{const Fe=q().filter(Q=>!Q.disabled),Qe=Fe.find(Q=>Q.ref.current===document.activeElement),$e=xR(Fe,ge,Qe);$e&&setTimeout(()=>$e.ref.current.focus())}),ie=_.useCallback((ge,Fe,Qe)=>{const $e=!F.current&&!Qe;(C.value!==void 0&&C.value===Fe||$e)&&(z(ge),$e&&(F.current=!0))},[C.value]),P=_.useCallback(()=>j==null?void 0:j.focus(),[j]),pe=_.useCallback((ge,Fe,Qe)=>{const $e=!F.current&&!Qe;(C.value!==void 0&&C.value===Fe||$e)&&B(ge)},[C.value]),Pe=r==="popper"?Cb:rR,Ne=Pe===Cb?{side:u,sideOffset:f,align:h,alignOffset:g,arrowPadding:p,collisionBoundary:x,collisionPadding:y,sticky:k,hideWhenDetached:w,avoidCollisions:S}:{};return c.jsx(tR,{scope:n,content:j,viewport:I,onViewportChange:T,itemRefCallback:ie,selectedItem:R,onItemLeave:P,itemTextRefCallback:pe,focusSelectedItem:V,selectedItemText:D,position:r,isPositioned:K,searchRef:L,children:c.jsx(bp,{as:BY,allowPinchZoom:!0,children:c.jsx(xp,{asChild:!0,trapped:C.open,onMountAutoFocus:ge=>{ge.preventDefault()},onUnmountAutoFocus:bt(s,ge=>{var Fe;(Fe=C.trigger)==null||Fe.focus({preventScroll:!0}),ge.preventDefault()}),children:c.jsx($d,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:ge=>ge.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:c.jsx(Pe,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:ge=>ge.preventDefault(),...N,...Ne,onPlaced:()=>G(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...N.style},onKeyDown:bt(N.onKeyDown,ge=>{const Fe=ge.ctrlKey||ge.altKey||ge.metaKey;if(ge.key==="Tab"&&ge.preventDefault(),!Fe&&ge.key.length===1&&ne(ge.key),["ArrowUp","ArrowDown","Home","End"].includes(ge.key)){let $e=q().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);if(["ArrowUp","End"].includes(ge.key)&&($e=$e.slice().reverse()),["ArrowUp","ArrowDown"].includes(ge.key)){const Q=ge.target,_e=$e.indexOf(Q);$e=$e.slice(_e+1)}setTimeout(()=>M($e)),ge.preventDefault()}})})})})})})});nR.displayName=FY;var UY="SelectItemAlignedPosition",rR=_.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...s}=t,a=Za(qo,n),l=Wa(qo,n),[u,f]=_.useState(null),[h,g]=_.useState(null),p=Bt(e,E=>g(E)),x=Sp(n),y=_.useRef(!1),k=_.useRef(!0),{viewport:w,selectedItem:S,selectedItemText:N,focusSelectedItem:C}=l,j=_.useCallback(()=>{if(a.trigger&&a.valueNode&&u&&h&&w&&S&&N){const E=a.trigger.getBoundingClientRect(),R=h.getBoundingClientRect(),z=a.valueNode.getBoundingClientRect(),D=N.getBoundingClientRect();if(a.dir!=="rtl"){const Q=D.left-R.left,_e=z.left-Q,Oe=E.left-_e,le=E.width+Oe,he=Math.max(le,R.width),Ee=window.innerWidth-js,De=cC(_e,[js,Math.max(js,Ee-he)]);u.style.minWidth=le+"px",u.style.left=De+"px"}else{const Q=R.right-D.right,_e=window.innerWidth-z.right-Q,Oe=window.innerWidth-E.right-_e,le=E.width+Oe,he=Math.max(le,R.width),Ee=window.innerWidth-js,De=cC(_e,[js,Math.max(js,Ee-he)]);u.style.minWidth=le+"px",u.style.right=De+"px"}const B=x(),q=window.innerHeight-js*2,K=w.scrollHeight,G=window.getComputedStyle(h),F=parseInt(G.borderTopWidth,10),M=parseInt(G.paddingTop,10),V=parseInt(G.borderBottomWidth,10),U=parseInt(G.paddingBottom,10),H=F+M+K+U+V,L=Math.min(S.offsetHeight*5,H),ne=window.getComputedStyle(w),ie=parseInt(ne.paddingTop,10),P=parseInt(ne.paddingBottom,10),pe=E.top+E.height/2-js,Pe=q-pe,Ne=S.offsetHeight/2,ge=S.offsetTop+Ne,Fe=F+M+ge,Qe=H-Fe;if(Fe<=pe){const Q=B.length>0&&S===B[B.length-1].ref.current;u.style.bottom="0px";const _e=h.clientHeight-w.offsetTop-w.offsetHeight,Oe=Math.max(Pe,Ne+(Q?P:0)+_e+V),le=Fe+Oe;u.style.height=le+"px"}else{const Q=B.length>0&&S===B[0].ref.current;u.style.top="0px";const Oe=Math.max(pe,F+w.offsetTop+(Q?ie:0)+Ne)+Qe;u.style.height=Oe+"px",w.scrollTop=Fe-pe+w.offsetTop}u.style.margin=`${js}px 0`,u.style.minHeight=L+"px",u.style.maxHeight=q+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[x,a.trigger,a.valueNode,u,h,w,S,N,a.dir,r]);or(()=>j(),[j]);const[A,I]=_.useState();or(()=>{h&&I(window.getComputedStyle(h).zIndex)},[h]);const T=_.useCallback(E=>{E&&k.current===!0&&(j(),C==null||C(),k.current=!1)},[j,C]);return c.jsx(HY,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:y,onScrollButtonChange:T,children:c.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:A},children:c.jsx(Ct.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});rR.displayName=UY;var qY="SelectPopperPosition",Cb=_.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=js,...a}=t,l=jp(n);return c.jsx(b0,{...l,...a,ref:e,align:r,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Cb.displayName=qY;var[HY,nw]=Ic(qo,{}),Eb="SelectViewport",sR=_.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...s}=t,a=Wa(Eb,n),l=nw(Eb,n),u=Bt(e,a.onViewportChange),f=_.useRef(0);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),c.jsx(kp.Slot,{scope:n,children:c.jsx(Ct.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:bt(s.onScroll,h=>{const g=h.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:x}=l;if(x!=null&&x.current&&p){const y=Math.abs(f.current-g.scrollTop);if(y>0){const k=window.innerHeight-js*2,w=parseFloat(p.style.minHeight),S=parseFloat(p.style.height),N=Math.max(w,S);if(N<k){const C=N+y,j=Math.min(k,C),A=C-j;p.style.height=j+"px",p.style.bottom==="0px"&&(g.scrollTop=A>0?A:0,p.style.justifyContent="flex-end")}}}f.current=g.scrollTop})})})]})});sR.displayName=Eb;var iR="SelectGroup",[VY,KY]=Ic(iR),YY=_.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=Pa();return c.jsx(VY,{scope:n,id:s,children:c.jsx(Ct.div,{role:"group","aria-labelledby":s,...r,ref:e})})});YY.displayName=iR;var aR="SelectLabel",GY=_.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=KY(aR,n);return c.jsx(Ct.div,{id:s.id,...r,ref:e})});GY.displayName=aR;var Fm="SelectItem",[ZY,oR]=Ic(Fm),lR=_.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:a,...l}=t,u=Za(Fm,n),f=Wa(Fm,n),h=u.value===r,[g,p]=_.useState(a??""),[x,y]=_.useState(!1),k=Bt(e,C=>{var j;return(j=f.itemRefCallback)==null?void 0:j.call(f,C,r,s)}),w=Pa(),S=_.useRef("touch"),N=()=>{s||(u.onValueChange(r),u.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return c.jsx(ZY,{scope:n,value:r,disabled:s,textId:w,isSelected:h,onItemTextChange:_.useCallback(C=>{p(j=>j||((C==null?void 0:C.textContent)??"").trim())},[]),children:c.jsx(kp.ItemSlot,{scope:n,value:r,disabled:s,textValue:g,children:c.jsx(Ct.div,{role:"option","aria-labelledby":w,"data-highlighted":x?"":void 0,"aria-selected":h&&x,"data-state":h?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...l,ref:k,onFocus:bt(l.onFocus,()=>y(!0)),onBlur:bt(l.onBlur,()=>y(!1)),onClick:bt(l.onClick,()=>{S.current!=="mouse"&&N()}),onPointerUp:bt(l.onPointerUp,()=>{S.current==="mouse"&&N()}),onPointerDown:bt(l.onPointerDown,C=>{S.current=C.pointerType}),onPointerMove:bt(l.onPointerMove,C=>{var j;S.current=C.pointerType,s?(j=f.onItemLeave)==null||j.call(f):S.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:bt(l.onPointerLeave,C=>{var j;C.currentTarget===document.activeElement&&((j=f.onItemLeave)==null||j.call(f))}),onKeyDown:bt(l.onKeyDown,C=>{var A;((A=f.searchRef)==null?void 0:A.current)!==""&&C.key===" "||(MY.includes(C.key)&&N(),C.key===" "&&C.preventDefault())})})})})});lR.displayName=Fm;var rd="SelectItemText",cR=_.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,...a}=t,l=Za(rd,n),u=Wa(rd,n),f=oR(rd,n),h=PY(rd,n),[g,p]=_.useState(null),x=Bt(e,N=>p(N),f.onItemTextChange,N=>{var C;return(C=u.itemTextRefCallback)==null?void 0:C.call(u,N,f.value,f.disabled)}),y=g==null?void 0:g.textContent,k=_.useMemo(()=>c.jsx("option",{value:f.value,disabled:f.disabled,children:y},f.value),[f.disabled,f.value,y]),{onNativeOptionAdd:w,onNativeOptionRemove:S}=h;return or(()=>(w(k),()=>S(k)),[w,S,k]),c.jsxs(c.Fragment,{children:[c.jsx(Ct.span,{id:f.textId,...a,ref:x}),f.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Vm.createPortal(a.children,l.valueNode):null]})});cR.displayName=rd;var uR="SelectItemIndicator",dR=_.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return oR(uR,n).isSelected?c.jsx(Ct.span,{"aria-hidden":!0,...r,ref:e}):null});dR.displayName=uR;var Tb="SelectScrollUpButton",fR=_.forwardRef((t,e)=>{const n=Wa(Tb,t.__scopeSelect),r=nw(Tb,t.__scopeSelect),[s,a]=_.useState(!1),l=Bt(e,r.onScrollButtonChange);return or(()=>{if(n.viewport&&n.isPositioned){let u=function(){const h=f.scrollTop>0;a(h)};const f=n.viewport;return u(),f.addEventListener("scroll",u),()=>f.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),s?c.jsx(mR,{...t,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:f}=n;u&&f&&(u.scrollTop=u.scrollTop-f.offsetHeight)}}):null});fR.displayName=Tb;var Ab="SelectScrollDownButton",hR=_.forwardRef((t,e)=>{const n=Wa(Ab,t.__scopeSelect),r=nw(Ab,t.__scopeSelect),[s,a]=_.useState(!1),l=Bt(e,r.onScrollButtonChange);return or(()=>{if(n.viewport&&n.isPositioned){let u=function(){const h=f.scrollHeight-f.clientHeight,g=Math.ceil(f.scrollTop)<h;a(g)};const f=n.viewport;return u(),f.addEventListener("scroll",u),()=>f.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),s?c.jsx(mR,{...t,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:f}=n;u&&f&&(u.scrollTop=u.scrollTop+f.offsetHeight)}}):null});hR.displayName=Ab;var mR=_.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=t,a=Wa("SelectScrollButton",n),l=_.useRef(null),u=Sp(n),f=_.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return _.useEffect(()=>()=>f(),[f]),or(()=>{var g;const h=u().find(p=>p.ref.current===document.activeElement);(g=h==null?void 0:h.ref.current)==null||g.scrollIntoView({block:"nearest"})},[u]),c.jsx(Ct.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:bt(s.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:bt(s.onPointerMove,()=>{var h;(h=a.onItemLeave)==null||h.call(a),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:bt(s.onPointerLeave,()=>{f()})})}),WY="SelectSeparator",QY=_.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return c.jsx(Ct.div,{"aria-hidden":!0,...r,ref:e})});QY.displayName=WY;var Ob="SelectArrow",XY=_.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=jp(n),a=Za(Ob,n),l=Wa(Ob,n);return a.open&&l.position==="popper"?c.jsx(w0,{...s,...r,ref:e}):null});XY.displayName=Ob;var JY="SelectBubbleInput",pR=_.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const s=_.useRef(null),a=Bt(r,s),l=V0(e);return _.useEffect(()=>{const u=s.current;if(!u)return;const f=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(f,"value").set;if(l!==e&&g){const p=new Event("change",{bubbles:!0});g.call(u,e),u.dispatchEvent(p)}},[l,e]),c.jsx(Ct.select,{...n,style:{...CT,...n.style},ref:a,defaultValue:e})});pR.displayName=JY;function gR(t){return t===""||t===void 0}function vR(t){const e=Po(t),n=_.useRef(""),r=_.useRef(0),s=_.useCallback(l=>{const u=n.current+l;e(u),(function f(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>f(""),1e3))})(u)},[e]),a=_.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,a]}function xR(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,a=n?t.indexOf(n):-1;let l=eG(t,Math.max(a,0));s.length===1&&(l=l.filter(h=>h!==n));const f=l.find(h=>h.textValue.toLowerCase().startsWith(s.toLowerCase()));return f!==n?f:void 0}function eG(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var tG=YO,nG=ZO,rG=QO,sG=XO,iG=JO,aG=eR,oG=sR,lG=lR,cG=cR,uG=dR,dG=fR,fG=hR;function rw({...t}){return c.jsx(tG,{"data-slot":"select",...t})}function sw({...t}){return c.jsx(rG,{"data-slot":"select-value",...t})}function iw({className:t,size:e="default",children:n,...r}){return c.jsxs(nG,{"data-slot":"select-trigger","data-size":e,className:ae("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r,children:[n,c.jsx(sG,{asChild:!0,children:c.jsx(Ar,{className:"size-4 opacity-50"})})]})}function aw({className:t,children:e,position:n="popper",...r}){return c.jsx(iG,{children:c.jsxs(aG,{"data-slot":"select-content",className:ae("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[c.jsx(hG,{}),c.jsx(oG,{className:ae("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:e}),c.jsx(mG,{})]})})}function ac({className:t,children:e,...n}){return c.jsxs(lG,{"data-slot":"select-item",className:ae("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...n,children:[c.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:c.jsx(uG,{children:c.jsx(Es,{className:"size-4"})})}),c.jsx(cG,{children:e})]})}function hG({className:t,...e}){return c.jsx(dG,{"data-slot":"select-scroll-up-button",className:ae("flex cursor-default items-center justify-center py-1",t),...e,children:c.jsx(Ua,{className:"size-4"})})}function mG({className:t,...e}){return c.jsx(fG,{"data-slot":"select-scroll-down-button",className:ae("flex cursor-default items-center justify-center py-1",t),...e,children:c.jsx(Ar,{className:"size-4"})})}const pG=[/\bapi[_-]?key\b/i,/\bapikey\b/i,/\bsecret\b/i,/\btoken\b/i,/\bpassword\b/i,/\bauthorization\b/i,/\bauth[_-]?token\b/i,/\bbearer\b/i,/\bcredential\b/i,/\bclient[_-]?secret\b/i];function ny({label:t="Key-Value Pairs",placeholder:e={key:"Key",value:"Value"},pairs:n,onChange:r,disabled:s=!1,className:a="",keyLabel:l="Key",valueLabel:u="Value",maskSensitiveValues:f=!0}){const[h,g]=_.useState(new Set),p=S=>!f||!S?!1:pG.some(N=>N.test(S)),x=S=>{g(N=>{const C=new Set(N);return C.has(S)?C.delete(S):C.add(S),C})},y=()=>{const S={key:"",value:"",id:`kv-${Date.now()}-${Math.random().toString(36).substring(2,11)}`};r([...n,S])},k=S=>{const N=n.filter(C=>C.id!==S);r(N)},w=(S,N,C)=>{r(n.map(j=>j.id===S?{...j,[N]:C}:j))};return c.jsxs("div",{className:`space-y-3 ${a}`,children:[t&&c.jsx(Qt,{className:"text-sm font-medium",children:t}),c.jsxs("div",{className:"space-y-2",children:[n.length>0&&c.jsxs("div",{className:"grid grid-cols-12 gap-2 items-center text-xs text-muted-foreground",children:[c.jsx("div",{className:"col-span-5",children:l}),c.jsx("div",{className:"col-span-6",children:u}),c.jsx("div",{className:"col-span-1"})]}),n.map(S=>{const N=p(S.key),C=h.has(S.id);return c.jsxs("div",{className:"grid grid-cols-12 gap-2 items-center",children:[c.jsx(st,{placeholder:e.key,value:S.key,onChange:j=>w(S.id,"key",j.target.value),disabled:s,className:"col-span-5"}),c.jsxs("div",{className:"col-span-6 relative",children:[c.jsx(st,{type:N&&!C?"password":"text",placeholder:e.value,value:S.value,onChange:j=>w(S.id,"value",j.target.value),disabled:s,className:"pr-10"}),N&&S.value&&c.jsx(ye,{type:"button",variant:"ghost",size:"sm",onClick:()=>x(S.id),disabled:s,className:"absolute right-0 top-0 h-full w-10 p-0 hover:bg-transparent","aria-label":C?"Hide value":"Show value",children:C?c.jsx(GE,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(c0,{className:"h-4 w-4 text-muted-foreground"})})]}),c.jsx(ye,{type:"button",variant:"ghost",size:"sm",onClick:()=>k(S.id),disabled:s,className:"col-span-1 h-8 w-8 p-0",children:c.jsx(Zn,{className:"h-4 w-4"})})]},S.id)})]}),c.jsxs(ye,{type:"button",variant:"outline",size:"sm",onClick:y,disabled:s,className:"w-full mt-2",children:[c.jsx(us,{className:"h-4 w-4 mr-2"}),"Add ",l]})]})}function yR({isOpen:t,onClose:e,onServerConnected:n,initialName:r,initialConfig:s,lockName:a}){const l=o0(),[u,f]=_.useState(""),[h,g]=_.useState("stdio"),[p,x]=_.useState(""),[y,k]=_.useState(""),[w,S]=_.useState(""),[N,C]=_.useState([]),[j,A]=_.useState([]),[I,T]=_.useState(null),[E,R]=_.useState(!1),[z,D]=_.useState(!1),B=M=>{const V={};return M.forEach(U=>{U.key.trim()&&U.value.trim()&&(V[U.key.trim()]=U.value.trim())}),V},q=M=>{const V={};for(const{key:U,value:H}of M){const L=U.trim(),ne=H.trim();L&&ne&&(V[L]=ne)}return V},K=M=>{const V=["api_key","secret","token","password","key"],U={};for(const[H,L]of Object.entries(M)){const ne=V.some(ie=>H.toLowerCase().includes(ie));U[H]=ne?"***masked***":L}return U},G=M=>{const V=["authorization","proxy-authorization","api-key","x-api-key","token","cookie","set-cookie"],U={};for(const[H,L]of Object.entries(M)){const ne=H.toLowerCase(),ie=V.some(P=>ne===P||ne.includes(P));U[H]=ie?"***masked***":L}return U};_.useEffect(()=>{if(!t){const M=setTimeout(()=>{f(""),g("stdio"),x(""),k(""),S(""),C([]),A([]),T(null),R(!1)},300);return()=>clearTimeout(M)}},[t]),_.useEffect(()=>{if(!t)return;f(r??"");const M=(s==null?void 0:s.type)??"stdio";if(g(M),M==="stdio"){const V=s??{};x(typeof V.command=="string"?V.command:""),k(Array.isArray(V.args)?V.args.join(", "):"");const U=Object.entries(V.env??{});A(U.map(([H,L],ne)=>({key:H,value:String(L??""),id:`env-${ne}`}))),S(""),C([])}else{const V=s??{};S(typeof V.url=="string"?V.url:"");const U=Object.entries(V.headers??{});C(U.map(([H,L],ne)=>({key:H,value:String(L??""),id:`hdr-${ne}`}))),x(""),k(""),A([])}},[t,r,s]);const F=async M=>{if(M.preventDefault(),T(null),R(!0),!u.trim()){T("Server name is required."),R(!1);return}if(h==="stdio"){if(!p.trim()){T("Command is required for stdio servers."),R(!1);return}const U=j.map(H=>H.key.trim()).filter(Boolean);if(U.length){const H=U.filter((ne,ie)=>U.indexOf(ne)!==ie);if(H.length){T(`Duplicate environment variables: ${Array.from(new Set(H)).join(", ")}`),R(!1);return}const L=j.filter(ne=>ne.key.trim()&&!ne.value.trim()).map(ne=>ne.key.trim());if(L.length){T(`Please set required environment variables: ${L.join(", ")}`),R(!1);return}}}else{if(!w.trim()){T(`URL is required for ${h.toUpperCase()} servers.`),R(!1);return}try{new URL(w.trim())}catch{T(`Invalid URL format for ${h.toUpperCase()} server.`),R(!1);return}}let V;h==="stdio"?V={type:"stdio",command:p.trim(),args:y.split(",").map(U=>U.trim()).filter(Boolean),env:q(j),timeout:3e4,connectionMode:"lenient"}:h==="sse"?V={type:"sse",url:w.trim(),headers:N.length?B(N):{},timeout:3e4,connectionMode:"lenient"}:V={type:"http",url:w.trim(),headers:N.length?B(N):{},timeout:3e4,connectionMode:"lenient"};try{await l.mutateAsync({name:u.trim(),config:V,persistToAgent:z}),n==null||n(),e()}catch(U){let H="Failed to connect server";U instanceof Error?H=U.message||H:typeof U=="string"&&(H=U),l.reset(),T(H)}finally{R(!1)}};return c.jsx(rr,{open:t,onOpenChange:M=>!M&&e(),children:c.jsxs(sr,{className:"sm:max-w-[480px]",children:[c.jsxs(ir,{children:[c.jsx(ar,{children:"Connect New MCP Server"}),c.jsx(Yr,{children:"Configure connection details for a new MCP server (stdio, SSE, or HTTP)."})]}),c.jsxs("form",{id:"connectServerForm",onSubmit:F,className:"grid gap-4 py-4",children:[I&&c.jsx(ds,{variant:"destructive",children:c.jsx(fs,{children:I})}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(Qt,{htmlFor:"serverName",className:"text-right",children:"Server Name"}),c.jsx(st,{id:"serverName",value:u,onChange:M=>f(M.target.value),className:"col-span-3",placeholder:"e.g., My Local Tools",required:!0,disabled:E||!!a})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(Qt,{htmlFor:"serverType",className:"text-right",children:"Server Type"}),c.jsxs(rw,{value:h,onValueChange:M=>g(M),disabled:E,children:[c.jsx(iw,{id:"serverType",className:"col-span-3",children:c.jsx(sw,{placeholder:"Select type"})}),c.jsxs(aw,{children:[c.jsx(ac,{value:"stdio",children:"stdio"}),c.jsx(ac,{value:"sse",children:"sse"}),c.jsx(ac,{value:"http",children:"http"})]})]})]}),h==="stdio"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(Qt,{htmlFor:"command",className:"text-right",children:"Command"}),c.jsx(st,{id:"command",value:p,onChange:M=>x(M.target.value),className:"col-span-3",placeholder:"e.g., /path/to/executable or python",required:!0,disabled:E})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(Qt,{htmlFor:"args",className:"text-right",children:"Arguments"}),c.jsx(st,{id:"args",value:y,onChange:M=>k(M.target.value),className:"col-span-3",placeholder:"Comma-separated, e.g., -m,script.py,--port,8080",disabled:E})]}),c.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[c.jsx(Qt,{className:"text-right mt-2",children:"Environment"}),c.jsx("div",{className:"col-span-3",children:c.jsx(ny,{pairs:j,onChange:A,placeholder:{key:"API_KEY",value:"your-secret-key"},disabled:E,keyLabel:"Variable",valueLabel:"Value"})})]})]}):h==="sse"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(Qt,{htmlFor:"url",className:"text-right",children:"URL"}),c.jsx(st,{id:"url",type:"url",value:w,onChange:M=>S(M.target.value),className:"col-span-3",placeholder:"e.g., http://localhost:8000/events",required:!0,disabled:E})]}),c.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[c.jsx(Qt,{className:"text-right mt-2",children:"Headers"}),c.jsx("div",{className:"col-span-3",children:c.jsx(ny,{pairs:N,onChange:C,placeholder:{key:"Authorization",value:"Bearer your-token"},disabled:E,keyLabel:"Header",valueLabel:"Value"})})]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(Qt,{htmlFor:"url",className:"text-right",children:"URL"}),c.jsx(st,{id:"url",type:"url",value:w,onChange:M=>S(M.target.value),className:"col-span-3",placeholder:"e.g., http://localhost:8080",required:!0,disabled:E})]}),c.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[c.jsx(Qt,{className:"text-right mt-2",children:"Headers"}),c.jsx("div",{className:"col-span-3",children:c.jsx(ny,{pairs:N,onChange:C,placeholder:{key:"Authorization",value:"Bearer your-token"},disabled:E,keyLabel:"Header",valueLabel:"Value"})})]})]}),c.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[c.jsx($m,{id:"persistToAgent",checked:z,onCheckedChange:M=>D(M===!0),disabled:E}),c.jsx(Qt,{htmlFor:"persistToAgent",className:"text-sm font-normal cursor-pointer",children:"Save to agent configuration file"})]})]}),c.jsxs(Kr,{children:[c.jsx(HO,{asChild:!0,children:c.jsx(ye,{type:"button",variant:"outline",disabled:E,children:"Cancel"})}),c.jsx(ye,{type:"submit",form:"connectServerForm",disabled:E,children:E?"Connecting...":"Connect"})]})]})})}const gG=JSON.parse('[{"id":"filesystem","name":"Filesystem","description":"Secure file operations with configurable access controls for reading and writing files","category":"productivity","icon":"๐","config":{"type":"stdio","command":"npx","args":["-y","@modelcontextprotocol/server-filesystem","."],"timeout":30000},"tags":["file","directory","filesystem","io"],"isOfficial":true,"isInstalled":false,"author":"Anthropic","homepage":"https://github.com/modelcontextprotocol/servers","matchIds":["filesystem"]},{"id":"meme-mcp","name":"Meme Generator","description":"Create memes using Imgflip templates","category":"creative","icon":"๐ผ๏ธ","config":{"type":"stdio","command":"npx","args":["-y","meme-mcp"],"env":{"IMGFLIP_USERNAME":"","IMGFLIP_PASSWORD":""},"timeout":30000},"tags":["meme","image","creative"],"isOfficial":false,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Community","homepage":"https://www.npmjs.com/package/meme-mcp","matchIds":["meme-mcp"]},{"id":"product-name-scout","name":"Product Name Scout","description":"SERP analysis, autocomplete, dev collisions, and scoring for product names","category":"research","icon":"๐","config":{"type":"stdio","command":"npx","args":["-y","@truffle-ai/product-name-scout-mcp"],"timeout":30000},"tags":["research","naming","brand"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Truffle AI","homepage":"https://github.com/truffle-ai/mcp-servers","matchIds":["product-name-scout"]},{"id":"duckduckgo","name":"DuckDuckGo Search","description":"Search the web using DuckDuckGo","category":"research","icon":"๐ฆ","config":{"type":"stdio","command":"uvx","args":["duckduckgo-mcp-server"],"timeout":30000},"tags":["search","web","research"],"isOfficial":false,"isInstalled":false,"requirements":{"platform":"all","python":">=3.10","dependencies":["uv"]},"author":"Community","homepage":"https://github.com/duckduckgo/mcp-server","matchIds":["duckduckgo","ddg"]},{"id":"domain-checker","name":"Domain Checker","description":"Check domain availability across TLDs","category":"research","icon":"๐","config":{"type":"stdio","command":"uvx","args":["truffle-ai-domain-checker-mcp"],"timeout":30000},"tags":["domains","availability","research"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","python":">=3.10"},"author":"Truffle AI","homepage":"https://github.com/truffle-ai/mcp-servers","matchIds":["domain-checker"]},{"id":"linear","name":"Linear","description":"Manage Linear issues, projects, and workflows","category":"productivity","icon":"๐","config":{"type":"stdio","command":"npx","args":["-y","mcp-remote","https://mcp.linear.app/sse"],"timeout":30000},"tags":["linear","tasks","projects"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Linear","homepage":"https://mcp.linear.app","matchIds":["linear"]},{"id":"image-editor","name":"Image Editor","description":"Comprehensive image processing and manipulation tools","category":"creative","icon":"๐๏ธ","config":{"type":"stdio","command":"uvx","args":["truffle-ai-image-editor-mcp"],"timeout":30000},"tags":["image","edit","opencv","pillow"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","python":">=3.10"},"author":"Truffle AI","homepage":"https://github.com/truffle-ai/mcp-servers","matchIds":["image_editor","image-editor"]},{"id":"music-creator","name":"Music Creator","description":"Create, analyze, and transform music and audio","category":"creative","icon":"๐ต","config":{"type":"stdio","command":"uvx","args":["truffle-ai-music-creator-mcp"],"timeout":30000},"tags":["audio","music","effects"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","python":">=3.10"},"author":"Truffle AI","homepage":"https://github.com/truffle-ai/mcp-servers","matchIds":["music_creator","music-creator"]},{"id":"elevenlabs","name":"ElevenLabs","description":"Text-to-speech and voice synthesis using ElevenLabs API","category":"creative","icon":"๐ค","config":{"type":"stdio","command":"uvx","args":["elevenlabs-mcp"],"env":{"ELEVENLABS_API_KEY":""},"timeout":30000},"tags":["tts","voice","audio","synthesis"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","python":">=3.10"},"author":"ElevenLabs","homepage":"https://github.com/elevenlabs/elevenlabs-mcp","matchIds":["elevenlabs"]},{"id":"hf","name":"Hugging Face","description":"Access Hugging Face models and datasets","category":"development","icon":"๐ค","config":{"type":"stdio","command":"npx","args":["-y","@llmindset/mcp-hfspace"],"timeout":30000},"tags":["huggingface","models","ai","ml"],"isOfficial":false,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"LLMindset","homepage":"https://github.com/llmindset/mcp-hfspace","matchIds":["hf","huggingface"]},{"id":"tavily","name":"Tavily Search","description":"Web search and research using Tavily AI search engine","category":"research","icon":"๐","config":{"type":"stdio","command":"npx","args":["-y","tavily-mcp@0.1.3"],"env":{"TAVILY_API_KEY":""},"timeout":30000},"tags":["search","web","research","ai"],"isOfficial":false,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Tavily AI","homepage":"https://www.npmjs.com/package/tavily-mcp","matchIds":["tavily"]},{"id":"puppeteer","name":"Puppeteer","description":"Browser automation and web interaction tools","category":"productivity","icon":"๐","config":{"type":"stdio","command":"npx","args":["-y","@truffle-ai/puppeteer-server"],"timeout":30000},"tags":["browser","automation","web","puppeteer"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Truffle AI","homepage":"https://github.com/truffle-ai/mcp-servers","matchIds":["puppeteer"]},{"id":"gemini-tts","name":"Gemini TTS","description":"Google Gemini Text-to-Speech with 30 prebuilt voices and multi-speaker conversation support","category":"creative","icon":"๐๏ธ","config":{"type":"stdio","command":"npx","args":["-y","@truffle-ai/gemini-tts-server"],"env":{"GEMINI_API_KEY":""},"timeout":60000},"tags":["tts","speech","voice","audio","gemini","multi-speaker"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Truffle AI","homepage":"https://github.com/truffle-ai/mcp-servers","matchIds":["gemini-tts","gemini_tts"]},{"id":"nano-banana","name":"Nano Banana","description":"Google Gemini 2.5 Flash Image for advanced image generation, editing, and manipulation","category":"creative","icon":"๐","config":{"type":"stdio","command":"npx","args":["-y","@truffle-ai/nano-banana-server@0.1.2"],"env":{"GEMINI_API_KEY":""},"timeout":60000},"tags":["image","generation","editing","ai","gemini","nano-banana"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Truffle AI","homepage":"https://github.com/truffle-ai/mcp-servers","matchIds":["nano-banana","nano_banana"]},{"id":"heygen","name":"HeyGen","description":"Generate realistic human-like audio using HeyGen","category":"creative","icon":"๐ค","config":{"type":"stdio","command":"uvx","args":["heygen-mcp"],"env":{"HEYGEN_API_KEY":""},"timeout":30000},"tags":["audio","voice","synthesis","heygen"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","python":">=3.10"},"author":"HeyGen","homepage":"https://github.com/heygen-com/heygen-mcp","matchIds":["heygen"]},{"id":"runway","name":"Runway","description":"AI-powered creative suite for video and image generation","category":"creative","icon":"๐ฌ","config":{"type":"stdio","command":"npx","args":["mcp-remote","https://mcp.runway.team","--header","Authorization: Bearer ${RUNWAY_API_KEY}"],"env":{"RUNWAY_API_KEY":""},"timeout":60000},"tags":["runway","video","generation","ai","creative"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Runway","homepage":"https://docs.runway.team/api/runway-mcp-server","matchIds":["runway"]},{"id":"perplexity","name":"Perplexity","description":"AI-powered search engine for real-time web search and research","category":"research","icon":"๐","config":{"type":"stdio","command":"npx","args":["-y","@perplexity-ai/mcp-server"],"env":{"PERPLEXITY_API_KEY":"","PERPLEXITY_TIMEOUT_MS":"600000"},"timeout":600000},"tags":["search","web","research","ai"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Perplexity AI","homepage":"https://github.com/perplexityai/modelcontextprotocol/tree/main","matchIds":["perplexity"]},{"id":"sora","name":"Sora","description":"AI-powered video generation using OpenAI\'s Sora technology","category":"creative","icon":"๐ฌ","config":{"type":"stdio","command":"npx","args":["-y","@truffle-ai/sora-video-server"],"env":{"OPENAI_API_KEY":""},"timeout":60000},"tags":["video","generation","ai","creative"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Truffle AI","homepage":"https://github.com/truffle-ai/mcp-servers","matchIds":["sora","sora_video"]},{"id":"chartjs","name":"ChartJS","description":"Charting and visualization tool using ChartJS","category":"data","icon":"๐","config":{"type":"stdio","command":"npx","args":["-y","@ax-crew/chartjs-mcp-server"],"timeout":30000},"tags":["chart","visualization","data","chartjs"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"ax-crew","homepage":"https://github.com/ax-crew/chartjs-mcp-server","matchIds":["chartjs"]},{"id":"rag-lite-ts","name":"Rag-lite TS","description":"A local-first TypeScript retrieval engine for semantic search over static documents.","category":"data","icon":"๐","config":{"type":"stdio","command":"npx","args":["-y","raglite-mcp"],"timeout":30000},"tags":["rag","data","ai"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"FrugalX","homepage":"https://github.com/raglite/rag-lite-ts","matchIds":["rag-lite-ts"]},{"id":"exa","name":"Exa","description":"AI-powered web search and research API with semantic search capabilities.","category":"data","icon":"๐","config":{"type":"http","url":"https://mcp.exa.ai/mcp","headers":{}},"tags":["rag","data","ai"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Exa","homepage":"https://docs.exa.ai/reference/exa-mcp","matchIds":["exa"]},{"id":"firecrawl","name":"Firecrawl","description":"AI-powered web search and research API that performs semantic search across web sources, aggregates and ranks results for relevance, and returns contextual summaries with citations","category":"data","icon":"๐","config":{"type":"stdio","command":"npx","args":["-y","firecrawl-mcp"],"env":{"FIRECRAWL_API_KEY":""},"timeout":30000},"tags":["search","web","research","ai"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Firecrawl","homepage":"https://docs.firecrawl.dev/mcp-server","matchIds":["firecrawl"]},{"id":"shadcn","name":"Shadcn","description":"Shadcn UI components for MCP servers","category":"development","icon":"๐๏ธ","config":{"type":"stdio","command":"npx","args":["shadcn@latest","mcp"],"timeout":30000},"tags":["shadcn","ui","components","mcp"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Shadcn","homepage":"https://ui.shadcn.com/docs/mcp#configuration","matchIds":["shadcn"]},{"id":"kite-trade","name":"Kite","description":"Zerodha Kite API MCP server","category":"data","icon":"๐ฐ","config":{"type":"http","url":"https://mcp.kite.trade/mcp","headers":{}},"tags":["kite","trade","data","ai"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Zerodha","homepage":"https://github.com/zerodha/kite-mcp-server","matchIds":["kite-trade"]},{"id":"coingecko","name":"CoinGecko","description":"CoinGecko API MCP server","category":"data","icon":"๐ฐ","config":{"type":"http","url":"https://mcp.api.coingecko.com/mcp","headers":{}},"tags":["coingecko","data","ai"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"CoinGecko","homepage":"https://docs.coingecko.com/docs/mcp-server","matchIds":["coingecko"]}]');class Ta{constructor(){this.registryEntries=[],this.isInitialized=!1}static normalizeId(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}static getInstance(){return Ta.instance||(Ta.instance=new Ta),Ta.instance}async initialize(){this.isInitialized||(this.registryEntries=this.getBuiltinEntries(),this.isInitialized=!0)}async getEntries(e){var r;await this.initialize();let n=[...this.registryEntries];if(e!=null&&e.category&&(n=n.filter(s=>s.category===e.category)),(r=e==null?void 0:e.tags)!=null&&r.length&&(n=n.filter(s=>e.tags.some(a=>s.tags.includes(a)))),e!=null&&e.search){const s=e.search.toLowerCase();n=n.filter(a=>a.name.toLowerCase().includes(s)||a.description.toLowerCase().includes(s)||a.tags.some(l=>l.toLowerCase().includes(s)))}return(e==null?void 0:e.installed)!==void 0&&(n=n.filter(s=>s.isInstalled===e.installed)),(e==null?void 0:e.official)!==void 0&&(n=n.filter(s=>s.isOfficial===e.official)),n.sort((s,a)=>s.isInstalled!==a.isInstalled?s.isInstalled?-1:1:s.isOfficial!==a.isOfficial?s.isOfficial?-1:1:s.name.localeCompare(a.name))}async updateEntry(e,n){const r=this.registryEntries.findIndex(s=>s.id===e);return r===-1?!1:(this.registryEntries[r]={...this.registryEntries[r],...n},!0)}async setInstalled(e,n){return this.updateEntry(e,{isInstalled:n})}async syncWithServerStatus(){try{if(await this.initialize(),this.registryEntries.length===0){console.warn("Registry entries not available for status sync");return}const e=await mt.api.mcp.servers.$get();if(!e.ok)throw new Error(`Failed to fetch servers: ${e.status}`);const r=(await e.json()).servers||[],s=new Set;r.forEach(a=>{if(!(a!=null&&a.id)||typeof a.id!="string")return;const l=Ta.normalizeId(a.id);s.add(l)});for(const a of this.registryEntries){const f=[a.id,a.name,...a.matchIds||[]].filter(Boolean).map(h=>Ta.normalizeId(String(h))).some(h=>s.has(h));a.isInstalled!==f&&(a.isInstalled=f)}}catch(e){console.warn("Failed to sync registry with server status:",e)}}async getServerConfig(e){return await this.initialize(),this.registryEntries.find(n=>n.id===e)||null}getBuiltinEntries(){return gG}}const Ns=Ta.getInstance();function uC({className:t,...e}){return c.jsx("div",{"data-slot":"card",className:ae("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...e})}function vG({className:t,...e}){return c.jsx("div",{"data-slot":"card-header",className:ae("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...e})}function xG({className:t,...e}){return c.jsx("div",{"data-slot":"card-title",className:ae("leading-none font-semibold",t),...e})}function yG({className:t,...e}){return c.jsx("div",{"data-slot":"card-content",className:ae("px-6",t),...e})}function Rb({isOpen:t,onClose:e,onInstallServer:n,onOpenConnectModal:r,refreshTrigger:s,disableClose:a=!1}){const[l,u]=_.useState([]),[f,h]=_.useState([]),[g,p]=_.useState(!1),[x,y]=_.useState(null),[k,w]=_.useState(null),[S]=_.useState({}),[N,C]=_.useState(""),[j,A]=_.useState("grid"),[I,T]=_.useState(null),E=_.useRef(null),R=_.useRef(!0),z=_.useRef(null);_.useEffect(()=>(R.current=!0,()=>{R.current=!1,E.current&&clearTimeout(E.current),z.current&&z.current.abort()}),[]),_.useEffect(()=>{if(!t)return;(async()=>{z.current&&z.current.abort();const V=new AbortController;if(z.current=V,!!R.current){p(!0),y(null);try{await Ns.syncWithServerStatus();const U=await Ns.getEntries();R.current&&!V.signal.aborted&&(u(U),h(U))}catch(U){if(R.current&&!V.signal.aborted){const H=U instanceof Error?U.message:"Failed to load server registry";y(H)}}finally{R.current&&!V.signal.aborted&&p(!1)}}})()},[t,s]);const D=_.useCallback(async(M,V)=>{if(R.current)try{const U=await Ns.getEntries({...M,search:V||void 0});R.current&&h(U)}catch(U){if(R.current){const H=U instanceof Error?U.message:"Failed to filter entries";y(H)}}},[]);_.useEffect(()=>(E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{D(S,N)},300),()=>{E.current&&clearTimeout(E.current)}),[S,N,l,D]);const B=async M=>{if(R.current){w(M.id);try{await n(M)==="connected"?(await Ns.setInstalled(M.id,!0),R.current&&(u(U=>U.map(H=>H.id===M.id?{...H,isInstalled:!0}:H)),h(U=>U.map(H=>H.id===M.id?{...H,isInstalled:!0}:H)))):R.current&&(u(U=>U.map(H=>H.id===M.id?{...H,isInstalled:!1}:H)),h(U=>U.map(H=>H.id===M.id?{...H,isInstalled:!1}:H)))}catch(V){if(R.current){const U=V instanceof Error?V.message:"Failed to install server";y(U)}}finally{R.current&&w(null)}}},q=M=>{const V={productivity:"bg-blue-50 text-blue-700 border-blue-200/60",development:"bg-emerald-50 text-emerald-700 border-emerald-200/60",research:"bg-purple-50 text-purple-700 border-purple-200/60",creative:"bg-pink-50 text-pink-700 border-pink-200/60",data:"bg-amber-50 text-amber-700 border-amber-200/60",communication:"bg-indigo-50 text-indigo-700 border-indigo-200/60",custom:"bg-slate-50 text-slate-700 border-slate-200/60"};return V[M]||V.custom},K=a||!!k,G=_.useCallback(M=>{!M&&!K&&e()},[K,e]),F=K?M=>{M.preventDefault()}:void 0;return c.jsx(rr,{open:t,onOpenChange:G,children:c.jsxs(sr,{className:"!max-w-none w-[90vw] max-h-[85vh] overflow-hidden flex flex-col !sm:max-w-none p-0 bg-gradient-to-b from-background via-background to-muted/20",hideCloseButton:!0,onEscapeKeyDown:K?M=>M.preventDefault():void 0,onInteractOutside:F,children:[c.jsx(ir,{className:"pb-4 border-b px-6 pt-5 bg-gradient-to-r from-muted/30 via-transparent to-transparent",children:c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"p-2 rounded-lg bg-primary/10 border border-primary/20 flex-shrink-0",children:c.jsx(Bi,{className:"h-5 w-5 text-primary"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx(ar,{className:"text-lg font-semibold leading-tight mb-1",children:"MCP Server Registry"}),c.jsx(Yr,{className:"text-sm text-muted-foreground",children:"Discover and add integrations to your AI assistant"})]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(ye,{onClick:()=>{K||e(),r==null||r()},size:"sm",variant:"outline",className:"h-8 px-3 text-sm font-medium hover:bg-muted whitespace-nowrap",children:[c.jsx(v$,{className:"mr-1.5 h-3.5 w-3.5"}),"Connect Custom"]}),c.jsxs(ye,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>e(),disabled:K,children:[c.jsx(Er,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}),c.jsxs("div",{className:"flex gap-3 mb-5 px-6 pt-5",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(As,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground/60 pointer-events-none z-10"}),c.jsx(st,{placeholder:"Search servers and integrations...",value:N,onChange:M=>C(M.target.value),className:"pl-10 h-10 border focus:border-primary/40 bg-background text-sm placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-primary/20 transition-all"})]}),c.jsxs("div",{className:"flex bg-muted/50 rounded-md p-1 border",children:[c.jsxs(ye,{variant:j==="grid"?"secondary":"ghost",size:"sm",onClick:()=>{A("grid"),T(null)},className:ae("h-8 px-3 rounded-sm transition-all text-sm font-medium",j==="grid"?"bg-background shadow-sm":"hover:bg-background/50"),children:[c.jsx(F$,{className:"h-3.5 w-3.5 mr-1.5"}),"Grid"]}),c.jsxs(ye,{variant:j==="list"?"secondary":"ghost",size:"sm",onClick:()=>{A("list"),T(null)},className:ae("h-8 px-3 rounded-sm transition-all text-sm font-medium",j==="list"?"bg-background shadow-sm":"hover:bg-background/50"),children:[c.jsx(W$,{className:"h-3.5 w-3.5 mr-1.5"}),"List"]})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-6 pb-6",children:[x&&c.jsx(ds,{variant:"destructive",className:"mb-6 border-2 border-red-300 bg-red-50 shadow-md",children:c.jsx(fs,{className:"text-red-800 font-medium",children:x})}),g?c.jsx("div",{className:"flex items-center justify-center py-24",children:c.jsxs("div",{className:"flex flex-col items-center space-y-5",children:[c.jsx("div",{className:"h-12 w-12 border-4 border-primary/30 border-t-primary rounded-full animate-spin"}),c.jsx("div",{className:"text-lg text-foreground font-semibold",children:"Discovering servers..."}),c.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading registry entries"})]})}):f.length===0?c.jsxs("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:[c.jsx("div",{className:"p-6 rounded-2xl bg-gradient-to-br from-muted/50 to-muted/30 border-2 border-border/30 mb-6 shadow-sm",children:c.jsx(Bi,{className:"h-14 w-14 text-muted-foreground/60 mx-auto"})}),c.jsx("div",{className:"text-xl font-bold text-foreground mb-3",children:l.length===0?"No servers available in the registry":"No servers match your search"}),c.jsx("div",{className:"text-base text-muted-foreground/80 mb-6 max-w-md",children:l.length===0?"The registry is currently empty or failed to load":"Try adjusting your search terms or browse all categories"}),N&&c.jsxs(ye,{variant:"outline",onClick:()=>C(""),className:"border-2 border-primary/30 hover:bg-primary/10 hover:border-primary/50 font-semibold",children:[c.jsx(As,{className:"h-4 w-4 mr-2"}),"Clear search"]})]}):c.jsx("div",{className:ae(j==="grid"?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-3"),children:f.map((M,V)=>{const U=I===M.id,H=M.description&&M.description.length>100;return j==="grid"?c.jsx(uC,{className:ae("group relative overflow-hidden transition-all duration-200 hover:-translate-y-0.5 border bg-card shadow-sm hover:shadow-lg hover:border-primary/30 flex flex-col",U&&"ring-1 ring-primary/20 border-primary/40 shadow-lg -translate-y-0.5"),style:{animationDelay:`${Math.min(V*30,300)}ms`},children:c.jsxs("div",{className:"cursor-pointer flex flex-col flex-1",onClick:()=>T(U?null:M.id),children:[c.jsx(vG,{className:"pb-3 flex-shrink-0",children:c.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[c.jsxs("div",{className:"relative flex-shrink-0",children:[c.jsx("div",{className:"text-2xl w-12 h-12 flex items-center justify-center rounded-lg bg-gradient-to-br from-primary/15 to-primary/5 border border-primary/20 group-hover:border-primary/30 transition-all duration-200",children:M.icon||"โก"}),M.isInstalled&&c.jsx("div",{className:"absolute -top-1 -right-1 w-4 h-4 bg-emerald-500 rounded-full border-2 border-card flex items-center justify-center",children:c.jsx(Ts,{className:"h-2.5 w-2.5 text-white"})})]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx(xG,{className:"text-base font-semibold mb-2 group-hover:text-primary transition-colors leading-snug line-clamp-2",children:M.name}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[M.isOfficial&&c.jsxs(yn,{variant:"outline",className:"text-xs px-1.5 py-0 bg-blue-50 text-blue-700 border-blue-200/60 font-medium",children:[c.jsx(kd,{className:"h-2.5 w-2.5 mr-1 fill-blue-400 text-blue-400"}),"Official"]}),M.category&&c.jsx(yn,{variant:"outline",className:ae("text-xs px-1.5 py-0 font-medium capitalize",q(M.category)),children:M.category})]})]})]})}),c.jsxs(yG,{className:"pt-0 flex flex-col flex-1",children:[c.jsxs("div",{className:"flex-1",children:[c.jsx("p",{className:ae("text-sm text-muted-foreground leading-relaxed transition-all duration-200",U?"":"line-clamp-3"),children:M.description}),U&&c.jsxs("div",{className:"space-y-3 pt-3 mt-3 border-t border-border/30 animate-in slide-in-from-top-1 duration-200",children:[M.author&&c.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[c.jsx("div",{className:"p-1 rounded bg-muted/40",children:c.jsx(Lj,{className:"h-3 w-3 text-muted-foreground"})}),c.jsxs("div",{children:[c.jsxs("span",{className:"text-muted-foreground/70",children:["by"," "]}),c.jsx("span",{className:"font-medium text-foreground",children:M.author})]})]}),M.tags&&M.tags.length>0&&c.jsxs("div",{className:"flex flex-wrap gap-1",children:[M.tags.slice(0,6).map(L=>c.jsx(yn,{variant:"outline",className:"text-xs px-1.5 py-0 text-muted-foreground border-border/40 bg-muted/20 font-normal",children:L},L)),M.tags.length>6&&c.jsxs(yn,{variant:"outline",className:"text-xs px-1.5 py-0 text-muted-foreground border-border/40 bg-muted/20",children:["+",M.tags.length-6]})]}),M.homepage&&c.jsxs("a",{href:M.homepage,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs text-primary hover:text-primary/80 transition-colors font-medium",onClick:L=>L.stopPropagation(),children:[c.jsx(sb,{className:"h-3 w-3"}),"Documentation"]})]})]}),c.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-border/30 flex-shrink-0 mt-auto",children:[H&&c.jsx(ye,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-foreground p-0 h-auto font-medium -ml-1",children:U?c.jsxs(c.Fragment,{children:[c.jsx(Ua,{className:"h-3 w-3 mr-1"}),"Less"]}):c.jsxs(c.Fragment,{children:[c.jsx(Ar,{className:"h-3 w-3 mr-1"}),"More"]})}),c.jsx("div",{className:"ml-auto",children:c.jsx(ye,{onClick:L=>{L.stopPropagation(),B(M)},disabled:M.isInstalled||k===M.id,size:"sm",variant:M.isInstalled?"outline":"default",className:ae("h-8 px-4 transition-all font-semibold text-sm shadow-sm",k===M.id&&"opacity-70",M.isInstalled&&"border bg-emerald-50 text-emerald-700 border-emerald-200 hover:bg-emerald-100",!M.isInstalled&&"bg-primary hover:bg-primary/90"),children:k===M.id?c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("div",{className:"h-3 w-3 border-2 border-current border-t-transparent rounded-full animate-spin"}),c.jsx("span",{children:"Adding"})]}):M.isInstalled?c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(Ts,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Added"})]}):c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(us,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Add"})]})})})]})]})]})},M.id):c.jsx(uC,{className:ae("group transition-all duration-200 hover:-translate-y-0.5 border bg-card shadow-sm hover:shadow-md hover:border-primary/30 cursor-pointer !py-0 !gap-0",U&&"border-primary/40 shadow-md -translate-y-0.5"),onClick:()=>T(U?null:M.id),children:c.jsx("div",{className:"p-4",children:c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsxs("div",{className:"relative flex-shrink-0",children:[c.jsx("div",{className:"w-12 h-12 rounded-lg bg-gradient-to-br from-primary/15 to-primary/5 border border-primary/20 group-hover:border-primary/30 flex items-center justify-center text-2xl transition-all duration-200",children:M.icon||"โก"}),M.isInstalled&&c.jsx("div",{className:"absolute -top-1 -right-1 w-4 h-4 bg-emerald-500 rounded-full border-2 border-card flex items-center justify-center",children:c.jsx(Ts,{className:"h-2.5 w-2.5 text-white"})})]}),c.jsxs("div",{className:"flex-1 min-w-0 space-y-2.5",children:[c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[c.jsx("h3",{className:"text-base font-semibold text-foreground group-hover:text-primary transition-colors leading-snug",children:M.name}),H&&c.jsx(Ar,{className:ae("h-3.5 w-3.5 text-muted-foreground/60 transition-all duration-200 flex-shrink-0",U&&"rotate-180 text-muted-foreground")})]}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[M.isOfficial&&c.jsxs(yn,{variant:"outline",className:"text-xs px-1.5 py-0 bg-blue-50 text-blue-700 border-blue-200/60 font-medium",children:[c.jsx(kd,{className:"h-2.5 w-2.5 mr-1 fill-blue-400 text-blue-400"}),"Official"]}),M.category&&c.jsx(yn,{variant:"outline",className:ae("text-xs px-1.5 py-0 font-medium capitalize",q(M.category)),children:M.category})]})]}),c.jsx(ye,{onClick:L=>{L.stopPropagation(),B(M)},disabled:M.isInstalled||k===M.id,size:"sm",variant:M.isInstalled?"outline":"default",className:ae("h-8 px-4 text-sm font-semibold transition-all flex-shrink-0 shadow-sm",k===M.id&&"opacity-70",M.isInstalled&&"border bg-emerald-50 text-emerald-700 border-emerald-200 hover:bg-emerald-100",!M.isInstalled&&"bg-primary hover:bg-primary/90"),children:k===M.id?c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("div",{className:"h-3 w-3 border-2 border-current border-t-transparent rounded-full animate-spin"}),c.jsx("span",{children:"Adding"})]}):M.isInstalled?c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(Ts,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Added"})]}):c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(us,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Add"})]})})]}),c.jsx("div",{children:c.jsx("p",{className:ae("text-sm text-muted-foreground leading-relaxed transition-all duration-200",U?"":"line-clamp-2"),children:M.description})}),U&&c.jsxs("div",{className:"space-y-3 pt-3 border-t border-border/30 animate-in slide-in-from-top-2 duration-200",children:[M.author&&c.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[c.jsx("div",{className:"p-1 rounded bg-muted/40",children:c.jsx(Lj,{className:"h-3 w-3 text-muted-foreground"})}),c.jsxs("div",{children:[c.jsxs("span",{className:"text-muted-foreground/70",children:["by"," "]}),c.jsx("span",{className:"font-medium text-foreground",children:M.author})]})]}),M.tags&&M.tags.length>0&&c.jsx("div",{className:"flex flex-wrap gap-1.5",children:M.tags.map(L=>c.jsx(yn,{variant:"outline",className:"text-xs px-2 py-0.5 text-muted-foreground border-border/40 bg-muted/20 font-normal",children:L},L))}),M.homepage&&c.jsxs("a",{href:M.homepage,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs text-primary hover:text-primary/80 transition-colors font-medium",onClick:L=>L.stopPropagation(),children:[c.jsx(sb,{className:"h-3 w-3"}),"Documentation"]})]})]})]})})},M.id)})})]})]})})}const bG=new Set(["placeholder","your-api-key","your_api_key","enter-your-token","xxx","...","todo"]),wG=["your-","your_","your ","enter-","enter_","enter ","placeholder","api_key","api-key","api key","secret","token","password","xxx","..."],_G=[/^your[\s_-]?/,/^enter[\s_-]?/];function Bm(t){return Object.values(t).some(e=>{if(!e||e.trim()==="")return!0;const n=e.trim().toLowerCase();return bG.has(n)||_G.some(r=>r.test(n))?!0:wG.some(r=>n.includes(r))})}function bR(t){const e=t.config.timeout??3e4;switch(t.config.type){case"stdio":return{type:"stdio",command:t.config.command??"",args:t.config.args??[],env:t.config.env??{},timeout:e,connectionMode:"lenient"};case"sse":return{type:"sse",url:t.config.url??"",headers:t.config.headers??{},timeout:e,connectionMode:"lenient"};case"http":default:return{type:"http",url:t.config.url??"",headers:t.config.headers??{},timeout:e,connectionMode:"lenient"}}}function dC({isOpen:t,onClose:e,onOpenConnectModal:n,onOpenConnectWithPrefill:r,onServerConnected:s,variant:a,refreshTrigger:l}){const u=a??"overlay",f=Nc(),[h,g]=_.useState(null),[p,x]=_.useState(!1),[y,k]=_.useState(!1),[w,S]=_.useState(!1),{data:N=[],isLoading:C,error:j,refetch:A}=TE(t),{data:I=[],isLoading:T,error:E}=AE(h,t&&!!h),R=o0(),z=hP(),D=mP();_.useEffect(()=>{if(N.length>0&&!h){const F=N.find(M=>M.status==="connected");g((F==null?void 0:F.id)||N[0].id)}},[N,h]);const B=async F=>{const M=bR(F),V=M.type==="stdio"&&Object.keys(M.env||{}).length>0&&Bm(M.env||{}),U=(M.type==="sse"||M.type==="http")&&Object.keys(M.headers||{}).length>0&&Bm(M.headers||{});if(V||U)return typeof r=="function"&&r({name:F.name,config:M,lockName:!0,registryEntryId:F.id,onCloseRegistryModal:()=>k(!1)}),"requires-input";try{S(!0),await R.mutateAsync({name:F.name,config:M,persistToAgent:!1});try{await Ns.syncWithServerStatus()}catch(H){console.warn("Failed to sync registry after server install:",H)}return f.trackMCPServerConnected({serverName:F.name,transportType:M.type}),k(!1),s==null||s(F.name),"connected"}catch(H){throw new Error(H.message||"Failed to install server")}finally{S(!1)}},q=async F=>{const M=N.find(V=>V.id===F);if(M&&window.confirm(`Are you sure you want to remove server "${M.name}"?`))try{h===F&&g(null),await z.mutateAsync(F);try{const V=ne=>ne.toLowerCase().replace(/[^a-z0-9]+/g,"-"),U=V(F),L=(await Ns.getEntries()).find(ne=>[ne.id,ne.name,...ne.matchIds||[]].filter(Boolean).map(P=>V(String(P))).includes(U));L&&await Ns.setInstalled(L.id,!1)}catch(V){console.warn("Failed to update registry installed state on delete:",V)}try{await Ns.syncWithServerStatus()}catch(V){console.warn("Failed to sync registry status after server deletion:",V)}}catch(V){console.error("Delete server error:",V)}},K=async F=>{const M=N.find(V=>V.id===F);if(M&&window.confirm(`Restart server "${M.name}"?`))try{await D.mutateAsync(F);try{await Ns.syncWithServerStatus()}catch(V){console.warn("Failed to sync registry status after server restart:",V)}}catch(V){console.error("Restart server error:",V)}};_.useEffect(()=>{l&&t&&A()},[l,t,A]);const G=N.find(F=>F.id===h);return u==="inline"?c.jsxs("aside",{className:"h-full w-full flex flex-col bg-card",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border/50 bg-card/50 backdrop-blur-sm",children:[c.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Tools & Servers"}),c.jsx("div",{className:"flex items-center space-x-1",children:c.jsx(ye,{variant:"ghost",size:"sm",onClick:()=>A(),disabled:C,className:"h-8 w-8 p-0",children:c.jsx(hr,{className:ae("h-3.5 w-3.5",C&&"animate-spin")})})})]}),c.jsxs("div",{className:"px-4 py-3 space-y-2 border-b border-border/30",children:[c.jsxs(ye,{onClick:()=>k(!0),className:"w-full h-9 text-sm font-medium",size:"sm",children:[c.jsx(Rj,{className:"mr-2 h-4 w-4"}),"Connect MCPs"]}),c.jsxs(ye,{onClick:()=>window.open("/playground","_blank"),className:"w-full h-9 text-sm font-medium",size:"sm",variant:"outline",children:[c.jsx(Tm,{className:"mr-2 h-4 w-4"}),"MCP Playground"]})]}),c.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[c.jsxs("div",{className:"p-4 border-b border-border/30",children:[c.jsx("div",{className:"flex items-center justify-between mb-3",children:c.jsxs("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:["Connected Servers (",N.length,")"]})}),C&&c.jsx("div",{className:"flex items-center justify-center py-8",children:c.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[c.jsx(hr,{className:"h-5 w-5 animate-spin text-muted-foreground"}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading servers..."})]})}),j&&c.jsx("div",{className:"p-3 rounded-lg bg-destructive/10 border border-destructive/20 mb-3",children:c.jsxs("div",{className:"flex items-start space-x-2",children:[c.jsx(Ln,{className:"h-4 w-4 text-destructive flex-shrink-0 mt-0.5"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"text-xs font-medium text-destructive",children:"Connection Error"}),c.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:(j==null?void 0:j.message)||"Failed to load servers"})]})]})}),!C&&N.length===0&&!j&&c.jsxs("div",{className:"text-center py-8",children:[c.jsx(Bi,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"No servers connected"}),c.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"Connect or browse the registry"})]}),N.map(F=>c.jsx("div",{onClick:()=>g(F.id),className:ae("p-3 rounded-lg border cursor-pointer transition-all duration-200 mb-2 last:mb-0",h===F.id?"bg-primary/5 border-primary/20 shadow-sm":"bg-background hover:bg-muted/50 border-border/50 hover:border-border"),children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx("div",{className:ae("w-2 h-2 rounded-full flex-shrink-0",F.status==="connected"?"bg-green-500":F.status==="error"?"bg-red-500":"bg-yellow-500")}),c.jsx("h4",{className:"text-sm font-medium truncate",children:F.name})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1 capitalize",children:F.status})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[D.isPending&&D.variables===F.id?c.jsx("div",{className:"h-8 w-8 flex items-center justify-center",children:c.jsx(hr,{className:"h-4 w-4 animate-spin text-muted-foreground",role:"status","aria-label":`Restarting ${F.name}โฆ`})}):c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"sm",onClick:M=>{M.stopPropagation(),K(F.id)},className:"h-8 w-8 p-0 text-muted-foreground hover:text-primary","aria-label":`Restart server ${F.name}`,disabled:z.isPending&&z.variables===F.id,children:c.jsx(Ij,{className:"h-3.5 w-3.5"})})}),c.jsx(Lt,{side:"top",children:"Restart server"})]}),z.isPending&&z.variables===F.id?c.jsx("div",{className:"h-8 w-8 flex items-center justify-center",children:c.jsx(hr,{className:"h-4 w-4 animate-spin text-muted-foreground",role:"status","aria-label":`Removing ${F.name}โฆ`})}):c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"sm",onClick:M=>{M.stopPropagation(),q(F.id)},className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive","aria-label":`Remove server ${F.name}`,disabled:D.isPending&&D.variables===F.id,children:c.jsx(Zn,{className:"h-3.5 w-3.5"})})}),c.jsx(Lt,{side:"top",children:"Remove server"})]})]})]})},F.id))]}),G&&c.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[c.jsx("div",{className:"px-4 py-3 border-b border-border/30",children:c.jsxs("button",{onClick:()=>x(!p),className:"flex items-center justify-between w-full text-left",children:[c.jsxs("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:["Available Tools ",I.length>0&&`(${I.length})`]}),c.jsx(Ar,{className:ae("h-3.5 w-3.5 transition-transform text-muted-foreground",p&&"rotate-180")})]})}),p&&c.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:[T&&c.jsx("div",{className:"flex items-center justify-center py-6",children:c.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[c.jsx(hr,{className:"h-4 w-4 animate-spin text-muted-foreground"}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading tools..."})]})}),E&&c.jsx("div",{className:"p-3 rounded-lg bg-destructive/10 border border-destructive/20 mb-3",children:c.jsxs("div",{className:"flex items-start space-x-2",children:[c.jsx(Ln,{className:"h-4 w-4 text-destructive flex-shrink-0 mt-0.5"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"text-xs font-medium text-destructive",children:"Tools Error"}),c.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:(E==null?void 0:E.message)||"Failed to load tools"})]})]})}),!T&&I.length===0&&!E&&G.status==="connected"&&c.jsxs("div",{className:"text-center py-6",children:[c.jsx(Oj,{className:"h-6 w-6 text-muted-foreground/50 mx-auto mb-2"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"No tools available"})]}),G.status!=="connected"&&c.jsxs("div",{className:"text-center py-6",children:[c.jsx(Ln,{className:"h-6 w-6 text-muted-foreground/50 mx-auto mb-2"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Server not connected"}),c.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"Tools unavailable"})]}),I.map(F=>{var M;return c.jsxs("div",{className:"p-3 rounded-lg border border-border/50 bg-background hover:bg-muted/30 transition-colors mb-2 last:mb-0",children:[c.jsx("h4",{className:"text-sm font-medium mb-1",children:F.name}),F.description&&c.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:F.description}),((M=F.inputSchema)==null?void 0:M.properties)&&c.jsxs("div",{className:"flex flex-wrap gap-1 mt-2",children:[Object.keys(F.inputSchema.properties).slice(0,3).map(V=>c.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-muted text-xs font-medium",children:V},V)),Object.keys(F.inputSchema.properties).length>3&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",Object.keys(F.inputSchema.properties).length-3," ","more"]})]})]},F.name)})]})]})]}),c.jsx(Rb,{isOpen:y,onClose:()=>k(!1),onInstallServer:B,onOpenConnectModal:n,disableClose:w})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:ae("fixed inset-0 bg-black/50 z-30 transition-opacity duration-300",t?"opacity-100":"opacity-0 pointer-events-none"),onClick:e}),c.jsxs("aside",{className:ae("fixed top-0 right-0 z-40 h-screen w-80 bg-card border-l border-border shadow-xl transition-transform duration-300 ease-in-out flex flex-col",t?"translate-x-0":"translate-x-full"),children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border/50 bg-card/50 backdrop-blur-sm",children:[c.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Tools & Servers"}),c.jsxs("div",{className:"flex items-center space-x-1",children:[c.jsx(ye,{variant:"ghost",size:"sm",onClick:()=>A(),disabled:C,className:"h-8 w-8 p-0",children:c.jsx(hr,{className:ae("h-3.5 w-3.5",C&&"animate-spin")})}),c.jsx(ye,{variant:"ghost",size:"sm",onClick:e,className:"h-8 w-8 p-0",children:c.jsx(Er,{className:"h-3.5 w-3.5"})})]})]}),c.jsxs("div",{className:"px-4 py-3 space-y-2 border-b border-border/30",children:[c.jsxs(ye,{onClick:()=>k(!0),className:"w-full h-9 text-sm font-medium",size:"sm",children:[c.jsx(Rj,{className:"mr-2 h-4 w-4"}),"Connect MCPs"]}),c.jsxs(ye,{onClick:()=>window.open("/playground","_blank"),className:"w-full h-9 text-sm font-medium",size:"sm",variant:"outline",children:[c.jsx(Tm,{className:"mr-2 h-4 w-4"}),"MCP Playground"]})]}),c.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[c.jsxs("div",{className:"p-4 border-b border-border/30",children:[c.jsx("div",{className:"flex items-center justify-between mb-3",children:c.jsxs("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:["Connected Servers (",N.length,")"]})}),C&&c.jsx("div",{className:"flex items-center justify-center py-8",children:c.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[c.jsx(hr,{className:"h-5 w-5 animate-spin text-muted-foreground"}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading servers..."})]})}),j&&c.jsx("div",{className:"p-3 rounded-lg bg-destructive/10 border border-destructive/20 mb-3",children:c.jsxs("div",{className:"flex items-start space-x-2",children:[c.jsx(Ln,{className:"h-4 w-4 text-destructive flex-shrink-0 mt-0.5"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"text-xs font-medium text-destructive",children:"Connection Error"}),c.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:(j==null?void 0:j.message)||"Failed to load servers"})]})]})}),!C&&N.length===0&&!j&&c.jsxs("div",{className:"text-center py-8",children:[c.jsx(Bi,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"No servers connected"}),c.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"Connect or browse the registry"})]}),N.map(F=>c.jsx("div",{onClick:()=>g(F.id),className:ae("p-3 rounded-lg border cursor-pointer transition-all duration-200 mb-2 last:mb-0",h===F.id?"bg-primary/5 border-primary/20 shadow-sm":"bg-background hover:bg-muted/50 border-border/50 hover:border-border"),children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx("div",{className:ae("w-2 h-2 rounded-full flex-shrink-0",F.status==="connected"?"bg-green-500":F.status==="error"?"bg-red-500":"bg-yellow-500")}),c.jsx("h4",{className:"text-sm font-medium truncate",children:F.name})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1 capitalize",children:F.status})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[D.isPending&&D.variables===F.id?c.jsx("div",{className:"h-8 w-8 flex items-center justify-center",children:c.jsx(hr,{className:"h-4 w-4 animate-spin text-muted-foreground",role:"status","aria-label":`Restarting ${F.name}โฆ`})}):c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"sm",onClick:M=>{M.stopPropagation(),K(F.id)},className:"h-8 w-8 p-0 text-muted-foreground hover:text-primary","aria-label":`Restart server ${F.name}`,disabled:z.isPending&&z.variables===F.id,children:c.jsx(Ij,{className:"h-3.5 w-3.5"})})}),c.jsx(Lt,{side:"top",children:"Restart server"})]}),z.isPending&&z.variables===F.id?c.jsx("div",{className:"h-8 w-8 flex items-center justify-center",children:c.jsx(hr,{className:"h-4 w-4 animate-spin text-muted-foreground",role:"status","aria-label":`Removing ${F.name}โฆ`})}):c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"sm",onClick:M=>{M.stopPropagation(),q(F.id)},className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive","aria-label":`Remove server ${F.name}`,disabled:D.isPending&&D.variables===F.id,children:c.jsx(Zn,{className:"h-3.5 w-3.5"})})}),c.jsx(Lt,{side:"top",children:"Remove server"})]})]})]})},F.id))]}),G&&c.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[c.jsx("div",{className:"px-4 py-3 border-b border-border/30",children:c.jsxs("button",{onClick:()=>x(!p),className:"flex items-center justify-between w-full text-left",children:[c.jsx("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Available Tools"}),c.jsx(Ar,{className:ae("h-3.5 w-3.5 transition-transform text-muted-foreground",p&&"rotate-180")})]})}),p&&c.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:[T&&c.jsx("div",{className:"flex items-center justify-center py-6",children:c.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[c.jsx(hr,{className:"h-4 w-4 animate-spin text-muted-foreground"}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading tools..."})]})}),E&&c.jsx("div",{className:"p-3 rounded-lg bg-destructive/10 border border-destructive/20 mb-3",children:c.jsxs("div",{className:"flex items-start space-x-2",children:[c.jsx(Ln,{className:"h-4 w-4 text-destructive flex-shrink-0 mt-0.5"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"text-xs font-medium text-destructive",children:"Tools Error"}),c.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:(E==null?void 0:E.message)||"Failed to load tools"})]})]})}),!T&&I.length===0&&!E&&G.status==="connected"&&c.jsxs("div",{className:"text-center py-6",children:[c.jsx(Oj,{className:"h-6 w-6 text-muted-foreground/50 mx-auto mb-2"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"No tools available"})]}),G.status!=="connected"&&c.jsxs("div",{className:"text-center py-6",children:[c.jsx(Ln,{className:"h-6 w-6 text-muted-foreground/50 mx-auto mb-2"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Server not connected"}),c.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"Tools unavailable"})]}),I.map(F=>{var M;return c.jsxs("div",{className:"p-3 rounded-lg border border-border/50 bg-background hover:bg-muted/30 transition-colors mb-2 last:mb-0",children:[c.jsx("h4",{className:"text-sm font-medium mb-1",children:F.name}),F.description&&c.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:F.description}),((M=F.inputSchema)==null?void 0:M.properties)&&c.jsxs("div",{className:"flex flex-wrap gap-1 mt-2",children:[Object.keys(F.inputSchema.properties).slice(0,3).map(V=>c.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-muted text-xs font-medium",children:V},V)),Object.keys(F.inputSchema.properties).length>3&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",Object.keys(F.inputSchema.properties).length-3," ","more"]})]})]},F.name)})]})]})]}),c.jsx(Rb,{isOpen:y,onClose:()=>k(!1),onInstallServer:B,onOpenConnectModal:n,disableClose:w})]})]})}const Yd=_.forwardRef(({className:t,children:e,...n},r)=>c.jsx("div",{ref:r,className:ae("relative overflow-auto",t),...n,children:e}));Yd.displayName="ScrollArea";function kG(t){return t.sort((e,n)=>{const r=e.lastActivity?new Date(e.lastActivity).getTime():0;return(n.lastActivity?new Date(n.lastActivity).getTime():0)-r})}function fC({isOpen:t,onClose:e,currentSessionId:n,onSessionChange:r,returnToWelcome:s,variant:a="overlay",onSearchOpen:l,onNewChat:u}){var ne,ie;const[f,h]=_.useState(!1),[g,p]=_.useState(""),[x,y]=_.useState(!1),[k,w]=_.useState(null),[S,N]=_.useState(!1),[C,j]=_.useState(""),[A,I]=_.useState(null),{data:T=[],isLoading:E,error:R}=uP(t),z=kG([...T]),D=dP(),B=EE(),q=fP(),K=async()=>{const P=await D.mutateAsync({sessionId:g.trim()||void 0});p(""),h(!1),r(P.id)},G=async P=>{await B.mutateAsync({sessionId:P}),n===P&&s()},F=async()=>{if(!k)return;await B.mutateAsync({sessionId:k}),n===k&&s(),y(!1),w(null)},M=(P,pe)=>{w(P),j(pe||""),N(!0)},V=async()=>{if(!(!k||!C.trim()))try{await q.mutateAsync({sessionId:k,title:C.trim()}),N(!1),w(null),j("")}catch(P){console.error(`Failed to rename session: ${P}`)}},U=async P=>{try{await navigator.clipboard.writeText(P),I(P)}catch(pe){console.error(`Failed to copy session ID: ${pe}`)}};_.useEffect(()=>{if(A){const P=setTimeout(()=>I(null),2e3);return()=>clearTimeout(P)}},[A]);const H=P=>{if(!P)return"Unknown";const Pe=Date.now()-P,Ne=Math.floor(Pe/6e4),ge=Math.floor(Pe/36e5),Fe=Math.floor(Pe/864e5);return Ne<1?"Just now":Ne<60?`${Ne}m ago`:ge<24?`${ge}h ago`:`${Fe}d ago`},L=c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"p-3 space-y-3 border-b border-border/50",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h2",{id:"sessionpanel-title",className:"text-base font-semibold",children:"Chat History"}),a==="overlay"&&c.jsx(ye,{variant:"ghost",size:"sm",onClick:e,className:"h-7 w-7 p-0","aria-label":"Close panel",children:c.jsx(Er,{className:"h-3.5 w-3.5"})})]}),c.jsxs("div",{className:"flex flex-col gap-2",children:[u&&c.jsxs(ye,{variant:"outline",size:"sm",onClick:u,className:"w-full h-9 justify-start gap-2",children:[c.jsx(us,{className:"h-4 w-4"}),c.jsx("span",{children:"New Chat"})]}),l&&c.jsxs(ye,{variant:"outline",size:"sm",onClick:l,className:"w-full h-9 justify-start gap-2",children:[c.jsx(As,{className:"h-4 w-4"}),c.jsx("span",{children:"Search Chats"})]})]})]}),R&&c.jsx("div",{className:"p-4",children:c.jsxs(ds,{variant:"destructive",children:[c.jsx(Ln,{className:"h-4 w-4"}),c.jsx(fs,{children:R.message})]})}),c.jsx(Yd,{className:"flex-1",children:E?c.jsx("div",{className:"flex items-center justify-center py-8",children:c.jsx(hr,{className:"h-6 w-6 animate-spin"})}):z.length===0?c.jsxs("div",{className:"text-center py-8 text-muted-foreground px-4",children:[c.jsx(WE,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),c.jsx("p",{children:"No chat history"}),c.jsx("p",{className:"text-sm",children:"Start a conversation to see it here"})]}):c.jsx("div",{className:"px-3 py-2 space-y-0.5",children:z.map(P=>{const pe=P.title&&P.title.trim().length>0?P.title:P.id,Pe=n===P.id;return c.jsx("div",{className:ae("group relative px-3 py-2.5 rounded-lg transition-colors cursor-pointer",Pe?"bg-muted/40 hover:bg-muted/60":"hover:bg-muted/30"),role:"button",tabIndex:0,"aria-current":Pe?"page":void 0,onClick:()=>r(P.id),onKeyDown:Ne=>{Ne.target===Ne.currentTarget&&(Ne.key==="Enter"||Ne.key===" ")&&(Ne.preventDefault(),r(P.id))},children:c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("h3",{className:ae("text-sm truncate",Pe?"font-semibold":"font-normal text-muted-foreground"),children:pe}),c.jsx("span",{className:"text-xs text-muted-foreground",children:H(P.lastActivity)})]}),c.jsxs(Td,{children:[c.jsx(Ad,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"sm",onClick:Ne=>Ne.stopPropagation(),className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity","aria-label":"Session options",children:c.jsx(YE,{className:"h-4 w-4 text-muted-foreground"})})}),c.jsxs(bc,{align:"end",className:"w-48",onClick:Ne=>Ne.stopPropagation(),children:[c.jsxs($t,{onClick:()=>M(P.id,P.title??null),children:[c.jsx(Dj,{className:"h-4 w-4 mr-2"}),"Rename"]}),c.jsxs($t,{onClick:()=>U(P.id),children:[A===P.id?c.jsx(Es,{className:"h-4 w-4 mr-2 text-green-500"}):c.jsx(Pd,{className:"h-4 w-4 mr-2"}),A===P.id?"Copied!":"Copy Session ID"]}),c.jsx(Pi,{}),c.jsxs($t,{onClick:()=>{P.messageCount>0?(w(P.id),y(!0)):G(P.id)},className:"text-destructive focus:text-destructive",children:[c.jsx(Zn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})},P.id)})})}),c.jsx(rr,{open:f,onOpenChange:h,children:c.jsxs(sr,{className:"sm:max-w-md",children:[c.jsx(ir,{children:c.jsx(ar,{children:"Start New Chat"})}),c.jsx("div",{className:"space-y-4",children:c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qt,{htmlFor:"sessionId",children:"Chat ID"}),c.jsx(st,{id:"sessionId",value:g,onChange:P=>p(P.target.value),placeholder:"e.g., user-123, project-alpha",className:"font-mono"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave empty to auto-generate a unique ID"})]})}),c.jsxs(Kr,{children:[c.jsx(ye,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),c.jsx(ye,{onClick:K,children:"Start Chat"})]})]})}),c.jsx(rr,{open:x,onOpenChange:y,children:c.jsxs(sr,{className:"sm:max-w-md",children:[c.jsxs(ir,{children:[c.jsxs(ar,{className:"flex items-center space-x-2",children:[c.jsx(Zn,{className:"h-5 w-5 text-destructive"}),c.jsx("span",{children:"Delete Conversation"})]}),c.jsxs(Yr,{children:["This will permanently delete this conversation and all its messages. This action cannot be undone.",k&&c.jsxs("span",{className:"block mt-2 font-medium",children:["Session:"," ",c.jsx("span",{className:"font-mono",children:k})]})]})]}),c.jsxs(Kr,{children:[c.jsx(ye,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),c.jsxs(ye,{variant:"destructive",onClick:F,disabled:B.isPending&&((ne=B.variables)==null?void 0:ne.sessionId)===k,className:"flex items-center space-x-2",children:[c.jsx(Zn,{className:"h-4 w-4"}),c.jsx("span",{children:B.isPending&&((ie=B.variables)==null?void 0:ie.sessionId)===k?"Deleting...":"Delete Conversation"})]})]})]})}),c.jsx(rr,{open:S,onOpenChange:N,children:c.jsxs(sr,{className:"sm:max-w-md",children:[c.jsxs(ir,{children:[c.jsxs(ar,{className:"flex items-center space-x-2",children:[c.jsx(Dj,{className:"h-5 w-5"}),c.jsx("span",{children:"Rename Chat"})]}),c.jsx(Yr,{children:"Enter a new name for this conversation."})]}),c.jsx("div",{className:"space-y-4",children:c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qt,{htmlFor:"renameTitle",children:"Chat Name"}),c.jsx(st,{id:"renameTitle",value:C,onChange:P=>j(P.target.value),placeholder:"Enter chat name...",onKeyDown:P=>{P.key==="Enter"&&C.trim()&&V()},autoFocus:!0})]})}),c.jsxs(Kr,{children:[c.jsx(ye,{variant:"outline",onClick:()=>N(!1),children:"Cancel"}),c.jsx(ye,{onClick:V,disabled:!C.trim()||q.isPending,children:q.isPending?"Saving...":"Save"})]})]})})]});return a==="inline"?c.jsx("div",{className:"h-full w-full flex flex-col bg-card",children:L}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:ae("fixed inset-0 bg-black/50 z-30 transition-opacity duration-300",t?"opacity-100":"opacity-0 pointer-events-none"),onClick:e}),c.jsx("aside",{role:"dialog","aria-modal":"true","aria-labelledby":"sessionpanel-title",tabIndex:-1,className:ae("fixed top-0 left-0 z-40 h-screen w-80 bg-card border-r border-border shadow-xl transition-transform duration-300 ease-in-out flex flex-col",t?"translate-x-0":"-translate-x-full"),children:L})]})}function SG(t,e="en"){const n=Date.now(),r=t-n,s=Math.abs(r),a=60*1e3,l=60*a,u=24*l,f=7*u,h=30*u,g=365*u;let p,x;return s<a?(p=Math.round(r/1e3),x="second"):s<l?(p=Math.round(r/a),x="minute"):s<u?(p=Math.round(r/l),x="hour"):s<f?(p=Math.round(r/u),x="day"):s<h?(p=Math.round(r/f),x="week"):s<g?(p=Math.round(r/h),x="month"):(p=Math.round(r/g),x="year"),new Intl.RelativeTimeFormat(e,{numeric:"auto"}).format(p,x)}function jG({isOpen:t,onClose:e,variant:n="modal"}){const[r,s]=_.useState(""),[a,l]=_.useState(!1),[u,f]=_.useState(!1),[h,g]=_.useState(null),{data:p=[],isLoading:x,error:y}=kY(t),k=SY(),w=async j=>{await k.mutateAsync({memoryId:j}),f(!1),g(null)},S=(j,A=120)=>j.length<=A?j:j.slice(0,A)+"...",N=p.filter(j=>{var I;if(!r.trim())return!0;const A=r.toLowerCase();return j.content.toLowerCase().includes(A)||((I=j.tags)==null?void 0:I.some(T=>T.toLowerCase().includes(A)))}),C=c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsx("div",{className:"flex items-center justify-between p-3 border-b border-border/50",children:c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx(Io,{className:"h-4 w-4"}),c.jsx("h2",{className:"text-base font-semibold",children:"Memories"}),c.jsx(yn,{variant:"secondary",className:"text-xs",children:p.length})]})}),c.jsx("div",{className:"p-3 border-b border-border/50",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(As,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),c.jsx(st,{placeholder:"Search memories...",value:r,onChange:j=>s(j.target.value),className:"pl-8 h-8 text-sm"})]}),c.jsx(Os,{children:c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(ye,{variant:"outline",size:"sm",onClick:()=>l(!0),className:"h-8 w-8 p-0 shrink-0","aria-label":"Create new memory",children:c.jsx(us,{className:"h-4 w-4"})})}),c.jsx(Lt,{children:"Create Memory"})]})})]})}),y&&c.jsx("div",{className:"p-4",children:c.jsxs(ds,{variant:"destructive",children:[c.jsx(Ln,{className:"h-4 w-4"}),c.jsx(fs,{children:y.message})]})}),c.jsx(Yd,{className:"flex-1 p-4",children:c.jsx("div",{className:"space-y-2",children:x?c.jsx("div",{className:"flex items-center justify-center py-8",children:c.jsx(hr,{className:"h-6 w-6 animate-spin"})}):N.length===0?c.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[c.jsx(Io,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.trim()?c.jsxs(c.Fragment,{children:[c.jsx("p",{children:"No memories found"}),c.jsx("p",{className:"text-sm",children:"Try a different search term"})]}):c.jsxs(c.Fragment,{children:[c.jsx("p",{children:"No memories yet"}),c.jsx("p",{className:"text-sm",children:"Type # in chat or use the + button above"})]})]}):N.map(j=>{var A,I,T;return c.jsx("div",{className:ae("group p-3 rounded-lg border border-border/50 bg-card hover:bg-muted/50 transition-all",((A=j.metadata)==null?void 0:A.pinned)&&"ring-1 ring-primary/30 bg-primary/5"),children:c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[c.jsx("p",{className:"text-sm leading-relaxed",children:S(j.content)}),j.tags&&j.tags.length>0&&c.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[c.jsx(Az,{className:"h-3 w-3 text-muted-foreground"}),j.tags.map((E,R)=>c.jsx(yn,{variant:"outline",className:"text-xs px-1.5 py-0",children:E},R))]}),c.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(a$,{className:"h-3 w-3"}),c.jsx("span",{children:SG(j.updatedAt)})]}),((I=j.metadata)==null?void 0:I.source)&&c.jsx(yn,{variant:"secondary",className:"text-xs px-1.5 py-0",children:j.metadata.source}),((T=j.metadata)==null?void 0:T.pinned)&&c.jsx(yn,{variant:"secondary",className:"text-xs px-1.5 py-0",children:"Pinned"})]})]}),c.jsx("div",{className:"flex items-center gap-1",children:c.jsx(ye,{variant:"ghost",size:"sm",onClick:()=>{g(j),f(!0)},className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",title:"Delete memory",children:c.jsx(Zn,{className:"h-3.5 w-3.5 text-destructive"})})})]})},j.id)})})}),c.jsx(KO,{open:a,onClose:()=>l(!1)}),c.jsx(rr,{open:u,onOpenChange:f,children:c.jsxs(sr,{className:"sm:max-w-md",children:[c.jsxs(ir,{children:[c.jsxs(ar,{className:"flex items-center space-x-2",children:[c.jsx(Zn,{className:"h-5 w-5 text-destructive"}),c.jsx("span",{children:"Delete Memory"})]}),c.jsxs(Yr,{children:["This will permanently delete this memory. This action cannot be undone.",h&&c.jsx("span",{className:"block mt-2 text-sm font-medium max-h-20 overflow-y-auto",children:S(h.content,100)})]})]}),c.jsxs(Kr,{children:[c.jsx(ye,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),c.jsxs(ye,{variant:"destructive",onClick:()=>h&&w(h.id),disabled:k.isPending,className:"flex items-center space-x-2",children:[c.jsx(Zn,{className:"h-4 w-4"}),c.jsx("span",{children:k.isPending?"Deleting...":"Delete Memory"})]})]})]})})]});return n==="inline"?c.jsx("div",{className:"h-full",children:C}):c.jsx(rr,{open:t,onOpenChange:e,children:c.jsxs(sr,{className:"sm:max-w-lg h-[600px] flex flex-col p-0",children:[c.jsx(ir,{className:"sr-only",children:c.jsx(ar,{children:"Memories"})}),C]})})}function NG(){return On({mutationFn:async t=>{const{approvalId:e,...n}=t;return await(await mt.api.approvals[":approvalId"].$post({param:{approvalId:e},json:n,header:{}})).json()}})}function CG({onApprovalRequest:t,onApprove:e,onDeny:n,onHandlersReady:r}){const{currentSessionId:s}=Ld(),{pendingApproval:a,clearApproval:l}=eE(),{mutateAsync:u}=NG(),f=a&&(!a.sessionId||!s||a.sessionId===s)?a:null;_.useEffect(()=>{t==null||t(f)},[f,t]);const h=_.useCallback(async(x,y,k)=>{if(!f)return;const{approvalId:w}=f;console.debug(`[WebUI] Sending approval response for ${w}: ${x?"approved":"denied"}`);try{await u({approvalId:w,status:x?Jy.APPROVED:Jy.DENIED,...x&&y?{formData:y}:{},...x&&k!==void 0?{rememberChoice:k}:{}})}catch(S){const N=S instanceof Error?S.message:String(S);console.error(`[WebUI] Failed to send approval response: ${N}`);return}l()},[f,u,l]),g=_.useCallback((x,y)=>{h(!0,x,y),e==null||e(x,y)},[h,e]),p=_.useCallback(()=>{h(!1),n==null||n()},[h,n]);return _.useEffect(()=>{r&&r({onApprove:g,onDeny:p})},[g,p,r]),null}function EG(t,e,n,r){var s=this,a=_.useRef(null),l=_.useRef(0),u=_.useRef(0),f=_.useRef(null),h=_.useRef([]),g=_.useRef(),p=_.useRef(),x=_.useRef(t),y=_.useRef(!0);x.current=t;var k=typeof window<"u",w=!e&&e!==0&&k;if(typeof t!="function")throw new TypeError("Expected a function");e=+e||0;var S=!!(n=n||{}).leading,N=!("trailing"in n)||!!n.trailing,C="maxWait"in n,j="debounceOnServer"in n&&!!n.debounceOnServer,A=C?Math.max(+n.maxWait||0,e):null;_.useEffect(function(){return y.current=!0,function(){y.current=!1}},[]);var I=_.useMemo(function(){var T=function(K){var G=h.current,F=g.current;return h.current=g.current=null,l.current=K,u.current=u.current||K,p.current=x.current.apply(F,G)},E=function(K,G){w&&cancelAnimationFrame(f.current),f.current=w?requestAnimationFrame(K):setTimeout(K,G)},R=function(K){if(!y.current)return!1;var G=K-a.current;return!a.current||G>=e||G<0||C&&K-l.current>=A},z=function(K){return f.current=null,N&&h.current?T(K):(h.current=g.current=null,p.current)},D=function K(){var G=Date.now();if(S&&u.current===l.current&&B(),R(G))return z(G);if(y.current){var F=e-(G-a.current),M=C?Math.min(F,A-(G-l.current)):F;E(K,M)}},B=function(){r&&r({})},q=function(){if(k||j){var K=Date.now(),G=R(K);if(h.current=[].slice.call(arguments),g.current=s,a.current=K,G){if(!f.current&&y.current)return l.current=a.current,E(D,e),S?T(a.current):p.current;if(C)return E(D,e),T(a.current)}return f.current||E(D,e),p.current}};return q.cancel=function(){var K=f.current;K&&(w?cancelAnimationFrame(f.current):clearTimeout(f.current)),l.current=0,h.current=a.current=g.current=f.current=null,K&&r&&r({})},q.isPending=function(){return!!f.current},q.flush=function(){return f.current?z(Date.now()):p.current},q},[S,C,e,A,N,w,k,j,r]);return I}function TG(t,e){return t===e}function wR(t,e,n){var r=TG,s=_.useRef(t),a=_.useState({})[1],l=EG(_.useCallback(function(f){s.current=f,a({})},[a]),e,n,a),u=_.useRef(t);return r(u.current,t)||(l(t),u.current=t),[s.current,l]}function AG(t,e,n=50,r=!0){return Tr({queryKey:Xe.search.messages(t,e,n),queryFn:async()=>await(await mt.api.search.messages.$get({query:{q:t,limit:n,...e}})).json(),enabled:r&&t.trim().length>0,staleTime:3e4})}function OG({isOpen:t,onClose:e,onNavigateToSession:n}){const[r,s]=_.useState(""),[a]=wR(r,300),[l,u]=_.useState(0),{data:f,isLoading:h,error:g}=AG(a,void 0,10,t),p=(f==null?void 0:f.results)||[],x=(g==null?void 0:g.message)??null;_.useEffect(()=>{l>=p.length&&p.length>0?u(p.length-1):p.length===0&&u(0)},[p.length,l]);const y=_.useCallback(N=>{n(N.sessionId,N.messageIndex),e()},[n,e]);_.useEffect(()=>{t&&(s(""),u(0))},[t]),fr("down",()=>{u(N=>Math.min(N+1,p.length-1))},{enabled:t,preventDefault:!0},[t,p.length]),fr("up",()=>{u(N=>Math.max(N-1,0))},{enabled:t,preventDefault:!0},[t]),fr("enter",()=>{p[l]&&(y(p[l]),u(0))},{enabled:t,preventDefault:!0},[t,p,l,y]),fr("escape",()=>{e()},{enabled:t,preventDefault:!0},[t,e]);const k=N=>{switch(N){case"user":return c.jsx(tT,{className:"w-4 h-4"});case"assistant":return c.jsx(tc,{className:"w-4 h-4"});case"system":return c.jsx(ab,{className:"w-4 h-4"});default:return c.jsx(nz,{className:"w-4 h-4"})}},w=N=>{switch(N){case"user":return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";case"assistant":return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200";case"system":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200";default:return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"}},S=(N,C)=>{if(!C)return N;const j=C.replace(/[.*+?^${}()|\[\]\\]/g,"\\$&"),A=new RegExp(`(${j})`,"gi");return N.split(A).map((T,E)=>T.toLowerCase()===C.toLowerCase()?c.jsx("mark",{className:"bg-yellow-200 dark:bg-yellow-800 font-medium rounded px-1",children:T},E):T)};return t?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 z-40 bg-black/10 backdrop-blur-[2px]",onClick:e}),c.jsx("div",{className:"fixed left-1/2 top-[15%] -translate-x-1/2 z-50 w-full max-w-2xl bg-popover/70 backdrop-blur-xl border border-border/30 rounded-xl shadow-2xl overflow-hidden",children:c.jsxs("div",{className:"flex flex-col max-h-[70vh]",children:[c.jsx("div",{className:"p-4 border-b border-border/30",children:c.jsxs("div",{className:"relative",children:[c.jsx(As,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-muted-foreground"}),c.jsx(st,{placeholder:"Search conversations...",value:r,onChange:N=>s(N.target.value),className:"pl-12 text-lg border-0 shadow-none focus-visible:ring-0 bg-transparent",autoFocus:!0})]})}),c.jsx("div",{className:"flex-1 overflow-hidden",children:h?c.jsxs("div",{className:"flex items-center justify-center py-12",children:[c.jsx(hr,{className:"h-6 w-6 animate-spin mr-3"}),c.jsx("span",{className:"text-muted-foreground",children:"Searching..."})]}):g?c.jsx("div",{className:"flex items-center justify-center py-12",children:c.jsxs("div",{className:"text-center",children:[c.jsx(As,{className:"w-12 h-12 mx-auto mb-4 text-destructive opacity-50"}),c.jsx("p",{className:"text-destructive font-medium",children:"Search Error"}),c.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:x}),c.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Try again or check your connection."})]})}):c.jsx(Yd,{className:"h-full max-h-[calc(70vh-80px)]",children:c.jsx("div",{className:"p-2",children:p.length>0?c.jsx("div",{className:"space-y-1",children:p.map((N,C)=>c.jsxs("div",{className:ae("flex items-start gap-3 p-3 rounded-lg cursor-pointer transition-colors",C===l?"bg-accent text-accent-foreground":"hover:bg-accent/50"),onClick:()=>y(N),children:[c.jsx("div",{className:"flex-shrink-0 mt-1",children:c.jsx(yn,{className:ae("text-xs",w(N.message.role)),children:k(N.message.role)})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[c.jsx("span",{className:"text-sm font-medium",children:N.sessionId.length>20?`${N.sessionId.slice(0,20)}...`:N.sessionId}),c.jsx("span",{className:"text-xs text-muted-foreground",children:N.message.role})]}),c.jsx("div",{className:"text-sm text-muted-foreground line-clamp-2",children:S(N.context,a)})]}),c.jsx(VE,{className:"w-4 h-4 text-muted-foreground flex-shrink-0 mt-1"})]},C))}):a?c.jsxs("div",{className:"text-center py-12",children:[c.jsx(As,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground opacity-50"}),c.jsx("p",{className:"text-muted-foreground",children:"No messages found matching your search."}),c.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Try different keywords."})]}):c.jsxs("div",{className:"text-center py-12",children:[c.jsx(As,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground opacity-50"}),c.jsx("p",{className:"text-muted-foreground",children:"Start typing to search your conversations."}),c.jsxs("div",{className:"flex items-center justify-center gap-4 mt-4 text-xs text-muted-foreground",children:[c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("kbd",{className:"px-2 py-1 bg-muted/50 rounded text-xs",children:"โ"}),c.jsx("kbd",{className:"px-2 py-1 bg-muted/50 rounded text-xs",children:"โ"}),c.jsx("span",{children:"to navigate"})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("kbd",{className:"px-2 py-1 bg-muted/50 rounded text-xs",children:"Enter"}),c.jsx("span",{children:"to select"})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("kbd",{className:"px-2 py-1 bg-muted/50 rounded text-xs",children:"Esc"}),c.jsx("span",{children:"to close"})]})]})]})})})})]})})]}):null}function RG(t=!0){return Tr({queryKey:Xe.agent.config,queryFn:async()=>await(await mt.api.agent.config.$get()).json(),enabled:t,staleTime:3e4})}function MG(){return On({mutationFn:async({yaml:t})=>await(await mt.api.agent.validate.$post({json:{yaml:t}})).json()})}function DG(){const t=An();return On({mutationFn:async({yaml:e})=>await(await mt.api.agent.config.$post({json:{yaml:e}})).json(),onSuccess:()=>{t.invalidateQueries({queryKey:Xe.agent.config})}})}function IG(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hC(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function mC(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?hC(Object(n),!0).forEach(function(r){IG(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):hC(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function LG(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,a;for(a=0;a<r.length;a++)s=r[a],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}function PG(t,e){if(t==null)return{};var n=LG(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function $G(t,e){return zG(t)||FG(t,e)||BG(t,e)||UG()}function zG(t){if(Array.isArray(t))return t}function FG(t,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var n=[],r=!0,s=!1,a=void 0;try{for(var l=t[Symbol.iterator](),u;!(r=(u=l.next()).done)&&(n.push(u.value),!(e&&n.length===e));r=!0);}catch(f){s=!0,a=f}finally{try{!r&&l.return!=null&&l.return()}finally{if(s)throw a}}return n}}function BG(t,e){if(t){if(typeof t=="string")return pC(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pC(t,e)}}function pC(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function UG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
529
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qG(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gC(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function vC(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?gC(Object(n),!0).forEach(function(r){qG(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gC(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function HG(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(r){return e.reduceRight(function(s,a){return a(s)},r)}}function sd(t){return function e(){for(var n=this,r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return s.length>=t.length?t.apply(this,s):function(){for(var l=arguments.length,u=new Array(l),f=0;f<l;f++)u[f]=arguments[f];return e.apply(n,[].concat(s,u))}}}function Um(t){return{}.toString.call(t).includes("Object")}function VG(t){return!Object.keys(t).length}function Od(t){return typeof t=="function"}function KG(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function YG(t,e){return Um(e)||za("changeType"),Object.keys(e).some(function(n){return!KG(t,n)})&&za("changeField"),e}function GG(t){Od(t)||za("selectorType")}function ZG(t){Od(t)||Um(t)||za("handlerType"),Um(t)&&Object.values(t).some(function(e){return!Od(e)})&&za("handlersType")}function WG(t){t||za("initialIsRequired"),Um(t)||za("initialType"),VG(t)&&za("initialContent")}function QG(t,e){throw new Error(t[e]||t.default)}var XG={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},za=sd(QG)(XG),Ih={changes:YG,selector:GG,handler:ZG,initial:WG};function JG(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ih.initial(t),Ih.handler(e);var n={current:t},r=sd(nZ)(n,e),s=sd(tZ)(n),a=sd(Ih.changes)(t),l=sd(eZ)(n);function u(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(g){return g};return Ih.selector(h),h(n.current)}function f(h){HG(r,s,a,l)(h)}return[u,f]}function eZ(t,e){return Od(e)?e(t.current):e}function tZ(t,e){return t.current=vC(vC({},t.current),e),e}function nZ(t,e,n){return Od(e)?e(t.current):Object.keys(n).forEach(function(r){var s;return(s=e[r])===null||s===void 0?void 0:s.call(e,t.current[r])}),n}var rZ={create:JG},sZ={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}};function iZ(t){return function e(){for(var n=this,r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return s.length>=t.length?t.apply(this,s):function(){for(var l=arguments.length,u=new Array(l),f=0;f<l;f++)u[f]=arguments[f];return e.apply(n,[].concat(s,u))}}}function aZ(t){return{}.toString.call(t).includes("Object")}function oZ(t){return t||xC("configIsRequired"),aZ(t)||xC("configType"),t.urls?(lZ(),{paths:{vs:t.urls.monacoBase}}):t}function lZ(){console.warn(_R.deprecation)}function cZ(t,e){throw new Error(t[e]||t.default)}var _R={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
530
|
-
You are using deprecated way of configuration.
|
|
531
|
-
|
|
532
|
-
Instead of using
|
|
533
|
-
monaco.config({ urls: { monacoBase: '...' } })
|
|
534
|
-
use
|
|
535
|
-
monaco.config({ paths: { vs: '...' } })
|
|
536
|
-
|
|
537
|
-
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
538
|
-
`},xC=iZ(cZ)(_R),uZ={config:oZ},dZ=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return function(s){return n.reduceRight(function(a,l){return l(a)},s)}};function kR(t,e){return Object.keys(e).forEach(function(n){e[n]instanceof Object&&t[n]&&Object.assign(e[n],kR(t[n],e[n]))}),mC(mC({},t),e)}var fZ={type:"cancelation",msg:"operation is manually canceled"};function ry(t){var e=!1,n=new Promise(function(r,s){t.then(function(a){return e?s(fZ):r(a)}),t.catch(s)});return n.cancel=function(){return e=!0},n}var hZ=rZ.create({config:sZ,isInitialized:!1,resolve:null,reject:null,monaco:null}),SR=$G(hZ,2),Gd=SR[0],Np=SR[1];function mZ(t){var e=uZ.config(t),n=e.monaco,r=PG(e,["monaco"]);Np(function(s){return{config:kR(s.config,r),monaco:n}})}function pZ(){var t=Gd(function(e){var n=e.monaco,r=e.isInitialized,s=e.resolve;return{monaco:n,isInitialized:r,resolve:s}});if(!t.isInitialized){if(Np({isInitialized:!0}),t.monaco)return t.resolve(t.monaco),ry(sy);if(window.monaco&&window.monaco.editor)return jR(window.monaco),t.resolve(window.monaco),ry(sy);dZ(gZ,xZ)(yZ)}return ry(sy)}function gZ(t){return document.body.appendChild(t)}function vZ(t){var e=document.createElement("script");return t&&(e.src=t),e}function xZ(t){var e=Gd(function(r){var s=r.config,a=r.reject;return{config:s,reject:a}}),n=vZ("".concat(e.config.paths.vs,"/loader.js"));return n.onload=function(){return t()},n.onerror=e.reject,n}function yZ(){var t=Gd(function(n){var r=n.config,s=n.resolve,a=n.reject;return{config:r,resolve:s,reject:a}}),e=window.require;e.config(t.config),e(["vs/editor/editor.main"],function(n){jR(n),t.resolve(n)},function(n){t.reject(n)})}function jR(t){Gd().monaco||Np({monaco:t})}function bZ(){return Gd(function(t){var e=t.monaco;return e})}var sy=new Promise(function(t,e){return Np({resolve:t,reject:e})}),NR={config:mZ,init:pZ,__getMonacoInstance:bZ},wZ={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},iy=wZ,_Z={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},kZ=_Z;function SZ({children:t}){return nt.createElement("div",{style:kZ.container},t)}var jZ=SZ,NZ=jZ;function CZ({width:t,height:e,isEditorReady:n,loading:r,_ref:s,className:a,wrapperProps:l}){return nt.createElement("section",{style:{...iy.wrapper,width:t,height:e},...l},!n&&nt.createElement(NZ,null,r),nt.createElement("div",{ref:s,style:{...iy.fullWidth,...!n&&iy.hide},className:a}))}var EZ=CZ,CR=_.memo(EZ);function TZ(t){_.useEffect(t,[])}var ER=TZ;function AZ(t,e,n=!0){let r=_.useRef(!0);_.useEffect(r.current||!n?()=>{r.current=!1}:t,e)}var Br=AZ;function md(){}function Kl(t,e,n,r){return OZ(t,r)||RZ(t,e,n,r)}function OZ(t,e){return t.editor.getModel(TR(t,e))}function RZ(t,e,n,r){return t.editor.createModel(e,n,r?TR(t,r):void 0)}function TR(t,e){return t.Uri.parse(e)}function MZ({original:t,modified:e,language:n,originalLanguage:r,modifiedLanguage:s,originalModelPath:a,modifiedModelPath:l,keepCurrentOriginalModel:u=!1,keepCurrentModifiedModel:f=!1,theme:h="light",loading:g="Loading...",options:p={},height:x="100%",width:y="100%",className:k,wrapperProps:w={},beforeMount:S=md,onMount:N=md}){let[C,j]=_.useState(!1),[A,I]=_.useState(!0),T=_.useRef(null),E=_.useRef(null),R=_.useRef(null),z=_.useRef(N),D=_.useRef(S),B=_.useRef(!1);ER(()=>{let F=NR.init();return F.then(M=>(E.current=M)&&I(!1)).catch(M=>(M==null?void 0:M.type)!=="cancelation"&&console.error("Monaco initialization: error:",M)),()=>T.current?G():F.cancel()}),Br(()=>{if(T.current&&E.current){let F=T.current.getOriginalEditor(),M=Kl(E.current,t||"",r||n||"text",a||"");M!==F.getModel()&&F.setModel(M)}},[a],C),Br(()=>{if(T.current&&E.current){let F=T.current.getModifiedEditor(),M=Kl(E.current,e||"",s||n||"text",l||"");M!==F.getModel()&&F.setModel(M)}},[l],C),Br(()=>{let F=T.current.getModifiedEditor();F.getOption(E.current.editor.EditorOption.readOnly)?F.setValue(e||""):e!==F.getValue()&&(F.executeEdits("",[{range:F.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),F.pushUndoStop())},[e],C),Br(()=>{var F,M;(M=(F=T.current)==null?void 0:F.getModel())==null||M.original.setValue(t||"")},[t],C),Br(()=>{let{original:F,modified:M}=T.current.getModel();E.current.editor.setModelLanguage(F,r||n||"text"),E.current.editor.setModelLanguage(M,s||n||"text")},[n,r,s],C),Br(()=>{var F;(F=E.current)==null||F.editor.setTheme(h)},[h],C),Br(()=>{var F;(F=T.current)==null||F.updateOptions(p)},[p],C);let q=_.useCallback(()=>{var V;if(!E.current)return;D.current(E.current);let F=Kl(E.current,t||"",r||n||"text",a||""),M=Kl(E.current,e||"",s||n||"text",l||"");(V=T.current)==null||V.setModel({original:F,modified:M})},[n,e,s,t,r,a,l]),K=_.useCallback(()=>{var F;!B.current&&R.current&&(T.current=E.current.editor.createDiffEditor(R.current,{automaticLayout:!0,...p}),q(),(F=E.current)==null||F.editor.setTheme(h),j(!0),B.current=!0)},[p,h,q]);_.useEffect(()=>{C&&z.current(T.current,E.current)},[C]),_.useEffect(()=>{!A&&!C&&K()},[A,C,K]);function G(){var M,V,U,H;let F=(M=T.current)==null?void 0:M.getModel();u||((V=F==null?void 0:F.original)==null||V.dispose()),f||((U=F==null?void 0:F.modified)==null||U.dispose()),(H=T.current)==null||H.dispose()}return nt.createElement(CR,{width:y,height:x,isEditorReady:C,loading:g,_ref:R,className:k,wrapperProps:w})}var DZ=MZ;_.memo(DZ);function IZ(t){let e=_.useRef();return _.useEffect(()=>{e.current=t},[t]),e.current}var LZ=IZ,Lh=new Map;function PZ({defaultValue:t,defaultLanguage:e,defaultPath:n,value:r,language:s,path:a,theme:l="light",line:u,loading:f="Loading...",options:h={},overrideServices:g={},saveViewState:p=!0,keepCurrentModel:x=!1,width:y="100%",height:k="100%",className:w,wrapperProps:S={},beforeMount:N=md,onMount:C=md,onChange:j,onValidate:A=md}){let[I,T]=_.useState(!1),[E,R]=_.useState(!0),z=_.useRef(null),D=_.useRef(null),B=_.useRef(null),q=_.useRef(C),K=_.useRef(N),G=_.useRef(),F=_.useRef(r),M=LZ(a),V=_.useRef(!1),U=_.useRef(!1);ER(()=>{let ne=NR.init();return ne.then(ie=>(z.current=ie)&&R(!1)).catch(ie=>(ie==null?void 0:ie.type)!=="cancelation"&&console.error("Monaco initialization: error:",ie)),()=>D.current?L():ne.cancel()}),Br(()=>{var ie,P,pe,Pe;let ne=Kl(z.current,t||r||"",e||s||"",a||n||"");ne!==((ie=D.current)==null?void 0:ie.getModel())&&(p&&Lh.set(M,(P=D.current)==null?void 0:P.saveViewState()),(pe=D.current)==null||pe.setModel(ne),p&&((Pe=D.current)==null||Pe.restoreViewState(Lh.get(a))))},[a],I),Br(()=>{var ne;(ne=D.current)==null||ne.updateOptions(h)},[h],I),Br(()=>{!D.current||r===void 0||(D.current.getOption(z.current.editor.EditorOption.readOnly)?D.current.setValue(r):r!==D.current.getValue()&&(U.current=!0,D.current.executeEdits("",[{range:D.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),D.current.pushUndoStop(),U.current=!1))},[r],I),Br(()=>{var ie,P;let ne=(ie=D.current)==null?void 0:ie.getModel();ne&&s&&((P=z.current)==null||P.editor.setModelLanguage(ne,s))},[s],I),Br(()=>{var ne;u!==void 0&&((ne=D.current)==null||ne.revealLine(u))},[u],I),Br(()=>{var ne;(ne=z.current)==null||ne.editor.setTheme(l)},[l],I);let H=_.useCallback(()=>{var ne;if(!(!B.current||!z.current)&&!V.current){K.current(z.current);let ie=a||n,P=Kl(z.current,r||t||"",e||s||"",ie||"");D.current=(ne=z.current)==null?void 0:ne.editor.create(B.current,{model:P,automaticLayout:!0,...h},g),p&&D.current.restoreViewState(Lh.get(ie)),z.current.editor.setTheme(l),u!==void 0&&D.current.revealLine(u),T(!0),V.current=!0}},[t,e,n,r,s,a,h,g,p,l,u]);_.useEffect(()=>{I&&q.current(D.current,z.current)},[I]),_.useEffect(()=>{!E&&!I&&H()},[E,I,H]),F.current=r,_.useEffect(()=>{var ne,ie;I&&j&&((ne=G.current)==null||ne.dispose(),G.current=(ie=D.current)==null?void 0:ie.onDidChangeModelContent(P=>{U.current||j(D.current.getValue(),P)}))},[I,j]),_.useEffect(()=>{if(I){let ne=z.current.editor.onDidChangeMarkers(ie=>{var pe;let P=(pe=D.current.getModel())==null?void 0:pe.uri;if(P&&ie.find(Pe=>Pe.path===P.path)){let Pe=z.current.editor.getModelMarkers({resource:P});A==null||A(Pe)}});return()=>{ne==null||ne.dispose()}}return()=>{}},[I,A]);function L(){var ne,ie;(ne=G.current)==null||ne.dispose(),x?p&&Lh.set(a,D.current.saveViewState()):(ie=D.current.getModel())==null||ie.dispose(),D.current.dispose()}return nt.createElement(CR,{width:y,height:k,isEditorReady:I,loading:f,_ref:B,className:w,wrapperProps:S})}var $Z=PZ,zZ=_.memo($Z),FZ=zZ;function BZ({value:t,onChange:e,onValidate:n,readOnly:r=!1,height:s="100%"}){const a=_.useRef(null);_.useEffect(()=>{a.current&&n&&a.current.getModel()},[n]);const l=f=>{a.current=f,f.updateOptions({minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,lineNumbers:"on",renderLineHighlight:"all",folding:!0,automaticLayout:!0})},u=f=>{f!==void 0&&e(f)};return c.jsx(FZ,{height:s,defaultLanguage:"yaml",value:t,onChange:u,onMount:l,theme:"vs-dark",options:{readOnly:r,wordWrap:"on",tabSize:2}})}function UZ({isValidating:t,isValid:e,errors:n,warnings:r,hasUnsavedChanges:s}){return c.jsxs("div",{className:"border-t border-border bg-background px-4 py-3",children:[c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary border-t-transparent"}),c.jsx("span",{className:"text-sm text-muted-foreground",children:"Validating..."})]}):e?c.jsxs(c.Fragment,{children:[c.jsx(Ts,{className:"h-4 w-4 text-green-500 flex-shrink-0"}),c.jsxs("span",{className:"text-sm text-muted-foreground",children:["Valid configuration",s&&" (unsaved changes)"]})]}):c.jsxs(c.Fragment,{children:[c.jsx(qa,{className:"h-4 w-4 text-destructive flex-shrink-0"}),c.jsxs("span",{className:"text-sm text-destructive",children:[n.length," ",n.length===1?"error":"errors"]})]})}),r.length>0&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Ln,{className:"h-4 w-4 text-yellow-500 flex-shrink-0"}),c.jsxs("span",{className:"text-sm text-yellow-500",children:[r.length," ",r.length===1?"warning":"warnings"]})]})]}),n.length>0&&c.jsx("div",{className:"mt-3 space-y-2 max-h-32 overflow-y-auto",children:n.map((a,l)=>c.jsxs("div",{className:"text-xs bg-destructive/10 text-destructive rounded px-2 py-1.5 flex items-start gap-2",children:[c.jsx(qa,{className:"h-3 w-3 mt-0.5 flex-shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[a.path&&c.jsxs("span",{className:"font-medium",children:[a.path,": "]}),a.message,a.line&&c.jsxs("span",{className:"text-muted-foreground ml-1",children:["(line ",a.line,a.column&&`:${a.column}`,")"]})]})]},l))}),r.length>0&&n.length===0&&c.jsx("div",{className:"mt-3 space-y-2 max-h-32 overflow-y-auto",children:r.map((a,l)=>c.jsxs("div",{className:"text-xs bg-yellow-500/10 text-yellow-600 dark:text-yellow-500 rounded px-2 py-1.5 flex items-start gap-2",children:[c.jsx(Ln,{className:"h-3 w-3 mt-0.5 flex-shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("span",{className:"font-medium",children:[a.path,": "]}),a.message]})]},l))})]})}function qZ({value:t,onChange:e,onValidate:n,isValidating:r=!1,isValid:s=!0,errors:a=[],warnings:l=[],hasUnsavedChanges:u=!1}){return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsx("div",{className:"flex-1 overflow-hidden",children:c.jsx(BZ,{value:t,onChange:e,onValidate:n,height:"100%"})}),c.jsx(UZ,{isValidating:r,isValid:s,errors:a,warnings:l,hasUnsavedChanges:u})]})}function yt({htmlFor:t,children:e,tooltip:n,className:r}){return c.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[c.jsx(Qt,{htmlFor:t,className:r,children:e}),n&&c.jsx(Os,{delayDuration:200,children:c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground transition-colors","aria-label":"More information",children:c.jsx(KE,{className:"h-3.5 w-3.5"})})}),c.jsx(Lt,{side:"right",className:"max-w-xs",children:c.jsx("p",{className:"text-sm",children:n})})]})})]})}function Ko({title:t,children:e,defaultOpen:n=!0,open:r,onOpenChange:s,errorCount:a=0,sectionErrors:l=[],className:u}){const[f,h]=_.useState(n),g=r!==void 0,p=g?r:f,x=()=>{const y=!p;g?s==null||s(y):h(y)};return c.jsxs("div",{className:ae("border border-border rounded-lg overflow-hidden",u),children:[c.jsxs("button",{onClick:x,className:"w-full flex items-center justify-between px-4 py-3 bg-muted/50 hover:bg-muted transition-colors text-left",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",children:t}),a>0&&c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsxs("span",{className:"inline-flex items-center justify-center px-2 py-0.5 text-xs font-medium bg-destructive text-destructive-foreground rounded-full cursor-help",children:[a," ",a===1?"error":"errors"]})}),c.jsx(Lt,{side:"top",className:"max-w-sm",children:c.jsx("ul",{className:"space-y-1 text-left",children:l.map((y,k)=>c.jsxs("li",{children:["โข ",y]},k))})})]})]}),c.jsx(Ar,{className:ae("h-4 w-4 transition-transform duration-200",p&&"transform rotate-180")})]}),p&&c.jsx("div",{className:"px-4 py-4 space-y-4",children:e})]})}function AR({value:t,onChange:e,errors:n={},open:r,onOpenChange:s,errorCount:a=0,sectionErrors:l=[]}){const[u,f]=_.useState(!1),h=(g,p)=>{e({...t,[g]:p})};return c.jsx(Ko,{title:"LLM Configuration",defaultOpen:!0,open:r,onOpenChange:s,errorCount:a,sectionErrors:l,children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"provider",tooltip:"The LLM provider to use (e.g., OpenAI, Anthropic)",children:"Provider *"}),c.jsxs("select",{id:"provider",value:t.provider||"",onChange:g=>h("provider",g.target.value),"aria-invalid":!!n["llm.provider"],className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",children:[c.jsx("option",{value:"",children:"Select provider..."}),Kh.map(g=>c.jsx("option",{value:g,children:g},g))]}),n["llm.provider"]&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n["llm.provider"]})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"model",tooltip:"The specific model identifier (e.g., gpt-5, claude-sonnet-4-5-20250929)",children:"Model *"}),c.jsx(st,{id:"model",value:t.model||"",onChange:g=>h("model",g.target.value),placeholder:"e.g., gpt-5, claude-sonnet-4-5-20250929","aria-invalid":!!n["llm.model"]}),n["llm.model"]&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n["llm.model"]})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"apiKey",tooltip:"Use $ENV_VAR for environment variables or enter the API key directly",children:"API Key *"}),c.jsxs("div",{className:"relative",children:[c.jsx(st,{id:"apiKey",type:u?"text":"password",value:t.apiKey??"",onChange:g=>h("apiKey",g.target.value),placeholder:"$OPENAI_API_KEY or direct value","aria-invalid":!!n["llm.apiKey"],className:"pr-10"}),c.jsx("button",{type:"button",onClick:()=>f(!u),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 hover:bg-accent rounded transition-colors","aria-label":u?"Hide API key":"Show API key",children:u?c.jsx(GE,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(c0,{className:"h-4 w-4 text-muted-foreground"})})]}),n["llm.apiKey"]&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n["llm.apiKey"]})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"router",tooltip:"LLM routing backend: 'vercel' uses Vercel AI SDK, 'in-built' uses provider-specific clients",children:"Router"}),c.jsx("select",{id:"router",value:t.router||"vercel",onChange:g=>h("router",g.target.value),"aria-invalid":!!n["llm.router"],className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",children:yL.map(g=>c.jsx("option",{value:g,children:g},g))}),n["llm.router"]&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n["llm.router"]})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"maxIterations",tooltip:"Maximum number of agent reasoning iterations per turn",children:"Max Iterations"}),c.jsx(st,{id:"maxIterations",type:"number",value:t.maxIterations!==void 0?t.maxIterations:"",onChange:g=>{const p=g.target.value;if(p==="")h("maxIterations",void 0);else{const x=parseInt(p,10);isNaN(x)||h("maxIterations",x)}},min:"1",placeholder:"50","aria-invalid":!!n["llm.maxIterations"]}),n["llm.maxIterations"]&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n["llm.maxIterations"]})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"baseURL",tooltip:"Custom base URL for the LLM provider (optional, for proxies or custom endpoints)",children:"Base URL"}),c.jsx(st,{id:"baseURL",value:t.baseURL||"",onChange:g=>h("baseURL",g.target.value||void 0),placeholder:"https://api.openai.com/v1","aria-invalid":!!n["llm.baseURL"]}),n["llm.baseURL"]&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n["llm.baseURL"]})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"temperature",tooltip:"Controls randomness in responses (0.0 = deterministic, 1.0 = creative)",children:"Temperature"}),c.jsx(st,{id:"temperature",type:"number",value:t.temperature!==void 0?t.temperature:"",onChange:g=>h("temperature",g.target.value?parseFloat(g.target.value):void 0),min:"0",max:"1",step:"0.1",placeholder:"0.0 - 1.0","aria-invalid":!!n["llm.temperature"]}),n["llm.temperature"]&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n["llm.temperature"]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"maxInputTokens",tooltip:"Maximum input tokens to send to the model. If not specified, defaults to model's limit from registry, or 128,000 tokens for custom endpoints",children:"Max Input Tokens"}),c.jsx(st,{id:"maxInputTokens",type:"number",value:t.maxInputTokens||"",onChange:g=>h("maxInputTokens",g.target.value?parseInt(g.target.value,10):void 0),min:"1",placeholder:"Auto (128k fallback)","aria-invalid":!!n["llm.maxInputTokens"]}),n["llm.maxInputTokens"]&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n["llm.maxInputTokens"]})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"maxOutputTokens",tooltip:"Maximum output tokens the model can generate. If not specified, uses provider's default (typically 4,096 tokens)",children:"Max Output Tokens"}),c.jsx(st,{id:"maxOutputTokens",type:"number",value:t.maxOutputTokens||"",onChange:g=>h("maxOutputTokens",g.target.value?parseInt(g.target.value,10):void 0),min:"1",placeholder:"Auto (provider default)","aria-invalid":!!n["llm.maxOutputTokens"]}),n["llm.maxOutputTokens"]&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n["llm.maxOutputTokens"]})]})]})]})})}function OR({value:t,onChange:e,errors:n={},open:r,onOpenChange:s,errorCount:a=0,sectionErrors:l=[]}){const[u,f]=_.useState(new Set),[h,g]=_.useState({}),p=t.contributors||[],x=j=>{f(A=>{const I=new Set(A);return I.has(j)?I.delete(j):I.add(j),I})},y=()=>{const j=`contributor-${Date.now()}`,A={id:j,type:"static",priority:p.length*10,enabled:!0,content:""};e({contributors:[...p,A]}),f(I=>new Set(I).add(j))},k=j=>{e({contributors:p.filter(A=>A.id!==j)}),f(A=>{const I=new Set(A);return I.delete(j),I})},w=(j,A)=>{e({contributors:p.map(I=>{if(I.id===j){if(A.id&&A.id!==j&&f(T=>{const E=new Set(T);return E.has(j)&&(E.delete(j),E.add(A.id)),E}),A.type&&A.type!==I.type){const T={id:A.id||I.id,priority:A.priority!==void 0?A.priority:I.priority,enabled:A.enabled!==void 0?A.enabled:I.enabled};if(A.type==="static")return{...T,type:"static",content:""};if(A.type==="dynamic")return{...T,type:"dynamic",source:"dateTime"};if(A.type==="file")return{...T,type:"file",files:[]}}return{...I,...A}}return I})})},S=(j,A)=>h[j]??A.join(", "),N=(j,A)=>{g(I=>({...I,[j]:A}))},C=(j,A)=>{g(T=>{const E={...T};return delete E[j],E});const I=A.split(",").map(T=>T.trim()).filter(Boolean);w(j,{files:I.length>0?I:[]})};return c.jsx(Ko,{title:"System Prompt",defaultOpen:!0,open:r,onOpenChange:s,errorCount:a,sectionErrors:l,children:c.jsxs("div",{className:"space-y-4",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"Define how the agent should behave using multiple contributors with different priorities."}),p.length===0?c.jsx("p",{className:"text-sm text-muted-foreground",children:"No contributors configured"}):p.map(j=>{var I,T,E,R,z;const A=u.has(j.id);return c.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[c.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-muted/30",children:[c.jsxs("button",{onClick:()=>x(j.id),className:"flex items-center gap-2 flex-1 text-left hover:text-foreground transition-colors",children:[A?c.jsx(Ua,{className:"h-4 w-4"}):c.jsx(Ar,{className:"h-4 w-4"}),c.jsx("span",{className:"font-medium text-sm",children:j.id}),c.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",j.type,", priority: ",j.priority,")"]}),j.enabled===!1&&c.jsx("span",{className:"text-xs text-destructive",children:"(disabled)"})]}),c.jsx(ye,{variant:"ghost",size:"sm",onClick:()=>k(j.id),className:"h-7 w-7 p-0",children:c.jsx(Zn,{className:"h-3.5 w-3.5 text-destructive"})})]}),A&&c.jsxs("div",{className:"px-3 py-3 space-y-3",children:[c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`contributor-id-${j.id}`,tooltip:"Unique identifier for this contributor",children:"ID *"}),c.jsx(st,{id:`contributor-id-${j.id}`,value:j.id,onChange:D=>w(j.id,{id:D.target.value}),placeholder:"e.g., primary, dateTime"})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`contributor-type-${j.id}`,tooltip:"Type of contributor: static (fixed text), dynamic (runtime generated), or file (from files)",children:"Type *"}),c.jsxs("select",{id:`contributor-type-${j.id}`,value:j.type,onChange:D=>w(j.id,{type:D.target.value}),className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[c.jsx("option",{value:"static",children:"Static"}),c.jsx("option",{value:"dynamic",children:"Dynamic"}),c.jsx("option",{value:"file",children:"File"})]})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`contributor-priority-${j.id}`,tooltip:"Execution priority (lower numbers run first)",children:"Priority *"}),c.jsx(st,{id:`contributor-priority-${j.id}`,type:"number",value:j.priority,onChange:D=>{const B=D.target.value,q=Number.parseInt(B,10);w(j.id,{priority:Number.isNaN(q)?0:q})},placeholder:"0",min:"0"})]})]}),c.jsx("div",{children:c.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[c.jsx("input",{type:"checkbox",checked:j.enabled!==!1,onChange:D=>w(j.id,{enabled:D.target.checked}),className:"rounded border-input"}),c.jsx("span",{children:"Enabled"})]})}),j.type==="static"&&c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`contributor-content-${j.id}`,tooltip:"Static content for the system prompt",children:"Content *"}),c.jsx(Kd,{id:`contributor-content-${j.id}`,value:j.content,onChange:D=>w(j.id,{content:D.target.value}),placeholder:"You are a helpful assistant...",rows:8,className:"font-mono text-sm"})]}),j.type==="dynamic"&&c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`contributor-source-${j.id}`,tooltip:"Source for dynamic content generation",children:"Source *"}),c.jsx("select",{id:`contributor-source-${j.id}`,value:j.source,onChange:D=>w(j.id,{source:D.target.value}),className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:$L.map(D=>c.jsx("option",{value:D,children:D},D))})]}),j.type==="file"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`contributor-files-${j.id}`,tooltip:"File paths to include, comma-separated",children:"Files *"}),c.jsx(st,{id:`contributor-files-${j.id}`,value:S(j.id,j.files),onChange:D=>N(j.id,D.target.value),onBlur:D=>C(j.id,D.target.value),placeholder:"./commands/context.md, ./commands/rules.txt",className:"font-mono"})]}),c.jsxs("details",{className:"border border-border rounded-md p-2",children:[c.jsx("summary",{className:"text-sm font-medium cursor-pointer",children:"File Options"}),c.jsxs("div",{className:"mt-3 space-y-3",children:[c.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[c.jsx("input",{type:"checkbox",checked:((I=j.options)==null?void 0:I.includeFilenames)!==!1,onChange:D=>w(j.id,{options:{...j.options??{},includeFilenames:D.target.checked}}),className:"rounded border-input"}),c.jsx("span",{children:"Include filenames as headers"})]}),c.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[c.jsx("input",{type:"checkbox",checked:((T=j.options)==null?void 0:T.includeMetadata)===!0,onChange:D=>w(j.id,{options:{...j.options??{},includeMetadata:D.target.checked}}),className:"rounded border-input"}),c.jsx("span",{children:"Include file metadata"})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`contributor-separator-${j.id}`,tooltip:"Separator between multiple files",children:"Separator"}),c.jsx(st,{id:`contributor-separator-${j.id}`,value:((E=j.options)==null?void 0:E.separator)??`
|
|
539
|
-
|
|
540
|
-
---
|
|
541
|
-
|
|
542
|
-
`,onChange:D=>w(j.id,{options:{...j.options??{},separator:D.target.value}}),placeholder:"\\n\\n---\\n\\n"})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`contributor-error-handling-${j.id}`,tooltip:"How to handle missing or unreadable files",children:"Error Handling"}),c.jsxs("select",{id:`contributor-error-handling-${j.id}`,value:((R=j.options)==null?void 0:R.errorHandling)||"skip",onChange:D=>w(j.id,{options:{...j.options??{},errorHandling:D.target.value}}),className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[c.jsx("option",{value:"skip",children:"Skip missing files"}),c.jsx("option",{value:"error",children:"Error on missing files"})]})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`contributor-max-file-size-${j.id}`,tooltip:"Maximum file size in bytes",children:"Max File Size (bytes)"}),c.jsx(st,{id:`contributor-max-file-size-${j.id}`,type:"number",value:((z=j.options)==null?void 0:z.maxFileSize)||1e5,onChange:D=>{const B=D.target.value,q=Number.parseInt(B,10);w(j.id,{options:{...j.options??{},maxFileSize:Number.isNaN(q)?void 0:q}})},placeholder:"100000",min:"1"})]})]})]})]})]})]},j.id)}),c.jsxs(ye,{onClick:y,variant:"outline",size:"sm",className:"w-full",children:[c.jsx(us,{className:"h-4 w-4 mr-2"}),"Add Contributor"]}),n.systemPrompt&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n.systemPrompt})]})})}function HZ({value:t,onChange:e,errors:n={},open:r,onOpenChange:s,errorCount:a=0,sectionErrors:l=[]}){const[u,f]=_.useState(new Set),[h,g]=_.useState({}),p=Object.entries(t||{}),x=T=>{f(E=>{const R=new Set(E);return R.has(T)?R.delete(T):R.add(T),R})},y=()=>{const T=`server-${Object.keys(t||{}).length+1}`;e({...t,[T]:{type:"stdio",command:"",connectionMode:"strict"}}),f(E=>new Set(E).add(T))},k=T=>{const E={...t};delete E[T],e(E),f(R=>{const z=new Set(R);return z.delete(T),z})},w=(T,E)=>{const R=t[T],{name:z,...D}=E,B={...R,...D};if(z&&typeof z=="string"&&z!==T){if(t[z])return;const q={...t};delete q[T],q[z]=B,e(q),f(K=>{const G=new Set(K);return G.has(T)&&(G.delete(T),G.add(z)),G})}else e({...t,[T]:B})},S=(T,E,R)=>{const z=`${T}:${E}`;return h[z]??R},N=(T,E,R)=>{const z=`${T}:${E}`;g(D=>({...D,[z]:R}))},C=(T,E)=>{const R=`${T}:${E}`;g(z=>{const D={...z};return delete D[R],D})},j=(T,E)=>{if(C(T,"args"),!E.trim()){w(T,{args:void 0});return}const R=E.split(",").map(z=>z.trim()).filter(Boolean);w(T,{args:R.length>0?R:void 0})},A=(T,E)=>{if(C(T,"env"),!E.trim()){w(T,{env:void 0});return}const R={};E.split(`
|
|
543
|
-
`).map(z=>z.trim()).filter(Boolean).forEach(z=>{const[D,...B]=z.split("=");D&&B.length>0&&(R[D.trim()]=B.join("=").trim())}),w(T,{env:Object.keys(R).length>0?R:void 0})},I=(T,E)=>{if(C(T,"headers"),!E.trim()){w(T,{headers:void 0});return}const R={};E.split(`
|
|
544
|
-
`).map(z=>z.trim()).filter(Boolean).forEach(z=>{const[D,...B]=z.split("=");D&&B.length>0&&(R[D.trim()]=B.join("=").trim())}),w(T,{headers:Object.keys(R).length>0?R:void 0})};return c.jsx(Ko,{title:"MCP Servers",defaultOpen:!1,open:r,onOpenChange:s,errorCount:a,sectionErrors:l,children:c.jsxs("div",{className:"space-y-4",children:[p.length===0?c.jsx("p",{className:"text-sm text-muted-foreground",children:"No MCP servers configured"}):p.map(([T,E])=>{const R=u.has(T);return c.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[c.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-muted/30",children:[c.jsxs("button",{onClick:()=>x(T),className:"flex items-center gap-2 flex-1 text-left hover:text-foreground transition-colors",children:[R?c.jsx(Ua,{className:"h-4 w-4"}):c.jsx(Ar,{className:"h-4 w-4"}),c.jsx("span",{className:"font-medium text-sm",children:T}),"command"in E&&E.command&&c.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["(",E.command,")"]})]}),c.jsx(ye,{variant:"ghost",size:"sm",onClick:()=>k(T),className:"h-7 w-7 p-0",children:c.jsx(Zn,{className:"h-3.5 w-3.5 text-destructive"})})]}),R&&c.jsxs("div",{className:"px-3 py-3 space-y-3",children:[c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`server-name-${T}`,tooltip:"Unique identifier for this MCP server",children:"Server Name"}),c.jsx(st,{id:`server-name-${T}`,value:T,onChange:z=>w(T,{name:z.target.value}),placeholder:"e.g., filesystem"})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`server-type-${T}`,tooltip:"MCP server connection type",children:"Connection Type *"}),c.jsx("select",{id:`server-type-${T}`,value:E.type||"stdio",onChange:z=>{const D=z.target.value;D==="stdio"?w(T,{type:"stdio",command:"",args:void 0,env:void 0}):w(T,{type:D,url:"",headers:void 0})},className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:bL.map(z=>c.jsx("option",{value:z,children:z==="stdio"?"Standard I/O (stdio)":z==="sse"?"Server-Sent Events (SSE)":"HTTP"},z))})]}),E.type==="stdio"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`server-command-${T}`,tooltip:"The command to execute (e.g., npx, node, python)",children:"Command *"}),c.jsx(st,{id:`server-command-${T}`,value:"command"in E?E.command:"",onChange:z=>w(T,{command:z.target.value}),placeholder:"e.g., npx, node, python","aria-invalid":!!n[`mcpServers.${T}.command`]}),n[`mcpServers.${T}.command`]&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n[`mcpServers.${T}.command`]})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`server-args-${T}`,tooltip:"Command arguments, comma-separated",children:"Arguments"}),c.jsx(st,{id:`server-args-${T}`,value:S(T,"args",("args"in E&&E.args?E.args:[]).join(", ")),onChange:z=>N(T,"args",z.target.value),onBlur:z=>j(T,z.target.value),placeholder:"--port, 3000, --host, localhost",className:"font-mono"})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`server-env-${T}`,tooltip:"Environment variables in KEY=value format, one per line",children:"Environment Variables"}),c.jsx("textarea",{id:`server-env-${T}`,value:S(T,"env",Object.entries("env"in E&&E.env||{}).map(([z,D])=>`${z}=${D}`).join(`
|
|
545
|
-
`)),onChange:z=>N(T,"env",z.target.value),onBlur:z=>A(T,z.target.value),placeholder:`API_KEY=$MY_API_KEY
|
|
546
|
-
PORT=3000`,rows:4,className:"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 font-mono"})]})]}),(E.type==="sse"||E.type==="http")&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`server-url-${T}`,tooltip:"The URL endpoint for the MCP server",children:"URL *"}),c.jsx(st,{id:`server-url-${T}`,value:"url"in E?E.url:"",onChange:z=>w(T,{url:z.target.value}),placeholder:"https://example.com/mcp","aria-invalid":!!n[`mcpServers.${T}.url`]}),n[`mcpServers.${T}.url`]&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n[`mcpServers.${T}.url`]})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`server-headers-${T}`,tooltip:"HTTP headers in KEY=value format, one per line",children:"Headers"}),c.jsx("textarea",{id:`server-headers-${T}`,value:S(T,"headers",Object.entries("headers"in E&&E.headers||{}).map(([z,D])=>`${z}=${D}`).join(`
|
|
547
|
-
`)),onChange:z=>N(T,"headers",z.target.value),onBlur:z=>I(T,z.target.value),placeholder:`Authorization=Bearer token
|
|
548
|
-
Content-Type=application/json`,rows:4,className:"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 font-mono"})]})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:`server-mode-${T}`,tooltip:"Strict mode fails on any error; lenient mode continues despite errors",children:"Connection Mode"}),c.jsx("select",{id:`server-mode-${T}`,value:E.connectionMode||tp,onChange:z=>w(T,{connectionMode:z.target.value}),className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:ep.map(z=>c.jsx("option",{value:z,children:z.charAt(0).toUpperCase()+z.slice(1)},z))})]})]})]},T)}),c.jsxs(ye,{onClick:y,variant:"outline",size:"sm",className:"w-full",children:[c.jsx(us,{className:"h-4 w-4 mr-2"}),"Add MCP Server"]}),n.mcpServers&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n.mcpServers})]})})}function VZ({value:t,onChange:e,errors:n={},open:r,onOpenChange:s,errorCount:a=0,sectionErrors:l=[]}){const u=p=>{e({...t,cache:{...t.cache,...p}})},f=p=>{e({...t,database:{...t.database,...p}})},h=t.cache.type==="redis",g=t.database.type==="sqlite"||t.database.type==="postgres";return c.jsx(Ko,{title:"Storage Configuration",defaultOpen:!1,open:r,onOpenChange:s,errorCount:a,sectionErrors:l,children:c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"space-y-3",children:[c.jsx("h4",{className:"text-sm font-medium",children:"Cache"}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"cache-type",tooltip:"Storage backend for caching data (in-memory or Redis)",children:"Cache Type"}),c.jsx("select",{id:"cache-type",value:t.cache.type,onChange:p=>u({type:p.target.value}),className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:jL.map(p=>c.jsx("option",{value:p,children:p},p))})]}),h&&"url"in t.cache&&c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"cache-url",tooltip:"Redis connection URL (e.g., redis://localhost:6379)",children:"Redis URL"}),c.jsx(st,{id:"cache-url",value:t.cache.url||"",onChange:p=>u({url:p.target.value||void 0}),placeholder:"redis://localhost:6379","aria-invalid":!!n["storage.cache.url"]}),n["storage.cache.url"]&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n["storage.cache.url"]})]})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx("h4",{className:"text-sm font-medium",children:"Database"}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"database-type",tooltip:"Storage backend for persistent data (in-memory, SQLite, or PostgreSQL)",children:"Database Type"}),c.jsx("select",{id:"database-type",value:t.database.type,onChange:p=>f({type:p.target.value}),className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:TL.map(p=>c.jsx("option",{value:p,children:p},p))})]}),g&&c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"database-url",tooltip:t.database.type==="sqlite"?"File path for SQLite database":"PostgreSQL connection string",children:t.database.type==="sqlite"?"SQLite Path":"PostgreSQL URL"}),c.jsx(st,{id:"database-url",value:"url"in t.database&&t.database.url||"path"in t.database&&t.database.path||"",onChange:p=>{t.database.type==="sqlite"?f({path:p.target.value||void 0}):f({url:p.target.value||void 0})},placeholder:t.database.type==="sqlite"?"./dexto.db":"postgresql://user:pass@localhost:5432/dexto","aria-invalid":!!(n["storage.database.url"]||n["storage.database.path"])}),(n["storage.database.url"]||n["storage.database.path"])&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n["storage.database.url"]||n["storage.database.path"]})]})]})]})})}function KZ({value:t,onChange:e,errors:n={},open:r,onOpenChange:s,errorCount:a=0,sectionErrors:l=[]}){const u=h=>{e({...t,...h})},f=h=>{e({...t,allowedToolsStorage:h})};return c.jsx(Ko,{title:"Tool Confirmation",defaultOpen:!1,open:r,onOpenChange:s,errorCount:a,sectionErrors:l,children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"confirmation-mode",tooltip:"How the agent handles tool execution requests",children:"Confirmation Mode"}),c.jsx("select",{id:"confirmation-mode",value:t.mode||gE,onChange:h=>u({mode:h.target.value}),className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:mE.map(h=>c.jsx("option",{value:h,children:h==="auto-approve"?"Auto-approve":h==="manual"?"Manual":"Auto-deny"},h))}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.mode==="manual"?"Require explicit approval before executing tools":t.mode==="auto-deny"?"Automatically deny all tool executions":"Automatically approve tool executions"})]}),t.mode==="manual"&&c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"confirmation-timeout",tooltip:"How long to wait for approval before timing out",children:"Timeout (seconds)"}),c.jsx(st,{id:"confirmation-timeout",type:"number",value:t.timeout||"",onChange:h=>u({timeout:h.target.value?parseInt(h.target.value,10):void 0}),min:"1",placeholder:"e.g., 60","aria-invalid":!!n["toolConfirmation.timeout"]}),n["toolConfirmation.timeout"]&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n["toolConfirmation.timeout"]})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"allowed-tools-storage",tooltip:"Where to store the list of pre-approved tools (memory or persistent storage)",children:"Allowed Tools Storage"}),c.jsx("select",{id:"allowed-tools-storage",value:t.allowedToolsStorage||vE,onChange:h=>f(h.target.value),className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:pE.map(h=>c.jsx("option",{value:h,children:h},h))})]})]})})}function YZ({config:t,onChange:e,errors:n={}}){const r=t.systemPrompt?typeof t.systemPrompt=="string"?{contributors:[{id:"primary",type:"static",priority:0,enabled:!0,content:t.systemPrompt}]}:{contributors:t.systemPrompt.contributors||[]}:{contributors:[]},[s,a]=_.useState({basic:!0,llm:!1,systemPrompt:!1,mcpServers:!1,storage:!1,toolConfirmation:!1}),l=yC(n);_.useEffect(()=>{const k=yC(n),w=Object.keys(k).filter(S=>k[S].length>0);w.length>0&&a(S=>{const N={...S};return w.forEach(C=>{N[C]=!0}),N})},[n]);const u=k=>{a(w=>({...w,[k]:!w[k]}))},f=k=>{e({...t,llm:k})},h=k=>{e({...t,systemPrompt:k})},g=k=>{e({...t,mcpServers:k})},p=k=>{e({...t,storage:k})},x=k=>{e({...t,toolConfirmation:k})},y=GZ(t);return c.jsxs("div",{className:"flex flex-col h-full overflow-auto",children:[y&&c.jsx("div",{className:"mx-4 mt-4 p-3 bg-yellow-500/10 border border-yellow-500/20 rounded-lg",children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(qa,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 mt-0.5 flex-shrink-0"}),c.jsxs("div",{className:"text-sm",children:[c.jsx("p",{className:"font-medium text-yellow-600 dark:text-yellow-500",children:"Advanced Configuration Detected"}),c.jsx("p",{className:"text-xs text-yellow-600/80 dark:text-yellow-500/80 mt-1",children:"Some advanced features may not be editable in form mode. Switch to YAML editor for full control."})]})]})}),c.jsxs("div",{className:"flex-1 p-4 space-y-4",children:[c.jsx(Ko,{title:"Basic Information",open:s.basic,onOpenChange:()=>u("basic"),errorCount:l.basic.length,sectionErrors:l.basic,children:c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"agent-greeting",tooltip:"The initial message shown to users when they start a conversation",children:"Greeting Message"}),c.jsx(st,{id:"agent-greeting",value:t.greeting||"",onChange:k=>e({...t,greeting:k.target.value}),placeholder:"Hello! How can I help you today?","aria-invalid":!!n.greeting}),n.greeting&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:n.greeting})]})}),c.jsx(AR,{value:t.llm,onChange:f,errors:n,open:s.llm,onOpenChange:()=>u("llm"),errorCount:l.llm.length,sectionErrors:l.llm}),c.jsx(OR,{value:r,onChange:h,errors:n,open:s.systemPrompt,onOpenChange:()=>u("systemPrompt"),errorCount:l.systemPrompt.length,sectionErrors:l.systemPrompt}),c.jsx(HZ,{value:t.mcpServers||{},onChange:g,errors:n,open:s.mcpServers,onOpenChange:()=>u("mcpServers"),errorCount:l.mcpServers.length,sectionErrors:l.mcpServers}),c.jsx(VZ,{value:t.storage||{cache:{type:"in-memory"},database:{type:"in-memory"},blob:{type:"local",storePath:"/tmp/dexto-blobs"}},onChange:p,errors:n,open:s.storage,onOpenChange:()=>u("storage"),errorCount:l.storage.length,sectionErrors:l.storage}),c.jsx(KZ,{value:t.toolConfirmation||{},onChange:x,errors:n,open:s.toolConfirmation,onOpenChange:()=>u("toolConfirmation"),errorCount:l.toolConfirmation.length,sectionErrors:l.toolConfirmation})]})]})}function GZ(t){return!!(t.sessions&&Object.keys(t.sessions).length>0||t.internalTools)}function yC(t){const e={basic:[],llm:[],systemPrompt:[],mcpServers:[],storage:[],toolConfirmation:[]};return Object.entries(t).forEach(([n,r])=>{n==="greeting"?e.basic.push(r):n.startsWith("llm.")?e.llm.push(r):n.startsWith("systemPrompt")?e.systemPrompt.push(r):n.startsWith("mcpServers")?e.mcpServers.push(r):n.startsWith("storage.")?e.storage.push(r):n.startsWith("toolConfirmation.")&&e.toolConfirmation.push(r)}),e}function ZZ({config:t,onChange:e,errors:n={}}){return c.jsx("div",{className:"flex flex-col h-full",children:c.jsx(YZ,{config:t,onChange:e,errors:n})})}const ow=Symbol.for("yaml.alias"),Mb=Symbol.for("yaml.document"),Fa=Symbol.for("yaml.map"),RR=Symbol.for("yaml.pair"),ii=Symbol.for("yaml.scalar"),Lc=Symbol.for("yaml.seq"),hs=Symbol.for("yaml.node.type"),Yo=t=>!!t&&typeof t=="object"&&t[hs]===ow,Cp=t=>!!t&&typeof t=="object"&&t[hs]===Mb,Zd=t=>!!t&&typeof t=="object"&&t[hs]===Fa,_n=t=>!!t&&typeof t=="object"&&t[hs]===RR,Jt=t=>!!t&&typeof t=="object"&&t[hs]===ii,Wd=t=>!!t&&typeof t=="object"&&t[hs]===Lc;function bn(t){if(t&&typeof t=="object")switch(t[hs]){case Fa:case Lc:return!0}return!1}function wn(t){if(t&&typeof t=="object")switch(t[hs]){case ow:case Fa:case ii:case Lc:return!0}return!1}const MR=t=>(Jt(t)||bn(t))&&!!t.anchor,wo=Symbol("break visit"),WZ=Symbol("skip children"),pd=Symbol("remove node");function Pc(t,e){const n=QZ(e);Cp(t)?Yl(null,t.contents,n,Object.freeze([t]))===pd&&(t.contents=null):Yl(null,t,n,Object.freeze([]))}Pc.BREAK=wo;Pc.SKIP=WZ;Pc.REMOVE=pd;function Yl(t,e,n,r){const s=XZ(t,e,n,r);if(wn(s)||_n(s))return JZ(t,r,s),Yl(t,s,n,r);if(typeof s!="symbol"){if(bn(e)){r=Object.freeze(r.concat(e));for(let a=0;a<e.items.length;++a){const l=Yl(a,e.items[a],n,r);if(typeof l=="number")a=l-1;else{if(l===wo)return wo;l===pd&&(e.items.splice(a,1),a-=1)}}}else if(_n(e)){r=Object.freeze(r.concat(e));const a=Yl("key",e.key,n,r);if(a===wo)return wo;a===pd&&(e.key=null);const l=Yl("value",e.value,n,r);if(l===wo)return wo;l===pd&&(e.value=null)}}return s}function QZ(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function XZ(t,e,n,r){var s,a,l,u,f;if(typeof n=="function")return n(t,e,r);if(Zd(e))return(s=n.Map)==null?void 0:s.call(n,t,e,r);if(Wd(e))return(a=n.Seq)==null?void 0:a.call(n,t,e,r);if(_n(e))return(l=n.Pair)==null?void 0:l.call(n,t,e,r);if(Jt(e))return(u=n.Scalar)==null?void 0:u.call(n,t,e,r);if(Yo(e))return(f=n.Alias)==null?void 0:f.call(n,t,e,r)}function JZ(t,e,n){const r=e[e.length-1];if(bn(r))r.items[t]=n;else if(_n(r))t==="key"?r.key=n:r.value=n;else if(Cp(r))r.contents=n;else{const s=Yo(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${s} parent`)}}const eW={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},tW=t=>t.replace(/[!,[\]{}]/g,e=>eW[e]);class mr{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},mr.defaultYaml,e),this.tags=Object.assign({},mr.defaultTags,n)}clone(){const e=new mr(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new mr(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:mr.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},mr.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:mr.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},mr.defaultTags),this.atNextDocument=!1);const r=e.trim().split(/[ \t]+/),s=r.shift();switch(s){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;const[a,l]=r;return this.tags[a]=l,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[a]=r;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{const l=/^\d+\.\d+$/.test(a);return n(6,`Unsupported YAML version ${a}`,l),!1}}default:return n(0,`Unknown directive ${s}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const l=e.slice(2,-1);return l==="!"||l==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),l)}const[,r,s]=e.match(/^(.*!)([^!]*)$/s);s||n(`The ${e} tag has no suffix`);const a=this.tags[r];if(a)try{return a+decodeURIComponent(s)}catch(l){return n(String(l)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+tW(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags);let s;if(e&&r.length>0&&wn(e.contents)){const a={};Pc(e.contents,(l,u)=>{wn(u)&&u.tag&&(a[u.tag]=!0)}),s=Object.keys(a)}else s=[];for(const[a,l]of r)a==="!!"&&l==="tag:yaml.org,2002:"||(!e||s.some(u=>u.startsWith(l)))&&n.push(`%TAG ${a} ${l}`);return n.join(`
|
|
549
|
-
`)}}mr.defaultYaml={explicit:!1,version:"1.2"};mr.defaultTags={"!!":"tag:yaml.org,2002:"};function DR(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function IR(t){const e=new Set;return Pc(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function LR(t,e){for(let n=1;;++n){const r=`${t}${n}`;if(!e.has(r))return r}}function nW(t,e){const n=[],r=new Map;let s=null;return{onAnchor:a=>{n.push(a),s??(s=IR(t));const l=LR(e,s);return s.add(l),l},setAnchors:()=>{for(const a of n){const l=r.get(a);if(typeof l=="object"&&l.anchor&&(Jt(l.node)||bn(l.node)))l.node.anchor=l.anchor;else{const u=new Error("Failed to resolve repeated object (this should not happen)");throw u.source=a,u}}},sourceObjects:r}}function Gl(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let s=0,a=r.length;s<a;++s){const l=r[s],u=Gl(t,r,String(s),l);u===void 0?delete r[s]:u!==l&&(r[s]=u)}else if(r instanceof Map)for(const s of Array.from(r.keys())){const a=r.get(s),l=Gl(t,r,s,a);l===void 0?r.delete(s):l!==a&&r.set(s,l)}else if(r instanceof Set)for(const s of Array.from(r)){const a=Gl(t,r,s,s);a===void 0?r.delete(s):a!==s&&(r.delete(s),r.add(a))}else for(const[s,a]of Object.entries(r)){const l=Gl(t,r,s,a);l===void 0?delete r[s]:l!==a&&(r[s]=l)}return t.call(e,n,r)}function cs(t,e,n){if(Array.isArray(t))return t.map((r,s)=>cs(r,String(s),n));if(t&&typeof t.toJSON=="function"){if(!n||!MR(t))return t.toJSON(e,n);const r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=a=>{r.res=a,delete n.onCreate};const s=t.toJSON(e,n);return n.onCreate&&n.onCreate(s),s}return typeof t=="bigint"&&!(n!=null&&n.keep)?Number(t):t}class lw{constructor(e){Object.defineProperty(this,hs,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:r,onAnchor:s,reviver:a}={}){if(!Cp(e))throw new TypeError("A document argument is required");const l={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},u=cs(this,"",l);if(typeof s=="function")for(const{count:f,res:h}of l.anchors.values())s(h,f);return typeof a=="function"?Gl(a,{"":u},"",u):u}}class cw extends lw{constructor(e){super(ow),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){let r;n!=null&&n.aliasResolveCache?r=n.aliasResolveCache:(r=[],Pc(e,{Node:(a,l)=>{(Yo(l)||MR(l))&&r.push(l)}}),n&&(n.aliasResolveCache=r));let s;for(const a of r){if(a===this)break;a.anchor===this.source&&(s=a)}return s}toJSON(e,n){if(!n)return{source:this.source};const{anchors:r,doc:s,maxAliasCount:a}=n,l=this.resolve(s,n);if(!l){const f=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(f)}let u=r.get(l);if(u||(cs(l,null,n),u=r.get(l)),!u||u.res===void 0){const f="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(f)}if(a>=0&&(u.count+=1,u.aliasCount===0&&(u.aliasCount=tm(s,l,r)),u.count*u.aliasCount>a)){const f="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(f)}return u.res}toString(e,n,r){const s=`*${this.source}`;if(e){if(DR(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(e.implicitKey)return`${s} `}return s}}function tm(t,e,n){if(Yo(e)){const r=e.resolve(t),s=n&&r&&n.get(r);return s?s.count*s.aliasCount:0}else if(bn(e)){let r=0;for(const s of e.items){const a=tm(t,s,n);a>r&&(r=a)}return r}else if(_n(e)){const r=tm(t,e.key,n),s=tm(t,e.value,n);return Math.max(r,s)}return 1}const PR=t=>!t||typeof t!="function"&&typeof t!="object";class ht extends lw{constructor(e){super(ii),this.value=e}toJSON(e,n){return n!=null&&n.keep?this.value:cs(this.value,e,n)}toString(){return String(this.value)}}ht.BLOCK_FOLDED="BLOCK_FOLDED";ht.BLOCK_LITERAL="BLOCK_LITERAL";ht.PLAIN="PLAIN";ht.QUOTE_DOUBLE="QUOTE_DOUBLE";ht.QUOTE_SINGLE="QUOTE_SINGLE";const rW="tag:yaml.org,2002:";function sW(t,e,n){if(e){const r=n.filter(a=>a.tag===e),s=r.find(a=>!a.format)??r[0];if(!s)throw new Error(`Tag ${e} not found`);return s}return n.find(r=>{var s;return((s=r.identify)==null?void 0:s.call(r,t))&&!r.format})}function Rd(t,e,n){var p,x,y;if(Cp(t)&&(t=t.contents),wn(t))return t;if(_n(t)){const k=(x=(p=n.schema[Fa]).createNode)==null?void 0:x.call(p,n.schema,null,n);return k.items.push(t),k}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());const{aliasDuplicateObjects:r,onAnchor:s,onTagObj:a,schema:l,sourceObjects:u}=n;let f;if(r&&t&&typeof t=="object"){if(f=u.get(t),f)return f.anchor??(f.anchor=s(t)),new cw(f.anchor);f={anchor:null,node:null},u.set(t,f)}e!=null&&e.startsWith("!!")&&(e=rW+e.slice(2));let h=sW(t,e,l.tags);if(!h){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){const k=new ht(t);return f&&(f.node=k),k}h=t instanceof Map?l[Fa]:Symbol.iterator in Object(t)?l[Lc]:l[Fa]}a&&(a(h),delete n.onTagObj);const g=h!=null&&h.createNode?h.createNode(n.schema,t,n):typeof((y=h==null?void 0:h.nodeClass)==null?void 0:y.from)=="function"?h.nodeClass.from(n.schema,t,n):new ht(t);return e?g.tag=e:h.default||(g.tag=h.tag),f&&(f.node=g),g}function qm(t,e,n){let r=n;for(let s=e.length-1;s>=0;--s){const a=e[s];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){const l=[];l[a]=r,r=l}else r=new Map([[a,r]])}return Rd(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}const id=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done;class $R extends lw{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(r=>wn(r)||_n(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(id(e))this.add(n);else{const[r,...s]=e,a=this.get(r,!0);if(bn(a))a.addIn(s,n);else if(a===void 0&&this.schema)this.set(r,qm(this.schema,s,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}deleteIn(e){const[n,...r]=e;if(r.length===0)return this.delete(n);const s=this.get(n,!0);if(bn(s))return s.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){const[r,...s]=e,a=this.get(r,!0);return s.length===0?!n&&Jt(a)?a.value:a:bn(a)?a.getIn(s,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!_n(n))return!1;const r=n.value;return r==null||e&&Jt(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){const[n,...r]=e;if(r.length===0)return this.has(n);const s=this.get(n,!0);return bn(s)?s.hasIn(r):!1}setIn(e,n){const[r,...s]=e;if(s.length===0)this.set(r,n);else{const a=this.get(r,!0);if(bn(a))a.setIn(s,n);else if(a===void 0&&this.schema)this.set(r,qm(this.schema,s,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}}const iW=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function $i(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}const So=(t,e,n)=>t.endsWith(`
|
|
550
|
-
`)?$i(n,e):n.includes(`
|
|
551
|
-
`)?`
|
|
552
|
-
`+$i(n,e):(t.endsWith(" ")?"":" ")+n,zR="flow",Db="block",nm="quoted";function Ep(t,e,n="flow",{indentAtStart:r,lineWidth:s=80,minContentWidth:a=20,onFold:l,onOverflow:u}={}){if(!s||s<0)return t;s<a&&(a=0);const f=Math.max(1+a,1+s-e.length);if(t.length<=f)return t;const h=[],g={};let p=s-e.length;typeof r=="number"&&(r>s-Math.max(2,a)?h.push(0):p=s-r);let x,y,k=!1,w=-1,S=-1,N=-1;n===Db&&(w=bC(t,w,e.length),w!==-1&&(p=w+f));for(let j;j=t[w+=1];){if(n===nm&&j==="\\"){switch(S=w,t[w+1]){case"x":w+=3;break;case"u":w+=5;break;case"U":w+=9;break;default:w+=1}N=w}if(j===`
|
|
553
|
-
`)n===Db&&(w=bC(t,w,e.length)),p=w+e.length+f,x=void 0;else{if(j===" "&&y&&y!==" "&&y!==`
|
|
554
|
-
`&&y!==" "){const A=t[w+1];A&&A!==" "&&A!==`
|
|
555
|
-
`&&A!==" "&&(x=w)}if(w>=p)if(x)h.push(x),p=x+f,x=void 0;else if(n===nm){for(;y===" "||y===" ";)y=j,j=t[w+=1],k=!0;const A=w>N+1?w-2:S-1;if(g[A])return t;h.push(A),g[A]=!0,p=A+f,x=void 0}else k=!0}y=j}if(k&&u&&u(),h.length===0)return t;l&&l();let C=t.slice(0,h[0]);for(let j=0;j<h.length;++j){const A=h[j],I=h[j+1]||t.length;A===0?C=`
|
|
556
|
-
${e}${t.slice(0,I)}`:(n===nm&&g[A]&&(C+=`${t[A]}\\`),C+=`
|
|
557
|
-
${e}${t.slice(A+1,I)}`)}return C}function bC(t,e,n){let r=e,s=e+1,a=t[s];for(;a===" "||a===" ";)if(e<s+n)a=t[++e];else{do a=t[++e];while(a&&a!==`
|
|
558
|
-
`);r=e,s=e+1,a=t[s]}return r}const Tp=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Ap=t=>/^(%|---|\.\.\.)/m.test(t);function aW(t,e,n){if(!e||e<0)return!1;const r=e-n,s=t.length;if(s<=r)return!1;for(let a=0,l=0;a<s;++a)if(t[a]===`
|
|
559
|
-
`){if(a-l>r)return!0;if(l=a+1,s-l<=r)return!1}return!0}function gd(t,e){const n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;const{implicitKey:r}=e,s=e.options.doubleQuotedMinMultiLineLength,a=e.indent||(Ap(t)?" ":"");let l="",u=0;for(let f=0,h=n[f];h;h=n[++f])if(h===" "&&n[f+1]==="\\"&&n[f+2]==="n"&&(l+=n.slice(u,f)+"\\ ",f+=1,u=f,h="\\"),h==="\\")switch(n[f+1]){case"u":{l+=n.slice(u,f);const g=n.substr(f+2,4);switch(g){case"0000":l+="\\0";break;case"0007":l+="\\a";break;case"000b":l+="\\v";break;case"001b":l+="\\e";break;case"0085":l+="\\N";break;case"00a0":l+="\\_";break;case"2028":l+="\\L";break;case"2029":l+="\\P";break;default:g.substr(0,2)==="00"?l+="\\x"+g.substr(2):l+=n.substr(f,6)}f+=5,u=f+1}break;case"n":if(r||n[f+2]==='"'||n.length<s)f+=1;else{for(l+=n.slice(u,f)+`
|
|
560
|
-
|
|
561
|
-
`;n[f+2]==="\\"&&n[f+3]==="n"&&n[f+4]!=='"';)l+=`
|
|
562
|
-
`,f+=2;l+=a,n[f+2]===" "&&(l+="\\"),f+=1,u=f+1}break;default:f+=1}return l=u?l+n.slice(u):n,r?l:Ep(l,a,nm,Tp(e,!1))}function Ib(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
563
|
-
`)||/[ \t]\n|\n[ \t]/.test(t))return gd(t,e);const n=e.indent||(Ap(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
564
|
-
${n}`)+"'";return e.implicitKey?r:Ep(r,n,zR,Tp(e,!1))}function Zl(t,e){const{singleQuote:n}=e.options;let r;if(n===!1)r=gd;else{const s=t.includes('"'),a=t.includes("'");s&&!a?r=Ib:a&&!s?r=gd:r=n?Ib:gd}return r(t,e)}let Lb;try{Lb=new RegExp(`(^|(?<!
|
|
565
|
-
))
|
|
566
|
-
+(?!
|
|
567
|
-
|$)`,"g")}catch{Lb=/\n+(?!\n|$)/g}function rm({comment:t,type:e,value:n},r,s,a){const{blockQuote:l,commentString:u,lineWidth:f}=r.options;if(!l||/\n[\t ]+$/.test(n))return Zl(n,r);const h=r.indent||(r.forceBlockIndent||Ap(n)?" ":""),g=l==="literal"?!0:l==="folded"||e===ht.BLOCK_FOLDED?!1:e===ht.BLOCK_LITERAL?!0:!aW(n,f,h.length);if(!n)return g?`|
|
|
568
|
-
`:`>
|
|
569
|
-
`;let p,x;for(x=n.length;x>0;--x){const I=n[x-1];if(I!==`
|
|
570
|
-
`&&I!==" "&&I!==" ")break}let y=n.substring(x);const k=y.indexOf(`
|
|
571
|
-
`);k===-1?p="-":n===y||k!==y.length-1?(p="+",a&&a()):p="",y&&(n=n.slice(0,-y.length),y[y.length-1]===`
|
|
572
|
-
`&&(y=y.slice(0,-1)),y=y.replace(Lb,`$&${h}`));let w=!1,S,N=-1;for(S=0;S<n.length;++S){const I=n[S];if(I===" ")w=!0;else if(I===`
|
|
573
|
-
`)N=S;else break}let C=n.substring(0,N<S?N+1:S);C&&(n=n.substring(C.length),C=C.replace(/\n+/g,`$&${h}`));let A=(w?h?"2":"1":"")+p;if(t&&(A+=" "+u(t.replace(/ ?[\r\n]+/g," ")),s&&s()),!g){const I=n.replace(/\n+/g,`
|
|
574
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${h}`);let T=!1;const E=Tp(r,!0);l!=="folded"&&e!==ht.BLOCK_FOLDED&&(E.onOverflow=()=>{T=!0});const R=Ep(`${C}${I}${y}`,h,Db,E);if(!T)return`>${A}
|
|
575
|
-
${h}${R}`}return n=n.replace(/\n+/g,`$&${h}`),`|${A}
|
|
576
|
-
${h}${C}${n}${y}`}function oW(t,e,n,r){const{type:s,value:a}=t,{actualString:l,implicitKey:u,indent:f,indentStep:h,inFlow:g}=e;if(u&&a.includes(`
|
|
577
|
-
`)||g&&/[[\]{},]/.test(a))return Zl(a,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return u||g||!a.includes(`
|
|
578
|
-
`)?Zl(a,e):rm(t,e,n,r);if(!u&&!g&&s!==ht.PLAIN&&a.includes(`
|
|
579
|
-
`))return rm(t,e,n,r);if(Ap(a)){if(f==="")return e.forceBlockIndent=!0,rm(t,e,n,r);if(u&&f===h)return Zl(a,e)}const p=a.replace(/\n+/g,`$&
|
|
580
|
-
${f}`);if(l){const x=w=>{var S;return w.default&&w.tag!=="tag:yaml.org,2002:str"&&((S=w.test)==null?void 0:S.test(p))},{compat:y,tags:k}=e.doc.schema;if(k.some(x)||y!=null&&y.some(x))return Zl(a,e)}return u?p:Ep(p,f,zR,Tp(e,!1))}function uw(t,e,n,r){const{implicitKey:s,inFlow:a}=e,l=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)});let{type:u}=t;u!==ht.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(l.value)&&(u=ht.QUOTE_DOUBLE);const f=g=>{switch(g){case ht.BLOCK_FOLDED:case ht.BLOCK_LITERAL:return s||a?Zl(l.value,e):rm(l,e,n,r);case ht.QUOTE_DOUBLE:return gd(l.value,e);case ht.QUOTE_SINGLE:return Ib(l.value,e);case ht.PLAIN:return oW(l,e,n,r);default:return null}};let h=f(u);if(h===null){const{defaultKeyType:g,defaultStringType:p}=e.options,x=s&&g||p;if(h=f(x),h===null)throw new Error(`Unsupported default string type ${x}`)}return h}function FR(t,e){const n=Object.assign({blockQuote:!0,commentString:iW,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e);let r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function lW(t,e){var s;if(e.tag){const a=t.filter(l=>l.tag===e.tag);if(a.length>0)return a.find(l=>l.format===e.format)??a[0]}let n,r;if(Jt(e)){r=e.value;let a=t.filter(l=>{var u;return(u=l.identify)==null?void 0:u.call(l,r)});if(a.length>1){const l=a.filter(u=>u.test);l.length>0&&(a=l)}n=a.find(l=>l.format===e.format)??a.find(l=>!l.format)}else r=e,n=t.find(a=>a.nodeClass&&r instanceof a.nodeClass);if(!n){const a=((s=r==null?void 0:r.constructor)==null?void 0:s.name)??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${a} value`)}return n}function cW(t,e,{anchors:n,doc:r}){if(!r.directives)return"";const s=[],a=(Jt(t)||bn(t))&&t.anchor;a&&DR(a)&&(n.add(a),s.push(`&${a}`));const l=t.tag??(e.default?null:e.tag);return l&&s.push(r.directives.tagString(l)),s.join(" ")}function wc(t,e,n,r){var f;if(_n(t))return t.toString(e,n,r);if(Yo(t)){if(e.doc.directives)return t.toString(e);if((f=e.resolvedAliases)!=null&&f.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let s;const a=wn(t)?t:e.doc.createNode(t,{onTagObj:h=>s=h});s??(s=lW(e.doc.schema.tags,a));const l=cW(a,s,e);l.length>0&&(e.indentAtStart=(e.indentAtStart??0)+l.length+1);const u=typeof s.stringify=="function"?s.stringify(a,e,n,r):Jt(a)?uw(a,e,n,r):a.toString(e,n,r);return l?Jt(a)||u[0]==="{"||u[0]==="["?`${l} ${u}`:`${l}
|
|
581
|
-
${e.indent}${u}`:u}function uW({key:t,value:e},n,r,s){const{allNullValues:a,doc:l,indent:u,indentStep:f,options:{commentString:h,indentSeq:g,simpleKeys:p}}=n;let x=wn(t)&&t.comment||null;if(p){if(x)throw new Error("With simple keys, key nodes cannot have comments");if(bn(t)||!wn(t)&&typeof t=="object"){const E="With simple keys, collection cannot be used as a key value";throw new Error(E)}}let y=!p&&(!t||x&&e==null&&!n.inFlow||bn(t)||(Jt(t)?t.type===ht.BLOCK_FOLDED||t.type===ht.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!y&&(p||!a),indent:u+f});let k=!1,w=!1,S=wc(t,n,()=>k=!0,()=>w=!0);if(!y&&!n.inFlow&&S.length>1024){if(p)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");y=!0}if(n.inFlow){if(a||e==null)return k&&r&&r(),S===""?"?":y?`? ${S}`:S}else if(a&&!p||e==null&&y)return S=`? ${S}`,x&&!k?S+=So(S,n.indent,h(x)):w&&s&&s(),S;k&&(x=null),y?(x&&(S+=So(S,n.indent,h(x))),S=`? ${S}
|
|
582
|
-
${u}:`):(S=`${S}:`,x&&(S+=So(S,n.indent,h(x))));let N,C,j;wn(e)?(N=!!e.spaceBefore,C=e.commentBefore,j=e.comment):(N=!1,C=null,j=null,e&&typeof e=="object"&&(e=l.createNode(e))),n.implicitKey=!1,!y&&!x&&Jt(e)&&(n.indentAtStart=S.length+1),w=!1,!g&&f.length>=2&&!n.inFlow&&!y&&Wd(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let A=!1;const I=wc(e,n,()=>A=!0,()=>w=!0);let T=" ";if(x||N||C){if(T=N?`
|
|
583
|
-
`:"",C){const E=h(C);T+=`
|
|
584
|
-
${$i(E,n.indent)}`}I===""&&!n.inFlow?T===`
|
|
585
|
-
`&&(T=`
|
|
586
|
-
|
|
587
|
-
`):T+=`
|
|
588
|
-
${n.indent}`}else if(!y&&bn(e)){const E=I[0],R=I.indexOf(`
|
|
589
|
-
`),z=R!==-1,D=n.inFlow??e.flow??e.items.length===0;if(z||!D){let B=!1;if(z&&(E==="&"||E==="!")){let q=I.indexOf(" ");E==="&"&&q!==-1&&q<R&&I[q+1]==="!"&&(q=I.indexOf(" ",q+1)),(q===-1||R<q)&&(B=!0)}B||(T=`
|
|
590
|
-
${n.indent}`)}}else(I===""||I[0]===`
|
|
591
|
-
`)&&(T="");return S+=T+I,n.inFlow?A&&r&&r():j&&!A?S+=So(S,n.indent,h(j)):w&&s&&s(),S}function dW(t,e){(t==="debug"||t==="warn")&&console.warn(e)}const Ph="<<",Ui={identify:t=>t===Ph||typeof t=="symbol"&&t.description===Ph,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ht(Symbol(Ph)),{addToJSMap:BR}),stringify:()=>Ph},fW=(t,e)=>(Ui.identify(e)||Jt(e)&&(!e.type||e.type===ht.PLAIN)&&Ui.identify(e.value))&&(t==null?void 0:t.doc.schema.tags.some(n=>n.tag===Ui.tag&&n.default));function BR(t,e,n){if(n=t&&Yo(n)?n.resolve(t.doc):n,Wd(n))for(const r of n.items)ay(t,e,r);else if(Array.isArray(n))for(const r of n)ay(t,e,r);else ay(t,e,n)}function ay(t,e,n){const r=t&&Yo(n)?n.resolve(t.doc):n;if(!Zd(r))throw new Error("Merge sources must be maps or map aliases");const s=r.toJSON(null,t,Map);for(const[a,l]of s)e instanceof Map?e.has(a)||e.set(a,l):e instanceof Set?e.add(a):Object.prototype.hasOwnProperty.call(e,a)||Object.defineProperty(e,a,{value:l,writable:!0,enumerable:!0,configurable:!0});return e}function UR(t,e,{key:n,value:r}){if(wn(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if(fW(t,n))BR(t,e,r);else{const s=cs(n,"",t);if(e instanceof Map)e.set(s,cs(r,s,t));else if(e instanceof Set)e.add(s);else{const a=hW(n,s,t),l=cs(r,a,t);a in e?Object.defineProperty(e,a,{value:l,writable:!0,enumerable:!0,configurable:!0}):e[a]=l}}return e}function hW(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(wn(t)&&(n!=null&&n.doc)){const r=FR(n.doc,{});r.anchors=new Set;for(const a of n.anchors.keys())r.anchors.add(a.anchor);r.inFlow=!0,r.inStringifyKey=!0;const s=t.toString(r);if(!n.mapKeyWarned){let a=JSON.stringify(s);a.length>40&&(a=a.substring(0,36)+'..."'),dW(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return s}return JSON.stringify(e)}function dw(t,e,n){const r=Rd(t,void 0,n),s=Rd(e,void 0,n);return new gr(r,s)}class gr{constructor(e,n=null){Object.defineProperty(this,hs,{value:RR}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return wn(n)&&(n=n.clone(e)),wn(r)&&(r=r.clone(e)),new gr(n,r)}toJSON(e,n){const r=n!=null&&n.mapAsMap?new Map:{};return UR(n,r,this)}toString(e,n,r){return e!=null&&e.doc?uW(this,e,n,r):JSON.stringify(this)}}function qR(t,e,n){return(e.inFlow??t.flow?pW:mW)(t,e,n)}function mW({comment:t,items:e},n,{blockItemPrefix:r,flowChars:s,itemIndent:a,onChompKeep:l,onComment:u}){const{indent:f,options:{commentString:h}}=n,g=Object.assign({},n,{indent:a,type:null});let p=!1;const x=[];for(let k=0;k<e.length;++k){const w=e[k];let S=null;if(wn(w))!p&&w.spaceBefore&&x.push(""),Hm(n,x,w.commentBefore,p),w.comment&&(S=w.comment);else if(_n(w)){const C=wn(w.key)?w.key:null;C&&(!p&&C.spaceBefore&&x.push(""),Hm(n,x,C.commentBefore,p))}p=!1;let N=wc(w,g,()=>S=null,()=>p=!0);S&&(N+=So(N,a,h(S))),p&&S&&(p=!1),x.push(r+N)}let y;if(x.length===0)y=s.start+s.end;else{y=x[0];for(let k=1;k<x.length;++k){const w=x[k];y+=w?`
|
|
592
|
-
${f}${w}`:`
|
|
593
|
-
`}}return t?(y+=`
|
|
594
|
-
`+$i(h(t),f),u&&u()):p&&l&&l(),y}function pW({items:t},e,{flowChars:n,itemIndent:r}){const{indent:s,indentStep:a,flowCollectionPadding:l,options:{commentString:u}}=e;r+=a;const f=Object.assign({},e,{indent:r,inFlow:!0,type:null});let h=!1,g=0;const p=[];for(let k=0;k<t.length;++k){const w=t[k];let S=null;if(wn(w))w.spaceBefore&&p.push(""),Hm(e,p,w.commentBefore,!1),w.comment&&(S=w.comment);else if(_n(w)){const C=wn(w.key)?w.key:null;C&&(C.spaceBefore&&p.push(""),Hm(e,p,C.commentBefore,!1),C.comment&&(h=!0));const j=wn(w.value)?w.value:null;j?(j.comment&&(S=j.comment),j.commentBefore&&(h=!0)):w.value==null&&(C!=null&&C.comment)&&(S=C.comment)}S&&(h=!0);let N=wc(w,f,()=>S=null);k<t.length-1&&(N+=","),S&&(N+=So(N,r,u(S))),!h&&(p.length>g||N.includes(`
|
|
595
|
-
`))&&(h=!0),p.push(N),g=p.length}const{start:x,end:y}=n;if(p.length===0)return x+y;if(!h){const k=p.reduce((w,S)=>w+S.length+2,2);h=e.options.lineWidth>0&&k>e.options.lineWidth}if(h){let k=x;for(const w of p)k+=w?`
|
|
596
|
-
${a}${s}${w}`:`
|
|
597
|
-
`;return`${k}
|
|
598
|
-
${s}${y}`}else return`${x}${l}${p.join(" ")}${l}${y}`}function Hm({indent:t,options:{commentString:e}},n,r,s){if(r&&s&&(r=r.replace(/^\n+/,"")),r){const a=$i(e(r),t);n.push(a.trimStart())}}function jo(t,e){const n=Jt(e)?e.value:e;for(const r of t)if(_n(r)&&(r.key===e||r.key===n||Jt(r.key)&&r.key.value===n))return r}class is extends $R{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Fa,e),this.items=[]}static from(e,n,r){const{keepUndefined:s,replacer:a}=r,l=new this(e),u=(f,h)=>{if(typeof a=="function")h=a.call(n,f,h);else if(Array.isArray(a)&&!a.includes(f))return;(h!==void 0||s)&&l.items.push(dw(f,h,r))};if(n instanceof Map)for(const[f,h]of n)u(f,h);else if(n&&typeof n=="object")for(const f of Object.keys(n))u(f,n[f]);return typeof e.sortMapEntries=="function"&&l.items.sort(e.sortMapEntries),l}add(e,n){var l;let r;_n(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new gr(e,e==null?void 0:e.value):r=new gr(e.key,e.value);const s=jo(this.items,r.key),a=(l=this.schema)==null?void 0:l.sortMapEntries;if(s){if(!n)throw new Error(`Key ${r.key} already set`);Jt(s.value)&&PR(r.value)?s.value.value=r.value:s.value=r.value}else if(a){const u=this.items.findIndex(f=>a(r,f)<0);u===-1?this.items.push(r):this.items.splice(u,0,r)}else this.items.push(r)}delete(e){const n=jo(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){const r=jo(this.items,e),s=r==null?void 0:r.value;return(!n&&Jt(s)?s.value:s)??void 0}has(e){return!!jo(this.items,e)}set(e,n){this.add(new gr(e,n),!0)}toJSON(e,n,r){const s=r?new r:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(s);for(const a of this.items)UR(n,s,a);return s}toString(e,n,r){if(!e)return JSON.stringify(this);for(const s of this.items)if(!_n(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),qR(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}}const $c={collection:"map",default:!0,nodeClass:is,tag:"tag:yaml.org,2002:map",resolve(t,e){return Zd(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>is.from(t,e,n)};class Ho extends $R{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Lc,e),this.items=[]}add(e){this.items.push(e)}delete(e){const n=$h(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){const r=$h(e);if(typeof r!="number")return;const s=this.items[r];return!n&&Jt(s)?s.value:s}has(e){const n=$h(e);return typeof n=="number"&&n<this.items.length}set(e,n){const r=$h(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);const s=this.items[r];Jt(s)&&PR(n)?s.value=n:this.items[r]=n}toJSON(e,n){const r=[];n!=null&&n.onCreate&&n.onCreate(r);let s=0;for(const a of this.items)r.push(cs(a,String(s++),n));return r}toString(e,n,r){return e?qR(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(e,n,r){const{replacer:s}=r,a=new this(e);if(n&&Symbol.iterator in Object(n)){let l=0;for(let u of n){if(typeof s=="function"){const f=n instanceof Set?u:String(l++);u=s.call(n,f,u)}a.items.push(Rd(u,void 0,r))}}return a}}function $h(t){let e=Jt(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}const zc={collection:"seq",default:!0,nodeClass:Ho,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Wd(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Ho.from(t,e,n)},Op={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,r){return e=Object.assign({actualString:!0},e),uw(t,e,n,r)}},Rp={identify:t=>t==null,createNode:()=>new ht(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ht(null),stringify:({source:t},e)=>typeof t=="string"&&Rp.test.test(t)?t:e.options.nullStr},fw={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new ht(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&fw.test.test(t)){const r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?n.options.trueStr:n.options.falseStr}};function $s({format:t,minFractionDigits:e,tag:n,value:r}){if(typeof r=="bigint")return String(r);const s=typeof r=="number"?r:Number(r);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let a=JSON.stringify(r);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(a)){let l=a.indexOf(".");l<0&&(l=a.length,a+=".");let u=e-(a.length-l-1);for(;u-- >0;)a+="0"}return a}const HR={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:$s},VR={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){const e=Number(t.value);return isFinite(e)?e.toExponential():$s(t)}},KR={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){const e=new ht(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:$s},Mp=t=>typeof t=="bigint"||Number.isInteger(t),hw=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function YR(t,e,n){const{value:r}=t;return Mp(r)&&r>=0?n+r.toString(e):$s(t)}const GR={identify:t=>Mp(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>hw(t,2,8,n),stringify:t=>YR(t,8,"0o")},ZR={identify:Mp,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>hw(t,0,10,n),stringify:$s},WR={identify:t=>Mp(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>hw(t,2,16,n),stringify:t=>YR(t,16,"0x")},gW=[$c,zc,Op,Rp,fw,GR,ZR,WR,HR,VR,KR];function wC(t){return typeof t=="bigint"||Number.isInteger(t)}const zh=({value:t})=>JSON.stringify(t),vW=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:zh},{identify:t=>t==null,createNode:()=>new ht(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:zh},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:zh},{identify:wC,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>wC(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:zh}],xW={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},yW=[$c,zc].concat(vW,xW),mw={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof atob=="function"){const n=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let s=0;s<n.length;++s)r[s]=n.charCodeAt(s);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},r,s,a){if(!n)return"";const l=n;let u;if(typeof btoa=="function"){let f="";for(let h=0;h<l.length;++h)f+=String.fromCharCode(l[h]);u=btoa(f)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=ht.BLOCK_LITERAL),e!==ht.QUOTE_DOUBLE){const f=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),h=Math.ceil(u.length/f),g=new Array(h);for(let p=0,x=0;p<h;++p,x+=f)g[p]=u.substr(x,f);u=g.join(e===ht.BLOCK_LITERAL?`
|
|
599
|
-
`:" ")}return uw({comment:t,type:e,value:u},r,s,a)}};function QR(t,e){if(Wd(t))for(let n=0;n<t.items.length;++n){let r=t.items[n];if(!_n(r)){if(Zd(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");const s=r.items[0]||new gr(new ht(null));if(r.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${r.commentBefore}
|
|
600
|
-
${s.key.commentBefore}`:r.commentBefore),r.comment){const a=s.value??s.key;a.comment=a.comment?`${r.comment}
|
|
601
|
-
${a.comment}`:r.comment}r=s}t.items[n]=_n(r)?r:new gr(r)}}else e("Expected a sequence for this tag");return t}function XR(t,e,n){const{replacer:r}=n,s=new Ho(t);s.tag="tag:yaml.org,2002:pairs";let a=0;if(e&&Symbol.iterator in Object(e))for(let l of e){typeof r=="function"&&(l=r.call(e,String(a++),l));let u,f;if(Array.isArray(l))if(l.length===2)u=l[0],f=l[1];else throw new TypeError(`Expected [key, value] tuple: ${l}`);else if(l&&l instanceof Object){const h=Object.keys(l);if(h.length===1)u=h[0],f=l[u];else throw new TypeError(`Expected tuple with one key, not ${h.length} keys`)}else u=l;s.items.push(dw(u,f,n))}return s}const pw={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:QR,createNode:XR};class oc extends Ho{constructor(){super(),this.add=is.prototype.add.bind(this),this.delete=is.prototype.delete.bind(this),this.get=is.prototype.get.bind(this),this.has=is.prototype.has.bind(this),this.set=is.prototype.set.bind(this),this.tag=oc.tag}toJSON(e,n){if(!n)return super.toJSON(e);const r=new Map;n!=null&&n.onCreate&&n.onCreate(r);for(const s of this.items){let a,l;if(_n(s)?(a=cs(s.key,"",n),l=cs(s.value,a,n)):a=cs(s,"",n),r.has(a))throw new Error("Ordered maps must not include duplicate keys");r.set(a,l)}return r}static from(e,n,r){const s=XR(e,n,r),a=new this;return a.items=s.items,a}}oc.tag="tag:yaml.org,2002:omap";const gw={collection:"seq",identify:t=>t instanceof Map,nodeClass:oc,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){const n=QR(t,e),r=[];for(const{key:s}of n.items)Jt(s)&&(r.includes(s.value)?e(`Ordered maps must not include duplicate keys: ${s.value}`):r.push(s.value));return Object.assign(new oc,n)},createNode:(t,e,n)=>oc.from(t,e,n)};function JR({value:t,source:e},n){return e&&(t?eM:tM).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}const eM={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new ht(!0),stringify:JR},tM={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new ht(!1),stringify:JR},bW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:$s},wW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){const e=Number(t.value);return isFinite(e)?e.toExponential():$s(t)}},_W={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){const e=new ht(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){const r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:$s},Qd=t=>typeof t=="bigint"||Number.isInteger(t);function Dp(t,e,n,{intAsBigInt:r}){const s=t[0];if((s==="-"||s==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}const l=BigInt(t);return s==="-"?BigInt(-1)*l:l}const a=parseInt(t,n);return s==="-"?-1*a:a}function vw(t,e,n){const{value:r}=t;if(Qd(r)){const s=r.toString(e);return r<0?"-"+n+s.substr(1):n+s}return $s(t)}const kW={identify:Qd,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Dp(t,2,2,n),stringify:t=>vw(t,2,"0b")},SW={identify:Qd,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Dp(t,1,8,n),stringify:t=>vw(t,8,"0")},jW={identify:Qd,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Dp(t,0,10,n),stringify:$s},NW={identify:Qd,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Dp(t,2,16,n),stringify:t=>vw(t,16,"0x")};class lc extends is{constructor(e){super(e),this.tag=lc.tag}add(e){let n;_n(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new gr(e.key,null):n=new gr(e,null),jo(this.items,n.key)||this.items.push(n)}get(e,n){const r=jo(this.items,e);return!n&&_n(r)?Jt(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const r=jo(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new gr(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){const{replacer:s}=r,a=new this(e);if(n&&Symbol.iterator in Object(n))for(let l of n)typeof s=="function"&&(l=s.call(n,l,l)),a.items.push(dw(l,null,r));return a}}lc.tag="tag:yaml.org,2002:set";const xw={collection:"map",identify:t=>t instanceof Set,nodeClass:lc,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>lc.from(t,e,n),resolve(t,e){if(Zd(t)){if(t.hasAllNullValues(!0))return Object.assign(new lc,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};function yw(t,e){const n=t[0],r=n==="-"||n==="+"?t.substring(1):t,s=l=>e?BigInt(l):Number(l),a=r.replace(/_/g,"").split(":").reduce((l,u)=>l*s(60)+s(u),s(0));return n==="-"?s(-1)*a:a}function nM(t){let{value:e}=t,n=l=>l;if(typeof e=="bigint")n=l=>BigInt(l);else if(isNaN(e)||!isFinite(e))return $s(t);let r="";e<0&&(r="-",e*=n(-1));const s=n(60),a=[e%s];return e<60?a.unshift(0):(e=(e-a[0])/s,a.unshift(e%s),e>=60&&(e=(e-a[0])/s,a.unshift(e))),r+a.map(l=>String(l).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const rM={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>yw(t,n),stringify:nM},sM={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>yw(t,!1),stringify:nM},Ip={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){const e=t.match(Ip.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,r,s,a,l,u]=e.map(Number),f=e[7]?Number((e[7]+"00").substr(1,3)):0;let h=Date.UTC(n,r-1,s,a||0,l||0,u||0,f);const g=e[8];if(g&&g!=="Z"){let p=yw(g,!1);Math.abs(p)<30&&(p*=60),h-=6e4*p}return new Date(h)},stringify:({value:t})=>(t==null?void 0:t.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},_C=[$c,zc,Op,Rp,eM,tM,kW,SW,jW,NW,bW,wW,_W,mw,Ui,gw,pw,xw,rM,sM,Ip],kC=new Map([["core",gW],["failsafe",[$c,zc,Op]],["json",yW],["yaml11",_C],["yaml-1.1",_C]]),SC={binary:mw,bool:fw,float:KR,floatExp:VR,floatNaN:HR,floatTime:sM,int:ZR,intHex:WR,intOct:GR,intTime:rM,map:$c,merge:Ui,null:Rp,omap:gw,pairs:pw,seq:zc,set:xw,timestamp:Ip},CW={"tag:yaml.org,2002:binary":mw,"tag:yaml.org,2002:merge":Ui,"tag:yaml.org,2002:omap":gw,"tag:yaml.org,2002:pairs":pw,"tag:yaml.org,2002:set":xw,"tag:yaml.org,2002:timestamp":Ip};function oy(t,e,n){const r=kC.get(e);if(r&&!t)return n&&!r.includes(Ui)?r.concat(Ui):r.slice();let s=r;if(!s)if(Array.isArray(t))s=[];else{const a=Array.from(kC.keys()).filter(l=>l!=="yaml11").map(l=>JSON.stringify(l)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${a} or define customTags array`)}if(Array.isArray(t))for(const a of t)s=s.concat(a);else typeof t=="function"&&(s=t(s.slice()));return n&&(s=s.concat(Ui)),s.reduce((a,l)=>{const u=typeof l=="string"?SC[l]:l;if(!u){const f=JSON.stringify(l),h=Object.keys(SC).map(g=>JSON.stringify(g)).join(", ");throw new Error(`Unknown custom tag ${f}; use one of ${h}`)}return a.includes(u)||a.push(u),a},[])}const EW=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0;class bw{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:s,schema:a,sortMapEntries:l,toStringDefaults:u}){this.compat=Array.isArray(e)?oy(e,"compat"):e?oy(null,e):null,this.name=typeof a=="string"&&a||"core",this.knownTags=s?CW:{},this.tags=oy(n,this.name,r),this.toStringOptions=u??null,Object.defineProperty(this,Fa,{value:$c}),Object.defineProperty(this,ii,{value:Op}),Object.defineProperty(this,Lc,{value:zc}),this.sortMapEntries=typeof l=="function"?l:l===!0?EW:null}clone(){const e=Object.create(bw.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function TW(t,e){var f;const n=[];let r=e.directives===!0;if(e.directives!==!1&&t.directives){const h=t.directives.toString(t);h?(n.push(h),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");const s=FR(t,e),{commentString:a}=s.options;if(t.commentBefore){n.length!==1&&n.unshift("");const h=a(t.commentBefore);n.unshift($i(h,""))}let l=!1,u=null;if(t.contents){if(wn(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){const p=a(t.contents.commentBefore);n.push($i(p,""))}s.forceBlockIndent=!!t.comment,u=t.contents.comment}const h=u?void 0:()=>l=!0;let g=wc(t.contents,s,()=>u=null,h);u&&(g+=So(g,"",a(u))),(g[0]==="|"||g[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${g}`:n.push(g)}else n.push(wc(t.contents,s));if((f=t.directives)!=null&&f.docEnd)if(t.comment){const h=a(t.comment);h.includes(`
|
|
602
|
-
`)?(n.push("..."),n.push($i(h,""))):n.push(`... ${h}`)}else n.push("...");else{let h=t.comment;h&&l&&(h=h.replace(/^\n+/,"")),h&&((!l||u)&&n[n.length-1]!==""&&n.push(""),n.push($i(a(h),"")))}return n.join(`
|
|
603
|
-
`)+`
|
|
604
|
-
`}let iM=class aM{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,hs,{value:Mb});let s=null;typeof n=="function"||Array.isArray(n)?s=n:r===void 0&&n&&(r=n,n=void 0);const a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=a;let{version:l}=a;r!=null&&r._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(l=this.directives.yaml.version)):this.directives=new mr({version:l}),this.setSchema(l,r),this.contents=e===void 0?null:this.createNode(e,s,r)}clone(){const e=Object.create(aM.prototype,{[hs]:{value:Mb}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=wn(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Pl(this.contents)&&this.contents.add(e)}addIn(e,n){Pl(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){const r=IR(this);e.anchor=!n||r.has(n)?LR(n||"a",r):n}return new cw(e.anchor)}createNode(e,n,r){let s;if(typeof n=="function")e=n.call({"":e},"",e),s=n;else if(Array.isArray(n)){const S=C=>typeof C=="number"||C instanceof String||C instanceof Number,N=n.filter(S).map(String);N.length>0&&(n=n.concat(N)),s=n}else r===void 0&&n&&(r=n,n=void 0);const{aliasDuplicateObjects:a,anchorPrefix:l,flow:u,keepUndefined:f,onTagObj:h,tag:g}=r??{},{onAnchor:p,setAnchors:x,sourceObjects:y}=nW(this,l||"a"),k={aliasDuplicateObjects:a??!0,keepUndefined:f??!1,onAnchor:p,onTagObj:h,replacer:s,schema:this.schema,sourceObjects:y},w=Rd(e,g,k);return u&&bn(w)&&(w.flow=!0),x(),w}createPair(e,n,r={}){const s=this.createNode(e,null,r),a=this.createNode(n,null,r);return new gr(s,a)}delete(e){return Pl(this.contents)?this.contents.delete(e):!1}deleteIn(e){return id(e)?this.contents==null?!1:(this.contents=null,!0):Pl(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return bn(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return id(e)?!n&&Jt(this.contents)?this.contents.value:this.contents:bn(this.contents)?this.contents.getIn(e,n):void 0}has(e){return bn(this.contents)?this.contents.has(e):!1}hasIn(e){return id(e)?this.contents!==void 0:bn(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=qm(this.schema,[e],n):Pl(this.contents)&&this.contents.set(e,n)}setIn(e,n){id(e)?this.contents=n:this.contents==null?this.contents=qm(this.schema,Array.from(e),n):Pl(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new mr({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new mr({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{const s=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new bw(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:s,onAnchor:a,reviver:l}={}){const u={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},f=cs(this.contents,n??"",u);if(typeof a=="function")for(const{count:h,res:g}of u.anchors.values())a(g,h);return typeof l=="function"?Gl(l,{"":f},"",f):f}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){const n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return TW(this,e)}};function Pl(t){if(bn(t))return!0;throw new Error("Expected a YAML collection as document contents")}class oM extends Error{constructor(e,n,r,s){super(),this.name=e,this.code=r,this.message=s,this.pos=n}}class ad extends oM{constructor(e,n,r){super("YAMLParseError",e,n,r)}}class AW extends oM{constructor(e,n,r){super("YAMLWarning",e,n,r)}}const jC=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(u=>e.linePos(u));const{line:r,col:s}=n.linePos[0];n.message+=` at line ${r}, column ${s}`;let a=s-1,l=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(a>=60&&l.length>80){const u=Math.min(a-39,l.length-79);l="โฆ"+l.substring(u),a-=u-1}if(l.length>80&&(l=l.substring(0,79)+"โฆ"),r>1&&/^ *$/.test(l.substring(0,a))){let u=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);u.length>80&&(u=u.substring(0,79)+`โฆ
|
|
605
|
-
`),l=u+l}if(/[^ ]/.test(l)){let u=1;const f=n.linePos[1];f&&f.line===r&&f.col>s&&(u=Math.max(1,Math.min(f.col-s,80-a)));const h=" ".repeat(a)+"^".repeat(u);n.message+=`:
|
|
606
|
-
|
|
607
|
-
${l}
|
|
608
|
-
${h}
|
|
609
|
-
`}};function _c(t,{flow:e,indicator:n,next:r,offset:s,onError:a,parentIndent:l,startOnNewline:u}){let f=!1,h=u,g=u,p="",x="",y=!1,k=!1,w=null,S=null,N=null,C=null,j=null,A=null,I=null;for(const R of t)switch(k&&(R.type!=="space"&&R.type!=="newline"&&R.type!=="comma"&&a(R.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),k=!1),w&&(h&&R.type!=="comment"&&R.type!=="newline"&&a(w,"TAB_AS_INDENT","Tabs are not allowed as indentation"),w=null),R.type){case"space":!e&&(n!=="doc-start"||(r==null?void 0:r.type)!=="flow-collection")&&R.source.includes(" ")&&(w=R),g=!0;break;case"comment":{g||a(R,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const z=R.source.substring(1)||" ";p?p+=x+z:p=z,x="",h=!1;break}case"newline":h?p?p+=R.source:(!A||n!=="seq-item-ind")&&(f=!0):x+=R.source,h=!0,y=!0,(S||N)&&(C=R),g=!0;break;case"anchor":S&&a(R,"MULTIPLE_ANCHORS","A node can have at most one anchor"),R.source.endsWith(":")&&a(R.offset+R.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),S=R,I??(I=R.offset),h=!1,g=!1,k=!0;break;case"tag":{N&&a(R,"MULTIPLE_TAGS","A node can have at most one tag"),N=R,I??(I=R.offset),h=!1,g=!1,k=!0;break}case n:(S||N)&&a(R,"BAD_PROP_ORDER",`Anchors and tags must be after the ${R.source} indicator`),A&&a(R,"UNEXPECTED_TOKEN",`Unexpected ${R.source} in ${e??"collection"}`),A=R,h=n==="seq-item-ind"||n==="explicit-key-ind",g=!1;break;case"comma":if(e){j&&a(R,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),j=R,h=!1,g=!1;break}default:a(R,"UNEXPECTED_TOKEN",`Unexpected ${R.type} token`),h=!1,g=!1}const T=t[t.length-1],E=T?T.offset+T.source.length:s;return k&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&a(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),w&&(h&&w.indent<=l||(r==null?void 0:r.type)==="block-map"||(r==null?void 0:r.type)==="block-seq")&&a(w,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:j,found:A,spaceBefore:f,comment:p,hasNewline:y,anchor:S,tag:N,newlineAfterProp:C,end:E,start:I??E}}function Md(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
610
|
-
`))return!0;if(t.end){for(const e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(const e of t.items){for(const n of e.start)if(n.type==="newline")return!0;if(e.sep){for(const n of e.sep)if(n.type==="newline")return!0}if(Md(e.key)||Md(e.value))return!0}return!1;default:return!0}}function Pb(t,e,n){if((e==null?void 0:e.type)==="flow-collection"){const r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&Md(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function lM(t,e,n){const{uniqueKeys:r}=t.options;if(r===!1)return!1;const s=typeof r=="function"?r:(a,l)=>a===l||Jt(a)&&Jt(l)&&a.value===l.value;return e.some(a=>s(a.key,n))}const NC="All mapping items must start at the same column";function OW({composeNode:t,composeEmptyNode:e},n,r,s,a){var g;const l=(a==null?void 0:a.nodeClass)??is,u=new l(n.schema);n.atRoot&&(n.atRoot=!1);let f=r.offset,h=null;for(const p of r.items){const{start:x,key:y,sep:k,value:w}=p,S=_c(x,{indicator:"explicit-key-ind",next:y??(k==null?void 0:k[0]),offset:f,onError:s,parentIndent:r.indent,startOnNewline:!0}),N=!S.found;if(N){if(y&&(y.type==="block-seq"?s(f,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in y&&y.indent!==r.indent&&s(f,"BAD_INDENT",NC)),!S.anchor&&!S.tag&&!k){h=S.end,S.comment&&(u.comment?u.comment+=`
|
|
611
|
-
`+S.comment:u.comment=S.comment);continue}(S.newlineAfterProp||Md(y))&&s(y??x[x.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((g=S.found)==null?void 0:g.indent)!==r.indent&&s(f,"BAD_INDENT",NC);n.atKey=!0;const C=S.end,j=y?t(n,y,S,s):e(n,C,x,null,S,s);n.schema.compat&&Pb(r.indent,y,s),n.atKey=!1,lM(n,u.items,j)&&s(C,"DUPLICATE_KEY","Map keys must be unique");const A=_c(k??[],{indicator:"map-value-ind",next:w,offset:j.range[2],onError:s,parentIndent:r.indent,startOnNewline:!y||y.type==="block-scalar"});if(f=A.end,A.found){N&&((w==null?void 0:w.type)==="block-map"&&!A.hasNewline&&s(f,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&S.start<A.found.offset-1024&&s(j.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const I=w?t(n,w,A,s):e(n,f,k,null,A,s);n.schema.compat&&Pb(r.indent,w,s),f=I.range[2];const T=new gr(j,I);n.options.keepSourceTokens&&(T.srcToken=p),u.items.push(T)}else{N&&s(j.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),A.comment&&(j.comment?j.comment+=`
|
|
612
|
-
`+A.comment:j.comment=A.comment);const I=new gr(j);n.options.keepSourceTokens&&(I.srcToken=p),u.items.push(I)}}return h&&h<f&&s(h,"IMPOSSIBLE","Map comment with trailing content"),u.range=[r.offset,f,h??f],u}function RW({composeNode:t,composeEmptyNode:e},n,r,s,a){const l=(a==null?void 0:a.nodeClass)??Ho,u=new l(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=r.offset,h=null;for(const{start:g,value:p}of r.items){const x=_c(g,{indicator:"seq-item-ind",next:p,offset:f,onError:s,parentIndent:r.indent,startOnNewline:!0});if(!x.found)if(x.anchor||x.tag||p)p&&p.type==="block-seq"?s(x.end,"BAD_INDENT","All sequence items must start at the same column"):s(f,"MISSING_CHAR","Sequence item without - indicator");else{h=x.end,x.comment&&(u.comment=x.comment);continue}const y=p?t(n,p,x,s):e(n,x.end,g,null,x,s);n.schema.compat&&Pb(r.indent,p,s),f=y.range[2],u.items.push(y)}return u.range=[r.offset,f,h??f],u}function Xd(t,e,n,r){let s="";if(t){let a=!1,l="";for(const u of t){const{source:f,type:h}=u;switch(h){case"space":a=!0;break;case"comment":{n&&!a&&r(u,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const g=f.substring(1)||" ";s?s+=l+g:s=g,l="";break}case"newline":s&&(l+=f),a=!0;break;default:r(u,"UNEXPECTED_TOKEN",`Unexpected ${h} at node end`)}e+=f.length}}return{comment:s,offset:e}}const ly="Block collections are not allowed within flow collections",cy=t=>t&&(t.type==="block-map"||t.type==="block-seq");function MW({composeNode:t,composeEmptyNode:e},n,r,s,a){const l=r.start.source==="{",u=l?"flow map":"flow sequence",f=(a==null?void 0:a.nodeClass)??(l?is:Ho),h=new f(n.schema);h.flow=!0;const g=n.atRoot;g&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let p=r.offset+r.start.source.length;for(let S=0;S<r.items.length;++S){const N=r.items[S],{start:C,key:j,sep:A,value:I}=N,T=_c(C,{flow:u,indicator:"explicit-key-ind",next:j??(A==null?void 0:A[0]),offset:p,onError:s,parentIndent:r.indent,startOnNewline:!1});if(!T.found){if(!T.anchor&&!T.tag&&!A&&!I){S===0&&T.comma?s(T.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${u}`):S<r.items.length-1&&s(T.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${u}`),T.comment&&(h.comment?h.comment+=`
|
|
613
|
-
`+T.comment:h.comment=T.comment),p=T.end;continue}!l&&n.options.strict&&Md(j)&&s(j,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(S===0)T.comma&&s(T.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${u}`);else if(T.comma||s(T.start,"MISSING_CHAR",`Missing , between ${u} items`),T.comment){let E="";e:for(const R of C)switch(R.type){case"comma":case"space":break;case"comment":E=R.source.substring(1);break e;default:break e}if(E){let R=h.items[h.items.length-1];_n(R)&&(R=R.value??R.key),R.comment?R.comment+=`
|
|
614
|
-
`+E:R.comment=E,T.comment=T.comment.substring(E.length+1)}}if(!l&&!A&&!T.found){const E=I?t(n,I,T,s):e(n,T.end,A,null,T,s);h.items.push(E),p=E.range[2],cy(I)&&s(E.range,"BLOCK_IN_FLOW",ly)}else{n.atKey=!0;const E=T.end,R=j?t(n,j,T,s):e(n,E,C,null,T,s);cy(j)&&s(R.range,"BLOCK_IN_FLOW",ly),n.atKey=!1;const z=_c(A??[],{flow:u,indicator:"map-value-ind",next:I,offset:R.range[2],onError:s,parentIndent:r.indent,startOnNewline:!1});if(z.found){if(!l&&!T.found&&n.options.strict){if(A)for(const q of A){if(q===z.found)break;if(q.type==="newline"){s(q,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}T.start<z.found.offset-1024&&s(z.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else I&&("source"in I&&I.source&&I.source[0]===":"?s(I,"MISSING_CHAR",`Missing space after : in ${u}`):s(z.start,"MISSING_CHAR",`Missing , or : between ${u} items`));const D=I?t(n,I,z,s):z.found?e(n,z.end,A,null,z,s):null;D?cy(I)&&s(D.range,"BLOCK_IN_FLOW",ly):z.comment&&(R.comment?R.comment+=`
|
|
615
|
-
`+z.comment:R.comment=z.comment);const B=new gr(R,D);if(n.options.keepSourceTokens&&(B.srcToken=N),l){const q=h;lM(n,q.items,R)&&s(E,"DUPLICATE_KEY","Map keys must be unique"),q.items.push(B)}else{const q=new is(n.schema);q.flow=!0,q.items.push(B);const K=(D??R).range;q.range=[R.range[0],K[1],K[2]],h.items.push(q)}p=D?D.range[2]:z.end}}const x=l?"}":"]",[y,...k]=r.end;let w=p;if(y&&y.source===x)w=y.offset+y.source.length;else{const S=u[0].toUpperCase()+u.substring(1),N=g?`${S} must end with a ${x}`:`${S} in block collection must be sufficiently indented and end with a ${x}`;s(p,g?"MISSING_CHAR":"BAD_INDENT",N),y&&y.source.length!==1&&k.unshift(y)}if(k.length>0){const S=Xd(k,w,n.options.strict,s);S.comment&&(h.comment?h.comment+=`
|
|
616
|
-
`+S.comment:h.comment=S.comment),h.range=[r.offset,w,S.offset]}else h.range=[r.offset,w,w];return h}function uy(t,e,n,r,s,a){const l=n.type==="block-map"?OW(t,e,n,r,a):n.type==="block-seq"?RW(t,e,n,r,a):MW(t,e,n,r,a),u=l.constructor;return s==="!"||s===u.tagName?(l.tag=u.tagName,l):(s&&(l.tag=s),l)}function DW(t,e,n,r,s){var x;const a=r.tag,l=a?e.directives.tagName(a.source,y=>s(a,"TAG_RESOLVE_FAILED",y)):null;if(n.type==="block-seq"){const{anchor:y,newlineAfterProp:k}=r,w=y&&a?y.offset>a.offset?y:a:y??a;w&&(!k||k.offset<w.offset)&&s(w,"MISSING_CHAR","Missing newline after block sequence props")}const u=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!a||!l||l==="!"||l===is.tagName&&u==="map"||l===Ho.tagName&&u==="seq")return uy(t,e,n,s,l);let f=e.schema.tags.find(y=>y.tag===l&&y.collection===u);if(!f){const y=e.schema.knownTags[l];if(y&&y.collection===u)e.schema.tags.push(Object.assign({},y,{default:!1})),f=y;else return y?s(a,"BAD_COLLECTION_TYPE",`${y.tag} used for ${u} collection, but expects ${y.collection??"scalar"}`,!0):s(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${l}`,!0),uy(t,e,n,s,l)}const h=uy(t,e,n,s,l,f),g=((x=f.resolve)==null?void 0:x.call(f,h,y=>s(a,"TAG_RESOLVE_FAILED",y),e.options))??h,p=wn(g)?g:new ht(g);return p.range=h.range,p.tag=l,f!=null&&f.format&&(p.format=f.format),p}function IW(t,e,n){const r=e.offset,s=LW(e,t.options.strict,n);if(!s)return{value:"",type:null,comment:"",range:[r,r,r]};const a=s.mode===">"?ht.BLOCK_FOLDED:ht.BLOCK_LITERAL,l=e.source?PW(e.source):[];let u=l.length;for(let w=l.length-1;w>=0;--w){const S=l[w][1];if(S===""||S==="\r")u=w;else break}if(u===0){const w=s.chomp==="+"&&l.length>0?`
|
|
617
|
-
`.repeat(Math.max(1,l.length-1)):"";let S=r+s.length;return e.source&&(S+=e.source.length),{value:w,type:a,comment:s.comment,range:[r,S,S]}}let f=e.indent+s.indent,h=e.offset+s.length,g=0;for(let w=0;w<u;++w){const[S,N]=l[w];if(N===""||N==="\r")s.indent===0&&S.length>f&&(f=S.length);else{S.length<f&&n(h+S.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),s.indent===0&&(f=S.length),g=w,f===0&&!t.atRoot&&n(h,"BAD_INDENT","Block scalar values in collections must be indented");break}h+=S.length+N.length+1}for(let w=l.length-1;w>=u;--w)l[w][0].length>f&&(u=w+1);let p="",x="",y=!1;for(let w=0;w<g;++w)p+=l[w][0].slice(f)+`
|
|
618
|
-
`;for(let w=g;w<u;++w){let[S,N]=l[w];h+=S.length+N.length+1;const C=N[N.length-1]==="\r";if(C&&(N=N.slice(0,-1)),N&&S.length<f){const A=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;n(h-N.length-(C?2:1),"BAD_INDENT",A),S=""}a===ht.BLOCK_LITERAL?(p+=x+S.slice(f)+N,x=`
|
|
619
|
-
`):S.length>f||N[0]===" "?(x===" "?x=`
|
|
620
|
-
`:!y&&x===`
|
|
621
|
-
`&&(x=`
|
|
622
|
-
|
|
623
|
-
`),p+=x+S.slice(f)+N,x=`
|
|
624
|
-
`,y=!0):N===""?x===`
|
|
625
|
-
`?p+=`
|
|
626
|
-
`:x=`
|
|
627
|
-
`:(p+=x+N,x=" ",y=!1)}switch(s.chomp){case"-":break;case"+":for(let w=u;w<l.length;++w)p+=`
|
|
628
|
-
`+l[w][0].slice(f);p[p.length-1]!==`
|
|
629
|
-
`&&(p+=`
|
|
630
|
-
`);break;default:p+=`
|
|
631
|
-
`}const k=r+s.length+e.source.length;return{value:p,type:a,comment:s.comment,range:[r,k,k]}}function LW({offset:t,props:e},n,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:s}=e[0],a=s[0];let l=0,u="",f=-1;for(let x=1;x<s.length;++x){const y=s[x];if(!u&&(y==="-"||y==="+"))u=y;else{const k=Number(y);!l&&k?l=k:f===-1&&(f=t+x)}}f!==-1&&r(f,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let h=!1,g="",p=s.length;for(let x=1;x<e.length;++x){const y=e[x];switch(y.type){case"space":h=!0;case"newline":p+=y.source.length;break;case"comment":n&&!h&&r(y,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),p+=y.source.length,g=y.source.substring(1);break;case"error":r(y,"UNEXPECTED_TOKEN",y.message),p+=y.source.length;break;default:{const k=`Unexpected token in block scalar header: ${y.type}`;r(y,"UNEXPECTED_TOKEN",k);const w=y.source;w&&typeof w=="string"&&(p+=w.length)}}}return{mode:a,indent:l,chomp:u,comment:g,length:p}}function PW(t){const e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),a=[r!=null&&r[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let l=1;l<e.length;l+=2)a.push([e[l],e[l+1]]);return a}function $W(t,e,n){const{offset:r,type:s,source:a,end:l}=t;let u,f;const h=(x,y,k)=>n(r+x,y,k);switch(s){case"scalar":u=ht.PLAIN,f=zW(a,h);break;case"single-quoted-scalar":u=ht.QUOTE_SINGLE,f=FW(a,h);break;case"double-quoted-scalar":u=ht.QUOTE_DOUBLE,f=BW(a,h);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[r,r+a.length,r+a.length]}}const g=r+a.length,p=Xd(l,g,e,n);return{value:f,type:u,comment:p.comment,range:[r,g,p.offset]}}function zW(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),cM(t)}function FW(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),cM(t.slice(1,-1)).replace(/''/g,"'")}function cM(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
632
|
-
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
633
|
-
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(t);if(!r)return t;let s=r[1],a=" ",l=e.lastIndex;for(n.lastIndex=l;r=n.exec(t);)r[1]===""?a===`
|
|
634
|
-
`?s+=a:a=`
|
|
635
|
-
`:(s+=a+r[1],a=" "),l=n.lastIndex;const u=/[ \t]*(.*)/sy;return u.lastIndex=l,r=u.exec(t),s+a+((r==null?void 0:r[1])??"")}function BW(t,e){let n="";for(let r=1;r<t.length-1;++r){const s=t[r];if(!(s==="\r"&&t[r+1]===`
|
|
636
|
-
`))if(s===`
|
|
637
|
-
`){const{fold:a,offset:l}=UW(t,r);n+=a,r=l}else if(s==="\\"){let a=t[++r];const l=qW[a];if(l)n+=l;else if(a===`
|
|
638
|
-
`)for(a=t[r+1];a===" "||a===" ";)a=t[++r+1];else if(a==="\r"&&t[r+1]===`
|
|
639
|
-
`)for(a=t[++r+1];a===" "||a===" ";)a=t[++r+1];else if(a==="x"||a==="u"||a==="U"){const u={x:2,u:4,U:8}[a];n+=HW(t,r+1,u,e),r+=u}else{const u=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${u}`),n+=u}}else if(s===" "||s===" "){const a=r;let l=t[r+1];for(;l===" "||l===" ";)l=t[++r+1];l!==`
|
|
640
|
-
`&&!(l==="\r"&&t[r+2]===`
|
|
641
|
-
`)&&(n+=r>a?t.slice(a,r+1):s)}else n+=s}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function UW(t,e){let n="",r=t[e+1];for(;(r===" "||r===" "||r===`
|
|
642
|
-
`||r==="\r")&&!(r==="\r"&&t[e+2]!==`
|
|
643
|
-
`);)r===`
|
|
644
|
-
`&&(n+=`
|
|
645
|
-
`),e+=1,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}const qW={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
646
|
-
`,r:"\r",t:" ",v:"\v",N:"ย
",_:"ย ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function HW(t,e,n,r){const s=t.substr(e,n),l=s.length===n&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;if(isNaN(l)){const u=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${u}`),u}return String.fromCodePoint(l)}function uM(t,e,n,r){const{value:s,type:a,comment:l,range:u}=e.type==="block-scalar"?IW(t,e,r):$W(e,t.options.strict,r),f=n?t.directives.tagName(n.source,p=>r(n,"TAG_RESOLVE_FAILED",p)):null;let h;t.options.stringKeys&&t.atKey?h=t.schema[ii]:f?h=VW(t.schema,s,f,n,r):e.type==="scalar"?h=KW(t,s,e,r):h=t.schema[ii];let g;try{const p=h.resolve(s,x=>r(n??e,"TAG_RESOLVE_FAILED",x),t.options);g=Jt(p)?p:new ht(p)}catch(p){const x=p instanceof Error?p.message:String(p);r(n??e,"TAG_RESOLVE_FAILED",x),g=new ht(s)}return g.range=u,g.source=s,a&&(g.type=a),f&&(g.tag=f),h.format&&(g.format=h.format),l&&(g.comment=l),g}function VW(t,e,n,r,s){var u;if(n==="!")return t[ii];const a=[];for(const f of t.tags)if(!f.collection&&f.tag===n)if(f.default&&f.test)a.push(f);else return f;for(const f of a)if((u=f.test)!=null&&u.test(e))return f;const l=t.knownTags[n];return l&&!l.collection?(t.tags.push(Object.assign({},l,{default:!1,test:void 0})),l):(s(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[ii])}function KW({atKey:t,directives:e,schema:n},r,s,a){const l=n.tags.find(u=>{var f;return(u.default===!0||t&&u.default==="key")&&((f=u.test)==null?void 0:f.test(r))})||n[ii];if(n.compat){const u=n.compat.find(f=>{var h;return f.default&&((h=f.test)==null?void 0:h.test(r))})??n[ii];if(l.tag!==u.tag){const f=e.tagString(l.tag),h=e.tagString(u.tag),g=`Value may be parsed as either ${f} or ${h}`;a(s,"TAG_RESOLVE_FAILED",g,!0)}}return l}function YW(t,e,n){if(e){n??(n=e.length);for(let r=n-1;r>=0;--r){let s=e[r];switch(s.type){case"space":case"comment":case"newline":t-=s.source.length;continue}for(s=e[++r];(s==null?void 0:s.type)==="space";)t+=s.source.length,s=e[++r];break}}return t}const GW={composeNode:dM,composeEmptyNode:ww};function dM(t,e,n,r){const s=t.atKey,{spaceBefore:a,comment:l,anchor:u,tag:f}=n;let h,g=!0;switch(e.type){case"alias":h=ZW(t,e,r),(u||f)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":h=uM(t,e,f,r),u&&(h.anchor=u.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":h=DW(GW,t,e,n,r),u&&(h.anchor=u.source.substring(1));break;default:{const p=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",p),h=ww(t,e.offset,void 0,null,n,r),g=!1}}return u&&h.anchor===""&&r(u,"BAD_ALIAS","Anchor cannot be an empty string"),s&&t.options.stringKeys&&(!Jt(h)||typeof h.value!="string"||h.tag&&h.tag!=="tag:yaml.org,2002:str")&&r(f??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(h.spaceBefore=!0),l&&(e.type==="scalar"&&e.source===""?h.comment=l:h.commentBefore=l),t.options.keepSourceTokens&&g&&(h.srcToken=e),h}function ww(t,e,n,r,{spaceBefore:s,comment:a,anchor:l,tag:u,end:f},h){const g={type:"scalar",offset:YW(e,n,r),indent:-1,source:""},p=uM(t,g,u,h);return l&&(p.anchor=l.source.substring(1),p.anchor===""&&h(l,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(p.spaceBefore=!0),a&&(p.comment=a,p.range[2]=f),p}function ZW({options:t},{offset:e,source:n,end:r},s){const a=new cw(n.substring(1));a.source===""&&s(e,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&s(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const l=e+n.length,u=Xd(r,l,t.strict,s);return a.range=[e,l,u.offset],u.comment&&(a.comment=u.comment),a}function WW(t,e,{offset:n,start:r,value:s,end:a},l){const u=Object.assign({_directives:e},t),f=new iM(void 0,u),h={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},g=_c(r,{indicator:"doc-start",next:s??(a==null?void 0:a[0]),offset:n,onError:l,parentIndent:0,startOnNewline:!0});g.found&&(f.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!g.hasNewline&&l(g.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),f.contents=s?dM(h,s,g,l):ww(h,g.end,r,null,g,l);const p=f.contents.range[2],x=Xd(a,p,!1,l);return x.comment&&(f.comment=x.comment),f.range=[n,p,x.offset],f}function Gu(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];const{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function CC(t){var s;let e="",n=!1,r=!1;for(let a=0;a<t.length;++a){const l=t[a];switch(l[0]){case"#":e+=(e===""?"":r?`
|
|
647
|
-
|
|
648
|
-
`:`
|
|
649
|
-
`)+(l.substring(1)||" "),n=!0,r=!1;break;case"%":((s=t[a+1])==null?void 0:s[0])!=="#"&&(a+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}class QW{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,s,a)=>{const l=Gu(n);a?this.warnings.push(new AW(l,r,s)):this.errors.push(new ad(l,r,s))},this.directives=new mr({version:e.version||"1.2"}),this.options=e}decorate(e,n){const{comment:r,afterEmptyLine:s}=CC(this.prelude);if(r){const a=e.contents;if(n)e.comment=e.comment?`${e.comment}
|
|
650
|
-
${r}`:r;else if(s||e.directives.docStart||!a)e.commentBefore=r;else if(bn(a)&&!a.flow&&a.items.length>0){let l=a.items[0];_n(l)&&(l=l.key);const u=l.commentBefore;l.commentBefore=u?`${r}
|
|
651
|
-
${u}`:r}else{const l=a.commentBefore;a.commentBefore=l?`${r}
|
|
652
|
-
${l}`:r}}n?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:CC(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,r=-1){for(const s of e)yield*this.next(s);yield*this.end(n,r)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(n,r,s)=>{const a=Gu(e);a[0]+=n,this.onError(a,"BAD_DIRECTIVE",r,s)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const n=WW(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{const n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new ad(Gu(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){const r="Unexpected doc-end without preceding document";this.errors.push(new ad(Gu(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;const n=Xd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const r=this.doc.comment;this.doc.comment=r?`${r}
|
|
653
|
-
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new ad(Gu(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){const r=Object.assign({_directives:this.directives},this.options),s=new iM(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,n,n],this.decorate(s,!1),yield s}}}const fM="\uFEFF",hM="",mM="",$b="";function XW(t){switch(t){case fM:return"byte-order-mark";case hM:return"doc-mode";case mM:return"flow-error-end";case $b:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
654
|
-
`:case`\r
|
|
655
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function ks(t){switch(t){case void 0:case" ":case`
|
|
656
|
-
`:case"\r":case" ":return!0;default:return!1}}const EC=new Set("0123456789ABCDEFabcdef"),JW=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Fh=new Set(",[]{}"),eQ=new Set(` ,[]{}
|
|
657
|
-
\r `),dy=t=>!t||eQ.has(t);class tQ{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
|
|
658
|
-
`?!0:n==="\r"?this.buffer[e+1]===`
|
|
659
|
-
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+e];if(n==="\r"){const s=this.buffer[r+e+1];if(s===`
|
|
660
|
-
`||!s&&!this.atEnd)return e+r+1}return n===`
|
|
661
|
-
`||r>=this.indentNext||!n&&!this.atEnd?e+r:-1}if(n==="-"||n==="."){const r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&ks(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
662
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===fM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,r=e.indexOf("#");for(;r!==-1;){const a=e[r-1];if(a===" "||a===" "){n=r-1;break}else r=e.indexOf("#",r+1)}for(;;){const a=e[n-1];if(a===" "||a===" ")n-=1;else break}const s=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-s),this.pushNewline(),"stream"}if(this.atLineEnd()){const n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield hM,yield*this.parseLineStart()}*parseLineStart(){const e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");const n=this.peek(3);if((n==="---"||n==="...")&&ks(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ks(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ks(n)){const r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(dy),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);const s=this.getLine();if(s===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&s[0]!=="#"||r===0&&(s.startsWith("---")||s.startsWith("..."))&&ks(s[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(s[0]==="]"||s[0]==="}")))return this.flowLevel=0,yield mM,yield*this.parseLineStart();let a=0;for(;s[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),s[a]){case void 0:return"flow";case"#":return yield*this.pushCount(s.length-a),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(dy),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const l=this.charAt(1);if(this.flowKey||ks(l)||l===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const e=this.charAt(0);let n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let a=0;for(;this.buffer[n-1-a]==="\\";)a+=1;if(a%2===0)break;n=this.buffer.indexOf('"',n+1)}const r=this.buffer.substring(0,n);let s=r.indexOf(`
|
|
663
|
-
`,this.pos);if(s!==-1){for(;s!==-1;){const a=this.continueScalar(s+1);if(a===-1)break;s=r.indexOf(`
|
|
664
|
-
`,a)}s!==-1&&(n=s-(r[s-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){const n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>ks(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,r;e:for(let a=this.pos;r=this.buffer[a];++a)switch(r){case" ":n+=1;break;case`
|
|
665
|
-
`:e=a,n=0;break;case"\r":{const l=this.buffer[a+1];if(!l&&!this.atEnd)return this.setNext("block-scalar");if(l===`
|
|
666
|
-
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const a=this.continueScalar(e+1);if(a===-1)break;e=this.buffer.indexOf(`
|
|
667
|
-
`,a)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let s=e+1;for(r=this.buffer[s];r===" ";)r=this.buffer[++s];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
|
|
668
|
-
`;)r=this.buffer[++s];e=s-1}else if(!this.blockScalarKeep)do{let a=e-1,l=this.buffer[a];l==="\r"&&(l=this.buffer[--a]);const u=a;for(;l===" ";)l=this.buffer[--a];if(l===`
|
|
669
|
-
`&&a>=this.pos&&a+1+n>u)e=a;else break}while(!0);return yield $b,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let n=this.pos-1,r=this.pos-1,s;for(;s=this.buffer[++r];)if(s===":"){const a=this.buffer[r+1];if(ks(a)||e&&Fh.has(a))break;n=r}else if(ks(s)){let a=this.buffer[r+1];if(s==="\r"&&(a===`
|
|
670
|
-
`?(r+=1,s=`
|
|
671
|
-
`,a=this.buffer[r+1]):n=r),a==="#"||e&&Fh.has(a))break;if(s===`
|
|
672
|
-
`){const l=this.continueScalar(r+1);if(l===-1)break;r=Math.max(r,l-2)}}else{if(e&&Fh.has(s))break;n=r}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield $b,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){const r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(dy))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,n=this.charAt(1);if(ks(n)||e&&Fh.has(n))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!ks(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(JW.has(n))n=this.buffer[++e];else if(n==="%"&&EC.has(this.buffer[e+1])&&EC.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return e===`
|
|
673
|
-
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
674
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");const s=n-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=n),s}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class nQ{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,r=this.lineStarts.length;for(;n<r;){const a=n+r>>1;this.lineStarts[a]<e?n=a+1:r=a}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};const s=this.lineStarts[n-1];return{line:n,col:e-s+1}}}}function Aa(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function TC(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function pM(t){switch(t==null?void 0:t.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Bh(t){switch(t.type){case"document":return t.start;case"block-map":{const e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function $l(t){var n;if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((n=t[++e])==null?void 0:n.type)==="space";);return t.splice(e,t.length)}function AC(t){if(t.start.type==="flow-seq-start")for(const e of t.items)e.sep&&!e.value&&!Aa(e.start,"explicit-key-ind")&&!Aa(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,pM(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}class rQ{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new tQ,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const r of this.lexer.lex(e,n))yield*this.next(r);n||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}const n=XW(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{const r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){const n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&AC(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{const s=r.items[r.items.length-1];if(s.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=n;else{Object.assign(s,{key:n,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{const s=r.items[r.items.length-1];s.value?r.items.push({start:[],value:n}):s.value=n;break}case"flow-collection":{const s=r.items[r.items.length-1];!s||s.value?r.items.push({start:[],key:n,sep:[]}):s.sep?s.value=n:Object.assign(s,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const s=n.items[n.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&TC(s.start)===-1&&(n.indent===0||s.start.every(a=>a.type!=="comment"||a.indent<n.indent))&&(r.type==="document"?r.end=s.start:r.items.push({start:s.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{const e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{TC(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}const n=this.startBlockValue(e);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){const n=Bh(this.peek(2)),r=$l(n);let s;e.end?(s=e.end,s.push(this.sourceToken),delete e.end):s=[this.sourceToken];const a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
|
|
675
|
-
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
676
|
-
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){var r;const n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){const s="end"in n.value?n.value.end:void 0,a=Array.isArray(s)?s[s.length-1]:void 0;(a==null?void 0:a.type)==="comment"?s==null||s.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){const s=e.items[e.items.length-2],a=(r=s==null?void 0:s.value)==null?void 0:r.end;if(Array.isArray(a)){Array.prototype.push.apply(a,n.start),a.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const s=!this.onKeyLine&&this.indent===e.indent,a=s&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let l=[];if(a&&n.sep&&!n.value){const u=[];for(let f=0;f<n.sep.length;++f){const h=n.sep[f];switch(h.type){case"newline":u.push(f);break;case"space":break;case"comment":h.indent>e.indent&&(u.length=0);break;default:u.length=0}}u.length>=2&&(l=n.sep.splice(u[1]))}switch(this.type){case"anchor":case"tag":a||n.value?(l.push(this.sourceToken),e.items.push({start:l}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):a||n.value?(l.push(this.sourceToken),e.items.push({start:l,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Aa(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]});else if(pM(n.key)&&!Aa(n.sep,"newline")){const u=$l(n.start),f=n.key,h=n.sep;h.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:u,key:f,sep:h}]})}else l.length>0?n.sep=n.sep.concat(l,this.sourceToken):n.sep.push(this.sourceToken);else if(Aa(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const u=$l(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:u,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||a?e.items.push({start:l,key:null,sep:[this.sourceToken]}):Aa(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const u=this.flowScalar(this.type);a||n.value?(e.items.push({start:l,key:u,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(u):(Object.assign(n,{key:u,sep:[]}),this.onKeyLine=!0);return}default:{const u=this.startBlockValue(e);if(u){if(u.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Aa(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else s&&e.items.push({start:l});this.stack.push(u);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){var r;const n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){const s="end"in n.value?n.value.end:void 0,a=Array.isArray(s)?s[s.length-1]:void 0;(a==null?void 0:a.type)==="comment"?s==null||s.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){const s=e.items[e.items.length-2],a=(r=s==null?void 0:s.value)==null?void 0:r.end;if(Array.isArray(a)){Array.prototype.push.apply(a,n.start),a.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||Aa(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){const s=this.startBlockValue(e);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r&&r.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const s=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:s,sep:[]}):n.sep?this.stack.push(s):Object.assign(n,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{const r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){const s=Bh(r),a=$l(s);AC(e);const l=e.end.splice(1,e.end.length);l.push(this.sourceToken);const u={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:a,key:e,sep:l}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=u}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
|
|
677
|
-
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
678
|
-
`,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=Bh(e),r=$l(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=Bh(e),r=$l(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function sQ(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new nQ||null,prettyErrors:e}}function iQ(t,e={}){const{lineCounter:n,prettyErrors:r}=sQ(e),s=new rQ(n==null?void 0:n.addNewLine),a=new QW(e);let l=null;for(const u of a.compose(s.parse(t),!0,t.length))if(!l)l=u;else if(l.options.logLevel!=="silent"){l.errors.push(new ad(u.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(l.errors.forEach(jC(t,n)),l.warnings.forEach(jC(t,n))),l}function aQ({isOpen:t,onClose:e,variant:n="overlay"}){const{data:r,isLoading:s,error:a,refetch:l}=RG(t),u=MG(),f=DG(),[h,g]=_.useState(""),[p,x]=_.useState(""),[y,k]=_.useState(null),[w,S]=_.useState(null),[N,C]=_.useState(null),[j,A]=_.useState(""),[I,T]=_.useState("yaml"),[E,R]=_.useState(null),[z,D]=_.useState(!0),[B,q]=_.useState([]),[K,G]=_.useState([]),[F,M]=_.useState(!1),[V,U]=_.useState(!1),[H,L]=_.useState(!1),[ne,ie]=_.useState(""),[P]=wR(h,500),pe=_.useRef(0),Pe=_.useCallback(async be=>{const Se=pe.current+1;pe.current=Se;try{const ot=await u.mutateAsync({yaml:be});pe.current===Se&&(D(ot.valid),q(ot.errors||[]),G(ot.warnings||[]))}catch(ot){console.warn(`Validation error: ${ot instanceof Error?ot.message:String(ot)}`),pe.current===Se&&(D(!1),q([{message:"Failed to validate configuration",code:"VALIDATION_ERROR"}]))}},[u.mutateAsync]);_.useEffect(()=>{if(r&&t){g(r.yaml),x(r.yaml),A(r.relativePath),M(!1);const{config:be,document:Se}=Ne(r.yaml);be&&Se&&(k(be),S(be),C(Se)),Pe(r.yaml)}},[r,t,Pe]);const Ne=be=>{console.log("[parseYamlToConfig] Starting parse");try{const Se=iQ(be);if(console.log("[parseYamlToConfig] Document created:",Se),Se.errors&&Se.errors.length>0)return console.debug("[parseYamlToConfig] Parse errors:",Se.errors),{config:null,document:null,error:Se.errors.map(J=>J.message).join("; ")};const ot=Se.toJS();return console.log("[parseYamlToConfig] Config parsed successfully:",ot),{config:ot,document:Se,error:null}}catch(Se){return console.debug("[parseYamlToConfig] Exception:",Se),{config:null,document:null,error:Se instanceof Error?Se.message:"Failed to parse YAML"}}},ge=(be,Se)=>{console.log("[updateYamlDocumentFromConfig] Starting update"),console.log("[updateYamlDocumentFromConfig] Document:",be),console.log("[updateYamlDocumentFromConfig] Config:",Se);const ot=(dt,J)=>{if(J==null||Array.isArray(J))return be.createNode(J);if(typeof J=="object"&&!Array.isArray(J)){if(!dt||!dt.items)return be.createNode(J);const me=new Set;for(const Ae of dt.items){const He=Ae.key.value;me.add(He),He in J&&(Ae.value=ot(Ae.value,J[He]))}for(const[Ae,He]of Object.entries(J))me.has(Ae)||dt.items.push(be.createPair(Ae,He));return dt.items=dt.items.filter(Ae=>Ae.key.value in J),dt}return be.createNode(J)};try{return be.contents=ot(be.contents,Se),console.log("[updateYamlDocumentFromConfig] Update successful"),be}catch(dt){throw console.error("[updateYamlDocumentFromConfig] Update failed:",dt),dt}},Fe=be=>{const Se=dt=>!!(dt==null||dt===""||Array.isArray(dt)&&dt.length===0||typeof dt=="object"&&dt!==null&&Object.prototype.toString.call(dt)==="[object Object]"&&Object.keys(dt).length===0),ot=dt=>{if(Array.isArray(dt))return dt.map(ot).filter(J=>!Se(J));if(typeof dt=="object"&&dt!==null){const J={};for(const[me,Ae]of Object.entries(dt))if(!Se(Ae))if(typeof Ae=="object"&&Ae!==null){const He=ot(Ae);Se(He)||(J[me]=He)}else J[me]=Ae;return J}return dt};return ot(be)},Qe=(be,Se)=>{console.log("[serializeConfigToYaml] Starting serialization"),console.log("[serializeConfigToYaml] Document:",Se),console.log("[serializeConfigToYaml] Config:",be);const ot=Fe(be);console.log("[serializeConfigToYaml] Cleaned config:",ot);const J=ge(Se,ot).toString();return console.log("[serializeConfigToYaml] Serialized result length:",J.length),J},$e=(be,Se)=>be===Se?!0:!be||!Se?!1:JSON.stringify(be)===JSON.stringify(Se),Q=be=>{g(be),M(be!==p),L(!1);const{config:Se,document:ot}=Ne(be);Se&&ot&&(k(Se),C(ot))},_e=be=>{if(console.log("[handleFormChange] Called with new config"),console.log("[handleFormChange] yamlDocument exists?",!!N),!N){console.error("[handleFormChange] No document available - this should not happen!");return}k(be);const Se=Qe(be,N);g(Se),M(!$e(be,w)),L(!1)},Oe=be=>{if(console.log("[handleModeSwitch] Called with newMode:",be,"current mode:",I),be===I){console.log("[handleModeSwitch] Same mode, returning");return}if(be==="form"){console.log("[handleModeSwitch] Switching to form mode, parsing YAML...");const{config:Se,document:ot,error:dt}=Ne(h);if(console.log("[handleModeSwitch] Parse result:",{config:Se,document:ot,error:dt}),dt){console.error("[handleModeSwitch] Parse error, not switching:",dt),R(dt);return}console.log("[handleModeSwitch] Parse successful, setting state"),k(Se),C(ot),R(null)}console.log("[handleModeSwitch] Setting editor mode to:",be),T(be)},le=_.useCallback(async()=>{if(!(!z||B.length>0)){L(!1),ie("");try{const be=await f.mutateAsync({yaml:h});x(h),M(!1),L(!0),be.restarted?ie(`Configuration applied successfully โ ${be.changesApplied.join(", ")} updated`):ie("Configuration saved successfully (no changes detected)"),setTimeout(()=>{L(!1),ie("")},5e3)}catch(be){const Se=be instanceof Error?be.message:String(be);console.error(`Error saving agent config: ${Se}`)}}},[z,B,f,h]),he=()=>{F?U(!0):l()},Ee=_.useCallback(()=>{F?U(!0):e()},[F,e]),De=()=>{U(!1),g(p),M(!1),l()};if(_.useEffect(()=>{t&&Pe(P)},[P,t,Pe]),_.useEffect(()=>{if(!t)return;const be=Se=>{(Se.metaKey||Se.ctrlKey)&&Se.key==="s"&&(Se.preventDefault(),!f.isPending&&z&&le()),Se.key==="Escape"&&(Se.preventDefault(),Ee())};return window.addEventListener("keydown",be),()=>window.removeEventListener("keydown",be)},[t,f.isPending,z,F,le,Ee]),!t)return null;const ue=(()=>{if(f.isPending)return null;if(!F)return"No changes to save";if(B.length>0){const be=B[0];return be.path?`Configuration error in ${be.path}: ${be.message}`:`Configuration error: ${be.message}`}return z?null:"Configuration has validation errors"})(),Ce=!F||f.isPending||!z||B.length>0,ze=c.jsxs("div",{className:"flex flex-col h-full bg-background",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[c.jsx("div",{className:"flex items-center gap-3",children:c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("h2",{className:"text-lg font-semibold",children:"Customize Agent"}),c.jsxs("a",{href:"https://docs.dexto.ai/docs/guides/configuring-dexto/overview",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",title:"View configuration documentation",children:["View docs",c.jsx(sb,{className:"h-3 w-3"})]})]}),j&&c.jsx("p",{className:"text-xs text-muted-foreground",children:j})]})}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("div",{className:"flex items-center gap-1 bg-muted/50 rounded-md p-1",children:[c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(ye,{variant:I==="yaml"?"default":"ghost",size:"sm",onClick:()=>Oe("yaml"),className:"h-7 px-3",children:"YAML Editor"})}),c.jsx(Lt,{children:"Edit configuration in raw YAML format with full control"})]}),c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(ye,{variant:I==="form"?"default":"ghost",size:"sm",onClick:()=>Oe("form"),className:"h-7 px-3",children:"Form Editor"})}),c.jsx(Lt,{children:"Edit configuration using user-friendly forms"})]})]}),c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"sm",onClick:he,disabled:s,children:c.jsx(hr,{className:ae("h-4 w-4",s&&"animate-spin")})})}),c.jsx(Lt,{children:"Reload configuration"})]}),c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"sm",onClick:Ee,children:c.jsx(Er,{className:"h-4 w-4"})})}),c.jsx(Lt,{children:"Close (Esc)"})]})]})]}),c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:a?c.jsx("div",{className:"flex items-center justify-center h-full p-4",children:c.jsxs("div",{className:"text-center max-w-md",children:[c.jsx(Ln,{className:"h-12 w-12 text-destructive mx-auto mb-4"}),c.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Failed to load configuration"}),c.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:(a==null?void 0:a.message)||"Unknown error"}),c.jsxs(ye,{onClick:()=>l(),variant:"outline",children:[c.jsx(hr,{className:"h-4 w-4 mr-2"}),"Retry"]})]})}):s?c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsxs("div",{className:"text-center",children:[c.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading configuration..."})]})}):E&&I==="form"?c.jsx("div",{className:"flex items-center justify-center h-full p-4",children:c.jsxs("div",{className:"text-center max-w-md",children:[c.jsx(Ln,{className:"h-12 w-12 text-destructive mx-auto mb-4"}),c.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Cannot parse YAML"}),c.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:E}),c.jsx(ye,{onClick:()=>T("yaml"),variant:"outline",children:"Switch to YAML Editor"})]})}):I==="yaml"?c.jsx(qZ,{value:h,onChange:Q,isValidating:u.isPending,isValid:z,errors:B,warnings:K,hasUnsavedChanges:F}):y?c.jsx(ZZ,{config:y,onChange:_e,errors:B.reduce((be,Se)=>(Se.path&&(be[Se.path]=Se.message),be),{})}):null}),!a&&!s&&c.jsxs("div",{className:"flex flex-col border-t border-border",children:[(H||f.error)&&c.jsxs("div",{className:"px-4 py-3 bg-muted/50 border-b border-border",children:[H&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-500",children:[c.jsx(Ts,{className:"h-4 w-4"}),c.jsx("span",{children:ne})]}),f.error&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[c.jsx(Ln,{className:"h-4 w-4"}),c.jsx("span",{children:f.error.message})]})]}),c.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[c.jsx("div",{}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(ye,{variant:"outline",size:"sm",onClick:Ee,children:"Close"}),c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx("div",{children:c.jsx(ye,{variant:"default",size:"sm",onClick:le,disabled:Ce,children:f.isPending?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-background border-t-transparent mr-2"}),"Saving..."]}):c.jsxs(c.Fragment,{children:[c.jsx(gz,{className:"h-4 w-4 mr-2"}),"Save"]})})})}),c.jsx(Lt,{children:ue||"Save configuration (โS)"})]})]})]})]}),c.jsx(rr,{open:V,onOpenChange:U,children:c.jsxs(sr,{children:[c.jsxs(ir,{children:[c.jsx(ar,{children:"Unsaved Changes"}),c.jsx(Yr,{children:"You have unsaved changes. Do you want to discard them?"})]}),c.jsxs(Kr,{children:[c.jsx(ye,{variant:"outline",onClick:()=>U(!1),children:"Cancel"}),c.jsx(ye,{variant:"destructive",onClick:De,children:"Discard Changes"})]})]})})]});return n==="inline"?ze:c.jsx("div",{className:ae("fixed inset-y-0 right-0 z-50 w-full sm:w-[600px] md:w-[700px] lg:w-[800px] border-l border-border bg-background shadow-2xl transform transition-transform duration-300",t?"translate-x-0":"translate-x-full"),children:ze})}function oQ(){const{theme:t,toggleTheme:e}=jE(),[n,r]=_.useState(!1);_.useEffect(()=>{r(!0)},[]);const s=t==="dark";return n?c.jsx(Os,{children:c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(G0,{checked:s,onCheckedChange:e,className:"w-12 h-6 bg-gray-300 dark:bg-gray-700 rounded-full relative transition-colors flex items-center px-0.5","aria-label":"Toggle theme",children:c.jsx(sO,{className:`
|
|
679
|
-
w-5 h-5 rounded-full shadow flex items-center justify-center
|
|
680
|
-
transition-transform transform
|
|
681
|
-
translate-x-0.5 data-[state=checked]:translate-x-[1.375rem]
|
|
682
|
-
bg-white dark:bg-gray-100
|
|
683
|
-
`,children:s?c.jsx(iz,{className:"w-3.5 h-3.5 text-gray-700"}):c.jsx(Ez,{className:"w-3.5 h-3.5 text-yellow-500"})})})}),c.jsx(Lt,{children:s?"Switch to light mode":"Switch to dark mode"})]})}):c.jsx("div",{className:"w-12 h-6 bg-gray-300 dark:bg-gray-700 rounded-full"})}function lQ({onClick:t,className:e,variant:n="outline",side:r="bottom"}){return c.jsx(Os,{children:c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(ye,{variant:n,size:"sm",onClick:t,className:["h-8 w-8 p-0",e].filter(Boolean).join(" "),"aria-label":"New chat",children:c.jsx(us,{className:"h-4 w-4"})})}),c.jsx(Lt,{side:r,children:"New Chat (โK)"})]})})}function cQ({active:t=!1}){const{voices:e,selected:n,setSelected:r}=a8(),[s,a]=_.useState(!1);_.useEffect(()=>{if(!t){a(!1);return}const u=window.requestIdleCallback?window.requestIdleCallback(()=>a(!0)):setTimeout(()=>a(!0),0);return()=>{window.cancelIdleCallback&&typeof u=="number"?window.cancelIdleCallback(u):clearTimeout(u)}},[t]);const l=u=>{r(u==="auto"?null:u)};return t?c.jsxs(rw,{value:n??"auto",onValueChange:l,children:[c.jsx(iw,{className:"h-8 w-[12rem] text-xs",children:c.jsx(sw,{placeholder:"Voice"})}),c.jsxs(aw,{children:[c.jsx(ac,{value:"auto",children:"Auto (best available)"}),s&&e.map(u=>c.jsxs(ac,{value:u.name,children:[u.name," (",u.lang,")"]},`${u.name}-${u.lang}`))]})]}):null}function uQ({isOpen:t,onClose:e}){return c.jsx(rr,{open:t,onOpenChange:n=>!n&&e(),children:c.jsxs(sr,{className:"sm:max-w-lg",children:[c.jsxs(ir,{children:[c.jsx(ar,{children:"Settings"}),c.jsx(Yr,{children:"Configure preferences for speech and more."})]}),c.jsx("div",{className:"space-y-6 py-2",children:c.jsxs("section",{className:"space-y-2",children:[c.jsx(Qt,{className:"text-xs uppercase text-muted-foreground",children:"Voice"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose a preferred text-to-speech voice. โAutoโ selects the best available voice on your device."}),c.jsx(cQ,{active:t})]})})]})})}function dQ(){return Tr({queryKey:Xe.agents.all,queryFn:async()=>{const t=await mt.api.agents.$get();if(!t.ok)throw new Error(`Failed to fetch agents: ${t.status}`);return await t.json()},staleTime:300*1e3})}function fQ(){return Tr({queryKey:Xe.agents.path,queryFn:async()=>{const t=await mt.api.agent.path.$get();if(!t.ok)throw new Error(`Failed to fetch agent path: ${t.status}`);return await t.json()},retry:!1,staleTime:300*1e3})}function hQ(){const t=An();return On({mutationFn:async e=>{const n=await mt.api.agents.switch.$post({json:e});if(!n.ok)throw new Error(`Failed to switch agent: ${n.status}`);return await n.json()},onSuccess:()=>{t.invalidateQueries({queryKey:Xe.agents.all}),t.invalidateQueries({queryKey:Xe.agents.path})}})}function mQ(){const t=An();return On({mutationFn:async e=>{const n=await mt.api.agents.install.$post({json:e});if(!n.ok)throw new Error(`Failed to install agent: ${n.status}`);return await n.json()},onSuccess:()=>{t.invalidateQueries({queryKey:Xe.agents.all})}})}function pQ(){const t=An();return On({mutationFn:async e=>{const n=await mt.api.agents.uninstall.$post({json:e});if(!n.ok)throw new Error(`Failed to uninstall agent: ${n.status}`);return await n.json()},onSuccess:()=>{t.invalidateQueries({queryKey:Xe.agents.all}),t.invalidateQueries({queryKey:Xe.agents.path})}})}function gQ(){const t=An();return On({mutationFn:async e=>{const n=await mt.api.agents.custom.create.$post({json:e});if(!n.ok)throw new Error(`Failed to create agent: ${n.status}`);return await n.json()},onSuccess:()=>{t.invalidateQueries({queryKey:Xe.agents.all})}})}const OC=t=>{let e;const n=new Set,r=(h,g)=>{const p=typeof h=="function"?h(e):h;if(!Object.is(p,e)){const x=e;e=g??(typeof p!="object"||p===null)?p:Object.assign({},e,p),n.forEach(y=>y(e,x))}},s=()=>e,u={setState:r,getState:s,getInitialState:()=>f,subscribe:h=>(n.add(h),()=>n.delete(h))},f=e=t(r,s,u);return u},vQ=(t=>t?OC(t):OC),xQ=t=>t;function yQ(t,e=xQ){const n=nt.useSyncExternalStore(t.subscribe,nt.useCallback(()=>e(t.getState()),[t,e]),nt.useCallback(()=>e(t.getInitialState()),[t,e]));return nt.useDebugValue(n),n}const bQ=t=>{const e=vQ(t),n=r=>yQ(e,r);return Object.assign(n,e),n},wQ=(t=>bQ);function _Q(t,e){let n;try{n=t()}catch{return}return{getItem:s=>{var a;const l=f=>f===null?null:JSON.parse(f,void 0),u=(a=n.getItem(s))!=null?a:null;return u instanceof Promise?u.then(l):l(u)},setItem:(s,a)=>n.setItem(s,JSON.stringify(a,void 0)),removeItem:s=>n.removeItem(s)}}const zb=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(r){return zb(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return zb(r)(n)}}}},kQ=(t,e)=>(n,r,s)=>{let a={storage:_Q(()=>localStorage),partialize:w=>w,version:0,merge:(w,S)=>({...S,...w}),...e},l=!1;const u=new Set,f=new Set;let h=a.storage;if(!h)return t((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...w)},r,s);const g=()=>{const w=a.partialize({...r()});return h.setItem(a.name,{state:w,version:a.version})},p=s.setState;s.setState=(w,S)=>(p(w,S),g());const x=t((...w)=>(n(...w),g()),r,s);s.getInitialState=()=>x;let y;const k=()=>{var w,S;if(!h)return;l=!1,u.forEach(C=>{var j;return C((j=r())!=null?j:x)});const N=((S=a.onRehydrateStorage)==null?void 0:S.call(a,(w=r())!=null?w:x))||void 0;return zb(h.getItem.bind(h))(a.name).then(C=>{if(C)if(typeof C.version=="number"&&C.version!==a.version){if(a.migrate){const j=a.migrate(C.state,C.version);return j instanceof Promise?j.then(A=>[!0,A]):[!0,j]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,C.state];return[!1,void 0]}).then(C=>{var j;const[A,I]=C;if(y=a.merge(I,(j=r())!=null?j:x),n(y,!0),A)return g()}).then(()=>{N==null||N(y,void 0),y=r(),l=!0,f.forEach(C=>C(y))}).catch(C=>{N==null||N(void 0,C)})};return s.persist={setOptions:w=>{a={...a,...w},w.storage&&(h=w.storage)},clearStorage:()=>{h==null||h.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>k(),hasHydrated:()=>l,onHydrate:w=>(u.add(w),()=>{u.delete(w)}),onFinishHydration:w=>(f.add(w),()=>{f.delete(w)})},a.skipHydration||k(),y||x},SQ=kQ,jQ=5,RC=wQ()(SQ(t=>({recentAgents:[],addRecentAgent:e=>t(n=>{const r=n.recentAgents.filter(a=>a.path!==e.path);return{recentAgents:[{...e,lastUsed:Date.now()},...r].slice(0,jQ)}}),clearRecentAgents:()=>t({recentAgents:[]})}),{name:"dexto:recentAgents"})),fy={id:"",name:"",description:"",author:"",tags:""},hy={llm:{provider:"openai",model:"gpt-5",apiKey:""},systemPrompt:{contributors:[{id:"primary",type:"static",priority:0,enabled:!0,content:""}]}};function NQ({open:t,onOpenChange:e,onAgentCreated:n}){const[r,s]=_.useState(fy),[a,l]=_.useState(hy),[u,f]=_.useState({}),[h,g]=_.useState(null),p=gQ(),x=p.isPending,[y,k]=_.useState({basic:!0,llm:!0,systemPrompt:!0}),w=A=>{k(I=>({...I,[A]:!I[A]}))},S=(A,I)=>{s(T=>({...T,[A]:I})),u[A]&&f(T=>{const E={...T};return delete E[A],E})},N=()=>{var T,E,R;const A={};r.id.trim()?/^[a-z0-9-]+$/.test(r.id)||(A.id="Agent ID must contain only lowercase letters, numbers, and hyphens"):A.id="Agent ID is required",r.name.trim()||(A.name="Agent name is required"),r.description.trim()||(A.description="Description is required"),(T=a.llm)!=null&&T.provider||(A["llm.provider"]="Provider is required"),(R=(E=a.llm)==null?void 0:E.model)!=null&&R.trim()||(A["llm.model"]="Model is required");const I=a.systemPrompt;if(I&&typeof I=="object"&&"contributors"in I){const z=I.contributors;Array.isArray(z)&&(z.some(B=>!!(B.type==="static"&&typeof B.content=="string"&&B.content.trim()))||(A.systemPrompt="At least one static contributor with content is required"))}else typeof I=="string"&&!I.trim()&&(A.systemPrompt="System prompt is required");return f(A),Object.keys(A).length===0},C=async()=>{N()&&(g(null),p.mutate({id:r.id.trim(),name:r.name.trim(),description:r.description.trim(),author:r.author.trim()||void 0,tags:r.tags.split(",").map(A=>A.trim()).filter(Boolean),config:a},{onSuccess:A=>{s(fy),l(hy),f({}),e(!1),n&&A.id&&n(A.id)},onError:A=>{g(A.message)}}))},j=()=>{s(fy),l(hy),f({}),g(null),e(!1)};return c.jsx(rr,{open:t,onOpenChange:e,children:c.jsxs(sr,{className:"max-w-2xl max-h-[90vh] flex flex-col",children:[c.jsxs(ir,{children:[c.jsx(ar,{children:"Create New Agent"}),c.jsxs(Yr,{children:["Create a custom agent with your own configuration.",c.jsx("br",{}),c.jsx("br",{}),"You can add more advanced configuration after creating the agent using the Edit Agent button."]})]}),h&&c.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-3 flex items-start gap-2",children:[c.jsx(qa,{className:"h-4 w-4 text-destructive mt-0.5 flex-shrink-0"}),c.jsx("div",{className:"text-sm text-destructive",children:h})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4 pr-2",children:[c.jsx(Ko,{title:"Basic Information",open:y.basic,onOpenChange:()=>w("basic"),children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"agent-id",tooltip:"Unique identifier for this agent (lowercase, no spaces, hyphens only)",children:"Agent ID *"}),c.jsx(st,{id:"agent-id",value:r.id,onChange:A=>S("id",A.target.value),placeholder:"my-custom-agent","aria-invalid":!!u.id}),u.id&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:u.id})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"agent-name",tooltip:"Display name for this agent (shown in UI)",children:"Agent Name *"}),c.jsx(st,{id:"agent-name",value:r.name,onChange:A=>S("name",A.target.value),placeholder:"My Custom Agent","aria-invalid":!!u.name}),u.name&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:u.name})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"agent-description",tooltip:"Brief description of what this agent does",children:"Description *"}),c.jsx(st,{id:"agent-description",value:r.description,onChange:A=>S("description",A.target.value),placeholder:"A custom agent for specific tasks","aria-invalid":!!u.description}),u.description&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:u.description})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"agent-author",tooltip:"Your name or organization",children:"Author"}),c.jsx(st,{id:"agent-author",value:r.author,onChange:A=>S("author",A.target.value),placeholder:"Your Name"})]}),c.jsxs("div",{children:[c.jsx(yt,{htmlFor:"agent-tags",tooltip:"Comma-separated tags for categorization",children:"Tags"}),c.jsx(st,{id:"agent-tags",value:r.tags,onChange:A=>S("tags",A.target.value),placeholder:"coding, custom, specialized"})]})]})}),c.jsx(AR,{value:a.llm||{provider:"openai",model:"gpt-5",apiKey:""},onChange:A=>l(I=>({...I,llm:A})),errors:u,open:y.llm,onOpenChange:()=>w("llm"),errorCount:0,sectionErrors:[]}),c.jsx(OR,{value:typeof a.systemPrompt=="object"&&"contributors"in a.systemPrompt?{contributors:a.systemPrompt.contributors||[]}:{contributors:[]},onChange:A=>l(I=>({...I,systemPrompt:A})),errors:u,open:y.systemPrompt,onOpenChange:()=>w("systemPrompt"),errorCount:0,sectionErrors:[]})]}),c.jsxs(Kr,{children:[c.jsx(ye,{variant:"outline",onClick:j,disabled:x,children:"Cancel"}),c.jsxs(ye,{onClick:C,disabled:x,children:[x&&c.jsx(Ms,{className:"mr-2 h-4 w-4 animate-spin"}),"Create Agent"]})]})]})})}function CQ({mode:t="default"}){const e=Fb(),{currentSessionId:n}=Ld(),r=Nc(),s=_.useRef(r),a=RC(H=>H.recentAgents),l=RC(H=>H.addRecentAgent),[u,f]=_.useState(!1),[h,g]=_.useState(!1),[p,x]=_.useState(!1);_.useEffect(()=>{s.current=r},[r]);const y=An(),k=_.useCallback(()=>{y.invalidateQueries({queryKey:Xe.sessions.all}),y.invalidateQueries({queryKey:Xe.memories.all}),y.invalidateQueries({queryKey:Xe.servers.all}),y.invalidateQueries({queryKey:["servers","tools"]}),y.invalidateQueries({queryKey:Xe.resources.all}),y.invalidateQueries({queryKey:["greeting"]}),y.invalidateQueries({queryKey:Xe.prompts.all}),y.invalidateQueries({queryKey:Xe.agent.config})},[y]),w=_.useCallback(H=>{const ie=H.replace(/\\/g,"/").split("/").filter(Boolean).findIndex(P=>P===".dexto");return ie>=0&&ie<=3},[]),{data:S,isLoading:N,refetch:C}=dQ(),{data:j}=fQ(),A=_.useMemo(()=>(S==null?void 0:S.installed)||[],[S==null?void 0:S.installed]),I=_.useMemo(()=>(S==null?void 0:S.available)||[],[S==null?void 0:S.available]),T=(S==null?void 0:S.current.id)||null,E=j??null,R=hQ(),z=mQ(),D=pQ();_.useEffect(()=>{E!=null&&E.path&&(E!=null&&E.name)&&l({id:E.name,name:E.name,path:E.path})},[E,l]);const B=N,q=_.useCallback(async H=>{try{f(!0);const L=A.find(ie=>ie.id===H);if(!L)throw console.error(`Agent not found in installed list: ${H}`),new Error(`Agent '${H}' not found. Please refresh the agents list.`);const ne=T;await R.mutateAsync({id:H}),g(!1),s.current.trackAgentSwitched({fromAgentId:ne,toAgentId:H,toAgentName:L.name,sessionId:n||void 0}),k(),e({to:"/"})}catch(L){console.error(`Switch agent failed: ${L instanceof Error?L.message:String(L)}`);const ne=L instanceof Error?L.message:"Failed to switch agent";alert(`Failed to switch agent: ${ne}`)}finally{f(!1)}},[A,e,T,n,R,k]),K=_.useCallback(async H=>{try{f(!0);const L=T;await R.mutateAsync({id:H.id,path:H.path}),g(!1),l(H),s.current.trackAgentSwitched({fromAgentId:L,toAgentId:H.id,toAgentName:H.name,sessionId:n||void 0}),k(),e({to:"/"})}catch(L){console.error(`Switch agent failed: ${L instanceof Error?L.message:String(L)}`);const ne=L instanceof Error?L.message:"Failed to switch agent";alert(`Failed to switch agent: ${ne}`)}finally{f(!1)}},[l,e,T,n,R,k]),G=_.useCallback(async H=>{try{f(!0);const L=T;await z.mutateAsync({id:H}),await y.refetchQueries({queryKey:Xe.agents.all});const ne=y.getQueryData(Xe.agents.all),ie=ne==null?void 0:ne.installed.find(P=>P.id===H);if(!ie)throw new Error(`Agent '${H}' not found after installation. Please refresh.`);await R.mutateAsync({id:H}),g(!1),s.current.trackAgentSwitched({fromAgentId:L,toAgentId:H,toAgentName:ie.name,sessionId:n||void 0}),k(),e({to:"/"})}catch(L){console.error(`Install/switch agent failed: ${L instanceof Error?L.message:String(L)}`);const ne=L instanceof Error?L.message:"Failed to install/switch agent";alert(`Failed to install/switch agent: ${ne}`)}finally{f(!1)}},[e,T,n,y,z,R,k]),F=_.useCallback(async(H,L)=>{if(L.stopPropagation(),!!confirm(`Are you sure you want to delete the custom agent "${H.name}"?`))try{f(!0),await D.mutateAsync({id:H.id})}catch(ne){console.error(`Delete agent failed: ${ne instanceof Error?ne.message:String(ne)}`);const ie=ne instanceof Error?ne.message:"Failed to delete agent";alert(`Failed to delete agent: ${ie}`)}finally{f(!1)}},[D]),M=_.useMemo(()=>{if(!T)return"Choose Agent";const H=A.find(L=>L.id===T)||I.find(L=>L.id===T);return(H==null?void 0:H.name)??T},[I,T,A]),V=_.useCallback(async H=>{await C()},[C]),U=H=>{const L="transition-all duration-200 shadow-lg hover:shadow-xl font-semibold rounded-full";switch(H){case"badge":return`h-9 px-4 text-xs border border-teal-500 bg-teal-500/20 text-teal-600 hover:bg-teal-500/40 hover:border-teal-500 hover:text-teal-700 dark:text-teal-400 dark:hover:text-teal-300 dark:border-teal-400 dark:hover:border-teal-300 min-w-[100px] max-w-[140px] md:min-w-[140px] md:max-w-[240px] lg:max-w-[400px] xl:max-w-[500px] ${L}`;case"title":return`h-11 px-4 text-lg font-bold bg-gradient-to-r from-teal-500/30 to-teal-500/40 text-teal-600 hover:from-teal-500/50 hover:to-teal-500/60 hover:text-teal-700 focus-visible:ring-2 focus-visible:ring-teal-500/50 focus-visible:ring-offset-2 border border-teal-500/40 dark:text-teal-400 dark:hover:text-teal-300 dark:border-teal-400 ${L}`;default:return`h-10 px-3 text-sm bg-teal-500/40 text-teal-600 hover:bg-teal-500/50 hover:text-teal-700 focus-visible:ring-2 focus-visible:ring-teal-500/50 focus-visible:ring-offset-2 border border-teal-500/50 dark:text-teal-400 dark:hover:text-teal-300 dark:border-teal-400 ${L}`}};return c.jsxs(c.Fragment,{children:[c.jsxs(Td,{open:h,onOpenChange:g,children:[c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(Ad,{asChild:!0,children:c.jsx(ye,{variant:t==="badge"?"outline":"default",size:"sm",className:U(t),disabled:u,children:c.jsxs("div",{className:"flex items-center justify-between w-full min-w-0",children:[c.jsx(JE,{className:"w-4 h-4 mr-2 flex-shrink-0"}),c.jsx("span",{className:"flex-1 text-center truncate min-w-0 px-1",children:u?"Switching...":t==="title"?`Agent: ${M}`:M}),c.jsx(Ar,{className:"w-4 h-4 ml-2 flex-shrink-0"})]})})})}),c.jsx(Lt,{side:"bottom",children:"Select agent"})]}),c.jsxs(bc,{align:"start",className:"w-80 max-h-96 overflow-y-auto",children:[B&&c.jsx($t,{disabled:!0,className:"text-center text-muted-foreground",children:"Loading agents..."}),!B&&c.jsxs(c.Fragment,{children:[c.jsx($t,{onClick:()=>{x(!0),g(!1)},disabled:u,className:"cursor-pointer py-3 bg-gradient-to-r from-purple-500/10 to-purple-500/5 hover:from-purple-500/20 hover:to-purple-500/10 border-b border-purple-500/20",children:c.jsxs("div",{className:"flex items-center gap-2 w-full",children:[c.jsx(us,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"}),c.jsx("span",{className:"font-semibold text-purple-600 dark:text-purple-400",children:"New Agent"})]})}),E&&!A.some(H=>H.id===E.name)&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold text-teal-600 dark:text-teal-400 uppercase tracking-wider",children:"Currently Active"}),c.jsx($t,{onClick:()=>K({id:E.name,name:E.name,path:E.path}),disabled:u||T===E.name,className:"cursor-pointer py-3",children:c.jsx("div",{className:"flex items-center justify-between w-full",children:c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium text-sm truncate",children:E.name}),T===E.name&&c.jsx(Es,{className:"w-4 h-4 text-green-600 flex-shrink-0 animate-in fade-in duration-200"})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:"Loaded from file"})]})})}),c.jsx(Pi,{})]}),a.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Recent"}),a.filter(H=>!A.some(L=>L.id===H.id)&&H.id!==(E==null?void 0:E.name)&&!w(H.path)).slice(0,3).map(H=>c.jsx($t,{onClick:()=>K(H),disabled:u||H.id===T,className:"cursor-pointer py-3",children:c.jsx("div",{className:"flex items-center justify-between w-full",children:c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium text-sm truncate",children:H.name}),H.id===T&&c.jsx(Es,{className:"w-4 h-4 text-green-600 flex-shrink-0 animate-in fade-in duration-200"})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",title:H.path,children:H.path})]})})},H.path)),c.jsx(Pi,{})]}),A.filter(H=>H.type==="custom").length>0&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"px-2 py-1.5 text-xs font-semibold text-purple-600 dark:text-purple-400 uppercase tracking-wider flex items-center gap-1",children:[c.jsx(n$,{className:"w-3 h-3"}),"Custom Agents"]}),A.filter(H=>H.type==="custom").map(H=>c.jsx($t,{onClick:()=>q(H.id),disabled:u||H.id===T,className:"cursor-pointer py-3",children:c.jsxs("div",{className:"flex items-center justify-between w-full gap-2",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium text-sm truncate",children:H.name}),H.id===T&&c.jsx(Es,{className:"w-4 h-4 text-green-600 flex-shrink-0 animate-in fade-in duration-200"})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:H.description}),H.author&&c.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5",children:["by ",H.author]})]}),c.jsx("button",{onClick:L=>F(H,L),disabled:u,className:"p-1 hover:bg-red-100 dark:hover:bg-red-900/30 rounded transition-colors",title:"Delete custom agent",children:c.jsx(Zn,{className:"w-4 h-4 text-red-600 dark:text-red-400"})})]})},H.id))]}),A.filter(H=>H.type==="builtin").length>0&&c.jsxs(c.Fragment,{children:[A.filter(H=>H.type==="custom").length>0&&c.jsx(Pi,{}),c.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Installed"}),A.filter(H=>H.type==="builtin").map(H=>c.jsx($t,{onClick:()=>q(H.id),disabled:u||H.id===T,className:"cursor-pointer py-3",children:c.jsx("div",{className:"flex items-center justify-between w-full",children:c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium text-sm truncate",children:H.name}),H.id===T&&c.jsx(Es,{className:"w-4 h-4 text-green-600 flex-shrink-0 animate-in fade-in duration-200"})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:H.description}),H.author&&c.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5",children:["by ",H.author]})]})})},H.id))]}),I.filter(H=>H.type==="builtin").length>0&&c.jsxs(c.Fragment,{children:[A.length>0&&c.jsx(Pi,{}),c.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Available"}),I.filter(H=>H.type==="builtin").map(H=>c.jsx($t,{onClick:()=>G(H.id),disabled:u,className:"cursor-pointer py-3",children:c.jsx("div",{className:"flex items-center justify-between w-full",children:c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium text-sm truncate",children:H.name}),c.jsx(S$,{className:"w-4 h-4 text-blue-600 flex-shrink-0"})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:H.description}),H.author&&c.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5",children:["by ",H.author]})]})})},H.id))]}),!B&&A.length===0&&I.length===0&&c.jsx($t,{disabled:!0,className:"text-center text-muted-foreground",children:"No agents found"})]})]})]}),c.jsx(NQ,{open:p,onOpenChange:x,onAgentCreated:V})]})}function gM({sessionId:t}={}){const e=Fb(),{messages:n,sendMessage:r,currentSessionId:s,switchSession:a,isWelcomeState:l,returnToWelcome:u,activeError:f,clearError:h,processing:g,cancel:p,greeting:x,isStreaming:y,setStreaming:k}=Ld(),{theme:w,toggleTheme:S}=jE(),{mutateAsync:N}=o0(),{mutateAsync:C}=CE(),[j,A]=_.useState(!1),[I,T]=_.useState(!1),[E,R]=_.useState(!1),[z,D]=_.useState(!1),[B,q]=_.useState(!1),K=nt.useRef(!0),[G,F]=_.useState(!1),[M,V]=_.useState(!1),[U,H]=_.useState(!1),[L,ne]=_.useState(!1),[ie,P]=_.useState(!1),[pe,Pe]=_.useState("dexto-config"),[Ne,ge]=_.useState(null),[Fe,Qe]=_.useState(""),[$e,Q]=_.useState(!1),[_e,Oe]=_.useState(null),[le,he]=_.useState(!1),[Ee,De]=_.useState(!1),[ve,ue]=_.useState(!1),[Ce,ze]=_.useState(null),[be,Se]=_.useState(!1),[ot,dt]=_.useState(null),[J,me]=_.useState(null),Ae=EE(),{data:He=[],isLoading:Et}=NE({enabled:l}),kn=He.filter(xe=>{var je;return((je=xe.metadata)==null?void 0:je.showInStarters)===!0}),xr=!Et,on=nt.useRef(null),Hn=nt.useRef(null),[Rn,ln]=_.useState(!0),[Sn,$n]=_.useState(!1),[ps,gs]=_.useState(!1),Zi=nt.useRef(0),[ci,vs]=_.useState(!1),xs=nt.useRef(null),[Wi,ys]=_.useState(0),[de,Te]=_.useState(null),[it,et]=_.useState(!1);_.useEffect(()=>{var je;const xe=()=>{var pn;if(typeof document>"u")return;const Tt=((pn=window.visualViewport)==null?void 0:pn.height)??window.innerHeight;document.documentElement.style.setProperty("--app-viewport-height",`${Tt}px`)};return xe(),window.addEventListener("resize",xe),window.addEventListener("orientationchange",xe),(je=window.visualViewport)==null||je.addEventListener("resize",xe),()=>{var Tt;window.removeEventListener("resize",xe),window.removeEventListener("orientationchange",xe),(Tt=window.visualViewport)==null||Tt.removeEventListener("resize",xe)}},[]);const We=_.useCallback(()=>{const xe=on.current;if(!xe)return;const je=xe.scrollHeight-xe.scrollTop<=xe.clientHeight+1;ln(je)},[]),ft=_.useCallback((xe="auto")=>{const je=on.current;je&&($n(!0),je.scrollTo({top:je.scrollHeight,behavior:xe}),requestAnimationFrame(()=>$n(!1)))},[]);_.useEffect(()=>{const xe=on.current;if(!xe)return;const je=()=>{const Tt=Zi.current,pn=xe.scrollTop;!Sn&&ps&&pn<Tt&&gs(!1),Zi.current=pn,We(),xe.scrollHeight-xe.scrollTop<=xe.clientHeight+1?(vs(!1),xs.current&&(window.clearTimeout(xs.current),xs.current=null)):(vs(!1),xs.current&&window.clearTimeout(xs.current),xs.current=window.setTimeout(()=>{vs(!0)},180))};return xe.addEventListener("scroll",je),We(),()=>xe.removeEventListener("scroll",je)},[We,ps,Sn,l]),_.useEffect(()=>{const xe=Hn.current;if(!xe)return;const je=new ResizeObserver(()=>{Sn||(ps||Rn)&&ft("auto")});return je.observe(xe),()=>je.disconnect()},[Rn,Sn,ps,ft,l]),_.useEffect(()=>{ps&&ft("auto")},[ps,n,ft]);const Kt=_.useCallback(()=>{const xe=on.current;if(!xe)return;const je=xe.querySelectorAll('[data-role="user"]'),Tt=je[je.length-1];if(!Tt){ft("auto");return}const pn=xe.getBoundingClientRect(),Qi=Tt.getBoundingClientRect().top-pn.top+xe.scrollTop,Pp=Math.max(Qi-16,0);$n(!0),xe.scrollTo({top:Pp,behavior:"auto"}),requestAnimationFrame(()=>$n(!1))},[ft]);_.useEffect(()=>{M?(async()=>{try{const je=await mt.api.agent.config.export.$get({query:s?{sessionId:s}:{}});if(!je.ok)throw new Error("Failed to fetch configuration");const Tt=await je.text();Qe(Tt),ge(null)}catch(je){console.error("Preview fetch failed:",je),ge(je instanceof Error?je.message:"Preview fetch failed")}})():(Qe(""),ge(null),Q(!1))},[M,s]);const zn=_.useCallback(async()=>{try{const xe=await mt.api.agent.config.export.$get({query:s?{sessionId:s}:{}});if(!xe.ok)throw new Error("Failed to fetch configuration");const je=await xe.text(),Tt=new Blob([je],{type:"application/x-yaml"}),pn=URL.createObjectURL(Tt),dn=document.createElement("a");dn.href=pn;const Qi=s?`${pe}-${s}.yml`:`${pe}.yml`;dn.download=Qi,document.body.appendChild(dn),dn.click(),document.body.removeChild(dn),URL.revokeObjectURL(pn)}catch(xe){console.error("Download failed:",xe),ge(xe instanceof Error?xe.message:"Download failed")}},[pe,s]),Wn=_.useCallback(async()=>{try{await navigator.clipboard.writeText(Fe),Q(!0),setTimeout(()=>Q(!1),2e3)}catch(xe){console.error("Copy failed:",xe),ge("Failed to copy to clipboard")}},[Fe]),cn=_.useCallback(async(xe,je,Tt)=>{De(!0),ze(null);try{await r(xe,je,Tt),setTimeout(()=>{Kt(),gs(!0)},0)}catch(pn){console.error("Failed to send message:",pn),ze(pn instanceof Error?pn.message:"Failed to send message"),setTimeout(()=>ze(null),5e3)}finally{De(!1)}},[r,Kt]);_.useEffect(()=>{gs(g)},[g]);const ui=_.useCallback(xe=>{gs(!1),vs(!1),e({to:`/chat/${xe}`})},[e]),mn=_.useCallback(()=>{gs(!1),vs(!1),u(),e({to:"/"})},[e,u]);_.useEffect(()=>{q(!0),localStorage.getItem("sessionsPanelOpen")==="true"&&D(!0),setTimeout(()=>{K.current=!1},0)},[]),_.useEffect(()=>{B&&typeof window<"u"&&localStorage.setItem("sessionsPanelOpen",z.toString())},[z,B]),_.useEffect(()=>{t&&t!==s&&(gs(!1),vs(!1),a(t))},[t,s,a]),_.useEffect(()=>{!t&&!l&&u()},[t,l,u]);const Go=_.useCallback(async xe=>{const je=bR(xe),Tt=je.type==="stdio"&&Object.keys(je.env||{}).length>0&&Bm(je.env||{}),pn=(je.type==="sse"||je.type==="http")&&"headers"in je&&Object.keys(je.headers||{}).length>0&&Bm(je.headers||{});if(Tt||pn)return Te({name:xe.name,config:je,lockName:!0,registryEntryId:xe.id,onCloseRegistryModal:xe.onCloseRegistryModal??(()=>T(!1))}),A(!0),"requires-input";try{if(et(!0),await N({name:xe.name,config:je,persistToAgent:!1}),xe.id)try{await Ns.setInstalled(xe.id,!0)}catch(dn){console.warn("Failed to mark registry entry installed:",dn)}return ys(dn=>dn+1),Oe(`Added ${xe.name}`),setTimeout(()=>Oe(null),4e3),T(!1),"connected"}catch(dn){const Qi=dn instanceof Error?dn.message:"Failed to install server";throw new Error(Qi)}finally{et(!1)}},[N,T,A,Te,ys,Oe,et]),di=()=>typeof window<"u"&&window.innerWidth<768,zs=_.useCallback(()=>{di()&&E&&R(!1),D(!z)},[z,E]),Fs=_.useCallback(()=>{di()&&z&&D(!1),R(!E)},[E,z]),Bs=_.useCallback(async()=>{if(s)try{await Ae.mutateAsync({sessionId:s}),Se(!1),mn()}catch(xe){console.error("Failed to delete conversation:",xe),ze(xe instanceof Error?xe.message:"Failed to delete conversation"),setTimeout(()=>ze(null),5e3)}},[s,mn]),un=nt.useMemo(()=>[{title:"Help me get started",description:"Show me what you can do",action:()=>cn("I'm new to Dexto. Can you show me your capabilities and help me understand how to work with you effectively?"),icon:"๐"},{title:"Create Snake Game",description:"Build a game and open it",action:()=>cn("Create a snake game in a new directory with HTML, CSS, and JavaScript, then open it in the browser for me to play."),icon:"๐"},{title:"Connect new tools",description:"Browse and add MCP servers",action:()=>R(!0),icon:"๐ง"},{title:"Demonstrate tools",description:"Show me your capabilities",action:()=>cn("Pick one of your most interesting tools and demonstrate it with a practical example. Show me what it can do."),icon:"โก"}],[cn,R]),Jd=nt.useMemo(()=>{if(!xr)return un.map(je=>({description:`${je.icon} ${je.title}`,tooltip:je.description,action:je.action}));const xe=kn.length>0?[]:un.map(je=>({description:`${je.icon} ${je.title}`,tooltip:je.description,action:je.action}));return kn.forEach(je=>{const Tt=je.title||je.description||"Starter prompt",pn=je.description;(je==null?void 0:je.name)==="starter:connect-tools"?xe.push({description:Tt,tooltip:pn,action:()=>R(!0)}):xe.push({description:Tt,tooltip:pn,action:async()=>{try{const dn=await C({name:je.name});dn.text.trim()?cn(dn.text.trim()):cn(`/${je.name}`)}catch(dn){console.error(`Failed to resolve starter prompt ${je.name}:`,dn),cn(`/${je.name}`)}}})}),xe},[kn,xr,un,cn,R,C]);return fr("mod+backspace",()=>{s&&!l&&(n.length>0?Se(!0):Bs())},{preventDefault:!0},[s,l,n.length,Bs]),fr("mod+h",zs,{preventDefault:!0},[zs]),fr("mod+k",mn,{preventDefault:!0},[mn]),fr("mod+j",Fs,{preventDefault:!0},[Fs]),fr("mod+m",()=>P(xe=>!xe),{preventDefault:!0}),fr("mod+shift+s",()=>F(!0),{preventDefault:!0}),fr("mod+l",()=>window.open("/playground","_blank"),{preventDefault:!0}),fr("mod+e",()=>ne(xe=>!xe),{preventDefault:!0}),fr("mod+shift+e",()=>V(!0),{preventDefault:!0}),fr("mod+slash",()=>ue(!0),{preventDefault:!0}),fr("escape",()=>{L?ne(!1):E?R(!1):z?D(!1):ie?P(!1):I?T(!1):M?V(!1):ve?ue(!1):be?Se(!1):Ce?ze(null):g&&p(s||void 0)},[L,E,z,ie,I,M,ve,be,Ce,g,p,s]),c.jsxs("div",{className:"flex w-full bg-background",style:{height:"var(--app-viewport-height, 100vh)",minHeight:"var(--app-viewport-height, 100vh)"},children:[c.jsx("div",{className:ae("hidden md:block shrink-0 border-r border-border/50 bg-card/50 backdrop-blur-sm",!K.current&&"transition-all duration-300 ease-in-out",z?"w-80":"w-0 overflow-hidden"),suppressHydrationWarning:!0,children:z&&c.jsx(fC,{isOpen:z,onClose:()=>D(!1),currentSessionId:s,onSessionChange:ui,returnToWelcome:mn,variant:"inline",onSearchOpen:()=>F(!0),onNewChat:mn})}),c.jsx("div",{className:"md:hidden",children:c.jsx(fC,{isOpen:z,onClose:()=>D(!1),currentSessionId:s,onSessionChange:ui,returnToWelcome:mn,variant:"overlay",onSearchOpen:()=>F(!0),onNewChat:mn})}),c.jsxs("main",{className:"flex-1 flex flex-col relative min-w-0",style:{"--thread-max-width":"54rem"},children:[null,c.jsxs("header",{className:"shrink-0 border-b border-border/50 bg-background/95 backdrop-blur-xl shadow-sm relative",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 gap-3",children:[c.jsxs("div",{className:"flex items-center gap-2.5 shrink-0",children:[c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"sm",onClick:zs,className:ae("h-8 w-8 p-0 transition-colors",z&&"bg-muted"),children:c.jsx(ib,{className:"h-4 w-4"})})}),c.jsx(Lt,{children:"Chat History (โH)"})]}),!z&&c.jsx("div",{className:"hidden md:block",children:c.jsx(lQ,{onClick:mn})}),c.jsxs("a",{href:"https://dexto.ai",target:"_blank",rel:"noopener noreferrer",className:"flex items-center hover:opacity-80 transition-opacity shrink-0",children:[c.jsx("img",{src:"/logos/dexto/dexto_logo_icon.svg",alt:"Dexto",className:ae("h-9 w-9",z?"lg:hidden":"md:hidden")}),c.jsx("img",{src:"/logos/dexto/dexto_logo_light.svg",alt:"Dexto",className:ae("h-11 w-auto hidden dark:hidden",z?"lg:block":"md:block")}),c.jsx("img",{src:"/logos/dexto/dexto_logo.svg",alt:"Dexto",className:ae("h-11 w-auto hidden",z?"dark:lg:block":"dark:md:block")}),c.jsx("span",{className:"sr-only",children:"Dexto"})]})]}),c.jsxs("div",{className:ae("hidden items-center gap-2",z?"lg:flex":"md:flex"),children:[c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"sm",onClick:()=>ne(!L),className:ae("h-8 w-8 p-0",L&&"bg-muted"),"aria-label":"Customize agent",children:c.jsx(Aj,{className:"h-3.5 w-3.5"})})}),c.jsx(Lt,{children:"Customize Agent (โE)"})]}),c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"sm",onClick:Fs,className:ae("h-8 w-8 p-0 transition-colors",E&&"bg-muted"),"aria-label":"Toggle tools panel",children:c.jsx(Ii,{className:"h-3.5 w-3.5"})})}),c.jsx(Lt,{children:"Toggle tools panel (โJ)"})]}),c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"sm",onClick:()=>P(!ie),className:ae("h-8 w-8 p-0 transition-colors",ie&&"bg-muted"),"aria-label":"Toggle memories panel",children:c.jsx(Io,{className:"h-3.5 w-3.5"})})}),c.jsx(Lt,{children:"Toggle memories panel (โM)"})]}),c.jsx(oQ,{}),c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"sm",onClick:()=>H(!0),className:"h-8 w-8 p-0","aria-label":"Open settings",children:c.jsx(ab,{className:"h-3.5 w-3.5"})})}),c.jsx(Lt,{children:"Settings"})]}),c.jsxs(Td,{children:[c.jsx(Ad,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:c.jsx(YE,{className:"h-3.5 w-3.5"})})}),c.jsxs(bc,{align:"end",children:[c.jsxs($t,{onClick:()=>T(!0),children:[c.jsx(Bi,{className:"h-4 w-4 mr-2"}),"Connect MCPs"]}),c.jsxs($t,{onClick:()=>window.open("/playground","_blank"),children:[c.jsx(Tm,{className:"h-4 w-4 mr-2"}),"MCP Playground"]}),c.jsxs($t,{onClick:()=>V(!0),children:[c.jsx(Sh,{className:"h-4 w-4 mr-2"}),"Export Config"]}),c.jsxs($t,{onClick:()=>ue(!0),children:[c.jsx(Sx,{className:"h-4 w-4 mr-2"}),"Shortcuts"]}),s&&!l&&c.jsxs(c.Fragment,{children:[c.jsx(Pi,{}),c.jsxs($t,{onClick:()=>Se(!0),className:"text-destructive focus:text-destructive",children:[c.jsx(Zn,{className:"h-4 w-4 mr-2"}),"Delete Conversation"]})]})]})]})]}),c.jsx("div",{className:ae("flex",z?"lg:hidden":"md:hidden"),children:c.jsxs(Td,{open:le,onOpenChange:he,children:[c.jsx(Ad,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0","aria-label":"Open menu",children:c.jsx(ez,{className:"h-4 w-4"})})}),c.jsxs(bc,{align:"end",children:[c.jsxs($t,{onClick:()=>{ne(!L),he(!1)},children:[c.jsx(Aj,{className:"h-4 w-4 mr-2"}),"Customize Agent"]}),c.jsxs($t,{onClick:()=>{Fs(),he(!1)},children:[c.jsx(Ii,{className:"h-4 w-4 mr-2"}),"Tools"]}),c.jsxs($t,{onClick:()=>{P(!ie),he(!1)},children:[c.jsx(Io,{className:"h-4 w-4 mr-2"}),"Memories"]}),c.jsxs($t,{onClick:()=>{S(w==="light"),he(!1)},children:[c.jsx("span",{className:"h-4 w-4 mr-2",children:"๐"}),"Toggle Theme"]}),c.jsxs($t,{onClick:()=>{H(!0),he(!1)},children:[c.jsx(ab,{className:"h-4 w-4 mr-2"}),"Settings"]}),c.jsxs($t,{onClick:xe=>{xe.preventDefault(),k(!y)},className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center",children:[c.jsx(np,{className:"h-4 w-4 mr-2"}),"Streaming"]}),c.jsx(Z0,{checked:y,onCheckedChange:k,onClick:xe=>xe.stopPropagation()})]}),c.jsx(Pi,{}),c.jsxs($t,{onClick:()=>{T(!0),he(!1)},children:[c.jsx(Bi,{className:"h-4 w-4 mr-2"}),"Connect MCPs"]}),c.jsxs($t,{onClick:()=>{window.open("/playground","_blank"),he(!1)},children:[c.jsx(Tm,{className:"h-4 w-4 mr-2"}),"MCP Playground"]}),c.jsxs($t,{onClick:()=>{V(!0),he(!1)},children:[c.jsx(Sh,{className:"h-4 w-4 mr-2"}),"Export Config"]}),c.jsxs($t,{onClick:()=>{ue(!0),he(!1)},children:[c.jsx(Sx,{className:"h-4 w-4 mr-2"}),"Shortcuts"]}),s&&!l&&c.jsxs(c.Fragment,{children:[c.jsx(Pi,{}),c.jsxs($t,{onClick:()=>{Se(!0),he(!1)},className:"text-destructive focus:text-destructive",children:[c.jsx(Zn,{className:"h-4 w-4 mr-2"}),"Delete Conversation"]})]})]})]})})]}),c.jsx("div",{className:"absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2",children:c.jsx("div",{className:"w-full max-w-[180px] md:max-w-[260px]",children:c.jsx(CQ,{mode:"badge"})})})]}),c.jsxs("div",{className:"flex-1 flex overflow-hidden min-w-0",children:[_e&&c.jsxs("div",{className:"fixed bottom-4 right-4 z-50 border border-border/60 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 text-foreground px-3 py-2 rounded-md shadow-md inline-flex items-center gap-2",children:[c.jsx(Es,{className:"h-4 w-4 text-green-600"}),c.jsx("span",{className:"text-sm",children:_e})]}),Ce&&c.jsx("div",{className:"absolute top-4 right-4 z-50 bg-destructive text-destructive-foreground px-4 py-2 rounded-md shadow-lg",children:Ce}),c.jsx("div",{className:"flex-1 flex flex-col min-h-0 min-w-0",children:l?c.jsx("div",{className:"flex-1 flex flex-col justify-end sm:justify-center p-6 sm:-mt-20",children:c.jsxs("div",{className:"w-full max-w-full sm:max-w-[var(--thread-max-width)] mx-auto space-y-6 pb-safe",children:[c.jsxs("div",{className:"text-center space-y-3",children:[c.jsxs("div",{className:"flex items-center justify-center gap-3",children:[c.jsx("img",{src:"/logos/dexto/dexto_logo_icon.svg",alt:"Dexto",className:"h-12 w-auto"}),c.jsx("h2",{className:"text-2xl font-bold font-mono tracking-tight bg-gradient-to-r from-primary to-primary/70 bg-clip-text",children:x||"Welcome to Dexto"})]}),c.jsx("p",{className:"text-base text-muted-foreground max-w-xl mx-auto leading-relaxed",children:"Your AI assistant with powerful tools. Ask anything or connect new capabilities."})]}),c.jsx("div",{className:"flex flex-wrap justify-center gap-2 max-w-full sm:max-w-[var(--thread-max-width)] mx-auto",children:Jd.map((xe,je)=>{const Tt=c.jsx("button",{onClick:xe.action,className:"group px-3 py-2 text-left rounded-full bg-primary/5 hover:bg-primary/10 transition-all duration-200 hover:shadow-sm hover:scale-105",children:c.jsx("span",{className:"font-medium text-sm text-primary group-hover:text-primary/80 transition-colors",children:xe.description})},je);return xe.tooltip?c.jsxs(Dt,{children:[c.jsx(It,{asChild:!0,children:Tt}),c.jsx(Lt,{children:xe.tooltip})]},je):Tt})}),c.jsx("div",{className:"max-w-full sm:max-w-[var(--thread-max-width)] mx-auto",children:c.jsx(lC,{onSend:cn,isSending:Ee,variant:"welcome",isSessionsPanelOpen:z})}),c.jsx("div",{className:"text-xs text-muted-foreground space-y-1 text-center",children:c.jsxs("p",{children:["๐ก Try",c.jsx("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs ml-1",children:"โK"})," ","for new chat,",c.jsx("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs ml-1",children:"โJ"})," ","for tools,",c.jsx("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs ml-1",children:"โL"})," ","for playground,",c.jsx("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs ml-1",children:"โโซ"})," ","to delete session,",c.jsx("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs ml-1",children:"โ/"})," ","for shortcuts"]})})]})}):c.jsx("div",{className:"flex-1 min-h-0 overflow-hidden min-w-0",children:c.jsx("div",{ref:on,className:"h-full overflow-y-auto overflow-x-hidden overscroll-contain relative min-w-0",children:c.jsxs("div",{className:"min-h-full grid grid-cols-1 grid-rows-[1fr_auto] min-w-0",children:[c.jsx("div",{className:"w-full max-w-full sm:max-w-[var(--thread-max-width)] mx-0 sm:mx-auto min-w-0",children:c.jsx(JH,{messages:n,processing:g,activeError:f,onDismissError:h,outerRef:Hn,pendingApproval:ot,onApprovalApprove:J==null?void 0:J.onApprove,onApprovalDeny:J==null?void 0:J.onDeny})}),c.jsxs("div",{className:"sticky bottom-0 z-10 px-0 sm:px-4 pt-2 pb-2 bg-background relative",style:{paddingBottom:"calc(env(safe-area-inset-bottom, 0px) + 0.5rem)",marginBottom:"calc(env(safe-area-inset-bottom, 0px) * -1)"},children:[ci&&c.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 -top-3 z-20 pointer-events-none",children:c.jsxs("button",{onClick:()=>{vs(!1),ft("smooth")},className:"pointer-events-auto px-3 py-1.5 rounded-full shadow-sm bg-background/95 border border-border/60 backdrop-blur supports-[backdrop-filter]:bg-background/80 text-sm text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1.5",children:[c.jsx("span",{children:"Scroll to bottom"}),c.jsx(Ar,{className:"h-3.5 w-3.5"})]})}),c.jsx("div",{className:"w-full max-w-full sm:max-w-[var(--thread-max-width)] mx-0 sm:mx-auto pointer-events-auto",children:c.jsx(lC,{onSend:cn,isSending:Ee,variant:"chat",isSessionsPanelOpen:z})})]})]})})})}),c.jsx("div",{className:ae("hidden md:block shrink-0 transition-all duration-300 ease-in-out border-l border-border/50 bg-card/50 backdrop-blur-sm",E?"w-80":"w-0 overflow-hidden"),children:E&&c.jsx(dC,{isOpen:E,onClose:()=>R(!1),onOpenConnectModal:()=>A(!0),onOpenConnectWithPrefill:xe=>{Te(xe),A(!0)},onServerConnected:xe=>{ys(je=>je+1),Oe(`Added ${xe}`),setTimeout(()=>Oe(null),4e3)},variant:"inline",refreshTrigger:Wi})}),c.jsx("div",{className:"md:hidden",children:c.jsx(dC,{isOpen:E,onClose:()=>R(!1),onOpenConnectModal:()=>A(!0),onOpenConnectWithPrefill:xe=>{Te(xe),A(!0)},onServerConnected:xe=>{ys(je=>je+1),Oe(`Added ${xe}`),setTimeout(()=>Oe(null),4e3)},variant:"overlay",refreshTrigger:Wi})})]}),c.jsx(aQ,{isOpen:L,onClose:()=>ne(!1),variant:"overlay"}),c.jsx(yR,{isOpen:j,onClose:()=>{A(!1),et(!1),Te(null)},onServerConnected:async()=>{var je;if(de!=null&&de.registryEntryId)try{await Ns.setInstalled(de.registryEntryId,!0)}catch(Tt){console.warn("Failed to mark registry entry installed:",Tt)}ys(Tt=>Tt+1);const xe=(de==null?void 0:de.name)||"Server";Oe(`Added ${xe}`),setTimeout(()=>Oe(null),4e3),(je=de==null?void 0:de.onCloseRegistryModal)==null||je.call(de),et(!1),Te(null)},initialName:de==null?void 0:de.name,initialConfig:de==null?void 0:de.config,lockName:de==null?void 0:de.lockName}),c.jsx(Rb,{isOpen:I,onClose:()=>T(!1),onInstallServer:Go,onOpenConnectModal:()=>A(!0),refreshTrigger:Wi,disableClose:it}),c.jsx(rr,{open:M,onOpenChange:V,children:c.jsxs(sr,{className:"sm:max-w-2xl",children:[c.jsxs(ir,{children:[c.jsxs(ar,{className:"flex items-center space-x-2",children:[c.jsx(Sh,{className:"h-5 w-5"}),c.jsx("span",{children:"Export Configuration"})]}),c.jsxs(Yr,{children:["Download your tool configuration for Claude Desktop or other MCP clients",s&&c.jsxs("span",{className:"block mt-1 text-sm text-muted-foreground",children:["Including session-specific settings for:"," ",c.jsx("span",{className:"font-mono",children:s})]})]})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qt,{htmlFor:"filename",children:"File name"}),c.jsx(st,{id:"filename",value:pe,onChange:xe=>Pe(xe.target.value),placeholder:"dexto-config",className:"font-mono"})]}),Ne&&c.jsxs(ds,{variant:"destructive",children:[c.jsx(Ln,{className:"h-4 w-4"}),c.jsx($K,{children:"Export Error"}),c.jsx(fs,{children:Ne})]}),Fe&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qt,{children:"Configuration Preview"}),c.jsx(Kd,{value:Fe,readOnly:!0,className:"h-32 font-mono text-xs bg-muted/30"})]})]}),c.jsxs(Kr,{children:[c.jsx(ye,{variant:"outline",onClick:Wn,className:"flex items-center space-x-2",children:c.jsx("span",{children:$e?"Copied!":"Copy"})}),c.jsxs(ye,{onClick:zn,className:"flex items-center space-x-2",children:[c.jsx(Sh,{className:"h-4 w-4"}),c.jsx("span",{children:"Download"})]})]})]})}),c.jsx(uQ,{isOpen:U,onClose:()=>H(!1)}),c.jsx(jG,{isOpen:ie,onClose:()=>P(!1),variant:"modal"}),c.jsx(rr,{open:be,onOpenChange:Se,children:c.jsxs(sr,{className:"sm:max-w-md",children:[c.jsxs(ir,{children:[c.jsxs(ar,{className:"flex items-center space-x-2",children:[c.jsx(Zn,{className:"h-5 w-5 text-destructive"}),c.jsx("span",{children:"Delete Conversation"})]}),c.jsxs(Yr,{children:["This will permanently delete this conversation and all its messages. This action cannot be undone.",s&&c.jsxs("span",{className:"block mt-2 font-medium",children:["Session:"," ",c.jsx("span",{className:"font-mono",children:s})]})]})]}),c.jsxs(Kr,{children:[c.jsx(ye,{variant:"outline",onClick:()=>Se(!1),children:"Cancel"}),c.jsxs(ye,{variant:"destructive",onClick:Bs,disabled:Ae.isPending,className:"flex items-center space-x-2",children:[c.jsx(Zn,{className:"h-4 w-4"}),c.jsx("span",{children:Ae.isPending?"Deleting...":"Delete Conversation"})]})]})]})}),c.jsx(rr,{open:ve,onOpenChange:ue,children:c.jsxs(sr,{className:"sm:max-w-md",children:[c.jsx(ir,{children:c.jsxs(ar,{className:"flex items-center space-x-2",children:[c.jsx(Sx,{className:"h-5 w-5"}),c.jsx("span",{children:"Keyboard Shortcuts"})]})}),c.jsx("div",{className:"space-y-3",children:[{key:"โH",desc:"Toggle chat history panel"},{key:"โK",desc:"Create new chat"},{key:"โJ",desc:"Toggle tools panel"},{key:"โM",desc:"Toggle memories panel"},{key:"โE",desc:"Customize agent"},{key:"โโงS",desc:"Search conversations"},{key:"โL",desc:"Open MCP playground"},{key:"โโงE",desc:"Export config"},{key:"โ/",desc:"Show shortcuts"},{key:"โโซ",desc:"Delete current session"},{key:"Esc",desc:"Close panels"}].map((xe,je)=>c.jsxs("div",{className:"flex justify-between items-center py-1",children:[c.jsx("span",{className:"text-sm text-muted-foreground",children:xe.desc}),c.jsx(yn,{variant:"outline",className:"font-mono text-xs",children:xe.key})]},je))}),c.jsx(Kr,{children:c.jsx(HO,{asChild:!0,children:c.jsx(ye,{variant:"outline",children:"Close"})})})]})})]}),c.jsx(OG,{isOpen:G,onClose:()=>F(!1),onNavigateToSession:xe=>{e({to:`/chat/${xe}`}),F(!1)}}),c.jsx(CG,{onApprovalRequest:dt,onHandlersReady:me})]})}function EQ(){return c.jsx(gM,{})}function TQ(){const{sessionId:t}=T3({from:"/chat/$sessionId"});return c.jsxs(c.Fragment,{children:[c.jsxs(qb,{children:[c.jsx("title",{children:"Chat ยท Dexto"}),c.jsx("meta",{name:"description",content:`Chat session ${t}`})]}),c.jsx(gM,{sessionId:t})]})}function Wl({className:t,...e}){return c.jsx("div",{className:ae("animate-pulse rounded-md bg-muted",t),...e})}function AQ({servers:t,selectedServer:e,isLoading:n,error:r,searchQuery:s,onSearchChange:a,onServerSelect:l,onConnectNew:u}){const f=t.filter(p=>p.name.toLowerCase().includes(s.toLowerCase())),h=p=>{switch(p){case"connected":return c.jsx(Es,{className:"h-3 w-3"});case"error":return c.jsx(qa,{className:"h-3 w-3"});case"disconnected":default:return c.jsx(Ms,{className:"h-3 w-3 animate-spin"})}},g=p=>{switch(p){case"connected":return"bg-green-100 text-green-700 dark:bg-green-700/20 dark:text-green-400";case"error":return"bg-red-100 text-red-700 dark:bg-red-700/20 dark:text-red-400";case"disconnected":return"bg-slate-100 text-slate-600 dark:bg-slate-700/20 dark:text-slate-400";default:return"bg-yellow-100 text-yellow-700 dark:bg-yellow-700/20 dark:text-yellow-400"}};return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"pb-3 mb-3 border-b border-border",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[c.jsx(Bi,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"MCP Servers"}),n&&t.length===0&&c.jsx(Ms,{className:"h-3 w-3 animate-spin text-muted-foreground ml-auto"})]}),c.jsx(st,{placeholder:"Search servers...",value:s,onChange:p=>a(p.target.value),className:"h-8 text-sm"})]}),r&&t.length===0&&!n&&c.jsxs("div",{className:"p-3 bg-destructive/10 text-destructive text-sm rounded-md",children:[c.jsx("p",{className:"font-medium",children:"Error loading servers"}),c.jsx("p",{className:"text-xs mt-1",children:r})]}),n&&t.length===0&&c.jsx("div",{className:"flex-1 space-y-2 pr-1",children:[1,2,3].map(p=>c.jsx("div",{className:"p-2.5 rounded-lg border border-border",children:c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx(Wl,{className:"h-4 flex-1"}),c.jsx(Wl,{className:"h-5 w-16"})]})},p))}),t.length===0&&!n&&!r&&c.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:c.jsxs("div",{className:"text-center",children:[c.jsx(Bi,{className:"h-8 w-8 mx-auto text-muted-foreground/50 mb-2"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"No servers available"}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Connect a server to get started"})]})}),f.length>0&&c.jsx("div",{className:"flex-1 overflow-y-auto space-y-1 pr-1",children:f.map(p=>c.jsx("button",{onClick:()=>p.status==="connected"&&l(p),disabled:p.status!=="connected",className:ae("w-full p-2.5 rounded-lg text-left transition-all duration-200","hover:shadow-sm border border-transparent",(e==null?void 0:e.id)===p.id?"bg-primary text-primary-foreground shadow-sm border-primary/20":"hover:bg-muted hover:border-border",p.status!=="connected"&&"opacity-50 cursor-not-allowed"),title:p.status!=="connected"?`${p.name} is ${p.status}`:p.name,children:c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"font-medium text-sm truncate",children:p.name}),c.jsxs(yn,{variant:"secondary",className:ae("text-xs px-1.5 py-0 h-5 flex items-center gap-1",g(p.status)),children:[h(p.status),p.status]})]})},p.id))}),f.length===0&&t.length>0&&c.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"No servers match your search"})}),c.jsxs(ye,{onClick:u,variant:"outline",className:"mt-auto w-full sticky bottom-0 bg-background",size:"sm",children:[c.jsx(Bi,{className:"h-4 w-4 mr-2"}),"Connect New Server"]})]})}function OQ({tools:t,selectedTool:e,selectedServer:n,isLoading:r,error:s,searchQuery:a,onSearchChange:l,onToolSelect:u}){const f=t.filter(h=>{var g;return h.name.toLowerCase().includes(a.toLowerCase())||((g=h.description)==null?void 0:g.toLowerCase().includes(a.toLowerCase()))});return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"pb-3 mb-3 border-b border-border",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[c.jsx(Ii,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Tools"}),r&&t.length===0&&c.jsx(Ms,{className:"h-3 w-3 animate-spin text-muted-foreground ml-auto"}),t.length>0&&c.jsx(yn,{variant:"secondary",className:"ml-auto text-xs",children:f.length})]}),t.length>0&&c.jsxs("div",{className:"relative",children:[c.jsx(As,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),c.jsx(st,{placeholder:"Search tools...",value:a,onChange:h=>l(h.target.value),className:"h-8 text-sm pl-7"})]})]}),!n&&c.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:c.jsxs("div",{className:"text-center",children:[c.jsx(Ii,{className:"h-8 w-8 mx-auto text-muted-foreground/50 mb-2"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a server"}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Choose a connected server to view its tools"})]})}),n&&n.status!=="connected"&&c.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:c.jsxs("div",{className:"text-center",children:[c.jsx(Ii,{className:"h-8 w-8 mx-auto text-muted-foreground/50 mb-2"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Server not connected"}),c.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:['"',n.name,'" is ',n.status]})]})}),s&&(n==null?void 0:n.status)==="connected"&&!r&&c.jsxs("div",{className:"p-3 bg-destructive/10 text-destructive text-sm rounded-md",children:[c.jsx("p",{className:"font-medium",children:"Error loading tools"}),c.jsx("p",{className:"text-xs mt-1",children:s})]}),r&&(n==null?void 0:n.status)==="connected"&&t.length===0&&c.jsx("div",{className:"flex-1 space-y-2 pr-1",children:[1,2,3,4].map(h=>c.jsx("div",{className:"p-3 rounded-lg border border-border",children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(Wl,{className:"h-4 w-4 mt-0.5 flex-shrink-0 rounded-full"}),c.jsxs("div",{className:"flex-1 space-y-2",children:[c.jsx(Wl,{className:"h-4 w-3/4"}),c.jsx(Wl,{className:"h-3 w-full"}),c.jsx(Wl,{className:"h-3 w-5/6"})]})]})},h))}),n&&n.status==="connected"&&!r&&t.length===0&&!s&&c.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:c.jsxs("div",{className:"text-center",children:[c.jsx(Ii,{className:"h-8 w-8 mx-auto text-muted-foreground/50 mb-2"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"No tools available"}),c.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["No tools found for ",n.name]})]})}),f.length>0&&c.jsx("div",{className:"flex-1 overflow-y-auto space-y-1 pr-1",children:f.map(h=>c.jsx("button",{onClick:()=>u(h),className:ae("w-full p-3 rounded-lg text-left transition-all duration-200","hover:shadow-sm border border-transparent",(e==null?void 0:e.id)===h.id?"bg-primary text-primary-foreground shadow-sm border-primary/20":"hover:bg-muted hover:border-border"),children:c.jsx("div",{className:"flex items-start gap-2",children:c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("h3",{className:"font-medium text-sm truncate",children:h.name}),h.description&&c.jsx("p",{className:ae("text-xs mt-1 line-clamp-2",(e==null?void 0:e.id)===h.id?"text-primary-foreground/80":"text-muted-foreground"),children:h.description})]})})},h.id))}),f.length===0&&t.length>0&&c.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:c.jsxs("div",{className:"text-center",children:[c.jsx(As,{className:"h-8 w-8 mx-auto text-muted-foreground/50 mb-2"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"No tools match your search"}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Try a different search term"})]})})]})}const RQ=[{name:"Quick Test",description:"Fill with test values",apply:t=>{var n;const e={};return(n=t.inputSchema)!=null&&n.properties&&Object.entries(t.inputSchema.properties).forEach(([r,s])=>{s.type==="string"?e[r]=`test-${r}`:s.type==="number"?e[r]=42:s.type==="boolean"?e[r]=!0:s.type==="object"?e[r]='{"example": "value"}':s.type==="array"&&(e[r]='["example"]')}),e}},{name:"Required Only",description:"Fill only required fields",apply:t=>{var n,r;const e={};return(n=t.inputSchema)!=null&&n.properties&&((r=t.inputSchema)!=null&&r.required)&&t.inputSchema.required.forEach(s=>{const a=t.inputSchema.properties[s];a.type==="string"||a.type==="number"?e[s]="":a.type==="boolean"?e[s]=!1:a.type==="object"?e[s]="{}":a.type==="array"&&(e[s]="[]")}),e}},{name:"Clear All",description:"Clear all fields",apply:()=>({})}];function MQ({tool:t,inputs:e,errors:n,isLoading:r,onInputChange:s,onSubmit:a,onCopyConfig:l,onShareConfig:u}){var g;const f=((g=t.inputSchema)==null?void 0:g.properties)&&Object.keys(t.inputSchema.properties).length>0,h=(p,x)=>{var N,C;const y=(C=(N=t.inputSchema)==null?void 0:N.required)==null?void 0:C.includes(p),k=n[p],w=`w-full ${k?"border-destructive focus-visible:ring-destructive":""}`;if(x.enum&&Array.isArray(x.enum)){const j=x.enum.every(I=>typeof I=="boolean"),A=x.enum.every(I=>typeof I=="number");return c.jsxs(rw,{value:e[p]===void 0&&x.default!==void 0?String(x.default):String(e[p]||""),onValueChange:I=>{let T=I;j?T=I==="true":A&&(T=Number(I)),s(p,T,x.type)},disabled:r,children:[c.jsx(iw,{id:p,className:w,children:c.jsx(sw,{placeholder:`Select ${x.description||p}${y?"":" (optional)"}...`})}),c.jsx(aw,{children:x.enum.map(I=>c.jsx(ac,{value:String(I),children:String(I)},String(I)))})]})}if(x.type==="boolean")return c.jsx($m,{id:p,checked:e[p]===void 0&&x.default!==void 0?!!x.default:!!e[p],onCheckedChange:j=>s(p,j,x.type),disabled:r,className:k?"border-destructive ring-destructive":""});if(x.type==="object"||x.type==="array")return c.jsx(Kd,{id:p,value:e[p]===void 0&&x.default!==void 0?JSON.stringify(x.default,null,2):e[p]||"",onChange:j=>s(p,j.target.value,x.type),rows:5,className:`${w} font-mono text-sm min-h-[100px] resize-y`,placeholder:`Enter JSON for ${x.description||p}`,disabled:r});let S="text";return(x.type==="number"||x.type==="integer")&&(S="number"),x.format==="date-time"&&(S="datetime-local"),x.format==="date"&&(S="date"),x.format==="email"&&(S="email"),x.format==="uri"&&(S="url"),x.format==="password"&&(S="password"),c.jsx(st,{type:S,id:p,value:e[p]===void 0&&x.default!==void 0?String(x.default):String(e[p]||""),onChange:j=>s(p,j.target.value,x.type),className:w,placeholder:x.description||`Enter ${p}`,disabled:r,step:x.type==="number"||x.type==="integer"?"any":void 0})};return c.jsxs("form",{onSubmit:p=>{p.preventDefault(),a()},className:"space-y-5 p-4 border border-border rounded-lg bg-card shadow-sm",children:[f&&c.jsxs("div",{className:"border-b border-border pb-4",children:[c.jsx("h4",{className:"text-sm font-medium mb-2 text-muted-foreground",children:"Quick Fill"}),c.jsx("div",{className:"flex flex-wrap gap-2",children:RQ.map((p,x)=>c.jsx(ye,{type:"button",variant:"outline",size:"sm",onClick:()=>{const y=p.apply(t);Object.entries(y).forEach(([k,w])=>{var N,C;const S=(C=(N=t.inputSchema)==null?void 0:N.properties)==null?void 0:C[k];s(k,w,S==null?void 0:S.type)})},className:"text-xs",title:p.description,children:p.name},x))})]}),!f&&c.jsx("p",{className:"text-sm text-muted-foreground py-2",children:"This tool does not require any inputs."}),f&&Object.entries(t.inputSchema.properties).map(([p,x])=>{var w,S;const y=(S=(w=t.inputSchema)==null?void 0:w.required)==null?void 0:S.includes(p),k=n[p];return c.jsxs("div",{className:"grid gap-1.5",children:[c.jsxs("div",{className:`flex ${x.type==="boolean"?"flex-row items-center space-x-3":"flex-col"}`,children:[c.jsxs(Qt,{htmlFor:p,className:`${x.type==="boolean"?"leading-none cursor-pointer peer-disabled:cursor-not-allowed peer-disabled:opacity-70":"capitalize font-medium"}`,children:[x.description||p.replace(/([A-Z]+(?=[A-Z][a-z]))|([A-Z][a-z])/g," $&").trim().replace(/_/g," "),y&&c.jsx("span",{className:"text-destructive text-lg ml-0.5",children:"*"})]}),x.type==="boolean"?h(p,x):c.jsx("div",{className:"w-full",children:h(p,x)})]}),k&&c.jsx("p",{className:"text-xs text-destructive",children:k})]},p)}),c.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[c.jsx(ye,{type:"submit",disabled:r||Object.keys(n).some(p=>n[p]!==""),className:"flex-1",children:r?"Executing...":c.jsxs(c.Fragment,{children:[c.jsx(np,{className:"h-4 w-4 mr-2"}),"Run Tool"]})}),f&&Object.keys(e).length>0&&c.jsxs(c.Fragment,{children:[l&&c.jsxs(ye,{type:"button",variant:"outline",size:"sm",onClick:l,children:[c.jsx(Pd,{className:"h-3 w-3 mr-2"}),"Copy"]}),u&&c.jsxs(ye,{type:"button",variant:"outline",size:"sm",onClick:u,children:[c.jsx(kz,{className:"h-3 w-3 mr-2"}),"Share"]})]})]})]})}function DQ({result:t,toolName:e,onCopyResult:n}){const r=()=>{if(t.data&&typeof t.data=="object"&&(Array.isArray(t.data)||typeof t.data=="object"&&Array.isArray(t.data.content))&&t.data){let a="",l=null,u=[];if(Array.isArray(t.data))l=t.data.find(f=>f&&f.type==="image"),l&&typeof l.data=="string"&&l.mimeType&&(a=`data:${l.mimeType};base64,${l.data}`);else if(t.data&&typeof t.data=="object"&&Array.isArray(t.data.content)){const f=t.data.content;l=f.find(h=>h&&h.type==="image"),l&&typeof l.data=="string"&&l.mimeType&&(a=`data:${l.mimeType};base64,${l.data}`),u=f.filter(h=>h&&h.type!=="image")}else typeof t.data=="string"&&(t.data.startsWith("data:image")||t.data.startsWith("http://")||t.data.startsWith("https://"))&&(a=t.data);if(a)return c.jsx("img",{src:a,alt:"Tool result",className:"my-2 max-h-96 w-auto rounded-lg border border-border shadow-sm"});if(u.length>0)return c.jsx("div",{className:"space-y-3",children:u.map((f,h)=>c.jsx("pre",{className:"whitespace-pre-wrap text-sm bg-muted/50 p-3 rounded-md border border-border font-mono overflow-x-auto max-h-64",children:typeof f=="object"?JSON.stringify(f,null,2):String(f)},h))})}return c.jsx("pre",{className:"whitespace-pre-wrap text-sm bg-muted/50 p-3 rounded-md border border-border overflow-x-auto",children:typeof t.data=="object"?JSON.stringify(t.data,null,2):String(t.data)})};return c.jsxs("div",{className:"mt-6 p-4 border border-border rounded-lg bg-card shadow-sm",children:[c.jsxs("div",{className:"flex justify-between items-center mb-3 pb-3 border-b border-border",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[t.success?c.jsx(Ts,{className:"h-5 w-5 text-green-500"}):c.jsx(rb,{className:"h-5 w-5 text-red-500"}),c.jsx("h3",{className:"text-base font-semibold text-foreground",children:t.success?"Success":"Error"}),c.jsxs("span",{className:"text-sm text-muted-foreground",children:["โข ",e]})]}),n&&t.success&&c.jsxs(ye,{variant:"outline",size:"sm",onClick:n,children:[c.jsx(Pd,{className:"h-3 w-3 mr-2"}),"Copy Result"]})]}),t.success?c.jsx("div",{className:"space-y-3",children:r()}):c.jsxs("div",{className:"p-3 bg-destructive/10 rounded-md",children:[c.jsx("p",{className:"text-sm text-destructive font-semibold",children:"Error executing tool:"}),c.jsx("pre",{className:"mt-1 text-xs text-destructive whitespace-pre-wrap break-all",children:t.error||"Unknown error"})]})]})}function IQ({history:t}){if(t.length===0)return null;const e=t.filter(r=>r.success).length,n=t.filter(r=>!r.success).length;return c.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[c.jsxs("div",{className:"flex items-center justify-between mb-3",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(WE,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Execution History"}),c.jsx(yn,{variant:"secondary",className:"text-xs",children:t.length})]}),c.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(Ts,{className:"h-3 w-3 text-green-500"}),c.jsx("span",{children:e})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(rb,{className:"h-3 w-3 text-red-500"}),c.jsx("span",{children:n})]})]})]}),c.jsx(Yd,{className:"h-32",children:c.jsx("div",{className:"space-y-2",children:t.map(r=>c.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md bg-muted/50 hover:bg-muted transition-colors",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[r.success?c.jsx(Ts,{className:"h-3 w-3 text-green-500 flex-shrink-0"}):c.jsx(rb,{className:"h-3 w-3 text-red-500 flex-shrink-0"}),c.jsx("span",{className:"text-sm font-medium truncate",children:r.toolName})]}),c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.duration&&c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(_$,{className:"h-3 w-3"}),r.duration,"ms"]}),c.jsx("span",{children:new Date(r.timestamp).toLocaleTimeString()})]})]},r.id))})})]})}function LQ(){const[t,e]=_.useState(null),[n,r]=_.useState(null),[s,a]=_.useState({}),[l,u]=_.useState(null),[f,h]=_.useState(null),[g,p]=_.useState({}),[x,y]=_.useState(!1),[k,w]=_.useState(!1),[S,N]=_.useState([]),[C,j]=_.useState(null),[A,I]=_.useState(""),[T,E]=_.useState(""),[R,z]=_.useState(!0),[D,B]=_.useState(!0),q=_.useRef(null),{data:K=[],isLoading:G,error:F,refetch:M}=TE(),{data:V=[],isLoading:U,error:H}=AE((t==null?void 0:t.id)||null,!!t&&t.status==="connected"),L=(Q,_e)=>{console.error(`Playground Error (${_e||"general"}):`,Q),_e!=="input"&&h(Q)},ne=_.useCallback(Q=>{e(Q),r(null),u(null),h(null),p({})},[]),ie=_.useCallback(Q=>{r(Q),u(null),h(null),p({});const _e={};if(Q.inputSchema&&Q.inputSchema.properties)for(const Oe in Q.inputSchema.properties){const le=Q.inputSchema.properties[Oe];le.default!==void 0?_e[Oe]=le.default:le.type==="boolean"?_e[Oe]=!1:(le.type==="number"||le.type==="integer"||le.type==="object"||le.type,_e[Oe]="")}a(_e)},[]),P=_.useCallback((Q,_e,Oe)=>{if(a(le=>({...le,[Q]:_e})),g[Q]&&p(le=>({...le,[Q]:""})),Oe==="object"||Oe==="array"){if(_e==="")return;try{JSON.parse(_e)}catch{p(le=>({...le,[Q]:"Invalid JSON format"}));return}}},[g]),pe=_.useCallback(()=>{var Oe;if(!n||!n.inputSchema||!n.inputSchema.properties)return!0;const Q={};let _e=!0;for(const le in n.inputSchema.properties){const he=n.inputSchema.properties[le],Ee=s[le];if((Oe=n.inputSchema.required)!=null&&Oe.includes(le)&&(Ee===void 0||Ee===""||he.type==="boolean"&&typeof Ee!="boolean")){Q[le]="This field is required.",_e=!1;continue}if((he.type==="number"||he.type==="integer")&&Ee!==""&&isNaN(Number(Ee))&&(Q[le]="Must be a valid number.",_e=!1),(he.type==="object"||he.type==="array")&&Ee!=="")try{JSON.parse(Ee)}catch{Q[le]="Invalid JSON format.",_e=!1}}return p(Q),_e},[n,s]),Pe=_.useCallback(async()=>{var le;if(!t||!n){L("No server or tool selected for execution.","execution");return}(le=q.current)==null||le.abort();const Q=new AbortController;if(q.current=Q,h(null),u(null),!pe()){L("Please correct the input errors.","input");return}const _e=Date.now(),Oe=`exec_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;w(!0);try{const he={};if(n.inputSchema&&n.inputSchema.properties)for(const ue in n.inputSchema.properties){const Ce=n.inputSchema.properties[ue];let ze=s[ue];if(Ce.type==="number")ze=ze===""?void 0:Number(ze);else if(Ce.type==="integer")if(ze==="")ze=void 0;else{const be=Number(ze);if(!Number.isInteger(be)){p(Se=>({...Se,[ue]:"Must be a valid integer."})),w(!1);return}ze=be}else if(Ce.type==="boolean")typeof ze=="string"?ze=ze==="true":ze=!!ze;else if((Ce.type==="object"||Ce.type==="array")&&typeof ze=="string"&&ze.trim()!=="")try{ze=JSON.parse(ze)}catch{p(be=>({...be,[ue]:"Invalid JSON before sending."})),w(!1);return}else(Ce.type==="object"||Ce.type==="array")&&(ze===void 0||ze==="")&&(ze=void 0);ze!==void 0&&(he[ue]=ze)}const Ee=await mt.api.mcp.servers[":serverId"].tools[":toolName"].execute.$post({param:{serverId:t.id,toolName:n.id},json:he},{init:{signal:Q.signal}});if(!Ee.ok)throw new Error("Tool execution failed");const De=await Ee.json(),ve=Date.now()-_e;u(De),N(ue=>[{id:Oe,toolName:n.name,timestamp:new Date,success:!0,duration:ve},...ue.slice(0,9)])}catch(he){if(he.name!=="AbortError"){const Ee=Date.now()-_e;L(he.message,"execution"),he.message&&(!l||l.success||l.error!==he.message)&&u({success:!1,error:he.message}),N(De=>[{id:Oe,toolName:(n==null?void 0:n.name)||"Unknown",timestamp:new Date,success:!1,duration:Ee},...De.slice(0,9)])}}finally{Q.signal.aborted||w(!1)}},[t,n,s,pe,l]),Ne=()=>{y(!1),M()},ge=async(Q,_e)=>{try{await navigator.clipboard.writeText(Q),j({message:_e||"Copied to clipboard",type:"success"}),setTimeout(()=>j(null),3e3)}catch(Oe){j({message:"Failed to copy to clipboard. Please check browser permissions.",type:"error"}),setTimeout(()=>j(null),5e3),console.error("Failed to copy to clipboard:",Oe)}},Fe=()=>{if(!n||!t)return;const Q={server:t.name,tool:n.name,inputs:s,timestamp:new Date().toISOString()};ge(JSON.stringify(Q,null,2),"Tool configuration copied!")},Qe=()=>{if(!l)return;const Q=typeof l.data=="object"?JSON.stringify(l.data,null,2):String(l.data);ge(Q,"Tool result copied!")},$e=()=>{if(!n||!t)return;const Q=`Check out this Dexto tool configuration:
|
|
684
|
-
|
|
685
|
-
Server: ${t.name}
|
|
686
|
-
Tool: ${n.name}
|
|
687
|
-
Inputs: ${JSON.stringify(s,null,2)}`;navigator.share?navigator.share({title:`Dexto Tool: ${n.name}`,text:Q}):ge(Q,"Tool configuration copied for sharing!")};return c.jsxs("div",{className:"flex h-screen bg-background text-foreground antialiased",children:[c.jsx("aside",{className:ae("w-72 flex-shrink-0 border-r border-border bg-card p-4 flex flex-col transition-all duration-300","lg:relative lg:translate-x-0",R?"translate-x-0":"-translate-x-full absolute lg:w-0 lg:p-0 lg:border-0"),children:R&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center justify-between pb-3 mb-3 border-b border-border",children:[c.jsx(DC,{to:"/",children:c.jsxs(ye,{variant:"outline",size:"sm",className:"gap-1.5",children:[c.jsx(Tj,{className:"h-4 w-4"}),"Back"]})}),c.jsx(ye,{variant:"ghost",size:"sm",onClick:()=>z(!1),className:"lg:hidden",children:c.jsx(lz,{className:"h-4 w-4"})})]}),c.jsx(AQ,{servers:K,selectedServer:t,isLoading:G,error:(F==null?void 0:F.message)||f,searchQuery:A,onSearchChange:I,onServerSelect:ne,onConnectNew:()=>y(!0)})]})}),c.jsx("aside",{className:ae("w-80 flex-shrink-0 border-r border-border bg-card p-4 flex flex-col transition-all duration-300","lg:relative lg:translate-x-0",D?"translate-x-0":"-translate-x-full absolute lg:w-0 lg:p-0 lg:border-0"),children:D&&c.jsx(OQ,{tools:V,selectedTool:n,selectedServer:t,isLoading:U,error:(H==null?void 0:H.message)||((t==null?void 0:t.status)==="connected"?f:null),searchQuery:T,onSearchChange:E,onToolSelect:ie})}),c.jsxs("main",{className:"flex-1 p-6 flex flex-col bg-muted/30 overflow-y-auto",children:[c.jsx("div",{className:"pb-3 mb-4 border-b border-border",children:c.jsx("div",{className:"flex items-center justify-between",children:c.jsxs("div",{className:"flex items-center gap-2",children:[!R&&c.jsx(ye,{variant:"outline",size:"sm",onClick:()=>z(!0),className:"lg:hidden",children:c.jsx(ib,{className:"h-4 w-4"})}),!D&&c.jsx(ye,{variant:"outline",size:"sm",onClick:()=>B(!0),className:"lg:hidden",children:c.jsx(ib,{className:"h-4 w-4"})}),c.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Tool Runner"})]})})}),C&&c.jsxs(ds,{variant:C.type==="error"?"destructive":"default",className:ae("mb-4",C.type==="success"&&"border-green-200 bg-green-50 text-green-800 dark:border-green-800 dark:bg-green-950 dark:text-green-400"),children:[C.type==="error"&&c.jsx(Ln,{className:"h-4 w-4"}),C.type==="success"&&c.jsx(Ts,{className:"h-4 w-4"}),c.jsx(fs,{children:C.message})]}),f&&n&&(!l||!l.success)&&c.jsxs("div",{className:"mb-4 p-3 border border-destructive/50 bg-destructive/10 rounded-md text-destructive text-sm",children:[c.jsx("p",{className:"font-medium",children:"Error:"}),c.jsx("p",{children:f})]}),!n&&c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsxs("div",{className:"text-center max-w-md",children:[c.jsx("div",{className:"mb-4",children:c.jsx(Tj,{className:"h-12 w-12 mx-auto text-muted-foreground opacity-50"})}),c.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Select a Tool"}),c.jsx("p",{className:"text-muted-foreground text-sm",children:"Choose a tool from the left panel to start testing and experimenting with MCP capabilities."})]})}),n&&c.jsxs("div",{className:"space-y-6",children:[c.jsx("div",{className:"p-4 border border-border rounded-lg bg-card shadow-sm",children:c.jsxs("div",{className:"flex justify-between items-start",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-base font-semibold text-primary mb-1",children:n.name}),n.description&&c.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]}),c.jsxs("div",{className:"text-right text-xs text-muted-foreground",children:[c.jsxs("p",{children:["Server: ",t==null?void 0:t.name]}),S.filter(Q=>Q.toolName===n.name).length>0&&c.jsxs("p",{children:["Runs:"," ",S.filter(Q=>Q.toolName===n.name).length]})]})]})}),c.jsx(MQ,{tool:n,inputs:s,errors:g,isLoading:k,onInputChange:P,onSubmit:Pe,onCopyConfig:Fe,onShareConfig:$e}),l&&c.jsx(DQ,{result:l,toolName:n.name,onCopyResult:Qe}),c.jsx(IQ,{history:S})]})]}),c.jsx(yR,{isOpen:x,onClose:Ne})]})}function PQ(){return c.jsxs(c.Fragment,{children:[c.jsxs(qb,{children:[c.jsx("title",{children:"Playground ยท Dexto"}),c.jsx("meta",{name:"description",content:"Test MCP tools in an interactive playground"})]}),c.jsx(LQ,{})]})}function $Q(){return c.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:c.jsxs("div",{className:"text-center space-y-6",children:[c.jsx("h1",{className:"text-6xl font-bold text-foreground",children:"404"}),c.jsx("p",{className:"text-xl text-muted-foreground",children:"Page not found"}),c.jsx(ye,{variant:"default",className:"gap-2",asChild:!0,children:c.jsxs(DC,{to:"/",children:[c.jsx(q$,{className:"h-4 w-4"}),"Return Home"]})})]})})}const Lp=A3({component:YL,notFoundComponent:$Q}),zQ=Bb({getParentRoute:()=>Lp,path:"/",component:EQ}),FQ=Bb({getParentRoute:()=>Lp,path:"/chat/$sessionId",component:TQ}),BQ=Bb({getParentRoute:()=>Lp,path:"/playground",component:PQ}),UQ=Lp.addChildren([zQ,FQ,BQ]),qQ=O3({routeTree:UQ,defaultPreload:"intent"});F3.createRoot(document.getElementById("root")).render(c.jsx(nt.StrictMode,{children:c.jsx(R3,{router:qQ})}));
|