@iflow-ai/iflow-cli 0.4.9 → 0.4.10

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/bundle/iflow.js CHANGED
@@ -186,7 +186,7 @@ Saved to: ~/.iflow/output-styles/{{fileName}}.md
186
186
  You can now use it with: /output-style "{{name}}"`,creationFailed:"Failed to create output style: {{error}}",usageNew:`Usage: /output-style:new <description>
187
187
  Example: /output-style:new I want an output style that focuses on security best practices`,emptyResponse:"Empty response from AI model",aiGenerationError:"AI generation failed: {{error}}",unableToCreateUniqueName:'Unable to create a unique name for output style based on "{{name}}". Please try a different description.',customStyleFallback:"Custom output style: {{description}}",commandDescription:"change your output style preferences (use --scope global for global settings)",commandNewDescription:"use '/output-style:new <description>' to create a custom output style"},outputStyles:{default:{name:"Default",description:"IFlow completes coding tasks efficiently and provides concise responses"},explanatory:{name:"Explanatory",description:"IFlow explains its implementation choices and codebase patterns"},learning:{name:"Learning",description:"IFlow pauses and asks you to write small pieces of code for hands-on practice"}},outputStyleDialog:{loadingTitle:"Loading Output Styles...",loadingMessage:"Please wait while we load available output styles...",errorPrefix:"Error: ",pressQToClose:"Press q to close",globalTitle:"Global Output Styles",projectTitle:"Project Output Styles",noStylesAvailable:"No output styles available",currentIndicator:" (current)",navigationTitle:"Navigation:",navigateUpDown:"\u2022 \u2191/\u2193 or j/k - Navigate up/down",confirmAction:"\u2022 Enter - Confirm",exitAction:"\u2022 q - Exit",failedToLoad:"Failed to load output styles"},thinking:{thinking:"Thinking",thinkingWithSubject:"Thinking: {{subject}}",pressEnterToToggle:"(Press Enter to toggle)",moreLines:"... ({{count}} more lines - Press Space to {{action}})",expand:"expand",collapse:"collapse"},todoWrite:{validationErrors:{invalidJsonString:"Invalid JSON string format",todosRequired:"Todos array is required",todoNullUndefined:"Todo at index {{index}} cannot be null or undefined",todoEmptyTask:"Todo at index {{index}} must have a non-empty task",todoInvalidStatus:"Todo at index {{index}} has invalid status: {{status}}",duplicateIds:"Duplicate todo IDs found",multipleInProgress:"Only one task can be in progress at a time"},messages:{invalidParameters:"Invalid todo parameters",errorPrefix:"Todo validation failed: {{reason}}",errorDisplay:"Todo Error: {{error}}",todosModifiedSuccess:"Todo list has been updated successfully"},status:{updatingTodoList:"Updating todo list ({{pending}} pending, {{inProgress}} in progress, {{completed}} completed)",updateTodos:"Updated todo list",noTodos:"no todos"}},lsTool:{errors:{pathNotAbsolute:"Path must be absolute: {{path}}",pathNotInWorkspace:"Path must be within one of the workspace directories: {{directories}}",invalidParameters:"Invalid parameters provided. Reason: {{reason}}",failedToExecute:"Failed to execute tool.",directoryNotFound:"Directory not found or inaccessible: {{path}}",directoryNotFoundShort:"Directory not found or inaccessible.",pathNotDirectory:"Path is not a directory: {{path}}",pathNotDirectoryShort:"Path is not a directory.",listingFailed:"Error listing directory: {{error}}",listingFailedShort:"Failed to list directory."},messages:{directoryEmpty:"Directory {{path}} is empty.",directoryEmptyShort:"Directory is empty.",directoryListing:`Directory listing for {{path}}:
188
188
  {{content}}`,listedItems:"Listed {{count}} item(s).",gitIgnored:"{{count}} git-ignored",iflowIgnored:"{{count}} iflow-ignored"}},geminiStream:{messages:{requestCancelled:"Request cancelled.",compressingContext:"Compressing context to stay within token limits for {{model}}...",contextCompressed:"Context compressed (from {{originalTokenCount}} to {{newTokenCount}} tokens).",maxSessionTurns:"The session has reached the maximum number of turns: {{maxTurns}}. Please update this limit in your setting.json file.",loopDetected:"A potential loop was detected. This can happen due to repetitive tool calls or other model behavior. The request has been halted.",planApprovalResponse:"User has approved your plan. You can now start coding. Start with updating your todo list if applicable"},finishReasons:{maxTokens:"Response truncated due to token limits.",safety:"Response stopped due to safety reasons.",recitation:"Response stopped due to recitation policy.",language:"Response stopped due to unsupported language.",blocklist:"Response stopped due to forbidden terms.",prohibitedContent:"Response stopped due to prohibited content.",spii:"Response stopped due to sensitive personally identifiable information.",other:"Response stopped for other reasons.",malformedFunctionCall:"Response stopped due to malformed function call.",imageSafety:"Response stopped due to image safety violations.",unexpectedToolCall:"Response stopped due to unexpected tool call."}},compressionMessage:{compressingHistory:"Compressing chat history",previousConversationCompressed:"Previous Conversation Compressed",contextCompressed:"Context compressed from {{originalTokenCount}} to {{newTokenCount}} tokens",expandCollapseHint:" (ctrl+r to {{action}} summary)",expand:"expand",collapse:"collapse",summaryLabel:"Summary:",collapseHint:"(ctrl+r to collapse)"},writeFileTool:{errors:{pathNotAbsolute:"File path must be absolute: {{filePath}}",pathNotInWorkspace:"File path must be within one of the workspace directories: {{directories}}",pathIsDirectory:"Path is a directory, not a file: {{filePath}}",accessError:"Error accessing path properties for validation: {{filePath}}. Reason: {{error}}",invalidParameters:"Invalid parameters provided. Reason: {{reason}}",checkingFileError:"Error checking existing file: {{message}}",checkingFileErrorLong:"Error checking existing file {{filePath}}: {{message}}",writingFileError:"Error writing to file: {{error}}",writingFileErrorLong:"Error writing to file {{filePath}}: {{error}}"},messages:{invalidParams:"Model did not provide valid parameters for write file tool",writingTo:"Writing to {{path}}",confirmWrite:"Confirm Write: {{path}}",newFileCreated:"Successfully created and wrote to new file: {{filePath}}.",fileOverwritten:"Successfully overwrote file: {{filePath}}.",userModified:"User modified the `content` to be: {{content}}"}},fileUtils:{errors:{fileNotFound:"File not found.",fileNotFoundLong:"File not found: {{filePath}}",pathIsDirectory:"Path is a directory.",pathIsDirectoryLong:"Path is a directory, not a file: {{filePath}}",fileTooLarge:"File content ({{sizeKB}}KB) exceeds maximum allowed size (256KB). Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific content.",errorReadingFile:"Error reading file {{displayPath}}: {{errorMessage}}",errorParsingPdf:"Error parsing PDF file: {{error}}",errorParsingDocx:"Error parsing DOCX file: {{error}}",errorParsingExcel:"Error parsing Excel file: {{error}}",errorParsingPdfLong:"Error parsing PDF file {{filePath}}: {{error}}",errorParsingDocxLong:"Error parsing DOCX file {{filePath}}: {{error}}",errorParsingExcelLong:"Error parsing Excel file {{filePath}}: {{error}}",imageDescriptionFailed:"Failed to generate image description: {{error}}"},messages:{cannotDisplayBinary:"Cannot display content of binary file: {{path}}",skippedBinaryFile:"Skipped binary file: {{path}}",cannotDisplayLargeSvg:"Cannot display content of SVG file larger than 1MB: {{path}}",skippedLargeSvg:"Skipped large SVG file (>1MB): {{path}}",readSvgAsText:"Read SVG as text: {{path}}",readPdfAsText:"Read PDF file as text: {{path}}",readDocxAsText:"Read DOCX file as text: {{path}}",readExcelAsText:"Read Excel file as text: {{path}}",errorReadingPdf:"Error reading PDF file: {{path}}",errorReadingDocx:"Error reading DOCX file: {{path}}",errorReadingExcel:"Error reading Excel file: {{path}}",readMediaFile:"Read {{fileType}} file: {{path}}",unhandledFileType:"Unhandled file type: {{fileType}}",skippedUnhandledFile:"Skipped unhandled file type: {{path}}",unhandledFileTypeError:"Unhandled file type for {{filePath}}",fileTruncatedLines:"[File content truncated: showing lines {{startLine}}-{{endLine}} of {{totalLines}} total lines. Use offset/limit parameters to view more.]",fileTruncatedLength:"[File content partially truncated: some lines exceeded maximum length of {{maxLength}} characters.]",readLinesRange:"Read lines {{startLine}}-{{endLine}} of {{totalLines}} from {{path}}",readAllLinesShortened:"Read all {{totalLines}} lines from {{path}} (some lines were shortened)",readAllLines:"Read all {{totalLines}} lines from {{path}}",someLinesShortened:" (some lines were shortened)",imageDescriptionGenerated:`Generated image description for {{path}}:
189
- {{description}}`,imageDescriptionError:"Error generating image description for {{path}}",imageDescriptionErrorWithFallback:"Error generating image description for {{path}} ({{sizeKB}}KB). File content available.",readImageFile:"Read image file {{path}} ({{sizeKB}}KB)",imageFileRead:"Image file: {{path}} ({{sizeKB}}KB, {{mimeType}})"}},session:{agentPoweringDown:"Agent powering down. Goodbye!"},authInProgress:{authTimeout:"Authentication timed out. Please try again.",waitingForAuth:"Waiting for auth... (Press ESC to cancel)",copyUrlPrompt:"Browser didn't open automatically? Please copy the following link and open it in your browser:"},modelDialog:{modelSelection:"Model Selection",selectModelPrompt:"Please select the model you want to use with iFlow.",defaultSelection:"Enter To Use Default selection: GLM 4.6",modelNameRequired:"Model name cannot be empty",selectInstructions:"(Use Enter to select, Esc to cancel)",modelConfiguration:"Model Configuration",enterModelPrompt:"Please enter the model name you want to use.",modelNameLabel:"Model Name:",modelNamePlaceholder:"Enter model name (e.g. gpt-4o, claude-3-5-sonnet)",confirmInstructions:"(Press Enter to confirm, Esc to cancel)",recommend:"recommend",directMultimodal:"direct multimodal",loading:"Loading..."},agentInstallDialog:{title:"Install New Agent",agentInstallation:"Agent Installation",stepOf:"Step {{current}} of {{total}}",locationTitle:"Choose Installation Location",locationDescription:"Where would you like to install the agent?",projectAgent:"Project Agent",projectAgentDesc:"Install in the current project (accessible only to this project)",userAgent:"User Agent",userAgentDesc:"Install globally for your user (accessible across all projects)",methodTitle:"Choose Creation Method",methodDescription:"How would you like to create the agent?",generateWithIFlow:"Generate with iFlow (recommended)",generateWithIFlowDesc:"Create through the intelligent guidance of iFlow",manualConfig:"Manual configuration",manualConfigDesc:"Create it step by step by hand",fromOnlineRepo:"From Online Repository",fromOnlineRepoDesc:"Browse and install from the online agent repository",agentGoalTitle:"Describe Your Agent Goal",agentGoalDescription:"What do you want this agent to do? Be specific about its purpose and capabilities.",agentGoalPlaceholder:"e.g. Review code for security vulnerabilities and best practices",agentTypeTitle:"Agent Type (identifier)",agentTypeDescription:"Enter a unique identifier for your agent",agentTypePlaceholder:"e.g. code-reviewer, tech-lead, etc",systemPromptTitle:"System Prompt",systemPromptDescription:"Define the agent's behavior and capabilities",systemPromptPlaceholder:"Enter system prompt. Be comprehensive for best results",descriptionTitle:"Agent Description",descriptionDescription:"Provide a brief description of what this agent does",descriptionPlaceholder:"Enter agent description",toolsTitle:"Select Tools",toolsDescription:"Choose which tools this agent can use",allowAccessTo:"Allow access to {{tool}} tool",mcpsTitle:"Select MCP Servers",mcpsDescription:"Choose which MCP servers this agent can access",allowMcpAccess:"Allow access to {{mcp}} MCP server",colorTitle:"Choose Background Color",colorDescription:"Select a color for your agent",automaticColor:"Automatic color",automaticColorDesc:"Let the system choose a color automatically",red:"Red",blue:"Blue",green:"Green",yellow:"Yellow",purple:"Purple",orange:"Orange",pink:"Pink",cyan:"Cyan",previewTitle:"Preview Agent Configuration",previewDescription:"Review your agent configuration before creating",details:"Details:",location:"Location: {{location}}",model:"Model: {{model}}",color:"Color: {{color}}",tools:"Tools:",mcpServers:"MCP Servers:",systemPrompt:"System Prompt:",allToolsAvailable:"All tools available",allMcpServersAvailable:"All MCP servers available",generatedPreviewTitle:"Review Generated Configuration",generatedPreviewDescription:"Review and edit the AI-generated agent configuration",continueToToolsSelection:"[Continue to Tools Selection]",proceedToNextStep:"Proceed to next step",agentTypeLabel:"Agent Type",descriptionLabel:"Description",systemPromptLabel:"System Prompt",notSet:"(not set)",generatingTitle:"Generating Agent Configuration",generatingDescription:"Using AI to create your agent from the goal description...",startingGeneration:"Starting generation...",pleaseWait:"Please wait while the configuration is generated.",generatingFromGoal:"Generating agent configuration from your goal...",generatedSuccessfully:"\u2714 Agent configuration generated successfully!",continue:"[Continue]",currentValue:"Current value: {{value}}",currentValueNotSet:"Current value: (not set)",pressEnterToEdit:"Press Enter to edit",editField:"Edit {{field}}",modifyField:"Modify the {{field}} for your agent",enterField:"Enter {{field}}",navigation:"Navigation:",navigateOptions:"\u2022 \u2191/\u2193 or j/k - Navigate options",enterToSelect:"\u2022 Enter - Select option",enterToEdit:"\u2022 Enter - Edit value",enterToEditField:"\u2022 Enter - Edit field or continue",escToBack:"\u2022 ESC - Back",qToExit:"\u2022 q - Exit",actions:"Actions:",enterToCreate:"\u2022 Enter - Create agent",escToBackEdit:"\u2022 ESC - Back to edit",creatingAgent:"Creating agent '{{agentType}}'...",successfullyCreated:"Successfully created agent '{{agentType}}' at {{filePath}}",agentCreatedSuccess:"\u2714 Successfully created agent '{{agentType}}'",redirectingToOnline:"Redirecting to online repository...",useAgentsOnline:"Use /agents online to browse and install agents from the online repository",failedToGenerate:"Failed to generate agent configuration: {{error}}",failedToCreate:"Failed to create agent: {{error}}",failedGenerateStatus:"\u274C Failed to generate configuration: {{error}}",failedCreateStatus:"\u274C Failed to create agent: {{error}}"},statsDisplay:{sessionStats:"Session Stats",interactionSummary:"Interaction Summary",toolCalls:"Tool Calls:",successRate:"Success Rate:",userAgreement:"User Agreement:",reviewed:"reviewed",performance:"Performance",wallTime:"Wall Time:",agentActive:"Agent Active:",apiTime:"API Time:",toolTime:"Tool Time:",modelUsage:"Model Usage",requests:"Reqs",inputTokens:"Input Tokens",outputTokens:"Output Tokens",savingsHighlight:"Savings Highlight:",cacheReduction:"of input tokens were served from the cache, reducing costs.",tokenBredownTip:"Tip: For a full token breakdown, run `/stats model`."},agentsCommand:{list:{availableAgents:"Available agents:",personalAgents:"Personal agents",projectAgents:"Project agents",builtinAgents:"Built-in agents (always available)",generalPurpose:"- general-purpose",tips:"\u{1F4A1} Tips:",listDesc:"Use /agents list desc to show agent descriptions",refresh:"Use /agents refresh to refresh agents from source files",online:"Use /agents online to browse and install agents from online repository",noAgentsFound:"No agents found",description:"Description",descriptionSubtitle:"(tells Iflow when to use this agent):",tools:"Tools:",allTools:"All tools",noInherit:" (no inherit)",inherit:" (inherit)",mcps:"MCPs:",none:"None",allMcpServers:"All MCP servers available (inherit)",color:"Color:",systemPrompt:"System prompt:"},refresh:{refreshing:"Refreshing agents from source files...",success:"Agents refreshed successfully. Found {{count}} agents.",error:"Error refreshing agents: {{error}}"},online:{availableOnlineAgents:"Available Online Agents",total:"total",category:"Category:",model:"Model:",version:"Version:",visibility:"Visibility:",context:"Context:",availableTools:"Available Tools",tags:"Tags:",extendedInformation:"Extended Information:",allowedTools:"Allowed Tools:",inheritTools:"Inherit Tools:",yes:"Yes",no:"No",mcpServers:"MCP Servers:",serverPage:"Server Page",showingAgents:"Showing {{count}} agents",navigation:"Navigation:",navigateUpDown:"\u2191/\u2193 - Navigate up/down",prevNextPage:"h/l - Previous/Next page (load from server)",viewDetails:"Enter - View details",refreshPage:"r - Refresh current page",exit:"q - Exit",actions:"Actions:",installProject:"1 - Install for project",installUser:"2 - Install for user",backToList:"b - Back to list"},install:{successfullyInstalled:"\u2714 Successfully installed agent '{{name}}' for {{scope}}",location:"Location: {{path}}",useAgent:"You can now use this agent by typing: /agents list",alreadyInstalled:"\u26A0\uFE0F Agent '{{name}}' is already installed",alreadyExistsMessage:"An agent with this name already exists in your {{scope}} scope.",tipUseList:"Tip: Use /agents list to see all installed agents",installFailed:"\u274C Failed to install agent '{{name}}'",errorMessage:"Error: {{error}}"},subCommands:{list:"List available agents.",refresh:"Refresh agents from source files.",online:"Browse and install agents from online repository",install:"Install a new agent with guided setup"},errors:{showingAgents:"Error showing agents: {{error}}"}},agentsOnlineDialog:{loadingTitle:"Loading Agents...",loadingMessage:"Please wait while we fetch available agents...",availableAgents:"Available Agents",availableAgentsWithCount:"Available Agents ({{count}} total)",noAgentsAvailable:"No agents available",noAgentsFound:"No agents found in the online repository.",pageOf:"Page {{current}} of {{total}}",category:"Category:{{category}}",details:"Details:",model:"Model: {{model}}",categoryLabel:"Category: {{category}}",version:"Version: {{version}}",tools:"Tools:",mcpServers:"MCP Servers:",systemPrompt:"System Prompt:",allToolsAvailableInherit:"All tools available (inherit)",noToolsAvailableNoInherit:"No tools available (no inherit)",inherit:" (inherit)",noInherit:" (no inherit)",allMcpServersAvailableInherit:"All MCP servers available (inherit)",noMcpServersAvailableNoInherit:"No MCP servers available (no inherit)",navigation:"Navigation:",navigateUpDown:"\u2022 \u2191/\u2193 or j/k - Navigate up/down",prevNextPage:"\u2022 \u2190/\u2192 or h/l - Previous/Next page",viewDetails:"\u2022 Enter - View details",exit:"\u2022 q - Exit",actions:"Actions:",installProject:"\u2022 1 - Install for project",installUser:"\u2022 2 - Install for user",backToList:"\u2022 b - Back to list",installing:"Installing {{name}}...",authRequired:"Please authenticate first by running the auth command",loadFailed:"Unable to load agents. Please try again later",authFailed:"Authentication failed. Please check your API key or re-authenticate",accessDenied:"Access denied. Please check your permissions",serviceNotFound:"Agents service not found. Please try again later",serverError:"Server error. Please try again later",serverLoadFailed:"Failed to load agents from server",connectionError:"Unable to load agents. Please check your connection and try again",networkError:"Network error. Please check your internet connection",loadAgentsFailed:"Failed to load agents",installationFailed:"Installation failed",createAgentFailed:"Failed to create agent for '{{name}}'",installFailedWithError:"Failed to install {{name}}: {{error}}"},copyableUrlBox:{pressCtrlCToCopy:"Use Ctrl+C to copy, avoid selecting border characters",copied:"Url copied to clipboard!"},authDialog:{getStarted:"Get started",iflowAuth:"iFlow Authentication",iflowOAuthLogin:"iFlow OAuth Login",aoneAuth:"Aone Authentication",modelConfig:"Model Configuration",openaiConfig:"OpenAI Compatible API Configuration",loginWithIFlowRecommend:"Login with iFlow(recommend)",loginWithIFlowApiKey:"Login with iFlow ApiKey",loginWithIFlowApiKeyRecommend:"Login with iFlow ApiKey(recommend)",loginWithAoneRecommend:"Login with Aone(recommend)",loginWithAoneApiKey:"Login with Aone Code Private Token",openaiCompatibleApi:"OpenAI Compatible API",howToAuth:"How would you like to authenticate for this project?",enterIFlowApiKey:"Please enter your iFlow API key. See: https://docs.iflow.cn/docs/",enterAoneApiKey:"Please enter your Aone Private Token. See: https://code.alibaba-inc.com/profile/account",selectModel:"Please select the model you want to use.",enterModelName:"Please enter the model name you want to use.",defaultSelection:"Enter To Use Default selection: GLM 4.6",enterBaseUrl:"Please enter the base URL for your OpenAI compatible API.",enterApiKey:"Please enter your API key.",enterOpenaiModelName:"Please enter the model name.",oauthStep1:"1. Please copy the following link and open it in your browser:",oauthStep2:"2. Login to your iFlow account and authorize",oauthStep3:"3. Copy the authorization code and paste it below:",authCodeLabel:"Authorization Code:",authCodePlaceholder:"Paste authorization code...",failedToGetApiKey:"Failed to get API key",authFailed:"Authentication failed",apiKeyLabel:"API Key:",modelNameLabel:"Model Name:",baseUrlLabel:"Base URL:",current:"Current: {{value}}",apiKeyPlaceholder:"Enter your iFlow API key...",privateTokenPlaceholder:"Enter your Aone Private Token...",modelNamePlaceholder:"Enter model name (e.g. Qwen3-Coder)",openaiModelPlaceholder:"Enter model name (e.g. gpt-4)",baseUrlPlaceholder:"https://api.openai.com/v1",openaiApiKeyPlaceholder:"Enter your API key...",useEnterToSelect:"(Use Enter to select)",browserNotAvailable:"\u26A0\uFE0F Browser launch not available in this environment (SSH/CI/no display).",useApiKeyAlternative:'Alternatively, use "Login with iFlow ApiKey" for headless environments.',termsOfService:"Terms of Services and Privacy Notice for iFlow CLI",mustSelectAuth:"You must select an auth method to proceed. Press Ctrl+C twice to exit."},textInput:{defaultPlaceholder:"Enter value...",defaultLabel:"Input:",instructions:"Press Enter to confirm, Escape to cancel"},passwordInput:{defaultPlaceholder:"Enter your API key...",defaultLabel:"API Key:",instructions:"Press Enter to confirm, Escape to cancel",validationError:"Invalid API key format. Only English letters, digits, and special characters are allowed."},suggestionsDisplay:{loading:"Loading suggestions..."},editTool:{errors:{pathNotAbsolute:"File path must be absolute: {{filePath}}",pathNotInWorkspace:"File path must be within one of the workspace directories: {{directories}}",fileNotFound:"File not found: {{filePath}}",pathIsDirectory:"Path is a directory, not a file: {{filePath}}",stringNotFound:"Failed to edit, could not find the string to replace in {{filePath}}",fileAlreadyExists:"Failed to edit. Attempted to create a file that already exists: {{filePath}}",editFailed:"Failed to apply edit: {{error}}",expectedOccurrenceMismatch:"Failed to edit, expected {{expected}} occurrence(s) but found {{actual}}"},messages:{createFile:"Create {{path}}",editFile:"Edit {{path}}",noChanges:"No file changes to {{path}}",successfulEdit:"Successfully edited {{path}}"}},smartEditTool:{errors:{unknownWriteError:"Unknown error occurred",executingEdit:"Error executing edit: {{error}}",writingFile:"Error writing file: {{error}}",stringNotFoundDisplay:"String not found",occurrenceMismatchDisplay:"Occurrence mismatch",noChangeDisplay:"No changes required",fileNotFoundDisplay:"File not found",readContentFailureDisplay:"Failed to read content",readContentFailure:"Failed to read file content: {{error}}",fileAlreadyExistsDisplay:"File already exists",noChangesRequiredDisplay:"No changes required",noChangesRequired:"No changes required for edit",confirmationWithInvalidParams:"Cannot confirm edit with invalid parameters",preparingEdit:"Error preparing edit: {{error}}",errorDisplay:"Error: {{error}}",invalidParameters:"Invalid parameters: {{reason}}",invalidParametersDisplay:"Invalid parameters",filePathEmpty:"File path cannot be empty"},messages:{confirmEdit:"Confirm edit to {{path}}",invalidParams:"Invalid parameters",invalidStringParams:"Invalid string parameters",created:"Created {{path}}",newFileCreated:"New file created",fileModified:"File modified",userModified:"User modified"}},globTool:{errors:{pathNotInWorkspace:'Search path ("{{path}}") resolves outside the allowed workspace directories: {{directories}}',pathNotInWorkspaceShort:"Path is not within workspace",pathNotExist:"Search path does not exist {{path}}",pathNotDirectory:"Search path is not a directory: {{path}}",accessError:"Error accessing search path: {{error}}",patternEmpty:"The 'pattern' parameter cannot be empty",searchFailed:"Error during glob search operation: {{error}}",searchFailedShort:"Error: An unexpected error occurred"},messages:{noFilesFound:'No files found matching pattern "{{pattern}}"',noFilesFoundShort:"No files found",filesFound:'Found {{count}} file(s) matching "{{pattern}}"',filesFoundShort:"Found {{count}} matching file(s)"}},grepTool:{errors:{invalidPattern:"Invalid regular expression pattern provided: {{pattern}}. Error: {{error}}",pathValidationFailed:'Path validation failed: Attempted path "{{path}}" resolves outside the allowed workspace directories: {{directories}}',invalidParameters:"Error: Invalid parameters provided. Reason: {{reason}}",invalidParametersShort:"Model provided invalid parameters. Error: {{error}}",searchFailed:"Error during grep search operation: {{error}}",searchFailedShort:"Error: {{error}}",pathNotDirectory:"Path is not a directory: {{path}}",pathNotExist:"Path does not exist: {{path}}",pathAccessFailed:"Failed to access path stats for {{path}}: {{error}}"},messages:{noMatches:'No matches found for pattern "{{pattern}}"',noMatchesShort:"No matches found",matchesFound:'Found {{count}} {{matchType}} for pattern "{{pattern}}" in {{fileCount}} file(s)',matchesFoundShort:"Found {{count}} {{matchType}}"}},shellTool:{errors:{commandEmpty:"Command cannot be empty",directoryAbsolute:"Directory cannot be absolute: {{directory}}",commandFailed:"Command failed: {{error}}",executionFailed:"Command execution failed",commandNotAllowed:"Command is not allowed: {{command}}",couldNotIdentifyCommand:"Could not identify command root to obtain permission from user.",directoryNotRegistered:"Directory '{{directory}}' is not a registered workspace directory.",directoryAmbiguous:"Directory name '{{directory}}' is ambiguous as it matches multiple workspace directories."},messages:{commandCancelled:"Command was cancelled by user",commandSuccess:"Command executed successfully"}},multiEditTool:{errors:{pathNotAbsolute:"File path must be absolute: {{filePath}}",pathNotInWorkspace:"File path must be within the root directory ({{targetDir}}): {{filePath}}",editNoChanges:"Edit {{editNumber}}: old_string and new_string must be different",fileNotFoundForEdit:"File not found: {{filePath}}. Use an empty old_string in the first edit to create a new file.",editStringNotFound:"Edit {{editNumber}}: Could not find the string to replace",editFailed:"Edit {{editNumber}}: {{error}}",validationError:"Validation error: {{error}}",validationErrorShort:"Validation error: {{error}}",calculationError:"Error calculating edits: {{error}}",calculationErrorShort:"Error calculating edits: {{error}}",multiEditFailed:"MultiEdit failed: {{error}}. No changes were applied.",multiEditFailedShort:"MultiEdit failed: {{error}}. No changes were applied.",executionError:"Error executing multi-edit: {{error}}",fileWriteError:"Error writing file: {{error}}"},messages:{fileCreatedWithEdits:"Created {{path}} and applied {{editCount}} additional edits",newFileCreated:"Created new file: {{filePath}} and applied {{editCount}} edits.",editsApplied:"Successfully applied {{editCount}} edits to {{filePath}}.",userModified:"User modified the edits."}},readFileTool:{errors:{pathNotAbsolute:"File path must be absolute, but was relative: {{filePath}}. You must provide an absolute path.",pathNotInWorkspace:"File path must be within one of the workspace directories: {{directories}}",offsetInvalid:"Offset must be a non-negative number",limitInvalid:"Limit must be a positive number",fileIgnored:"File path '{{filePath}}' is ignored by .iflowignore pattern(s).",pathUnavailable:"Path unavailable",invalidParameters:"Error: Invalid parameters provided. Reason: {{reason}}",readError:"Error reading file"}},imageReadTool:{errors:{pathNotAbsolute:"File path must be absolute, but was relative: {{filePath}}. You must provide an absolute path.",pathNotInWorkspace:"File path must be within one of the workspace directories: {{directories}}",fileNotFound:"File not found: {{filePath}}",notImageFile:"File is not a supported image format: {{filePath}}",emptyBase64:"base64 data cannot be empty",invalidBase64:"Invalid base64 data format",invalidMimeType:'Invalid MIME type: {{mimeType}}, must be an image type starting with "image/"',multimodalHelperUnavailable:"Multimodal helper unavailable, cannot generate image description",invalidParameters:"Error: Invalid parameters provided. Reason: {{reason}}",executionError:"Execution error: {{error}}",executionErrorShort:"Image read error",inputUnavailable:"Input unavailable"},description:{base64Image:"base64 encoded image"}},webFetchTool:{errors:{noUrlFoundFallback:"Error: No URL found in the prompt for fallback.",fallbackError:"Error: {{error}}",promptEmpty:"The 'prompt' parameter cannot be empty and must contain URL(s) and instructions.",noValidUrl:"The 'prompt' must contain at least one valid URL (starting with http:// or https://).",executionError:"Error: {{error}}"},messages:{contentProcessedFallback:"Content for {{url}} processed using fallback fetch.",contentProcessed:"Content processed from prompt."}},todoReadTool:{messages:{readingTodoList:"Reading the current todo list",todoListEmpty:"The todo list is currently empty.",currentTodos:`\xB7Current Todos
189
+ {{description}}`,imageDescriptionError:"Error generating image description for {{path}}",imageDescriptionErrorWithFallback:"Error generating image description for {{path}} ({{sizeKB}}KB). File content available.",readImageFile:"Read image file {{path}} ({{sizeKB}}KB)",imageFileRead:"Image file: {{path}} ({{sizeKB}}KB, {{mimeType}})"}},session:{agentPoweringDown:"Agent powering down. Goodbye!"},authInProgress:{authTimeout:"Authentication timed out. Please try again.",waitingForAuth:"Waiting for auth... (Press ESC to cancel)",copyUrlPrompt:"Browser didn't open automatically? Please copy the following link and open it in your browser:"},modelDialog:{modelSelection:"Model Selection",selectModelPrompt:"Please select the model you want to use with iFlow.",defaultSelection:"Enter To Use Default selection: GLM 4.7",modelNameRequired:"Model name cannot be empty",selectInstructions:"(Use Enter to select, Esc to cancel)",modelConfiguration:"Model Configuration",enterModelPrompt:"Please enter the model name you want to use.",modelNameLabel:"Model Name:",modelNamePlaceholder:"Enter model name (e.g. gpt-4o, claude-3-5-sonnet)",confirmInstructions:"(Press Enter to confirm, Esc to cancel)",recommend:"recommend",directMultimodal:"direct multimodal",loading:"Loading..."},agentInstallDialog:{title:"Install New Agent",agentInstallation:"Agent Installation",stepOf:"Step {{current}} of {{total}}",locationTitle:"Choose Installation Location",locationDescription:"Where would you like to install the agent?",projectAgent:"Project Agent",projectAgentDesc:"Install in the current project (accessible only to this project)",userAgent:"User Agent",userAgentDesc:"Install globally for your user (accessible across all projects)",methodTitle:"Choose Creation Method",methodDescription:"How would you like to create the agent?",generateWithIFlow:"Generate with iFlow (recommended)",generateWithIFlowDesc:"Create through the intelligent guidance of iFlow",manualConfig:"Manual configuration",manualConfigDesc:"Create it step by step by hand",fromOnlineRepo:"From Online Repository",fromOnlineRepoDesc:"Browse and install from the online agent repository",agentGoalTitle:"Describe Your Agent Goal",agentGoalDescription:"What do you want this agent to do? Be specific about its purpose and capabilities.",agentGoalPlaceholder:"e.g. Review code for security vulnerabilities and best practices",agentTypeTitle:"Agent Type (identifier)",agentTypeDescription:"Enter a unique identifier for your agent",agentTypePlaceholder:"e.g. code-reviewer, tech-lead, etc",systemPromptTitle:"System Prompt",systemPromptDescription:"Define the agent's behavior and capabilities",systemPromptPlaceholder:"Enter system prompt. Be comprehensive for best results",descriptionTitle:"Agent Description",descriptionDescription:"Provide a brief description of what this agent does",descriptionPlaceholder:"Enter agent description",toolsTitle:"Select Tools",toolsDescription:"Choose which tools this agent can use",allowAccessTo:"Allow access to {{tool}} tool",mcpsTitle:"Select MCP Servers",mcpsDescription:"Choose which MCP servers this agent can access",allowMcpAccess:"Allow access to {{mcp}} MCP server",colorTitle:"Choose Background Color",colorDescription:"Select a color for your agent",automaticColor:"Automatic color",automaticColorDesc:"Let the system choose a color automatically",red:"Red",blue:"Blue",green:"Green",yellow:"Yellow",purple:"Purple",orange:"Orange",pink:"Pink",cyan:"Cyan",previewTitle:"Preview Agent Configuration",previewDescription:"Review your agent configuration before creating",details:"Details:",location:"Location: {{location}}",model:"Model: {{model}}",color:"Color: {{color}}",tools:"Tools:",mcpServers:"MCP Servers:",systemPrompt:"System Prompt:",allToolsAvailable:"All tools available",allMcpServersAvailable:"All MCP servers available",generatedPreviewTitle:"Review Generated Configuration",generatedPreviewDescription:"Review and edit the AI-generated agent configuration",continueToToolsSelection:"[Continue to Tools Selection]",proceedToNextStep:"Proceed to next step",agentTypeLabel:"Agent Type",descriptionLabel:"Description",systemPromptLabel:"System Prompt",notSet:"(not set)",generatingTitle:"Generating Agent Configuration",generatingDescription:"Using AI to create your agent from the goal description...",startingGeneration:"Starting generation...",pleaseWait:"Please wait while the configuration is generated.",generatingFromGoal:"Generating agent configuration from your goal...",generatedSuccessfully:"\u2714 Agent configuration generated successfully!",continue:"[Continue]",currentValue:"Current value: {{value}}",currentValueNotSet:"Current value: (not set)",pressEnterToEdit:"Press Enter to edit",editField:"Edit {{field}}",modifyField:"Modify the {{field}} for your agent",enterField:"Enter {{field}}",navigation:"Navigation:",navigateOptions:"\u2022 \u2191/\u2193 or j/k - Navigate options",enterToSelect:"\u2022 Enter - Select option",enterToEdit:"\u2022 Enter - Edit value",enterToEditField:"\u2022 Enter - Edit field or continue",escToBack:"\u2022 ESC - Back",qToExit:"\u2022 q - Exit",actions:"Actions:",enterToCreate:"\u2022 Enter - Create agent",escToBackEdit:"\u2022 ESC - Back to edit",creatingAgent:"Creating agent '{{agentType}}'...",successfullyCreated:"Successfully created agent '{{agentType}}' at {{filePath}}",agentCreatedSuccess:"\u2714 Successfully created agent '{{agentType}}'",redirectingToOnline:"Redirecting to online repository...",useAgentsOnline:"Use /agents online to browse and install agents from the online repository",failedToGenerate:"Failed to generate agent configuration: {{error}}",failedToCreate:"Failed to create agent: {{error}}",failedGenerateStatus:"\u274C Failed to generate configuration: {{error}}",failedCreateStatus:"\u274C Failed to create agent: {{error}}"},statsDisplay:{sessionStats:"Session Stats",interactionSummary:"Interaction Summary",toolCalls:"Tool Calls:",successRate:"Success Rate:",userAgreement:"User Agreement:",reviewed:"reviewed",performance:"Performance",wallTime:"Wall Time:",agentActive:"Agent Active:",apiTime:"API Time:",toolTime:"Tool Time:",modelUsage:"Model Usage",requests:"Reqs",inputTokens:"Input Tokens",outputTokens:"Output Tokens",savingsHighlight:"Savings Highlight:",cacheReduction:"of input tokens were served from the cache, reducing costs.",tokenBredownTip:"Tip: For a full token breakdown, run `/stats model`."},agentsCommand:{list:{availableAgents:"Available agents:",personalAgents:"Personal agents",projectAgents:"Project agents",builtinAgents:"Built-in agents (always available)",generalPurpose:"- general-purpose",tips:"\u{1F4A1} Tips:",listDesc:"Use /agents list desc to show agent descriptions",refresh:"Use /agents refresh to refresh agents from source files",online:"Use /agents online to browse and install agents from online repository",noAgentsFound:"No agents found",description:"Description",descriptionSubtitle:"(tells Iflow when to use this agent):",tools:"Tools:",allTools:"All tools",noInherit:" (no inherit)",inherit:" (inherit)",mcps:"MCPs:",none:"None",allMcpServers:"All MCP servers available (inherit)",color:"Color:",systemPrompt:"System prompt:"},refresh:{refreshing:"Refreshing agents from source files...",success:"Agents refreshed successfully. Found {{count}} agents.",error:"Error refreshing agents: {{error}}"},online:{availableOnlineAgents:"Available Online Agents",total:"total",category:"Category:",model:"Model:",version:"Version:",visibility:"Visibility:",context:"Context:",availableTools:"Available Tools",tags:"Tags:",extendedInformation:"Extended Information:",allowedTools:"Allowed Tools:",inheritTools:"Inherit Tools:",yes:"Yes",no:"No",mcpServers:"MCP Servers:",serverPage:"Server Page",showingAgents:"Showing {{count}} agents",navigation:"Navigation:",navigateUpDown:"\u2191/\u2193 - Navigate up/down",prevNextPage:"h/l - Previous/Next page (load from server)",viewDetails:"Enter - View details",refreshPage:"r - Refresh current page",exit:"q - Exit",actions:"Actions:",installProject:"1 - Install for project",installUser:"2 - Install for user",backToList:"b - Back to list"},install:{successfullyInstalled:"\u2714 Successfully installed agent '{{name}}' for {{scope}}",location:"Location: {{path}}",useAgent:"You can now use this agent by typing: /agents list",alreadyInstalled:"\u26A0\uFE0F Agent '{{name}}' is already installed",alreadyExistsMessage:"An agent with this name already exists in your {{scope}} scope.",tipUseList:"Tip: Use /agents list to see all installed agents",installFailed:"\u274C Failed to install agent '{{name}}'",errorMessage:"Error: {{error}}"},subCommands:{list:"List available agents.",refresh:"Refresh agents from source files.",online:"Browse and install agents from online repository",install:"Install a new agent with guided setup"},errors:{showingAgents:"Error showing agents: {{error}}"}},agentsOnlineDialog:{loadingTitle:"Loading Agents...",loadingMessage:"Please wait while we fetch available agents...",availableAgents:"Available Agents",availableAgentsWithCount:"Available Agents ({{count}} total)",noAgentsAvailable:"No agents available",noAgentsFound:"No agents found in the online repository.",pageOf:"Page {{current}} of {{total}}",category:"Category:{{category}}",details:"Details:",model:"Model: {{model}}",categoryLabel:"Category: {{category}}",version:"Version: {{version}}",tools:"Tools:",mcpServers:"MCP Servers:",systemPrompt:"System Prompt:",allToolsAvailableInherit:"All tools available (inherit)",noToolsAvailableNoInherit:"No tools available (no inherit)",inherit:" (inherit)",noInherit:" (no inherit)",allMcpServersAvailableInherit:"All MCP servers available (inherit)",noMcpServersAvailableNoInherit:"No MCP servers available (no inherit)",navigation:"Navigation:",navigateUpDown:"\u2022 \u2191/\u2193 or j/k - Navigate up/down",prevNextPage:"\u2022 \u2190/\u2192 or h/l - Previous/Next page",viewDetails:"\u2022 Enter - View details",exit:"\u2022 q - Exit",actions:"Actions:",installProject:"\u2022 1 - Install for project",installUser:"\u2022 2 - Install for user",backToList:"\u2022 b - Back to list",installing:"Installing {{name}}...",authRequired:"Please authenticate first by running the auth command",loadFailed:"Unable to load agents. Please try again later",authFailed:"Authentication failed. Please check your API key or re-authenticate",accessDenied:"Access denied. Please check your permissions",serviceNotFound:"Agents service not found. Please try again later",serverError:"Server error. Please try again later",serverLoadFailed:"Failed to load agents from server",connectionError:"Unable to load agents. Please check your connection and try again",networkError:"Network error. Please check your internet connection",loadAgentsFailed:"Failed to load agents",installationFailed:"Installation failed",createAgentFailed:"Failed to create agent for '{{name}}'",installFailedWithError:"Failed to install {{name}}: {{error}}"},copyableUrlBox:{pressCtrlCToCopy:"Use Ctrl+C to copy, avoid selecting border characters",copied:"Url copied to clipboard!"},authDialog:{getStarted:"Get started",iflowAuth:"iFlow Authentication",iflowOAuthLogin:"iFlow OAuth Login",aoneAuth:"Aone Authentication",modelConfig:"Model Configuration",openaiConfig:"OpenAI Compatible API Configuration",loginWithIFlowRecommend:"Login with iFlow(recommend)",loginWithIFlowApiKey:"Login with iFlow ApiKey",loginWithIFlowApiKeyRecommend:"Login with iFlow ApiKey(recommend)",loginWithAoneRecommend:"Login with Aone(recommend)",loginWithAoneApiKey:"Login with Aone Code Private Token",openaiCompatibleApi:"OpenAI Compatible API",howToAuth:"How would you like to authenticate for this project?",enterIFlowApiKey:"Please enter your iFlow API key. See: https://docs.iflow.cn/docs/",enterAoneApiKey:"Please enter your Aone Private Token. See: https://code.alibaba-inc.com/profile/account",selectModel:"Please select the model you want to use.",enterModelName:"Please enter the model name you want to use.",defaultSelection:"Enter To Use Default selection: GLM 4.7",enterBaseUrl:"Please enter the base URL for your OpenAI compatible API.",enterApiKey:"Please enter your API key.",enterOpenaiModelName:"Please enter the model name.",oauthStep1:"1. Please copy the following link and open it in your browser:",oauthStep2:"2. Login to your iFlow account and authorize",oauthStep3:"3. Copy the authorization code and paste it below:",authCodeLabel:"Authorization Code:",authCodePlaceholder:"Paste authorization code...",failedToGetApiKey:"Failed to get API key",authFailed:"Authentication failed",apiKeyLabel:"API Key:",modelNameLabel:"Model Name:",baseUrlLabel:"Base URL:",current:"Current: {{value}}",apiKeyPlaceholder:"Enter your iFlow API key...",privateTokenPlaceholder:"Enter your Aone Private Token...",modelNamePlaceholder:"Enter model name (e.g. Qwen3-Coder)",openaiModelPlaceholder:"Enter model name (e.g. gpt-4)",baseUrlPlaceholder:"https://api.openai.com/v1",openaiApiKeyPlaceholder:"Enter your API key...",useEnterToSelect:"(Use Enter to select)",browserNotAvailable:"\u26A0\uFE0F Browser launch not available in this environment (SSH/CI/no display).",useApiKeyAlternative:'Alternatively, use "Login with iFlow ApiKey" for headless environments.',termsOfService:"Terms of Services and Privacy Notice for iFlow CLI",mustSelectAuth:"You must select an auth method to proceed. Press Ctrl+C twice to exit."},textInput:{defaultPlaceholder:"Enter value...",defaultLabel:"Input:",instructions:"Press Enter to confirm, Escape to cancel"},passwordInput:{defaultPlaceholder:"Enter your API key...",defaultLabel:"API Key:",instructions:"Press Enter to confirm, Escape to cancel",validationError:"Invalid API key format. Only English letters, digits, and special characters are allowed."},suggestionsDisplay:{loading:"Loading suggestions..."},editTool:{errors:{pathNotAbsolute:"File path must be absolute: {{filePath}}",pathNotInWorkspace:"File path must be within one of the workspace directories: {{directories}}",fileNotFound:"File not found: {{filePath}}",pathIsDirectory:"Path is a directory, not a file: {{filePath}}",stringNotFound:"Failed to edit, could not find the string to replace in {{filePath}}",fileAlreadyExists:"Failed to edit. Attempted to create a file that already exists: {{filePath}}",editFailed:"Failed to apply edit: {{error}}",expectedOccurrenceMismatch:"Failed to edit, expected {{expected}} occurrence(s) but found {{actual}}"},messages:{createFile:"Create {{path}}",editFile:"Edit {{path}}",noChanges:"No file changes to {{path}}",successfulEdit:"Successfully edited {{path}}"}},smartEditTool:{errors:{unknownWriteError:"Unknown error occurred",executingEdit:"Error executing edit: {{error}}",writingFile:"Error writing file: {{error}}",stringNotFoundDisplay:"String not found",occurrenceMismatchDisplay:"Occurrence mismatch",noChangeDisplay:"No changes required",fileNotFoundDisplay:"File not found",readContentFailureDisplay:"Failed to read content",readContentFailure:"Failed to read file content: {{error}}",fileAlreadyExistsDisplay:"File already exists",noChangesRequiredDisplay:"No changes required",noChangesRequired:"No changes required for edit",confirmationWithInvalidParams:"Cannot confirm edit with invalid parameters",preparingEdit:"Error preparing edit: {{error}}",errorDisplay:"Error: {{error}}",invalidParameters:"Invalid parameters: {{reason}}",invalidParametersDisplay:"Invalid parameters",filePathEmpty:"File path cannot be empty"},messages:{confirmEdit:"Confirm edit to {{path}}",invalidParams:"Invalid parameters",invalidStringParams:"Invalid string parameters",created:"Created {{path}}",newFileCreated:"New file created",fileModified:"File modified",userModified:"User modified"}},globTool:{errors:{pathNotInWorkspace:'Search path ("{{path}}") resolves outside the allowed workspace directories: {{directories}}',pathNotInWorkspaceShort:"Path is not within workspace",pathNotExist:"Search path does not exist {{path}}",pathNotDirectory:"Search path is not a directory: {{path}}",accessError:"Error accessing search path: {{error}}",patternEmpty:"The 'pattern' parameter cannot be empty",searchFailed:"Error during glob search operation: {{error}}",searchFailedShort:"Error: An unexpected error occurred"},messages:{noFilesFound:'No files found matching pattern "{{pattern}}"',noFilesFoundShort:"No files found",filesFound:'Found {{count}} file(s) matching "{{pattern}}"',filesFoundShort:"Found {{count}} matching file(s)"}},grepTool:{errors:{invalidPattern:"Invalid regular expression pattern provided: {{pattern}}. Error: {{error}}",pathValidationFailed:'Path validation failed: Attempted path "{{path}}" resolves outside the allowed workspace directories: {{directories}}',invalidParameters:"Error: Invalid parameters provided. Reason: {{reason}}",invalidParametersShort:"Model provided invalid parameters. Error: {{error}}",searchFailed:"Error during grep search operation: {{error}}",searchFailedShort:"Error: {{error}}",pathNotDirectory:"Path is not a directory: {{path}}",pathNotExist:"Path does not exist: {{path}}",pathAccessFailed:"Failed to access path stats for {{path}}: {{error}}"},messages:{noMatches:'No matches found for pattern "{{pattern}}"',noMatchesShort:"No matches found",matchesFound:'Found {{count}} {{matchType}} for pattern "{{pattern}}" in {{fileCount}} file(s)',matchesFoundShort:"Found {{count}} {{matchType}}"}},shellTool:{errors:{commandEmpty:"Command cannot be empty",directoryAbsolute:"Directory cannot be absolute: {{directory}}",commandFailed:"Command failed: {{error}}",executionFailed:"Command execution failed",commandNotAllowed:"Command is not allowed: {{command}}",couldNotIdentifyCommand:"Could not identify command root to obtain permission from user.",directoryNotRegistered:"Directory '{{directory}}' is not a registered workspace directory.",directoryAmbiguous:"Directory name '{{directory}}' is ambiguous as it matches multiple workspace directories."},messages:{commandCancelled:"Command was cancelled by user",commandSuccess:"Command executed successfully"}},multiEditTool:{errors:{pathNotAbsolute:"File path must be absolute: {{filePath}}",pathNotInWorkspace:"File path must be within the root directory ({{targetDir}}): {{filePath}}",editNoChanges:"Edit {{editNumber}}: old_string and new_string must be different",fileNotFoundForEdit:"File not found: {{filePath}}. Use an empty old_string in the first edit to create a new file.",editStringNotFound:"Edit {{editNumber}}: Could not find the string to replace",editFailed:"Edit {{editNumber}}: {{error}}",validationError:"Validation error: {{error}}",validationErrorShort:"Validation error: {{error}}",calculationError:"Error calculating edits: {{error}}",calculationErrorShort:"Error calculating edits: {{error}}",multiEditFailed:"MultiEdit failed: {{error}}. No changes were applied.",multiEditFailedShort:"MultiEdit failed: {{error}}. No changes were applied.",executionError:"Error executing multi-edit: {{error}}",fileWriteError:"Error writing file: {{error}}"},messages:{fileCreatedWithEdits:"Created {{path}} and applied {{editCount}} additional edits",newFileCreated:"Created new file: {{filePath}} and applied {{editCount}} edits.",editsApplied:"Successfully applied {{editCount}} edits to {{filePath}}.",userModified:"User modified the edits."}},readFileTool:{errors:{pathNotAbsolute:"File path must be absolute, but was relative: {{filePath}}. You must provide an absolute path.",pathNotInWorkspace:"File path must be within one of the workspace directories: {{directories}}",offsetInvalid:"Offset must be a non-negative number",limitInvalid:"Limit must be a positive number",fileIgnored:"File path '{{filePath}}' is ignored by .iflowignore pattern(s).",pathUnavailable:"Path unavailable",invalidParameters:"Error: Invalid parameters provided. Reason: {{reason}}",readError:"Error reading file"}},imageReadTool:{errors:{pathNotAbsolute:"File path must be absolute, but was relative: {{filePath}}. You must provide an absolute path.",pathNotInWorkspace:"File path must be within one of the workspace directories: {{directories}}",fileNotFound:"File not found: {{filePath}}",notImageFile:"File is not a supported image format: {{filePath}}",emptyBase64:"base64 data cannot be empty",invalidBase64:"Invalid base64 data format",invalidMimeType:'Invalid MIME type: {{mimeType}}, must be an image type starting with "image/"',multimodalHelperUnavailable:"Multimodal helper unavailable, cannot generate image description",invalidParameters:"Error: Invalid parameters provided. Reason: {{reason}}",executionError:"Execution error: {{error}}",executionErrorShort:"Image read error",inputUnavailable:"Input unavailable"},description:{base64Image:"base64 encoded image"}},webFetchTool:{errors:{noUrlFoundFallback:"Error: No URL found in the prompt for fallback.",fallbackError:"Error: {{error}}",promptEmpty:"The 'prompt' parameter cannot be empty and must contain URL(s) and instructions.",noValidUrl:"The 'prompt' must contain at least one valid URL (starting with http:// or https://).",executionError:"Error: {{error}}"},messages:{contentProcessedFallback:"Content for {{url}} processed using fallback fetch.",contentProcessed:"Content processed from prompt."}},todoReadTool:{messages:{readingTodoList:"Reading the current todo list",todoListEmpty:"The todo list is currently empty.",currentTodos:`\xB7Current Todos
190
190
  \u23BF (No todos)`,todosFound:"Found {{count}} todos: {{pending}} pending, {{inProgress}} in progress, {{completed}} completed."}},memoryTool:{errors:{factRequired:'Parameter "fact" must be a non-empty string.',savingError:"Error saving memory: {{error}}"},messages:{fileUpdated:"Okay, I've updated the memory file with your modifications.",factRemembered:`Okay, I've remembered that: "{{fact}}"`}},readManyFilesTool:{errors:{noSearchPaths:"No search paths or include patterns provided.",noSearchPathsInfo:`## Information
191
191
 
192
192
  No search paths or include patterns were specified. Nothing to read or concatenate.`,invalidParameters:"Error: Invalid parameters for {{toolName}}. Reason: {{reason}}",parameterError:`## Parameter Error
@@ -482,9 +482,9 @@ ${c}`.trim()}_serializeSingularDataPoint(e,r,n){let o="";e=a6t(e,r);let{value:s,
482
482
  ${o}
483
483
  ${s}
484
484
  `}};Vke.PrometheusSerializer=l6t});var DPr=I(Wke=>{"use strict";Object.defineProperty(Wke,"__esModule",{value:!0});Wke.PrometheusExporter=void 0;var wme=(ir(),bt(hr)),Ugo=yi(),d6t=Zx(),Qgo=_e("http"),jgo=u6t(),$go=_e("url"),f6t=class t extends d6t.MetricReader{static DEFAULT_OPTIONS={host:void 0,port:9464,endpoint:"/metrics",prefix:"",appendTimestamp:!1,withResourceConstantLabels:void 0};_host;_port;_baseUrl;_endpoint;_server;_prefix;_appendTimestamp;_serializer;_startServerPromise;constructor(e={},r=()=>{}){super({aggregationSelector:o=>({type:d6t.AggregationType.DEFAULT}),aggregationTemporalitySelector:o=>d6t.AggregationTemporality.CUMULATIVE,metricProducers:e.metricProducers}),this._host=e.host||process.env.OTEL_EXPORTER_PROMETHEUS_HOST||t.DEFAULT_OPTIONS.host,this._port=e.port||Number(process.env.OTEL_EXPORTER_PROMETHEUS_PORT)||t.DEFAULT_OPTIONS.port,this._prefix=e.prefix||t.DEFAULT_OPTIONS.prefix,this._appendTimestamp=typeof e.appendTimestamp=="boolean"?e.appendTimestamp:t.DEFAULT_OPTIONS.appendTimestamp;let n=e.withResourceConstantLabels||t.DEFAULT_OPTIONS.withResourceConstantLabels;this._server=(0,Qgo.createServer)(this._requestHandler).unref(),this._serializer=new jgo.PrometheusSerializer(this._prefix,this._appendTimestamp,n),this._baseUrl=`http://${this._host}:${this._port}/`,this._endpoint=(e.endpoint||t.DEFAULT_OPTIONS.endpoint).replace(/^([^/])/,"/$1"),e.preventServerStart!==!0?this.startServer().then(r,o=>{wme.diag.error(o),r(o)}):r&&queueMicrotask(r)}async onForceFlush(){}onShutdown(){return this.stopServer()}stopServer(){return this._server?new Promise(e=>{this._server.close(r=>{r?r.code!=="ERR_SERVER_NOT_RUNNING"&&(0,Ugo.globalErrorHandler)(r):wme.diag.debug("Prometheus exporter was stopped"),e()})}):(wme.diag.debug("Prometheus stopServer() was called but server was never started."),Promise.resolve())}startServer(){return this._startServerPromise??=new Promise((e,r)=>{this._server.once("error",r),this._server.listen({port:this._port,host:this._host},()=>{wme.diag.debug(`Prometheus exporter server started: ${this._host}:${this._port}/${this._endpoint}`),e()})}),this._startServerPromise}getMetricsRequestHandler(e,r){this._exportMetrics(r)}_requestHandler=(e,r)=>{e.url!=null&&new $go.URL(e.url,this._baseUrl).pathname===this._endpoint?this._exportMetrics(r):this._notFound(r)};_exportMetrics=e=>{e.statusCode=200,e.setHeader("content-type","text/plain"),this.collect().then(r=>{let{resourceMetrics:n,errors:o}=r;o.length&&wme.diag.error("PrometheusExporter: metrics collection errors",...o),e.end(this._serializer.serialize(n))},r=>{e.end(`# failed to export metrics: ${r}`)})};_notFound=e=>{e.statusCode=404,e.end()}};Wke.PrometheusExporter=f6t});var RPr=I(WJ=>{"use strict";Object.defineProperty(WJ,"__esModule",{value:!0});WJ.PrometheusSerializer=WJ.PrometheusExporter=void 0;var Ggo=DPr();Object.defineProperty(WJ,"PrometheusExporter",{enumerable:!0,get:function(){return Ggo.PrometheusExporter}});var qgo=u6t();Object.defineProperty(WJ,"PrometheusSerializer",{enumerable:!0,get:function(){return qgo.PrometheusSerializer}})});var kPr=I(zke=>{"use strict";Object.defineProperty(zke,"__esModule",{value:!0});zke.VERSION=void 0;zke.VERSION="0.206.0"});var OPr=I(Yke=>{"use strict";Object.defineProperty(Yke,"__esModule",{value:!0});Yke.OTLPTraceExporter=void 0;var Hgo=(qx(),bt(Gx)),Vgo=kPr(),Wgo=rw(),NPr=(P7(),bt(ON)),p6t=class extends Hgo.OTLPExporterBase{constructor(e={}){super((0,NPr.createOtlpHttpExportDelegate)((0,NPr.convertLegacyHttpOptions)(e,"TRACES","v1/traces",{"User-Agent":`OTel-OTLP-Exporter-JavaScript/${Vgo.VERSION}`,"Content-Type":"application/json"}),Wgo.JsonTraceSerializer))}};Yke.OTLPTraceExporter=p6t});var BPr=I(Kke=>{"use strict";Object.defineProperty(Kke,"__esModule",{value:!0});Kke.OTLPTraceExporter=void 0;var zgo=OPr();Object.defineProperty(Kke,"OTLPTraceExporter",{enumerable:!0,get:function(){return zgo.OTLPTraceExporter}})});var PPr=I(Xke=>{"use strict";Object.defineProperty(Xke,"__esModule",{value:!0});Xke.OTLPTraceExporter=void 0;var Ygo=BPr();Object.defineProperty(Xke,"OTLPTraceExporter",{enumerable:!0,get:function(){return Ygo.OTLPTraceExporter}})});var MPr=I(Jke=>{"use strict";Object.defineProperty(Jke,"__esModule",{value:!0});Jke.OTLPTraceExporter=void 0;var Kgo=PPr();Object.defineProperty(Jke,"OTLPTraceExporter",{enumerable:!0,get:function(){return Kgo.OTLPTraceExporter}})});var LPr=I(Zke=>{"use strict";Object.defineProperty(Zke,"__esModule",{value:!0});Zke.OTLPTraceExporter=void 0;var FPr=Bke(),Xgo=rw(),Jgo=(qx(),bt(Gx)),h6t=class extends Jgo.OTLPExporterBase{constructor(e={}){super((0,FPr.createOtlpGrpcExportDelegate)((0,FPr.convertLegacyOtlpGrpcOptions)(e,"TRACES"),Xgo.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}};Zke.OTLPTraceExporter=h6t});var UPr=I(eNe=>{"use strict";Object.defineProperty(eNe,"__esModule",{value:!0});eNe.OTLPTraceExporter=void 0;var Zgo=LPr();Object.defineProperty(eNe,"OTLPTraceExporter",{enumerable:!0,get:function(){return Zgo.OTLPTraceExporter}})});var QPr=I(rNe=>{"use strict";Object.defineProperty(rNe,"__esModule",{value:!0});rNe.prepareSend=void 0;var m6t=(ir(),bt(hr)),tNe=yi(),e0o=_e("http"),t0o=_e("https");function r0o(t,e){let r=new URL(t),n=Object.assign({method:"POST",headers:{"Content-Type":"application/json",...e}});return function(s,a){if(s.length===0)return m6t.diag.debug("Zipkin send with empty spans"),a({code:tNe.ExportResultCode.SUCCESS});let{request:c}=r.protocol==="http:"?e0o:t0o,u=c(r,n,f=>{let p="";f.on("data",h=>{p+=h}),f.on("end",()=>{let h=f.statusCode||0;return m6t.diag.debug(`Zipkin response status code: ${h}, body: ${p}`),h<400?a({code:tNe.ExportResultCode.SUCCESS}):a({code:tNe.ExportResultCode.FAILED,error:new Error(`Got unexpected status code from zipkin: ${h}`)})})});u.on("error",f=>a({code:tNe.ExportResultCode.FAILED,error:f}));let d=JSON.stringify(s);m6t.diag.debug(`Zipkin request payload: ${d}`),u.write(d,"utf8"),u.end()}}rNe.prepareSend=r0o});var jPr=I(nNe=>{"use strict";Object.defineProperty(nNe,"__esModule",{value:!0});nNe.prepareSend=void 0;var n0o=QPr();Object.defineProperty(nNe,"prepareSend",{enumerable:!0,get:function(){return n0o.prepareSend}})});var g6t=I(iNe=>{"use strict";Object.defineProperty(iNe,"__esModule",{value:!0});iNe.prepareSend=void 0;var i0o=jPr();Object.defineProperty(iNe,"prepareSend",{enumerable:!0,get:function(){return i0o.prepareSend}})});var $Pr=I(Tme=>{"use strict";Object.defineProperty(Tme,"__esModule",{value:!0});Tme.SpanKind=void 0;var o0o;(function(t){t.CLIENT="CLIENT",t.SERVER="SERVER",t.CONSUMER="CONSUMER",t.PRODUCER="PRODUCER"})(o0o=Tme.SpanKind||(Tme.SpanKind={}))});var HPr=I(qv=>{"use strict";Object.defineProperty(qv,"__esModule",{value:!0});qv._toZipkinAnnotations=qv._toZipkinTags=qv.toZipkinSpan=qv.defaultStatusErrorTagName=qv.defaultStatusCodeTagName=void 0;var tO=(ir(),bt(hr)),A6t=yi(),oNe=$Pr(),s0o={[tO.SpanKind.CLIENT]:oNe.SpanKind.CLIENT,[tO.SpanKind.SERVER]:oNe.SpanKind.SERVER,[tO.SpanKind.CONSUMER]:oNe.SpanKind.CONSUMER,[tO.SpanKind.PRODUCER]:oNe.SpanKind.PRODUCER,[tO.SpanKind.INTERNAL]:void 0};qv.defaultStatusCodeTagName="otel.status_code";qv.defaultStatusErrorTagName="error";function a0o(t,e,r,n){return{traceId:t.spanContext().traceId,parentId:t.parentSpanContext?.spanId,name:t.name,id:t.spanContext().spanId,kind:s0o[t.kind],timestamp:(0,A6t.hrTimeToMicroseconds)(t.startTime),duration:Math.round((0,A6t.hrTimeToMicroseconds)(t.duration)),localEndpoint:{serviceName:e},tags:GPr(t,r,n),annotations:t.events.length?qPr(t.events):void 0}}qv.toZipkinSpan=a0o;function GPr({attributes:t,resource:e,status:r,droppedAttributesCount:n,droppedEventsCount:o,droppedLinksCount:s},a,c){let u={};for(let d of Object.keys(t))u[d]=String(t[d]);return r.code!==tO.SpanStatusCode.UNSET&&(u[a]=String(tO.SpanStatusCode[r.code])),r.code===tO.SpanStatusCode.ERROR&&r.message&&(u[c]=r.message),n&&(u["otel.dropped_attributes_count"]=String(n)),o&&(u["otel.dropped_events_count"]=String(o)),s&&(u["otel.dropped_links_count"]=String(s)),Object.keys(e.attributes).forEach(d=>u[d]=String(e.attributes[d])),u}qv._toZipkinTags=GPr;function qPr(t){return t.map(e=>({timestamp:Math.round((0,A6t.hrTimeToMicroseconds)(e.time)),value:e.name}))}qv._toZipkinAnnotations=qPr});var VPr=I(sNe=>{"use strict";Object.defineProperty(sNe,"__esModule",{value:!0});sNe.prepareGetHeaders=void 0;function c0o(t){return function(){return t()}}sNe.prepareGetHeaders=c0o});var KPr=I(aNe=>{"use strict";Object.defineProperty(aNe,"__esModule",{value:!0});aNe.ZipkinExporter=void 0;var WPr=(ir(),bt(hr)),zPr=yi(),YPr=g6t(),y6t=HPr(),_6t=(xm(),bt(d2)),l0o=VPr(),E6t=class{DEFAULT_SERVICE_NAME="OpenTelemetry Service";_statusCodeTagName;_statusDescriptionTagName;_urlStr;_send;_getHeaders;_serviceName;_isShutdown;_sendingPromises=[];constructor(e={}){this._urlStr=e.url||((0,zPr.getStringFromEnv)("OTEL_EXPORTER_ZIPKIN_ENDPOINT")??"http://localhost:9411/api/v2/spans"),this._send=(0,YPr.prepareSend)(this._urlStr,e.headers),this._serviceName=e.serviceName,this._statusCodeTagName=e.statusCodeTagName||y6t.defaultStatusCodeTagName,this._statusDescriptionTagName=e.statusDescriptionTagName||y6t.defaultStatusErrorTagName,this._isShutdown=!1,typeof e.getExportRequestHeaders=="function"?this._getHeaders=(0,l0o.prepareGetHeaders)(e.getExportRequestHeaders):this._beforeSend=function(){}}export(e,r){let n=String(this._serviceName||e[0].resource.attributes[_6t.ATTR_SERVICE_NAME]||this.DEFAULT_SERVICE_NAME);if(WPr.diag.debug("Zipkin exporter export"),this._isShutdown){setTimeout(()=>r({code:zPr.ExportResultCode.FAILED,error:new Error("Exporter has been shutdown")}));return}let o=new Promise(a=>{this._sendSpans(e,n,c=>{a(),r(c)})});this._sendingPromises.push(o);let s=()=>{let a=this._sendingPromises.indexOf(o);this._sendingPromises.splice(a,1)};o.then(s,s)}shutdown(){return WPr.diag.debug("Zipkin exporter shutdown"),this._isShutdown=!0,this.forceFlush()}forceFlush(){return new Promise((e,r)=>{Promise.all(this._sendingPromises).then(()=>{e()},r)})}_beforeSend(){this._getHeaders&&(this._send=(0,YPr.prepareSend)(this._urlStr,this._getHeaders()))}_sendSpans(e,r,n){let o=e.map(s=>(0,y6t.toZipkinSpan)(s,String(s.attributes[_6t.ATTR_SERVICE_NAME]||s.resource.attributes[_6t.ATTR_SERVICE_NAME]||r),this._statusCodeTagName,this._statusDescriptionTagName));return this._beforeSend(),this._send(o,s=>{if(n)return n(s)})}};aNe.ZipkinExporter=E6t});var XPr=I(zJ=>{"use strict";Object.defineProperty(zJ,"__esModule",{value:!0});zJ.ZipkinExporter=zJ.prepareSend=void 0;var u0o=g6t();Object.defineProperty(zJ,"prepareSend",{enumerable:!0,get:function(){return u0o.prepareSend}});var d0o=KPr();Object.defineProperty(zJ,"ZipkinExporter",{enumerable:!0,get:function(){return d0o.ZipkinExporter}})});var v6t=I(cNe=>{"use strict";Object.defineProperty(cNe,"__esModule",{value:!0});cNe.B3_DEBUG_FLAG_KEY=void 0;var f0o=(ir(),bt(hr));cNe.B3_DEBUG_FLAG_KEY=(0,f0o.createContextKey)("OpenTelemetry Context Key B3 Debug Flag")});var Ime=I(By=>{"use strict";Object.defineProperty(By,"__esModule",{value:!0});By.X_B3_FLAGS=By.X_B3_PARENT_SPAN_ID=By.X_B3_SAMPLED=By.X_B3_SPAN_ID=By.X_B3_TRACE_ID=By.B3_CONTEXT_HEADER=void 0;By.B3_CONTEXT_HEADER="b3";By.X_B3_TRACE_ID="x-b3-traceid";By.X_B3_SPAN_ID="x-b3-spanid";By.X_B3_SAMPLED="x-b3-sampled";By.X_B3_PARENT_SPAN_ID="x-b3-parentspanid";By.X_B3_FLAGS="x-b3-flags"});var eMr=I(uNe=>{"use strict";Object.defineProperty(uNe,"__esModule",{value:!0});uNe.B3MultiPropagator=void 0;var iS=(ir(),bt(hr)),p0o=yi(),JPr=v6t(),xE=Ime(),h0o=new Set([!0,"true","True","1",1]),m0o=new Set([!1,"false","False","0",0]);function g0o(t){return t===iS.TraceFlags.SAMPLED||t===iS.TraceFlags.NONE}function A0o(t){return Array.isArray(t)?t[0]:t}function lNe(t,e,r){let n=e.get(t,r);return A0o(n)}function y0o(t,e){let r=lNe(t,e,xE.X_B3_TRACE_ID);return typeof r=="string"?r.padStart(32,"0"):""}function _0o(t,e){let r=lNe(t,e,xE.X_B3_SPAN_ID);return typeof r=="string"?r:""}function ZPr(t,e){return lNe(t,e,xE.X_B3_FLAGS)==="1"?"1":void 0}function E0o(t,e){let r=lNe(t,e,xE.X_B3_SAMPLED);if(ZPr(t,e)==="1"||h0o.has(r))return iS.TraceFlags.SAMPLED;if(r===void 0||m0o.has(r))return iS.TraceFlags.NONE}var b6t=class{inject(e,r,n){let o=iS.trace.getSpanContext(e);if(!o||!(0,iS.isSpanContextValid)(o)||(0,p0o.isTracingSuppressed)(e))return;let s=e.getValue(JPr.B3_DEBUG_FLAG_KEY);n.set(r,xE.X_B3_TRACE_ID,o.traceId),n.set(r,xE.X_B3_SPAN_ID,o.spanId),s==="1"?n.set(r,xE.X_B3_FLAGS,s):o.traceFlags!==void 0&&n.set(r,xE.X_B3_SAMPLED,(iS.TraceFlags.SAMPLED&o.traceFlags)===iS.TraceFlags.SAMPLED?"1":"0")}extract(e,r,n){let o=y0o(r,n),s=_0o(r,n),a=E0o(r,n),c=ZPr(r,n);return(0,iS.isValidTraceId)(o)&&(0,iS.isValidSpanId)(s)&&g0o(a)?(e=e.setValue(JPr.B3_DEBUG_FLAG_KEY,c),iS.trace.setSpanContext(e,{traceId:o,spanId:s,isRemote:!0,traceFlags:a})):e}fields(){return[xE.X_B3_TRACE_ID,xE.X_B3_SPAN_ID,xE.X_B3_FLAGS,xE.X_B3_SAMPLED,xE.X_B3_PARENT_SPAN_ID]}};uNe.B3MultiPropagator=b6t});var rMr=I(dNe=>{"use strict";Object.defineProperty(dNe,"__esModule",{value:!0});dNe.B3SinglePropagator=void 0;var UQ=(ir(),bt(hr)),v0o=yi(),tMr=v6t(),C6t=Ime(),b0o=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,C0o="0".repeat(16),S0o=new Set(["d","1"]),x0o="d";function w0o(t){return t.length===32?t:`${C0o}${t}`}function T0o(t){return t&&S0o.has(t)?UQ.TraceFlags.SAMPLED:UQ.TraceFlags.NONE}var S6t=class{inject(e,r,n){let o=UQ.trace.getSpanContext(e);if(!o||!(0,UQ.isSpanContextValid)(o)||(0,v0o.isTracingSuppressed)(e))return;let s=e.getValue(tMr.B3_DEBUG_FLAG_KEY)||o.traceFlags&1,a=`${o.traceId}-${o.spanId}-${s}`;n.set(r,C6t.B3_CONTEXT_HEADER,a)}extract(e,r,n){let o=n.get(r,C6t.B3_CONTEXT_HEADER),s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let a=s.match(b0o);if(!a)return e;let[,c,u,d]=a,f=w0o(c);if(!(0,UQ.isValidTraceId)(f)||!(0,UQ.isValidSpanId)(u))return e;let p=T0o(d);return d===x0o&&(e=e.setValue(tMr.B3_DEBUG_FLAG_KEY,d)),UQ.trace.setSpanContext(e,{traceId:f,spanId:u,isRemote:!0,traceFlags:p})}fields(){return[C6t.B3_CONTEXT_HEADER]}};dNe.B3SinglePropagator=S6t});var x6t=I(Dme=>{"use strict";Object.defineProperty(Dme,"__esModule",{value:!0});Dme.B3InjectEncoding=void 0;var I0o;(function(t){t[t.SINGLE_HEADER=0]="SINGLE_HEADER",t[t.MULTI_HEADER=1]="MULTI_HEADER"})(I0o=Dme.B3InjectEncoding||(Dme.B3InjectEncoding={}))});var nMr=I(fNe=>{"use strict";Object.defineProperty(fNe,"__esModule",{value:!0});fNe.B3Propagator=void 0;var D0o=yi(),R0o=eMr(),k0o=rMr(),N0o=Ime(),O0o=x6t(),w6t=class{_b3MultiPropagator=new R0o.B3MultiPropagator;_b3SinglePropagator=new k0o.B3SinglePropagator;_inject;_fields;constructor(e={}){e.injectEncoding===O0o.B3InjectEncoding.MULTI_HEADER?(this._inject=this._b3MultiPropagator.inject,this._fields=this._b3MultiPropagator.fields()):(this._inject=this._b3SinglePropagator.inject,this._fields=this._b3SinglePropagator.fields())}inject(e,r,n){(0,D0o.isTracingSuppressed)(e)||this._inject(e,r,n)}extract(e,r,n){let o=n.get(r,N0o.B3_CONTEXT_HEADER);return(Array.isArray(o)?o[0]:o)?this._b3SinglePropagator.extract(e,r,n):this._b3MultiPropagator.extract(e,r,n)}fields(){return this._fields}};fNe.B3Propagator=w6t});var iMr=I(Rg=>{"use strict";Object.defineProperty(Rg,"__esModule",{value:!0});Rg.B3InjectEncoding=Rg.X_B3_TRACE_ID=Rg.X_B3_SPAN_ID=Rg.X_B3_SAMPLED=Rg.X_B3_PARENT_SPAN_ID=Rg.X_B3_FLAGS=Rg.B3_CONTEXT_HEADER=Rg.B3Propagator=void 0;var B0o=nMr();Object.defineProperty(Rg,"B3Propagator",{enumerable:!0,get:function(){return B0o.B3Propagator}});var YJ=Ime();Object.defineProperty(Rg,"B3_CONTEXT_HEADER",{enumerable:!0,get:function(){return YJ.B3_CONTEXT_HEADER}});Object.defineProperty(Rg,"X_B3_FLAGS",{enumerable:!0,get:function(){return YJ.X_B3_FLAGS}});Object.defineProperty(Rg,"X_B3_PARENT_SPAN_ID",{enumerable:!0,get:function(){return YJ.X_B3_PARENT_SPAN_ID}});Object.defineProperty(Rg,"X_B3_SAMPLED",{enumerable:!0,get:function(){return YJ.X_B3_SAMPLED}});Object.defineProperty(Rg,"X_B3_SPAN_ID",{enumerable:!0,get:function(){return YJ.X_B3_SPAN_ID}});Object.defineProperty(Rg,"X_B3_TRACE_ID",{enumerable:!0,get:function(){return YJ.X_B3_TRACE_ID}});var P0o=x6t();Object.defineProperty(Rg,"B3InjectEncoding",{enumerable:!0,get:function(){return P0o.B3InjectEncoding}})});var oMr=I(oS=>{"use strict";Object.defineProperty(oS,"__esModule",{value:!0});oS.JaegerPropagator=oS.UBER_BAGGAGE_HEADER_PREFIX=oS.UBER_TRACE_ID_HEADER=void 0;var QQ=(ir(),bt(hr)),M0o=yi();oS.UBER_TRACE_ID_HEADER="uber-trace-id";oS.UBER_BAGGAGE_HEADER_PREFIX="uberctx";var T6t=class{_jaegerTraceHeader;_jaegerBaggageHeaderPrefix;constructor(e){typeof e=="string"?(this._jaegerTraceHeader=e,this._jaegerBaggageHeaderPrefix=oS.UBER_BAGGAGE_HEADER_PREFIX):(this._jaegerTraceHeader=e?.customTraceHeader||oS.UBER_TRACE_ID_HEADER,this._jaegerBaggageHeaderPrefix=e?.customBaggageHeaderPrefix||oS.UBER_BAGGAGE_HEADER_PREFIX)}inject(e,r,n){let o=QQ.trace.getSpanContext(e),s=QQ.propagation.getBaggage(e);if(o&&(0,M0o.isTracingSuppressed)(e)===!1){let a=`0${(o.traceFlags||QQ.TraceFlags.NONE).toString(16)}`;n.set(r,this._jaegerTraceHeader,`${o.traceId}:${o.spanId}:0:${a}`)}if(s)for(let[a,c]of s.getAllEntries())n.set(r,`${this._jaegerBaggageHeaderPrefix}-${a}`,encodeURIComponent(c.value))}extract(e,r,n){let o=n.get(r,this._jaegerTraceHeader),s=Array.isArray(o)?o[0]:o,a=n.keys(r).filter(d=>d.startsWith(`${this._jaegerBaggageHeaderPrefix}-`)).map(d=>{let f=n.get(r,d);return{key:d.substring(this._jaegerBaggageHeaderPrefix.length+1),value:Array.isArray(f)?f[0]:f}}),c=e;if(typeof s=="string"){let d=L0o(s);d&&(c=QQ.trace.setSpanContext(c,d))}if(a.length===0)return c;let u=QQ.propagation.getBaggage(e)??QQ.propagation.createBaggage();for(let d of a)d.value!==void 0&&(u=u.setEntry(d.key,{value:decodeURIComponent(d.value)}));return c=QQ.propagation.setBaggage(c,u),c}fields(){return[this._jaegerTraceHeader]}};oS.JaegerPropagator=T6t;var F0o=/^[0-9a-f]{1,2}$/i;function L0o(t){let e=decodeURIComponent(t).split(":");if(e.length!==4)return null;let[r,n,,o]=e,s=r.padStart(32,"0"),a=n.padStart(16,"0"),c=F0o.test(o)?parseInt(o,16)&1:1;return{traceId:s,spanId:a,isRemote:!0,traceFlags:c}}});var sMr=I(rO=>{"use strict";Object.defineProperty(rO,"__esModule",{value:!0});rO.UBER_TRACE_ID_HEADER=rO.UBER_BAGGAGE_HEADER_PREFIX=rO.JaegerPropagator=void 0;var I6t=oMr();Object.defineProperty(rO,"JaegerPropagator",{enumerable:!0,get:function(){return I6t.JaegerPropagator}});Object.defineProperty(rO,"UBER_BAGGAGE_HEADER_PREFIX",{enumerable:!0,get:function(){return I6t.UBER_BAGGAGE_HEADER_PREFIX}});Object.defineProperty(rO,"UBER_TRACE_ID_HEADER",{enumerable:!0,get:function(){return I6t.UBER_TRACE_ID_HEADER}})});var uMr=I(Hv=>{"use strict";Object.defineProperty(Hv,"__esModule",{value:!0});Hv.getPropagatorFromEnv=Hv.getSpanProcessorsFromEnv=Hv.getOtlpProtocolFromEnv=Hv.filterBlanksAndNulls=Hv.getResourceDetectorsFromEnv=void 0;var nO=(ir(),bt(hr)),iO=yi(),aMr=OAt(),U0o=MPr(),Q0o=UPr(),j0o=XPr(),Rme=$X(),pNe=mDe(),D6t=iMr(),$0o=sMr(),G0o="env",q0o="host",H0o="os",V0o="process",W0o="serviceinstance";function z0o(){let t=new Map([[G0o,Rme.envDetector],[q0o,Rme.hostDetector],[H0o,Rme.osDetector],[W0o,Rme.serviceInstanceIdDetector],[V0o,Rme.processDetector]]),e=(0,iO.getStringListFromEnv)("OTEL_NODE_RESOURCE_DETECTORS")??["all"];return e.includes("all")?[...t.values()].flat():e.includes("none")?[]:e.flatMap(r=>{let n=t.get(r);return n||nO.diag.warn(`Invalid resource detector "${r}" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`),n||[]})}Hv.getResourceDetectorsFromEnv=z0o;function cMr(t){return t.map(e=>e.trim()).filter(e=>e!=="null"&&e!=="")}Hv.filterBlanksAndNulls=cMr;function lMr(){return(0,iO.getStringFromEnv)("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL")??(0,iO.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL")??"http/protobuf"}Hv.getOtlpProtocolFromEnv=lMr;function Y0o(){let t=lMr();switch(t){case"grpc":return new Q0o.OTLPTraceExporter;case"http/json":return new U0o.OTLPTraceExporter;case"http/protobuf":return new aMr.OTLPTraceExporter;default:return nO.diag.warn(`Unsupported OTLP traces protocol: ${t}. Using http/protobuf.`),new aMr.OTLPTraceExporter}}function K0o(){try{let{JaegerExporter:t}=_e("@opentelemetry/exporter-jaeger");return new t}catch(t){throw new Error(`Could not instantiate JaegerExporter. This could be due to the JaegerExporter's lack of support for bundling. If possible, use @opentelemetry/exporter-trace-otlp-proto instead. Original Error: ${t}`)}}function X0o(){let t=new Map([["otlp",()=>Y0o()],["zipkin",()=>new j0o.ZipkinExporter],["console",()=>new pNe.ConsoleSpanExporter],["jaeger",()=>K0o()]]),e=[],r=[],n=cMr(Array.from(new Set((0,iO.getStringListFromEnv)("OTEL_TRACES_EXPORTER"))));if(n[0]==="none")return nO.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.'),[];n.length===0?(nO.diag.debug("OTEL_TRACES_EXPORTER is empty. Using default otlp exporter."),n=["otlp"]):n.length>1&&n.includes("none")&&(nO.diag.warn('OTEL_TRACES_EXPORTER contains "none" along with other exporters. Using default otlp exporter.'),n=["otlp"]);for(let o of n){let s=t.get(o)?.();s?e.push(s):nO.diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${o}.`)}for(let o of e)o instanceof pNe.ConsoleSpanExporter?r.push(new pNe.SimpleSpanProcessor(o)):r.push(new pNe.BatchSpanProcessor(o));return e.length===0&&nO.diag.warn("Unable to set up trace exporter(s) due to invalid exporter and/or protocol values."),r}Hv.getSpanProcessorsFromEnv=X0o;function J0o(){let t=(0,iO.getStringListFromEnv)("OTEL_PROPAGATORS");if(t==null)return;let e=new Map([["tracecontext",()=>new iO.W3CTraceContextPropagator],["baggage",()=>new iO.W3CBaggagePropagator],["b3",()=>new D6t.B3Propagator],["b3multi",()=>new D6t.B3Propagator({injectEncoding:D6t.B3InjectEncoding.MULTI_HEADER})],["jaeger",()=>new $0o.JaegerPropagator]]),r=Array.from(new Set(t)),o=r.map(s=>{let a=e.get(s)?.();if(!a){nO.diag.warn(`Propagator "${s}" requested through environment variable is unavailable.`);return}return a}).reduce((s,a)=>(a&&s.push(a),s),[]);return o.length===0?null:r.length===1?o[0]:new iO.CompositePropagator({propagators:o})}Hv.getPropagatorFromEnv=J0o});var pMr=I(hNe=>{"use strict";Object.defineProperty(hNe,"__esModule",{value:!0});hNe.NodeSDK=void 0;var o3=(ir(),bt(hr)),Z0o=LX(),eAo=KRr(),KJ=$X(),kme=y2t(),tAo=jAt(),rAo=APr(),R6t=CPr(),nAo=wPr(),dMr=UAt(),iAo=W9e(),oAo=RPr(),jQ=Zx(),sAo=mDe(),aAo=qIe(),cAo=(xm(),bt(d2)),oO=yi(),k6t=uMr();function fMr(t,e){return parseInt(process.env[t]||"")||e}function lAo(){let t=[],e=(0,oO.getStringListFromEnv)("OTEL_METRICS_EXPORTER");return e?(e.length===0&&o3.diag.debug("OTEL_METRICS_EXPORTER is empty. Using default otlp exporter."),e.includes("none")?(o3.diag.info('OTEL_METRICS_EXPORTER contains "none". Metric provider will not be initialized.'),t):(e.forEach(r=>{if(r==="otlp"){let n=process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),o=fMr("OTEL_METRIC_EXPORT_INTERVAL",6e4),s=fMr("OTEL_METRIC_EXPORT_TIMEOUT",3e4);switch(n){case"grpc":t.push(new jQ.PeriodicExportingMetricReader({exporter:new nAo.OTLPMetricExporter,exportIntervalMillis:o,exportTimeoutMillis:s}));break;case"http/json":t.push(new jQ.PeriodicExportingMetricReader({exporter:new iAo.OTLPMetricExporter,exportIntervalMillis:o,exportTimeoutMillis:s}));break;case"http/protobuf":t.push(new jQ.PeriodicExportingMetricReader({exporter:new dMr.OTLPMetricExporter,exportIntervalMillis:o,exportTimeoutMillis:s}));break;default:o3.diag.warn(`Unsupported OTLP metrics protocol: "${n}". Using http/protobuf.`),t.push(new jQ.PeriodicExportingMetricReader({exporter:new dMr.OTLPMetricExporter,exportIntervalMillis:o,exportTimeoutMillis:s}))}}else r==="console"?t.push(new jQ.PeriodicExportingMetricReader({exporter:new jQ.ConsoleMetricExporter})):r==="prometheus"?t.push(new oAo.PrometheusExporter):o3.diag.warn(`Unsupported OTEL_METRICS_EXPORTER value: "${r}". Supported values are: otlp, console, prometheus, none.`)}),t)):t}var N6t=class{_tracerProviderConfig;_loggerProviderConfig;_meterProviderConfig;_instrumentations;_resource;_resourceDetectors;_autoDetectResources;_tracerProvider;_loggerProvider;_meterProvider;_serviceName;_configuration;_disabled;constructor(e={}){(0,oO.getBooleanFromEnv)("OTEL_SDK_DISABLED")&&(this._disabled=!0);let r=(0,oO.getStringFromEnv)("OTEL_LOG_LEVEL");if(r!=null&&o3.diag.setLogger(new o3.DiagConsoleLogger,{logLevel:(0,oO.diagLogLevelFromString)(r)}),this._configuration=e,this._resource=e.resource??(0,KJ.defaultResource)(),this._autoDetectResources=e.autoDetectResources??!0,this._autoDetectResources?e.resourceDetectors!=null?this._resourceDetectors=e.resourceDetectors:(0,oO.getStringFromEnv)("OTEL_NODE_RESOURCE_DETECTORS")?this._resourceDetectors=(0,k6t.getResourceDetectorsFromEnv)():this._resourceDetectors=[KJ.envDetector,KJ.processDetector,KJ.hostDetector]:this._resourceDetectors=[],this._serviceName=e.serviceName,e.traceExporter||e.spanProcessor||e.spanProcessors){let n={};e.sampler&&(n.sampler=e.sampler),e.spanLimits&&(n.spanLimits=e.spanLimits),e.idGenerator&&(n.idGenerator=e.idGenerator),e.spanProcessor&&o3.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");let o=e.spanProcessor??new sAo.BatchSpanProcessor(e.traceExporter),s=e.spanProcessors??[o];this._tracerProviderConfig={tracerConfig:n,spanProcessors:s,contextManager:e.contextManager,textMapPropagator:e.textMapPropagator}}if(e.logRecordProcessors?this._loggerProviderConfig={logRecordProcessors:e.logRecordProcessors}:e.logRecordProcessor?(this._loggerProviderConfig={logRecordProcessors:[e.logRecordProcessor]},o3.diag.warn("The 'logRecordProcessor' option is deprecated. Please use 'logRecordProcessors' instead.")):this.configureLoggerProviderFromEnv(),e.metricReaders||e.metricReader||e.views){let n={};e.metricReaders?n.readers=e.metricReaders:e.metricReader&&(n.readers=[e.metricReader],o3.diag.warn("The 'metricReader' option is deprecated. Please use 'metricReaders' instead.")),e.views&&(n.views=e.views),this._meterProviderConfig=n}this._instrumentations=e.instrumentations?.flat()??[]}start(){if(this._disabled)return;if((0,eAo.registerInstrumentations)({instrumentations:this._instrumentations}),this._autoDetectResources){let n={detectors:this._resourceDetectors};this._resource=this._resource.merge((0,KJ.detectResources)(n))}this._resource=this._serviceName===void 0?this._resource:this._resource.merge((0,KJ.resourceFromAttributes)({[cAo.ATTR_SERVICE_NAME]:this._serviceName}));let e=this._tracerProviderConfig?this._tracerProviderConfig.spanProcessors:(0,k6t.getSpanProcessorsFromEnv)();if(this._tracerProvider=new aAo.NodeTracerProvider({...this._configuration,resource:this._resource,spanProcessors:e}),e.length>0&&this._tracerProvider.register({contextManager:this._tracerProviderConfig?.contextManager??this._configuration?.contextManager,propagator:this._tracerProviderConfig?.textMapPropagator??(0,k6t.getPropagatorFromEnv)()}),this._loggerProviderConfig){let n=new kme.LoggerProvider({resource:this._resource,processors:this._loggerProviderConfig.logRecordProcessors});this._loggerProvider=n,Z0o.logs.setGlobalLoggerProvider(n)}let r=lAo();if(this._meterProviderConfig||r.length>0){let n=[];this._meterProviderConfig?.readers&&n.push(...this._meterProviderConfig.readers),n.length===0&&r.forEach(s=>n.push(s));let o=new jQ.MeterProvider({resource:this._resource,views:this._meterProviderConfig?.views??[],readers:n});this._meterProvider=o,o3.metrics.setGlobalMeterProvider(o);for(let s of this._instrumentations)s.setMeterProvider(o3.metrics.getMeterProvider())}}shutdown(){let e=[];return this._tracerProvider&&e.push(this._tracerProvider.shutdown()),this._loggerProvider&&e.push(this._loggerProvider.shutdown()),this._meterProvider&&e.push(this._meterProvider.shutdown()),Promise.all(e).then(()=>{})}configureLoggerProviderFromEnv(){let e=(0,oO.getStringListFromEnv)("OTEL_LOGS_EXPORTER")??[];if(e.length===0&&(o3.diag.debug("OTEL_LOGS_EXPORTER is empty. Using default otlp exporter."),e.push("otlp")),e.includes("none")){o3.diag.info('OTEL_LOGS_EXPORTER contains "none". Logger provider will not be initialized.');return}let r=[];e.forEach(n=>{if(n==="otlp"){let o=((0,oO.getStringFromEnv)("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL")??(0,oO.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL"))?.trim();switch(o){case"grpc":r.push(new rAo.OTLPLogExporter);break;case"http/json":r.push(new tAo.OTLPLogExporter);break;case"http/protobuf":r.push(new R6t.OTLPLogExporter);break;case void 0:case"":r.push(new R6t.OTLPLogExporter);break;default:o3.diag.warn(`Unsupported OTLP logs protocol: "${o}". Using http/protobuf.`),r.push(new R6t.OTLPLogExporter)}}else n==="console"?r.push(new kme.ConsoleLogRecordExporter):o3.diag.warn(`Unsupported OTEL_LOGS_EXPORTER value: "${n}". Supported values are: otlp, console, none.`)}),r.length>0&&(this._loggerProviderConfig={logRecordProcessors:r.map(n=>n instanceof kme.ConsoleLogRecordExporter?new kme.SimpleLogRecordProcessor(n):new kme.BatchLogRecordProcessor(n))})}};hNe.NodeSDK=N6t});var hMr=I(Fh=>{"use strict";Object.defineProperty(Fh,"__esModule",{value:!0});Fh.NodeSDK=Fh.tracing=Fh.resources=Fh.node=Fh.metrics=Fh.logs=Fh.core=Fh.contextBase=Fh.api=void 0;Fh.api=(ir(),bt(hr));Fh.contextBase=(ir(),bt(hr));Fh.core=yi();Fh.logs=y2t();Fh.metrics=Zx();Fh.node=qIe();Fh.resources=$X();Fh.tracing=mDe();var uAo=pMr();Object.defineProperty(Fh,"NodeSDK",{enumerable:!0,get:function(){return uAo.NodeSDK}})});function dAo(t,e){return new Promise((r,n)=>{let o=setTimeout(()=>{n(new Error(`Operation timed out after ${e} ms`))},e);t.then(r).catch(n).finally(()=>clearTimeout(o))})}var mMr,mNe,gMr=q(()=>{"use strict";mMr=we(Zx(),1);mNe=class extends mMr.PeriodicExportingMetricReader{_alignSeconds=[0,20,40];_intervalSeconds=20;constructor(e){if(super({...e,exportIntervalMillis:e.exportIntervalMillis??2e4}),(e.exportIntervalMillis??2e4)!==2e4)throw new Error("Aligned reader only supports 20-second intervals for 0/20/40 alignment")}onInitialized(){let e=new Date,r=e.getSeconds(),n=e.getMilliseconds(),o=this._alignSeconds.find(c=>c>=r),s;o!==void 0?s=(o-r)*1e3-n:(s=(60-r)*1e3-n,o=0),s=Math.max(0,s);let a=setTimeout(()=>{this._alignedExport(),this._interval=setInterval(()=>{this._alignedExport()},this._intervalSeconds*1e3);let c=this._interval;typeof c!="number"&&c?.unref&&c.unref()},s);typeof a!="number"&&a?.unref&&a.unref()}async _alignedExport(){let e=this._exportTimeout;try{await dAo(this._doCollectAndExport(),e)}catch{}}async _doCollectAndExport(){let e=this._exportTimeout,{resourceMetrics:r,errors:n}=await this.collect({timeoutMillis:e});if(n.length>0,r.resource.asyncAttributesPending)try{await r.resource.waitForAsyncAttributes?.()}catch{}if(r.scopeMetrics.length===0)return;await this._exporter.export(r)}async onShutdown(){let e=this._interval;e&&clearInterval(e),await super.onShutdown()}}});var Nme=I(sO=>{"use strict";Object.defineProperty(sO,"__esModule",{value:!0});sO.isTracingSuppressed=sO.unsuppressTracing=sO.suppressTracing=void 0;var fAo=(ir(),bt(hr)),O6t=(0,fAo.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function pAo(t){return t.setValue(O6t,!0)}sO.suppressTracing=pAo;function hAo(t){return t.deleteValue(O6t)}sO.unsuppressTracing=hAo;function mAo(t){return t.getValue(O6t)===!0}sO.isTracingSuppressed=mAo});var B6t=I(g2=>{"use strict";Object.defineProperty(g2,"__esModule",{value:!0});g2.BAGGAGE_MAX_TOTAL_LENGTH=g2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=g2.BAGGAGE_MAX_NAME_VALUE_PAIRS=g2.BAGGAGE_HEADER=g2.BAGGAGE_ITEMS_SEPARATOR=g2.BAGGAGE_PROPERTIES_SEPARATOR=g2.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;g2.BAGGAGE_KEY_PAIR_SEPARATOR="=";g2.BAGGAGE_PROPERTIES_SEPARATOR=";";g2.BAGGAGE_ITEMS_SEPARATOR=",";g2.BAGGAGE_HEADER="baggage";g2.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;g2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;g2.BAGGAGE_MAX_TOTAL_LENGTH=8192});var P6t=I(kw=>{"use strict";Object.defineProperty(kw,"__esModule",{value:!0});kw.parseKeyPairsIntoRecord=kw.parsePairKeyValue=kw.getKeyPairs=kw.serializeKeyPairs=void 0;var gAo=(ir(),bt(hr)),$Q=B6t();function AAo(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?$Q.BAGGAGE_ITEMS_SEPARATOR:""}${r}`;return n.length>$Q.BAGGAGE_MAX_TOTAL_LENGTH?e:n},"")}kw.serializeKeyPairs=AAo;function yAo(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=$Q.BAGGAGE_PROPERTIES_SEPARATOR+r.metadata.toString()),n})}kw.getKeyPairs=yAo;function AMr(t){let e=t.split($Q.BAGGAGE_PROPERTIES_SEPARATOR);if(e.length<=0)return;let r=e.shift();if(!r)return;let n=r.indexOf($Q.BAGGAGE_KEY_PAIR_SEPARATOR);if(n<=0)return;let o=decodeURIComponent(r.substring(0,n).trim()),s=decodeURIComponent(r.substring(n+1).trim()),a;return e.length>0&&(a=(0,gAo.baggageEntryMetadataFromString)(e.join($Q.BAGGAGE_PROPERTIES_SEPARATOR))),{key:o,value:s,metadata:a}}kw.parsePairKeyValue=AMr;function _Ao(t){let e={};return typeof t=="string"&&t.length>0&&t.split($Q.BAGGAGE_ITEMS_SEPARATOR).forEach(r=>{let n=AMr(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}kw.parseKeyPairsIntoRecord=_Ao});var yMr=I(gNe=>{"use strict";Object.defineProperty(gNe,"__esModule",{value:!0});gNe.W3CBaggagePropagator=void 0;var M6t=(ir(),bt(hr)),EAo=Nme(),GQ=B6t(),F6t=P6t(),L6t=class{inject(e,r,n){let o=M6t.propagation.getBaggage(e);if(!o||(0,EAo.isTracingSuppressed)(e))return;let s=(0,F6t.getKeyPairs)(o).filter(c=>c.length<=GQ.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,GQ.BAGGAGE_MAX_NAME_VALUE_PAIRS),a=(0,F6t.serializeKeyPairs)(s);a.length>0&&n.set(r,GQ.BAGGAGE_HEADER,a)}extract(e,r,n){let o=n.get(r,GQ.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(GQ.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let a={};return s.length===0||(s.split(GQ.BAGGAGE_ITEMS_SEPARATOR).forEach(u=>{let d=(0,F6t.parsePairKeyValue)(u);if(d){let f={value:d.value};d.metadata&&(f.metadata=d.metadata),a[d.key]=f}}),Object.entries(a).length===0)?e:M6t.propagation.setBaggage(e,M6t.propagation.createBaggage(a))}fields(){return[GQ.BAGGAGE_HEADER]}};gNe.W3CBaggagePropagator=L6t});var _Mr=I(ANe=>{"use strict";Object.defineProperty(ANe,"__esModule",{value:!0});ANe.AnchoredClock=void 0;var U6t=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,r){this._monotonicClock=r,this._epochMillis=e.now(),this._performanceMillis=r.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}};ANe.AnchoredClock=U6t});var SMr=I(aO=>{"use strict";Object.defineProperty(aO,"__esModule",{value:!0});aO.isAttributeValue=aO.isAttributeKey=aO.sanitizeAttributes=void 0;var EMr=(ir(),bt(hr));function vAo(t){let e={};if(typeof t!="object"||t==null)return e;for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!vMr(r)){EMr.diag.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!bMr(n)){EMr.diag.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}aO.sanitizeAttributes=vAo;function vMr(t){return typeof t=="string"&&t!==""}aO.isAttributeKey=vMr;function bMr(t){return t==null?!0:Array.isArray(t)?bAo(t):CMr(typeof t)}aO.isAttributeValue=bMr;function bAo(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(CMr(n)){e=n;continue}return!1}return!1}}return!0}function CMr(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var Q6t=I(yNe=>{"use strict";Object.defineProperty(yNe,"__esModule",{value:!0});yNe.loggingErrorHandler=void 0;var CAo=(ir(),bt(hr));function SAo(){return t=>{CAo.diag.error(xAo(t))}}yNe.loggingErrorHandler=SAo;function xAo(t){return typeof t=="string"?t:JSON.stringify(wAo(t))}function wAo(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let o=r[n];o&&(e[n]=String(o))}),r=Object.getPrototypeOf(r);return e}});var wMr=I(XJ=>{"use strict";Object.defineProperty(XJ,"__esModule",{value:!0});XJ.globalErrorHandler=XJ.setGlobalErrorHandler=void 0;var TAo=Q6t(),xMr=(0,TAo.loggingErrorHandler)();function IAo(t){xMr=t}XJ.setGlobalErrorHandler=IAo;function DAo(t){try{xMr(t)}catch{}}XJ.globalErrorHandler=DAo});var RMr=I(Nw=>{"use strict";Object.defineProperty(Nw,"__esModule",{value:!0});Nw.getStringListFromEnv=Nw.getBooleanFromEnv=Nw.getStringFromEnv=Nw.getNumberFromEnv=void 0;var TMr=(ir(),bt(hr)),IMr=_e("util");function RAo(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){TMr.diag.warn(`Unknown value ${(0,IMr.inspect)(e)} for ${t}, expected a number, using defaults`);return}return r}Nw.getNumberFromEnv=RAo;function DMr(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}Nw.getStringFromEnv=DMr;function kAo(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||TMr.diag.warn(`Unknown value ${(0,IMr.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}Nw.getBooleanFromEnv=kAo;function NAo(t){return DMr(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}Nw.getStringListFromEnv=NAo});var kMr=I(_Ne=>{"use strict";Object.defineProperty(_Ne,"__esModule",{value:!0});_Ne._globalThis=void 0;_Ne._globalThis=typeof globalThis=="object"?globalThis:global});var NMr=I(ENe=>{"use strict";Object.defineProperty(ENe,"__esModule",{value:!0});ENe.otperformance=void 0;var OAo=_e("perf_hooks");ENe.otperformance=OAo.performance});var OMr=I(vNe=>{"use strict";Object.defineProperty(vNe,"__esModule",{value:!0});vNe.VERSION=void 0;vNe.VERSION="2.2.0"});var BMr=I(bNe=>{"use strict";Object.defineProperty(bNe,"__esModule",{value:!0});bNe.ATTR_PROCESS_RUNTIME_NAME=void 0;bNe.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var PMr=I(SNe=>{"use strict";Object.defineProperty(SNe,"__esModule",{value:!0});SNe.SDK_INFO=void 0;var BAo=OMr(),CNe=(xm(),bt(d2)),PAo=BMr();SNe.SDK_INFO={[CNe.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[PAo.ATTR_PROCESS_RUNTIME_NAME]:"node",[CNe.ATTR_TELEMETRY_SDK_LANGUAGE]:CNe.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[CNe.ATTR_TELEMETRY_SDK_VERSION]:BAo.VERSION}});var MMr=I(A2=>{"use strict";Object.defineProperty(A2,"__esModule",{value:!0});A2.SDK_INFO=A2.otperformance=A2._globalThis=A2.getStringListFromEnv=A2.getNumberFromEnv=A2.getBooleanFromEnv=A2.getStringFromEnv=void 0;var xNe=RMr();Object.defineProperty(A2,"getStringFromEnv",{enumerable:!0,get:function(){return xNe.getStringFromEnv}});Object.defineProperty(A2,"getBooleanFromEnv",{enumerable:!0,get:function(){return xNe.getBooleanFromEnv}});Object.defineProperty(A2,"getNumberFromEnv",{enumerable:!0,get:function(){return xNe.getNumberFromEnv}});Object.defineProperty(A2,"getStringListFromEnv",{enumerable:!0,get:function(){return xNe.getStringListFromEnv}});var MAo=kMr();Object.defineProperty(A2,"_globalThis",{enumerable:!0,get:function(){return MAo._globalThis}});var FAo=NMr();Object.defineProperty(A2,"otperformance",{enumerable:!0,get:function(){return FAo.otperformance}});var LAo=PMr();Object.defineProperty(A2,"SDK_INFO",{enumerable:!0,get:function(){return LAo.SDK_INFO}})});var j6t=I(y2=>{"use strict";Object.defineProperty(y2,"__esModule",{value:!0});y2.getStringListFromEnv=y2.getNumberFromEnv=y2.getStringFromEnv=y2.getBooleanFromEnv=y2.otperformance=y2._globalThis=y2.SDK_INFO=void 0;var qQ=MMr();Object.defineProperty(y2,"SDK_INFO",{enumerable:!0,get:function(){return qQ.SDK_INFO}});Object.defineProperty(y2,"_globalThis",{enumerable:!0,get:function(){return qQ._globalThis}});Object.defineProperty(y2,"otperformance",{enumerable:!0,get:function(){return qQ.otperformance}});Object.defineProperty(y2,"getBooleanFromEnv",{enumerable:!0,get:function(){return qQ.getBooleanFromEnv}});Object.defineProperty(y2,"getStringFromEnv",{enumerable:!0,get:function(){return qQ.getStringFromEnv}});Object.defineProperty(y2,"getNumberFromEnv",{enumerable:!0,get:function(){return qQ.getNumberFromEnv}});Object.defineProperty(y2,"getStringListFromEnv",{enumerable:!0,get:function(){return qQ.getStringListFromEnv}})});var QMr=I(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.addHrTimes=zu.isTimeInput=zu.isTimeInputHrTime=zu.hrTimeToMicroseconds=zu.hrTimeToMilliseconds=zu.hrTimeToNanoseconds=zu.hrTimeToTimeStamp=zu.hrTimeDuration=zu.timeInputToHrTime=zu.hrTime=zu.getTimeOrigin=zu.millisToHrTime=void 0;var $6t=j6t(),FMr=9,UAo=6,QAo=Math.pow(10,UAo),wNe=Math.pow(10,FMr);function Ome(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*QAo);return[r,n]}zu.millisToHrTime=Ome;function G6t(){let t=$6t.otperformance.timeOrigin;if(typeof t!="number"){let e=$6t.otperformance;t=e.timing&&e.timing.fetchStart}return t}zu.getTimeOrigin=G6t;function LMr(t){let e=Ome(G6t()),r=Ome(typeof t=="number"?t:$6t.otperformance.now());return UMr(e,r)}zu.hrTime=LMr;function jAo(t){if(q6t(t))return t;if(typeof t=="number")return t<G6t()?LMr(t):Ome(t);if(t instanceof Date)return Ome(t.getTime());throw TypeError("Invalid input type")}zu.timeInputToHrTime=jAo;function $Ao(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=wNe),[r,n]}zu.hrTimeDuration=$Ao;function GAo(t){let e=FMr,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}zu.hrTimeToTimeStamp=GAo;function qAo(t){return t[0]*wNe+t[1]}zu.hrTimeToNanoseconds=qAo;function HAo(t){return t[0]*1e3+t[1]/1e6}zu.hrTimeToMilliseconds=HAo;function VAo(t){return t[0]*1e6+t[1]/1e3}zu.hrTimeToMicroseconds=VAo;function q6t(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}zu.isTimeInputHrTime=q6t;function WAo(t){return q6t(t)||typeof t=="number"||t instanceof Date}zu.isTimeInput=WAo;function UMr(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=wNe&&(r[1]-=wNe,r[0]+=1),r}zu.addHrTimes=UMr});var jMr=I(TNe=>{"use strict";Object.defineProperty(TNe,"__esModule",{value:!0});TNe.unrefTimer=void 0;function zAo(t){typeof t!="number"&&t.unref()}TNe.unrefTimer=zAo});var $Mr=I(Bme=>{"use strict";Object.defineProperty(Bme,"__esModule",{value:!0});Bme.ExportResultCode=void 0;var YAo;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(YAo=Bme.ExportResultCode||(Bme.ExportResultCode={}))});var qMr=I(INe=>{"use strict";Object.defineProperty(INe,"__esModule",{value:!0});INe.CompositePropagator=void 0;var GMr=(ir(),bt(hr)),H6t=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(e,r,n){for(let o of this._propagators)try{o.inject(e,r,n)}catch(s){GMr.diag.warn(`Failed to inject with ${o.constructor.name}. Err: ${s.message}`)}}extract(e,r,n){return this._propagators.reduce((o,s)=>{try{return s.extract(o,r,n)}catch(a){GMr.diag.warn(`Failed to extract with ${s.constructor.name}. Err: ${a.message}`)}return o},e)}fields(){return this._fields.slice()}};INe.CompositePropagator=H6t});var HMr=I(JJ=>{"use strict";Object.defineProperty(JJ,"__esModule",{value:!0});JJ.validateValue=JJ.validateKey=void 0;var V6t="[_0-9a-z-*/]",KAo=`[a-z]${V6t}{0,255}`,XAo=`[a-z0-9]${V6t}{0,240}@[a-z]${V6t}{0,13}`,JAo=new RegExp(`^(?:${KAo}|${XAo})$`),ZAo=/^[ -~]{0,255}[!-~]$/,e2o=/,|=/;function t2o(t){return JAo.test(t)}JJ.validateKey=t2o;function r2o(t){return ZAo.test(t)&&!e2o.test(t)}JJ.validateValue=r2o});var z6t=I(DNe=>{"use strict";Object.defineProperty(DNe,"__esModule",{value:!0});DNe.TraceState=void 0;var VMr=HMr(),WMr=32,n2o=512,zMr=",",YMr="=",W6t=class t{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,r){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n}unset(e){let r=this._clone();return r._internalState.delete(e),r}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,r)=>(e.push(r+YMr+this.get(r)),e),[]).join(zMr)}_parse(e){e.length>n2o||(this._internalState=e.split(zMr).reverse().reduce((r,n)=>{let o=n.trim(),s=o.indexOf(YMr);if(s!==-1){let a=o.slice(0,s),c=o.slice(s+1,n.length);(0,VMr.validateKey)(a)&&(0,VMr.validateValue)(c)&&r.set(a,c)}return r},new Map),this._internalState.size>WMr&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,WMr))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};DNe.TraceState=W6t});var XMr=I(_2=>{"use strict";Object.defineProperty(_2,"__esModule",{value:!0});_2.W3CTraceContextPropagator=_2.parseTraceParent=_2.TRACE_STATE_HEADER=_2.TRACE_PARENT_HEADER=void 0;var RNe=(ir(),bt(hr)),i2o=Nme(),o2o=z6t();_2.TRACE_PARENT_HEADER="traceparent";_2.TRACE_STATE_HEADER="tracestate";var s2o="00",a2o="(?!ff)[\\da-f]{2}",c2o="(?![0]{32})[\\da-f]{32}",l2o="(?![0]{16})[\\da-f]{16}",u2o="[\\da-f]{2}",d2o=new RegExp(`^\\s?(${a2o})-(${c2o})-(${l2o})-(${u2o})(-.*)?\\s?$`);function KMr(t){let e=d2o.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}_2.parseTraceParent=KMr;var Y6t=class{inject(e,r,n){let o=RNe.trace.getSpanContext(e);if(!o||(0,i2o.isTracingSuppressed)(e)||!(0,RNe.isSpanContextValid)(o))return;let s=`${s2o}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||RNe.TraceFlags.NONE).toString(16)}`;n.set(r,_2.TRACE_PARENT_HEADER,s),o.traceState&&n.set(r,_2.TRACE_STATE_HEADER,o.traceState.serialize())}extract(e,r,n){let o=n.get(r,_2.TRACE_PARENT_HEADER);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let a=KMr(s);if(!a)return e;a.isRemote=!0;let c=n.get(r,_2.TRACE_STATE_HEADER);if(c){let u=Array.isArray(c)?c.join(","):c;a.traceState=new o2o.TraceState(typeof u=="string"?u:void 0)}return RNe.trace.setSpanContext(e,a)}fields(){return[_2.TRACE_PARENT_HEADER,_2.TRACE_STATE_HEADER]}};_2.W3CTraceContextPropagator=Y6t});var JMr=I(sS=>{"use strict";Object.defineProperty(sS,"__esModule",{value:!0});sS.getRPCMetadata=sS.deleteRPCMetadata=sS.setRPCMetadata=sS.RPCType=void 0;var f2o=(ir(),bt(hr)),K6t=(0,f2o.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),p2o;(function(t){t.HTTP="http"})(p2o=sS.RPCType||(sS.RPCType={}));function h2o(t,e){return t.setValue(K6t,e)}sS.setRPCMetadata=h2o;function m2o(t){return t.deleteValue(K6t)}sS.deleteRPCMetadata=m2o;function g2o(t){return t.getValue(K6t)}sS.getRPCMetadata=g2o});var nFr=I(kNe=>{"use strict";Object.defineProperty(kNe,"__esModule",{value:!0});kNe.isPlainObject=void 0;var A2o="[object Object]",y2o="[object Null]",_2o="[object Undefined]",E2o=Function.prototype,ZMr=E2o.toString,v2o=ZMr.call(Object),b2o=Object.getPrototypeOf,eFr=Object.prototype,tFr=eFr.hasOwnProperty,HQ=Symbol?Symbol.toStringTag:void 0,rFr=eFr.toString;function C2o(t){if(!S2o(t)||x2o(t)!==A2o)return!1;let e=b2o(t);if(e===null)return!0;let r=tFr.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&ZMr.call(r)===v2o}kNe.isPlainObject=C2o;function S2o(t){return t!=null&&typeof t=="object"}function x2o(t){return t==null?t===void 0?_2o:y2o:HQ&&HQ in Object(t)?w2o(t):T2o(t)}function w2o(t){let e=tFr.call(t,HQ),r=t[HQ],n=!1;try{t[HQ]=void 0,n=!0}catch{}let o=rFr.call(t);return n&&(e?t[HQ]=r:delete t[HQ]),o}function T2o(t){return rFr.call(t)}});var cFr=I(BNe=>{"use strict";Object.defineProperty(BNe,"__esModule",{value:!0});BNe.merge=void 0;var iFr=nFr(),I2o=20;function D2o(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=sFr(e,t.shift(),0,r);return e}BNe.merge=D2o;function X6t(t){return ONe(t)?t.slice():t}function sFr(t,e,r=0,n){let o;if(!(r>I2o)){if(r++,NNe(t)||NNe(e)||aFr(e))o=X6t(e);else if(ONe(t)){if(o=t.slice(),ONe(e))for(let s=0,a=e.length;s<a;s++)o.push(X6t(e[s]));else if(Pme(e)){let s=Object.keys(e);for(let a=0,c=s.length;a<c;a++){let u=s[a];o[u]=X6t(e[u])}}}else if(Pme(t))if(Pme(e)){if(!R2o(t,e))return e;o=Object.assign({},t);let s=Object.keys(e);for(let a=0,c=s.length;a<c;a++){let u=s[a],d=e[u];if(NNe(d))typeof d>"u"?delete o[u]:o[u]=d;else{let f=o[u],p=d;if(oFr(t,u,n)||oFr(e,u,n))delete o[u];else{if(Pme(f)&&Pme(p)){let h=n.get(f)||[],m=n.get(p)||[];h.push({obj:t,key:u}),m.push({obj:e,key:u}),n.set(f,h),n.set(p,m)}o[u]=sFr(o[u],d,r,n)}}}}else o=e;return o}}function oFr(t,e,r){let n=r.get(t[e])||[];for(let o=0,s=n.length;o<s;o++){let a=n[o];if(a.key===e&&a.obj===t)return!0}return!1}function ONe(t){return Array.isArray(t)}function aFr(t){return typeof t=="function"}function Pme(t){return!NNe(t)&&!ONe(t)&&!aFr(t)&&typeof t=="object"}function NNe(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function R2o(t,e){return!(!(0,iFr.isPlainObject)(t)||!(0,iFr.isPlainObject)(e))}});var lFr=I(ZJ=>{"use strict";Object.defineProperty(ZJ,"__esModule",{value:!0});ZJ.callWithTimeout=ZJ.TimeoutError=void 0;var PNe=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};ZJ.TimeoutError=PNe;function k2o(t,e){let r,n=new Promise(function(s,a){r=setTimeout(function(){a(new PNe("Operation timed out."))},e)});return Promise.race([t,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}ZJ.callWithTimeout=k2o});var dFr=I(eZ=>{"use strict";Object.defineProperty(eZ,"__esModule",{value:!0});eZ.isUrlIgnored=eZ.urlMatches=void 0;function uFr(t,e){return typeof e=="string"?t===e:!!t.match(e)}eZ.urlMatches=uFr;function N2o(t,e){if(!e)return!1;for(let r of e)if(uFr(t,r))return!0;return!1}eZ.isUrlIgnored=N2o});var fFr=I(MNe=>{"use strict";Object.defineProperty(MNe,"__esModule",{value:!0});MNe.Deferred=void 0;var J6t=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};MNe.Deferred=J6t});var pFr=I(FNe=>{"use strict";Object.defineProperty(FNe,"__esModule",{value:!0});FNe.BindOnceFuture=void 0;var O2o=fFr(),Z6t=class{_callback;_that;_isCalled=!1;_deferred=new O2o.Deferred;constructor(e,r){this._callback=e,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};FNe.BindOnceFuture=Z6t});var mFr=I(LNe=>{"use strict";Object.defineProperty(LNe,"__esModule",{value:!0});LNe.diagLogLevelFromString=void 0;var K7=(ir(),bt(hr)),hFr={ALL:K7.DiagLogLevel.ALL,VERBOSE:K7.DiagLogLevel.VERBOSE,DEBUG:K7.DiagLogLevel.DEBUG,INFO:K7.DiagLogLevel.INFO,WARN:K7.DiagLogLevel.WARN,ERROR:K7.DiagLogLevel.ERROR,NONE:K7.DiagLogLevel.NONE};function B2o(t){if(t==null)return;let e=hFr[t.toUpperCase()];return e??(K7.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(hFr)}, using default`),K7.DiagLogLevel.INFO)}LNe.diagLogLevelFromString=B2o});var AFr=I(UNe=>{"use strict";Object.defineProperty(UNe,"__esModule",{value:!0});UNe._export=void 0;var gFr=(ir(),bt(hr)),P2o=Nme();function M2o(t,e){return new Promise(r=>{gFr.context.with((0,P2o.suppressTracing)(gFr.context.active()),()=>{t.export(e,n=>{r(n)})})})}UNe._export=M2o});var tvt=I(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.internal=Gr.diagLogLevelFromString=Gr.BindOnceFuture=Gr.urlMatches=Gr.isUrlIgnored=Gr.callWithTimeout=Gr.TimeoutError=Gr.merge=Gr.TraceState=Gr.unsuppressTracing=Gr.suppressTracing=Gr.isTracingSuppressed=Gr.setRPCMetadata=Gr.getRPCMetadata=Gr.deleteRPCMetadata=Gr.RPCType=Gr.parseTraceParent=Gr.W3CTraceContextPropagator=Gr.TRACE_STATE_HEADER=Gr.TRACE_PARENT_HEADER=Gr.CompositePropagator=Gr.otperformance=Gr.getStringListFromEnv=Gr.getNumberFromEnv=Gr.getBooleanFromEnv=Gr.getStringFromEnv=Gr._globalThis=Gr.SDK_INFO=Gr.parseKeyPairsIntoRecord=Gr.ExportResultCode=Gr.unrefTimer=Gr.timeInputToHrTime=Gr.millisToHrTime=Gr.isTimeInputHrTime=Gr.isTimeInput=Gr.hrTimeToTimeStamp=Gr.hrTimeToNanoseconds=Gr.hrTimeToMilliseconds=Gr.hrTimeToMicroseconds=Gr.hrTimeDuration=Gr.hrTime=Gr.getTimeOrigin=Gr.addHrTimes=Gr.loggingErrorHandler=Gr.setGlobalErrorHandler=Gr.globalErrorHandler=Gr.sanitizeAttributes=Gr.isAttributeValue=Gr.AnchoredClock=Gr.W3CBaggagePropagator=void 0;var F2o=yMr();Object.defineProperty(Gr,"W3CBaggagePropagator",{enumerable:!0,get:function(){return F2o.W3CBaggagePropagator}});var L2o=_Mr();Object.defineProperty(Gr,"AnchoredClock",{enumerable:!0,get:function(){return L2o.AnchoredClock}});var yFr=SMr();Object.defineProperty(Gr,"isAttributeValue",{enumerable:!0,get:function(){return yFr.isAttributeValue}});Object.defineProperty(Gr,"sanitizeAttributes",{enumerable:!0,get:function(){return yFr.sanitizeAttributes}});var _Fr=wMr();Object.defineProperty(Gr,"globalErrorHandler",{enumerable:!0,get:function(){return _Fr.globalErrorHandler}});Object.defineProperty(Gr,"setGlobalErrorHandler",{enumerable:!0,get:function(){return _Fr.setGlobalErrorHandler}});var U2o=Q6t();Object.defineProperty(Gr,"loggingErrorHandler",{enumerable:!0,get:function(){return U2o.loggingErrorHandler}});var Vv=QMr();Object.defineProperty(Gr,"addHrTimes",{enumerable:!0,get:function(){return Vv.addHrTimes}});Object.defineProperty(Gr,"getTimeOrigin",{enumerable:!0,get:function(){return Vv.getTimeOrigin}});Object.defineProperty(Gr,"hrTime",{enumerable:!0,get:function(){return Vv.hrTime}});Object.defineProperty(Gr,"hrTimeDuration",{enumerable:!0,get:function(){return Vv.hrTimeDuration}});Object.defineProperty(Gr,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return Vv.hrTimeToMicroseconds}});Object.defineProperty(Gr,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return Vv.hrTimeToMilliseconds}});Object.defineProperty(Gr,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return Vv.hrTimeToNanoseconds}});Object.defineProperty(Gr,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return Vv.hrTimeToTimeStamp}});Object.defineProperty(Gr,"isTimeInput",{enumerable:!0,get:function(){return Vv.isTimeInput}});Object.defineProperty(Gr,"isTimeInputHrTime",{enumerable:!0,get:function(){return Vv.isTimeInputHrTime}});Object.defineProperty(Gr,"millisToHrTime",{enumerable:!0,get:function(){return Vv.millisToHrTime}});Object.defineProperty(Gr,"timeInputToHrTime",{enumerable:!0,get:function(){return Vv.timeInputToHrTime}});var Q2o=jMr();Object.defineProperty(Gr,"unrefTimer",{enumerable:!0,get:function(){return Q2o.unrefTimer}});var j2o=$Mr();Object.defineProperty(Gr,"ExportResultCode",{enumerable:!0,get:function(){return j2o.ExportResultCode}});var $2o=P6t();Object.defineProperty(Gr,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return $2o.parseKeyPairsIntoRecord}});var VQ=j6t();Object.defineProperty(Gr,"SDK_INFO",{enumerable:!0,get:function(){return VQ.SDK_INFO}});Object.defineProperty(Gr,"_globalThis",{enumerable:!0,get:function(){return VQ._globalThis}});Object.defineProperty(Gr,"getStringFromEnv",{enumerable:!0,get:function(){return VQ.getStringFromEnv}});Object.defineProperty(Gr,"getBooleanFromEnv",{enumerable:!0,get:function(){return VQ.getBooleanFromEnv}});Object.defineProperty(Gr,"getNumberFromEnv",{enumerable:!0,get:function(){return VQ.getNumberFromEnv}});Object.defineProperty(Gr,"getStringListFromEnv",{enumerable:!0,get:function(){return VQ.getStringListFromEnv}});Object.defineProperty(Gr,"otperformance",{enumerable:!0,get:function(){return VQ.otperformance}});var G2o=qMr();Object.defineProperty(Gr,"CompositePropagator",{enumerable:!0,get:function(){return G2o.CompositePropagator}});var QNe=XMr();Object.defineProperty(Gr,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return QNe.TRACE_PARENT_HEADER}});Object.defineProperty(Gr,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return QNe.TRACE_STATE_HEADER}});Object.defineProperty(Gr,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return QNe.W3CTraceContextPropagator}});Object.defineProperty(Gr,"parseTraceParent",{enumerable:!0,get:function(){return QNe.parseTraceParent}});var jNe=JMr();Object.defineProperty(Gr,"RPCType",{enumerable:!0,get:function(){return jNe.RPCType}});Object.defineProperty(Gr,"deleteRPCMetadata",{enumerable:!0,get:function(){return jNe.deleteRPCMetadata}});Object.defineProperty(Gr,"getRPCMetadata",{enumerable:!0,get:function(){return jNe.getRPCMetadata}});Object.defineProperty(Gr,"setRPCMetadata",{enumerable:!0,get:function(){return jNe.setRPCMetadata}});var evt=Nme();Object.defineProperty(Gr,"isTracingSuppressed",{enumerable:!0,get:function(){return evt.isTracingSuppressed}});Object.defineProperty(Gr,"suppressTracing",{enumerable:!0,get:function(){return evt.suppressTracing}});Object.defineProperty(Gr,"unsuppressTracing",{enumerable:!0,get:function(){return evt.unsuppressTracing}});var q2o=z6t();Object.defineProperty(Gr,"TraceState",{enumerable:!0,get:function(){return q2o.TraceState}});var H2o=cFr();Object.defineProperty(Gr,"merge",{enumerable:!0,get:function(){return H2o.merge}});var EFr=lFr();Object.defineProperty(Gr,"TimeoutError",{enumerable:!0,get:function(){return EFr.TimeoutError}});Object.defineProperty(Gr,"callWithTimeout",{enumerable:!0,get:function(){return EFr.callWithTimeout}});var vFr=dFr();Object.defineProperty(Gr,"isUrlIgnored",{enumerable:!0,get:function(){return vFr.isUrlIgnored}});Object.defineProperty(Gr,"urlMatches",{enumerable:!0,get:function(){return vFr.urlMatches}});var V2o=pFr();Object.defineProperty(Gr,"BindOnceFuture",{enumerable:!0,get:function(){return V2o.BindOnceFuture}});var W2o=mFr();Object.defineProperty(Gr,"diagLogLevelFromString",{enumerable:!0,get:function(){return W2o.diagLogLevelFromString}});var z2o=AFr();Gr.internal={_export:z2o._export}});var bFr=I($Ne=>{"use strict";Object.defineProperty($Ne,"__esModule",{value:!0});$Ne.defaultServiceName=void 0;function Y2o(){return`unknown_service:${process.argv0}`}$Ne.defaultServiceName=Y2o});var CFr=I(GNe=>{"use strict";Object.defineProperty(GNe,"__esModule",{value:!0});GNe.defaultServiceName=void 0;var K2o=bFr();Object.defineProperty(GNe,"defaultServiceName",{enumerable:!0,get:function(){return K2o.defaultServiceName}})});var rvt=I(qNe=>{"use strict";Object.defineProperty(qNe,"__esModule",{value:!0});qNe.defaultServiceName=void 0;var X2o=CFr();Object.defineProperty(qNe,"defaultServiceName",{enumerable:!0,get:function(){return X2o.defaultServiceName}})});var SFr=I(tZ=>{"use strict";Object.defineProperty(tZ,"__esModule",{value:!0});tZ.identity=tZ.isPromiseLike=void 0;var J2o=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";tZ.isPromiseLike=J2o;function Z2o(t){return t}tZ.identity=Z2o});var ovt=I(Ow=>{"use strict";Object.defineProperty(Ow,"__esModule",{value:!0});Ow.defaultResource=Ow.emptyResource=Ow.resourceFromDetectedResource=Ow.resourceFromAttributes=void 0;var Fme=(ir(),bt(hr)),nvt=tvt(),WQ=(xm(),bt(d2)),e1o=rvt(),Mme=SFr(),HNe=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=xFr(e),n._asyncAttributesPending=e.filter(([o,s])=>(0,Mme.isPromiseLike)(s)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([o,s])=>((0,Mme.isPromiseLike)(s)&&(this._asyncAttributesPending=!0),[o,s])),this._rawAttributes=xFr(this._rawAttributes),this._schemaUrl=i1o(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[r,n]=this._rawAttributes[e];this._rawAttributes[e]=[r,(0,Mme.isPromiseLike)(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Fme.diag.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[r,n]of this._rawAttributes){if((0,Mme.isPromiseLike)(n)){Fme.diag.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(e[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let r=o1o(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function ivt(t,e){return HNe.FromAttributeList(Object.entries(t),e)}Ow.resourceFromAttributes=ivt;function t1o(t,e){return new HNe(t,e)}Ow.resourceFromDetectedResource=t1o;function r1o(){return ivt({})}Ow.emptyResource=r1o;function n1o(){return ivt({[WQ.ATTR_SERVICE_NAME]:(0,e1o.defaultServiceName)(),[WQ.ATTR_TELEMETRY_SDK_LANGUAGE]:nvt.SDK_INFO[WQ.ATTR_TELEMETRY_SDK_LANGUAGE],[WQ.ATTR_TELEMETRY_SDK_NAME]:nvt.SDK_INFO[WQ.ATTR_TELEMETRY_SDK_NAME],[WQ.ATTR_TELEMETRY_SDK_VERSION]:nvt.SDK_INFO[WQ.ATTR_TELEMETRY_SDK_VERSION]})}Ow.defaultResource=n1o;function xFr(t){return t.map(([e,r])=>(0,Mme.isPromiseLike)(r)?[e,r.catch(n=>{Fme.diag.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function i1o(t){if(typeof t=="string"||t===void 0)return t;Fme.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function o1o(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,o=r===void 0||r==="",s=n===void 0||n==="";if(o)return n;if(s||r===n)return r;Fme.diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}});var TFr=I(VNe=>{"use strict";Object.defineProperty(VNe,"__esModule",{value:!0});VNe.detectResources=void 0;var wFr=(ir(),bt(hr)),svt=ovt(),s1o=(t={})=>(t.detectors||[]).map(r=>{try{let n=(0,svt.resourceFromDetectedResource)(r.detect(t));return wFr.diag.debug(`${r.constructor.name} found resource.`,n),n}catch(n){return wFr.diag.debug(`${r.constructor.name} failed: ${n.message}`),(0,svt.emptyResource)()}}).reduce((r,n)=>r.merge(n),(0,svt.emptyResource)());VNe.detectResources=s1o});var DFr=I(WNe=>{"use strict";Object.defineProperty(WNe,"__esModule",{value:!0});WNe.envDetector=void 0;var a1o=(ir(),bt(hr)),c1o=(xm(),bt(d2)),IFr=tvt(),avt=class{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";_ERROR_MESSAGE_INVALID_CHARS="should be a ASCII string with a length greater than 0 and not exceed "+this._MAX_LENGTH+" characters.";_ERROR_MESSAGE_INVALID_VALUE="should be a ASCII string with a length not exceed "+this._MAX_LENGTH+" characters.";detect(e){let r={},n=(0,IFr.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES"),o=(0,IFr.getStringFromEnv)("OTEL_SERVICE_NAME");if(n)try{let s=this._parseResourceAttributes(n);Object.assign(r,s)}catch(s){a1o.diag.debug(`EnvDetector failed: ${s.message}`)}return o&&(r[c1o.ATTR_SERVICE_NAME]=o),{attributes:r}}_parseResourceAttributes(e){if(!e)return{};let r={},n=e.split(this._COMMA_SEPARATOR,-1);for(let o of n){let s=o.split(this._LABEL_KEY_VALUE_SPLITTER,-1);if(s.length!==2)continue;let[a,c]=s;if(a=a.trim(),c=c.trim().split(/^"|"$/).join(""),!this._isValidAndNotEmpty(a))throw new Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);if(!this._isValid(c))throw new Error(`Attribute value ${this._ERROR_MESSAGE_INVALID_VALUE}`);r[a]=decodeURIComponent(c)}return r}_isValid(e){return e.length<=this._MAX_LENGTH&&this._isBaggageOctetString(e)}_isBaggageOctetString(e){for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n<33||n===44||n===59||n===92||n>126)return!1}return!0}_isValidAndNotEmpty(e){return e.length>0&&this._isValid(e)}};WNe.envDetector=new avt});var Lme=I(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.ATTR_WEBENGINE_VERSION=jn.ATTR_WEBENGINE_NAME=jn.ATTR_WEBENGINE_DESCRIPTION=jn.ATTR_SERVICE_NAMESPACE=jn.ATTR_SERVICE_INSTANCE_ID=jn.ATTR_PROCESS_RUNTIME_VERSION=jn.ATTR_PROCESS_RUNTIME_NAME=jn.ATTR_PROCESS_RUNTIME_DESCRIPTION=jn.ATTR_PROCESS_PID=jn.ATTR_PROCESS_OWNER=jn.ATTR_PROCESS_EXECUTABLE_PATH=jn.ATTR_PROCESS_EXECUTABLE_NAME=jn.ATTR_PROCESS_COMMAND_ARGS=jn.ATTR_PROCESS_COMMAND=jn.ATTR_OS_VERSION=jn.ATTR_OS_TYPE=jn.ATTR_K8S_POD_NAME=jn.ATTR_K8S_NAMESPACE_NAME=jn.ATTR_K8S_DEPLOYMENT_NAME=jn.ATTR_K8S_CLUSTER_NAME=jn.ATTR_HOST_TYPE=jn.ATTR_HOST_NAME=jn.ATTR_HOST_IMAGE_VERSION=jn.ATTR_HOST_IMAGE_NAME=jn.ATTR_HOST_IMAGE_ID=jn.ATTR_HOST_ID=jn.ATTR_HOST_ARCH=jn.ATTR_CONTAINER_NAME=jn.ATTR_CONTAINER_IMAGE_TAGS=jn.ATTR_CONTAINER_IMAGE_NAME=jn.ATTR_CONTAINER_ID=jn.ATTR_CLOUD_REGION=jn.ATTR_CLOUD_PROVIDER=jn.ATTR_CLOUD_AVAILABILITY_ZONE=jn.ATTR_CLOUD_ACCOUNT_ID=void 0;jn.ATTR_CLOUD_ACCOUNT_ID="cloud.account.id";jn.ATTR_CLOUD_AVAILABILITY_ZONE="cloud.availability_zone";jn.ATTR_CLOUD_PROVIDER="cloud.provider";jn.ATTR_CLOUD_REGION="cloud.region";jn.ATTR_CONTAINER_ID="container.id";jn.ATTR_CONTAINER_IMAGE_NAME="container.image.name";jn.ATTR_CONTAINER_IMAGE_TAGS="container.image.tags";jn.ATTR_CONTAINER_NAME="container.name";jn.ATTR_HOST_ARCH="host.arch";jn.ATTR_HOST_ID="host.id";jn.ATTR_HOST_IMAGE_ID="host.image.id";jn.ATTR_HOST_IMAGE_NAME="host.image.name";jn.ATTR_HOST_IMAGE_VERSION="host.image.version";jn.ATTR_HOST_NAME="host.name";jn.ATTR_HOST_TYPE="host.type";jn.ATTR_K8S_CLUSTER_NAME="k8s.cluster.name";jn.ATTR_K8S_DEPLOYMENT_NAME="k8s.deployment.name";jn.ATTR_K8S_NAMESPACE_NAME="k8s.namespace.name";jn.ATTR_K8S_POD_NAME="k8s.pod.name";jn.ATTR_OS_TYPE="os.type";jn.ATTR_OS_VERSION="os.version";jn.ATTR_PROCESS_COMMAND="process.command";jn.ATTR_PROCESS_COMMAND_ARGS="process.command_args";jn.ATTR_PROCESS_EXECUTABLE_NAME="process.executable.name";jn.ATTR_PROCESS_EXECUTABLE_PATH="process.executable.path";jn.ATTR_PROCESS_OWNER="process.owner";jn.ATTR_PROCESS_PID="process.pid";jn.ATTR_PROCESS_RUNTIME_DESCRIPTION="process.runtime.description";jn.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name";jn.ATTR_PROCESS_RUNTIME_VERSION="process.runtime.version";jn.ATTR_SERVICE_INSTANCE_ID="service.instance.id";jn.ATTR_SERVICE_NAMESPACE="service.namespace";jn.ATTR_WEBENGINE_DESCRIPTION="webengine.description";jn.ATTR_WEBENGINE_NAME="webengine.name";jn.ATTR_WEBENGINE_VERSION="webengine.version"});var YNe=I(zNe=>{"use strict";Object.defineProperty(zNe,"__esModule",{value:!0});zNe.execAsync=void 0;var l1o=_e("child_process"),u1o=_e("util");zNe.execAsync=u1o.promisify(l1o.exec)});var RFr=I(KNe=>{"use strict";Object.defineProperty(KNe,"__esModule",{value:!0});KNe.getMachineId=void 0;var d1o=YNe(),f1o=(ir(),bt(hr));async function p1o(){try{let e=(await(0,d1o.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
485
- `).find(n=>n.includes("IOPlatformUUID"));if(!e)return;let r=e.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(t){f1o.diag.debug(`error reading machine id: ${t}`)}}KNe.getMachineId=p1o});var kFr=I(XNe=>{"use strict";Object.defineProperty(XNe,"__esModule",{value:!0});XNe.getMachineId=void 0;var h1o=_e("fs"),m1o=(ir(),bt(hr));async function g1o(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await h1o.promises.readFile(e,{encoding:"utf8"})).trim()}catch(r){m1o.diag.debug(`error reading machine id: ${r}`)}}XNe.getMachineId=g1o});var OFr=I(JNe=>{"use strict";Object.defineProperty(JNe,"__esModule",{value:!0});JNe.getMachineId=void 0;var A1o=_e("fs"),y1o=YNe(),NFr=(ir(),bt(hr));async function _1o(){try{return(await A1o.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){NFr.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,y1o.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){NFr.diag.debug(`error reading machine id: ${t}`)}}JNe.getMachineId=_1o});var PFr=I(ZNe=>{"use strict";Object.defineProperty(ZNe,"__esModule",{value:!0});ZNe.getMachineId=void 0;var BFr=_e("process"),E1o=YNe(),v1o=(ir(),bt(hr));async function b1o(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";BFr.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in BFr.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let n=(await(0,E1o.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(n.length===2)return n[1].trim()}catch(r){v1o.diag.debug(`error reading machine id: ${r}`)}}ZNe.getMachineId=b1o});var MFr=I(eOe=>{"use strict";Object.defineProperty(eOe,"__esModule",{value:!0});eOe.getMachineId=void 0;var C1o=(ir(),bt(hr));async function S1o(){C1o.diag.debug("could not read machine-id: unsupported platform")}eOe.getMachineId=S1o});var FFr=I(tOe=>{"use strict";Object.defineProperty(tOe,"__esModule",{value:!0});tOe.getMachineId=void 0;var x1o=_e("process"),zQ;async function w1o(){if(!zQ)switch(x1o.platform){case"darwin":zQ=(await Promise.resolve().then(()=>we(RFr()))).getMachineId;break;case"linux":zQ=(await Promise.resolve().then(()=>we(kFr()))).getMachineId;break;case"freebsd":zQ=(await Promise.resolve().then(()=>we(OFr()))).getMachineId;break;case"win32":zQ=(await Promise.resolve().then(()=>we(PFr()))).getMachineId;break;default:zQ=(await Promise.resolve().then(()=>we(MFr()))).getMachineId;break}return zQ()}tOe.getMachineId=w1o});var cvt=I(rZ=>{"use strict";Object.defineProperty(rZ,"__esModule",{value:!0});rZ.normalizeType=rZ.normalizeArch=void 0;var T1o=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};rZ.normalizeArch=T1o;var I1o=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};rZ.normalizeType=I1o});var UFr=I(rOe=>{"use strict";Object.defineProperty(rOe,"__esModule",{value:!0});rOe.hostDetector=void 0;var lvt=Lme(),LFr=_e("os"),D1o=FFr(),R1o=cvt(),uvt=class{detect(e){return{attributes:{[lvt.ATTR_HOST_NAME]:(0,LFr.hostname)(),[lvt.ATTR_HOST_ARCH]:(0,R1o.normalizeArch)((0,LFr.arch)()),[lvt.ATTR_HOST_ID]:(0,D1o.getMachineId)()}}}};rOe.hostDetector=new uvt});var $Fr=I(nOe=>{"use strict";Object.defineProperty(nOe,"__esModule",{value:!0});nOe.osDetector=void 0;var QFr=Lme(),jFr=_e("os"),k1o=cvt(),dvt=class{detect(e){return{attributes:{[QFr.ATTR_OS_TYPE]:(0,k1o.normalizeType)((0,jFr.platform)()),[QFr.ATTR_OS_VERSION]:(0,jFr.release)()}}}};nOe.osDetector=new dvt});var GFr=I(iOe=>{"use strict";Object.defineProperty(iOe,"__esModule",{value:!0});iOe.processDetector=void 0;var N1o=(ir(),bt(hr)),X7=Lme(),O1o=_e("os"),fvt=class{detect(e){let r={[X7.ATTR_PROCESS_PID]:process.pid,[X7.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[X7.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[X7.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[X7.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[X7.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[X7.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(r[X7.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=O1o.userInfo();r[X7.ATTR_PROCESS_OWNER]=n.username}catch(n){N1o.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:r}}};iOe.processDetector=new fvt});var qFr=I(oOe=>{"use strict";Object.defineProperty(oOe,"__esModule",{value:!0});oOe.serviceInstanceIdDetector=void 0;var B1o=Lme(),P1o=_e("crypto"),pvt=class{detect(e){return{attributes:{[B1o.ATTR_SERVICE_INSTANCE_ID]:(0,P1o.randomUUID)()}}}};oOe.serviceInstanceIdDetector=new pvt});var HFr=I(Bw=>{"use strict";Object.defineProperty(Bw,"__esModule",{value:!0});Bw.serviceInstanceIdDetector=Bw.processDetector=Bw.osDetector=Bw.hostDetector=void 0;var M1o=UFr();Object.defineProperty(Bw,"hostDetector",{enumerable:!0,get:function(){return M1o.hostDetector}});var F1o=$Fr();Object.defineProperty(Bw,"osDetector",{enumerable:!0,get:function(){return F1o.osDetector}});var L1o=GFr();Object.defineProperty(Bw,"processDetector",{enumerable:!0,get:function(){return L1o.processDetector}});var U1o=qFr();Object.defineProperty(Bw,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return U1o.serviceInstanceIdDetector}})});var VFr=I(Pw=>{"use strict";Object.defineProperty(Pw,"__esModule",{value:!0});Pw.serviceInstanceIdDetector=Pw.processDetector=Pw.osDetector=Pw.hostDetector=void 0;var sOe=HFr();Object.defineProperty(Pw,"hostDetector",{enumerable:!0,get:function(){return sOe.hostDetector}});Object.defineProperty(Pw,"osDetector",{enumerable:!0,get:function(){return sOe.osDetector}});Object.defineProperty(Pw,"processDetector",{enumerable:!0,get:function(){return sOe.processDetector}});Object.defineProperty(Pw,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return sOe.serviceInstanceIdDetector}})});var WFr=I(nZ=>{"use strict";Object.defineProperty(nZ,"__esModule",{value:!0});nZ.noopDetector=nZ.NoopDetector=void 0;var aOe=class{detect(){return{attributes:{}}}};nZ.NoopDetector=aOe;nZ.noopDetector=new aOe});var zFr=I(Py=>{"use strict";Object.defineProperty(Py,"__esModule",{value:!0});Py.noopDetector=Py.serviceInstanceIdDetector=Py.processDetector=Py.osDetector=Py.hostDetector=Py.envDetector=void 0;var Q1o=DFr();Object.defineProperty(Py,"envDetector",{enumerable:!0,get:function(){return Q1o.envDetector}});var cOe=VFr();Object.defineProperty(Py,"hostDetector",{enumerable:!0,get:function(){return cOe.hostDetector}});Object.defineProperty(Py,"osDetector",{enumerable:!0,get:function(){return cOe.osDetector}});Object.defineProperty(Py,"processDetector",{enumerable:!0,get:function(){return cOe.processDetector}});Object.defineProperty(Py,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return cOe.serviceInstanceIdDetector}});var j1o=WFr();Object.defineProperty(Py,"noopDetector",{enumerable:!0,get:function(){return j1o.noopDetector}})});var mvt=I(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});hp.defaultServiceName=hp.emptyResource=hp.defaultResource=hp.resourceFromAttributes=hp.serviceInstanceIdDetector=hp.processDetector=hp.osDetector=hp.hostDetector=hp.envDetector=hp.detectResources=void 0;var $1o=TFr();Object.defineProperty(hp,"detectResources",{enumerable:!0,get:function(){return $1o.detectResources}});var Ume=zFr();Object.defineProperty(hp,"envDetector",{enumerable:!0,get:function(){return Ume.envDetector}});Object.defineProperty(hp,"hostDetector",{enumerable:!0,get:function(){return Ume.hostDetector}});Object.defineProperty(hp,"osDetector",{enumerable:!0,get:function(){return Ume.osDetector}});Object.defineProperty(hp,"processDetector",{enumerable:!0,get:function(){return Ume.processDetector}});Object.defineProperty(hp,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Ume.serviceInstanceIdDetector}});var hvt=ovt();Object.defineProperty(hp,"resourceFromAttributes",{enumerable:!0,get:function(){return hvt.resourceFromAttributes}});Object.defineProperty(hp,"defaultResource",{enumerable:!0,get:function(){return hvt.defaultResource}});Object.defineProperty(hp,"emptyResource",{enumerable:!0,get:function(){return hvt.emptyResource}});var G1o=rvt();Object.defineProperty(hp,"defaultServiceName",{enumerable:!0,get:function(){return G1o.defaultServiceName}})});var YFr=I(Qme=>{"use strict";Object.defineProperty(Qme,"__esModule",{value:!0});Qme.SeverityNumber=void 0;var q1o;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(q1o=Qme.SeverityNumber||(Qme.SeverityNumber={}))});var uOe=I(iZ=>{"use strict";Object.defineProperty(iZ,"__esModule",{value:!0});iZ.NOOP_LOGGER=iZ.NoopLogger=void 0;var lOe=class{emit(e){}};iZ.NoopLogger=lOe;iZ.NOOP_LOGGER=new lOe});var fOe=I(oZ=>{"use strict";Object.defineProperty(oZ,"__esModule",{value:!0});oZ.NOOP_LOGGER_PROVIDER=oZ.NoopLoggerProvider=void 0;var H1o=uOe(),dOe=class{getLogger(e,r,n){return new H1o.NoopLogger}};oZ.NoopLoggerProvider=dOe;oZ.NOOP_LOGGER_PROVIDER=new dOe});var Avt=I(pOe=>{"use strict";Object.defineProperty(pOe,"__esModule",{value:!0});pOe.ProxyLogger=void 0;var V1o=uOe(),gvt=class{constructor(e,r,n,o){this._provider=e,this.name=r,this.version=n,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):V1o.NOOP_LOGGER}};pOe.ProxyLogger=gvt});var _vt=I(hOe=>{"use strict";Object.defineProperty(hOe,"__esModule",{value:!0});hOe.ProxyLoggerProvider=void 0;var W1o=fOe(),z1o=Avt(),yvt=class{getLogger(e,r,n){var o;return(o=this._getDelegateLogger(e,r,n))!==null&&o!==void 0?o:new z1o.ProxyLogger(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:W1o.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,r,n)}};hOe.ProxyLoggerProvider=yvt});var KFr=I(mOe=>{"use strict";Object.defineProperty(mOe,"__esModule",{value:!0});mOe._globalThis=void 0;mOe._globalThis=typeof globalThis=="object"?globalThis:global});var XFr=I(gOe=>{"use strict";Object.defineProperty(gOe,"__esModule",{value:!0});gOe._globalThis=void 0;var Y1o=KFr();Object.defineProperty(gOe,"_globalThis",{enumerable:!0,get:function(){return Y1o._globalThis}})});var JFr=I(AOe=>{"use strict";Object.defineProperty(AOe,"__esModule",{value:!0});AOe._globalThis=void 0;var K1o=XFr();Object.defineProperty(AOe,"_globalThis",{enumerable:!0,get:function(){return K1o._globalThis}})});var ZFr=I(Mw=>{"use strict";Object.defineProperty(Mw,"__esModule",{value:!0});Mw.API_BACKWARDS_COMPATIBILITY_VERSION=Mw.makeGetter=Mw._global=Mw.GLOBAL_LOGS_API_KEY=void 0;var X1o=JFr();Mw.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");Mw._global=X1o._globalThis;function J1o(t,e,r){return n=>n===t?e:r}Mw.makeGetter=J1o;Mw.API_BACKWARDS_COMPATIBILITY_VERSION=1});var tLr=I(yOe=>{"use strict";Object.defineProperty(yOe,"__esModule",{value:!0});yOe.LogsAPI=void 0;var Wv=ZFr(),Z1o=fOe(),eLr=_vt(),Evt=class t{constructor(){this._proxyLoggerProvider=new eLr.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Wv._global[Wv.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(Wv._global[Wv.GLOBAL_LOGS_API_KEY]=(0,Wv.makeGetter)(Wv.API_BACKWARDS_COMPATIBILITY_VERSION,e,Z1o.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=Wv._global[Wv.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(Wv._global,Wv.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete Wv._global[Wv.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new eLr.ProxyLoggerProvider}};yOe.LogsAPI=Evt});var iLr=I(kg=>{"use strict";Object.defineProperty(kg,"__esModule",{value:!0});kg.logs=kg.ProxyLoggerProvider=kg.ProxyLogger=kg.NoopLoggerProvider=kg.NOOP_LOGGER_PROVIDER=kg.NoopLogger=kg.NOOP_LOGGER=kg.SeverityNumber=void 0;var e3o=YFr();Object.defineProperty(kg,"SeverityNumber",{enumerable:!0,get:function(){return e3o.SeverityNumber}});var rLr=uOe();Object.defineProperty(kg,"NOOP_LOGGER",{enumerable:!0,get:function(){return rLr.NOOP_LOGGER}});Object.defineProperty(kg,"NoopLogger",{enumerable:!0,get:function(){return rLr.NoopLogger}});var nLr=fOe();Object.defineProperty(kg,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return nLr.NOOP_LOGGER_PROVIDER}});Object.defineProperty(kg,"NoopLoggerProvider",{enumerable:!0,get:function(){return nLr.NoopLoggerProvider}});var t3o=Avt();Object.defineProperty(kg,"ProxyLogger",{enumerable:!0,get:function(){return t3o.ProxyLogger}});var r3o=_vt();Object.defineProperty(kg,"ProxyLoggerProvider",{enumerable:!0,get:function(){return r3o.ProxyLoggerProvider}});var n3o=tLr();kg.logs=n3o.LogsAPI.getInstance()});var jme=I(cO=>{"use strict";Object.defineProperty(cO,"__esModule",{value:!0});cO.isTracingSuppressed=cO.unsuppressTracing=cO.suppressTracing=void 0;var i3o=(ir(),bt(hr)),vvt=(0,i3o.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function o3o(t){return t.setValue(vvt,!0)}cO.suppressTracing=o3o;function s3o(t){return t.deleteValue(vvt)}cO.unsuppressTracing=s3o;function a3o(t){return t.getValue(vvt)===!0}cO.isTracingSuppressed=a3o});var bvt=I(E2=>{"use strict";Object.defineProperty(E2,"__esModule",{value:!0});E2.BAGGAGE_MAX_TOTAL_LENGTH=E2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=E2.BAGGAGE_MAX_NAME_VALUE_PAIRS=E2.BAGGAGE_HEADER=E2.BAGGAGE_ITEMS_SEPARATOR=E2.BAGGAGE_PROPERTIES_SEPARATOR=E2.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;E2.BAGGAGE_KEY_PAIR_SEPARATOR="=";E2.BAGGAGE_PROPERTIES_SEPARATOR=";";E2.BAGGAGE_ITEMS_SEPARATOR=",";E2.BAGGAGE_HEADER="baggage";E2.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;E2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;E2.BAGGAGE_MAX_TOTAL_LENGTH=8192});var Cvt=I(Fw=>{"use strict";Object.defineProperty(Fw,"__esModule",{value:!0});Fw.parseKeyPairsIntoRecord=Fw.parsePairKeyValue=Fw.getKeyPairs=Fw.serializeKeyPairs=void 0;var c3o=(ir(),bt(hr)),YQ=bvt();function l3o(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?YQ.BAGGAGE_ITEMS_SEPARATOR:""}${r}`;return n.length>YQ.BAGGAGE_MAX_TOTAL_LENGTH?e:n},"")}Fw.serializeKeyPairs=l3o;function u3o(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=YQ.BAGGAGE_PROPERTIES_SEPARATOR+r.metadata.toString()),n})}Fw.getKeyPairs=u3o;function oLr(t){let e=t.split(YQ.BAGGAGE_PROPERTIES_SEPARATOR);if(e.length<=0)return;let r=e.shift();if(!r)return;let n=r.indexOf(YQ.BAGGAGE_KEY_PAIR_SEPARATOR);if(n<=0)return;let o=decodeURIComponent(r.substring(0,n).trim()),s=decodeURIComponent(r.substring(n+1).trim()),a;return e.length>0&&(a=(0,c3o.baggageEntryMetadataFromString)(e.join(YQ.BAGGAGE_PROPERTIES_SEPARATOR))),{key:o,value:s,metadata:a}}Fw.parsePairKeyValue=oLr;function d3o(t){let e={};return typeof t=="string"&&t.length>0&&t.split(YQ.BAGGAGE_ITEMS_SEPARATOR).forEach(r=>{let n=oLr(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}Fw.parseKeyPairsIntoRecord=d3o});var sLr=I(_Oe=>{"use strict";Object.defineProperty(_Oe,"__esModule",{value:!0});_Oe.W3CBaggagePropagator=void 0;var Svt=(ir(),bt(hr)),f3o=jme(),KQ=bvt(),xvt=Cvt(),wvt=class{inject(e,r,n){let o=Svt.propagation.getBaggage(e);if(!o||(0,f3o.isTracingSuppressed)(e))return;let s=(0,xvt.getKeyPairs)(o).filter(c=>c.length<=KQ.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,KQ.BAGGAGE_MAX_NAME_VALUE_PAIRS),a=(0,xvt.serializeKeyPairs)(s);a.length>0&&n.set(r,KQ.BAGGAGE_HEADER,a)}extract(e,r,n){let o=n.get(r,KQ.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(KQ.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let a={};return s.length===0||(s.split(KQ.BAGGAGE_ITEMS_SEPARATOR).forEach(u=>{let d=(0,xvt.parsePairKeyValue)(u);if(d){let f={value:d.value};d.metadata&&(f.metadata=d.metadata),a[d.key]=f}}),Object.entries(a).length===0)?e:Svt.propagation.setBaggage(e,Svt.propagation.createBaggage(a))}fields(){return[KQ.BAGGAGE_HEADER]}};_Oe.W3CBaggagePropagator=wvt});var aLr=I(EOe=>{"use strict";Object.defineProperty(EOe,"__esModule",{value:!0});EOe.AnchoredClock=void 0;var Tvt=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,r){this._monotonicClock=r,this._epochMillis=e.now(),this._performanceMillis=r.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}};EOe.AnchoredClock=Tvt});var fLr=I(lO=>{"use strict";Object.defineProperty(lO,"__esModule",{value:!0});lO.isAttributeValue=lO.isAttributeKey=lO.sanitizeAttributes=void 0;var cLr=(ir(),bt(hr));function p3o(t){let e={};if(typeof t!="object"||t==null)return e;for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!lLr(r)){cLr.diag.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!uLr(n)){cLr.diag.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}lO.sanitizeAttributes=p3o;function lLr(t){return typeof t=="string"&&t!==""}lO.isAttributeKey=lLr;function uLr(t){return t==null?!0:Array.isArray(t)?h3o(t):dLr(typeof t)}lO.isAttributeValue=uLr;function h3o(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(dLr(n)){e=n;continue}return!1}return!1}}return!0}function dLr(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var Ivt=I(vOe=>{"use strict";Object.defineProperty(vOe,"__esModule",{value:!0});vOe.loggingErrorHandler=void 0;var m3o=(ir(),bt(hr));function g3o(){return t=>{m3o.diag.error(A3o(t))}}vOe.loggingErrorHandler=g3o;function A3o(t){return typeof t=="string"?t:JSON.stringify(y3o(t))}function y3o(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let o=r[n];o&&(e[n]=String(o))}),r=Object.getPrototypeOf(r);return e}});var hLr=I(sZ=>{"use strict";Object.defineProperty(sZ,"__esModule",{value:!0});sZ.globalErrorHandler=sZ.setGlobalErrorHandler=void 0;var _3o=Ivt(),pLr=(0,_3o.loggingErrorHandler)();function E3o(t){pLr=t}sZ.setGlobalErrorHandler=E3o;function v3o(t){try{pLr(t)}catch{}}sZ.globalErrorHandler=v3o});var yLr=I(Lw=>{"use strict";Object.defineProperty(Lw,"__esModule",{value:!0});Lw.getStringListFromEnv=Lw.getBooleanFromEnv=Lw.getStringFromEnv=Lw.getNumberFromEnv=void 0;var mLr=(ir(),bt(hr)),gLr=_e("util");function b3o(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){mLr.diag.warn(`Unknown value ${(0,gLr.inspect)(e)} for ${t}, expected a number, using defaults`);return}return r}Lw.getNumberFromEnv=b3o;function ALr(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}Lw.getStringFromEnv=ALr;function C3o(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||mLr.diag.warn(`Unknown value ${(0,gLr.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}Lw.getBooleanFromEnv=C3o;function S3o(t){return ALr(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}Lw.getStringListFromEnv=S3o});var _Lr=I(bOe=>{"use strict";Object.defineProperty(bOe,"__esModule",{value:!0});bOe._globalThis=void 0;bOe._globalThis=typeof globalThis=="object"?globalThis:global});var ELr=I(COe=>{"use strict";Object.defineProperty(COe,"__esModule",{value:!0});COe.otperformance=void 0;var x3o=_e("perf_hooks");COe.otperformance=x3o.performance});var vLr=I(SOe=>{"use strict";Object.defineProperty(SOe,"__esModule",{value:!0});SOe.VERSION=void 0;SOe.VERSION="2.2.0"});var bLr=I(xOe=>{"use strict";Object.defineProperty(xOe,"__esModule",{value:!0});xOe.ATTR_PROCESS_RUNTIME_NAME=void 0;xOe.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var CLr=I(TOe=>{"use strict";Object.defineProperty(TOe,"__esModule",{value:!0});TOe.SDK_INFO=void 0;var w3o=vLr(),wOe=(xm(),bt(d2)),T3o=bLr();TOe.SDK_INFO={[wOe.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[T3o.ATTR_PROCESS_RUNTIME_NAME]:"node",[wOe.ATTR_TELEMETRY_SDK_LANGUAGE]:wOe.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[wOe.ATTR_TELEMETRY_SDK_VERSION]:w3o.VERSION}});var SLr=I(v2=>{"use strict";Object.defineProperty(v2,"__esModule",{value:!0});v2.SDK_INFO=v2.otperformance=v2._globalThis=v2.getStringListFromEnv=v2.getNumberFromEnv=v2.getBooleanFromEnv=v2.getStringFromEnv=void 0;var IOe=yLr();Object.defineProperty(v2,"getStringFromEnv",{enumerable:!0,get:function(){return IOe.getStringFromEnv}});Object.defineProperty(v2,"getBooleanFromEnv",{enumerable:!0,get:function(){return IOe.getBooleanFromEnv}});Object.defineProperty(v2,"getNumberFromEnv",{enumerable:!0,get:function(){return IOe.getNumberFromEnv}});Object.defineProperty(v2,"getStringListFromEnv",{enumerable:!0,get:function(){return IOe.getStringListFromEnv}});var I3o=_Lr();Object.defineProperty(v2,"_globalThis",{enumerable:!0,get:function(){return I3o._globalThis}});var D3o=ELr();Object.defineProperty(v2,"otperformance",{enumerable:!0,get:function(){return D3o.otperformance}});var R3o=CLr();Object.defineProperty(v2,"SDK_INFO",{enumerable:!0,get:function(){return R3o.SDK_INFO}})});var Dvt=I(b2=>{"use strict";Object.defineProperty(b2,"__esModule",{value:!0});b2.getStringListFromEnv=b2.getNumberFromEnv=b2.getStringFromEnv=b2.getBooleanFromEnv=b2.otperformance=b2._globalThis=b2.SDK_INFO=void 0;var XQ=SLr();Object.defineProperty(b2,"SDK_INFO",{enumerable:!0,get:function(){return XQ.SDK_INFO}});Object.defineProperty(b2,"_globalThis",{enumerable:!0,get:function(){return XQ._globalThis}});Object.defineProperty(b2,"otperformance",{enumerable:!0,get:function(){return XQ.otperformance}});Object.defineProperty(b2,"getBooleanFromEnv",{enumerable:!0,get:function(){return XQ.getBooleanFromEnv}});Object.defineProperty(b2,"getStringFromEnv",{enumerable:!0,get:function(){return XQ.getStringFromEnv}});Object.defineProperty(b2,"getNumberFromEnv",{enumerable:!0,get:function(){return XQ.getNumberFromEnv}});Object.defineProperty(b2,"getStringListFromEnv",{enumerable:!0,get:function(){return XQ.getStringListFromEnv}})});var ILr=I(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.addHrTimes=Yu.isTimeInput=Yu.isTimeInputHrTime=Yu.hrTimeToMicroseconds=Yu.hrTimeToMilliseconds=Yu.hrTimeToNanoseconds=Yu.hrTimeToTimeStamp=Yu.hrTimeDuration=Yu.timeInputToHrTime=Yu.hrTime=Yu.getTimeOrigin=Yu.millisToHrTime=void 0;var Rvt=Dvt(),xLr=9,k3o=6,N3o=Math.pow(10,k3o),DOe=Math.pow(10,xLr);function $me(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*N3o);return[r,n]}Yu.millisToHrTime=$me;function kvt(){let t=Rvt.otperformance.timeOrigin;if(typeof t!="number"){let e=Rvt.otperformance;t=e.timing&&e.timing.fetchStart}return t}Yu.getTimeOrigin=kvt;function wLr(t){let e=$me(kvt()),r=$me(typeof t=="number"?t:Rvt.otperformance.now());return TLr(e,r)}Yu.hrTime=wLr;function O3o(t){if(Nvt(t))return t;if(typeof t=="number")return t<kvt()?wLr(t):$me(t);if(t instanceof Date)return $me(t.getTime());throw TypeError("Invalid input type")}Yu.timeInputToHrTime=O3o;function B3o(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=DOe),[r,n]}Yu.hrTimeDuration=B3o;function P3o(t){let e=xLr,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}Yu.hrTimeToTimeStamp=P3o;function M3o(t){return t[0]*DOe+t[1]}Yu.hrTimeToNanoseconds=M3o;function F3o(t){return t[0]*1e3+t[1]/1e6}Yu.hrTimeToMilliseconds=F3o;function L3o(t){return t[0]*1e6+t[1]/1e3}Yu.hrTimeToMicroseconds=L3o;function Nvt(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}Yu.isTimeInputHrTime=Nvt;function U3o(t){return Nvt(t)||typeof t=="number"||t instanceof Date}Yu.isTimeInput=U3o;function TLr(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=DOe&&(r[1]-=DOe,r[0]+=1),r}Yu.addHrTimes=TLr});var DLr=I(ROe=>{"use strict";Object.defineProperty(ROe,"__esModule",{value:!0});ROe.unrefTimer=void 0;function Q3o(t){typeof t!="number"&&t.unref()}ROe.unrefTimer=Q3o});var RLr=I(Gme=>{"use strict";Object.defineProperty(Gme,"__esModule",{value:!0});Gme.ExportResultCode=void 0;var j3o;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(j3o=Gme.ExportResultCode||(Gme.ExportResultCode={}))});var NLr=I(kOe=>{"use strict";Object.defineProperty(kOe,"__esModule",{value:!0});kOe.CompositePropagator=void 0;var kLr=(ir(),bt(hr)),Ovt=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(e,r,n){for(let o of this._propagators)try{o.inject(e,r,n)}catch(s){kLr.diag.warn(`Failed to inject with ${o.constructor.name}. Err: ${s.message}`)}}extract(e,r,n){return this._propagators.reduce((o,s)=>{try{return s.extract(o,r,n)}catch(a){kLr.diag.warn(`Failed to extract with ${s.constructor.name}. Err: ${a.message}`)}return o},e)}fields(){return this._fields.slice()}};kOe.CompositePropagator=Ovt});var OLr=I(aZ=>{"use strict";Object.defineProperty(aZ,"__esModule",{value:!0});aZ.validateValue=aZ.validateKey=void 0;var Bvt="[_0-9a-z-*/]",$3o=`[a-z]${Bvt}{0,255}`,G3o=`[a-z0-9]${Bvt}{0,240}@[a-z]${Bvt}{0,13}`,q3o=new RegExp(`^(?:${$3o}|${G3o})$`),H3o=/^[ -~]{0,255}[!-~]$/,V3o=/,|=/;function W3o(t){return q3o.test(t)}aZ.validateKey=W3o;function z3o(t){return H3o.test(t)&&!V3o.test(t)}aZ.validateValue=z3o});var Mvt=I(NOe=>{"use strict";Object.defineProperty(NOe,"__esModule",{value:!0});NOe.TraceState=void 0;var BLr=OLr(),PLr=32,Y3o=512,MLr=",",FLr="=",Pvt=class t{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,r){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n}unset(e){let r=this._clone();return r._internalState.delete(e),r}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,r)=>(e.push(r+FLr+this.get(r)),e),[]).join(MLr)}_parse(e){e.length>Y3o||(this._internalState=e.split(MLr).reverse().reduce((r,n)=>{let o=n.trim(),s=o.indexOf(FLr);if(s!==-1){let a=o.slice(0,s),c=o.slice(s+1,n.length);(0,BLr.validateKey)(a)&&(0,BLr.validateValue)(c)&&r.set(a,c)}return r},new Map),this._internalState.size>PLr&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,PLr))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};NOe.TraceState=Pvt});var ULr=I(C2=>{"use strict";Object.defineProperty(C2,"__esModule",{value:!0});C2.W3CTraceContextPropagator=C2.parseTraceParent=C2.TRACE_STATE_HEADER=C2.TRACE_PARENT_HEADER=void 0;var OOe=(ir(),bt(hr)),K3o=jme(),X3o=Mvt();C2.TRACE_PARENT_HEADER="traceparent";C2.TRACE_STATE_HEADER="tracestate";var J3o="00",Z3o="(?!ff)[\\da-f]{2}",eyo="(?![0]{32})[\\da-f]{32}",tyo="(?![0]{16})[\\da-f]{16}",ryo="[\\da-f]{2}",nyo=new RegExp(`^\\s?(${Z3o})-(${eyo})-(${tyo})-(${ryo})(-.*)?\\s?$`);function LLr(t){let e=nyo.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}C2.parseTraceParent=LLr;var Fvt=class{inject(e,r,n){let o=OOe.trace.getSpanContext(e);if(!o||(0,K3o.isTracingSuppressed)(e)||!(0,OOe.isSpanContextValid)(o))return;let s=`${J3o}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||OOe.TraceFlags.NONE).toString(16)}`;n.set(r,C2.TRACE_PARENT_HEADER,s),o.traceState&&n.set(r,C2.TRACE_STATE_HEADER,o.traceState.serialize())}extract(e,r,n){let o=n.get(r,C2.TRACE_PARENT_HEADER);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let a=LLr(s);if(!a)return e;a.isRemote=!0;let c=n.get(r,C2.TRACE_STATE_HEADER);if(c){let u=Array.isArray(c)?c.join(","):c;a.traceState=new X3o.TraceState(typeof u=="string"?u:void 0)}return OOe.trace.setSpanContext(e,a)}fields(){return[C2.TRACE_PARENT_HEADER,C2.TRACE_STATE_HEADER]}};C2.W3CTraceContextPropagator=Fvt});var QLr=I(aS=>{"use strict";Object.defineProperty(aS,"__esModule",{value:!0});aS.getRPCMetadata=aS.deleteRPCMetadata=aS.setRPCMetadata=aS.RPCType=void 0;var iyo=(ir(),bt(hr)),Lvt=(0,iyo.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),oyo;(function(t){t.HTTP="http"})(oyo=aS.RPCType||(aS.RPCType={}));function syo(t,e){return t.setValue(Lvt,e)}aS.setRPCMetadata=syo;function ayo(t){return t.deleteValue(Lvt)}aS.deleteRPCMetadata=ayo;function cyo(t){return t.getValue(Lvt)}aS.getRPCMetadata=cyo});var HLr=I(BOe=>{"use strict";Object.defineProperty(BOe,"__esModule",{value:!0});BOe.isPlainObject=void 0;var lyo="[object Object]",uyo="[object Null]",dyo="[object Undefined]",fyo=Function.prototype,jLr=fyo.toString,pyo=jLr.call(Object),hyo=Object.getPrototypeOf,$Lr=Object.prototype,GLr=$Lr.hasOwnProperty,JQ=Symbol?Symbol.toStringTag:void 0,qLr=$Lr.toString;function myo(t){if(!gyo(t)||Ayo(t)!==lyo)return!1;let e=hyo(t);if(e===null)return!0;let r=GLr.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&jLr.call(r)===pyo}BOe.isPlainObject=myo;function gyo(t){return t!=null&&typeof t=="object"}function Ayo(t){return t==null?t===void 0?dyo:uyo:JQ&&JQ in Object(t)?yyo(t):_yo(t)}function yyo(t){let e=GLr.call(t,JQ),r=t[JQ],n=!1;try{t[JQ]=void 0,n=!0}catch{}let o=qLr.call(t);return n&&(e?t[JQ]=r:delete t[JQ]),o}function _yo(t){return qLr.call(t)}});var KLr=I(FOe=>{"use strict";Object.defineProperty(FOe,"__esModule",{value:!0});FOe.merge=void 0;var VLr=HLr(),Eyo=20;function vyo(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=zLr(e,t.shift(),0,r);return e}FOe.merge=vyo;function Uvt(t){return MOe(t)?t.slice():t}function zLr(t,e,r=0,n){let o;if(!(r>Eyo)){if(r++,POe(t)||POe(e)||YLr(e))o=Uvt(e);else if(MOe(t)){if(o=t.slice(),MOe(e))for(let s=0,a=e.length;s<a;s++)o.push(Uvt(e[s]));else if(qme(e)){let s=Object.keys(e);for(let a=0,c=s.length;a<c;a++){let u=s[a];o[u]=Uvt(e[u])}}}else if(qme(t))if(qme(e)){if(!byo(t,e))return e;o=Object.assign({},t);let s=Object.keys(e);for(let a=0,c=s.length;a<c;a++){let u=s[a],d=e[u];if(POe(d))typeof d>"u"?delete o[u]:o[u]=d;else{let f=o[u],p=d;if(WLr(t,u,n)||WLr(e,u,n))delete o[u];else{if(qme(f)&&qme(p)){let h=n.get(f)||[],m=n.get(p)||[];h.push({obj:t,key:u}),m.push({obj:e,key:u}),n.set(f,h),n.set(p,m)}o[u]=zLr(o[u],d,r,n)}}}}else o=e;return o}}function WLr(t,e,r){let n=r.get(t[e])||[];for(let o=0,s=n.length;o<s;o++){let a=n[o];if(a.key===e&&a.obj===t)return!0}return!1}function MOe(t){return Array.isArray(t)}function YLr(t){return typeof t=="function"}function qme(t){return!POe(t)&&!MOe(t)&&!YLr(t)&&typeof t=="object"}function POe(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function byo(t,e){return!(!(0,VLr.isPlainObject)(t)||!(0,VLr.isPlainObject)(e))}});var XLr=I(cZ=>{"use strict";Object.defineProperty(cZ,"__esModule",{value:!0});cZ.callWithTimeout=cZ.TimeoutError=void 0;var LOe=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};cZ.TimeoutError=LOe;function Cyo(t,e){let r,n=new Promise(function(s,a){r=setTimeout(function(){a(new LOe("Operation timed out."))},e)});return Promise.race([t,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}cZ.callWithTimeout=Cyo});var ZLr=I(lZ=>{"use strict";Object.defineProperty(lZ,"__esModule",{value:!0});lZ.isUrlIgnored=lZ.urlMatches=void 0;function JLr(t,e){return typeof e=="string"?t===e:!!t.match(e)}lZ.urlMatches=JLr;function Syo(t,e){if(!e)return!1;for(let r of e)if(JLr(t,r))return!0;return!1}lZ.isUrlIgnored=Syo});var eUr=I(UOe=>{"use strict";Object.defineProperty(UOe,"__esModule",{value:!0});UOe.Deferred=void 0;var Qvt=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};UOe.Deferred=Qvt});var tUr=I(QOe=>{"use strict";Object.defineProperty(QOe,"__esModule",{value:!0});QOe.BindOnceFuture=void 0;var xyo=eUr(),jvt=class{_callback;_that;_isCalled=!1;_deferred=new xyo.Deferred;constructor(e,r){this._callback=e,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};QOe.BindOnceFuture=jvt});var nUr=I(jOe=>{"use strict";Object.defineProperty(jOe,"__esModule",{value:!0});jOe.diagLogLevelFromString=void 0;var J7=(ir(),bt(hr)),rUr={ALL:J7.DiagLogLevel.ALL,VERBOSE:J7.DiagLogLevel.VERBOSE,DEBUG:J7.DiagLogLevel.DEBUG,INFO:J7.DiagLogLevel.INFO,WARN:J7.DiagLogLevel.WARN,ERROR:J7.DiagLogLevel.ERROR,NONE:J7.DiagLogLevel.NONE};function wyo(t){if(t==null)return;let e=rUr[t.toUpperCase()];return e??(J7.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(rUr)}, using default`),J7.DiagLogLevel.INFO)}jOe.diagLogLevelFromString=wyo});var oUr=I($Oe=>{"use strict";Object.defineProperty($Oe,"__esModule",{value:!0});$Oe._export=void 0;var iUr=(ir(),bt(hr)),Tyo=jme();function Iyo(t,e){return new Promise(r=>{iUr.context.with((0,Tyo.suppressTracing)(iUr.context.active()),()=>{t.export(e,n=>{r(n)})})})}$Oe._export=Iyo});var Z7=I(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.internal=qr.diagLogLevelFromString=qr.BindOnceFuture=qr.urlMatches=qr.isUrlIgnored=qr.callWithTimeout=qr.TimeoutError=qr.merge=qr.TraceState=qr.unsuppressTracing=qr.suppressTracing=qr.isTracingSuppressed=qr.setRPCMetadata=qr.getRPCMetadata=qr.deleteRPCMetadata=qr.RPCType=qr.parseTraceParent=qr.W3CTraceContextPropagator=qr.TRACE_STATE_HEADER=qr.TRACE_PARENT_HEADER=qr.CompositePropagator=qr.otperformance=qr.getStringListFromEnv=qr.getNumberFromEnv=qr.getBooleanFromEnv=qr.getStringFromEnv=qr._globalThis=qr.SDK_INFO=qr.parseKeyPairsIntoRecord=qr.ExportResultCode=qr.unrefTimer=qr.timeInputToHrTime=qr.millisToHrTime=qr.isTimeInputHrTime=qr.isTimeInput=qr.hrTimeToTimeStamp=qr.hrTimeToNanoseconds=qr.hrTimeToMilliseconds=qr.hrTimeToMicroseconds=qr.hrTimeDuration=qr.hrTime=qr.getTimeOrigin=qr.addHrTimes=qr.loggingErrorHandler=qr.setGlobalErrorHandler=qr.globalErrorHandler=qr.sanitizeAttributes=qr.isAttributeValue=qr.AnchoredClock=qr.W3CBaggagePropagator=void 0;var Dyo=sLr();Object.defineProperty(qr,"W3CBaggagePropagator",{enumerable:!0,get:function(){return Dyo.W3CBaggagePropagator}});var Ryo=aLr();Object.defineProperty(qr,"AnchoredClock",{enumerable:!0,get:function(){return Ryo.AnchoredClock}});var sUr=fLr();Object.defineProperty(qr,"isAttributeValue",{enumerable:!0,get:function(){return sUr.isAttributeValue}});Object.defineProperty(qr,"sanitizeAttributes",{enumerable:!0,get:function(){return sUr.sanitizeAttributes}});var aUr=hLr();Object.defineProperty(qr,"globalErrorHandler",{enumerable:!0,get:function(){return aUr.globalErrorHandler}});Object.defineProperty(qr,"setGlobalErrorHandler",{enumerable:!0,get:function(){return aUr.setGlobalErrorHandler}});var kyo=Ivt();Object.defineProperty(qr,"loggingErrorHandler",{enumerable:!0,get:function(){return kyo.loggingErrorHandler}});var zv=ILr();Object.defineProperty(qr,"addHrTimes",{enumerable:!0,get:function(){return zv.addHrTimes}});Object.defineProperty(qr,"getTimeOrigin",{enumerable:!0,get:function(){return zv.getTimeOrigin}});Object.defineProperty(qr,"hrTime",{enumerable:!0,get:function(){return zv.hrTime}});Object.defineProperty(qr,"hrTimeDuration",{enumerable:!0,get:function(){return zv.hrTimeDuration}});Object.defineProperty(qr,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return zv.hrTimeToMicroseconds}});Object.defineProperty(qr,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return zv.hrTimeToMilliseconds}});Object.defineProperty(qr,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return zv.hrTimeToNanoseconds}});Object.defineProperty(qr,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return zv.hrTimeToTimeStamp}});Object.defineProperty(qr,"isTimeInput",{enumerable:!0,get:function(){return zv.isTimeInput}});Object.defineProperty(qr,"isTimeInputHrTime",{enumerable:!0,get:function(){return zv.isTimeInputHrTime}});Object.defineProperty(qr,"millisToHrTime",{enumerable:!0,get:function(){return zv.millisToHrTime}});Object.defineProperty(qr,"timeInputToHrTime",{enumerable:!0,get:function(){return zv.timeInputToHrTime}});var Nyo=DLr();Object.defineProperty(qr,"unrefTimer",{enumerable:!0,get:function(){return Nyo.unrefTimer}});var Oyo=RLr();Object.defineProperty(qr,"ExportResultCode",{enumerable:!0,get:function(){return Oyo.ExportResultCode}});var Byo=Cvt();Object.defineProperty(qr,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return Byo.parseKeyPairsIntoRecord}});var ZQ=Dvt();Object.defineProperty(qr,"SDK_INFO",{enumerable:!0,get:function(){return ZQ.SDK_INFO}});Object.defineProperty(qr,"_globalThis",{enumerable:!0,get:function(){return ZQ._globalThis}});Object.defineProperty(qr,"getStringFromEnv",{enumerable:!0,get:function(){return ZQ.getStringFromEnv}});Object.defineProperty(qr,"getBooleanFromEnv",{enumerable:!0,get:function(){return ZQ.getBooleanFromEnv}});Object.defineProperty(qr,"getNumberFromEnv",{enumerable:!0,get:function(){return ZQ.getNumberFromEnv}});Object.defineProperty(qr,"getStringListFromEnv",{enumerable:!0,get:function(){return ZQ.getStringListFromEnv}});Object.defineProperty(qr,"otperformance",{enumerable:!0,get:function(){return ZQ.otperformance}});var Pyo=NLr();Object.defineProperty(qr,"CompositePropagator",{enumerable:!0,get:function(){return Pyo.CompositePropagator}});var GOe=ULr();Object.defineProperty(qr,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return GOe.TRACE_PARENT_HEADER}});Object.defineProperty(qr,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return GOe.TRACE_STATE_HEADER}});Object.defineProperty(qr,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return GOe.W3CTraceContextPropagator}});Object.defineProperty(qr,"parseTraceParent",{enumerable:!0,get:function(){return GOe.parseTraceParent}});var qOe=QLr();Object.defineProperty(qr,"RPCType",{enumerable:!0,get:function(){return qOe.RPCType}});Object.defineProperty(qr,"deleteRPCMetadata",{enumerable:!0,get:function(){return qOe.deleteRPCMetadata}});Object.defineProperty(qr,"getRPCMetadata",{enumerable:!0,get:function(){return qOe.getRPCMetadata}});Object.defineProperty(qr,"setRPCMetadata",{enumerable:!0,get:function(){return qOe.setRPCMetadata}});var $vt=jme();Object.defineProperty(qr,"isTracingSuppressed",{enumerable:!0,get:function(){return $vt.isTracingSuppressed}});Object.defineProperty(qr,"suppressTracing",{enumerable:!0,get:function(){return $vt.suppressTracing}});Object.defineProperty(qr,"unsuppressTracing",{enumerable:!0,get:function(){return $vt.unsuppressTracing}});var Myo=Mvt();Object.defineProperty(qr,"TraceState",{enumerable:!0,get:function(){return Myo.TraceState}});var Fyo=KLr();Object.defineProperty(qr,"merge",{enumerable:!0,get:function(){return Fyo.merge}});var cUr=XLr();Object.defineProperty(qr,"TimeoutError",{enumerable:!0,get:function(){return cUr.TimeoutError}});Object.defineProperty(qr,"callWithTimeout",{enumerable:!0,get:function(){return cUr.callWithTimeout}});var lUr=ZLr();Object.defineProperty(qr,"isUrlIgnored",{enumerable:!0,get:function(){return lUr.isUrlIgnored}});Object.defineProperty(qr,"urlMatches",{enumerable:!0,get:function(){return lUr.urlMatches}});var Lyo=tUr();Object.defineProperty(qr,"BindOnceFuture",{enumerable:!0,get:function(){return Lyo.BindOnceFuture}});var Uyo=nUr();Object.defineProperty(qr,"diagLogLevelFromString",{enumerable:!0,get:function(){return Uyo.diagLogLevelFromString}});var Qyo=oUr();qr.internal={_export:Qyo._export}});var uUr=I(VOe=>{"use strict";Object.defineProperty(VOe,"__esModule",{value:!0});VOe.LogRecordImpl=void 0;var ej=(ir(),bt(hr)),HOe=Z7(),Gvt=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;totalAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,r,n){let{timestamp:o,observedTimestamp:s,eventName:a,severityNumber:c,severityText:u,body:d,attributes:f={},context:p}=n,h=Date.now();if(this.hrTime=(0,HOe.timeInputToHrTime)(o??h),this.hrTimeObserved=(0,HOe.timeInputToHrTime)(s??h),p){let m=ej.trace.getSpanContext(p);m&&ej.isSpanContextValid(m)&&(this.spanContext=m)}this.severityNumber=c,this.severityText=u,this.body=d,this.resource=e.resource,this.instrumentationScope=r,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(f)}setAttribute(e,r){return this._isLogRecordReadonly()?this:r===null?this:e.length===0?(ej.diag.warn(`Invalid attribute key: ${e}`),this):!(0,HOe.isAttributeValue)(r)&&!(typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length>0)?(ej.diag.warn(`Invalid attribute value set for key: ${e}`),this):(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this.droppedAttributesCount===1&&ej.diag.warn("Dropping extra attributes."),this):((0,HOe.isAttributeValue)(r)?this.attributes[e]=this._truncateToSize(r):this.attributes[e]=r,this))}setAttributes(e){for(let[r,n]of Object.entries(e))this.setAttribute(r,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let r=this._logRecordLimits.attributeValueLengthLimit;return r<=0?(ej.diag.warn(`Attribute value limit must be positive, got ${r}`),e):typeof e=="string"?this._truncateToLimitUtil(e,r):Array.isArray(e)?e.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):e}_truncateToLimitUtil(e,r){return e.length<=r?e:e.substring(0,r)}_isLogRecordReadonly(){return this._isReadonly&&ej.diag.warn("Can not execute the operation on emitted log record"),this._isReadonly}};VOe.LogRecordImpl=Gvt});var dUr=I(WOe=>{"use strict";Object.defineProperty(WOe,"__esModule",{value:!0});WOe.Logger=void 0;var jyo=(ir(),bt(hr)),$yo=uUr(),qvt=class{instrumentationScope;_sharedState;constructor(e,r){this.instrumentationScope=e,this._sharedState=r}emit(e){let r=e.context||jyo.context.active(),n=new $yo.LogRecordImpl(this._sharedState,this.instrumentationScope,{context:r,...e});this._sharedState.activeProcessor.onEmit(n,r),n._makeReadonly()}};WOe.Logger=qvt});var fUr=I(dZ=>{"use strict";Object.defineProperty(dZ,"__esModule",{value:!0});dZ.reconfigureLimits=dZ.loadDefaultConfig=void 0;var uZ=Z7();function Gyo(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:(0,uZ.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,uZ.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??128},includeTraceContext:!0}}dZ.loadDefaultConfig=Gyo;function qyo(t){return{attributeCountLimit:t.attributeCountLimit??(0,uZ.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??(0,uZ.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128,attributeValueLengthLimit:t.attributeValueLengthLimit??(0,uZ.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,uZ.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0}}dZ.reconfigureLimits=qyo});var Vvt=I(zOe=>{"use strict";Object.defineProperty(zOe,"__esModule",{value:!0});zOe.NoopLogRecordProcessor=void 0;var Hvt=class{forceFlush(){return Promise.resolve()}onEmit(e,r){}shutdown(){return Promise.resolve()}};zOe.NoopLogRecordProcessor=Hvt});var pUr=I(YOe=>{"use strict";Object.defineProperty(YOe,"__esModule",{value:!0});YOe.MultiLogRecordProcessor=void 0;var Hyo=Z7(),Wvt=class{processors;forceFlushTimeoutMillis;constructor(e,r){this.processors=e,this.forceFlushTimeoutMillis=r}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(r=>(0,Hyo.callWithTimeout)(r.forceFlush(),e)))}onEmit(e,r){this.processors.forEach(n=>n.onEmit(e,r))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}};YOe.MultiLogRecordProcessor=Wvt});var hUr=I(KOe=>{"use strict";Object.defineProperty(KOe,"__esModule",{value:!0});KOe.LoggerProviderSharedState=void 0;var Vyo=Vvt(),Wyo=pUr(),zvt=class{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,r,n,o){this.resource=e,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=o,o.length>0?(this.registeredLogRecordProcessors=o,this.activeProcessor=new Wyo.MultiLogRecordProcessor(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Vyo.NoopLogRecordProcessor}};KOe.LoggerProviderSharedState=zvt});var AUr=I(tj=>{"use strict";Object.defineProperty(tj,"__esModule",{value:!0});tj.LoggerProvider=tj.DEFAULT_LOGGER_NAME=void 0;var XOe=(ir(),bt(hr)),zyo=iLr(),Yyo=mvt(),mUr=Z7(),Kyo=dUr(),gUr=fUr(),Xyo=hUr();tj.DEFAULT_LOGGER_NAME="unknown";var Yvt=class{_shutdownOnce;_sharedState;constructor(e={}){let r=(0,mUr.merge)({},(0,gUr.loadDefaultConfig)(),e),n=e.resource??(0,Yyo.defaultResource)();this._sharedState=new Xyo.LoggerProviderSharedState(n,r.forceFlushTimeoutMillis,(0,gUr.reconfigureLimits)(r.logRecordLimits),e?.processors??[]),this._shutdownOnce=new mUr.BindOnceFuture(this._shutdown,this)}getLogger(e,r,n){if(this._shutdownOnce.isCalled)return XOe.diag.warn("A shutdown LoggerProvider cannot provide a Logger"),zyo.NOOP_LOGGER;e||XOe.diag.warn("Logger requested without instrumentation scope name.");let o=e||tj.DEFAULT_LOGGER_NAME,s=`${o}@${r||""}:${n?.schemaUrl||""}`;return this._sharedState.loggers.has(s)||this._sharedState.loggers.set(s,new Kyo.Logger({name:o,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(s)}forceFlush(){return this._shutdownOnce.isCalled?(XOe.diag.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(XOe.diag.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};tj.LoggerProvider=Yvt});var _Ur=I(JOe=>{"use strict";Object.defineProperty(JOe,"__esModule",{value:!0});JOe.ConsoleLogRecordExporter=void 0;var yUr=Z7(),Kvt=class{export(e,r){this._sendLogRecords(e,r)}shutdown(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:(0,yUr.hrTimeToMicroseconds)(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,body:e.body,attributes:e.attributes}}_sendLogRecords(e,r){for(let n of e)console.dir(this._exportInfo(n),{depth:3});r?.({code:yUr.ExportResultCode.SUCCESS})}};JOe.ConsoleLogRecordExporter=Kvt});var EUr=I(ZOe=>{"use strict";Object.defineProperty(ZOe,"__esModule",{value:!0});ZOe.SimpleLogRecordProcessor=void 0;var fZ=Z7(),Xvt=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new fZ.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let r=()=>fZ.internal._export(this._exporter,[e]).then(n=>{n.code!==fZ.ExportResultCode.SUCCESS&&(0,fZ.globalErrorHandler)(n.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${n})`))}).catch(fZ.globalErrorHandler);if(e.resource.asyncAttributesPending){let n=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(n),r()),fZ.globalErrorHandler);n!=null&&this._unresolvedExports.add(n)}else r()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};ZOe.SimpleLogRecordProcessor=Xvt});var bUr=I(eBe=>{"use strict";Object.defineProperty(eBe,"__esModule",{value:!0});eBe.InMemoryLogRecordExporter=void 0;var vUr=Z7(),Jvt=class{_finishedLogRecords=[];_stopped=!1;export(e,r){if(this._stopped)return r({code:vUr.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),r({code:vUr.ExportResultCode.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}};eBe.InMemoryLogRecordExporter=Jvt});var CUr=I(tBe=>{"use strict";Object.defineProperty(tBe,"__esModule",{value:!0});tBe.BatchLogRecordProcessorBase=void 0;var Jyo=(ir(),bt(hr)),Yv=Z7(),Zvt=class{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,r){this._exporter=e,this._maxExportBatchSize=r?.maxExportBatchSize??(0,Yv.getNumberFromEnv)("OTEL_BLRP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=r?.maxQueueSize??(0,Yv.getNumberFromEnv)("OTEL_BLRP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??(0,Yv.getNumberFromEnv)("OTEL_BLRP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??(0,Yv.getNumberFromEnv)("OTEL_BLRP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new Yv.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(Jyo.diag.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,r)=>{let n=[],o=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let s=0;s<o;s++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():new Promise((e,r)=>{(0,Yv.callWithTimeout)(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis).then(()=>e()).catch(r)})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,(0,Yv.globalErrorHandler)(r)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){let r=()=>Yv.internal._export(this._exporter,e).then(o=>{o.code!==Yv.ExportResultCode.SUCCESS&&(0,Yv.globalErrorHandler)(o.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${o})`))}).catch(Yv.globalErrorHandler),n=e.map(o=>o.resource).filter(o=>o.asyncAttributesPending);return n.length===0?r():Promise.all(n.map(o=>o.waitForAsyncAttributes?.())).then(r,Yv.globalErrorHandler)}};tBe.BatchLogRecordProcessorBase=Zvt});var SUr=I(rBe=>{"use strict";Object.defineProperty(rBe,"__esModule",{value:!0});rBe.BatchLogRecordProcessor=void 0;var Zyo=CUr(),ebt=class extends Zyo.BatchLogRecordProcessorBase{onShutdown(){}};rBe.BatchLogRecordProcessor=ebt});var xUr=I(nBe=>{"use strict";Object.defineProperty(nBe,"__esModule",{value:!0});nBe.BatchLogRecordProcessor=void 0;var e_o=SUr();Object.defineProperty(nBe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return e_o.BatchLogRecordProcessor}})});var wUr=I(iBe=>{"use strict";Object.defineProperty(iBe,"__esModule",{value:!0});iBe.BatchLogRecordProcessor=void 0;var t_o=xUr();Object.defineProperty(iBe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return t_o.BatchLogRecordProcessor}})});var TUr=I(My=>{"use strict";Object.defineProperty(My,"__esModule",{value:!0});My.BatchLogRecordProcessor=My.InMemoryLogRecordExporter=My.SimpleLogRecordProcessor=My.ConsoleLogRecordExporter=My.NoopLogRecordProcessor=My.LoggerProvider=void 0;var r_o=AUr();Object.defineProperty(My,"LoggerProvider",{enumerable:!0,get:function(){return r_o.LoggerProvider}});var n_o=Vvt();Object.defineProperty(My,"NoopLogRecordProcessor",{enumerable:!0,get:function(){return n_o.NoopLogRecordProcessor}});var i_o=_Ur();Object.defineProperty(My,"ConsoleLogRecordExporter",{enumerable:!0,get:function(){return i_o.ConsoleLogRecordExporter}});var o_o=EUr();Object.defineProperty(My,"SimpleLogRecordProcessor",{enumerable:!0,get:function(){return o_o.SimpleLogRecordProcessor}});var s_o=bUr();Object.defineProperty(My,"InMemoryLogRecordExporter",{enumerable:!0,get:function(){return s_o.InMemoryLogRecordExporter}});var a_o=wUr();Object.defineProperty(My,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return a_o.BatchLogRecordProcessor}})});var Lh,IUr,Hme,DUr,Vme,Wme,RUr,kUr,NUr,OUr,BUr,PUr,MUr,FUr,LUr,UUr,QUr,jUr,$Ur,GUr,qUr,HUr,VUr,WUr,zUr,YUr,KUr,XUr,JUr,ZUr,eQr,tQr,rQr,nQr,iQr,oQr,sQr,aQr,cQr,lQr,uQr,dQr,fQr,pQr,pZ=q(()=>{"use strict";Lh="iflow-cli",IUr="iflow_cli.user_prompt",Hme="iflow_cli.tool_call",DUr="iflow_cli.api_request",Vme="iflow_cli.api_error",Wme="iflow_cli.api_response",RUr="iflow_cli.config",kUr="iflow_cli.flash_fallback",NUr="iflow_cli.next_speaker_check",OUr="iflow_cli.slash_command",BUr="iflow_cli.cli_response",PUr="iflow_cli.tool.call.count",MUr="iflow_cli.tool.call.latency",FUr="iflow_cli.mcp.tool.call.count",LUr="iflow_cli.mcp.tool.call.latency",UUr="iflow_cli.builtin.tool.call.count",QUr="iflow_cli.builtin.tool.call.latency",jUr="gen_ai.client.operation",$Ur="gen_ai.client.operation.duration",GUr="gen_ai.client.token.usage",qUr="iflow_cli.session.count",HUr="iflow_cli.file.operation.count",VUr="iflow_cli.user_request.count",WUr="iflow_cli.user_request.latency",zUr="iflow_cli.user_experience.success",YUr="iflow_cli.user.identity",KUr="iflow_cli.scheduler.lock.error",XUr="iflow_cli.mcp.connect.count",JUr="iflow_cli.loop.detection.count",ZUr="iflow_cli.paste.operation.count",eQr="iflow_cli.paste.operation.latency",tQr="iflow_cli.xinliu.web.search.count",rQr="iflow_cli.xinliu.web.search.latency",nQr="iflow_cli.web.fetch.count",iQr="iflow_cli.web.fetch.latency",oQr="iflow_cli.approval.mode.count",sQr="iflow_cli.compression.lightweight.count",aQr="iflow_cli.compression.lightweight.ratio",cQr="iflow_cli.compression.full.count",lQr="iflow_cli.compression.full.ratio",uQr="iflow_cli.smart_approval.blacklist.block.count",dQr="iflow_cli.smart_approval.blacklist.user_action.count",fQr="iflow_cli.smart_approval.ai_review.count",pQr="iflow_cli.smart_approval.ai_risky.user_action.count"});var hZ,mZ,gZ,AZ,yZ,_Z,EZ,vZ,bZ,CZ,cS,lS,hQr=q(()=>{"use strict";hZ="iflow_cli.cpu.usage_percentage",mZ="iflow_cli.cpu.user_percentage",gZ="iflow_cli.cpu.system_percentage",AZ="iflow_cli.cpu.cores",yZ="iflow_cli.memory.heap_used",_Z="iflow_cli.memory.heap_total",EZ="iflow_cli.memory.rss",vZ="iflow_cli.memory.external",bZ="iflow_cli.memory.system_usage_percentage",CZ="iflow_cli.memory.process_usage_percentage",cS={[hZ]:"CPU usage percentage",[mZ]:"CPU user time percentage",[gZ]:"CPU system time percentage",[AZ]:"Number of CPU cores",[yZ]:"Heap memory used in bytes",[_Z]:"Heap memory total in bytes",[EZ]:"Resident Set Size in bytes",[vZ]:"External memory in bytes",[bZ]:"System memory usage percentage",[CZ]:"Process memory usage percentage relative to Node.js limits"},lS={[hZ]:"percent",[mZ]:"percent",[gZ]:"percent",[AZ]:"cores",[yZ]:"bytes",[_Z]:"bytes",[EZ]:"bytes",[vZ]:"bytes",[bZ]:"percent",[CZ]:"percent"}});import*as uS from"os";var oBe,mQr=q(()=>{"use strict";hQr();oBe=class{meter;options;lastCpuMeasurement;lastMeasureTime;cpuCores;totalSystemMemory;nodeJSMemoryLimit;cpuUsageGauge;cpuUserGauge;cpuSystemGauge;cpuCoresGauge;memoryHeapUsedGauge;memoryHeapTotalGauge;memoryRssGauge;memoryExternalGauge;memorySystemUsageGauge;memoryProcessUsageGauge;constructor(e,r={}){this.meter=e,this.options={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...r},this.lastCpuMeasurement=process.cpuUsage(),this.lastMeasureTime=Date.now(),this.cpuCores=uS.cpus().length,this.totalSystemMemory=uS.totalmem(),this.nodeJSMemoryLimit=this.getNodeJSMemoryLimit(),this.initializeMetrics()}getCurrentCpuMetrics(){try{let e=process.cpuUsage(this.lastCpuMeasurement),r=Date.now(),n=r-this.lastMeasureTime;if(this.lastCpuMeasurement=process.cpuUsage(),this.lastMeasureTime=r,n<=0)return{usage:0,user:0,system:0,cores:this.cpuCores};let o=Math.max(0,e.user+e.system),s=Math.max(0,e.user),a=Math.max(0,e.system),c=o/(n*1e3)*100,u=s/(n*1e3)*100,d=a/(n*1e3)*100,f=Number.isFinite(c)?Math.min(100,Math.max(0,c)):0,p=Number.isFinite(u)?Math.min(100,Math.max(0,u)):0,h=Number.isFinite(d)?Math.min(100,Math.max(0,d)):0;return{usage:f,user:p,system:h,cores:this.cpuCores}}catch{return{usage:0,user:0,system:0,cores:this.cpuCores}}}getCurrentMemoryMetrics(){try{let e=process.memoryUsage(),r=uS.freemem(),o=(this.totalSystemMemory-r)/this.totalSystemMemory*100,s=e.rss/this.nodeJSMemoryLimit*100;return{heapUsed:e.heapUsed,heapTotal:e.heapTotal,rss:e.rss,external:e.external,systemUsage:Math.min(100,Math.max(0,o)),processUsage:Math.min(100,Math.max(0,s))}}catch{return{heapUsed:0,heapTotal:0,rss:0,external:0,systemUsage:0,processUsage:0}}}initializeMetrics(){let e=uS.platform(),r=uS.arch(),n=process.version;this.options.enableCpuMetrics&&(this.cpuUsageGauge=this.meter.createObservableGauge(hZ,{description:cS[hZ],unit:lS[hZ]}),this.cpuUserGauge=this.meter.createObservableGauge(mZ,{description:cS[mZ],unit:lS[mZ]}),this.cpuSystemGauge=this.meter.createObservableGauge(gZ,{description:cS[gZ],unit:lS[gZ]}),this.cpuCoresGauge=this.meter.createObservableGauge(AZ,{description:cS[AZ],unit:lS[AZ]}),this.cpuUsageGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.usage,{platform:e,arch:r,node_version:n})}),this.cpuUserGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.user,{platform:e,arch:r,node_version:n})}),this.cpuSystemGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.system,{platform:e,arch:r,node_version:n})}),this.cpuCoresGauge?.addCallback(o=>{o.observe(this.cpuCores,{platform:e,arch:r})})),this.options.enableMemoryMetrics&&(this.memoryHeapUsedGauge=this.meter.createObservableGauge(yZ,{description:cS[yZ],unit:lS[yZ]}),this.memoryHeapTotalGauge=this.meter.createObservableGauge(_Z,{description:cS[_Z],unit:lS[_Z]}),this.memoryRssGauge=this.meter.createObservableGauge(EZ,{description:cS[EZ],unit:lS[EZ]}),this.memoryExternalGauge=this.meter.createObservableGauge(vZ,{description:cS[vZ],unit:lS[vZ]}),this.memorySystemUsageGauge=this.meter.createObservableGauge(bZ,{description:cS[bZ],unit:lS[bZ]}),this.memoryProcessUsageGauge=this.meter.createObservableGauge(CZ,{description:cS[CZ],unit:lS[CZ]}),this.memoryHeapUsedGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.heapUsed,{platform:e,arch:r,node_version:n})}),this.memoryHeapTotalGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.heapTotal,{platform:e,arch:r,node_version:n})}),this.memoryRssGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.rss,{platform:e,arch:r,node_version:n})}),this.memoryExternalGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.external,{platform:e,arch:r,node_version:n})}),this.memorySystemUsageGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.systemUsage,{platform:e,arch:r,node_version:n})}),this.memoryProcessUsageGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.processUsage,{platform:e,arch:r,node_version:n,memory_limit_mb:Math.round(this.nodeJSMemoryLimit/(1024*1024)).toString()})}))}getNodeJSMemoryLimit(){let e=process.execArgv.find(o=>o.startsWith("--max-old-space-size="))?.split("=")[1];if(e){let o=parseInt(e,10);if(!isNaN(o)&&o>0)return o*1024*1024}let r=process.execArgv.find(o=>o.startsWith("--max_old_space_size="))?.split("=")[1];if(r){let o=parseInt(r,10);if(!isNaN(o)&&o>0)return o*1024*1024}let n=uS.arch();return n==="x64"||n==="arm64"?1400*1024*1024:700*1024*1024}}});function gQr(t,e={}){if(sBe)return sBe;let r={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...e};return sBe=new oBe(t,r),sBe}var sBe,AQr=q(()=>{"use strict";mQr();sBe=null});import c_o from"os";function yQr(){try{let t=c_o.networkInterfaces();for(let e of Object.keys(t)){let r=t[e];if(r){for(let n of r)if(n.family==="IPv4"&&!n.internal)return n.address}}return"127.0.0.1"}catch{return"127.0.0.1"}}var _Qr=q(()=>{"use strict"});import*as SZ from"os";import*as aBe from"fs";function pa(t){let e="0.4.9",r=process.env.IFLOW_ENV||"normal",n={darwin:"macOS",win32:"Windows",linux:"Linux",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX"},o=SZ.platform(),s=n[o]||o,a="unknown";try{if(o==="darwin")a=SZ.release();else if(o==="linux")try{if(aBe.existsSync("/etc/os-release")){let m=aBe.readFileSync("/etc/os-release","utf8").match(/^PRETTY_NAME="(.+)"/m);m&&(a=m[1])}}catch{a=SZ.release()}else o==="win32"&&(a=SZ.release())}catch{a="unknown"}let c={name:"Node.js",version:process.version,architecture:process.arch},u=t.getModel()||"unknown",d=t.getUsageMode(),f=!1,p=t.getContentGeneratorConfig?.();if(p){let h=p.authType,m=p.baseUrl||"";(h===Jt.LOGIN_WITH_IFLOW||h===Jt.IFLOW||h===Jt.OPENAI_COMPATIBLE&&m.includes("apis.iflow.cn"))&&(f=!0)}return{app_name:Lh,tenant__:"gen_ai",version:e,platform:s,os_model:a,runtime_name:c.name,runtime_version:c.version,runtime_architecture:c.architecture,model_name:u,is_iflow_open_user:String(f),ip:yQr(),iflow_env:r,usage_mode:d}}var tbt=q(()=>{"use strict";hE();_Qr();pZ()});function EQr(){return rbt||(rbt=Dpe.getMeter(Lh)),rbt}function vQr(){if(Zl)return;let t=EQr();if(t){try{gQr(t,{enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0})}catch{}nbt=t.createHistogram(PUr,{description:"Counts tool calls, tagged by function name and success.",unit:"count",valueType:qs.INT}),ibt=t.createHistogram(MUr,{description:"Latency of tool calls in milliseconds.",unit:"ms",valueType:qs.INT}),obt=t.createHistogram(FUr,{description:"Counts MCP tool calls, tagged by function name and success.",unit:"count",valueType:qs.INT}),sbt=t.createHistogram(LUr,{description:"Latency of MCP tool calls in milliseconds.",unit:"ms",valueType:qs.INT}),abt=t.createHistogram(UUr,{description:"Counts built-in tool calls, tagged by function name and success.",unit:"count",valueType:qs.INT}),cbt=t.createHistogram(QUr,{description:"Latency of built-in tool calls in milliseconds.",unit:"ms",valueType:qs.INT}),zme=t.createHistogram(jUr,{description:"Counts API requests, tagged by model and status.",unit:"count",valueType:qs.INT}),Yme=t.createHistogram($Ur,{description:"Latency of API requests in milliseconds.",unit:"ms",valueType:qs.INT}),lbt=t.createHistogram(GUr,{description:"Counts the total number of tokens used.",unit:"tokens",valueType:qs.INT}),ubt=t.createHistogram(HUr,{description:"Counts file operations (create, read, update).",unit:"count",valueType:qs.INT}),dbt=t.createHistogram(VUr,{description:"Counts user requests from prompt to completion.",unit:"count",valueType:qs.INT}),fbt=t.createHistogram(WUr,{description:"End-to-end latency of user requests in milliseconds.",unit:"ms",valueType:qs.INT}),pbt=t.createHistogram(zUr,{description:"User experience success rate - counts successful user experiences including retries and fixes.",unit:"count",valueType:qs.INT}),hbt=t.createHistogram(YUr,{description:"User identity for tracking unique installations.",unit:"count",valueType:qs.INT}),mbt=t.createHistogram(KUr,{description:"Counts tool scheduler lock errors when new calls are blocked by running calls.",unit:"count",valueType:qs.INT}),gbt=t.createHistogram(XUr,{description:"Counts MCP connection attempts and their success/failure status.",unit:"count",valueType:qs.INT}),Abt=t.createHistogram(JUr,{description:"Counts loop detection events by loop type.",unit:"count",valueType:qs.INT}),ybt=t.createHistogram(ZUr,{description:"Counts paste operations, tagged by type and success.",unit:"count",valueType:qs.INT}),_bt=t.createHistogram(eQr,{description:"Latency of paste operations in milliseconds.",unit:"ms",valueType:qs.INT}),Ebt=t.createHistogram(tQr,{description:"Counts xinliu web search operations, tagged by success and error type.",unit:"count",valueType:qs.INT}),vbt=t.createHistogram(rQr,{description:"Latency of xinliu web search operations in milliseconds.",unit:"ms",valueType:qs.INT}),bbt=t.createHistogram(nQr,{description:"Counts web fetch operations, tagged by success and error type.",unit:"count",valueType:qs.INT}),Cbt=t.createHistogram(iQr,{description:"Latency of web fetch operations in milliseconds.",unit:"ms",valueType:qs.INT}),Sbt=t.createHistogram(oQr,{description:"Counts usage of different approval modes.",unit:"count",valueType:qs.INT}),xbt=t.createHistogram(sQr,{description:"Counts lightweight compression triggers, tagged by executed status and skip reason.",unit:"count",valueType:qs.INT}),wbt=t.createHistogram(aQr,{description:"Histogram of lightweight compression token reduction ratios (reduced_tokens / original_tokens).",unit:"ratio",valueType:qs.DOUBLE}),Tbt=t.createHistogram(cQr,{description:"Counts full compression triggers, tagged by triggered_by and had_lightweight_before.",unit:"count",valueType:qs.INT}),Ibt=t.createHistogram(lQr,{description:"Histogram of full compression token reduction ratios (reduced_tokens / original_tokens).",unit:"ratio",valueType:qs.DOUBLE}),Dbt=t.createHistogram(uQr,{description:"Counts blacklist blocks in smart approval, tagged by function name and risk level.",unit:"count",valueType:qs.INT}),Rbt=t.createHistogram(dQr,{description:"Counts user actions after blacklist block, tagged by function name and action (execute/cancel).",unit:"count",valueType:qs.INT}),kbt=t.createHistogram(fQr,{description:"Counts AI review operations in smart approval, tagged by function name and decision (safe/risky).",unit:"count",valueType:qs.INT}),Nbt=t.createHistogram(pQr,{description:"Counts user actions after AI judges risky, tagged by function name and action (execute/cancel).",unit:"count",valueType:qs.INT}),Zl=!0}}function cBe(t){let e=EQr();if(!e||!Zl)return;e.createHistogram(qUr,{description:"Count of CLI sessions started.",unit:"count",valueType:qs.INT}).record(1,pa(t))}function bQr(t,e,r,n,o,s){if(!nbt||!ibt||!Zl)return;let a={...pa(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};nbt.record(1,a),ibt.record(r,{...pa(t),function_name:e??"unknown",tool_type:s??"unknown"})}function CQr(t,e,r,n,o,s){if(!obt||!sbt||!Zl)return;let a={...pa(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};s&&(a.execution_context=s),obt.record(1,a),sbt.record(r,{...pa(t),function_name:e??"unknown",execution_context:s??"unknown"})}function SQr(t,e,r,n,o,s){if(!abt||!cbt||!Zl)return;let a={...pa(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};s&&(a.execution_context=s),abt.record(1,a),cbt.record(r,{...pa(t),function_name:e??"unknown",execution_context:s??"unknown"})}function xZ(t,e,r,n){!lbt||!Zl||lbt.record(r,{...pa(t),model:e??"unknown",type:n??"unknown"})}function xQr(t,e,r,n,o,s,a,c){if(!zme||!Yme||!Zl)return;let u={...pa(t),model:e??"unknown",status_code:String(n??(o?"error":"ok"))};a!==void 0&&(u.http_status_code=String(a)),c!==void 0&&(u.business_code=String(c)),s&&(u.finish_reason=s),zme.record(1,u);let d={...pa(t),model:e??"unknown",http_status_code:String(a??200),finish_reason:s??"unknown"};c!=null&&(d.business_code=String(c)),Yme.record(r,d)}function wQr(t,e,r,n,o,s,a){if(!zme||!Yme||!Zl)return;let c={...pa(t),model:e??"unknown",status_code:String(n??"error"),error:o??"unknown"};s!==void 0&&(c.http_status_code=String(s)),a!==void 0&&(c.business_code=String(a)),zme.record(1,c);let u={...pa(t),model:e??"unknown",http_status_code:String(s??0),error:o??"unknown"};a!=null&&(u.business_code=String(a)),Yme.record(r,u)}function eI(t,e,r,n,o){if(!ubt||!Zl)return;let s={...pa(t),operation:e};r!==void 0&&(s.lines=String(r)),n!==void 0&&(s.mimetype=n),o!==void 0&&(s.extension=o),ubt.record(1,s)}function TQr(t,e,r,n,o){if(!dbt||!fbt||!Zl)return;let s={...pa(t),prompt_id:e,success:String(n)};o&&(s.error=o),dbt.record(1,s),fbt.record(r,s)}function Obt(t,e,r=!1,n=!1,o){if(!pbt||!Zl)return;let s={...pa(t),success:String(e),had_retries:String(r),had_fixes:String(n)};o&&(s.final_error=o),pbt.record(1,s)}function IQr(t,e){if(!hbt||!Zl)return;let r={...pa(t),user_id:e};hbt.record(1,r)}function DQr(t,e,r){if(!mbt||!Zl)return;let n={...pa(t),running_calls_count:String(e)};r.forEach((o,s)=>{n[`call_${s}_name`]=o.name,n[`call_${s}_status`]=o.status}),mbt.record(1,n)}function Bbt(t,e,r,n,o){if(!gbt||!Zl)return;let s={...pa(t),server_name:e,success:String(r)};n&&(s.error_type=n),o&&(s.transport_type=o),gbt.record(1,s)}function RQr(t,e,r){if(!Abt||!Zl)return;let n={...pa(t),loop_type:e,prompt_id:r};Abt.record(1,n)}function lBe(t,e,r,n,o="text",s,a){if(!ybt||!_bt||!Zl)return;let c={};try{c=pa(t)}catch{c={app_name:Lh,tenant__:"gen_ai",version:"unknown",platform:a||"unknown",os_model:"unknown",runtime_name:"Node.js",runtime_version:process.version,runtime_architecture:process.arch,model_name:"unknown",is_iflow_open_user:"false",ip:"unknown",iflow_env:"test",usage_mode:"unknown"}}let u={...c,success:String(n),paste_type:o};s&&(u.error_type=s),a&&(u.platform_specific=a),ybt.record(1,u);let d={...c,paste_type:o,text_length_range:String(r),performance_ratio:l_o(e,r)};_bt.record(e,d)}function l_o(t,e){if(e===0)return"no-text";let r=t/e;return r<=.1?"excellent":r<=.5?"good":r<=1?"normal":r<=2?"slow":"very-slow"}function uBe(t,e,r,n,o,s){if(!Ebt||!vbt||!Zl)return;let a={...pa(t),success:String(r)};n&&(a.error_type=n),o!==void 0&&(a.results_count=String(o)),s&&(a.query_length=String(s.length)),Ebt.record(1,a),vbt.record(e,{...pa(t),error_type:n??"none"})}function rj(t,e,r,n,o,s){if(!bbt||!Cbt||!Zl)return;let a={...pa(t),success:String(r)};n&&(a.error_type=n),o!==void 0&&(a.url_count=String(o)),s!==void 0&&(a.prompt_length=String(s)),bbt.record(1,a),Cbt.record(e,{...pa(t),error_type:n??"none"})}function dBe(t,e){if(!Sbt||!Zl)return;let r={...pa(t),approval_mode:e};Sbt.record(1,r)}function wZ(t,e,r,n){if(!xbt||!Zl)return;let o={...pa(t),executed:String(e),triggered_by:r};n&&(o.skipped_reason=n),xbt.record(1,o)}function fBe(t,e,r,n){if(!wbt||!Zl)return;let o=e-r,s=e>0?o/e:0,a={...pa(t),original_tokens:String(e),compressed_tokens:String(r),reduced_tokens:String(o),removed_tool_calls:String(n)};wbt.record(s,a)}function TZ(t,e,r,n){if(!Tbt||!Zl)return;let o={...pa(t),executed:String(e),triggered_by:r,had_lightweight_before:String(n)};Tbt.record(1,o)}function pBe(t,e,r,n,o){if(!Ibt||!Zl)return;let s=e-r,a=e>0?s/e:0,c={...pa(t),original_tokens:String(e),compressed_tokens:String(r),reduced_tokens:String(s),had_lightweight_before:String(n),recovered_files_count:String(o)};Ibt.record(a,c)}function hBe(t,e,r,n,o){if(!Dbt||!Zl)return;let s={...pa(t),function_name:e,risk_level:r};if(n&&(s.rule_name=n),o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let c=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=c}}Dbt.record(1,s)}function mBe(t,e,r,n,o){if(!Rbt||!Zl)return;let s={...pa(t),function_name:e,action:r,risk_level:n};if(o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let c=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=c}}Rbt.record(1,s)}function gBe(t,e,r,n,o,s){if(!kbt||!Zl)return;let a={...pa(t),function_name:e,decision:r,review_layer:o,latency_ms:String(n)};if(s&&typeof s=="object"){let c=s;if((c.command||c.cmd)&&(a.command=String(c.command||c.cmd).substring(0,200)),(c.file_path||c.absolute_path||c.path)&&(a.file_path=String(c.file_path||c.absolute_path||c.path).substring(0,200)),c.url||c.prompt){let u=String(c.url||c.prompt).substring(0,200);a.url_or_prompt=u}}kbt.record(1,a)}function ABe(t,e,r,n,o){if(!Nbt||!Zl)return;let s={...pa(t),function_name:e,action:r,review_layer:n};if(o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let c=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=c}}Nbt.record(1,s)}var dS,rbt,nbt,ibt,obt,sbt,abt,cbt,zme,Yme,lbt,ubt,dbt,fbt,pbt,hbt,mbt,gbt,Abt,ybt,_bt,Ebt,vbt,bbt,Cbt,Sbt,xbt,wbt,Tbt,Ibt,Dbt,Rbt,kbt,Nbt,Zl,Ng=q(()=>{"use strict";ir();pZ();AQr();tbt();(function(t){t.CREATE="create",t.READ="read",t.UPDATE="update"})(dS||(dS={}));Zl=!1});var io,on,oo,so,eu=q(()=>{"use strict";io=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,o,s,a,c=!0,u=!1,d=[]){this.name=e,this.displayName=r,this.description=n,this.icon=o,this.kind=s,this.parameterSchema=a,this.isOutputMarkdown=c,this.canUpdateOutput=u,this.aliases=d}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(e){return null}getDescription(e){return JSON.stringify(e)}shouldConfirmExecute(e,r){return Promise.resolve(!1)}toolLocations(e){return[]}};(function(t){t.ProceedOnce="proceed_once",t.ProceedAlways="proceed_always",t.ProceedAlwaysServer="proceed_always_server",t.ProceedAlwaysTool="proceed_always_tool",t.ModifyWithEditor="modify_with_editor",t.Cancel="cancel"})(on||(on={}));(function(t){t.FileSearch="fileSearch",t.Folder="folder",t.Globe="globe",t.Hammer="hammer",t.LightBulb="lightBulb",t.Pencil="pencil",t.Regex="regex",t.Terminal="terminal"})(oo||(oo={}));(function(t){t.Read="read",t.Edit="edit",t.Delete="delete",t.Move="move",t.Search="search",t.Execute="execute",t.Think="think",t.Fetch="fetch",t.Other="other"})(so||(so={}))});function u_o(t){switch(t){case on.ProceedOnce:case on.ProceedAlways:case on.ProceedAlwaysServer:case on.ProceedAlwaysTool:return Kme.ACCEPT;case on.ModifyWithEditor:return Kme.MODIFY;case on.Cancel:default:return Kme.REJECT}}var Kme,IZ,DZ,RZ,kZ,NZ,S2,OZ,BZ,Kv,PZ,yBe,uO,_Be,nj=q(()=>{"use strict";eu();hE();(function(t){t.ACCEPT="accept",t.REJECT="reject",t.MODIFY="modify"})(Kme||(Kme={}));IZ=class{"event.name";"event.timestamp";model;embedding_model;sandbox_enabled;core_tools_enabled;approval_mode;api_key_enabled;vertex_ai_enabled;debug_enabled;mcp_servers;telemetry_enabled;telemetry_log_user_prompts_enabled;file_filtering_respect_git_ignore;constructor(e){let r=e.getContentGeneratorConfig(),n=e.getMcpServers(),o=!1,s=!1;r&&r.authType&&(o=r.authType===Jt.IFLOW,s=r.authType===Jt.AONE),this["event.name"]="cli_config",this.model=e.getModel(),this.embedding_model=e.getEmbeddingModel(),this.sandbox_enabled=typeof e.getSandbox()=="string"||!!e.getSandbox(),this.core_tools_enabled=(e.getCoreTools()??[]).join(","),this.approval_mode=e.getApprovalMode(),this.api_key_enabled=o||s,this.vertex_ai_enabled=s,this.debug_enabled=e.getDebugMode(),this.mcp_servers=n?Object.keys(n).join(","):"",this.telemetry_enabled=e.getTelemetryEnabled(),this.telemetry_log_user_prompts_enabled=e.getTelemetryLogPromptsEnabled(),this.file_filtering_respect_git_ignore=e.getFileFilteringRespectGitIgnore()}},DZ=class{"event.name";"event.timestamp";session_id;constructor(e){this["event.name"]="end_session",this["event.timestamp"]=new Date().toISOString(),this.session_id=e?.getSessionId()}},RZ=class{"event.name";"event.timestamp";prompt_length;prompt_id;auth_type;prompt;constructor(e,r,n,o){this["event.name"]="user_prompt",this["event.timestamp"]=new Date().toISOString(),this.prompt_length=e,this.prompt_id=r,this.auth_type=n,this.prompt=o}},kZ=class{"event.name";"event.timestamp";function_name;function_args;duration_ms;success;decision;error;error_type;prompt_id;server_name;response_text;constructor(e){this["event.name"]="tool_call",this["event.timestamp"]=new Date().toISOString(),this.function_name=e.request.name,this.function_args=JSON.stringify(e.request.args),this.duration_ms=e.durationMs??0,this.success=e.status==="success",this.decision=e.outcome?u_o(e.outcome):void 0,this.error=e.response.error?.message,this.error_type=e.response.errorType,this.prompt_id=e.request.prompt_id,this.response_text=JSON.stringify(e.response,null,2),"tool"in e&&e.tool&&"serverName"in e.tool&&(this.server_name=e.tool.serverName)}},NZ=class{"event.name";"event.timestamp";model;prompt_id;request_text;base_url;openai_request;constructor(e,r,n,o,s){this["event.name"]="api_request",this["event.timestamp"]=new Date().toISOString(),this.model=r,this.prompt_id=o,this.request_text=s,this.base_url=e,this.openai_request=n}},S2=class{"event.name";"event.timestamp";model;error;error_type;status_code;http_status_code;business_code;duration_ms;prompt_id;auth_type;constructor(e,r,n,o,s,a,c,u,d){this["event.name"]="api_error",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.error=r,this.error_type=a,this.status_code=c,this.http_status_code=u,this.business_code=d,this.duration_ms=n,this.prompt_id=o,this.auth_type=s}},OZ=class{"event.name";"event.timestamp";model;status_code;http_status_code;business_code;duration_ms;error;input_token_count;output_token_count;cached_content_token_count;thoughts_token_count;tool_token_count;total_token_count;response_text;prompt_id;auth_type;finish_reason;constructor(e,r,n,o,s,a,c,u,d,f){this["event.name"]="api_response",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.duration_ms=r,this.status_code=200,this.http_status_code=d||200,this.business_code=f,this.input_token_count=s?.promptTokenCount??0,this.output_token_count=s?.candidatesTokenCount??0,this.cached_content_token_count=s?.cachedContentTokenCount??0,this.thoughts_token_count=s?.thoughtsTokenCount??0,this.tool_token_count=s?.toolUsePromptTokenCount??0,this.total_token_count=s?.totalTokenCount??0,this.response_text=a,this.error=c,this.prompt_id=n,this.auth_type=o,this.finish_reason=u}},BZ=class{"event.name";"event.timestamp";auth_type;constructor(e){this["event.name"]="flash_fallback",this["event.timestamp"]=new Date().toISOString(),this.auth_type=e}};(function(t){t.CONSECUTIVE_IDENTICAL_TOOL_CALLS="consecutive_identical_tool_calls",t.CHANTING_IDENTICAL_SENTENCES="chanting_identical_sentences",t.LLM_DETECTED_LOOP="llm_detected_loop"})(Kv||(Kv={}));PZ=class{"event.name";"event.timestamp";loop_type;prompt_id;constructor(e,r){this["event.name"]="loop_detected",this["event.timestamp"]=new Date().toISOString(),this.loop_type=e,this.prompt_id=r}},yBe=class{"event.name";"event.timestamp";prompt_id;finish_reason;result;constructor(e,r,n){this["event.name"]="next_speaker_check",this["event.timestamp"]=new Date().toISOString(),this.prompt_id=e,this.finish_reason=r,this.result=n}},uO=class{"event.name";"event.timestamp";command;subcommand;constructor(e,r){this["event.name"]="slash_command",this["event.timestamp"]=new Date().toISOString(),this.command=e,this.subcommand=r}},_Be=class{"event.name";"event.timestamp";model;constructor(e){this["event.name"]="malformed_json_response",this["event.timestamp"]=new Date().toISOString(),this.model=e}}});var ci,kQr=q(()=>{"use strict";(function(t){t[t.IFLOW_CLI_KEY_UNKNOWN=0]="IFLOW_CLI_KEY_UNKNOWN",t[t.IFLOW_CLI_START_SESSION_MODEL=1]="IFLOW_CLI_START_SESSION_MODEL",t[t.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL=2]="IFLOW_CLI_START_SESSION_EMBEDDING_MODEL",t[t.IFLOW_CLI_START_SESSION_SANDBOX=3]="IFLOW_CLI_START_SESSION_SANDBOX",t[t.IFLOW_CLI_START_SESSION_CORE_TOOLS=4]="IFLOW_CLI_START_SESSION_CORE_TOOLS",t[t.IFLOW_CLI_START_SESSION_APPROVAL_MODE=5]="IFLOW_CLI_START_SESSION_APPROVAL_MODE",t[t.IFLOW_CLI_START_SESSION_API_KEY_ENABLED=6]="IFLOW_CLI_START_SESSION_API_KEY_ENABLED",t[t.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED=7]="IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED",t[t.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED=8]="IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED",t[t.IFLOW_CLI_START_SESSION_MCP_SERVERS=9]="IFLOW_CLI_START_SESSION_MCP_SERVERS",t[t.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED=10]="IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED",t[t.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED=11]="IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED",t[t.IFLOW_CLI_START_SESSION_RESPECT_GITIGNORE=12]="IFLOW_CLI_START_SESSION_RESPECT_GITIGNORE",t[t.IFLOW_CLI_USER_PROMPT_LENGTH=13]="IFLOW_CLI_USER_PROMPT_LENGTH",t[t.IFLOW_CLI_TOOL_CALL_NAME=14]="IFLOW_CLI_TOOL_CALL_NAME",t[t.IFLOW_CLI_TOOL_CALL_DECISION=15]="IFLOW_CLI_TOOL_CALL_DECISION",t[t.IFLOW_CLI_TOOL_CALL_SUCCESS=16]="IFLOW_CLI_TOOL_CALL_SUCCESS",t[t.IFLOW_CLI_TOOL_CALL_DURATION_MS=17]="IFLOW_CLI_TOOL_CALL_DURATION_MS",t[t.IFLOW_CLI_TOOL_ERROR_MESSAGE=18]="IFLOW_CLI_TOOL_ERROR_MESSAGE",t[t.IFLOW_CLI_TOOL_CALL_ERROR_TYPE=19]="IFLOW_CLI_TOOL_CALL_ERROR_TYPE",t[t.IFLOW_CLI_API_REQUEST_MODEL=20]="IFLOW_CLI_API_REQUEST_MODEL",t[t.IFLOW_CLI_API_RESPONSE_MODEL=21]="IFLOW_CLI_API_RESPONSE_MODEL",t[t.IFLOW_CLI_API_RESPONSE_STATUS_CODE=22]="IFLOW_CLI_API_RESPONSE_STATUS_CODE",t[t.IFLOW_CLI_API_RESPONSE_DURATION_MS=23]="IFLOW_CLI_API_RESPONSE_DURATION_MS",t[t.IFLOW_CLI_API_ERROR_MESSAGE=24]="IFLOW_CLI_API_ERROR_MESSAGE",t[t.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT=25]="IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT=26]="IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT=27]="IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT=28]="IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT=29]="IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT",t[t.IFLOW_CLI_API_ERROR_MODEL=30]="IFLOW_CLI_API_ERROR_MODEL",t[t.IFLOW_CLI_API_ERROR_TYPE=31]="IFLOW_CLI_API_ERROR_TYPE",t[t.IFLOW_CLI_API_ERROR_STATUS_CODE=32]="IFLOW_CLI_API_ERROR_STATUS_CODE",t[t.IFLOW_CLI_API_ERROR_DURATION_MS=33]="IFLOW_CLI_API_ERROR_DURATION_MS",t[t.IFLOW_CLI_END_SESSION_ID=34]="IFLOW_CLI_END_SESSION_ID",t[t.IFLOW_CLI_PROMPT_ID=35]="IFLOW_CLI_PROMPT_ID",t[t.IFLOW_CLI_AUTH_TYPE=36]="IFLOW_CLI_AUTH_TYPE",t[t.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT=37]="IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT",t[t.IFLOW_CLI_SURFACE=39]="IFLOW_CLI_SURFACE",t[t.IFLOW_CLI_SESSION_ID=40]="IFLOW_CLI_SESSION_ID",t[t.IFLOW_CLI_LOOP_DETECTED_TYPE=38]="IFLOW_CLI_LOOP_DETECTED_TYPE",t[t.IFLOW_CLI_SLASH_COMMAND_NAME=41]="IFLOW_CLI_SLASH_COMMAND_NAME",t[t.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND=42]="IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND",t[t.IFLOW_CLI_RESPONSE_FINISH_REASON=43]="IFLOW_CLI_RESPONSE_FINISH_REASON",t[t.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT=44]="IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT",t[t.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL=45]="IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL",t[t.IFLOW_CLI_RESPONSE_TYPE=46]="IFLOW_CLI_RESPONSE_TYPE",t[t.IFLOW_CLI_RESPONSE_LENGTH=47]="IFLOW_CLI_RESPONSE_LENGTH",t[t.IFLOW_CLI_RESPONSE_SUCCESS=48]="IFLOW_CLI_RESPONSE_SUCCESS",t[t.IFLOW_CLI_ERROR_MESSAGE=49]="IFLOW_CLI_ERROR_MESSAGE"})(ci||(ci={}))});function ij(t,e){let r=new WeakSet;return JSON.stringify(t,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular]";r.add(o)}return o},e)}var EBe=q(()=>{"use strict";});import Uw,{dirname as d_o,join as Pbt}from"node:path";import vBe from"os";import*as NQr from"crypto";import{fileURLToPath as f_o}from"node:url";import p_o from"node:fs";import{execSync as h_o}from"node:child_process";function Qw(t){let e=vBe.homedir();return t.startsWith(e)?t.replace(e,"~"):t}function ca(t,e=35){if(t.length<=e)return t;let n=Uw.parse(t).root,o=Uw.sep,a=t.substring(n.length).split(o).filter(m=>m!=="");if(a.length<=1){let m=Math.floor((e-3)/2);if(m<=0)return t.substring(0,e-3)+"...";let g=t.substring(0,m),A=t.substring(t.length-m);return`${g}...${A}`}let c=a[0],u=a[a.length-1],d=n+c,f=[],p=o.length+u.length;for(let m=a.length-2;m>=0;m--){let g=a[m],A=p+o.length+g.length;if(A<=e)f.unshift(g),p=A;else break}let h=f.join(o)+o+u;return p>e?h:(h=d+o+h,h.length>e?"..."+h.substring(h.length-e-3):h)}function ul(t,e){let r=Uw.resolve(t),n=Uw.resolve(e);return Uw.relative(n,r)||"."}function MZ(t){let e="";for(let r=0;r<t.length;r++)t[r]===" "&&(r===0||t[r-1]!=="\\")?e+="\\ ":e+=t[r];return e}function tI(t){return process.platform==="win32"?t.replace(/\\([ ,;!?()[\]{}])/g,"$1"):t.replace(/\\(.)/g,"$1")}function bBe(t){return NQr.createHash("sha256").update(t).digest("hex")}function s3(t){let e=bBe(t);return Uw.join(vBe.homedir(),Og,m_o,e)}function CBe(){return Uw.join(vBe.homedir(),Og,OQr)}function SBe(t){return Uw.join(t,Og,OQr)}function xBe(){if(process.env.USE_BUILTIN_RIPGREP==="0")return"rg";let t=d_o(f_o(import.meta.url)),e=[Pbt(t,"..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),Pbt(t,"..","..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),Pbt(t,"..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`)];for(let r of e)try{if(p_o.existsSync(r))return process.platform==="darwin"&&BQr(r),r}catch{}return e[0]}function BQr(t){if(process.platform==="darwin")try{let e=["com.apple.quarantine","CachedFileMimeType","CachedFileType","FileXRayCachedResultInEA"];for(let r of e)try{h_o(`xattr -d "${r}" "${t}" 2>/dev/null`,{stdio:"ignore"})}catch{}}catch{}}function oj(t,e){let n=vBe.platform()==="win32"?Uw.win32:Uw,o=n.relative(t,e);return!o.startsWith(`..${n.sep}`)&&o!==".."&&!n.isAbsolute(o)}var Og,Mbt,m_o,OQr,vu=q(()=>{"use strict";Og=".iflow",Mbt="google_accounts.json",m_o="tmp",OQr="commands"});import g_o from"node:path";import{promises as jec,existsSync as PQr,readFileSync as MQr}from"node:fs";import*as FQr from"os";function LQr(){return g_o.join(FQr.homedir(),Og,Mbt)}function UQr(){try{let t=LQr();if(PQr(t)){let e=MQr(t,"utf-8").trim();return e?JSON.parse(e).active:null}return null}catch(t){return console.debug("Error reading cached Google Account:",t),null}}function QQr(){try{let t=LQr();if(!PQr(t))return 0;let e=MQr(t,"utf-8").trim();if(!e)return 0;let r=JSON.parse(e);if(!r||typeof r!="object")return 0;let n=r,o=n.old&&Array.isArray(n.old)?n.old.length:0;return n.active&&o++,o}catch(t){return console.debug("Error reading lifetime Google Accounts:",t),0}}var jQr=q(()=>{"use strict";vu();});import*as $Qr from"os";import*as rI from"fs";import*as Ubt from"path";import{randomUUID as A_o}from"crypto";function __o(){rI.existsSync(Fbt)||rI.mkdirSync(Fbt,{recursive:!0})}function E_o(){return rI.existsSync(Lbt)&&rI.readFileSync(Lbt,"utf-8").trim()||null}function v_o(t){rI.writeFileSync(Lbt,t,"utf-8")}function wBe(){try{__o();let t=E_o();return t||(t=A_o(),v_o(t)),t}catch(t){return console.error("Error accessing installation ID file, generating ephemeral ID:",t),"123456789"}}var y_o,Fbt,Lbt,Qbt=q(()=>{"use strict";vu();y_o=$Qr.homedir()??"",Fbt=Ubt.join(y_o,Og),Lbt=Ubt.join(Fbt,"installation_id")});var GQr,b_o,C_o,S_o,x_o,w_o,T_o,I_o,D_o,R_o,k_o,N_o,O_o,B_o,Im,Xme=q(()=>{"use strict";GQr=we(opt(),1);nj();kQr();EBe();jQr();Qbt();b_o="start_session",C_o="new_prompt",S_o="tool_call",x_o="api_request",w_o="api_response",T_o="api_error",I_o="end_session",D_o="flash_fallback",R_o="loop_detected",k_o="next_speaker_check",N_o="slash_command",O_o="malformed_json_response",B_o="cli_response",Im=class t{static instance;config;events=[];last_flush_time=Date.now();flush_interval_ms=1e3*60;constructor(e){this.config=e}static getInstance(e){if(!(e===void 0||!e?.getUsageStatisticsEnabled()))return t.instance||(t.instance=new t(e)),t.instance}enqueueLogEvent(e){this.events.push([{event_time_ms:Date.now(),source_extension_json:ij(e)}])}createLogEvent(e,r){let n=UQr(),o=QQr();r.push({iflow_cli_key:ci.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT,value:o.toString()});let s={console_type:"IFLOW_CLI",application:102,event_name:e,event_metadata:[r]};return n?s.client_email=n:s.client_install_id=wBe(),s}flushIfNeeded(){Date.now()-this.last_flush_time<this.flush_interval_ms||this.flushToClearcut().catch(e=>{console.debug("Error flushing to Clearcut:",e)})}async flushToClearcut(){return this.config?.getDebugMode()&&console.log("Telemetry disabled - not sending log events to Clearcut."),this.events.length=0,this.last_flush_time=Date.now(),Promise.resolve({})}decodeLogResponse(e){if(e.length<1||e.readUInt8(0)!==8)return;let r=BigInt(0),n=!0;for(let s=1;n&&s<e.length;s++){let a=e.readUInt8(s);r|=BigInt(a&127)<<BigInt(7*(s-1)),n=(a&128)!==0}return n?void 0:{nextRequestWaitMs:Number(r)}}handleLogEvent(e,r,n=!1){this.enqueueLogEvent(this.createLogEvent(e,r)),n?this.flushToClearcut().catch(o=>{console.debug("Error flushing to Clearcut:",o)}):this.flushIfNeeded()}logStartSessionEvent(e){let r=process.env.SURFACE||"SURFACE_NOT_SET",n=[{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_MODEL,value:e.model},{iflow_cli_key:ci.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL,value:e.embedding_model},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_SANDBOX,value:e.sandbox_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_CORE_TOOLS,value:e.core_tools_enabled},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_APPROVAL_MODE,value:e.approval_mode},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_API_KEY_ENABLED,value:e.api_key_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED,value:e.debug_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_MCP_SERVERS,value:e.mcp_servers},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED,value:e.telemetry_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED,value:e.telemetry_log_user_prompts_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_SURFACE,value:r}];this.handleLogEvent(b_o,n,!0)}logNewPromptEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_USER_PROMPT_LENGTH,value:JSON.stringify(e.prompt_length)},{iflow_cli_key:ci.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:ci.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(C_o,r)}logToolCallEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_TOOL_CALL_NAME,value:JSON.stringify(e.function_name)},{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:ci.IFLOW_CLI_TOOL_CALL_DECISION,value:JSON.stringify(e.decision)},{iflow_cli_key:ci.IFLOW_CLI_TOOL_CALL_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:ci.IFLOW_CLI_TOOL_CALL_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:ci.IFLOW_CLI_TOOL_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:ci.IFLOW_CLI_TOOL_CALL_ERROR_TYPE,value:JSON.stringify(e.error_type)}];this.handleLogEvent(S_o,r)}logApiRequestEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_API_REQUEST_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)}];this.handleLogEvent(x_o,r)}logApiResponseEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:ci.IFLOW_CLI_API_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT,value:JSON.stringify(e.input_token_count)},{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT,value:JSON.stringify(e.output_token_count)},{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT,value:JSON.stringify(e.cached_content_token_count)},{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT,value:JSON.stringify(e.thoughts_token_count)},{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT,value:JSON.stringify(e.tool_token_count)},{iflow_cli_key:ci.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(w_o,r)}logApiErrorEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_API_ERROR_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:ci.IFLOW_CLI_API_ERROR_TYPE,value:JSON.stringify(e.error_type)},{iflow_cli_key:ci.IFLOW_CLI_API_ERROR_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:ci.IFLOW_CLI_API_ERROR_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:ci.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(T_o,r)}logFlashFallbackEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)},{iflow_cli_key:ci.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.handleLogEvent(D_o,r,!0)}logLoopDetectedEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:ci.IFLOW_CLI_LOOP_DETECTED_TYPE,value:JSON.stringify(e.loop_type)}];this.handleLogEvent(R_o,r)}logNextSpeakerCheck(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:ci.IFLOW_CLI_RESPONSE_FINISH_REASON,value:JSON.stringify(e.finish_reason)},{iflow_cli_key:ci.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT,value:JSON.stringify(e.result)},{iflow_cli_key:ci.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.handleLogEvent(k_o,r)}logSlashCommandEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_SLASH_COMMAND_NAME,value:JSON.stringify(e.command)}];e.subcommand&&r.push({iflow_cli_key:ci.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND,value:JSON.stringify(e.subcommand)}),this.handleLogEvent(N_o,r)}logMalformedJsonResponseEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL,value:JSON.stringify(e.model)}];this.handleLogEvent(O_o,r)}logCliResponseEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:ci.IFLOW_CLI_RESPONSE_TYPE,value:JSON.stringify(e.response_type)},{iflow_cli_key:ci.IFLOW_CLI_RESPONSE_LENGTH,value:JSON.stringify(e.response_length)},{iflow_cli_key:ci.IFLOW_CLI_RESPONSE_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:ci.IFLOW_CLI_ERROR_MESSAGE,value:JSON.stringify(e.error)}];this.handleLogEvent(B_o,r)}logEndSessionEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_SESSION_ID,value:e?.session_id?.toString()??""}];this.handleLogEvent(I_o,r,!0)}getProxyAgent(){let e=this.config?.getProxy();if(e){if(e.startsWith("http"))return new GQr.HttpsProxyAgent(e);throw new Error("Unsupported proxy type")}}shutdown(){let e=new DZ(this.config);this.logEndSessionEvent(e)}}});import*as qQr from"node:fs";var sj,HQr,Jme,TBe,IBe,DBe,VQr=q(()=>{"use strict";sj=we(yi(),1),HQr=we(Zx(),1);Jme=class{writeStream;constructor(e){this.writeStream=qQr.createWriteStream(e,{flags:"a"})}serialize(e){let r=new WeakSet;return JSON.stringify(e,(o,s)=>{if(typeof s=="object"&&s!==null){if(r.has(s))return"[Circular]";r.add(s)}return s},2)+`
485
+ `).find(n=>n.includes("IOPlatformUUID"));if(!e)return;let r=e.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(t){f1o.diag.debug(`error reading machine id: ${t}`)}}KNe.getMachineId=p1o});var kFr=I(XNe=>{"use strict";Object.defineProperty(XNe,"__esModule",{value:!0});XNe.getMachineId=void 0;var h1o=_e("fs"),m1o=(ir(),bt(hr));async function g1o(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await h1o.promises.readFile(e,{encoding:"utf8"})).trim()}catch(r){m1o.diag.debug(`error reading machine id: ${r}`)}}XNe.getMachineId=g1o});var OFr=I(JNe=>{"use strict";Object.defineProperty(JNe,"__esModule",{value:!0});JNe.getMachineId=void 0;var A1o=_e("fs"),y1o=YNe(),NFr=(ir(),bt(hr));async function _1o(){try{return(await A1o.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){NFr.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,y1o.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){NFr.diag.debug(`error reading machine id: ${t}`)}}JNe.getMachineId=_1o});var PFr=I(ZNe=>{"use strict";Object.defineProperty(ZNe,"__esModule",{value:!0});ZNe.getMachineId=void 0;var BFr=_e("process"),E1o=YNe(),v1o=(ir(),bt(hr));async function b1o(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";BFr.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in BFr.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let n=(await(0,E1o.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(n.length===2)return n[1].trim()}catch(r){v1o.diag.debug(`error reading machine id: ${r}`)}}ZNe.getMachineId=b1o});var MFr=I(eOe=>{"use strict";Object.defineProperty(eOe,"__esModule",{value:!0});eOe.getMachineId=void 0;var C1o=(ir(),bt(hr));async function S1o(){C1o.diag.debug("could not read machine-id: unsupported platform")}eOe.getMachineId=S1o});var FFr=I(tOe=>{"use strict";Object.defineProperty(tOe,"__esModule",{value:!0});tOe.getMachineId=void 0;var x1o=_e("process"),zQ;async function w1o(){if(!zQ)switch(x1o.platform){case"darwin":zQ=(await Promise.resolve().then(()=>we(RFr()))).getMachineId;break;case"linux":zQ=(await Promise.resolve().then(()=>we(kFr()))).getMachineId;break;case"freebsd":zQ=(await Promise.resolve().then(()=>we(OFr()))).getMachineId;break;case"win32":zQ=(await Promise.resolve().then(()=>we(PFr()))).getMachineId;break;default:zQ=(await Promise.resolve().then(()=>we(MFr()))).getMachineId;break}return zQ()}tOe.getMachineId=w1o});var cvt=I(rZ=>{"use strict";Object.defineProperty(rZ,"__esModule",{value:!0});rZ.normalizeType=rZ.normalizeArch=void 0;var T1o=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};rZ.normalizeArch=T1o;var I1o=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};rZ.normalizeType=I1o});var UFr=I(rOe=>{"use strict";Object.defineProperty(rOe,"__esModule",{value:!0});rOe.hostDetector=void 0;var lvt=Lme(),LFr=_e("os"),D1o=FFr(),R1o=cvt(),uvt=class{detect(e){return{attributes:{[lvt.ATTR_HOST_NAME]:(0,LFr.hostname)(),[lvt.ATTR_HOST_ARCH]:(0,R1o.normalizeArch)((0,LFr.arch)()),[lvt.ATTR_HOST_ID]:(0,D1o.getMachineId)()}}}};rOe.hostDetector=new uvt});var $Fr=I(nOe=>{"use strict";Object.defineProperty(nOe,"__esModule",{value:!0});nOe.osDetector=void 0;var QFr=Lme(),jFr=_e("os"),k1o=cvt(),dvt=class{detect(e){return{attributes:{[QFr.ATTR_OS_TYPE]:(0,k1o.normalizeType)((0,jFr.platform)()),[QFr.ATTR_OS_VERSION]:(0,jFr.release)()}}}};nOe.osDetector=new dvt});var GFr=I(iOe=>{"use strict";Object.defineProperty(iOe,"__esModule",{value:!0});iOe.processDetector=void 0;var N1o=(ir(),bt(hr)),X7=Lme(),O1o=_e("os"),fvt=class{detect(e){let r={[X7.ATTR_PROCESS_PID]:process.pid,[X7.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[X7.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[X7.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[X7.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[X7.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[X7.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(r[X7.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=O1o.userInfo();r[X7.ATTR_PROCESS_OWNER]=n.username}catch(n){N1o.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:r}}};iOe.processDetector=new fvt});var qFr=I(oOe=>{"use strict";Object.defineProperty(oOe,"__esModule",{value:!0});oOe.serviceInstanceIdDetector=void 0;var B1o=Lme(),P1o=_e("crypto"),pvt=class{detect(e){return{attributes:{[B1o.ATTR_SERVICE_INSTANCE_ID]:(0,P1o.randomUUID)()}}}};oOe.serviceInstanceIdDetector=new pvt});var HFr=I(Bw=>{"use strict";Object.defineProperty(Bw,"__esModule",{value:!0});Bw.serviceInstanceIdDetector=Bw.processDetector=Bw.osDetector=Bw.hostDetector=void 0;var M1o=UFr();Object.defineProperty(Bw,"hostDetector",{enumerable:!0,get:function(){return M1o.hostDetector}});var F1o=$Fr();Object.defineProperty(Bw,"osDetector",{enumerable:!0,get:function(){return F1o.osDetector}});var L1o=GFr();Object.defineProperty(Bw,"processDetector",{enumerable:!0,get:function(){return L1o.processDetector}});var U1o=qFr();Object.defineProperty(Bw,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return U1o.serviceInstanceIdDetector}})});var VFr=I(Pw=>{"use strict";Object.defineProperty(Pw,"__esModule",{value:!0});Pw.serviceInstanceIdDetector=Pw.processDetector=Pw.osDetector=Pw.hostDetector=void 0;var sOe=HFr();Object.defineProperty(Pw,"hostDetector",{enumerable:!0,get:function(){return sOe.hostDetector}});Object.defineProperty(Pw,"osDetector",{enumerable:!0,get:function(){return sOe.osDetector}});Object.defineProperty(Pw,"processDetector",{enumerable:!0,get:function(){return sOe.processDetector}});Object.defineProperty(Pw,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return sOe.serviceInstanceIdDetector}})});var WFr=I(nZ=>{"use strict";Object.defineProperty(nZ,"__esModule",{value:!0});nZ.noopDetector=nZ.NoopDetector=void 0;var aOe=class{detect(){return{attributes:{}}}};nZ.NoopDetector=aOe;nZ.noopDetector=new aOe});var zFr=I(Py=>{"use strict";Object.defineProperty(Py,"__esModule",{value:!0});Py.noopDetector=Py.serviceInstanceIdDetector=Py.processDetector=Py.osDetector=Py.hostDetector=Py.envDetector=void 0;var Q1o=DFr();Object.defineProperty(Py,"envDetector",{enumerable:!0,get:function(){return Q1o.envDetector}});var cOe=VFr();Object.defineProperty(Py,"hostDetector",{enumerable:!0,get:function(){return cOe.hostDetector}});Object.defineProperty(Py,"osDetector",{enumerable:!0,get:function(){return cOe.osDetector}});Object.defineProperty(Py,"processDetector",{enumerable:!0,get:function(){return cOe.processDetector}});Object.defineProperty(Py,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return cOe.serviceInstanceIdDetector}});var j1o=WFr();Object.defineProperty(Py,"noopDetector",{enumerable:!0,get:function(){return j1o.noopDetector}})});var mvt=I(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});hp.defaultServiceName=hp.emptyResource=hp.defaultResource=hp.resourceFromAttributes=hp.serviceInstanceIdDetector=hp.processDetector=hp.osDetector=hp.hostDetector=hp.envDetector=hp.detectResources=void 0;var $1o=TFr();Object.defineProperty(hp,"detectResources",{enumerable:!0,get:function(){return $1o.detectResources}});var Ume=zFr();Object.defineProperty(hp,"envDetector",{enumerable:!0,get:function(){return Ume.envDetector}});Object.defineProperty(hp,"hostDetector",{enumerable:!0,get:function(){return Ume.hostDetector}});Object.defineProperty(hp,"osDetector",{enumerable:!0,get:function(){return Ume.osDetector}});Object.defineProperty(hp,"processDetector",{enumerable:!0,get:function(){return Ume.processDetector}});Object.defineProperty(hp,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Ume.serviceInstanceIdDetector}});var hvt=ovt();Object.defineProperty(hp,"resourceFromAttributes",{enumerable:!0,get:function(){return hvt.resourceFromAttributes}});Object.defineProperty(hp,"defaultResource",{enumerable:!0,get:function(){return hvt.defaultResource}});Object.defineProperty(hp,"emptyResource",{enumerable:!0,get:function(){return hvt.emptyResource}});var G1o=rvt();Object.defineProperty(hp,"defaultServiceName",{enumerable:!0,get:function(){return G1o.defaultServiceName}})});var YFr=I(Qme=>{"use strict";Object.defineProperty(Qme,"__esModule",{value:!0});Qme.SeverityNumber=void 0;var q1o;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(q1o=Qme.SeverityNumber||(Qme.SeverityNumber={}))});var uOe=I(iZ=>{"use strict";Object.defineProperty(iZ,"__esModule",{value:!0});iZ.NOOP_LOGGER=iZ.NoopLogger=void 0;var lOe=class{emit(e){}};iZ.NoopLogger=lOe;iZ.NOOP_LOGGER=new lOe});var fOe=I(oZ=>{"use strict";Object.defineProperty(oZ,"__esModule",{value:!0});oZ.NOOP_LOGGER_PROVIDER=oZ.NoopLoggerProvider=void 0;var H1o=uOe(),dOe=class{getLogger(e,r,n){return new H1o.NoopLogger}};oZ.NoopLoggerProvider=dOe;oZ.NOOP_LOGGER_PROVIDER=new dOe});var Avt=I(pOe=>{"use strict";Object.defineProperty(pOe,"__esModule",{value:!0});pOe.ProxyLogger=void 0;var V1o=uOe(),gvt=class{constructor(e,r,n,o){this._provider=e,this.name=r,this.version=n,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):V1o.NOOP_LOGGER}};pOe.ProxyLogger=gvt});var _vt=I(hOe=>{"use strict";Object.defineProperty(hOe,"__esModule",{value:!0});hOe.ProxyLoggerProvider=void 0;var W1o=fOe(),z1o=Avt(),yvt=class{getLogger(e,r,n){var o;return(o=this._getDelegateLogger(e,r,n))!==null&&o!==void 0?o:new z1o.ProxyLogger(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:W1o.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,r,n)}};hOe.ProxyLoggerProvider=yvt});var KFr=I(mOe=>{"use strict";Object.defineProperty(mOe,"__esModule",{value:!0});mOe._globalThis=void 0;mOe._globalThis=typeof globalThis=="object"?globalThis:global});var XFr=I(gOe=>{"use strict";Object.defineProperty(gOe,"__esModule",{value:!0});gOe._globalThis=void 0;var Y1o=KFr();Object.defineProperty(gOe,"_globalThis",{enumerable:!0,get:function(){return Y1o._globalThis}})});var JFr=I(AOe=>{"use strict";Object.defineProperty(AOe,"__esModule",{value:!0});AOe._globalThis=void 0;var K1o=XFr();Object.defineProperty(AOe,"_globalThis",{enumerable:!0,get:function(){return K1o._globalThis}})});var ZFr=I(Mw=>{"use strict";Object.defineProperty(Mw,"__esModule",{value:!0});Mw.API_BACKWARDS_COMPATIBILITY_VERSION=Mw.makeGetter=Mw._global=Mw.GLOBAL_LOGS_API_KEY=void 0;var X1o=JFr();Mw.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");Mw._global=X1o._globalThis;function J1o(t,e,r){return n=>n===t?e:r}Mw.makeGetter=J1o;Mw.API_BACKWARDS_COMPATIBILITY_VERSION=1});var tLr=I(yOe=>{"use strict";Object.defineProperty(yOe,"__esModule",{value:!0});yOe.LogsAPI=void 0;var Wv=ZFr(),Z1o=fOe(),eLr=_vt(),Evt=class t{constructor(){this._proxyLoggerProvider=new eLr.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Wv._global[Wv.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(Wv._global[Wv.GLOBAL_LOGS_API_KEY]=(0,Wv.makeGetter)(Wv.API_BACKWARDS_COMPATIBILITY_VERSION,e,Z1o.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=Wv._global[Wv.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(Wv._global,Wv.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete Wv._global[Wv.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new eLr.ProxyLoggerProvider}};yOe.LogsAPI=Evt});var iLr=I(kg=>{"use strict";Object.defineProperty(kg,"__esModule",{value:!0});kg.logs=kg.ProxyLoggerProvider=kg.ProxyLogger=kg.NoopLoggerProvider=kg.NOOP_LOGGER_PROVIDER=kg.NoopLogger=kg.NOOP_LOGGER=kg.SeverityNumber=void 0;var e3o=YFr();Object.defineProperty(kg,"SeverityNumber",{enumerable:!0,get:function(){return e3o.SeverityNumber}});var rLr=uOe();Object.defineProperty(kg,"NOOP_LOGGER",{enumerable:!0,get:function(){return rLr.NOOP_LOGGER}});Object.defineProperty(kg,"NoopLogger",{enumerable:!0,get:function(){return rLr.NoopLogger}});var nLr=fOe();Object.defineProperty(kg,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return nLr.NOOP_LOGGER_PROVIDER}});Object.defineProperty(kg,"NoopLoggerProvider",{enumerable:!0,get:function(){return nLr.NoopLoggerProvider}});var t3o=Avt();Object.defineProperty(kg,"ProxyLogger",{enumerable:!0,get:function(){return t3o.ProxyLogger}});var r3o=_vt();Object.defineProperty(kg,"ProxyLoggerProvider",{enumerable:!0,get:function(){return r3o.ProxyLoggerProvider}});var n3o=tLr();kg.logs=n3o.LogsAPI.getInstance()});var jme=I(cO=>{"use strict";Object.defineProperty(cO,"__esModule",{value:!0});cO.isTracingSuppressed=cO.unsuppressTracing=cO.suppressTracing=void 0;var i3o=(ir(),bt(hr)),vvt=(0,i3o.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function o3o(t){return t.setValue(vvt,!0)}cO.suppressTracing=o3o;function s3o(t){return t.deleteValue(vvt)}cO.unsuppressTracing=s3o;function a3o(t){return t.getValue(vvt)===!0}cO.isTracingSuppressed=a3o});var bvt=I(E2=>{"use strict";Object.defineProperty(E2,"__esModule",{value:!0});E2.BAGGAGE_MAX_TOTAL_LENGTH=E2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=E2.BAGGAGE_MAX_NAME_VALUE_PAIRS=E2.BAGGAGE_HEADER=E2.BAGGAGE_ITEMS_SEPARATOR=E2.BAGGAGE_PROPERTIES_SEPARATOR=E2.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;E2.BAGGAGE_KEY_PAIR_SEPARATOR="=";E2.BAGGAGE_PROPERTIES_SEPARATOR=";";E2.BAGGAGE_ITEMS_SEPARATOR=",";E2.BAGGAGE_HEADER="baggage";E2.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;E2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;E2.BAGGAGE_MAX_TOTAL_LENGTH=8192});var Cvt=I(Fw=>{"use strict";Object.defineProperty(Fw,"__esModule",{value:!0});Fw.parseKeyPairsIntoRecord=Fw.parsePairKeyValue=Fw.getKeyPairs=Fw.serializeKeyPairs=void 0;var c3o=(ir(),bt(hr)),YQ=bvt();function l3o(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?YQ.BAGGAGE_ITEMS_SEPARATOR:""}${r}`;return n.length>YQ.BAGGAGE_MAX_TOTAL_LENGTH?e:n},"")}Fw.serializeKeyPairs=l3o;function u3o(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=YQ.BAGGAGE_PROPERTIES_SEPARATOR+r.metadata.toString()),n})}Fw.getKeyPairs=u3o;function oLr(t){let e=t.split(YQ.BAGGAGE_PROPERTIES_SEPARATOR);if(e.length<=0)return;let r=e.shift();if(!r)return;let n=r.indexOf(YQ.BAGGAGE_KEY_PAIR_SEPARATOR);if(n<=0)return;let o=decodeURIComponent(r.substring(0,n).trim()),s=decodeURIComponent(r.substring(n+1).trim()),a;return e.length>0&&(a=(0,c3o.baggageEntryMetadataFromString)(e.join(YQ.BAGGAGE_PROPERTIES_SEPARATOR))),{key:o,value:s,metadata:a}}Fw.parsePairKeyValue=oLr;function d3o(t){let e={};return typeof t=="string"&&t.length>0&&t.split(YQ.BAGGAGE_ITEMS_SEPARATOR).forEach(r=>{let n=oLr(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}Fw.parseKeyPairsIntoRecord=d3o});var sLr=I(_Oe=>{"use strict";Object.defineProperty(_Oe,"__esModule",{value:!0});_Oe.W3CBaggagePropagator=void 0;var Svt=(ir(),bt(hr)),f3o=jme(),KQ=bvt(),xvt=Cvt(),wvt=class{inject(e,r,n){let o=Svt.propagation.getBaggage(e);if(!o||(0,f3o.isTracingSuppressed)(e))return;let s=(0,xvt.getKeyPairs)(o).filter(c=>c.length<=KQ.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,KQ.BAGGAGE_MAX_NAME_VALUE_PAIRS),a=(0,xvt.serializeKeyPairs)(s);a.length>0&&n.set(r,KQ.BAGGAGE_HEADER,a)}extract(e,r,n){let o=n.get(r,KQ.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(KQ.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let a={};return s.length===0||(s.split(KQ.BAGGAGE_ITEMS_SEPARATOR).forEach(u=>{let d=(0,xvt.parsePairKeyValue)(u);if(d){let f={value:d.value};d.metadata&&(f.metadata=d.metadata),a[d.key]=f}}),Object.entries(a).length===0)?e:Svt.propagation.setBaggage(e,Svt.propagation.createBaggage(a))}fields(){return[KQ.BAGGAGE_HEADER]}};_Oe.W3CBaggagePropagator=wvt});var aLr=I(EOe=>{"use strict";Object.defineProperty(EOe,"__esModule",{value:!0});EOe.AnchoredClock=void 0;var Tvt=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,r){this._monotonicClock=r,this._epochMillis=e.now(),this._performanceMillis=r.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}};EOe.AnchoredClock=Tvt});var fLr=I(lO=>{"use strict";Object.defineProperty(lO,"__esModule",{value:!0});lO.isAttributeValue=lO.isAttributeKey=lO.sanitizeAttributes=void 0;var cLr=(ir(),bt(hr));function p3o(t){let e={};if(typeof t!="object"||t==null)return e;for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!lLr(r)){cLr.diag.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!uLr(n)){cLr.diag.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}lO.sanitizeAttributes=p3o;function lLr(t){return typeof t=="string"&&t!==""}lO.isAttributeKey=lLr;function uLr(t){return t==null?!0:Array.isArray(t)?h3o(t):dLr(typeof t)}lO.isAttributeValue=uLr;function h3o(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(dLr(n)){e=n;continue}return!1}return!1}}return!0}function dLr(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var Ivt=I(vOe=>{"use strict";Object.defineProperty(vOe,"__esModule",{value:!0});vOe.loggingErrorHandler=void 0;var m3o=(ir(),bt(hr));function g3o(){return t=>{m3o.diag.error(A3o(t))}}vOe.loggingErrorHandler=g3o;function A3o(t){return typeof t=="string"?t:JSON.stringify(y3o(t))}function y3o(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let o=r[n];o&&(e[n]=String(o))}),r=Object.getPrototypeOf(r);return e}});var hLr=I(sZ=>{"use strict";Object.defineProperty(sZ,"__esModule",{value:!0});sZ.globalErrorHandler=sZ.setGlobalErrorHandler=void 0;var _3o=Ivt(),pLr=(0,_3o.loggingErrorHandler)();function E3o(t){pLr=t}sZ.setGlobalErrorHandler=E3o;function v3o(t){try{pLr(t)}catch{}}sZ.globalErrorHandler=v3o});var yLr=I(Lw=>{"use strict";Object.defineProperty(Lw,"__esModule",{value:!0});Lw.getStringListFromEnv=Lw.getBooleanFromEnv=Lw.getStringFromEnv=Lw.getNumberFromEnv=void 0;var mLr=(ir(),bt(hr)),gLr=_e("util");function b3o(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){mLr.diag.warn(`Unknown value ${(0,gLr.inspect)(e)} for ${t}, expected a number, using defaults`);return}return r}Lw.getNumberFromEnv=b3o;function ALr(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}Lw.getStringFromEnv=ALr;function C3o(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||mLr.diag.warn(`Unknown value ${(0,gLr.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}Lw.getBooleanFromEnv=C3o;function S3o(t){return ALr(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}Lw.getStringListFromEnv=S3o});var _Lr=I(bOe=>{"use strict";Object.defineProperty(bOe,"__esModule",{value:!0});bOe._globalThis=void 0;bOe._globalThis=typeof globalThis=="object"?globalThis:global});var ELr=I(COe=>{"use strict";Object.defineProperty(COe,"__esModule",{value:!0});COe.otperformance=void 0;var x3o=_e("perf_hooks");COe.otperformance=x3o.performance});var vLr=I(SOe=>{"use strict";Object.defineProperty(SOe,"__esModule",{value:!0});SOe.VERSION=void 0;SOe.VERSION="2.2.0"});var bLr=I(xOe=>{"use strict";Object.defineProperty(xOe,"__esModule",{value:!0});xOe.ATTR_PROCESS_RUNTIME_NAME=void 0;xOe.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var CLr=I(TOe=>{"use strict";Object.defineProperty(TOe,"__esModule",{value:!0});TOe.SDK_INFO=void 0;var w3o=vLr(),wOe=(xm(),bt(d2)),T3o=bLr();TOe.SDK_INFO={[wOe.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[T3o.ATTR_PROCESS_RUNTIME_NAME]:"node",[wOe.ATTR_TELEMETRY_SDK_LANGUAGE]:wOe.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[wOe.ATTR_TELEMETRY_SDK_VERSION]:w3o.VERSION}});var SLr=I(v2=>{"use strict";Object.defineProperty(v2,"__esModule",{value:!0});v2.SDK_INFO=v2.otperformance=v2._globalThis=v2.getStringListFromEnv=v2.getNumberFromEnv=v2.getBooleanFromEnv=v2.getStringFromEnv=void 0;var IOe=yLr();Object.defineProperty(v2,"getStringFromEnv",{enumerable:!0,get:function(){return IOe.getStringFromEnv}});Object.defineProperty(v2,"getBooleanFromEnv",{enumerable:!0,get:function(){return IOe.getBooleanFromEnv}});Object.defineProperty(v2,"getNumberFromEnv",{enumerable:!0,get:function(){return IOe.getNumberFromEnv}});Object.defineProperty(v2,"getStringListFromEnv",{enumerable:!0,get:function(){return IOe.getStringListFromEnv}});var I3o=_Lr();Object.defineProperty(v2,"_globalThis",{enumerable:!0,get:function(){return I3o._globalThis}});var D3o=ELr();Object.defineProperty(v2,"otperformance",{enumerable:!0,get:function(){return D3o.otperformance}});var R3o=CLr();Object.defineProperty(v2,"SDK_INFO",{enumerable:!0,get:function(){return R3o.SDK_INFO}})});var Dvt=I(b2=>{"use strict";Object.defineProperty(b2,"__esModule",{value:!0});b2.getStringListFromEnv=b2.getNumberFromEnv=b2.getStringFromEnv=b2.getBooleanFromEnv=b2.otperformance=b2._globalThis=b2.SDK_INFO=void 0;var XQ=SLr();Object.defineProperty(b2,"SDK_INFO",{enumerable:!0,get:function(){return XQ.SDK_INFO}});Object.defineProperty(b2,"_globalThis",{enumerable:!0,get:function(){return XQ._globalThis}});Object.defineProperty(b2,"otperformance",{enumerable:!0,get:function(){return XQ.otperformance}});Object.defineProperty(b2,"getBooleanFromEnv",{enumerable:!0,get:function(){return XQ.getBooleanFromEnv}});Object.defineProperty(b2,"getStringFromEnv",{enumerable:!0,get:function(){return XQ.getStringFromEnv}});Object.defineProperty(b2,"getNumberFromEnv",{enumerable:!0,get:function(){return XQ.getNumberFromEnv}});Object.defineProperty(b2,"getStringListFromEnv",{enumerable:!0,get:function(){return XQ.getStringListFromEnv}})});var ILr=I(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.addHrTimes=Yu.isTimeInput=Yu.isTimeInputHrTime=Yu.hrTimeToMicroseconds=Yu.hrTimeToMilliseconds=Yu.hrTimeToNanoseconds=Yu.hrTimeToTimeStamp=Yu.hrTimeDuration=Yu.timeInputToHrTime=Yu.hrTime=Yu.getTimeOrigin=Yu.millisToHrTime=void 0;var Rvt=Dvt(),xLr=9,k3o=6,N3o=Math.pow(10,k3o),DOe=Math.pow(10,xLr);function $me(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*N3o);return[r,n]}Yu.millisToHrTime=$me;function kvt(){let t=Rvt.otperformance.timeOrigin;if(typeof t!="number"){let e=Rvt.otperformance;t=e.timing&&e.timing.fetchStart}return t}Yu.getTimeOrigin=kvt;function wLr(t){let e=$me(kvt()),r=$me(typeof t=="number"?t:Rvt.otperformance.now());return TLr(e,r)}Yu.hrTime=wLr;function O3o(t){if(Nvt(t))return t;if(typeof t=="number")return t<kvt()?wLr(t):$me(t);if(t instanceof Date)return $me(t.getTime());throw TypeError("Invalid input type")}Yu.timeInputToHrTime=O3o;function B3o(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=DOe),[r,n]}Yu.hrTimeDuration=B3o;function P3o(t){let e=xLr,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}Yu.hrTimeToTimeStamp=P3o;function M3o(t){return t[0]*DOe+t[1]}Yu.hrTimeToNanoseconds=M3o;function F3o(t){return t[0]*1e3+t[1]/1e6}Yu.hrTimeToMilliseconds=F3o;function L3o(t){return t[0]*1e6+t[1]/1e3}Yu.hrTimeToMicroseconds=L3o;function Nvt(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}Yu.isTimeInputHrTime=Nvt;function U3o(t){return Nvt(t)||typeof t=="number"||t instanceof Date}Yu.isTimeInput=U3o;function TLr(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=DOe&&(r[1]-=DOe,r[0]+=1),r}Yu.addHrTimes=TLr});var DLr=I(ROe=>{"use strict";Object.defineProperty(ROe,"__esModule",{value:!0});ROe.unrefTimer=void 0;function Q3o(t){typeof t!="number"&&t.unref()}ROe.unrefTimer=Q3o});var RLr=I(Gme=>{"use strict";Object.defineProperty(Gme,"__esModule",{value:!0});Gme.ExportResultCode=void 0;var j3o;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(j3o=Gme.ExportResultCode||(Gme.ExportResultCode={}))});var NLr=I(kOe=>{"use strict";Object.defineProperty(kOe,"__esModule",{value:!0});kOe.CompositePropagator=void 0;var kLr=(ir(),bt(hr)),Ovt=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(e,r,n){for(let o of this._propagators)try{o.inject(e,r,n)}catch(s){kLr.diag.warn(`Failed to inject with ${o.constructor.name}. Err: ${s.message}`)}}extract(e,r,n){return this._propagators.reduce((o,s)=>{try{return s.extract(o,r,n)}catch(a){kLr.diag.warn(`Failed to extract with ${s.constructor.name}. Err: ${a.message}`)}return o},e)}fields(){return this._fields.slice()}};kOe.CompositePropagator=Ovt});var OLr=I(aZ=>{"use strict";Object.defineProperty(aZ,"__esModule",{value:!0});aZ.validateValue=aZ.validateKey=void 0;var Bvt="[_0-9a-z-*/]",$3o=`[a-z]${Bvt}{0,255}`,G3o=`[a-z0-9]${Bvt}{0,240}@[a-z]${Bvt}{0,13}`,q3o=new RegExp(`^(?:${$3o}|${G3o})$`),H3o=/^[ -~]{0,255}[!-~]$/,V3o=/,|=/;function W3o(t){return q3o.test(t)}aZ.validateKey=W3o;function z3o(t){return H3o.test(t)&&!V3o.test(t)}aZ.validateValue=z3o});var Mvt=I(NOe=>{"use strict";Object.defineProperty(NOe,"__esModule",{value:!0});NOe.TraceState=void 0;var BLr=OLr(),PLr=32,Y3o=512,MLr=",",FLr="=",Pvt=class t{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,r){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n}unset(e){let r=this._clone();return r._internalState.delete(e),r}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,r)=>(e.push(r+FLr+this.get(r)),e),[]).join(MLr)}_parse(e){e.length>Y3o||(this._internalState=e.split(MLr).reverse().reduce((r,n)=>{let o=n.trim(),s=o.indexOf(FLr);if(s!==-1){let a=o.slice(0,s),c=o.slice(s+1,n.length);(0,BLr.validateKey)(a)&&(0,BLr.validateValue)(c)&&r.set(a,c)}return r},new Map),this._internalState.size>PLr&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,PLr))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};NOe.TraceState=Pvt});var ULr=I(C2=>{"use strict";Object.defineProperty(C2,"__esModule",{value:!0});C2.W3CTraceContextPropagator=C2.parseTraceParent=C2.TRACE_STATE_HEADER=C2.TRACE_PARENT_HEADER=void 0;var OOe=(ir(),bt(hr)),K3o=jme(),X3o=Mvt();C2.TRACE_PARENT_HEADER="traceparent";C2.TRACE_STATE_HEADER="tracestate";var J3o="00",Z3o="(?!ff)[\\da-f]{2}",eyo="(?![0]{32})[\\da-f]{32}",tyo="(?![0]{16})[\\da-f]{16}",ryo="[\\da-f]{2}",nyo=new RegExp(`^\\s?(${Z3o})-(${eyo})-(${tyo})-(${ryo})(-.*)?\\s?$`);function LLr(t){let e=nyo.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}C2.parseTraceParent=LLr;var Fvt=class{inject(e,r,n){let o=OOe.trace.getSpanContext(e);if(!o||(0,K3o.isTracingSuppressed)(e)||!(0,OOe.isSpanContextValid)(o))return;let s=`${J3o}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||OOe.TraceFlags.NONE).toString(16)}`;n.set(r,C2.TRACE_PARENT_HEADER,s),o.traceState&&n.set(r,C2.TRACE_STATE_HEADER,o.traceState.serialize())}extract(e,r,n){let o=n.get(r,C2.TRACE_PARENT_HEADER);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let a=LLr(s);if(!a)return e;a.isRemote=!0;let c=n.get(r,C2.TRACE_STATE_HEADER);if(c){let u=Array.isArray(c)?c.join(","):c;a.traceState=new X3o.TraceState(typeof u=="string"?u:void 0)}return OOe.trace.setSpanContext(e,a)}fields(){return[C2.TRACE_PARENT_HEADER,C2.TRACE_STATE_HEADER]}};C2.W3CTraceContextPropagator=Fvt});var QLr=I(aS=>{"use strict";Object.defineProperty(aS,"__esModule",{value:!0});aS.getRPCMetadata=aS.deleteRPCMetadata=aS.setRPCMetadata=aS.RPCType=void 0;var iyo=(ir(),bt(hr)),Lvt=(0,iyo.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),oyo;(function(t){t.HTTP="http"})(oyo=aS.RPCType||(aS.RPCType={}));function syo(t,e){return t.setValue(Lvt,e)}aS.setRPCMetadata=syo;function ayo(t){return t.deleteValue(Lvt)}aS.deleteRPCMetadata=ayo;function cyo(t){return t.getValue(Lvt)}aS.getRPCMetadata=cyo});var HLr=I(BOe=>{"use strict";Object.defineProperty(BOe,"__esModule",{value:!0});BOe.isPlainObject=void 0;var lyo="[object Object]",uyo="[object Null]",dyo="[object Undefined]",fyo=Function.prototype,jLr=fyo.toString,pyo=jLr.call(Object),hyo=Object.getPrototypeOf,$Lr=Object.prototype,GLr=$Lr.hasOwnProperty,JQ=Symbol?Symbol.toStringTag:void 0,qLr=$Lr.toString;function myo(t){if(!gyo(t)||Ayo(t)!==lyo)return!1;let e=hyo(t);if(e===null)return!0;let r=GLr.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&jLr.call(r)===pyo}BOe.isPlainObject=myo;function gyo(t){return t!=null&&typeof t=="object"}function Ayo(t){return t==null?t===void 0?dyo:uyo:JQ&&JQ in Object(t)?yyo(t):_yo(t)}function yyo(t){let e=GLr.call(t,JQ),r=t[JQ],n=!1;try{t[JQ]=void 0,n=!0}catch{}let o=qLr.call(t);return n&&(e?t[JQ]=r:delete t[JQ]),o}function _yo(t){return qLr.call(t)}});var KLr=I(FOe=>{"use strict";Object.defineProperty(FOe,"__esModule",{value:!0});FOe.merge=void 0;var VLr=HLr(),Eyo=20;function vyo(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=zLr(e,t.shift(),0,r);return e}FOe.merge=vyo;function Uvt(t){return MOe(t)?t.slice():t}function zLr(t,e,r=0,n){let o;if(!(r>Eyo)){if(r++,POe(t)||POe(e)||YLr(e))o=Uvt(e);else if(MOe(t)){if(o=t.slice(),MOe(e))for(let s=0,a=e.length;s<a;s++)o.push(Uvt(e[s]));else if(qme(e)){let s=Object.keys(e);for(let a=0,c=s.length;a<c;a++){let u=s[a];o[u]=Uvt(e[u])}}}else if(qme(t))if(qme(e)){if(!byo(t,e))return e;o=Object.assign({},t);let s=Object.keys(e);for(let a=0,c=s.length;a<c;a++){let u=s[a],d=e[u];if(POe(d))typeof d>"u"?delete o[u]:o[u]=d;else{let f=o[u],p=d;if(WLr(t,u,n)||WLr(e,u,n))delete o[u];else{if(qme(f)&&qme(p)){let h=n.get(f)||[],m=n.get(p)||[];h.push({obj:t,key:u}),m.push({obj:e,key:u}),n.set(f,h),n.set(p,m)}o[u]=zLr(o[u],d,r,n)}}}}else o=e;return o}}function WLr(t,e,r){let n=r.get(t[e])||[];for(let o=0,s=n.length;o<s;o++){let a=n[o];if(a.key===e&&a.obj===t)return!0}return!1}function MOe(t){return Array.isArray(t)}function YLr(t){return typeof t=="function"}function qme(t){return!POe(t)&&!MOe(t)&&!YLr(t)&&typeof t=="object"}function POe(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function byo(t,e){return!(!(0,VLr.isPlainObject)(t)||!(0,VLr.isPlainObject)(e))}});var XLr=I(cZ=>{"use strict";Object.defineProperty(cZ,"__esModule",{value:!0});cZ.callWithTimeout=cZ.TimeoutError=void 0;var LOe=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};cZ.TimeoutError=LOe;function Cyo(t,e){let r,n=new Promise(function(s,a){r=setTimeout(function(){a(new LOe("Operation timed out."))},e)});return Promise.race([t,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}cZ.callWithTimeout=Cyo});var ZLr=I(lZ=>{"use strict";Object.defineProperty(lZ,"__esModule",{value:!0});lZ.isUrlIgnored=lZ.urlMatches=void 0;function JLr(t,e){return typeof e=="string"?t===e:!!t.match(e)}lZ.urlMatches=JLr;function Syo(t,e){if(!e)return!1;for(let r of e)if(JLr(t,r))return!0;return!1}lZ.isUrlIgnored=Syo});var eUr=I(UOe=>{"use strict";Object.defineProperty(UOe,"__esModule",{value:!0});UOe.Deferred=void 0;var Qvt=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};UOe.Deferred=Qvt});var tUr=I(QOe=>{"use strict";Object.defineProperty(QOe,"__esModule",{value:!0});QOe.BindOnceFuture=void 0;var xyo=eUr(),jvt=class{_callback;_that;_isCalled=!1;_deferred=new xyo.Deferred;constructor(e,r){this._callback=e,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};QOe.BindOnceFuture=jvt});var nUr=I(jOe=>{"use strict";Object.defineProperty(jOe,"__esModule",{value:!0});jOe.diagLogLevelFromString=void 0;var J7=(ir(),bt(hr)),rUr={ALL:J7.DiagLogLevel.ALL,VERBOSE:J7.DiagLogLevel.VERBOSE,DEBUG:J7.DiagLogLevel.DEBUG,INFO:J7.DiagLogLevel.INFO,WARN:J7.DiagLogLevel.WARN,ERROR:J7.DiagLogLevel.ERROR,NONE:J7.DiagLogLevel.NONE};function wyo(t){if(t==null)return;let e=rUr[t.toUpperCase()];return e??(J7.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(rUr)}, using default`),J7.DiagLogLevel.INFO)}jOe.diagLogLevelFromString=wyo});var oUr=I($Oe=>{"use strict";Object.defineProperty($Oe,"__esModule",{value:!0});$Oe._export=void 0;var iUr=(ir(),bt(hr)),Tyo=jme();function Iyo(t,e){return new Promise(r=>{iUr.context.with((0,Tyo.suppressTracing)(iUr.context.active()),()=>{t.export(e,n=>{r(n)})})})}$Oe._export=Iyo});var Z7=I(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.internal=qr.diagLogLevelFromString=qr.BindOnceFuture=qr.urlMatches=qr.isUrlIgnored=qr.callWithTimeout=qr.TimeoutError=qr.merge=qr.TraceState=qr.unsuppressTracing=qr.suppressTracing=qr.isTracingSuppressed=qr.setRPCMetadata=qr.getRPCMetadata=qr.deleteRPCMetadata=qr.RPCType=qr.parseTraceParent=qr.W3CTraceContextPropagator=qr.TRACE_STATE_HEADER=qr.TRACE_PARENT_HEADER=qr.CompositePropagator=qr.otperformance=qr.getStringListFromEnv=qr.getNumberFromEnv=qr.getBooleanFromEnv=qr.getStringFromEnv=qr._globalThis=qr.SDK_INFO=qr.parseKeyPairsIntoRecord=qr.ExportResultCode=qr.unrefTimer=qr.timeInputToHrTime=qr.millisToHrTime=qr.isTimeInputHrTime=qr.isTimeInput=qr.hrTimeToTimeStamp=qr.hrTimeToNanoseconds=qr.hrTimeToMilliseconds=qr.hrTimeToMicroseconds=qr.hrTimeDuration=qr.hrTime=qr.getTimeOrigin=qr.addHrTimes=qr.loggingErrorHandler=qr.setGlobalErrorHandler=qr.globalErrorHandler=qr.sanitizeAttributes=qr.isAttributeValue=qr.AnchoredClock=qr.W3CBaggagePropagator=void 0;var Dyo=sLr();Object.defineProperty(qr,"W3CBaggagePropagator",{enumerable:!0,get:function(){return Dyo.W3CBaggagePropagator}});var Ryo=aLr();Object.defineProperty(qr,"AnchoredClock",{enumerable:!0,get:function(){return Ryo.AnchoredClock}});var sUr=fLr();Object.defineProperty(qr,"isAttributeValue",{enumerable:!0,get:function(){return sUr.isAttributeValue}});Object.defineProperty(qr,"sanitizeAttributes",{enumerable:!0,get:function(){return sUr.sanitizeAttributes}});var aUr=hLr();Object.defineProperty(qr,"globalErrorHandler",{enumerable:!0,get:function(){return aUr.globalErrorHandler}});Object.defineProperty(qr,"setGlobalErrorHandler",{enumerable:!0,get:function(){return aUr.setGlobalErrorHandler}});var kyo=Ivt();Object.defineProperty(qr,"loggingErrorHandler",{enumerable:!0,get:function(){return kyo.loggingErrorHandler}});var zv=ILr();Object.defineProperty(qr,"addHrTimes",{enumerable:!0,get:function(){return zv.addHrTimes}});Object.defineProperty(qr,"getTimeOrigin",{enumerable:!0,get:function(){return zv.getTimeOrigin}});Object.defineProperty(qr,"hrTime",{enumerable:!0,get:function(){return zv.hrTime}});Object.defineProperty(qr,"hrTimeDuration",{enumerable:!0,get:function(){return zv.hrTimeDuration}});Object.defineProperty(qr,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return zv.hrTimeToMicroseconds}});Object.defineProperty(qr,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return zv.hrTimeToMilliseconds}});Object.defineProperty(qr,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return zv.hrTimeToNanoseconds}});Object.defineProperty(qr,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return zv.hrTimeToTimeStamp}});Object.defineProperty(qr,"isTimeInput",{enumerable:!0,get:function(){return zv.isTimeInput}});Object.defineProperty(qr,"isTimeInputHrTime",{enumerable:!0,get:function(){return zv.isTimeInputHrTime}});Object.defineProperty(qr,"millisToHrTime",{enumerable:!0,get:function(){return zv.millisToHrTime}});Object.defineProperty(qr,"timeInputToHrTime",{enumerable:!0,get:function(){return zv.timeInputToHrTime}});var Nyo=DLr();Object.defineProperty(qr,"unrefTimer",{enumerable:!0,get:function(){return Nyo.unrefTimer}});var Oyo=RLr();Object.defineProperty(qr,"ExportResultCode",{enumerable:!0,get:function(){return Oyo.ExportResultCode}});var Byo=Cvt();Object.defineProperty(qr,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return Byo.parseKeyPairsIntoRecord}});var ZQ=Dvt();Object.defineProperty(qr,"SDK_INFO",{enumerable:!0,get:function(){return ZQ.SDK_INFO}});Object.defineProperty(qr,"_globalThis",{enumerable:!0,get:function(){return ZQ._globalThis}});Object.defineProperty(qr,"getStringFromEnv",{enumerable:!0,get:function(){return ZQ.getStringFromEnv}});Object.defineProperty(qr,"getBooleanFromEnv",{enumerable:!0,get:function(){return ZQ.getBooleanFromEnv}});Object.defineProperty(qr,"getNumberFromEnv",{enumerable:!0,get:function(){return ZQ.getNumberFromEnv}});Object.defineProperty(qr,"getStringListFromEnv",{enumerable:!0,get:function(){return ZQ.getStringListFromEnv}});Object.defineProperty(qr,"otperformance",{enumerable:!0,get:function(){return ZQ.otperformance}});var Pyo=NLr();Object.defineProperty(qr,"CompositePropagator",{enumerable:!0,get:function(){return Pyo.CompositePropagator}});var GOe=ULr();Object.defineProperty(qr,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return GOe.TRACE_PARENT_HEADER}});Object.defineProperty(qr,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return GOe.TRACE_STATE_HEADER}});Object.defineProperty(qr,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return GOe.W3CTraceContextPropagator}});Object.defineProperty(qr,"parseTraceParent",{enumerable:!0,get:function(){return GOe.parseTraceParent}});var qOe=QLr();Object.defineProperty(qr,"RPCType",{enumerable:!0,get:function(){return qOe.RPCType}});Object.defineProperty(qr,"deleteRPCMetadata",{enumerable:!0,get:function(){return qOe.deleteRPCMetadata}});Object.defineProperty(qr,"getRPCMetadata",{enumerable:!0,get:function(){return qOe.getRPCMetadata}});Object.defineProperty(qr,"setRPCMetadata",{enumerable:!0,get:function(){return qOe.setRPCMetadata}});var $vt=jme();Object.defineProperty(qr,"isTracingSuppressed",{enumerable:!0,get:function(){return $vt.isTracingSuppressed}});Object.defineProperty(qr,"suppressTracing",{enumerable:!0,get:function(){return $vt.suppressTracing}});Object.defineProperty(qr,"unsuppressTracing",{enumerable:!0,get:function(){return $vt.unsuppressTracing}});var Myo=Mvt();Object.defineProperty(qr,"TraceState",{enumerable:!0,get:function(){return Myo.TraceState}});var Fyo=KLr();Object.defineProperty(qr,"merge",{enumerable:!0,get:function(){return Fyo.merge}});var cUr=XLr();Object.defineProperty(qr,"TimeoutError",{enumerable:!0,get:function(){return cUr.TimeoutError}});Object.defineProperty(qr,"callWithTimeout",{enumerable:!0,get:function(){return cUr.callWithTimeout}});var lUr=ZLr();Object.defineProperty(qr,"isUrlIgnored",{enumerable:!0,get:function(){return lUr.isUrlIgnored}});Object.defineProperty(qr,"urlMatches",{enumerable:!0,get:function(){return lUr.urlMatches}});var Lyo=tUr();Object.defineProperty(qr,"BindOnceFuture",{enumerable:!0,get:function(){return Lyo.BindOnceFuture}});var Uyo=nUr();Object.defineProperty(qr,"diagLogLevelFromString",{enumerable:!0,get:function(){return Uyo.diagLogLevelFromString}});var Qyo=oUr();qr.internal={_export:Qyo._export}});var uUr=I(VOe=>{"use strict";Object.defineProperty(VOe,"__esModule",{value:!0});VOe.LogRecordImpl=void 0;var ej=(ir(),bt(hr)),HOe=Z7(),Gvt=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;totalAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,r,n){let{timestamp:o,observedTimestamp:s,eventName:a,severityNumber:c,severityText:u,body:d,attributes:f={},context:p}=n,h=Date.now();if(this.hrTime=(0,HOe.timeInputToHrTime)(o??h),this.hrTimeObserved=(0,HOe.timeInputToHrTime)(s??h),p){let m=ej.trace.getSpanContext(p);m&&ej.isSpanContextValid(m)&&(this.spanContext=m)}this.severityNumber=c,this.severityText=u,this.body=d,this.resource=e.resource,this.instrumentationScope=r,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(f)}setAttribute(e,r){return this._isLogRecordReadonly()?this:r===null?this:e.length===0?(ej.diag.warn(`Invalid attribute key: ${e}`),this):!(0,HOe.isAttributeValue)(r)&&!(typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length>0)?(ej.diag.warn(`Invalid attribute value set for key: ${e}`),this):(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this.droppedAttributesCount===1&&ej.diag.warn("Dropping extra attributes."),this):((0,HOe.isAttributeValue)(r)?this.attributes[e]=this._truncateToSize(r):this.attributes[e]=r,this))}setAttributes(e){for(let[r,n]of Object.entries(e))this.setAttribute(r,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let r=this._logRecordLimits.attributeValueLengthLimit;return r<=0?(ej.diag.warn(`Attribute value limit must be positive, got ${r}`),e):typeof e=="string"?this._truncateToLimitUtil(e,r):Array.isArray(e)?e.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):e}_truncateToLimitUtil(e,r){return e.length<=r?e:e.substring(0,r)}_isLogRecordReadonly(){return this._isReadonly&&ej.diag.warn("Can not execute the operation on emitted log record"),this._isReadonly}};VOe.LogRecordImpl=Gvt});var dUr=I(WOe=>{"use strict";Object.defineProperty(WOe,"__esModule",{value:!0});WOe.Logger=void 0;var jyo=(ir(),bt(hr)),$yo=uUr(),qvt=class{instrumentationScope;_sharedState;constructor(e,r){this.instrumentationScope=e,this._sharedState=r}emit(e){let r=e.context||jyo.context.active(),n=new $yo.LogRecordImpl(this._sharedState,this.instrumentationScope,{context:r,...e});this._sharedState.activeProcessor.onEmit(n,r),n._makeReadonly()}};WOe.Logger=qvt});var fUr=I(dZ=>{"use strict";Object.defineProperty(dZ,"__esModule",{value:!0});dZ.reconfigureLimits=dZ.loadDefaultConfig=void 0;var uZ=Z7();function Gyo(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:(0,uZ.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,uZ.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??128},includeTraceContext:!0}}dZ.loadDefaultConfig=Gyo;function qyo(t){return{attributeCountLimit:t.attributeCountLimit??(0,uZ.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??(0,uZ.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128,attributeValueLengthLimit:t.attributeValueLengthLimit??(0,uZ.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,uZ.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0}}dZ.reconfigureLimits=qyo});var Vvt=I(zOe=>{"use strict";Object.defineProperty(zOe,"__esModule",{value:!0});zOe.NoopLogRecordProcessor=void 0;var Hvt=class{forceFlush(){return Promise.resolve()}onEmit(e,r){}shutdown(){return Promise.resolve()}};zOe.NoopLogRecordProcessor=Hvt});var pUr=I(YOe=>{"use strict";Object.defineProperty(YOe,"__esModule",{value:!0});YOe.MultiLogRecordProcessor=void 0;var Hyo=Z7(),Wvt=class{processors;forceFlushTimeoutMillis;constructor(e,r){this.processors=e,this.forceFlushTimeoutMillis=r}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(r=>(0,Hyo.callWithTimeout)(r.forceFlush(),e)))}onEmit(e,r){this.processors.forEach(n=>n.onEmit(e,r))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}};YOe.MultiLogRecordProcessor=Wvt});var hUr=I(KOe=>{"use strict";Object.defineProperty(KOe,"__esModule",{value:!0});KOe.LoggerProviderSharedState=void 0;var Vyo=Vvt(),Wyo=pUr(),zvt=class{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,r,n,o){this.resource=e,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=o,o.length>0?(this.registeredLogRecordProcessors=o,this.activeProcessor=new Wyo.MultiLogRecordProcessor(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Vyo.NoopLogRecordProcessor}};KOe.LoggerProviderSharedState=zvt});var AUr=I(tj=>{"use strict";Object.defineProperty(tj,"__esModule",{value:!0});tj.LoggerProvider=tj.DEFAULT_LOGGER_NAME=void 0;var XOe=(ir(),bt(hr)),zyo=iLr(),Yyo=mvt(),mUr=Z7(),Kyo=dUr(),gUr=fUr(),Xyo=hUr();tj.DEFAULT_LOGGER_NAME="unknown";var Yvt=class{_shutdownOnce;_sharedState;constructor(e={}){let r=(0,mUr.merge)({},(0,gUr.loadDefaultConfig)(),e),n=e.resource??(0,Yyo.defaultResource)();this._sharedState=new Xyo.LoggerProviderSharedState(n,r.forceFlushTimeoutMillis,(0,gUr.reconfigureLimits)(r.logRecordLimits),e?.processors??[]),this._shutdownOnce=new mUr.BindOnceFuture(this._shutdown,this)}getLogger(e,r,n){if(this._shutdownOnce.isCalled)return XOe.diag.warn("A shutdown LoggerProvider cannot provide a Logger"),zyo.NOOP_LOGGER;e||XOe.diag.warn("Logger requested without instrumentation scope name.");let o=e||tj.DEFAULT_LOGGER_NAME,s=`${o}@${r||""}:${n?.schemaUrl||""}`;return this._sharedState.loggers.has(s)||this._sharedState.loggers.set(s,new Kyo.Logger({name:o,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(s)}forceFlush(){return this._shutdownOnce.isCalled?(XOe.diag.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(XOe.diag.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};tj.LoggerProvider=Yvt});var _Ur=I(JOe=>{"use strict";Object.defineProperty(JOe,"__esModule",{value:!0});JOe.ConsoleLogRecordExporter=void 0;var yUr=Z7(),Kvt=class{export(e,r){this._sendLogRecords(e,r)}shutdown(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:(0,yUr.hrTimeToMicroseconds)(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,body:e.body,attributes:e.attributes}}_sendLogRecords(e,r){for(let n of e)console.dir(this._exportInfo(n),{depth:3});r?.({code:yUr.ExportResultCode.SUCCESS})}};JOe.ConsoleLogRecordExporter=Kvt});var EUr=I(ZOe=>{"use strict";Object.defineProperty(ZOe,"__esModule",{value:!0});ZOe.SimpleLogRecordProcessor=void 0;var fZ=Z7(),Xvt=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new fZ.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let r=()=>fZ.internal._export(this._exporter,[e]).then(n=>{n.code!==fZ.ExportResultCode.SUCCESS&&(0,fZ.globalErrorHandler)(n.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${n})`))}).catch(fZ.globalErrorHandler);if(e.resource.asyncAttributesPending){let n=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(n),r()),fZ.globalErrorHandler);n!=null&&this._unresolvedExports.add(n)}else r()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};ZOe.SimpleLogRecordProcessor=Xvt});var bUr=I(eBe=>{"use strict";Object.defineProperty(eBe,"__esModule",{value:!0});eBe.InMemoryLogRecordExporter=void 0;var vUr=Z7(),Jvt=class{_finishedLogRecords=[];_stopped=!1;export(e,r){if(this._stopped)return r({code:vUr.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),r({code:vUr.ExportResultCode.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}};eBe.InMemoryLogRecordExporter=Jvt});var CUr=I(tBe=>{"use strict";Object.defineProperty(tBe,"__esModule",{value:!0});tBe.BatchLogRecordProcessorBase=void 0;var Jyo=(ir(),bt(hr)),Yv=Z7(),Zvt=class{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,r){this._exporter=e,this._maxExportBatchSize=r?.maxExportBatchSize??(0,Yv.getNumberFromEnv)("OTEL_BLRP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=r?.maxQueueSize??(0,Yv.getNumberFromEnv)("OTEL_BLRP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??(0,Yv.getNumberFromEnv)("OTEL_BLRP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??(0,Yv.getNumberFromEnv)("OTEL_BLRP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new Yv.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(Jyo.diag.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,r)=>{let n=[],o=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let s=0;s<o;s++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():new Promise((e,r)=>{(0,Yv.callWithTimeout)(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis).then(()=>e()).catch(r)})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,(0,Yv.globalErrorHandler)(r)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){let r=()=>Yv.internal._export(this._exporter,e).then(o=>{o.code!==Yv.ExportResultCode.SUCCESS&&(0,Yv.globalErrorHandler)(o.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${o})`))}).catch(Yv.globalErrorHandler),n=e.map(o=>o.resource).filter(o=>o.asyncAttributesPending);return n.length===0?r():Promise.all(n.map(o=>o.waitForAsyncAttributes?.())).then(r,Yv.globalErrorHandler)}};tBe.BatchLogRecordProcessorBase=Zvt});var SUr=I(rBe=>{"use strict";Object.defineProperty(rBe,"__esModule",{value:!0});rBe.BatchLogRecordProcessor=void 0;var Zyo=CUr(),ebt=class extends Zyo.BatchLogRecordProcessorBase{onShutdown(){}};rBe.BatchLogRecordProcessor=ebt});var xUr=I(nBe=>{"use strict";Object.defineProperty(nBe,"__esModule",{value:!0});nBe.BatchLogRecordProcessor=void 0;var e_o=SUr();Object.defineProperty(nBe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return e_o.BatchLogRecordProcessor}})});var wUr=I(iBe=>{"use strict";Object.defineProperty(iBe,"__esModule",{value:!0});iBe.BatchLogRecordProcessor=void 0;var t_o=xUr();Object.defineProperty(iBe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return t_o.BatchLogRecordProcessor}})});var TUr=I(My=>{"use strict";Object.defineProperty(My,"__esModule",{value:!0});My.BatchLogRecordProcessor=My.InMemoryLogRecordExporter=My.SimpleLogRecordProcessor=My.ConsoleLogRecordExporter=My.NoopLogRecordProcessor=My.LoggerProvider=void 0;var r_o=AUr();Object.defineProperty(My,"LoggerProvider",{enumerable:!0,get:function(){return r_o.LoggerProvider}});var n_o=Vvt();Object.defineProperty(My,"NoopLogRecordProcessor",{enumerable:!0,get:function(){return n_o.NoopLogRecordProcessor}});var i_o=_Ur();Object.defineProperty(My,"ConsoleLogRecordExporter",{enumerable:!0,get:function(){return i_o.ConsoleLogRecordExporter}});var o_o=EUr();Object.defineProperty(My,"SimpleLogRecordProcessor",{enumerable:!0,get:function(){return o_o.SimpleLogRecordProcessor}});var s_o=bUr();Object.defineProperty(My,"InMemoryLogRecordExporter",{enumerable:!0,get:function(){return s_o.InMemoryLogRecordExporter}});var a_o=wUr();Object.defineProperty(My,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return a_o.BatchLogRecordProcessor}})});var Lh,IUr,Hme,DUr,Vme,Wme,RUr,kUr,NUr,OUr,BUr,PUr,MUr,FUr,LUr,UUr,QUr,jUr,$Ur,GUr,qUr,HUr,VUr,WUr,zUr,YUr,KUr,XUr,JUr,ZUr,eQr,tQr,rQr,nQr,iQr,oQr,sQr,aQr,cQr,lQr,uQr,dQr,fQr,pQr,pZ=q(()=>{"use strict";Lh="iflow-cli",IUr="iflow_cli.user_prompt",Hme="iflow_cli.tool_call",DUr="iflow_cli.api_request",Vme="iflow_cli.api_error",Wme="iflow_cli.api_response",RUr="iflow_cli.config",kUr="iflow_cli.flash_fallback",NUr="iflow_cli.next_speaker_check",OUr="iflow_cli.slash_command",BUr="iflow_cli.cli_response",PUr="iflow_cli.tool.call.count",MUr="iflow_cli.tool.call.latency",FUr="iflow_cli.mcp.tool.call.count",LUr="iflow_cli.mcp.tool.call.latency",UUr="iflow_cli.builtin.tool.call.count",QUr="iflow_cli.builtin.tool.call.latency",jUr="gen_ai.client.operation",$Ur="gen_ai.client.operation.duration",GUr="gen_ai.client.token.usage",qUr="iflow_cli.session.count",HUr="iflow_cli.file.operation.count",VUr="iflow_cli.user_request.count",WUr="iflow_cli.user_request.latency",zUr="iflow_cli.user_experience.success",YUr="iflow_cli.user.identity",KUr="iflow_cli.scheduler.lock.error",XUr="iflow_cli.mcp.connect.count",JUr="iflow_cli.loop.detection.count",ZUr="iflow_cli.paste.operation.count",eQr="iflow_cli.paste.operation.latency",tQr="iflow_cli.xinliu.web.search.count",rQr="iflow_cli.xinliu.web.search.latency",nQr="iflow_cli.web.fetch.count",iQr="iflow_cli.web.fetch.latency",oQr="iflow_cli.approval.mode.count",sQr="iflow_cli.compression.lightweight.count",aQr="iflow_cli.compression.lightweight.ratio",cQr="iflow_cli.compression.full.count",lQr="iflow_cli.compression.full.ratio",uQr="iflow_cli.smart_approval.blacklist.block.count",dQr="iflow_cli.smart_approval.blacklist.user_action.count",fQr="iflow_cli.smart_approval.ai_review.count",pQr="iflow_cli.smart_approval.ai_risky.user_action.count"});var hZ,mZ,gZ,AZ,yZ,_Z,EZ,vZ,bZ,CZ,cS,lS,hQr=q(()=>{"use strict";hZ="iflow_cli.cpu.usage_percentage",mZ="iflow_cli.cpu.user_percentage",gZ="iflow_cli.cpu.system_percentage",AZ="iflow_cli.cpu.cores",yZ="iflow_cli.memory.heap_used",_Z="iflow_cli.memory.heap_total",EZ="iflow_cli.memory.rss",vZ="iflow_cli.memory.external",bZ="iflow_cli.memory.system_usage_percentage",CZ="iflow_cli.memory.process_usage_percentage",cS={[hZ]:"CPU usage percentage",[mZ]:"CPU user time percentage",[gZ]:"CPU system time percentage",[AZ]:"Number of CPU cores",[yZ]:"Heap memory used in bytes",[_Z]:"Heap memory total in bytes",[EZ]:"Resident Set Size in bytes",[vZ]:"External memory in bytes",[bZ]:"System memory usage percentage",[CZ]:"Process memory usage percentage relative to Node.js limits"},lS={[hZ]:"percent",[mZ]:"percent",[gZ]:"percent",[AZ]:"cores",[yZ]:"bytes",[_Z]:"bytes",[EZ]:"bytes",[vZ]:"bytes",[bZ]:"percent",[CZ]:"percent"}});import*as uS from"os";var oBe,mQr=q(()=>{"use strict";hQr();oBe=class{meter;options;lastCpuMeasurement;lastMeasureTime;cpuCores;totalSystemMemory;nodeJSMemoryLimit;cpuUsageGauge;cpuUserGauge;cpuSystemGauge;cpuCoresGauge;memoryHeapUsedGauge;memoryHeapTotalGauge;memoryRssGauge;memoryExternalGauge;memorySystemUsageGauge;memoryProcessUsageGauge;constructor(e,r={}){this.meter=e,this.options={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...r},this.lastCpuMeasurement=process.cpuUsage(),this.lastMeasureTime=Date.now(),this.cpuCores=uS.cpus().length,this.totalSystemMemory=uS.totalmem(),this.nodeJSMemoryLimit=this.getNodeJSMemoryLimit(),this.initializeMetrics()}getCurrentCpuMetrics(){try{let e=process.cpuUsage(this.lastCpuMeasurement),r=Date.now(),n=r-this.lastMeasureTime;if(this.lastCpuMeasurement=process.cpuUsage(),this.lastMeasureTime=r,n<=0)return{usage:0,user:0,system:0,cores:this.cpuCores};let o=Math.max(0,e.user+e.system),s=Math.max(0,e.user),a=Math.max(0,e.system),c=o/(n*1e3)*100,u=s/(n*1e3)*100,d=a/(n*1e3)*100,f=Number.isFinite(c)?Math.min(100,Math.max(0,c)):0,p=Number.isFinite(u)?Math.min(100,Math.max(0,u)):0,h=Number.isFinite(d)?Math.min(100,Math.max(0,d)):0;return{usage:f,user:p,system:h,cores:this.cpuCores}}catch{return{usage:0,user:0,system:0,cores:this.cpuCores}}}getCurrentMemoryMetrics(){try{let e=process.memoryUsage(),r=uS.freemem(),o=(this.totalSystemMemory-r)/this.totalSystemMemory*100,s=e.rss/this.nodeJSMemoryLimit*100;return{heapUsed:e.heapUsed,heapTotal:e.heapTotal,rss:e.rss,external:e.external,systemUsage:Math.min(100,Math.max(0,o)),processUsage:Math.min(100,Math.max(0,s))}}catch{return{heapUsed:0,heapTotal:0,rss:0,external:0,systemUsage:0,processUsage:0}}}initializeMetrics(){let e=uS.platform(),r=uS.arch(),n=process.version;this.options.enableCpuMetrics&&(this.cpuUsageGauge=this.meter.createObservableGauge(hZ,{description:cS[hZ],unit:lS[hZ]}),this.cpuUserGauge=this.meter.createObservableGauge(mZ,{description:cS[mZ],unit:lS[mZ]}),this.cpuSystemGauge=this.meter.createObservableGauge(gZ,{description:cS[gZ],unit:lS[gZ]}),this.cpuCoresGauge=this.meter.createObservableGauge(AZ,{description:cS[AZ],unit:lS[AZ]}),this.cpuUsageGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.usage,{platform:e,arch:r,node_version:n})}),this.cpuUserGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.user,{platform:e,arch:r,node_version:n})}),this.cpuSystemGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.system,{platform:e,arch:r,node_version:n})}),this.cpuCoresGauge?.addCallback(o=>{o.observe(this.cpuCores,{platform:e,arch:r})})),this.options.enableMemoryMetrics&&(this.memoryHeapUsedGauge=this.meter.createObservableGauge(yZ,{description:cS[yZ],unit:lS[yZ]}),this.memoryHeapTotalGauge=this.meter.createObservableGauge(_Z,{description:cS[_Z],unit:lS[_Z]}),this.memoryRssGauge=this.meter.createObservableGauge(EZ,{description:cS[EZ],unit:lS[EZ]}),this.memoryExternalGauge=this.meter.createObservableGauge(vZ,{description:cS[vZ],unit:lS[vZ]}),this.memorySystemUsageGauge=this.meter.createObservableGauge(bZ,{description:cS[bZ],unit:lS[bZ]}),this.memoryProcessUsageGauge=this.meter.createObservableGauge(CZ,{description:cS[CZ],unit:lS[CZ]}),this.memoryHeapUsedGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.heapUsed,{platform:e,arch:r,node_version:n})}),this.memoryHeapTotalGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.heapTotal,{platform:e,arch:r,node_version:n})}),this.memoryRssGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.rss,{platform:e,arch:r,node_version:n})}),this.memoryExternalGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.external,{platform:e,arch:r,node_version:n})}),this.memorySystemUsageGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.systemUsage,{platform:e,arch:r,node_version:n})}),this.memoryProcessUsageGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.processUsage,{platform:e,arch:r,node_version:n,memory_limit_mb:Math.round(this.nodeJSMemoryLimit/(1024*1024)).toString()})}))}getNodeJSMemoryLimit(){let e=process.execArgv.find(o=>o.startsWith("--max-old-space-size="))?.split("=")[1];if(e){let o=parseInt(e,10);if(!isNaN(o)&&o>0)return o*1024*1024}let r=process.execArgv.find(o=>o.startsWith("--max_old_space_size="))?.split("=")[1];if(r){let o=parseInt(r,10);if(!isNaN(o)&&o>0)return o*1024*1024}let n=uS.arch();return n==="x64"||n==="arm64"?1400*1024*1024:700*1024*1024}}});function gQr(t,e={}){if(sBe)return sBe;let r={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...e};return sBe=new oBe(t,r),sBe}var sBe,AQr=q(()=>{"use strict";mQr();sBe=null});import c_o from"os";function yQr(){try{let t=c_o.networkInterfaces();for(let e of Object.keys(t)){let r=t[e];if(r){for(let n of r)if(n.family==="IPv4"&&!n.internal)return n.address}}return"127.0.0.1"}catch{return"127.0.0.1"}}var _Qr=q(()=>{"use strict"});import*as SZ from"os";import*as aBe from"fs";function pa(t){let e="0.4.10",r=process.env.IFLOW_ENV||"normal",n={darwin:"macOS",win32:"Windows",linux:"Linux",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX"},o=SZ.platform(),s=n[o]||o,a="unknown";try{if(o==="darwin")a=SZ.release();else if(o==="linux")try{if(aBe.existsSync("/etc/os-release")){let m=aBe.readFileSync("/etc/os-release","utf8").match(/^PRETTY_NAME="(.+)"/m);m&&(a=m[1])}}catch{a=SZ.release()}else o==="win32"&&(a=SZ.release())}catch{a="unknown"}let c={name:"Node.js",version:process.version,architecture:process.arch},u=t.getModel()||"unknown",d=t.getUsageMode(),f=!1,p=t.getContentGeneratorConfig?.();if(p){let h=p.authType,m=p.baseUrl||"";(h===Jt.LOGIN_WITH_IFLOW||h===Jt.IFLOW||h===Jt.OPENAI_COMPATIBLE&&m.includes("apis.iflow.cn"))&&(f=!0)}return{app_name:Lh,tenant__:"gen_ai",version:e,platform:s,os_model:a,runtime_name:c.name,runtime_version:c.version,runtime_architecture:c.architecture,model_name:u,is_iflow_open_user:String(f),ip:yQr(),iflow_env:r,usage_mode:d}}var tbt=q(()=>{"use strict";hE();_Qr();pZ()});function EQr(){return rbt||(rbt=Dpe.getMeter(Lh)),rbt}function vQr(){if(Zl)return;let t=EQr();if(t){try{gQr(t,{enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0})}catch{}nbt=t.createHistogram(PUr,{description:"Counts tool calls, tagged by function name and success.",unit:"count",valueType:qs.INT}),ibt=t.createHistogram(MUr,{description:"Latency of tool calls in milliseconds.",unit:"ms",valueType:qs.INT}),obt=t.createHistogram(FUr,{description:"Counts MCP tool calls, tagged by function name and success.",unit:"count",valueType:qs.INT}),sbt=t.createHistogram(LUr,{description:"Latency of MCP tool calls in milliseconds.",unit:"ms",valueType:qs.INT}),abt=t.createHistogram(UUr,{description:"Counts built-in tool calls, tagged by function name and success.",unit:"count",valueType:qs.INT}),cbt=t.createHistogram(QUr,{description:"Latency of built-in tool calls in milliseconds.",unit:"ms",valueType:qs.INT}),zme=t.createHistogram(jUr,{description:"Counts API requests, tagged by model and status.",unit:"count",valueType:qs.INT}),Yme=t.createHistogram($Ur,{description:"Latency of API requests in milliseconds.",unit:"ms",valueType:qs.INT}),lbt=t.createHistogram(GUr,{description:"Counts the total number of tokens used.",unit:"tokens",valueType:qs.INT}),ubt=t.createHistogram(HUr,{description:"Counts file operations (create, read, update).",unit:"count",valueType:qs.INT}),dbt=t.createHistogram(VUr,{description:"Counts user requests from prompt to completion.",unit:"count",valueType:qs.INT}),fbt=t.createHistogram(WUr,{description:"End-to-end latency of user requests in milliseconds.",unit:"ms",valueType:qs.INT}),pbt=t.createHistogram(zUr,{description:"User experience success rate - counts successful user experiences including retries and fixes.",unit:"count",valueType:qs.INT}),hbt=t.createHistogram(YUr,{description:"User identity for tracking unique installations.",unit:"count",valueType:qs.INT}),mbt=t.createHistogram(KUr,{description:"Counts tool scheduler lock errors when new calls are blocked by running calls.",unit:"count",valueType:qs.INT}),gbt=t.createHistogram(XUr,{description:"Counts MCP connection attempts and their success/failure status.",unit:"count",valueType:qs.INT}),Abt=t.createHistogram(JUr,{description:"Counts loop detection events by loop type.",unit:"count",valueType:qs.INT}),ybt=t.createHistogram(ZUr,{description:"Counts paste operations, tagged by type and success.",unit:"count",valueType:qs.INT}),_bt=t.createHistogram(eQr,{description:"Latency of paste operations in milliseconds.",unit:"ms",valueType:qs.INT}),Ebt=t.createHistogram(tQr,{description:"Counts xinliu web search operations, tagged by success and error type.",unit:"count",valueType:qs.INT}),vbt=t.createHistogram(rQr,{description:"Latency of xinliu web search operations in milliseconds.",unit:"ms",valueType:qs.INT}),bbt=t.createHistogram(nQr,{description:"Counts web fetch operations, tagged by success and error type.",unit:"count",valueType:qs.INT}),Cbt=t.createHistogram(iQr,{description:"Latency of web fetch operations in milliseconds.",unit:"ms",valueType:qs.INT}),Sbt=t.createHistogram(oQr,{description:"Counts usage of different approval modes.",unit:"count",valueType:qs.INT}),xbt=t.createHistogram(sQr,{description:"Counts lightweight compression triggers, tagged by executed status and skip reason.",unit:"count",valueType:qs.INT}),wbt=t.createHistogram(aQr,{description:"Histogram of lightweight compression token reduction ratios (reduced_tokens / original_tokens).",unit:"ratio",valueType:qs.DOUBLE}),Tbt=t.createHistogram(cQr,{description:"Counts full compression triggers, tagged by triggered_by and had_lightweight_before.",unit:"count",valueType:qs.INT}),Ibt=t.createHistogram(lQr,{description:"Histogram of full compression token reduction ratios (reduced_tokens / original_tokens).",unit:"ratio",valueType:qs.DOUBLE}),Dbt=t.createHistogram(uQr,{description:"Counts blacklist blocks in smart approval, tagged by function name and risk level.",unit:"count",valueType:qs.INT}),Rbt=t.createHistogram(dQr,{description:"Counts user actions after blacklist block, tagged by function name and action (execute/cancel).",unit:"count",valueType:qs.INT}),kbt=t.createHistogram(fQr,{description:"Counts AI review operations in smart approval, tagged by function name and decision (safe/risky).",unit:"count",valueType:qs.INT}),Nbt=t.createHistogram(pQr,{description:"Counts user actions after AI judges risky, tagged by function name and action (execute/cancel).",unit:"count",valueType:qs.INT}),Zl=!0}}function cBe(t){let e=EQr();if(!e||!Zl)return;e.createHistogram(qUr,{description:"Count of CLI sessions started.",unit:"count",valueType:qs.INT}).record(1,pa(t))}function bQr(t,e,r,n,o,s){if(!nbt||!ibt||!Zl)return;let a={...pa(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};nbt.record(1,a),ibt.record(r,{...pa(t),function_name:e??"unknown",tool_type:s??"unknown"})}function CQr(t,e,r,n,o,s){if(!obt||!sbt||!Zl)return;let a={...pa(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};s&&(a.execution_context=s),obt.record(1,a),sbt.record(r,{...pa(t),function_name:e??"unknown",execution_context:s??"unknown"})}function SQr(t,e,r,n,o,s){if(!abt||!cbt||!Zl)return;let a={...pa(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};s&&(a.execution_context=s),abt.record(1,a),cbt.record(r,{...pa(t),function_name:e??"unknown",execution_context:s??"unknown"})}function xZ(t,e,r,n){!lbt||!Zl||lbt.record(r,{...pa(t),model:e??"unknown",type:n??"unknown"})}function xQr(t,e,r,n,o,s,a,c){if(!zme||!Yme||!Zl)return;let u={...pa(t),model:e??"unknown",status_code:String(n??(o?"error":"ok"))};a!==void 0&&(u.http_status_code=String(a)),c!==void 0&&(u.business_code=String(c)),s&&(u.finish_reason=s),zme.record(1,u);let d={...pa(t),model:e??"unknown",http_status_code:String(a??200),finish_reason:s??"unknown"};c!=null&&(d.business_code=String(c)),Yme.record(r,d)}function wQr(t,e,r,n,o,s,a){if(!zme||!Yme||!Zl)return;let c={...pa(t),model:e??"unknown",status_code:String(n??"error"),error:o??"unknown"};s!==void 0&&(c.http_status_code=String(s)),a!==void 0&&(c.business_code=String(a)),zme.record(1,c);let u={...pa(t),model:e??"unknown",http_status_code:String(s??0),error:o??"unknown"};a!=null&&(u.business_code=String(a)),Yme.record(r,u)}function eI(t,e,r,n,o){if(!ubt||!Zl)return;let s={...pa(t),operation:e};r!==void 0&&(s.lines=String(r)),n!==void 0&&(s.mimetype=n),o!==void 0&&(s.extension=o),ubt.record(1,s)}function TQr(t,e,r,n,o){if(!dbt||!fbt||!Zl)return;let s={...pa(t),prompt_id:e,success:String(n)};o&&(s.error=o),dbt.record(1,s),fbt.record(r,s)}function Obt(t,e,r=!1,n=!1,o){if(!pbt||!Zl)return;let s={...pa(t),success:String(e),had_retries:String(r),had_fixes:String(n)};o&&(s.final_error=o),pbt.record(1,s)}function IQr(t,e){if(!hbt||!Zl)return;let r={...pa(t),user_id:e};hbt.record(1,r)}function DQr(t,e,r){if(!mbt||!Zl)return;let n={...pa(t),running_calls_count:String(e)};r.forEach((o,s)=>{n[`call_${s}_name`]=o.name,n[`call_${s}_status`]=o.status}),mbt.record(1,n)}function Bbt(t,e,r,n,o){if(!gbt||!Zl)return;let s={...pa(t),server_name:e,success:String(r)};n&&(s.error_type=n),o&&(s.transport_type=o),gbt.record(1,s)}function RQr(t,e,r){if(!Abt||!Zl)return;let n={...pa(t),loop_type:e,prompt_id:r};Abt.record(1,n)}function lBe(t,e,r,n,o="text",s,a){if(!ybt||!_bt||!Zl)return;let c={};try{c=pa(t)}catch{c={app_name:Lh,tenant__:"gen_ai",version:"unknown",platform:a||"unknown",os_model:"unknown",runtime_name:"Node.js",runtime_version:process.version,runtime_architecture:process.arch,model_name:"unknown",is_iflow_open_user:"false",ip:"unknown",iflow_env:"test",usage_mode:"unknown"}}let u={...c,success:String(n),paste_type:o};s&&(u.error_type=s),a&&(u.platform_specific=a),ybt.record(1,u);let d={...c,paste_type:o,text_length_range:String(r),performance_ratio:l_o(e,r)};_bt.record(e,d)}function l_o(t,e){if(e===0)return"no-text";let r=t/e;return r<=.1?"excellent":r<=.5?"good":r<=1?"normal":r<=2?"slow":"very-slow"}function uBe(t,e,r,n,o,s){if(!Ebt||!vbt||!Zl)return;let a={...pa(t),success:String(r)};n&&(a.error_type=n),o!==void 0&&(a.results_count=String(o)),s&&(a.query_length=String(s.length)),Ebt.record(1,a),vbt.record(e,{...pa(t),error_type:n??"none"})}function rj(t,e,r,n,o,s){if(!bbt||!Cbt||!Zl)return;let a={...pa(t),success:String(r)};n&&(a.error_type=n),o!==void 0&&(a.url_count=String(o)),s!==void 0&&(a.prompt_length=String(s)),bbt.record(1,a),Cbt.record(e,{...pa(t),error_type:n??"none"})}function dBe(t,e){if(!Sbt||!Zl)return;let r={...pa(t),approval_mode:e};Sbt.record(1,r)}function wZ(t,e,r,n){if(!xbt||!Zl)return;let o={...pa(t),executed:String(e),triggered_by:r};n&&(o.skipped_reason=n),xbt.record(1,o)}function fBe(t,e,r,n){if(!wbt||!Zl)return;let o=e-r,s=e>0?o/e:0,a={...pa(t),original_tokens:String(e),compressed_tokens:String(r),reduced_tokens:String(o),removed_tool_calls:String(n)};wbt.record(s,a)}function TZ(t,e,r,n){if(!Tbt||!Zl)return;let o={...pa(t),executed:String(e),triggered_by:r,had_lightweight_before:String(n)};Tbt.record(1,o)}function pBe(t,e,r,n,o){if(!Ibt||!Zl)return;let s=e-r,a=e>0?s/e:0,c={...pa(t),original_tokens:String(e),compressed_tokens:String(r),reduced_tokens:String(s),had_lightweight_before:String(n),recovered_files_count:String(o)};Ibt.record(a,c)}function hBe(t,e,r,n,o){if(!Dbt||!Zl)return;let s={...pa(t),function_name:e,risk_level:r};if(n&&(s.rule_name=n),o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let c=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=c}}Dbt.record(1,s)}function mBe(t,e,r,n,o){if(!Rbt||!Zl)return;let s={...pa(t),function_name:e,action:r,risk_level:n};if(o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let c=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=c}}Rbt.record(1,s)}function gBe(t,e,r,n,o,s){if(!kbt||!Zl)return;let a={...pa(t),function_name:e,decision:r,review_layer:o,latency_ms:String(n)};if(s&&typeof s=="object"){let c=s;if((c.command||c.cmd)&&(a.command=String(c.command||c.cmd).substring(0,200)),(c.file_path||c.absolute_path||c.path)&&(a.file_path=String(c.file_path||c.absolute_path||c.path).substring(0,200)),c.url||c.prompt){let u=String(c.url||c.prompt).substring(0,200);a.url_or_prompt=u}}kbt.record(1,a)}function ABe(t,e,r,n,o){if(!Nbt||!Zl)return;let s={...pa(t),function_name:e,action:r,review_layer:n};if(o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let c=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=c}}Nbt.record(1,s)}var dS,rbt,nbt,ibt,obt,sbt,abt,cbt,zme,Yme,lbt,ubt,dbt,fbt,pbt,hbt,mbt,gbt,Abt,ybt,_bt,Ebt,vbt,bbt,Cbt,Sbt,xbt,wbt,Tbt,Ibt,Dbt,Rbt,kbt,Nbt,Zl,Ng=q(()=>{"use strict";ir();pZ();AQr();tbt();(function(t){t.CREATE="create",t.READ="read",t.UPDATE="update"})(dS||(dS={}));Zl=!1});var io,on,oo,so,eu=q(()=>{"use strict";io=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,o,s,a,c=!0,u=!1,d=[]){this.name=e,this.displayName=r,this.description=n,this.icon=o,this.kind=s,this.parameterSchema=a,this.isOutputMarkdown=c,this.canUpdateOutput=u,this.aliases=d}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(e){return null}getDescription(e){return JSON.stringify(e)}shouldConfirmExecute(e,r){return Promise.resolve(!1)}toolLocations(e){return[]}};(function(t){t.ProceedOnce="proceed_once",t.ProceedAlways="proceed_always",t.ProceedAlwaysServer="proceed_always_server",t.ProceedAlwaysTool="proceed_always_tool",t.ModifyWithEditor="modify_with_editor",t.Cancel="cancel"})(on||(on={}));(function(t){t.FileSearch="fileSearch",t.Folder="folder",t.Globe="globe",t.Hammer="hammer",t.LightBulb="lightBulb",t.Pencil="pencil",t.Regex="regex",t.Terminal="terminal"})(oo||(oo={}));(function(t){t.Read="read",t.Edit="edit",t.Delete="delete",t.Move="move",t.Search="search",t.Execute="execute",t.Think="think",t.Fetch="fetch",t.Other="other"})(so||(so={}))});function u_o(t){switch(t){case on.ProceedOnce:case on.ProceedAlways:case on.ProceedAlwaysServer:case on.ProceedAlwaysTool:return Kme.ACCEPT;case on.ModifyWithEditor:return Kme.MODIFY;case on.Cancel:default:return Kme.REJECT}}var Kme,IZ,DZ,RZ,kZ,NZ,S2,OZ,BZ,Kv,PZ,yBe,uO,_Be,nj=q(()=>{"use strict";eu();hE();(function(t){t.ACCEPT="accept",t.REJECT="reject",t.MODIFY="modify"})(Kme||(Kme={}));IZ=class{"event.name";"event.timestamp";model;embedding_model;sandbox_enabled;core_tools_enabled;approval_mode;api_key_enabled;vertex_ai_enabled;debug_enabled;mcp_servers;telemetry_enabled;telemetry_log_user_prompts_enabled;file_filtering_respect_git_ignore;constructor(e){let r=e.getContentGeneratorConfig(),n=e.getMcpServers(),o=!1,s=!1;r&&r.authType&&(o=r.authType===Jt.IFLOW,s=r.authType===Jt.AONE),this["event.name"]="cli_config",this.model=e.getModel(),this.embedding_model=e.getEmbeddingModel(),this.sandbox_enabled=typeof e.getSandbox()=="string"||!!e.getSandbox(),this.core_tools_enabled=(e.getCoreTools()??[]).join(","),this.approval_mode=e.getApprovalMode(),this.api_key_enabled=o||s,this.vertex_ai_enabled=s,this.debug_enabled=e.getDebugMode(),this.mcp_servers=n?Object.keys(n).join(","):"",this.telemetry_enabled=e.getTelemetryEnabled(),this.telemetry_log_user_prompts_enabled=e.getTelemetryLogPromptsEnabled(),this.file_filtering_respect_git_ignore=e.getFileFilteringRespectGitIgnore()}},DZ=class{"event.name";"event.timestamp";session_id;constructor(e){this["event.name"]="end_session",this["event.timestamp"]=new Date().toISOString(),this.session_id=e?.getSessionId()}},RZ=class{"event.name";"event.timestamp";prompt_length;prompt_id;auth_type;prompt;constructor(e,r,n,o){this["event.name"]="user_prompt",this["event.timestamp"]=new Date().toISOString(),this.prompt_length=e,this.prompt_id=r,this.auth_type=n,this.prompt=o}},kZ=class{"event.name";"event.timestamp";function_name;function_args;duration_ms;success;decision;error;error_type;prompt_id;server_name;response_text;constructor(e){this["event.name"]="tool_call",this["event.timestamp"]=new Date().toISOString(),this.function_name=e.request.name,this.function_args=JSON.stringify(e.request.args),this.duration_ms=e.durationMs??0,this.success=e.status==="success",this.decision=e.outcome?u_o(e.outcome):void 0,this.error=e.response.error?.message,this.error_type=e.response.errorType,this.prompt_id=e.request.prompt_id,this.response_text=JSON.stringify(e.response,null,2),"tool"in e&&e.tool&&"serverName"in e.tool&&(this.server_name=e.tool.serverName)}},NZ=class{"event.name";"event.timestamp";model;prompt_id;request_text;base_url;openai_request;constructor(e,r,n,o,s){this["event.name"]="api_request",this["event.timestamp"]=new Date().toISOString(),this.model=r,this.prompt_id=o,this.request_text=s,this.base_url=e,this.openai_request=n}},S2=class{"event.name";"event.timestamp";model;error;error_type;status_code;http_status_code;business_code;duration_ms;prompt_id;auth_type;constructor(e,r,n,o,s,a,c,u,d){this["event.name"]="api_error",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.error=r,this.error_type=a,this.status_code=c,this.http_status_code=u,this.business_code=d,this.duration_ms=n,this.prompt_id=o,this.auth_type=s}},OZ=class{"event.name";"event.timestamp";model;status_code;http_status_code;business_code;duration_ms;error;input_token_count;output_token_count;cached_content_token_count;thoughts_token_count;tool_token_count;total_token_count;response_text;prompt_id;auth_type;finish_reason;constructor(e,r,n,o,s,a,c,u,d,f){this["event.name"]="api_response",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.duration_ms=r,this.status_code=200,this.http_status_code=d||200,this.business_code=f,this.input_token_count=s?.promptTokenCount??0,this.output_token_count=s?.candidatesTokenCount??0,this.cached_content_token_count=s?.cachedContentTokenCount??0,this.thoughts_token_count=s?.thoughtsTokenCount??0,this.tool_token_count=s?.toolUsePromptTokenCount??0,this.total_token_count=s?.totalTokenCount??0,this.response_text=a,this.error=c,this.prompt_id=n,this.auth_type=o,this.finish_reason=u}},BZ=class{"event.name";"event.timestamp";auth_type;constructor(e){this["event.name"]="flash_fallback",this["event.timestamp"]=new Date().toISOString(),this.auth_type=e}};(function(t){t.CONSECUTIVE_IDENTICAL_TOOL_CALLS="consecutive_identical_tool_calls",t.CHANTING_IDENTICAL_SENTENCES="chanting_identical_sentences",t.LLM_DETECTED_LOOP="llm_detected_loop"})(Kv||(Kv={}));PZ=class{"event.name";"event.timestamp";loop_type;prompt_id;constructor(e,r){this["event.name"]="loop_detected",this["event.timestamp"]=new Date().toISOString(),this.loop_type=e,this.prompt_id=r}},yBe=class{"event.name";"event.timestamp";prompt_id;finish_reason;result;constructor(e,r,n){this["event.name"]="next_speaker_check",this["event.timestamp"]=new Date().toISOString(),this.prompt_id=e,this.finish_reason=r,this.result=n}},uO=class{"event.name";"event.timestamp";command;subcommand;constructor(e,r){this["event.name"]="slash_command",this["event.timestamp"]=new Date().toISOString(),this.command=e,this.subcommand=r}},_Be=class{"event.name";"event.timestamp";model;constructor(e){this["event.name"]="malformed_json_response",this["event.timestamp"]=new Date().toISOString(),this.model=e}}});var ci,kQr=q(()=>{"use strict";(function(t){t[t.IFLOW_CLI_KEY_UNKNOWN=0]="IFLOW_CLI_KEY_UNKNOWN",t[t.IFLOW_CLI_START_SESSION_MODEL=1]="IFLOW_CLI_START_SESSION_MODEL",t[t.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL=2]="IFLOW_CLI_START_SESSION_EMBEDDING_MODEL",t[t.IFLOW_CLI_START_SESSION_SANDBOX=3]="IFLOW_CLI_START_SESSION_SANDBOX",t[t.IFLOW_CLI_START_SESSION_CORE_TOOLS=4]="IFLOW_CLI_START_SESSION_CORE_TOOLS",t[t.IFLOW_CLI_START_SESSION_APPROVAL_MODE=5]="IFLOW_CLI_START_SESSION_APPROVAL_MODE",t[t.IFLOW_CLI_START_SESSION_API_KEY_ENABLED=6]="IFLOW_CLI_START_SESSION_API_KEY_ENABLED",t[t.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED=7]="IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED",t[t.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED=8]="IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED",t[t.IFLOW_CLI_START_SESSION_MCP_SERVERS=9]="IFLOW_CLI_START_SESSION_MCP_SERVERS",t[t.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED=10]="IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED",t[t.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED=11]="IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED",t[t.IFLOW_CLI_START_SESSION_RESPECT_GITIGNORE=12]="IFLOW_CLI_START_SESSION_RESPECT_GITIGNORE",t[t.IFLOW_CLI_USER_PROMPT_LENGTH=13]="IFLOW_CLI_USER_PROMPT_LENGTH",t[t.IFLOW_CLI_TOOL_CALL_NAME=14]="IFLOW_CLI_TOOL_CALL_NAME",t[t.IFLOW_CLI_TOOL_CALL_DECISION=15]="IFLOW_CLI_TOOL_CALL_DECISION",t[t.IFLOW_CLI_TOOL_CALL_SUCCESS=16]="IFLOW_CLI_TOOL_CALL_SUCCESS",t[t.IFLOW_CLI_TOOL_CALL_DURATION_MS=17]="IFLOW_CLI_TOOL_CALL_DURATION_MS",t[t.IFLOW_CLI_TOOL_ERROR_MESSAGE=18]="IFLOW_CLI_TOOL_ERROR_MESSAGE",t[t.IFLOW_CLI_TOOL_CALL_ERROR_TYPE=19]="IFLOW_CLI_TOOL_CALL_ERROR_TYPE",t[t.IFLOW_CLI_API_REQUEST_MODEL=20]="IFLOW_CLI_API_REQUEST_MODEL",t[t.IFLOW_CLI_API_RESPONSE_MODEL=21]="IFLOW_CLI_API_RESPONSE_MODEL",t[t.IFLOW_CLI_API_RESPONSE_STATUS_CODE=22]="IFLOW_CLI_API_RESPONSE_STATUS_CODE",t[t.IFLOW_CLI_API_RESPONSE_DURATION_MS=23]="IFLOW_CLI_API_RESPONSE_DURATION_MS",t[t.IFLOW_CLI_API_ERROR_MESSAGE=24]="IFLOW_CLI_API_ERROR_MESSAGE",t[t.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT=25]="IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT=26]="IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT=27]="IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT=28]="IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT=29]="IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT",t[t.IFLOW_CLI_API_ERROR_MODEL=30]="IFLOW_CLI_API_ERROR_MODEL",t[t.IFLOW_CLI_API_ERROR_TYPE=31]="IFLOW_CLI_API_ERROR_TYPE",t[t.IFLOW_CLI_API_ERROR_STATUS_CODE=32]="IFLOW_CLI_API_ERROR_STATUS_CODE",t[t.IFLOW_CLI_API_ERROR_DURATION_MS=33]="IFLOW_CLI_API_ERROR_DURATION_MS",t[t.IFLOW_CLI_END_SESSION_ID=34]="IFLOW_CLI_END_SESSION_ID",t[t.IFLOW_CLI_PROMPT_ID=35]="IFLOW_CLI_PROMPT_ID",t[t.IFLOW_CLI_AUTH_TYPE=36]="IFLOW_CLI_AUTH_TYPE",t[t.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT=37]="IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT",t[t.IFLOW_CLI_SURFACE=39]="IFLOW_CLI_SURFACE",t[t.IFLOW_CLI_SESSION_ID=40]="IFLOW_CLI_SESSION_ID",t[t.IFLOW_CLI_LOOP_DETECTED_TYPE=38]="IFLOW_CLI_LOOP_DETECTED_TYPE",t[t.IFLOW_CLI_SLASH_COMMAND_NAME=41]="IFLOW_CLI_SLASH_COMMAND_NAME",t[t.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND=42]="IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND",t[t.IFLOW_CLI_RESPONSE_FINISH_REASON=43]="IFLOW_CLI_RESPONSE_FINISH_REASON",t[t.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT=44]="IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT",t[t.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL=45]="IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL",t[t.IFLOW_CLI_RESPONSE_TYPE=46]="IFLOW_CLI_RESPONSE_TYPE",t[t.IFLOW_CLI_RESPONSE_LENGTH=47]="IFLOW_CLI_RESPONSE_LENGTH",t[t.IFLOW_CLI_RESPONSE_SUCCESS=48]="IFLOW_CLI_RESPONSE_SUCCESS",t[t.IFLOW_CLI_ERROR_MESSAGE=49]="IFLOW_CLI_ERROR_MESSAGE"})(ci||(ci={}))});function ij(t,e){let r=new WeakSet;return JSON.stringify(t,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular]";r.add(o)}return o},e)}var EBe=q(()=>{"use strict";});import Uw,{dirname as d_o,join as Pbt}from"node:path";import vBe from"os";import*as NQr from"crypto";import{fileURLToPath as f_o}from"node:url";import p_o from"node:fs";import{execSync as h_o}from"node:child_process";function Qw(t){let e=vBe.homedir();return t.startsWith(e)?t.replace(e,"~"):t}function ca(t,e=35){if(t.length<=e)return t;let n=Uw.parse(t).root,o=Uw.sep,a=t.substring(n.length).split(o).filter(m=>m!=="");if(a.length<=1){let m=Math.floor((e-3)/2);if(m<=0)return t.substring(0,e-3)+"...";let g=t.substring(0,m),A=t.substring(t.length-m);return`${g}...${A}`}let c=a[0],u=a[a.length-1],d=n+c,f=[],p=o.length+u.length;for(let m=a.length-2;m>=0;m--){let g=a[m],A=p+o.length+g.length;if(A<=e)f.unshift(g),p=A;else break}let h=f.join(o)+o+u;return p>e?h:(h=d+o+h,h.length>e?"..."+h.substring(h.length-e-3):h)}function ul(t,e){let r=Uw.resolve(t),n=Uw.resolve(e);return Uw.relative(n,r)||"."}function MZ(t){let e="";for(let r=0;r<t.length;r++)t[r]===" "&&(r===0||t[r-1]!=="\\")?e+="\\ ":e+=t[r];return e}function tI(t){return process.platform==="win32"?t.replace(/\\([ ,;!?()[\]{}])/g,"$1"):t.replace(/\\(.)/g,"$1")}function bBe(t){return NQr.createHash("sha256").update(t).digest("hex")}function s3(t){let e=bBe(t);return Uw.join(vBe.homedir(),Og,m_o,e)}function CBe(){return Uw.join(vBe.homedir(),Og,OQr)}function SBe(t){return Uw.join(t,Og,OQr)}function xBe(){if(process.env.USE_BUILTIN_RIPGREP==="0")return"rg";let t=d_o(f_o(import.meta.url)),e=[Pbt(t,"..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),Pbt(t,"..","..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),Pbt(t,"..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`)];for(let r of e)try{if(p_o.existsSync(r))return process.platform==="darwin"&&BQr(r),r}catch{}return e[0]}function BQr(t){if(process.platform==="darwin")try{let e=["com.apple.quarantine","CachedFileMimeType","CachedFileType","FileXRayCachedResultInEA"];for(let r of e)try{h_o(`xattr -d "${r}" "${t}" 2>/dev/null`,{stdio:"ignore"})}catch{}}catch{}}function oj(t,e){let n=vBe.platform()==="win32"?Uw.win32:Uw,o=n.relative(t,e);return!o.startsWith(`..${n.sep}`)&&o!==".."&&!n.isAbsolute(o)}var Og,Mbt,m_o,OQr,vu=q(()=>{"use strict";Og=".iflow",Mbt="google_accounts.json",m_o="tmp",OQr="commands"});import g_o from"node:path";import{promises as jec,existsSync as PQr,readFileSync as MQr}from"node:fs";import*as FQr from"os";function LQr(){return g_o.join(FQr.homedir(),Og,Mbt)}function UQr(){try{let t=LQr();if(PQr(t)){let e=MQr(t,"utf-8").trim();return e?JSON.parse(e).active:null}return null}catch(t){return console.debug("Error reading cached Google Account:",t),null}}function QQr(){try{let t=LQr();if(!PQr(t))return 0;let e=MQr(t,"utf-8").trim();if(!e)return 0;let r=JSON.parse(e);if(!r||typeof r!="object")return 0;let n=r,o=n.old&&Array.isArray(n.old)?n.old.length:0;return n.active&&o++,o}catch(t){return console.debug("Error reading lifetime Google Accounts:",t),0}}var jQr=q(()=>{"use strict";vu();});import*as $Qr from"os";import*as rI from"fs";import*as Ubt from"path";import{randomUUID as A_o}from"crypto";function __o(){rI.existsSync(Fbt)||rI.mkdirSync(Fbt,{recursive:!0})}function E_o(){return rI.existsSync(Lbt)&&rI.readFileSync(Lbt,"utf-8").trim()||null}function v_o(t){rI.writeFileSync(Lbt,t,"utf-8")}function wBe(){try{__o();let t=E_o();return t||(t=A_o(),v_o(t)),t}catch(t){return console.error("Error accessing installation ID file, generating ephemeral ID:",t),"123456789"}}var y_o,Fbt,Lbt,Qbt=q(()=>{"use strict";vu();y_o=$Qr.homedir()??"",Fbt=Ubt.join(y_o,Og),Lbt=Ubt.join(Fbt,"installation_id")});var GQr,b_o,C_o,S_o,x_o,w_o,T_o,I_o,D_o,R_o,k_o,N_o,O_o,B_o,Im,Xme=q(()=>{"use strict";GQr=we(opt(),1);nj();kQr();EBe();jQr();Qbt();b_o="start_session",C_o="new_prompt",S_o="tool_call",x_o="api_request",w_o="api_response",T_o="api_error",I_o="end_session",D_o="flash_fallback",R_o="loop_detected",k_o="next_speaker_check",N_o="slash_command",O_o="malformed_json_response",B_o="cli_response",Im=class t{static instance;config;events=[];last_flush_time=Date.now();flush_interval_ms=1e3*60;constructor(e){this.config=e}static getInstance(e){if(!(e===void 0||!e?.getUsageStatisticsEnabled()))return t.instance||(t.instance=new t(e)),t.instance}enqueueLogEvent(e){this.events.push([{event_time_ms:Date.now(),source_extension_json:ij(e)}])}createLogEvent(e,r){let n=UQr(),o=QQr();r.push({iflow_cli_key:ci.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT,value:o.toString()});let s={console_type:"IFLOW_CLI",application:102,event_name:e,event_metadata:[r]};return n?s.client_email=n:s.client_install_id=wBe(),s}flushIfNeeded(){Date.now()-this.last_flush_time<this.flush_interval_ms||this.flushToClearcut().catch(e=>{console.debug("Error flushing to Clearcut:",e)})}async flushToClearcut(){return this.config?.getDebugMode()&&console.log("Telemetry disabled - not sending log events to Clearcut."),this.events.length=0,this.last_flush_time=Date.now(),Promise.resolve({})}decodeLogResponse(e){if(e.length<1||e.readUInt8(0)!==8)return;let r=BigInt(0),n=!0;for(let s=1;n&&s<e.length;s++){let a=e.readUInt8(s);r|=BigInt(a&127)<<BigInt(7*(s-1)),n=(a&128)!==0}return n?void 0:{nextRequestWaitMs:Number(r)}}handleLogEvent(e,r,n=!1){this.enqueueLogEvent(this.createLogEvent(e,r)),n?this.flushToClearcut().catch(o=>{console.debug("Error flushing to Clearcut:",o)}):this.flushIfNeeded()}logStartSessionEvent(e){let r=process.env.SURFACE||"SURFACE_NOT_SET",n=[{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_MODEL,value:e.model},{iflow_cli_key:ci.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL,value:e.embedding_model},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_SANDBOX,value:e.sandbox_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_CORE_TOOLS,value:e.core_tools_enabled},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_APPROVAL_MODE,value:e.approval_mode},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_API_KEY_ENABLED,value:e.api_key_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED,value:e.debug_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_MCP_SERVERS,value:e.mcp_servers},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED,value:e.telemetry_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED,value:e.telemetry_log_user_prompts_enabled.toString()},{iflow_cli_key:ci.IFLOW_CLI_SURFACE,value:r}];this.handleLogEvent(b_o,n,!0)}logNewPromptEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_USER_PROMPT_LENGTH,value:JSON.stringify(e.prompt_length)},{iflow_cli_key:ci.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:ci.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(C_o,r)}logToolCallEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_TOOL_CALL_NAME,value:JSON.stringify(e.function_name)},{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:ci.IFLOW_CLI_TOOL_CALL_DECISION,value:JSON.stringify(e.decision)},{iflow_cli_key:ci.IFLOW_CLI_TOOL_CALL_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:ci.IFLOW_CLI_TOOL_CALL_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:ci.IFLOW_CLI_TOOL_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:ci.IFLOW_CLI_TOOL_CALL_ERROR_TYPE,value:JSON.stringify(e.error_type)}];this.handleLogEvent(S_o,r)}logApiRequestEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_API_REQUEST_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)}];this.handleLogEvent(x_o,r)}logApiResponseEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:ci.IFLOW_CLI_API_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT,value:JSON.stringify(e.input_token_count)},{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT,value:JSON.stringify(e.output_token_count)},{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT,value:JSON.stringify(e.cached_content_token_count)},{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT,value:JSON.stringify(e.thoughts_token_count)},{iflow_cli_key:ci.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT,value:JSON.stringify(e.tool_token_count)},{iflow_cli_key:ci.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(w_o,r)}logApiErrorEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_API_ERROR_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:ci.IFLOW_CLI_API_ERROR_TYPE,value:JSON.stringify(e.error_type)},{iflow_cli_key:ci.IFLOW_CLI_API_ERROR_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:ci.IFLOW_CLI_API_ERROR_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:ci.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(T_o,r)}logFlashFallbackEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)},{iflow_cli_key:ci.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.handleLogEvent(D_o,r,!0)}logLoopDetectedEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:ci.IFLOW_CLI_LOOP_DETECTED_TYPE,value:JSON.stringify(e.loop_type)}];this.handleLogEvent(R_o,r)}logNextSpeakerCheck(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:ci.IFLOW_CLI_RESPONSE_FINISH_REASON,value:JSON.stringify(e.finish_reason)},{iflow_cli_key:ci.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT,value:JSON.stringify(e.result)},{iflow_cli_key:ci.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.handleLogEvent(k_o,r)}logSlashCommandEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_SLASH_COMMAND_NAME,value:JSON.stringify(e.command)}];e.subcommand&&r.push({iflow_cli_key:ci.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND,value:JSON.stringify(e.subcommand)}),this.handleLogEvent(N_o,r)}logMalformedJsonResponseEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL,value:JSON.stringify(e.model)}];this.handleLogEvent(O_o,r)}logCliResponseEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:ci.IFLOW_CLI_RESPONSE_TYPE,value:JSON.stringify(e.response_type)},{iflow_cli_key:ci.IFLOW_CLI_RESPONSE_LENGTH,value:JSON.stringify(e.response_length)},{iflow_cli_key:ci.IFLOW_CLI_RESPONSE_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:ci.IFLOW_CLI_ERROR_MESSAGE,value:JSON.stringify(e.error)}];this.handleLogEvent(B_o,r)}logEndSessionEvent(e){let r=[{iflow_cli_key:ci.IFLOW_CLI_SESSION_ID,value:e?.session_id?.toString()??""}];this.handleLogEvent(I_o,r,!0)}getProxyAgent(){let e=this.config?.getProxy();if(e){if(e.startsWith("http"))return new GQr.HttpsProxyAgent(e);throw new Error("Unsupported proxy type")}}shutdown(){let e=new DZ(this.config);this.logEndSessionEvent(e)}}});import*as qQr from"node:fs";var sj,HQr,Jme,TBe,IBe,DBe,VQr=q(()=>{"use strict";sj=we(yi(),1),HQr=we(Zx(),1);Jme=class{writeStream;constructor(e){this.writeStream=qQr.createWriteStream(e,{flags:"a"})}serialize(e){let r=new WeakSet;return JSON.stringify(e,(o,s)=>{if(typeof s=="object"&&s!==null){if(r.has(s))return"[Circular]";r.add(s)}return s},2)+`
486
486
  `}shutdown(){return new Promise(e=>{this.writeStream.end(e)})}},TBe=class extends Jme{export(e,r){let n=e.map(o=>this.serialize(o)).join("");this.writeStream.write(n,o=>{r({code:o?sj.ExportResultCode.FAILED:sj.ExportResultCode.SUCCESS,error:o||void 0})})}},IBe=class extends Jme{export(e,r){let n=e.map(o=>this.serialize(o)).join("");this.writeStream.write(n,o=>{r({code:o?sj.ExportResultCode.FAILED:sj.ExportResultCode.SUCCESS,error:o||void 0})})}},DBe=class extends Jme{export(e,r){let n=this.serialize(e);this.writeStream.write(n,o=>{r({code:o?sj.ExportResultCode.FAILED:sj.ExportResultCode.SUCCESS,error:o||void 0})})}getPreferredAggregationTemporality(){return HQr.AggregationTemporality.CUMULATIVE}async forceFlush(){return Promise.resolve()}}});var ZQr={};ls(ZQr,{flushTelemetry:()=>jbt,initializeTelemetry:()=>Zme,isTelemetrySdkInitialized:()=>J0,shutdownTelemetry:()=>aj});function J0(){return FZ}function P_o(t){if(!t)return;let e=t.replace(/^["']|["']$/g,"");try{let r=new URL(e),o=r.port==="4318"||r.protocol==="http:"||r.protocol==="https:"?"http":"grpc";return{url:o==="grpc"?r.origin:e,protocol:o}}catch(r){lp.error("Invalid OTLP endpoint URL provided:",e,r);return}}function Zme(t){if(FZ)return;let e=(0,kBe.defaultResource)().merge((0,kBe.resourceFromAttributes)({[Cgt]:Lh,[Sgt]:process.version,"session.id":t.getSessionId()})),r=t.getTelemetryOtlpEndpoint(),n=P_o(r),o=!!n,s=t.getTelemetryOutfile(),a=[];o&&a.push(new WQr.OTLPTraceExporter({url:`${n.url}/v1/traces`})),s&&a.push(new TBe(s));let c=[];o&&n&&c.push(new YQr.OTLPLogExporter({url:`${n.url}/v1/logs`})),s&&c.push(new IBe(s));let u=[];o&&u.push(new mNe({exporter:new zQr.OTLPMetricExporter({url:`${n.url}/v1/metrics`,temporalityPreference:NBe.AggregationTemporality.DELTA}),exportIntervalMillis:2e4})),s&&u.push(new NBe.PeriodicExportingMetricReader({exporter:new DBe(s),exportIntervalMillis:1e4}));let d={resource:e,serviceName:Lh,logRecordProcessors:[],spanProcessors:[],metricReaders:[]};a.forEach(f=>{d.spanProcessors.push(new XQr.BatchSpanProcessor(f,{exportTimeoutMillis:1e4}))}),c.forEach(f=>{d.logRecordProcessors.push(new JQr.BatchLogRecordProcessor(f,{exportTimeoutMillis:1e4}))}),u.forEach(f=>{d.metricReaders.push(f)}),RBe=new KQr.NodeSDK({...d});try{RBe.start(),FZ=!0,vQr()}catch(f){console.error("Error starting OpenTelemetry SDK:",f)}process.on("SIGTERM",aj),process.on("SIGINT",aj)}async function jbt(){if(FZ)try{let{trace:t}=await Promise.resolve().then(()=>(ir(),hr)),e=t.getTracerProvider();"forceFlush"in e&&await e.forceFlush();let{metrics:r}=await Promise.resolve().then(()=>(ir(),hr)),n=r.getMeterProvider();"forceFlush"in n&&await n.forceFlush()}catch(t){process.env.DEBUG&&console.error("Error flushing telemetry:",t)}}async function aj(){if(!(!FZ||!RBe))try{Im.getInstance()?.shutdown(),await RBe.shutdown()}catch(t){console.error("Error shutting down SDK:",t)}finally{FZ=!1}}var WQr,zQr,YQr,KQr,kBe,XQr,JQr,NBe,RBe,FZ,ege=q(()=>{"use strict";ir();WQr=we(OAt(),1),zQr=we(UAt(),1),YQr=we(jAt(),1),KQr=we(hMr(),1);gMr();xm();kBe=we(mvt(),1),XQr=we(qIe(),1),JQr=we(TUr(),1),NBe=we(Zx(),1);pZ();Ng();Xme();VQr();process.env.DEBUG?lp.setLogger(new Cpe,Nh.DEBUG):lp.setLogger(new Cpe,Nh.NONE);FZ=!1});var ejr={};ls(ejr,{TraceContext:()=>fS});var fS,OBe=q(()=>{"use strict";ir();ege();fS=class{static rootSpan=null;static tracer=Ms.getTracer("iflow-cli-tracer");static spanLock=null;static startRootSpan(e="iflow_cli_request",r=!1){return this.rootSpan&&r&&(this.rootSpan.end(),this.rootSpan=null),this.rootSpan||(this.rootSpan=this.tracer.startSpan(e)),this.rootSpan}static async withRootSpan(e,r){let n=r?this.startRootSpan(r):this.getRootSpan();return n?H0.with(Ms.setSpan(H0.active(),n),async()=>{try{return await e()}catch(o){throw n.recordException(o),n.setStatus({code:Tv.ERROR,message:o.message}),o}}):e()}static startChildSpan(e){return this.tracer.startSpan(e,void 0,H0.active())}static async withChildSpan(e,r,n){let o=this.startChildSpan(e);return n&&o.setAttributes(n),H0.with(Ms.setSpan(H0.active(),o),async()=>{try{let s=await r();return o.setStatus({code:Tv.OK}),s}catch(s){throw o.recordException(s),o.setStatus({code:Tv.ERROR,message:s.message}),s}finally{o.end()}})}static getRootSpan(){return this.rootSpan}static async endRootSpan(){this.spanLock&&await this.spanLock,this.spanLock=(async()=>{if(this.rootSpan){let e=this.rootSpan;this.rootSpan=null,e.end();try{await jbt()}catch{}}})(),await this.spanLock,this.spanLock=null}static getActiveSpan(){return Ms.getActiveSpan()}static setSpanAttributes(e){let r=this.getActiveSpan();r&&r.setAttributes(e)}static addSpanEvent(e,r){let n=this.getActiveSpan();n&&n.addEvent(e,r)}}});function tge(){let t=Ms.getActiveSpan();if(t){let r=t.spanContext();if(r&&r.traceId&&r.spanId){let o=r.traceId,s=r.spanId,a=(r.traceFlags||0).toString(16).padStart(2,"0");return`00-${o}-${s}-${a}`}}return dO.getCurrentSession()?.traceparent}function rge(t){let e=tge();return e?{...t,traceparent:e}:t}function $bt(){return tge()}async function a3(t,e,r){let n=Ms.getTracer("iflow-cli"),{TraceContext:o}=await Promise.resolve().then(()=>(OBe(),ejr)),s=o.getRootSpan(),a;if(s){let c=Ms.setSpan(H0.active(),s);a=H0.with(c,()=>n.startSpan(t,{attributes:e}))}else a=n.startSpan(t,{attributes:e});try{return await H0.with(Ms.setSpan(H0.active(),a),r)}catch(c){throw a.recordException(c),a.setStatus({code:Tv.ERROR,message:c instanceof Error?c.message:"Unknown error"}),c}finally{a.end()}}var Xv=q(()=>{"use strict";ir();BBe();});import{release as M_o,version as F_o}from"os";var PBe,dO,BBe=q(()=>{"use strict";Qmt();jmt();Xv();PBe=class{currentSession=null;async startSession(e,r,n,o){let{model:s,tool:a}=o||{},c="iflow",u="cli",d=tge()||"",f="";d&&(f=d.split("-")[1]??"");let p=iX(),h=f?`${c}.${u}.${n}.${f}`:"",m=Date.now();return this.currentSession={traceId:f,parent_observation_id:p,conversationId:n,sessionId:e,userId:r,pid:c,sceneId:u,sam:h,traceparent:d,startTime:m,model:s,tool:a},await ype("/aitrack.lifecycle.run_started",{gmkey:"AI",gokey:{pid:c,sam:h,trace_id:f,session_id:e,conversation_id:n,observation_id:p,model:s,tool:a,user_id:r}}),this.currentSession}async endSession(){if(!this.currentSession)return;let{pid:e,sam:r,traceId:n,parent_observation_id:o,model:s,tool:a,sessionId:c,conversationId:u,userId:d,startTime:f}=this.currentSession,p=Date.now()-f,h=iX();await ype("/aitrack.lifecycle.run_finished",{gmkey:"AI",gokey:{pid:e,sam:r,trace_id:n,session_id:c,conversation_id:u,observation_id:h,parent_observation_id:o,duration:p,model:s,tool:a,sessionId:c,user_id:d}})}async recordError(e,r){if(!this.currentSession)throw new Error("No active session to record error");let{pid:n,sam:o,traceId:s,parent_observation_id:a,model:c,tool:u,sessionId:d,conversationId:f,userId:p}=this.currentSession,h=iX(),m="",g="";e instanceof Error?(m=e.cause?`${e.message}:${e.cause.message}`:e.message,g=e.cause?e.cause.stack||"":e.stack||""):m=String(e);let A={gmkey:"AI",gokey:{pid:n,sam:o,trace_id:s,observation_id:h,parent_observation_id:a,session_id:d,conversation_id:f,user_id:p,error_msg:`${m}
487
- ${g.slice(0,2e4)}`,model:c,tool:u,toolName:r?.toolName,toolArgs:r?.toolArgs?JSON.stringify(r.toolArgs):void 0,cliVer:"0.4.9",platform:process.platform,arch:process.arch,nodeVersion:process.version,osVersion:process.platform==="darwin"?M_o():F_o()}};await ype("/aitrack.lifecycle.run_error",A)}getCurrentSession(){return this.currentSession}},dO=new PBe});var tjr=I((Atc,L_o)=>{L_o.exports={name:"systeminformation",version:"5.27.11",description:"Advanced, lightweight system and OS information library",license:"MIT",author:"Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",homepage:"https://systeminformation.io",main:"./lib/index.js",type:"commonjs",bin:{systeminformation:"lib/cli.js"},types:"./lib/index.d.ts",scripts:{test:"node ./test/test.js",testDeno:"deno run -A ./test/test.js"},files:["lib/"],keywords:["system information","sysinfo","monitor","monitoring","os","linux","osx","windows","freebsd","openbsd","netbsd","cpu","cpuload","physical cores","logical cores","processor","cores","threads","socket type","memory","file system","fsstats","diskio","block devices","netstats","network","network interfaces","network connections","network stats","iface","printer","processes","users","internet","battery","docker","docker stats","docker processes","graphics","graphic card","graphic controller","gpu","display","smart","disk layout","usb","audio","bluetooth","wifi","wifinetworks","virtual box","virtualbox","vm","backend","hardware","BIOS","chassis"],repository:{type:"git",url:"git+https://github.com/sebhildebrandt/systeminformation.git"},funding:{type:"Buy me a coffee",url:"https://www.buymeacoffee.com/systeminfo"},os:["darwin","linux","win32","freebsd","openbsd","netbsd","sunos","android"],engines:{node:">=8.0.0"}}});var Uh=I(ji=>{"use strict";var UZ=_e("os"),mS=_e("fs"),U_o=_e("path"),Ybt=_e("child_process").spawn,Q_o=_e("child_process").exec,QZ=_e("child_process").execSync,j_o=_e("util"),lj=process.platform,Kbt=lj==="linux"||lj==="android",ijr=lj==="darwin",UBe=lj==="win32",ojr=lj==="freebsd",sjr=lj==="openbsd",ajr=lj==="netbsd",Gbt=0,cj="",pS="",fO=null,hS=null,Xbt=process.env.WINDIR||"C:\\Windows",Dm,LZ="",nge=[],Jbt=!1,FBe="",$_o="$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ",Hbt="--###START###--",rjr="--ERROR--",LBe="--###ENDCMD###--",Vbt="--##ID##--",ige={windowsHide:!0,maxBuffer:1024*2e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})},QBe={maxBuffer:1024*2e4,encoding:"UTF-8",stdio:["pipe","pipe","ignore"]};function G_o(t){let e=parseInt(t,10);return isNaN(e)&&(e=0),e}function q_o(t){let e=!1,r="",n="";for(let o of t)o>="0"&&o<="9"||e?(e=!0,r+=o):n+=o;return[n,r]}var MBe=new String,Wbt=new String().replace,zbt=new String().toLowerCase,cjr=new String().toString,ljr=new String().substr,ujr=new String().substring,djr=new String().trim,fjr=new String().startsWith,pjr=Math.min;function H_o(t){return t&&{}.toString.call(t)==="[object Function]"}function V_o(t){let e=[],r={};for(let n=0;n<t.length;n++){let o=Object.keys(t[n]);o.sort(function(a,c){return a-c});let s="";for(let a=0;a<o.length;a++)s+=JSON.stringify(o[a]),s+=JSON.stringify(t[n][o[a]]);({}).hasOwnProperty.call(r,s)||(e.push(t[n]),r[s]=!0)}return e}function W_o(t,e){return t.sort(function(r,n){let o="",s="";return e.forEach(function(a){o=o+r[a],s=s+n[a]}),o<s?-1:o>s?1:0})}function z_o(){return Gbt===0&&(Gbt=UZ.cpus().length),Gbt}function pO(t,e,r,n,o){r=r||":",e=e.toLowerCase(),n=n||!1,o=o||!1;let s="";return t.some(a=>{let c=a.toLowerCase().replace(/\t/g,"");if(n&&(c=c.trim()),c.startsWith(e)&&(!o||c.match(e+r)||c.match(e+" "+r))){let u=n?a.trim().split(r):a.split(r);if(u.length>=2)return u.shift(),s=u.join(r).trim(),!0}}),s}function Y_o(t,e){return e=e||16,t.replace(/\\x([0-9A-Fa-f]{2})/g,function(){return String.fromCharCode(parseInt(arguments[1],e))})}function K_o(t){let e="",r=0;return t.split("").forEach(n=>{n>="0"&&n<="9"?r===1&&r++:(r===0&&r++,r===1&&(e+=n))}),e}function X_o(t,e){e=e||"",t=t.toUpperCase();let r=0,n=0,o=K_o(t),s=t.split(o);if(s.length>=2){s[2]&&(s[1]+=s[2]);let a=s[1]&&s[1].toLowerCase().indexOf("pm")>-1||s[1].toLowerCase().indexOf("p.m.")>-1||s[1].toLowerCase().indexOf("p. m.")>-1||s[1].toLowerCase().indexOf("n")>-1||s[1].toLowerCase().indexOf("ch")>-1||s[1].toLowerCase().indexOf("\xF6s")>-1||e&&s[1].toLowerCase().indexOf(e)>-1;return r=parseInt(s[0],10),n=parseInt(s[1],10),r=a&&r<12?r+12:r,("0"+r).substr(-2)+":"+("0"+n).substr(-2)}}function J_o(t,e){let r={date:"",time:""};e=e||{};let n=(e.dateFormat||"").toLowerCase(),o=e.pmDesignator||"",s=t.split(" ");if(s[0]){if(s[0].indexOf("/")>=0){let a=s[0].split("/");a.length===3&&(a[0].length===4?r.date=a[0]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[2]).substr(-2):a[2].length===2?(n.indexOf("/d/")>-1||n.indexOf("/dd/")>-1,r.date="20"+a[2]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[0]).substr(-2)):(t.toLowerCase().indexOf("pm")>-1||t.toLowerCase().indexOf("p.m.")>-1||t.toLowerCase().indexOf("p. m.")>-1||t.toLowerCase().indexOf("am")>-1||t.toLowerCase().indexOf("a.m.")>-1||t.toLowerCase().indexOf("a. m.")>-1||n.indexOf("/d/")>-1||n.indexOf("/dd/")>-1)&&n.indexOf("dd/")!==0?r.date=a[2]+"-"+("0"+a[0]).substr(-2)+"-"+("0"+a[1]).substr(-2):r.date=a[2]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[0]).substr(-2))}if(s[0].indexOf(".")>=0){let a=s[0].split(".");a.length===3&&(n.indexOf(".d.")>-1||n.indexOf(".dd.")>-1?r.date=a[2]+"-"+("0"+a[0]).substr(-2)+"-"+("0"+a[1]).substr(-2):r.date=a[2]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[0]).substr(-2))}if(s[0].indexOf("-")>=0){let a=s[0].split("-");a.length===3&&(r.date=a[0]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[2]).substr(-2))}}if(s[1]){s.shift();let a=s.join(" ");r.time=X_o(a,o)}return r}function Z_o(t,e){let r=e>0,n=1,o=0,s=0,a=[];for(let u=0;u<t.length;u++)n<=e?(/\s/.test(t[u])&&!r&&(s=u-1,a.push({from:o,to:s+1,cap:t.substring(o,s+1)}),o=s+2,n++),r=t[u]===" "):(!/\s/.test(t[u])&&r&&(s=u-1,o<s&&a.push({from:o,to:s,cap:t.substring(o,s)}),o=s+1,n++),r=t[u]===" ");s=5e3,a.push({from:o,to:s,cap:t.substring(o,s)});let c=a.length;for(let u=0;u<c;u++)a[u].cap.replace(/\s/g,"").length===0&&u+1<c&&(a[u].to=a[u+1].to,a[u].cap=a[u].cap+a[u+1].cap,a.splice(u+1,1),c=c-1);return a}function eEo(t,e,r){for(let n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1}function tEo(){if(FBe="powershell.exe",UBe){let t=`${Xbt}\\system32\\WindowsPowerShell\\v1.0\\powershell.exe`;mS.existsSync(t)&&(FBe=t)}}function hjr(){if(UZ.type()==="Windows_NT"&&!cj&&(cj=Xbt+"\\system32\\wbem\\wmic.exe",!mS.existsSync(cj)))try{let t=QZ("WHERE WMIC",ige).toString().split(`\r
487
+ ${g.slice(0,2e4)}`,model:c,tool:u,toolName:r?.toolName,toolArgs:r?.toolArgs?JSON.stringify(r.toolArgs):void 0,cliVer:"0.4.10",platform:process.platform,arch:process.arch,nodeVersion:process.version,osVersion:process.platform==="darwin"?M_o():F_o()}};await ype("/aitrack.lifecycle.run_error",A)}getCurrentSession(){return this.currentSession}},dO=new PBe});var tjr=I((Atc,L_o)=>{L_o.exports={name:"systeminformation",version:"5.27.11",description:"Advanced, lightweight system and OS information library",license:"MIT",author:"Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",homepage:"https://systeminformation.io",main:"./lib/index.js",type:"commonjs",bin:{systeminformation:"lib/cli.js"},types:"./lib/index.d.ts",scripts:{test:"node ./test/test.js",testDeno:"deno run -A ./test/test.js"},files:["lib/"],keywords:["system information","sysinfo","monitor","monitoring","os","linux","osx","windows","freebsd","openbsd","netbsd","cpu","cpuload","physical cores","logical cores","processor","cores","threads","socket type","memory","file system","fsstats","diskio","block devices","netstats","network","network interfaces","network connections","network stats","iface","printer","processes","users","internet","battery","docker","docker stats","docker processes","graphics","graphic card","graphic controller","gpu","display","smart","disk layout","usb","audio","bluetooth","wifi","wifinetworks","virtual box","virtualbox","vm","backend","hardware","BIOS","chassis"],repository:{type:"git",url:"git+https://github.com/sebhildebrandt/systeminformation.git"},funding:{type:"Buy me a coffee",url:"https://www.buymeacoffee.com/systeminfo"},os:["darwin","linux","win32","freebsd","openbsd","netbsd","sunos","android"],engines:{node:">=8.0.0"}}});var Uh=I(ji=>{"use strict";var UZ=_e("os"),mS=_e("fs"),U_o=_e("path"),Ybt=_e("child_process").spawn,Q_o=_e("child_process").exec,QZ=_e("child_process").execSync,j_o=_e("util"),lj=process.platform,Kbt=lj==="linux"||lj==="android",ijr=lj==="darwin",UBe=lj==="win32",ojr=lj==="freebsd",sjr=lj==="openbsd",ajr=lj==="netbsd",Gbt=0,cj="",pS="",fO=null,hS=null,Xbt=process.env.WINDIR||"C:\\Windows",Dm,LZ="",nge=[],Jbt=!1,FBe="",$_o="$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ",Hbt="--###START###--",rjr="--ERROR--",LBe="--###ENDCMD###--",Vbt="--##ID##--",ige={windowsHide:!0,maxBuffer:1024*2e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})},QBe={maxBuffer:1024*2e4,encoding:"UTF-8",stdio:["pipe","pipe","ignore"]};function G_o(t){let e=parseInt(t,10);return isNaN(e)&&(e=0),e}function q_o(t){let e=!1,r="",n="";for(let o of t)o>="0"&&o<="9"||e?(e=!0,r+=o):n+=o;return[n,r]}var MBe=new String,Wbt=new String().replace,zbt=new String().toLowerCase,cjr=new String().toString,ljr=new String().substr,ujr=new String().substring,djr=new String().trim,fjr=new String().startsWith,pjr=Math.min;function H_o(t){return t&&{}.toString.call(t)==="[object Function]"}function V_o(t){let e=[],r={};for(let n=0;n<t.length;n++){let o=Object.keys(t[n]);o.sort(function(a,c){return a-c});let s="";for(let a=0;a<o.length;a++)s+=JSON.stringify(o[a]),s+=JSON.stringify(t[n][o[a]]);({}).hasOwnProperty.call(r,s)||(e.push(t[n]),r[s]=!0)}return e}function W_o(t,e){return t.sort(function(r,n){let o="",s="";return e.forEach(function(a){o=o+r[a],s=s+n[a]}),o<s?-1:o>s?1:0})}function z_o(){return Gbt===0&&(Gbt=UZ.cpus().length),Gbt}function pO(t,e,r,n,o){r=r||":",e=e.toLowerCase(),n=n||!1,o=o||!1;let s="";return t.some(a=>{let c=a.toLowerCase().replace(/\t/g,"");if(n&&(c=c.trim()),c.startsWith(e)&&(!o||c.match(e+r)||c.match(e+" "+r))){let u=n?a.trim().split(r):a.split(r);if(u.length>=2)return u.shift(),s=u.join(r).trim(),!0}}),s}function Y_o(t,e){return e=e||16,t.replace(/\\x([0-9A-Fa-f]{2})/g,function(){return String.fromCharCode(parseInt(arguments[1],e))})}function K_o(t){let e="",r=0;return t.split("").forEach(n=>{n>="0"&&n<="9"?r===1&&r++:(r===0&&r++,r===1&&(e+=n))}),e}function X_o(t,e){e=e||"",t=t.toUpperCase();let r=0,n=0,o=K_o(t),s=t.split(o);if(s.length>=2){s[2]&&(s[1]+=s[2]);let a=s[1]&&s[1].toLowerCase().indexOf("pm")>-1||s[1].toLowerCase().indexOf("p.m.")>-1||s[1].toLowerCase().indexOf("p. m.")>-1||s[1].toLowerCase().indexOf("n")>-1||s[1].toLowerCase().indexOf("ch")>-1||s[1].toLowerCase().indexOf("\xF6s")>-1||e&&s[1].toLowerCase().indexOf(e)>-1;return r=parseInt(s[0],10),n=parseInt(s[1],10),r=a&&r<12?r+12:r,("0"+r).substr(-2)+":"+("0"+n).substr(-2)}}function J_o(t,e){let r={date:"",time:""};e=e||{};let n=(e.dateFormat||"").toLowerCase(),o=e.pmDesignator||"",s=t.split(" ");if(s[0]){if(s[0].indexOf("/")>=0){let a=s[0].split("/");a.length===3&&(a[0].length===4?r.date=a[0]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[2]).substr(-2):a[2].length===2?(n.indexOf("/d/")>-1||n.indexOf("/dd/")>-1,r.date="20"+a[2]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[0]).substr(-2)):(t.toLowerCase().indexOf("pm")>-1||t.toLowerCase().indexOf("p.m.")>-1||t.toLowerCase().indexOf("p. m.")>-1||t.toLowerCase().indexOf("am")>-1||t.toLowerCase().indexOf("a.m.")>-1||t.toLowerCase().indexOf("a. m.")>-1||n.indexOf("/d/")>-1||n.indexOf("/dd/")>-1)&&n.indexOf("dd/")!==0?r.date=a[2]+"-"+("0"+a[0]).substr(-2)+"-"+("0"+a[1]).substr(-2):r.date=a[2]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[0]).substr(-2))}if(s[0].indexOf(".")>=0){let a=s[0].split(".");a.length===3&&(n.indexOf(".d.")>-1||n.indexOf(".dd.")>-1?r.date=a[2]+"-"+("0"+a[0]).substr(-2)+"-"+("0"+a[1]).substr(-2):r.date=a[2]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[0]).substr(-2))}if(s[0].indexOf("-")>=0){let a=s[0].split("-");a.length===3&&(r.date=a[0]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[2]).substr(-2))}}if(s[1]){s.shift();let a=s.join(" ");r.time=X_o(a,o)}return r}function Z_o(t,e){let r=e>0,n=1,o=0,s=0,a=[];for(let u=0;u<t.length;u++)n<=e?(/\s/.test(t[u])&&!r&&(s=u-1,a.push({from:o,to:s+1,cap:t.substring(o,s+1)}),o=s+2,n++),r=t[u]===" "):(!/\s/.test(t[u])&&r&&(s=u-1,o<s&&a.push({from:o,to:s,cap:t.substring(o,s)}),o=s+1,n++),r=t[u]===" ");s=5e3,a.push({from:o,to:s,cap:t.substring(o,s)});let c=a.length;for(let u=0;u<c;u++)a[u].cap.replace(/\s/g,"").length===0&&u+1<c&&(a[u].to=a[u+1].to,a[u].cap=a[u].cap+a[u+1].cap,a.splice(u+1,1),c=c-1);return a}function eEo(t,e,r){for(let n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1}function tEo(){if(FBe="powershell.exe",UBe){let t=`${Xbt}\\system32\\WindowsPowerShell\\v1.0\\powershell.exe`;mS.existsSync(t)&&(FBe=t)}}function hjr(){if(UZ.type()==="Windows_NT"&&!cj&&(cj=Xbt+"\\system32\\wbem\\wmic.exe",!mS.existsSync(cj)))try{let t=QZ("WHERE WMIC",ige).toString().split(`\r
488
488
  `);t&&t.length?cj=t[0]:cj="wmic"}catch{cj="wmic"}return cj}function rEo(t){return new Promise(e=>{process.nextTick(()=>{try{mjr(hjr()+" "+t).then(r=>{e(r,"")})}catch(r){e("",r)}})})}function nEo(){return UBe?`"${process.env.VBOX_INSTALL_PATH||process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"`:"vboxmanage"}function qbt(t){let e="",r,n="";if(t.indexOf(Hbt)>=0){r=t.split(Hbt);let s=r[1].split(Vbt);e=s[0],s.length>1&&(t=s.slice(1).join(Vbt))}t.indexOf(LBe)>=0&&(r=t.split(LBe),n=r[0]);let o=-1;for(let s=0;s<nge.length;s++)nge[s].id===e&&(o=s,nge[s].callback(n));o>=0&&nge.splice(o,1)}function iEo(){Dm||(Dm=Ybt(FBe,["-NoProfile","-NoLogo","-InputFormat","Text","-NoExit","-Command","-"],{stdio:"pipe",windowsHide:!0,maxBuffer:1024*2e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})}),Dm&&Dm.pid&&(Jbt=!0,Dm.stdout.on("data",function(t){LZ=LZ+t.toString("utf8"),t.indexOf(LBe)>=0&&(qbt(LZ),LZ="")}),Dm.stderr.on("data",function(){qbt(LZ+rjr)}),Dm.on("error",function(){qbt(LZ+rjr)}),Dm.on("close",function(){Dm&&Dm.kill()})))}function oEo(){try{Dm&&(Dm.stdin.write("exit"+UZ.EOL),Dm.stdin.end(),Jbt=!1)}catch{Dm&&Dm.kill()}Dm=null}function mjr(t){if(Jbt){let e=Math.random().toString(36).substring(2,12);return new Promise(r=>{process.nextTick(()=>{function n(o){r(o)}nge.push({id:e,cmd:t,callback:n,start:new Date});try{Dm&&Dm.pid&&Dm.stdin.write($_o+"echo "+Hbt+e+Vbt+"; "+UZ.EOL+t+UZ.EOL+"echo "+LBe+UZ.EOL)}catch{r("")}})})}else{let e="";return new Promise(r=>{process.nextTick(()=>{try{let n=Ybt(FBe,["-NoProfile","-NoLogo","-InputFormat","Text","-ExecutionPolicy","Unrestricted","-Command",t],{stdio:"pipe",windowsHide:!0,maxBuffer:2048e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})});n&&!n.pid&&n.on("error",function(){r(e)}),n&&n.pid?(n.stdout.on("data",function(o){e=e+o.toString("utf8")}),n.stderr.on("data",function(){n.kill(),r(e)}),n.on("close",function(){n.kill(),r(e)}),n.on("error",function(){n.kill(),r(e)})):r(e)}catch{r(e)}})})}}function sEo(t,e,r){let n="";return r=r||{},new Promise(o=>{process.nextTick(()=>{try{let s=Ybt(t,e,r);s&&!s.pid&&s.on("error",function(){o(n)}),s&&s.pid?(s.stdout.on("data",function(a){n+=a.toString()}),s.on("close",function(){s.kill(),o(n)}),s.on("error",function(){s.kill(),o(n)})):o(n)}catch{o(n)}})})}function aEo(){if(UBe){if(!pS)try{let r=QZ("chcp",ige).toString().split(`\r
489
489
  `)[0].split(":");pS=r.length>1?r[1].replace(".","").trim():""}catch{pS="437"}return pS}if(Kbt||ijr||ojr||sjr||ajr){if(!pS)try{let r=QZ("echo $LANG",QBe).toString().split(`\r
490
490
  `)[0].split(".");pS=r.length>1?r[1].trim():"",pS||(pS="UTF-8")}catch{pS="UTF-8"}return pS}}function cEo(){if(fO!==null)return fO;if(fO=!1,UBe)try{let t=QZ("WHERE smartctl 2>nul",ige).toString().split(`\r
@@ -869,7 +869,7 @@ Bus `);for(let c=1;c<a.length;c++){let u=ybo(a[c]);r.push(u)}}t&&t(r),e(r)}),dbo
869
869
  `);l3.getValue(c,"name",":")&&r.push(Mbo(c))}),t&&t(r),e(r)}),kbo&&e(null)})})}O$r.audio=Fbo});var M$r=I((Ltc,P$r)=>{"use strict";P$r.exports={0:"Ericsson Technology Licensing",1:"Nokia Mobile Phones",2:"Intel Corp.",3:"IBM Corp.",4:"Toshiba Corp.",5:"3Com",6:"Microsoft",7:"Lucent",8:"Motorola",9:"Infineon Technologies AG",10:"Cambridge Silicon Radio",11:"Silicon Wave",12:"Digianswer A/S",13:"Texas Instruments Inc.",14:"Ceva, Inc. (formerly Parthus Technologies, Inc.)",15:"Broadcom Corporation",16:"Mitel Semiconductor",17:"Widcomm, Inc",18:"Zeevo, Inc.",19:"Atmel Corporation",20:"Mitsubishi Electric Corporation",21:"RTX Telecom A/S",22:"KC Technology Inc.",23:"NewLogic",24:"Transilica, Inc.",25:"Rohde & Schwarz GmbH & Co. KG",26:"TTPCom Limited",27:"Signia Technologies, Inc.",28:"Conexant Systems Inc.",29:"Qualcomm",30:"Inventel",31:"AVM Berlin",32:"BandSpeed, Inc.",33:"Mansella Ltd",34:"NEC Corporation",35:"WavePlus Technology Co., Ltd.",36:"Alcatel",37:"NXP Semiconductors (formerly Philips Semiconductors)",38:"C Technologies",39:"Open Interface",40:"R F Micro Devices",41:"Hitachi Ltd",42:"Symbol Technologies, Inc.",43:"Tenovis",44:"Macronix International Co. Ltd.",45:"GCT Semiconductor",46:"Norwood Systems",47:"MewTel Technology Inc.",48:"ST Microelectronics",49:"Synopsis",50:"Red-M (Communications) Ltd",51:"Commil Ltd",52:"Computer Access Technology Corporation (CATC)",53:"Eclipse (HQ Espana) S.L.",54:"Renesas Electronics Corporation",55:"Mobilian Corporation",56:"Terax",57:"Integrated System Solution Corp.",58:"Matsushita Electric Industrial Co., Ltd.",59:"Gennum Corporation",60:"BlackBerry Limited (formerly Research In Motion)",61:"IPextreme, Inc.",62:"Systems and Chips, Inc.",63:"Bluetooth SIG, Inc.",64:"Seiko Epson Corporation",65:"Integrated Silicon Solution Taiwan, Inc.",66:"CONWISE Technology Corporation Ltd",67:"PARROT SA",68:"Socket Mobile",69:"Atheros Communications, Inc.",70:"MediaTek, Inc.",71:"Bluegiga",72:"Marvell Technology Group Ltd.",73:"3DSP Corporation",74:"Accel Semiconductor Ltd.",75:"Continental Automotive Systems",76:"Apple, Inc.",77:"Staccato Communications, Inc.",78:"Avago Technologies",79:"APT Licensing Ltd.",80:"SiRF Technology",81:"Tzero Technologies, Inc.",82:"J&M Corporation",83:"Free2move AB",84:"3DiJoy Corporation",85:"Plantronics, Inc.",86:"Sony Ericsson Mobile Communications",87:"Harman International Industries, Inc.",88:"Vizio, Inc.",89:"Nordic Semiconductor ASA",90:"EM Microelectronic-Marin SA",91:"Ralink Technology Corporation",92:"Belkin International, Inc.",93:"Realtek Semiconductor Corporation",94:"Stonestreet One, LLC",95:"Wicentric, Inc.",96:"RivieraWaves S.A.S",97:"RDA Microelectronics",98:"Gibson Guitars",99:"MiCommand Inc.",100:"Band XI International, LLC",101:"Hewlett-Packard Company",102:"9Solutions Oy",103:"GN Netcom A/S",104:"General Motors",105:"A&D Engineering, Inc.",106:"MindTree Ltd.",107:"Polar Electro OY",108:"Beautiful Enterprise Co., Ltd.",109:"BriarTek, Inc.",110:"Summit Data Communications, Inc.",111:"Sound ID",112:"Monster, LLC",113:"connectBlue AB",114:"ShangHai Super Smart Electronics Co. Ltd.",115:"Group Sense Ltd.",116:"Zomm, LLC",117:"Samsung Electronics Co. Ltd.",118:"Creative Technology Ltd.",119:"Laird Technologies",120:"Nike, Inc.",121:"lesswire AG",122:"MStar Semiconductor, Inc.",123:"Hanlynn Technologies",124:"A & R Cambridge",125:"Seers Technology Co. Ltd",126:"Sports Tracking Technologies Ltd.",127:"Autonet Mobile",128:"DeLorme Publishing Company, Inc.",129:"WuXi Vimicro",130:"Sennheiser Communications A/S",131:"TimeKeeping Systems, Inc.",132:"Ludus Helsinki Ltd.",133:"BlueRadios, Inc.",134:"equinox AG",135:"Garmin International, Inc.",136:"Ecotest",137:"GN ReSound A/S",138:"Jawbone",139:"Topcorn Positioning Systems, LLC",140:"Gimbal Inc. (formerly Qualcomm Labs, Inc. and Qualcomm Retail Solutions, Inc.)",141:"Zscan Software",142:"Quintic Corp.",143:"Stollman E+V GmbH",144:"Funai Electric Co., Ltd.",145:"Advanced PANMOBIL Systems GmbH & Co. KG",146:"ThinkOptics, Inc.",147:"Universal Electronics, Inc.",148:"Airoha Technology Corp.",149:"NEC Lighting, Ltd.",150:"ODM Technology, Inc.",151:"ConnecteDevice Ltd.",152:"zer01.tv GmbH",153:"i.Tech Dynamic Global Distribution Ltd.",154:"Alpwise",155:"Jiangsu Toppower Automotive Electronics Co., Ltd.",156:"Colorfy, Inc.",157:"Geoforce Inc.",158:"Bose Corporation",159:"Suunto Oy",160:"Kensington Computer Products Group",161:"SR-Medizinelektronik",162:"Vertu Corporation Limited",163:"Meta Watch Ltd.",164:"LINAK A/S",165:"OTL Dynamics LLC",166:"Panda Ocean Inc.",167:"Visteon Corporation",168:"ARP Devices Limited",169:"Magneti Marelli S.p.A",170:"CAEN RFID srl",171:"Ingenieur-Systemgruppe Zahn GmbH",172:"Green Throttle Games",173:"Peter Systemtechnik GmbH",174:"Omegawave Oy",175:"Cinetix",176:"Passif Semiconductor Corp",177:"Saris Cycling Group, Inc",178:"Bekey A/S",179:"Clarinox Technologies Pty. Ltd.",180:"BDE Technology Co., Ltd.",181:"Swirl Networks",182:"Meso international",183:"TreLab Ltd",184:"Qualcomm Innovation Center, Inc. (QuIC)",185:"Johnson Controls, Inc.",186:"Starkey Laboratories Inc.",187:"S-Power Electronics Limited",188:"Ace Sensor Inc",189:"Aplix Corporation",190:"AAMP of America",191:"Stalmart Technology Limited",192:"AMICCOM Electronics Corporation",193:"Shenzhen Excelsecu Data Technology Co.,Ltd",194:"Geneq Inc.",195:"adidas AG",196:"LG Electronics",197:"Onset Computer Corporation",198:"Selfly BV",199:"Quuppa Oy.",200:"GeLo Inc",201:"Evluma",202:"MC10",203:"Binauric SE",204:"Beats Electronics",205:"Microchip Technology Inc.",206:"Elgato Systems GmbH",207:"ARCHOS SA",208:"Dexcom, Inc.",209:"Polar Electro Europe B.V.",210:"Dialog Semiconductor B.V.",211:"Taixingbang\xA0Technology (HK) Co,. LTD.",212:"Kawantech",213:"Austco Communication Systems",214:"Timex Group USA, Inc.",215:"Qualcomm Technologies, Inc.",216:"Qualcomm Connected Experiences, Inc.",217:"Voyetra Turtle Beach",218:"txtr GmbH",219:"Biosentronics",220:"Procter & Gamble",221:"Hosiden Corporation",222:"Muzik LLC",223:"Misfit Wearables Corp",224:"Google",225:"Danlers Ltd",226:"Semilink Inc",227:"inMusic Brands, Inc",228:"L.S. Research Inc.",229:"Eden Software Consultants Ltd.",230:"Freshtemp",231:"KS Technologies",232:"ACTS Technologies",233:"Vtrack Systems",234:"Nielsen-Kellerman Company",235:"Server Technology, Inc.",236:"BioResearch Associates",237:"Jolly Logic, LLC",238:"Above Average Outcomes, Inc.",239:"Bitsplitters GmbH",240:"PayPal, Inc.",241:"Witron Technology Limited",242:"Aether Things\xA0Inc. (formerly Morse Project Inc.)",243:"Kent Displays Inc.",244:"Nautilus Inc.",245:"Smartifier Oy",246:"Elcometer Limited",247:"VSN Technologies Inc.",248:"AceUni Corp., Ltd.",249:"StickNFind",250:"Crystal Code AB",251:"KOUKAAM a.s.",252:"Delphi Corporation",253:"ValenceTech Limited",254:"Reserved",255:"Typo Products, LLC",256:"TomTom International BV",257:"Fugoo, Inc",258:"Keiser Corporation",259:"Bang & Olufsen A/S",260:"PLUS Locations Systems Pty Ltd",261:"Ubiquitous Computing Technology Corporation",262:"Innovative Yachtter Solutions",263:"William Demant Holding A/S",264:"Chicony Electronics Co., Ltd.",265:"Atus BV",266:"Codegate Ltd.",267:"ERi, Inc.",268:"Transducers Direct, LLC",269:"Fujitsu Ten Limited",270:"Audi AG",271:"HiSilicon Technologies Co., Ltd.",272:"Nippon Seiki Co., Ltd.",273:"Steelseries ApS",274:"vyzybl Inc.",275:"Openbrain Technologies, Co., Ltd.",276:"Xensr",277:"e.solutions",278:"1OAK Technologies",279:"Wimoto Technologies Inc",280:"Radius Networks, Inc.",281:"Wize Technology Co., Ltd.",282:"Qualcomm Labs, Inc.",283:"Aruba Networks",284:"Baidu",285:"Arendi AG",286:"Skoda Auto a.s.",287:"Volkswagon AG",288:"Porsche AG",289:"Sino Wealth Electronic Ltd.",290:"AirTurn, Inc.",291:"Kinsa, Inc.",292:"HID Global",293:"SEAT es",294:"Promethean Ltd.",295:"Salutica Allied Solutions",296:"GPSI Group Pty Ltd",297:"Nimble Devices Oy",298:"Changzhou Yongse Infotech Co., Ltd",299:"SportIQ",300:"TEMEC Instruments B.V.",301:"Sony Corporation",302:"ASSA ABLOY",303:"Clarion Co., Ltd.",304:"Warehouse Innovations",305:"Cypress Semiconductor Corporation",306:"MADS Inc",307:"Blue Maestro Limited",308:"Resolution Products, Inc.",309:"Airewear LLC",310:"Seed Labs, Inc. (formerly ETC sp. z.o.o.)",311:"Prestigio Plaza Ltd.",312:"NTEO Inc.",313:"Focus Systems Corporation",314:"Tencent Holdings Limited",315:"Allegion",316:"Murata Manufacuring Co., Ltd.",318:"Nod, Inc.",319:"B&B Manufacturing Company",320:"Alpine\xA0Electronics\xA0(China)\xA0Co.,\xA0Ltd",321:"FedEx Services",322:"Grape Systems Inc.",323:"Bkon Connect",324:"Lintech GmbH",325:"Novatel Wireless",326:"Ciright",327:"Mighty Cast, Inc.",328:"Ambimat Electronics",329:"Perytons Ltd.",330:"Tivoli Audio, LLC",331:"Master Lock",332:"Mesh-Net Ltd",333:"Huizhou Desay SV Automotive CO., LTD.",334:"Tangerine, Inc.",335:"B&W Group Ltd.",336:"Pioneer Corporation",337:"OnBeep",338:"Vernier Software & Technology",339:"ROL Ergo",340:"Pebble Technology",341:"NETATMO",342:"Accumulate AB",343:"Anhui Huami Information Technology Co., Ltd.",344:"Inmite s.r.o.",345:"ChefSteps, Inc.",346:"micas AG",347:"Biomedical Research Ltd.",348:"Pitius Tec S.L.",349:"Estimote, Inc.",350:"Unikey Technologies, Inc.",351:"Timer Cap Co.",352:"AwoX",353:"yikes",354:"MADSGlobal NZ Ltd.",355:"PCH International",356:"Qingdao Yeelink Information Technology Co., Ltd.",357:"Milwaukee Tool (formerly Milwaukee Electric Tools)",358:"MISHIK Pte Ltd",359:"Bayer HealthCare",360:"Spicebox LLC",361:"emberlight",362:"Cooper-Atkins Corporation",363:"Qblinks",364:"MYSPHERA",365:"LifeScan Inc",366:"Volantic AB",367:"Podo Labs, Inc",368:"Roche Diabetes Care AG",369:"Amazon Fulfillment Service",370:"Connovate Technology Private Limited",371:"Kocomojo, LLC",372:"Everykey LLC",373:"Dynamic Controls",374:"SentriLock",375:"I-SYST inc.",376:"CASIO COMPUTER CO., LTD.",377:"LAPIS Semiconductor Co., Ltd.",378:"Telemonitor, Inc.",379:"taskit GmbH",380:"Daimler AG",381:"BatAndCat",382:"BluDotz Ltd",383:"XTel ApS",384:"Gigaset Communications GmbH",385:"Gecko Health Innovations, Inc.",386:"HOP Ubiquitous",387:"To Be Assigned",388:"Nectar",389:"bel\u2019apps LLC",390:"CORE Lighting Ltd",391:"Seraphim Sense Ltd",392:"Unico RBC",393:"Physical Enterprises Inc.",394:"Able Trend Technology Limited",395:"Konica Minolta, Inc.",396:"Wilo SE",397:"Extron Design Services",398:"Fitbit, Inc.",399:"Fireflies Systems",400:"Intelletto Technologies Inc.",401:"FDK CORPORATION",402:"Cloudleaf, Inc",403:"Maveric Automation LLC",404:"Acoustic Stream Corporation",405:"Zuli",406:"Paxton Access Ltd",407:"WiSilica Inc",408:"Vengit Limited",409:"SALTO SYSTEMS S.L.",410:"TRON Forum (formerly T-Engine Forum)",411:"CUBETECH s.r.o.",412:"Cokiya Incorporated",413:"CVS Health",414:"Ceruus",415:"Strainstall Ltd",416:"Channel Enterprises (HK) Ltd.",417:"FIAMM",418:"GIGALANE.CO.,LTD",419:"EROAD",420:"Mine Safety Appliances",421:"Icon Health and Fitness",422:"Asandoo GmbH",423:"ENERGOUS CORPORATION",424:"Taobao",425:"Canon Inc.",426:"Geophysical Technology Inc.",427:"Facebook, Inc.",428:"Nipro Diagnostics, Inc.",429:"FlightSafety International",430:"Earlens Corporation",431:"Sunrise Micro Devices, Inc.",432:"Star Micronics Co., Ltd.",433:"Netizens Sp. z o.o.",434:"Nymi Inc.",435:"Nytec, Inc.",436:"Trineo Sp. z o.o.",437:"Nest Labs Inc.",438:"LM Technologies Ltd",439:"General Electric Company",440:"i+D3 S.L.",441:"HANA Micron",442:"Stages Cycling LLC",443:"Cochlear Bone Anchored Solutions AB",444:"SenionLab AB",445:"Syszone Co., Ltd",446:"Pulsate Mobile Ltd.",447:"Hong Kong HunterSun Electronic Limited",448:"pironex GmbH",449:"BRADATECH Corp.",450:"Transenergooil AG",451:"Bunch",452:"DME Microelectronics",453:"Bitcraze AB",454:"HASWARE Inc.",455:"Abiogenix Inc.",456:"Poly-Control ApS",457:"Avi-on",458:"Laerdal Medical AS",459:"Fetch My Pet",460:"Sam Labs Ltd.",461:"Chengdu Synwing Technology Ltd",462:"HOUWA SYSTEM DESIGN, k.k.",463:"BSH",464:"Primus Inter Pares Ltd",465:"August",466:"Gill Electronics",467:"Sky Wave Design",468:"Newlab S.r.l.",469:"ELAD srl",470:"G-wearables inc.",471:"Squadrone Systems Inc.",472:"Code Corporation",473:"Savant Systems LLC",474:"Logitech International SA",475:"Innblue Consulting",476:"iParking Ltd.",477:"Koninklijke Philips Electronics N.V.",478:"Minelab Electronics Pty Limited",479:"Bison Group Ltd.",480:"Widex A/S",481:"Jolla Ltd",482:"Lectronix, Inc.",483:"Caterpillar Inc",484:"Freedom Innovations",485:"Dynamic Devices Ltd",486:"Technology Solutions (UK) Ltd",487:"IPS Group Inc.",488:"STIR",489:"Sano, Inc",490:"Advanced Application Design, Inc.",491:"AutoMap LLC",492:"Spreadtrum Communications Shanghai Ltd",493:"CuteCircuit LTD",494:"Valeo Service",495:"Fullpower Technologies, Inc.",496:"KloudNation",497:"Zebra Technologies Corporation",498:"Itron, Inc.",499:"The University of Tokyo",500:"UTC Fire and Security",501:"Cool Webthings Limited",502:"DJO Global",503:"Gelliner Limited",504:"Anyka (Guangzhou) Microelectronics Technology Co, LTD",505:"Medtronic, Inc.",506:"Gozio, Inc.",507:"Form Lifting, LLC",508:"Wahoo Fitness, LLC",509:"Kontakt Micro-Location Sp. z o.o.",510:"Radio System Corporation",511:"Freescale Semiconductor, Inc.",512:"Verifone Systems PTe Ltd. Taiwan Branch",513:"AR Timing",514:"Rigado LLC",515:"Kemppi Oy",516:"Tapcentive Inc.",517:"Smartbotics Inc.",518:"Otter Products, LLC",519:"STEMP Inc.",520:"LumiGeek LLC",521:"InvisionHeart Inc.",522:"Macnica Inc. ",523:"Jaguar Land Rover Limited",524:"CoroWare Technologies, Inc",525:"Simplo Technology Co., LTD",526:"Omron Healthcare Co., LTD",527:"Comodule GMBH",528:"ikeGPS",529:"Telink Semiconductor Co. Ltd",530:"Interplan Co., Ltd",531:"Wyler AG",532:"IK Multimedia Production srl",533:"Lukoton Experience Oy",534:"MTI Ltd",535:"Tech4home, Lda",536:"Hiotech AB",537:"DOTT Limited",538:"Blue Speck Labs, LLC",539:"Cisco Systems, Inc",540:"Mobicomm Inc",541:"Edamic",542:"Goodnet, Ltd",543:"Luster Leaf Products Inc",544:"Manus Machina BV",545:"Mobiquity Networks Inc",546:"Praxis Dynamics",547:"Philip Morris Products S.A.",548:"Comarch SA",549:"Nestl Nespresso S.A.",550:"Merlinia A/S",551:"LifeBEAM Technologies",552:"Twocanoes Labs, LLC",553:"Muoverti Limited",554:"Stamer Musikanlagen GMBH",555:"Tesla Motors",556:"Pharynks Corporation",557:"Lupine",558:"Siemens AG",559:"Huami (Shanghai) Culture Communication CO., LTD",560:"Foster Electric Company, Ltd",561:"ETA SA",562:"x-Senso Solutions Kft",563:"Shenzhen SuLong Communication Ltd",564:"FengFan (BeiJing) Technology Co, Ltd",565:"Qrio Inc",566:"Pitpatpet Ltd",567:"MSHeli s.r.l.",568:"Trakm8 Ltd",569:"JIN CO, Ltd",570:"Alatech Tehnology",571:"Beijing CarePulse Electronic Technology Co, Ltd",572:"Awarepoint",573:"ViCentra B.V.",574:"Raven Industries",575:"WaveWare Technologies Inc.",576:"Argenox Technologies",577:"Bragi GmbH",578:"16Lab Inc",579:"Masimo Corp",580:"Iotera Inc",581:"Endress+Hauser",582:"ACKme Networks, Inc.",583:"FiftyThree Inc.",584:"Parker Hannifin Corp",585:"Transcranial Ltd",586:"Uwatec AG",587:"Orlan LLC",588:"Blue Clover Devices",589:"M-Way Solutions GmbH",590:"Microtronics Engineering GmbH",591:"Schneider Schreibgerte GmbH",592:"Sapphire Circuits LLC",593:"Lumo Bodytech Inc.",594:"UKC Technosolution",595:"Xicato Inc.",596:"Playbrush",597:"Dai Nippon Printing Co., Ltd.",598:"G24 Power Limited",599:"AdBabble Local Commerce Inc.",600:"Devialet SA",601:"ALTYOR",602:"University of Applied Sciences Valais/Haute Ecole Valaisanne",603:"Five Interactive, LLC dba Zendo",604:"NetEaseHangzhouNetwork co.Ltd.",605:"Lexmark International Inc.",606:"Fluke Corporation",607:"Yardarm Technologies",608:"SensaRx",609:"SECVRE GmbH",610:"Glacial Ridge Technologies",611:"Identiv, Inc.",612:"DDS, Inc.",613:"SMK Corporation",614:"Schawbel Technologies LLC",615:"XMI Systems SA",616:"Cerevo",617:"Torrox GmbH & Co KG",618:"Gemalto",619:"DEKA Research & Development Corp.",620:"Domster Tadeusz Szydlowski",621:"Technogym SPA",622:"FLEURBAEY BVBA",623:"Aptcode Solutions",624:"LSI ADL Technology",625:"Animas Corp",626:"Alps Electric Co., Ltd.",627:"OCEASOFT",628:"Motsai Research",629:"Geotab",630:"E.G.O. Elektro-Gertebau GmbH",631:"bewhere inc",632:"Johnson Outdoors Inc",633:"steute Schaltgerate GmbH & Co. KG",634:"Ekomini inc.",635:"DEFA AS",636:"Aseptika Ltd",637:"HUAWEI Technologies Co., Ltd. ( )",638:"HabitAware, LLC",639:"ruwido austria gmbh",640:"ITEC corporation",641:"StoneL",642:"Sonova AG",643:"Maven Machines, Inc.",644:"Synapse Electronics",645:"Standard Innovation Inc.",646:"RF Code, Inc.",647:"Wally Ventures S.L.",648:"Willowbank Electronics Ltd",649:"SK Telecom",650:"Jetro AS",651:"Code Gears LTD",652:"NANOLINK APS",653:"IF, LLC",654:"RF Digital Corp",655:"Church & Dwight Co., Inc",656:"Multibit Oy",657:"CliniCloud Inc",658:"SwiftSensors",659:"Blue Bite",660:"ELIAS GmbH",661:"Sivantos GmbH",662:"Petzl",663:"storm power ltd",664:"EISST Ltd",665:"Inexess Technology Simma KG",666:"Currant, Inc.",667:"C2 Development, Inc.",668:"Blue Sky Scientific, LLC",669:"ALOTTAZS LABS, LLC",670:"Kupson spol. s r.o.",671:"Areus Engineering GmbH",672:"Impossible Camera GmbH",673:"InventureTrack Systems",674:"LockedUp",675:"Itude",676:"Pacific Lock Company",677:"Tendyron Corporation ( )",678:"Robert Bosch GmbH",679:"Illuxtron international B.V.",680:"miSport Ltd.",681:"Chargelib",682:"Doppler Lab",683:"BBPOS Limited",684:"RTB Elektronik GmbH & Co. KG",685:"Rx Networks, Inc.",686:"WeatherFlow, Inc.",687:"Technicolor USA Inc.",688:"Bestechnic(Shanghai),Ltd",689:"Raden Inc",690:"JouZen Oy",691:"CLABER S.P.A.",692:"Hyginex, Inc.",693:"HANSHIN ELECTRIC RAILWAY CO.,LTD.",694:"Schneider Electric",695:"Oort Technologies LLC",696:"Chrono Therapeutics",697:"Rinnai Corporation",698:"Swissprime Technologies AG",699:"Koha.,Co.Ltd",700:"Genevac Ltd",701:"Chemtronics",702:"Seguro Technology Sp. z o.o.",703:"Redbird Flight Simulations",704:"Dash Robotics",705:"LINE Corporation",706:"Guillemot Corporation",707:"Techtronic Power Tools Technology Limited",708:"Wilson Sporting Goods",709:"Lenovo (Singapore) Pte Ltd. ( )",710:"Ayatan Sensors",711:"Electronics Tomorrow Limited",712:"VASCO Data Security International, Inc.",713:"PayRange Inc.",714:"ABOV Semiconductor",715:"AINA-Wireless Inc.",716:"Eijkelkamp Soil & Water",717:"BMA ergonomics b.v.",718:"Teva Branded Pharmaceutical Products R&D, Inc.",719:"Anima",720:"3M",721:"Empatica Srl",722:"Afero, Inc.",723:"Powercast Corporation",724:"Secuyou ApS",725:"OMRON Corporation",726:"Send Solutions",727:"NIPPON SYSTEMWARE CO.,LTD.",728:"Neosfar",729:"Fliegl Agrartechnik GmbH",730:"Gilvader",731:"Digi International Inc (R)",732:"DeWalch Technologies, Inc.",733:"Flint Rehabilitation Devices, LLC",734:"Samsung SDS Co., Ltd.",735:"Blur Product Development",736:"University of Michigan",737:"Victron Energy BV",738:"NTT docomo",739:"Carmanah Technologies Corp.",740:"Bytestorm Ltd.",741:"Espressif Incorporated ( () )",742:"Unwire",743:"Connected Yard, Inc.",744:"American Music Environments",745:"Sensogram Technologies, Inc.",746:"Fujitsu Limited",747:"Ardic Technology",748:"Delta Systems, Inc",749:"HTC Corporation",750:"Citizen Holdings Co., Ltd.",751:"SMART-INNOVATION.inc",752:"Blackrat Software",753:"The Idea Cave, LLC",754:"GoPro, Inc.",755:"AuthAir, Inc",756:"Vensi, Inc.",757:"Indagem Tech LLC",758:"Intemo Technologies",759:"DreamVisions co., Ltd.",760:"Runteq Oy Ltd",761:"IMAGINATION TECHNOLOGIES LTD",762:"CoSTAR TEchnologies",763:"Clarius Mobile Health Corp.",764:"Shanghai Frequen Microelectronics Co., Ltd.",765:"Uwanna, Inc.",766:"Lierda Science & Technology Group Co., Ltd.",767:"Silicon Laboratories",768:"World Moto Inc.",769:"Giatec Scientific Inc.",770:"Loop Devices, Inc",771:"IACA electronique",772:"Martians Inc",773:"Swipp ApS",774:"Life Laboratory Inc.",775:"FUJI INDUSTRIAL CO.,LTD.",776:"Surefire, LLC",777:"Dolby Labs",778:"Ellisys",779:"Magnitude Lighting Converters",780:"Hilti AG",781:"Devdata S.r.l.",782:"Deviceworx",783:"Shortcut Labs",784:"SGL Italia S.r.l.",785:"PEEQ DATA",786:"Ducere Technologies Pvt Ltd",787:"DiveNav, Inc.",788:"RIIG AI Sp. z o.o.",789:"Thermo Fisher Scientific",790:"AG Measurematics Pvt. Ltd.",791:"CHUO Electronics CO., LTD.",792:"Aspenta International",793:"Eugster Frismag AG",794:"Amber wireless GmbH",795:"HQ Inc",796:"Lab Sensor Solutions",797:"Enterlab ApS",798:"Eyefi, Inc.",799:"MetaSystem S.p.A.",800:"SONO ELECTRONICS. CO., LTD",801:"Jewelbots",802:"Compumedics Limited",803:"Rotor Bike Components",804:"Astro, Inc.",805:"Amotus Solutions",806:"Healthwear Technologies (Changzhou)Ltd",807:"Essex Electronics",808:"Grundfos A/S",809:"Eargo, Inc.",810:"Electronic Design Lab",811:"ESYLUX",812:"NIPPON SMT.CO.,Ltd",813:"BM innovations GmbH",814:"indoormap",815:"OttoQ Inc",816:"North Pole Engineering",817:"3flares Technologies Inc.",818:"Electrocompaniet A.S.",819:"Mul-T-Lock",820:"Corentium AS",821:"Enlighted Inc",822:"GISTIC",823:"AJP2 Holdings, LLC",824:"COBI GmbH",825:"Blue Sky Scientific, LLC",826:"Appception, Inc.",827:"Courtney Thorne Limited",828:"Virtuosys",829:"TPV Technology Limited",830:"Monitra SA",831:"Automation Components, Inc.",832:"Letsense s.r.l.",833:"Etesian Technologies LLC",834:"GERTEC BRASIL LTDA.",835:"Drekker Development Pty. Ltd.",836:"Whirl Inc",837:"Locus Positioning",838:"Acuity Brands Lighting, Inc",839:"Prevent Biometrics",840:"Arioneo",841:"VersaMe",842:"Vaddio",843:"Libratone A/S",844:"HM Electronics, Inc.",845:"TASER International, Inc.",846:"SafeTrust Inc.",847:"Heartland Payment Systems",848:"Bitstrata Systems Inc.",849:"Pieps GmbH",850:"iRiding(Xiamen)Technology Co.,Ltd.",851:"Alpha Audiotronics, Inc.",852:"TOPPAN FORMS CO.,LTD.",853:"Sigma Designs, Inc.",854:"Spectrum Brands, Inc.",855:"Polymap Wireless",856:"MagniWare Ltd.",857:"Novotec Medical GmbH",858:"Medicom Innovation Partner a/s",859:"Matrix Inc.",860:"Eaton Corporation",861:"KYS",862:"Naya Health, Inc.",863:"Acromag",864:"Insulet Corporation",865:"Wellinks Inc.",866:"ON Semiconductor",867:"FREELAP SA",868:"Favero Electronics Srl",869:"BioMech Sensor LLC",870:"BOLTT Sports technologies Private limited",871:"Saphe International",872:"Metormote AB",873:"littleBits",874:"SetPoint Medical",875:"BRControls Products BV",876:"Zipcar",877:"AirBolt Pty Ltd",878:"KeepTruckin Inc",879:"Motiv, Inc.",880:"Wazombi Labs O",881:"ORBCOMM",882:"Nixie Labs, Inc.",883:"AppNearMe Ltd",884:"Holman Industries",885:"Expain AS",886:"Electronic Temperature Instruments Ltd",887:"Plejd AB",888:"Propeller Health",889:"Shenzhen iMCO Electronic Technology Co.,Ltd",890:"Algoria",891:"Apption Labs Inc.",892:"Cronologics Corporation",893:"MICRODIA Ltd.",894:"lulabytes S.L.",895:"Nestec S.A.",896:"LLC MEGA - F service",897:"Sharp Corporation",898:"Precision Outcomes Ltd",899:"Kronos Incorporated",900:"OCOSMOS Co., Ltd.",901:"Embedded Electronic Solutions Ltd. dba e2Solutions",902:"Aterica Inc.",903:"BluStor PMC, Inc.",904:"Kapsch TrafficCom AB",905:"ActiveBlu Corporation",906:"Kohler Mira Limited",907:"Noke",908:"Appion Inc.",909:"Resmed Ltd",910:"Crownstone B.V.",911:"Xiaomi Inc.",912:"INFOTECH s.r.o.",913:"Thingsquare AB",914:"T&D",915:"LAVAZZA S.p.A.",916:"Netclearance Systems, Inc.",917:"SDATAWAY",918:"BLOKS GmbH",919:"LEGO System A/S",920:"Thetatronics Ltd",921:"Nikon Corporation",922:"NeST",923:"South Silicon Valley Microelectronics",924:"ALE International",925:"CareView Communications, Inc.",926:"SchoolBoard Limited",927:"Molex Corporation",928:"IVT Wireless Limited",929:"Alpine Labs LLC",930:"Candura Instruments",931:"SmartMovt Technology Co., Ltd",932:"Token Zero Ltd",933:"ACE CAD Enterprise Co., Ltd. (ACECAD)",934:"Medela, Inc",935:"AeroScout",936:"Esrille Inc.",937:"THINKERLY SRL",938:"Exon Sp. z o.o.",939:"Meizu Technology Co., Ltd.",940:"Smablo LTD",941:"XiQ",942:"Allswell Inc.",943:"Comm-N-Sense Corp DBA Verigo",944:"VIBRADORM GmbH",945:"Otodata Wireless Network Inc.",946:"Propagation Systems Limited",947:"Midwest Instruments & Controls",948:"Alpha Nodus, inc.",949:"petPOMM, Inc",950:"Mattel",951:"Airbly Inc.",952:"A-Safe Limited",953:"FREDERIQUE CONSTANT SA",954:"Maxscend Microelectronics Company Limited",955:"Abbott Diabetes Care",956:"ASB Bank Ltd",957:"amadas",958:"Applied Science, Inc.",959:"iLumi Solutions Inc.",960:"Arch Systems Inc.",961:"Ember Technologies, Inc.",962:"Snapchat Inc",963:"Casambi Technologies Oy",964:"Pico Technology Inc.",965:"St. Jude Medical, Inc.",966:"Intricon",967:"Structural Health Systems, Inc.",968:"Avvel International",969:"Gallagher Group",970:"In2things Automation Pvt. Ltd.",971:"SYSDEV Srl",972:"Vonkil Technologies Ltd",973:"Wynd Technologies, Inc.",974:"CONTRINEX S.A.",975:"MIRA, Inc.",976:"Watteam Ltd",977:"Density Inc.",978:"IOT Pot India Private Limited",979:"Sigma Connectivity AB",980:"PEG PEREGO SPA",981:"Wyzelink Systems Inc.",982:"Yota Devices LTD",983:"FINSECUR",984:"Zen-Me Labs Ltd",985:"3IWare Co., Ltd.",986:"EnOcean GmbH",987:"Instabeat, Inc",988:"Nima Labs",989:"Andreas Stihl AG & Co. KG",990:"Nathan Rhoades LLC",991:"Grob Technologies, LLC",992:"Actions (Zhuhai) Technology Co., Limited",993:"SPD Development Company Ltd",994:"Sensoan Oy",995:"Qualcomm Life Inc",996:"Chip-ing AG",997:"ffly4u",998:"IoT Instruments Oy",999:"TRUE Fitness Technology",1e3:"Reiner Kartengeraete GmbH & Co. KG.",1001:"SHENZHEN LEMONJOY TECHNOLOGY CO., LTD.",1002:"Hello Inc.",1003:"Evollve Inc.",1004:"Jigowatts Inc.",1005:"BASIC MICRO.COM,INC.",1006:"CUBE TECHNOLOGIES",1007:"foolography GmbH",1008:"CLINK",1009:"Hestan Smart Cooking Inc.",1010:"WindowMaster A/S",1011:"Flowscape AB",1012:"PAL Technologies Ltd",1013:"WHERE, Inc.",1014:"Iton Technology Corp.",1015:"Owl Labs Inc.",1016:"Rockford Corp.",1017:"Becon Technologies Co.,Ltd.",1018:"Vyassoft Technologies Inc",1019:"Nox Medical",1020:"Kimberly-Clark",1021:"Trimble Navigation Ltd.",1022:"Littelfuse",1023:"Withings",1024:"i-developer IT Beratung UG",1026:"Sears Holdings Corporation",1027:"Gantner Electronic GmbH",1028:"Authomate Inc",1029:"Vertex International, Inc.",1030:"Airtago",1031:"Swiss Audio SA",1032:"ToGetHome Inc.",1033:"AXIS",1034:"Openmatics",1035:"Jana Care Inc.",1036:"Senix Corporation",1037:"NorthStar Battery Company, LLC",1038:"SKF (U.K.) Limited",1039:"CO-AX Technology, Inc.",1040:"Fender Musical Instruments",1041:"Luidia Inc",1042:"SEFAM",1043:"Wireless Cables Inc",1044:"Lightning Protection International Pty Ltd",1045:"Uber Technologies Inc",1046:"SODA GmbH",1047:"Fatigue Science",1048:"Alpine Electronics Inc.",1049:"Novalogy LTD",1050:"Friday Labs Limited",1051:"OrthoAccel Technologies",1052:"WaterGuru, Inc.",1053:"Benning Elektrotechnik und Elektronik GmbH & Co. KG",1054:"Dell Computer Corporation",1055:"Kopin Corporation",1056:"TecBakery GmbH",1057:"Backbone Labs, Inc.",1058:"DELSEY SA",1059:"Chargifi Limited",1060:"Trainesense Ltd.",1061:"Unify Software and Solutions GmbH & Co. KG",1062:"Husqvarna AB",1063:"Focus fleet and fuel management inc",1064:"SmallLoop, LLC",1065:"Prolon Inc.",1066:"BD Medical",1067:"iMicroMed Incorporated",1068:"Ticto N.V.",1069:"Meshtech AS",1070:"MemCachier Inc.",1071:"Danfoss A/S",1072:"SnapStyk Inc.",1073:"Amyway Corporation",1074:"Silk Labs, Inc.",1075:"Pillsy Inc.",1076:"Hatch Baby, Inc.",1077:"Blocks Wearables Ltd.",1078:"Drayson Technologies (Europe) Limited",1079:"eBest IOT Inc.",1080:"Helvar Ltd",1081:"Radiance Technologies",1082:"Nuheara Limited",1083:"Appside co., ltd.",1084:"DeLaval",1085:"Coiler Corporation",1086:"Thermomedics, Inc.",1087:"Tentacle Sync GmbH",1088:"Valencell, Inc.",1089:"iProtoXi Oy",1090:"SECOM CO., LTD.",1091:"Tucker International LLC",1092:"Metanate Limited",1093:"Kobian Canada Inc.",1094:"NETGEAR, Inc.",1095:"Fabtronics Australia Pty Ltd",1096:"Grand Centrix GmbH",1097:"1UP USA.com llc",1098:"SHIMANO INC.",1099:"Nain Inc.",1100:"LifeStyle Lock, LLC",1101:"VEGA Grieshaber KG",1102:"Xtrava Inc.",1103:"TTS Tooltechnic Systems AG & Co. KG",1104:"Teenage Engineering AB",1105:"Tunstall Nordic AB",1106:"Svep Design Center AB",1107:"GreenPeak Technologies BV",1108:"Sphinx Electronics GmbH & Co KG",1109:"Atomation",1110:"Nemik Consulting Inc",1111:"RF INNOVATION",1112:"Mini Solution Co., Ltd.",1113:"Lumenetix, Inc",1114:"2048450 Ontario Inc",1115:"SPACEEK LTD",1116:"Delta T Corporation",1117:"Boston Scientific Corporation",1118:"Nuviz, Inc.",1119:"Real Time Automation, Inc.",1120:"Kolibree",1121:"vhf elektronik GmbH",1122:"Bonsai Systems GmbH",1123:"Fathom Systems Inc.",1124:"Bellman & Symfon",1125:"International Forte Group LLC",1126:"CycleLabs Solutions inc.",1127:"Codenex Oy",1128:"Kynesim Ltd",1129:"Palago AB",1130:"INSIGMA INC.",1131:"PMD Solutions",1132:"Qingdao Realtime Technology Co., Ltd.",1133:"BEGA Gantenbrink-Leuchten KG",1134:"Pambor Ltd.",65535:"SPECIAL USE/DEFAULT"}});var L$r=I(F$r=>{"use strict";var Lbo=_e("child_process").exec,Ubo=_e("child_process").execSync,Qbo=_e("path"),sI=Uh(),jbo=M$r(),$bo=_e("fs"),LO=process.platform,Gbo=LO==="linux"||LO==="android",qbo=LO==="darwin",Hbo=LO==="win32",Vbo=LO==="freebsd",Wbo=LO==="openbsd",zbo=LO==="netbsd",Ybo=LO==="sunos";function O4t(t){let e="";return t.indexOf("keyboard")>=0&&(e="Keyboard"),t.indexOf("mouse")>=0&&(e="Mouse"),t.indexOf("trackpad")>=0&&(e="Trackpad"),t.indexOf("speaker")>=0&&(e="Speaker"),t.indexOf("headset")>=0&&(e="Headset"),t.indexOf("phone")>=0&&(e="Phone"),t.indexOf("macbook")>=0&&(e="Computer"),t.indexOf("imac")>=0&&(e="Computer"),t.indexOf("ipad")>=0&&(e="Tablet"),t.indexOf("watch")>=0&&(e="Watch"),t.indexOf("headphone")>=0&&(e="Headset"),e}function Kbo(t){let e=t.split(" ")[0];return t=t.toLowerCase(),t.indexOf("apple")>=0&&(e="Apple"),t.indexOf("ipad")>=0&&(e="Apple"),t.indexOf("imac")>=0&&(e="Apple"),t.indexOf("iphone")>=0&&(e="Apple"),t.indexOf("magic mouse")>=0&&(e="Apple"),t.indexOf("magic track")>=0&&(e="Apple"),t.indexOf("macbook")>=0&&(e="Apple"),e}function Xbo(t){let e=parseInt(t);if(!isNaN(e))return jbo[e]}function Jbo(t,e,r){let n={};return n.device=null,n.name=sI.getValue(t,"name","="),n.manufacturer=null,n.macDevice=e,n.macHost=r,n.batteryPercent=null,n.type=O4t(n.name.toLowerCase()),n.connected=!1,n}function N4t(t,e){let r={},n=((t.device_minorClassOfDevice_string||t.device_majorClassOfDevice_string||t.device_minorType||"")+(t.device_name||"")).toLowerCase();return r.device=t.device_services||"",r.name=t.device_name||"",r.manufacturer=t.device_manufacturer||Xbo(t.device_vendorID)||Kbo(t.device_name||"")||"",r.macDevice=(t.device_addr||t.device_address||"").toLowerCase().replace(/-/g,":"),r.macHost=e,r.batteryPercent=t.device_batteryPercent||null,r.type=O4t(n),r.connected=t.device_isconnected==="attrib_Yes"||!1,r}function Zbo(t){let e={};return e.device=null,e.name=sI.getValue(t,"name",":"),e.manufacturer=sI.getValue(t,"manufacturer",":"),e.macDevice=null,e.macHost=null,e.batteryPercent=null,e.type=O4t(e.name.toLowerCase()),e.connected=null,e}function e4o(t){return new Promise(e=>{process.nextTick(()=>{let r=[];if(Gbo){sI.getFilesInPath("/var/lib/bluetooth/").forEach(o=>{let s=Qbo.basename(o),a=o.split("/"),c=a.length>=6?a[a.length-2]:null,u=a.length>=7?a[a.length-3]:null;if(s==="info"){let d=$bo.readFileSync(o,{encoding:"utf8"}).split(`
870
870
  `);r.push(Jbo(d,c,u))}});try{let o=Ubo("hcitool con",sI.execOptsLinux).toString().toLowerCase();for(let s=0;s<r.length;s++)r[s].macDevice&&r[s].macDevice.length>10&&o.indexOf(r[s].macDevice.toLowerCase())>=0&&(r[s].connected=!0)}catch{sI.noop()}t&&t(r),e(r)}qbo&&Lbo("system_profiler SPBluetoothDataType -json",function(o,s){if(!o)try{let a=JSON.parse(s.toString());if(a.SPBluetoothDataType&&a.SPBluetoothDataType.length&&a.SPBluetoothDataType[0]&&a.SPBluetoothDataType[0].device_title&&a.SPBluetoothDataType[0].device_title.length){let c=null;a.SPBluetoothDataType[0].local_device_title&&a.SPBluetoothDataType[0].local_device_title.general_address&&(c=a.SPBluetoothDataType[0].local_device_title.general_address.toLowerCase().replace(/-/g,":")),a.SPBluetoothDataType[0].device_title.forEach(u=>{let d=u,f=Object.keys(d);if(f&&f.length===1){let p=d[f[0]];p.device_name=f[0];let h=N4t(p,c);r.push(h)}})}if(a.SPBluetoothDataType&&a.SPBluetoothDataType.length&&a.SPBluetoothDataType[0]&&a.SPBluetoothDataType[0].device_connected&&a.SPBluetoothDataType[0].device_connected.length){let c=a.SPBluetoothDataType[0].controller_properties&&a.SPBluetoothDataType[0].controller_properties.controller_address?a.SPBluetoothDataType[0].controller_properties.controller_address.toLowerCase().replace(/-/g,":"):null;a.SPBluetoothDataType[0].device_connected.forEach(u=>{let d=u,f=Object.keys(d);if(f&&f.length===1){let p=d[f[0]];p.device_name=f[0],p.device_isconnected="attrib_Yes";let h=N4t(p,c);r.push(h)}})}if(a.SPBluetoothDataType&&a.SPBluetoothDataType.length&&a.SPBluetoothDataType[0]&&a.SPBluetoothDataType[0].device_not_connected&&a.SPBluetoothDataType[0].device_not_connected.length){let c=a.SPBluetoothDataType[0].controller_properties&&a.SPBluetoothDataType[0].controller_properties.controller_address?a.SPBluetoothDataType[0].controller_properties.controller_address.toLowerCase().replace(/-/g,":"):null;a.SPBluetoothDataType[0].device_not_connected.forEach(u=>{let d=u,f=Object.keys(d);if(f&&f.length===1){let p=d[f[0]];p.device_name=f[0],p.device_isconnected="attrib_No";let h=N4t(p,c);r.push(h)}})}}catch{sI.noop()}t&&t(r),e(r)}),Hbo&&sI.powerShell("Get-CimInstance Win32_PNPEntity | select PNPClass, Name, Manufacturer | fl").then((n,o)=>{o||n.toString().split(/\n\s*\n/).forEach(a=>{sI.getValue(a.split(`
871
871
  `),"PNPClass",":")==="Bluetooth"&&r.push(Zbo(a.split(`
872
- `)))}),t&&t(r),e(r)}),(Vbo||zbo||Wbo||Ybo)&&e(null)})})}F$r.bluetoothDevices=e4o});var K$r=I(di=>{"use strict";var t4o=tjr().version,QO=Uh(),UO=_jr(),aI=r4t(),ab=xjr(),gPe=Bjr(),U$r=Fjr(),Q$r=$jr(),qw=Wjr(),cI=t$r(),APe=s$r(),Sge=l$r(),j$r=f$r(),B4t=y$r(),Aj=b$r(),r4o=S$r(),$$r=I$r(),G$r=k$r(),q$r=B$r(),H$r=L$r(),xge=process.platform,mPe=xge==="win32",vge=xge==="freebsd",bge=xge==="openbsd",Cge=xge==="netbsd",Gw=xge==="sunos";mPe&&(QO.getCodepage(),QO.getPowershell());function V$r(){return t4o}function W$r(t){return new Promise(e=>{process.nextTick(()=>{let r={};r.version=V$r(),Promise.all([UO.system(),UO.bios(),UO.baseboard(),UO.chassis(),aI.osInfo(),aI.uuid(),aI.versions(),ab.cpu(),ab.cpuFlags(),Q$r.graphics(),cI.networkInterfaces(),gPe.memLayout(),qw.diskLayout(),q$r.audio(),H$r.bluetoothDevices(),G$r.usb(),$$r.printer()]).then(n=>{r.system=n[0],r.bios=n[1],r.baseboard=n[2],r.chassis=n[3],r.os=n[4],r.uuid=n[5],r.versions=n[6],r.cpu=n[7],r.cpu.flags=n[8],r.graphics=n[9],r.net=n[10],r.memLayout=n[11],r.diskLayout=n[12],r.audio=n[13],r.bluetooth=n[14],r.usb=n[15],r.printer=n[16],t&&t(r),e(r)})})})}function z$r(t,e,r){return QO.isFunction(e)&&(r=e,e=""),QO.isFunction(t)&&(r=t,t=""),new Promise(n=>{process.nextTick(()=>{e=e||cI.getDefaultNetworkInterface(),t=t||"";let o=(function(){let a=15;return mPe&&(a=13),(vge||bge||Cge)&&(a=11),Gw&&(a=6),function(){--a===0&&(r&&r(s),n(s))}})(),s={};s.time=aI.time(),s.node=process.versions.node,s.v8=process.versions.v8,ab.cpuCurrentSpeed().then(a=>{s.cpuCurrentSpeed=a,o()}),j$r.users().then(a=>{s.users=a,o()}),Sge.processes().then(a=>{s.processes=a,o()}),ab.currentLoad().then(a=>{s.currentLoad=a,o()}),Gw||ab.cpuTemperature().then(a=>{s.temp=a,o()}),!bge&&!vge&&!Cge&&!Gw&&cI.networkStats(e).then(a=>{s.networkStats=a,o()}),Gw||cI.networkConnections().then(a=>{s.networkConnections=a,o()}),gPe.mem().then(a=>{s.mem=a,o()}),Gw||U$r().then(a=>{s.battery=a,o()}),Gw||Sge.services(t).then(a=>{s.services=a,o()}),Gw||qw.fsSize().then(a=>{s.fsSize=a,o()}),!mPe&&!bge&&!vge&&!Cge&&!Gw&&qw.fsStats().then(a=>{s.fsStats=a,o()}),!mPe&&!bge&&!vge&&!Cge&&!Gw&&qw.disksIO().then(a=>{s.disksIO=a,o()}),!bge&&!vge&&!Cge&&!Gw&&APe.wifiNetworks().then(a=>{s.wifiNetworks=a,o()}),B4t.inetLatency().then(a=>{s.inetLatency=a,o()})})})}function n4o(t,e,r){return new Promise(n=>{process.nextTick(()=>{let o={};e&&QO.isFunction(e)&&!r&&(r=e,e=""),t&&QO.isFunction(t)&&!e&&!r&&(r=t,t="",e=""),W$r().then(s=>{o=s,z$r(t,e).then(a=>{for(let c in a)({}).hasOwnProperty.call(a,c)&&(o[c]=a[c]);r&&r(o),n(o)})})})})}function Y$r(t,e){return new Promise(r=>{process.nextTick(()=>{let n=Object.keys(t).filter(o=>({}).hasOwnProperty.call(di,o)).map(o=>{let s=t[o].substring(t[o].lastIndexOf("(")+1,t[o].lastIndexOf(")")),a=o.indexOf(")")>=0?o.split(")")[1].trim():o;return a=o.indexOf("|")>=0?o.split("|")[0].trim():a,s?di[a](s):di[a]("")});Promise.all(n).then(o=>{let s={},a=0;for(let c in t)if({}.hasOwnProperty.call(t,c)&&{}.hasOwnProperty.call(di,c)&&o.length>a){if(t[c]==="*"||t[c]==="all")s[c]=o[a];else{let u=t[c],d="",f=[];if(u.indexOf(")")>=0&&(u=u.split(")")[1].trim()),u.indexOf("|")>=0&&(d=u.split("|")[1].trim(),f=d.split(":"),u=u.split("|")[0].trim()),u=u.replace(/,/g," ").replace(/ +/g," ").split(" "),o[a])if(Array.isArray(o[a])){let p=[];o[a].forEach(h=>{let m={};if(u.length===1&&(u[0]==="*"||u[0]==="all")?m=h:u.forEach(g=>{({}).hasOwnProperty.call(h,g)&&(m[g]=h[g])}),d&&f.length===2){if({}.hasOwnProperty.call(m,f[0].trim())){let g=m[f[0].trim()];typeof g=="number"?g===parseFloat(f[1].trim())&&p.push(m):typeof g=="string"&&g.toLowerCase()===f[1].trim().toLowerCase()&&p.push(m)}}else p.push(m)}),s[c]=p}else{let p={};u.forEach(h=>{({}).hasOwnProperty.call(o[a],h)&&(p[h]=o[a][h])}),s[c]=p}else s[c]={}}a++}e&&e(s),r(s)})})})}function i4o(t,e,r){let n=null;return setInterval(()=>{Y$r(t).then(s=>{JSON.stringify(n)!==JSON.stringify(s)&&(n=Object.assign({},s),r(s))})},e)}di.version=V$r;di.system=UO.system;di.bios=UO.bios;di.baseboard=UO.baseboard;di.chassis=UO.chassis;di.time=aI.time;di.osInfo=aI.osInfo;di.versions=aI.versions;di.shell=aI.shell;di.uuid=aI.uuid;di.cpu=ab.cpu;di.cpuFlags=ab.cpuFlags;di.cpuCache=ab.cpuCache;di.cpuCurrentSpeed=ab.cpuCurrentSpeed;di.cpuTemperature=ab.cpuTemperature;di.currentLoad=ab.currentLoad;di.fullLoad=ab.fullLoad;di.mem=gPe.mem;di.memLayout=gPe.memLayout;di.battery=U$r;di.graphics=Q$r.graphics;di.fsSize=qw.fsSize;di.fsOpenFiles=qw.fsOpenFiles;di.blockDevices=qw.blockDevices;di.fsStats=qw.fsStats;di.disksIO=qw.disksIO;di.diskLayout=qw.diskLayout;di.networkInterfaceDefault=cI.networkInterfaceDefault;di.networkGatewayDefault=cI.networkGatewayDefault;di.networkInterfaces=cI.networkInterfaces;di.networkStats=cI.networkStats;di.networkConnections=cI.networkConnections;di.wifiNetworks=APe.wifiNetworks;di.wifiInterfaces=APe.wifiInterfaces;di.wifiConnections=APe.wifiConnections;di.services=Sge.services;di.processes=Sge.processes;di.processLoad=Sge.processLoad;di.users=j$r.users;di.inetChecksite=B4t.inetChecksite;di.inetLatency=B4t.inetLatency;di.dockerInfo=Aj.dockerInfo;di.dockerImages=Aj.dockerImages;di.dockerContainers=Aj.dockerContainers;di.dockerContainerStats=Aj.dockerContainerStats;di.dockerContainerProcesses=Aj.dockerContainerProcesses;di.dockerVolumes=Aj.dockerVolumes;di.dockerAll=Aj.dockerAll;di.vboxInfo=r4o.vboxInfo;di.printer=$$r.printer;di.usb=G$r.usb;di.audio=q$r.audio;di.bluetoothDevices=H$r.bluetoothDevices;di.getStaticData=W$r;di.getDynamicData=z$r;di.getAllData=n4o;di.get=Y$r;di.observe=i4o;di.powerShellStart=QO.powerShellStart;di.powerShellRelease=QO.powerShellRelease});async function P4t(){try{let{displays:t}=await X$r.default.graphics();if(!t?.length)return"-";let e=t.find(o=>o.main)||t[0],r=e.currentResX||e.resolutionX,n=e.currentResY||e.resolutionY;return r&&n?`${r}x${n}`:"-"}catch{return"-"}}var X$r,M4t=q(()=>{"use strict";X$r=we(K$r(),1)});async function yPe(){let t=new AbortController,e=setTimeout(()=>t.abort(),3e3);try{let o=(await(await fetch("https://log.mmstat.com/v.gif",{signal:t.signal})).headers.getSetCookie()).find(s=>s.startsWith("cna="));return o?o.split(";")?.[0]?.split("=")?.[1]:void 0}catch{return}finally{clearTimeout(e)}}async function J$r({cna:t,userId:e,iFlowEnv:r}){if(!(!t||process.env.DISABLE_SEND_PV))try{let n=process.env.IFLOW_NON_INTERACTIVE==="true",s="global"==="aone",a=await P4t(),c;s?c=n?"a21111a.39011320.0.0.0":"a21111a.39011391.0.0.0":c=n?"a2110qe.33796382.46182003.0.0":"a2110qe.32214347.46097794.0.0";let u=["logtype=1","title=iFlow-CLI","pre=-",`scr=${a}`,`cna=${t}`,`spm-cnt=${c}`,"aplus","pid=iflow",`_user_id=${e}`,`cache=${Math.floor(268435456*Math.random()).toString(16)}`,"sidx=aplusSidex","ckx=aplusCkx",`platformType=${process.env.IFLOW_RUN_IN||"pc"}`,`device_model=${a4o[process.platform]||process.platform}`,`os=${o4o[process.platform]||process.platform}`,`o=${s4o[process.platform]||process.platform}`,`node_version=${process.version}`,`language=${process.env.LANG}`,`interactive=${n?0:1}`,`iFlowEnv=${r}`,"_g_encode=utf-8"].join("&");await fetch("https://log.mmstat.com/v.gif",{method:"POST",headers:{"content-type":"text/plain;charset=UTF-8","cache-control":"no-cache"},body:u})}catch{}}var o4o,s4o,a4o,F4t=q(()=>{"use strict";M4t();o4o={darwin:encodeURIComponent("Mac OS X"),win32:"Windows",linux:"Linux"},s4o={darwin:"mac",win32:"win"},a4o={darwin:"Macintosh",win32:"Windows",linux:"Linux"}});async function L4t(t,e,r){let n=wBe();try{let o=process.env.IFLOW_ENV||"",s=t.getCna();J$r({cna:s,userId:n,iFlowEnv:o})}catch(o){t.getDebugMode()&&console.error("Failed to send pv",o)}try{if(t.getDisableTelemetry())return;let o=t.getSessionId();IQr(t,n),await dO.startSession(o,n,e,r)}catch(o){t.getDebugMode()&&console.error("Failed to initialize CLI telemetry:",o)}}async function wge(t){try{if(t.getDisableTelemetry())return;await dO.endSession()}catch(e){t.getDebugMode()&&console.error("Failed to cleanup CLI telemetry:",e)}}async function _Pe(t,e){if(!t.getDisableTelemetry())try{await dO.recordError(e)}catch(r){t.getDebugMode()&&console.error("Failed to record CLI error in telemetry:",r.message)}}async function EPe(t,e,r){try{await dO.recordError(r,{toolName:t,toolArgs:e})}catch{}}var U4t=q(()=>{"use strict";BBe();Qbt();F4t();Ng();});import{EventEmitter as c4o}from"events";var l4o,u4o,vPe,w2,Q4t=q(()=>{"use strict";pZ();l4o=()=>({api:{totalRequests:0,totalErrors:0,totalLatencyMs:0},tokens:{prompt:0,candidates:0,total:0,cached:0,thoughts:0,tool:0}}),u4o=()=>({models:{},tools:{totalCalls:0,totalSuccess:0,totalFail:0,totalDurationMs:0,totalDecisions:{accept:0,reject:0,modify:0},byName:{}}}),vPe=class extends c4o{#e=u4o();#t=0;#r=!1;addEvent(e){switch(e["event.name"]){case Wme:this.processApiResponse(e);break;case Vme:this.processApiError(e);break;case Hme:this.processToolCall(e);break;default:return}this.emit("update",{metrics:this.#e,lastPromptTokenCount:this.#t})}getMetrics(){return this.#e}getLastPromptTokenCount(){return this.#t}resetLastPromptTokenCount(){this.#t=0,this.emit("update",{metrics:this.#e,lastPromptTokenCount:this.#t})}pauseTokenCountUpdates(e){this.#r=e}getOrCreateModelMetrics(e){return this.#e.models[e]||(this.#e.models[e]=l4o()),this.#e.models[e]}processApiResponse(e){let r=this.getOrCreateModelMetrics(e.model);r.api.totalRequests++,r.api.totalLatencyMs+=e.duration_ms,r.tokens.prompt+=e.input_token_count,r.tokens.candidates+=e.output_token_count,r.tokens.total+=e.total_token_count,r.tokens.cached+=e.cached_content_token_count,r.tokens.thoughts+=e.thoughts_token_count,r.tokens.tool+=e.tool_token_count,this.#r||(this.#t=e.input_token_count)}processApiError(e){let r=this.getOrCreateModelMetrics(e.model);r.api.totalRequests++,r.api.totalErrors++,r.api.totalLatencyMs+=e.duration_ms}processToolCall(e){let{tools:r}=this.#e;r.totalCalls++,r.totalDurationMs+=e.duration_ms,e.success?r.totalSuccess++:r.totalFail++,r.byName[e.function_name]||(r.byName[e.function_name]={count:0,success:0,fail:0,durationMs:0,decisions:{accept:0,reject:0,modify:0}});let n=r.byName[e.function_name];n.count++,n.durationMs+=e.duration_ms,e.success?n.success++:n.fail++,e.decision&&(r.totalDecisions[e.decision]++,n.decisions[e.decision]++)}},w2=new vPe});import{existsSync as j4t,mkdirSync as d4o,writeFileSync as Z$r,readFileSync as f4o}from"fs";import{dirname as p4o,join as h4o}from"path";import{randomUUID as m4o}from"crypto";function eGr(){let t=s3(process.cwd());return h4o(t,"errors",tGr(new Date)+".txt")}function tGr(t){return t.toISOString().replace(/[:.]/g,"-")}var Tge,g4o,bPe,iee,$4t=q(()=>{"use strict";vu();Tge=[],g4o=100,bPe=m4o();iee=class{config;constructor(e){this.config={enabled:!0,maxInMemoryErrors:g4o,enableFileLogging:!1,...e}}logError(e,r){try{let n=e instanceof Error?e.stack||e.message:String(e),o=e instanceof Error?e.constructor.name:"Unknown",s={error:n,timestamp:new Date().toISOString()};Tge.length>=this.config.maxInMemoryErrors&&Tge.shift(),Tge.push(s),this.config.enableFileLogging&&this.appendToLog(eGr(),{error:n,errorType:o,context:r})}catch{}}getInMemoryErrors(){return[...Tge]}getFileErrors(){return this.readLog(eGr())}clearLogs(){Tge.length=0}getConfig(){return{...this.config}}generateGitHubIssueUrl(e,r){let o=e.replace("{title}",encodeURIComponent(r.title)).replace("{problem}",encodeURIComponent(r.problem)).replace("{expected}",encodeURIComponent(r.expected)).replace("{info}",encodeURIComponent(r.info)).replace("{loginInfo}",encodeURIComponent(r.loginInfo||"")).replace("{additionalContext}",encodeURIComponent(r.additionalContext||""));if(o.length>2e3){let s={...r};o.length>2e3&&s.problem.length>500&&(s.problem=s.problem.substring(0,500)+"... (truncated)",o=e.replace("{title}",encodeURIComponent(s.title)).replace("{problem}",encodeURIComponent(s.problem)).replace("{expected}",encodeURIComponent(s.expected)).replace("{info}",encodeURIComponent(s.info)).replace("{loginInfo}",encodeURIComponent(s.loginInfo||"")).replace("{additionalContext}",encodeURIComponent(s.additionalContext||""))),o.length>2e3&&s.additionalContext&&s.additionalContext.length>300&&(s.additionalContext=s.additionalContext.substring(0,300)+"... (truncated)",o=e.replace("{title}",encodeURIComponent(s.title)).replace("{problem}",encodeURIComponent(s.problem)).replace("{expected}",encodeURIComponent(s.expected)).replace("{info}",encodeURIComponent(s.info)).replace("{loginInfo}",encodeURIComponent(s.loginInfo||"")).replace("{additionalContext}",encodeURIComponent(s.additionalContext))),o.length>2e3&&s.problem.length>200&&(s.problem=s.problem.substring(0,200)+"... (truncated)",o=e.replace("{title}",encodeURIComponent(s.title)).replace("{problem}",encodeURIComponent(s.problem)).replace("{expected}",encodeURIComponent(s.expected)).replace("{info}",encodeURIComponent(s.info)).replace("{loginInfo}",encodeURIComponent(s.loginInfo||"")).replace("{additionalContext}",encodeURIComponent(s.additionalContext||"")))}return o}readLog(e){if(!j4t(e))return[];try{return JSON.parse(f4o(e,"utf8"))}catch{return[]}}appendToLog(e,r){if(process.env.USER_TYPE==="external")return;let n=p4o(e);j4t(n)||d4o(n,{recursive:!0}),j4t(e)||Z$r(e,"[]","utf8");let o=this.readLog(e),s={...r,cwd:process.cwd(),userType:process.env.USER_TYPE,sessionId:bPe,timestamp:new Date().toISOString(),version:process.env.npm_package_version||"unknown"};o.push(s),Z$r(e,JSON.stringify(o,null,2),"utf8")}}});function yj(){return oee||(oee=new iee),oee}function G4t(t){oee||(oee=new iee(t))}function Ly(t,e){try{yj().logError(t,e)}catch{console.error("Failed to log error:",t)}}function A4o(){try{return yj().getInMemoryErrors()}catch{return[]}}function y4o(){try{return yj().getFileErrors()}catch{return[]}}function _4o(){try{yj().clearLogs()}catch{}}function E4o(t){oee=t}var oee,CPe=q(()=>{"use strict";$4t();oee=null});function yS(t){return{"session.id":t.getSessionId(),pwd:process.cwd()}}function b4o(t,e){let r=e instanceof Error&&e.message?e.message:String(e);Ly(new Error(`Telemetry ${t} failed: ${r}`))}function _S(t,e){try{e()}catch(r){b4o(t,r)}}function rGr(t,e){_S("logCliConfiguration",()=>{if(Im.getInstance(t)?.logStartSessionEvent(e),!J0())return;let r={...yS(t),"event.name":RUr,"event.timestamp":new Date().toISOString(),model:e.model,embedding_model:e.embedding_model,sandbox_enabled:e.sandbox_enabled,core_tools_enabled:e.core_tools_enabled,approval_mode:e.approval_mode,api_key_enabled:e.api_key_enabled,vertex_ai_enabled:e.vertex_ai_enabled,log_user_prompts_enabled:e.telemetry_log_user_prompts_enabled,file_filtering_respect_git_ignore:e.file_filtering_respect_git_ignore,debug_mode:e.debug_enabled,mcp_servers:e.mcp_servers},n=cb.logs.getLogger(Lh),o={body:"CLI configuration loaded.",attributes:r};n.emit(o)})}function see(t,e){_S("logUserPrompt",()=>{if(Im.getInstance(t)?.logNewPromptEvent(e),!J0())return;let r={...yS(t),"event.name":IUr,"event.timestamp":new Date().toISOString(),prompt_length:e.prompt_length};v4o(t)&&(r.prompt=e.prompt);let n=cb.logs.getLogger(Lh),o={body:`User prompt. Length: ${e.prompt_length}.`,attributes:r};n.emit(o)})}function lb(t,e){_S("logToolCall",()=>{let r={...e,function_args:typeof e.function_args=="string"?e.function_args:ij(e.function_args)},n={...r,"event.name":Hme,"event.timestamp":new Date().toISOString()};if(w2.addEvent(n),Im.getInstance(t)?.logToolCallEvent(r),!J0())return;let o={...yS(t),...r,"event.name":Hme,"event.timestamp":new Date().toISOString()};e.error&&(o["error.message"]=e.error,o["error.type"]=e.error_type);let s=cb.logs.getLogger(Lh),a={body:`Tool call: ${e.function_name}${e.decision?`. Decision: ${e.decision}`:""}. Success: ${e.success}. Duration: ${e.duration_ms}ms.`,attributes:o};s.emit(a);let c,u="main_agent";e.function_name.startsWith("mcp_")||e.server_name&&e.server_name!==""?c="mcp":e.function_name==="task"||["Task","agent","Agent","subagent","subAgent","SubAgent"].includes(e.function_name)?c="task":c="builtin",e.prompt_id&&(e.prompt_id.startsWith("subagent-")||e.prompt_id.startsWith("subagent-call_"))&&(u="subagent"),c==="mcp"?CQr(t,e.function_name,e.duration_ms,e.success,e.decision,u):c==="builtin"&&SQr(t,e.function_name,e.duration_ms,e.success,e.decision,u),bQr(t,e.function_name,e.duration_ms,e.success,e.decision,c)})}function SPe(t,e){_S("logApiRequest",()=>{if(Im.getInstance(t)?.logApiRequestEvent(e),!J0())return;let r={...t?yS(t):{},"event.name":DUr,"event.timestamp":new Date().toISOString(),model:e.model,prompt_id:e.prompt_id,request_text:e.request_text,base_url:e.base_url,openai_request:e.openai_request},n=cb.logs.getLogger(Lh),o={body:`API request to ${e.model}.`,attributes:r};n.emit(o)})}function xPe(t,e){_S("logFlashFallback",()=>{if(Im.getInstance(t)?.logFlashFallbackEvent(e),!J0())return;let r={...yS(t),...e,"event.name":kUr,"event.timestamp":new Date().toISOString()},n=cb.logs.getLogger(Lh),o={body:"Switching to flash as Fallback.",attributes:r};n.emit(o)})}function Uy(t,e){_S("logApiError",()=>{let r={...e,"event.name":Vme,"event.timestamp":new Date().toISOString()};if(w2.addEvent(r),Im.getInstance(t)?.logApiErrorEvent(e),!J0())return;let n={...yS(t),...e,"event.name":Vme,"event.timestamp":new Date().toISOString(),"error.message":e.error,model_name:e.model,duration:e.duration_ms};e.error_type&&(n["error.type"]=e.error_type),typeof e.status_code=="number"&&(n[lX.HTTP_STATUS_CODE]=e.status_code);let o=cb.logs.getLogger(Lh),s={body:`API error for ${e.model}. Error: ${e.error}. Duration: ${e.duration_ms}ms.`,attributes:n};o.emit(s),wQr(t,e.model,e.duration_ms,e.status_code,e.error_type,e.http_status_code,e.business_code)})}function wPe(t,e){_S("logApiResponse",()=>{let r={...e,"event.name":Wme,"event.timestamp":new Date().toISOString()};if(w2.addEvent(r),Im.getInstance(t)?.logApiResponseEvent(e),!J0())return;let n={...yS(t),...e,"event.name":Wme,"event.timestamp":new Date().toISOString()};e.response_text&&(n.response_text=e.response_text),e.error?n["error.message"]=e.error:e.status_code&&typeof e.status_code=="number"&&(n[lX.HTTP_STATUS_CODE]=e.status_code);let o=cb.logs.getLogger(Lh),s={body:`API response from ${e.model}. Status: ${e.status_code||"N/A"}. Duration: ${e.duration_ms}ms.`,attributes:n};o.emit(s),xQr(t,e.model,e.duration_ms,e.business_code||e.status_code,e.error,e.finish_reason,e.http_status_code,e.business_code),xZ(t,e.model,e.input_token_count,"input"),xZ(t,e.model,e.output_token_count,"output"),xZ(t,e.model,e.cached_content_token_count,"cache"),xZ(t,e.model,e.thoughts_token_count,"thought"),xZ(t,e.model,e.tool_token_count,"tool")})}function TPe(t,e){_S("logLoopDetected",()=>{if(Im.getInstance(t)?.logLoopDetectedEvent(e),!J0())return;let r={...yS(t),...e},n=cb.logs.getLogger(Lh),o={body:`Loop detected. Type: ${e.loop_type}.`,attributes:r};n.emit(o),RQr(t,e.loop_type,e.prompt_id)})}function nGr(t,e){_S("logNextSpeakerCheck",()=>{if(Im.getInstance(t)?.logNextSpeakerCheck(e),!J0())return;let r={...yS(t),...e,"event.name":NUr},n=cb.logs.getLogger(Lh),o={body:"Next speaker check.",attributes:r};n.emit(o)})}function aee(t,e){_S("logSlashCommand",()=>{if(Im.getInstance(t)?.logSlashCommandEvent(e),!J0())return;let r={...yS(t),...e,"event.name":OUr},n=cb.logs.getLogger(Lh),o={body:`Slash command: ${e.command}.`,attributes:r};n.emit(o)})}function IPe(t){_S("logCliResponse",()=>{if(!J0())return;let e={...yS(t),"event.name":BUr,"event.timestamp":new Date().toISOString()},r=cb.logs.getLogger(Lh),n={body:"CLI response.",attributes:e};r.emit(n)})}var cb,v4o,Ige=q(()=>{"use strict";cb=we(LX(),1);xm();pZ();Ng();ege();Q4t();Xme();EBe();CPe();v4o=t=>t.getTelemetryLogPromptsEnabled()});function iGr(t){if(!t.length)return"";let e=t[t.length-1],r=t[t.length-2];if(e?.role==="tool"&&e?.tool_call_id&&r?.tool_calls&&Array.isArray(r.tool_calls)){let n=r.tool_calls.find(o=>o.id===e.tool_call_id);if(n?.function?.name)return n.function.name}return""}var oGr=q(()=>{"use strict";});function _j(t,e){if(e&&e>0)return e;if(!t||typeof t!="string")return 128e3;let r=t.toLowerCase();if(sGr[t])return sGr[t];for(let n of C4o)if(n.pattern.test(r)){for(let[o,s]of Object.entries(n.limits))if(o!=="default"&&r.includes(o))return s;return n.limits.default??n.defaultLimit??128e3}return 128e3}function q4t(t,e=0,r){if(!t||typeof t!="string")return 8e3;let n=t.toLowerCase(),o=8e3;if(aGr[t])o=aGr[t];else for(let s of S4o)if(s.pattern.test(n)){for(let[a,c]of Object.entries(s.limits))if(a!=="default"&&n.includes(a)){o=c;break}o===8e3&&(o=s.limits.default??s.defaultLimit??8e3);break}return o}var mrc,C4o,sGr,S4o,aGr,Dge=q(()=>{"use strict";mrc=128e3,C4o=[{pattern:/kimi/i,limits:{"k2-0905":256e3,"k2-thinking":256e3,k2:128e3}},{pattern:/minimax/i,limits:{default:128e3}},{pattern:/glm/i,limits:{"4.6":2e5,"4.5":128e3},defaultLimit:128e3},{pattern:/sonnet/i,limits:{},defaultLimit:2e5},{pattern:/claude/i,limits:{},defaultLimit:2e5},{pattern:/deepseek/i,limits:{v3:128e3,default:65e3}},{pattern:/qwen3/i,limits:{coder:256e3,thinking:2e5,instruct:2e5,"max-preview":256e3,default:128e3}},{pattern:/qwen/i,limits:{max:1228e3,plus:1228e3}},{pattern:/gpt/i,limits:{"32k":32e3,default:128e3}},{pattern:/mimo/i,limits:{default:256e3}}],sGr={"gemini-1.5-pro":2097152,"gemini-1.5-flash":1048576,"gemini-2.5-pro-preview-05-06":1048576,"gemini-2.5-pro-preview-06-05":1048576,"gemini-2.5-pro":1048576,"gemini-2.5-flash-preview-05-20":1048576,"gemini-2.5-flash":1048576,"gemini-2.0-flash":1048576,"gemini-2.0-flash-preview-image-generation":32e3},S4o=[{pattern:/kimi/i,limits:{"k2-0905":32e3,"k2-thinking":32e3,"ide-modelscope":8192,default:32e3}},{pattern:/minimax/i,limits:{default:64e3}},{pattern:/glm/i,limits:{"ide-modelscope":16384},defaultLimit:64e3},{pattern:/claude/i,limits:{},defaultLimit:64e3},{pattern:/sonnet/i,limits:{},defaultLimit:64e3},{pattern:/deepseek|seek/i,limits:{"v3.2-reasoner":64e3,v3:8192,r1:32e3,default:8e3}},{pattern:/qwen3/i,limits:{coder:64e3,"max-preview":32e3,default:8192}},{pattern:/qwen/i,limits:{max:8192,plus:8192,default:8e3}},{pattern:/gpt/i,limits:{"32k":4096,default:16384}},{pattern:/mimo/i,limits:{default:64e3}}],aGr={"gemini-1.5-pro":8192,"gemini-1.5-flash":65536,"gemini-2.5-pro-preview-05-06":65536,"gemini-2.5-pro-preview-06-05":65536,"gemini-2.5-pro":65536,"gemini-2.5-flash-preview-05-20":65536,"gemini-2.5-flash":65536,"gemini-2.0-flash":65536,"gemini-2.0-flash-preview-image-generation":8192}});var cGr={};ls(cGr,{MultimodalHelper:()=>Hw});import x4o from"crypto";var Hw,Rge=q(()=>{"use strict";Hw=class t{apiKey;baseUrl;modelName;isIFlowMode;isAoneMode;static descriptionCache=new Map;constructor(e,r,n,o=!1,s=!1){this.apiKey=e,this.baseUrl=r,this.modelName=n||"",this.isIFlowMode=o,this.isAoneMode=s}generateCacheKey(e,r,n=""){let o=`${e}|${r}|${n}`;return x4o.createHash("sha256").update(o).digest("hex")}async generateImageDescription(e,r){if(!this.isIFlowMode&&!this.modelName)throw new Error("No multimodal model specified for image description");let n=this.generateCacheKey(e,r),o=t.descriptionCache.get(n);if(o)return o;let s=this.createImageAnalysisPrompt();try{let a=this.isIFlowMode&&(this.baseUrl==="https://apis.iflow.cn/v1"||this.baseUrl.includes("iflow"))?"qwen3-vl-plus":this.modelName;a=this.isAoneMode&&this.baseUrl==="https://ducky.code.alibaba-inc.com/v1/openai"?"Qwen2.5-VL-72B_aone":a;let c={model:a,messages:[{role:"user",content:[{type:"text",text:s},{type:"image_url",image_url:{url:`data:${r};base64,${e}`}}]}],temperature:.1,max_tokens:2e3},u=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl,d=await fetch(`${u}/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"user-agent":"iFlow-Cli-MultimodalHelper"},body:JSON.stringify(c)});if(!d.ok){let m=await d.text();throw new Error(`API error! status: ${d.status}, body: ${m} TraceID: ${d.headers.get("eagleeye-traceid")}`)}let f;try{f=await d.json()}catch{throw new Error(`Response format error. TraceID: ${d.headers.get("eagleeye-traceid")}`)}if(f.msg&&f.msg.includes("invalid apiKey"))throw new Error("Invalid API key provided for model");let p=f.choices?.[0]?.message?.content;if(!p)throw new Error("No description generated by model");let h=p.trim();return t.descriptionCache.set(n,h),h}catch(a){throw new Error(`Image description error: ${a instanceof Error?a.message:String(a)}`)}}async generateImageDescriptionFromPrompt(e,r,n){if(!this.isIFlowMode&&!this.modelName)throw new Error("No multimodal model specified for image description");let o=this.generateCacheKey(e,r,n),s=t.descriptionCache.get(o);if(s)return s;try{let a=this.isIFlowMode&&(this.baseUrl==="https://apis.iflow.cn/v1"||this.baseUrl.includes("iflow"))?"qwen3-vl-plus":this.modelName;a=this.isAoneMode&&this.baseUrl==="https://ducky.code.alibaba-inc.com/v1/openai"?"Qwen2.5-VL-72B_aone":a;let c={model:a,messages:[{role:"user",content:[{type:"text",text:n},{type:"image_url",image_url:{url:`data:${r};base64,${e}`}}]}],temperature:.1,max_tokens:2e3},u=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl,d=await fetch(`${u}/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"user-agent":"iFlow-Cli-MultimodalHelper"},body:JSON.stringify(c)});if(!d.ok){let m=await d.text();throw new Error(`API error! status: ${d.status}, body: ${m} TraceID: ${d.headers.get("eagleeye-traceid")}`)}let f;try{f=await d.json()}catch{throw new Error(`Response format error. TraceID: ${d.headers.get("eagleeye-traceid")}`)}if(f.msg&&f.msg.includes("invalid apiKey"))throw new Error("Invalid API key provided for model");let p=f.choices?.[0]?.message?.content;if(!p)throw new Error("No description generated by model");let h=p.trim();return t.descriptionCache.set(o,h),h}catch(a){throw new Error(`Image description error: ${a instanceof Error?a.message:String(a)}`)}}async generateContextAwareImageDescription(e,r,n){let o=this.createContextAwarePrompt(n);return await this.generateImageDescriptionFromPrompt(e,r,o)}createContextAwarePrompt(e){let r=this.createImageAnalysisPrompt();return!e||e.trim()===""?r:`${r}
872
+ `)))}),t&&t(r),e(r)}),(Vbo||zbo||Wbo||Ybo)&&e(null)})})}F$r.bluetoothDevices=e4o});var K$r=I(di=>{"use strict";var t4o=tjr().version,QO=Uh(),UO=_jr(),aI=r4t(),ab=xjr(),gPe=Bjr(),U$r=Fjr(),Q$r=$jr(),qw=Wjr(),cI=t$r(),APe=s$r(),Sge=l$r(),j$r=f$r(),B4t=y$r(),Aj=b$r(),r4o=S$r(),$$r=I$r(),G$r=k$r(),q$r=B$r(),H$r=L$r(),xge=process.platform,mPe=xge==="win32",vge=xge==="freebsd",bge=xge==="openbsd",Cge=xge==="netbsd",Gw=xge==="sunos";mPe&&(QO.getCodepage(),QO.getPowershell());function V$r(){return t4o}function W$r(t){return new Promise(e=>{process.nextTick(()=>{let r={};r.version=V$r(),Promise.all([UO.system(),UO.bios(),UO.baseboard(),UO.chassis(),aI.osInfo(),aI.uuid(),aI.versions(),ab.cpu(),ab.cpuFlags(),Q$r.graphics(),cI.networkInterfaces(),gPe.memLayout(),qw.diskLayout(),q$r.audio(),H$r.bluetoothDevices(),G$r.usb(),$$r.printer()]).then(n=>{r.system=n[0],r.bios=n[1],r.baseboard=n[2],r.chassis=n[3],r.os=n[4],r.uuid=n[5],r.versions=n[6],r.cpu=n[7],r.cpu.flags=n[8],r.graphics=n[9],r.net=n[10],r.memLayout=n[11],r.diskLayout=n[12],r.audio=n[13],r.bluetooth=n[14],r.usb=n[15],r.printer=n[16],t&&t(r),e(r)})})})}function z$r(t,e,r){return QO.isFunction(e)&&(r=e,e=""),QO.isFunction(t)&&(r=t,t=""),new Promise(n=>{process.nextTick(()=>{e=e||cI.getDefaultNetworkInterface(),t=t||"";let o=(function(){let a=15;return mPe&&(a=13),(vge||bge||Cge)&&(a=11),Gw&&(a=6),function(){--a===0&&(r&&r(s),n(s))}})(),s={};s.time=aI.time(),s.node=process.versions.node,s.v8=process.versions.v8,ab.cpuCurrentSpeed().then(a=>{s.cpuCurrentSpeed=a,o()}),j$r.users().then(a=>{s.users=a,o()}),Sge.processes().then(a=>{s.processes=a,o()}),ab.currentLoad().then(a=>{s.currentLoad=a,o()}),Gw||ab.cpuTemperature().then(a=>{s.temp=a,o()}),!bge&&!vge&&!Cge&&!Gw&&cI.networkStats(e).then(a=>{s.networkStats=a,o()}),Gw||cI.networkConnections().then(a=>{s.networkConnections=a,o()}),gPe.mem().then(a=>{s.mem=a,o()}),Gw||U$r().then(a=>{s.battery=a,o()}),Gw||Sge.services(t).then(a=>{s.services=a,o()}),Gw||qw.fsSize().then(a=>{s.fsSize=a,o()}),!mPe&&!bge&&!vge&&!Cge&&!Gw&&qw.fsStats().then(a=>{s.fsStats=a,o()}),!mPe&&!bge&&!vge&&!Cge&&!Gw&&qw.disksIO().then(a=>{s.disksIO=a,o()}),!bge&&!vge&&!Cge&&!Gw&&APe.wifiNetworks().then(a=>{s.wifiNetworks=a,o()}),B4t.inetLatency().then(a=>{s.inetLatency=a,o()})})})}function n4o(t,e,r){return new Promise(n=>{process.nextTick(()=>{let o={};e&&QO.isFunction(e)&&!r&&(r=e,e=""),t&&QO.isFunction(t)&&!e&&!r&&(r=t,t="",e=""),W$r().then(s=>{o=s,z$r(t,e).then(a=>{for(let c in a)({}).hasOwnProperty.call(a,c)&&(o[c]=a[c]);r&&r(o),n(o)})})})})}function Y$r(t,e){return new Promise(r=>{process.nextTick(()=>{let n=Object.keys(t).filter(o=>({}).hasOwnProperty.call(di,o)).map(o=>{let s=t[o].substring(t[o].lastIndexOf("(")+1,t[o].lastIndexOf(")")),a=o.indexOf(")")>=0?o.split(")")[1].trim():o;return a=o.indexOf("|")>=0?o.split("|")[0].trim():a,s?di[a](s):di[a]("")});Promise.all(n).then(o=>{let s={},a=0;for(let c in t)if({}.hasOwnProperty.call(t,c)&&{}.hasOwnProperty.call(di,c)&&o.length>a){if(t[c]==="*"||t[c]==="all")s[c]=o[a];else{let u=t[c],d="",f=[];if(u.indexOf(")")>=0&&(u=u.split(")")[1].trim()),u.indexOf("|")>=0&&(d=u.split("|")[1].trim(),f=d.split(":"),u=u.split("|")[0].trim()),u=u.replace(/,/g," ").replace(/ +/g," ").split(" "),o[a])if(Array.isArray(o[a])){let p=[];o[a].forEach(h=>{let m={};if(u.length===1&&(u[0]==="*"||u[0]==="all")?m=h:u.forEach(g=>{({}).hasOwnProperty.call(h,g)&&(m[g]=h[g])}),d&&f.length===2){if({}.hasOwnProperty.call(m,f[0].trim())){let g=m[f[0].trim()];typeof g=="number"?g===parseFloat(f[1].trim())&&p.push(m):typeof g=="string"&&g.toLowerCase()===f[1].trim().toLowerCase()&&p.push(m)}}else p.push(m)}),s[c]=p}else{let p={};u.forEach(h=>{({}).hasOwnProperty.call(o[a],h)&&(p[h]=o[a][h])}),s[c]=p}else s[c]={}}a++}e&&e(s),r(s)})})})}function i4o(t,e,r){let n=null;return setInterval(()=>{Y$r(t).then(s=>{JSON.stringify(n)!==JSON.stringify(s)&&(n=Object.assign({},s),r(s))})},e)}di.version=V$r;di.system=UO.system;di.bios=UO.bios;di.baseboard=UO.baseboard;di.chassis=UO.chassis;di.time=aI.time;di.osInfo=aI.osInfo;di.versions=aI.versions;di.shell=aI.shell;di.uuid=aI.uuid;di.cpu=ab.cpu;di.cpuFlags=ab.cpuFlags;di.cpuCache=ab.cpuCache;di.cpuCurrentSpeed=ab.cpuCurrentSpeed;di.cpuTemperature=ab.cpuTemperature;di.currentLoad=ab.currentLoad;di.fullLoad=ab.fullLoad;di.mem=gPe.mem;di.memLayout=gPe.memLayout;di.battery=U$r;di.graphics=Q$r.graphics;di.fsSize=qw.fsSize;di.fsOpenFiles=qw.fsOpenFiles;di.blockDevices=qw.blockDevices;di.fsStats=qw.fsStats;di.disksIO=qw.disksIO;di.diskLayout=qw.diskLayout;di.networkInterfaceDefault=cI.networkInterfaceDefault;di.networkGatewayDefault=cI.networkGatewayDefault;di.networkInterfaces=cI.networkInterfaces;di.networkStats=cI.networkStats;di.networkConnections=cI.networkConnections;di.wifiNetworks=APe.wifiNetworks;di.wifiInterfaces=APe.wifiInterfaces;di.wifiConnections=APe.wifiConnections;di.services=Sge.services;di.processes=Sge.processes;di.processLoad=Sge.processLoad;di.users=j$r.users;di.inetChecksite=B4t.inetChecksite;di.inetLatency=B4t.inetLatency;di.dockerInfo=Aj.dockerInfo;di.dockerImages=Aj.dockerImages;di.dockerContainers=Aj.dockerContainers;di.dockerContainerStats=Aj.dockerContainerStats;di.dockerContainerProcesses=Aj.dockerContainerProcesses;di.dockerVolumes=Aj.dockerVolumes;di.dockerAll=Aj.dockerAll;di.vboxInfo=r4o.vboxInfo;di.printer=$$r.printer;di.usb=G$r.usb;di.audio=q$r.audio;di.bluetoothDevices=H$r.bluetoothDevices;di.getStaticData=W$r;di.getDynamicData=z$r;di.getAllData=n4o;di.get=Y$r;di.observe=i4o;di.powerShellStart=QO.powerShellStart;di.powerShellRelease=QO.powerShellRelease});async function P4t(){try{let{displays:t}=await X$r.default.graphics();if(!t?.length)return"-";let e=t.find(o=>o.main)||t[0],r=e.currentResX||e.resolutionX,n=e.currentResY||e.resolutionY;return r&&n?`${r}x${n}`:"-"}catch{return"-"}}var X$r,M4t=q(()=>{"use strict";X$r=we(K$r(),1)});async function yPe(){let t=new AbortController,e=setTimeout(()=>t.abort(),3e3);try{let o=(await(await fetch("https://log.mmstat.com/v.gif",{signal:t.signal})).headers.getSetCookie()).find(s=>s.startsWith("cna="));return o?o.split(";")?.[0]?.split("=")?.[1]:void 0}catch{return}finally{clearTimeout(e)}}async function J$r({cna:t,userId:e,iFlowEnv:r}){if(!(!t||process.env.DISABLE_SEND_PV))try{let n=process.env.IFLOW_NON_INTERACTIVE==="true",s="global"==="aone",a=await P4t(),c;s?c=n?"a21111a.39011320.0.0.0":"a21111a.39011391.0.0.0":c=n?"a2110qe.33796382.46182003.0.0":"a2110qe.32214347.46097794.0.0";let u=["logtype=1","title=iFlow-CLI","pre=-",`scr=${a}`,`cna=${t}`,`spm-cnt=${c}`,"aplus","pid=iflow",`_user_id=${e}`,`cache=${Math.floor(268435456*Math.random()).toString(16)}`,"sidx=aplusSidex","ckx=aplusCkx",`platformType=${process.env.IFLOW_RUN_IN||"pc"}`,`device_model=${a4o[process.platform]||process.platform}`,`os=${o4o[process.platform]||process.platform}`,`o=${s4o[process.platform]||process.platform}`,`node_version=${process.version}`,`language=${process.env.LANG}`,`interactive=${n?0:1}`,`iFlowEnv=${r}`,"_g_encode=utf-8"].join("&");await fetch("https://log.mmstat.com/v.gif",{method:"POST",headers:{"content-type":"text/plain;charset=UTF-8","cache-control":"no-cache"},body:u})}catch{}}var o4o,s4o,a4o,F4t=q(()=>{"use strict";M4t();o4o={darwin:encodeURIComponent("Mac OS X"),win32:"Windows",linux:"Linux"},s4o={darwin:"mac",win32:"win"},a4o={darwin:"Macintosh",win32:"Windows",linux:"Linux"}});async function L4t(t,e,r){let n=wBe();try{let o=process.env.IFLOW_ENV||"",s=t.getCna();J$r({cna:s,userId:n,iFlowEnv:o})}catch(o){t.getDebugMode()&&console.error("Failed to send pv",o)}try{if(t.getDisableTelemetry())return;let o=t.getSessionId();IQr(t,n),await dO.startSession(o,n,e,r)}catch(o){t.getDebugMode()&&console.error("Failed to initialize CLI telemetry:",o)}}async function wge(t){try{if(t.getDisableTelemetry())return;await dO.endSession()}catch(e){t.getDebugMode()&&console.error("Failed to cleanup CLI telemetry:",e)}}async function _Pe(t,e){if(!t.getDisableTelemetry())try{await dO.recordError(e)}catch(r){t.getDebugMode()&&console.error("Failed to record CLI error in telemetry:",r.message)}}async function EPe(t,e,r){try{await dO.recordError(r,{toolName:t,toolArgs:e})}catch{}}var U4t=q(()=>{"use strict";BBe();Qbt();F4t();Ng();});import{EventEmitter as c4o}from"events";var l4o,u4o,vPe,w2,Q4t=q(()=>{"use strict";pZ();l4o=()=>({api:{totalRequests:0,totalErrors:0,totalLatencyMs:0},tokens:{prompt:0,candidates:0,total:0,cached:0,thoughts:0,tool:0}}),u4o=()=>({models:{},tools:{totalCalls:0,totalSuccess:0,totalFail:0,totalDurationMs:0,totalDecisions:{accept:0,reject:0,modify:0},byName:{}}}),vPe=class extends c4o{#e=u4o();#t=0;#r=!1;addEvent(e){switch(e["event.name"]){case Wme:this.processApiResponse(e);break;case Vme:this.processApiError(e);break;case Hme:this.processToolCall(e);break;default:return}this.emit("update",{metrics:this.#e,lastPromptTokenCount:this.#t})}getMetrics(){return this.#e}getLastPromptTokenCount(){return this.#t}resetLastPromptTokenCount(){this.#t=0,this.emit("update",{metrics:this.#e,lastPromptTokenCount:this.#t})}pauseTokenCountUpdates(e){this.#r=e}getOrCreateModelMetrics(e){return this.#e.models[e]||(this.#e.models[e]=l4o()),this.#e.models[e]}processApiResponse(e){let r=this.getOrCreateModelMetrics(e.model);r.api.totalRequests++,r.api.totalLatencyMs+=e.duration_ms,r.tokens.prompt+=e.input_token_count,r.tokens.candidates+=e.output_token_count,r.tokens.total+=e.total_token_count,r.tokens.cached+=e.cached_content_token_count,r.tokens.thoughts+=e.thoughts_token_count,r.tokens.tool+=e.tool_token_count,this.#r||(this.#t=e.input_token_count)}processApiError(e){let r=this.getOrCreateModelMetrics(e.model);r.api.totalRequests++,r.api.totalErrors++,r.api.totalLatencyMs+=e.duration_ms}processToolCall(e){let{tools:r}=this.#e;r.totalCalls++,r.totalDurationMs+=e.duration_ms,e.success?r.totalSuccess++:r.totalFail++,r.byName[e.function_name]||(r.byName[e.function_name]={count:0,success:0,fail:0,durationMs:0,decisions:{accept:0,reject:0,modify:0}});let n=r.byName[e.function_name];n.count++,n.durationMs+=e.duration_ms,e.success?n.success++:n.fail++,e.decision&&(r.totalDecisions[e.decision]++,n.decisions[e.decision]++)}},w2=new vPe});import{existsSync as j4t,mkdirSync as d4o,writeFileSync as Z$r,readFileSync as f4o}from"fs";import{dirname as p4o,join as h4o}from"path";import{randomUUID as m4o}from"crypto";function eGr(){let t=s3(process.cwd());return h4o(t,"errors",tGr(new Date)+".txt")}function tGr(t){return t.toISOString().replace(/[:.]/g,"-")}var Tge,g4o,bPe,iee,$4t=q(()=>{"use strict";vu();Tge=[],g4o=100,bPe=m4o();iee=class{config;constructor(e){this.config={enabled:!0,maxInMemoryErrors:g4o,enableFileLogging:!1,...e}}logError(e,r){try{let n=e instanceof Error?e.stack||e.message:String(e),o=e instanceof Error?e.constructor.name:"Unknown",s={error:n,timestamp:new Date().toISOString()};Tge.length>=this.config.maxInMemoryErrors&&Tge.shift(),Tge.push(s),this.config.enableFileLogging&&this.appendToLog(eGr(),{error:n,errorType:o,context:r})}catch{}}getInMemoryErrors(){return[...Tge]}getFileErrors(){return this.readLog(eGr())}clearLogs(){Tge.length=0}getConfig(){return{...this.config}}generateGitHubIssueUrl(e,r){let o=e.replace("{title}",encodeURIComponent(r.title)).replace("{problem}",encodeURIComponent(r.problem)).replace("{expected}",encodeURIComponent(r.expected)).replace("{info}",encodeURIComponent(r.info)).replace("{loginInfo}",encodeURIComponent(r.loginInfo||"")).replace("{additionalContext}",encodeURIComponent(r.additionalContext||""));if(o.length>2e3){let s={...r};o.length>2e3&&s.problem.length>500&&(s.problem=s.problem.substring(0,500)+"... (truncated)",o=e.replace("{title}",encodeURIComponent(s.title)).replace("{problem}",encodeURIComponent(s.problem)).replace("{expected}",encodeURIComponent(s.expected)).replace("{info}",encodeURIComponent(s.info)).replace("{loginInfo}",encodeURIComponent(s.loginInfo||"")).replace("{additionalContext}",encodeURIComponent(s.additionalContext||""))),o.length>2e3&&s.additionalContext&&s.additionalContext.length>300&&(s.additionalContext=s.additionalContext.substring(0,300)+"... (truncated)",o=e.replace("{title}",encodeURIComponent(s.title)).replace("{problem}",encodeURIComponent(s.problem)).replace("{expected}",encodeURIComponent(s.expected)).replace("{info}",encodeURIComponent(s.info)).replace("{loginInfo}",encodeURIComponent(s.loginInfo||"")).replace("{additionalContext}",encodeURIComponent(s.additionalContext))),o.length>2e3&&s.problem.length>200&&(s.problem=s.problem.substring(0,200)+"... (truncated)",o=e.replace("{title}",encodeURIComponent(s.title)).replace("{problem}",encodeURIComponent(s.problem)).replace("{expected}",encodeURIComponent(s.expected)).replace("{info}",encodeURIComponent(s.info)).replace("{loginInfo}",encodeURIComponent(s.loginInfo||"")).replace("{additionalContext}",encodeURIComponent(s.additionalContext||"")))}return o}readLog(e){if(!j4t(e))return[];try{return JSON.parse(f4o(e,"utf8"))}catch{return[]}}appendToLog(e,r){if(process.env.USER_TYPE==="external")return;let n=p4o(e);j4t(n)||d4o(n,{recursive:!0}),j4t(e)||Z$r(e,"[]","utf8");let o=this.readLog(e),s={...r,cwd:process.cwd(),userType:process.env.USER_TYPE,sessionId:bPe,timestamp:new Date().toISOString(),version:process.env.npm_package_version||"unknown"};o.push(s),Z$r(e,JSON.stringify(o,null,2),"utf8")}}});function yj(){return oee||(oee=new iee),oee}function G4t(t){oee||(oee=new iee(t))}function Ly(t,e){try{yj().logError(t,e)}catch{console.error("Failed to log error:",t)}}function A4o(){try{return yj().getInMemoryErrors()}catch{return[]}}function y4o(){try{return yj().getFileErrors()}catch{return[]}}function _4o(){try{yj().clearLogs()}catch{}}function E4o(t){oee=t}var oee,CPe=q(()=>{"use strict";$4t();oee=null});function yS(t){return{"session.id":t.getSessionId(),pwd:process.cwd()}}function b4o(t,e){let r=e instanceof Error&&e.message?e.message:String(e);Ly(new Error(`Telemetry ${t} failed: ${r}`))}function _S(t,e){try{e()}catch(r){b4o(t,r)}}function rGr(t,e){_S("logCliConfiguration",()=>{if(Im.getInstance(t)?.logStartSessionEvent(e),!J0())return;let r={...yS(t),"event.name":RUr,"event.timestamp":new Date().toISOString(),model:e.model,embedding_model:e.embedding_model,sandbox_enabled:e.sandbox_enabled,core_tools_enabled:e.core_tools_enabled,approval_mode:e.approval_mode,api_key_enabled:e.api_key_enabled,vertex_ai_enabled:e.vertex_ai_enabled,log_user_prompts_enabled:e.telemetry_log_user_prompts_enabled,file_filtering_respect_git_ignore:e.file_filtering_respect_git_ignore,debug_mode:e.debug_enabled,mcp_servers:e.mcp_servers},n=cb.logs.getLogger(Lh),o={body:"CLI configuration loaded.",attributes:r};n.emit(o)})}function see(t,e){_S("logUserPrompt",()=>{if(Im.getInstance(t)?.logNewPromptEvent(e),!J0())return;let r={...yS(t),"event.name":IUr,"event.timestamp":new Date().toISOString(),prompt_length:e.prompt_length};v4o(t)&&(r.prompt=e.prompt);let n=cb.logs.getLogger(Lh),o={body:`User prompt. Length: ${e.prompt_length}.`,attributes:r};n.emit(o)})}function lb(t,e){_S("logToolCall",()=>{let r={...e,function_args:typeof e.function_args=="string"?e.function_args:ij(e.function_args)},n={...r,"event.name":Hme,"event.timestamp":new Date().toISOString()};if(w2.addEvent(n),Im.getInstance(t)?.logToolCallEvent(r),!J0())return;let o={...yS(t),...r,"event.name":Hme,"event.timestamp":new Date().toISOString()};e.error&&(o["error.message"]=e.error,o["error.type"]=e.error_type);let s=cb.logs.getLogger(Lh),a={body:`Tool call: ${e.function_name}${e.decision?`. Decision: ${e.decision}`:""}. Success: ${e.success}. Duration: ${e.duration_ms}ms.`,attributes:o};s.emit(a);let c,u="main_agent";e.function_name.startsWith("mcp_")||e.server_name&&e.server_name!==""?c="mcp":e.function_name==="task"||["Task","agent","Agent","subagent","subAgent","SubAgent"].includes(e.function_name)?c="task":c="builtin",e.prompt_id&&(e.prompt_id.startsWith("subagent-")||e.prompt_id.startsWith("subagent-call_"))&&(u="subagent"),c==="mcp"?CQr(t,e.function_name,e.duration_ms,e.success,e.decision,u):c==="builtin"&&SQr(t,e.function_name,e.duration_ms,e.success,e.decision,u),bQr(t,e.function_name,e.duration_ms,e.success,e.decision,c)})}function SPe(t,e){_S("logApiRequest",()=>{if(Im.getInstance(t)?.logApiRequestEvent(e),!J0())return;let r={...t?yS(t):{},"event.name":DUr,"event.timestamp":new Date().toISOString(),model:e.model,prompt_id:e.prompt_id,request_text:e.request_text,base_url:e.base_url,openai_request:e.openai_request},n=cb.logs.getLogger(Lh),o={body:`API request to ${e.model}.`,attributes:r};n.emit(o)})}function xPe(t,e){_S("logFlashFallback",()=>{if(Im.getInstance(t)?.logFlashFallbackEvent(e),!J0())return;let r={...yS(t),...e,"event.name":kUr,"event.timestamp":new Date().toISOString()},n=cb.logs.getLogger(Lh),o={body:"Switching to flash as Fallback.",attributes:r};n.emit(o)})}function Uy(t,e){_S("logApiError",()=>{let r={...e,"event.name":Vme,"event.timestamp":new Date().toISOString()};if(w2.addEvent(r),Im.getInstance(t)?.logApiErrorEvent(e),!J0())return;let n={...yS(t),...e,"event.name":Vme,"event.timestamp":new Date().toISOString(),"error.message":e.error,model_name:e.model,duration:e.duration_ms};e.error_type&&(n["error.type"]=e.error_type),typeof e.status_code=="number"&&(n[lX.HTTP_STATUS_CODE]=e.status_code);let o=cb.logs.getLogger(Lh),s={body:`API error for ${e.model}. Error: ${e.error}. Duration: ${e.duration_ms}ms.`,attributes:n};o.emit(s),wQr(t,e.model,e.duration_ms,e.status_code,e.error_type,e.http_status_code,e.business_code)})}function wPe(t,e){_S("logApiResponse",()=>{let r={...e,"event.name":Wme,"event.timestamp":new Date().toISOString()};if(w2.addEvent(r),Im.getInstance(t)?.logApiResponseEvent(e),!J0())return;let n={...yS(t),...e,"event.name":Wme,"event.timestamp":new Date().toISOString()};e.response_text&&(n.response_text=e.response_text),e.error?n["error.message"]=e.error:e.status_code&&typeof e.status_code=="number"&&(n[lX.HTTP_STATUS_CODE]=e.status_code);let o=cb.logs.getLogger(Lh),s={body:`API response from ${e.model}. Status: ${e.status_code||"N/A"}. Duration: ${e.duration_ms}ms.`,attributes:n};o.emit(s),xQr(t,e.model,e.duration_ms,e.business_code||e.status_code,e.error,e.finish_reason,e.http_status_code,e.business_code),xZ(t,e.model,e.input_token_count,"input"),xZ(t,e.model,e.output_token_count,"output"),xZ(t,e.model,e.cached_content_token_count,"cache"),xZ(t,e.model,e.thoughts_token_count,"thought"),xZ(t,e.model,e.tool_token_count,"tool")})}function TPe(t,e){_S("logLoopDetected",()=>{if(Im.getInstance(t)?.logLoopDetectedEvent(e),!J0())return;let r={...yS(t),...e},n=cb.logs.getLogger(Lh),o={body:`Loop detected. Type: ${e.loop_type}.`,attributes:r};n.emit(o),RQr(t,e.loop_type,e.prompt_id)})}function nGr(t,e){_S("logNextSpeakerCheck",()=>{if(Im.getInstance(t)?.logNextSpeakerCheck(e),!J0())return;let r={...yS(t),...e,"event.name":NUr},n=cb.logs.getLogger(Lh),o={body:"Next speaker check.",attributes:r};n.emit(o)})}function aee(t,e){_S("logSlashCommand",()=>{if(Im.getInstance(t)?.logSlashCommandEvent(e),!J0())return;let r={...yS(t),...e,"event.name":OUr},n=cb.logs.getLogger(Lh),o={body:`Slash command: ${e.command}.`,attributes:r};n.emit(o)})}function IPe(t){_S("logCliResponse",()=>{if(!J0())return;let e={...yS(t),"event.name":BUr,"event.timestamp":new Date().toISOString()},r=cb.logs.getLogger(Lh),n={body:"CLI response.",attributes:e};r.emit(n)})}var cb,v4o,Ige=q(()=>{"use strict";cb=we(LX(),1);xm();pZ();Ng();ege();Q4t();Xme();EBe();CPe();v4o=t=>t.getTelemetryLogPromptsEnabled()});function iGr(t){if(!t.length)return"";let e=t[t.length-1],r=t[t.length-2];if(e?.role==="tool"&&e?.tool_call_id&&r?.tool_calls&&Array.isArray(r.tool_calls)){let n=r.tool_calls.find(o=>o.id===e.tool_call_id);if(n?.function?.name)return n.function.name}return""}var oGr=q(()=>{"use strict";});function _j(t,e){if(e&&e>0)return e;if(!t||typeof t!="string")return 128e3;let r=t.toLowerCase();if(sGr[t])return sGr[t];for(let n of C4o)if(n.pattern.test(r)){for(let[o,s]of Object.entries(n.limits))if(o!=="default"&&r.includes(o))return s;return n.limits.default??n.defaultLimit??128e3}return 128e3}function q4t(t,e=0,r){if(!t||typeof t!="string")return 8e3;let n=t.toLowerCase(),o=8e3;if(aGr[t])o=aGr[t];else for(let s of S4o)if(s.pattern.test(n)){for(let[a,c]of Object.entries(s.limits))if(a!=="default"&&n.includes(a)){o=c;break}o===8e3&&(o=s.limits.default??s.defaultLimit??8e3);break}return o}var mrc,C4o,sGr,S4o,aGr,Dge=q(()=>{"use strict";mrc=128e3,C4o=[{pattern:/kimi/i,limits:{"k2-0905":256e3,"k2-thinking":256e3,k2:128e3}},{pattern:/minimax/i,limits:{default:128e3}},{pattern:/glm/i,limits:{"4.7":2e5,"4.6":2e5,"4.5":128e3},defaultLimit:128e3},{pattern:/sonnet/i,limits:{},defaultLimit:2e5},{pattern:/claude/i,limits:{},defaultLimit:2e5},{pattern:/deepseek/i,limits:{v3:128e3,default:65e3}},{pattern:/qwen3/i,limits:{coder:256e3,thinking:2e5,instruct:2e5,"max-preview":256e3,default:128e3}},{pattern:/qwen/i,limits:{max:1228e3,plus:1228e3}},{pattern:/gpt/i,limits:{"32k":32e3,default:128e3}},{pattern:/mimo/i,limits:{default:256e3}}],sGr={"gemini-1.5-pro":2097152,"gemini-1.5-flash":1048576,"gemini-2.5-pro-preview-05-06":1048576,"gemini-2.5-pro-preview-06-05":1048576,"gemini-2.5-pro":1048576,"gemini-2.5-flash-preview-05-20":1048576,"gemini-2.5-flash":1048576,"gemini-2.0-flash":1048576,"gemini-2.0-flash-preview-image-generation":32e3},S4o=[{pattern:/kimi/i,limits:{"k2-0905":32e3,"k2-thinking":32e3,"ide-modelscope":8192,default:32e3}},{pattern:/minimax/i,limits:{default:64e3}},{pattern:/glm/i,limits:{"ide-modelscope":16384},defaultLimit:64e3},{pattern:/claude/i,limits:{},defaultLimit:64e3},{pattern:/sonnet/i,limits:{},defaultLimit:64e3},{pattern:/deepseek|seek/i,limits:{"v3.2-reasoner":64e3,v3:8192,r1:32e3,default:8e3}},{pattern:/qwen3/i,limits:{coder:64e3,"max-preview":32e3,default:8192}},{pattern:/qwen/i,limits:{max:8192,plus:8192,default:8e3}},{pattern:/gpt/i,limits:{"32k":4096,default:16384}},{pattern:/mimo/i,limits:{default:64e3}}],aGr={"gemini-1.5-pro":8192,"gemini-1.5-flash":65536,"gemini-2.5-pro-preview-05-06":65536,"gemini-2.5-pro-preview-06-05":65536,"gemini-2.5-pro":65536,"gemini-2.5-flash-preview-05-20":65536,"gemini-2.5-flash":65536,"gemini-2.0-flash":65536,"gemini-2.0-flash-preview-image-generation":8192}});var cGr={};ls(cGr,{MultimodalHelper:()=>Hw});import x4o from"crypto";var Hw,Rge=q(()=>{"use strict";Hw=class t{apiKey;baseUrl;modelName;isIFlowMode;isAoneMode;static descriptionCache=new Map;constructor(e,r,n,o=!1,s=!1){this.apiKey=e,this.baseUrl=r,this.modelName=n||"",this.isIFlowMode=o,this.isAoneMode=s}generateCacheKey(e,r,n=""){let o=`${e}|${r}|${n}`;return x4o.createHash("sha256").update(o).digest("hex")}async generateImageDescription(e,r){if(!this.isIFlowMode&&!this.modelName)throw new Error("No multimodal model specified for image description");let n=this.generateCacheKey(e,r),o=t.descriptionCache.get(n);if(o)return o;let s=this.createImageAnalysisPrompt();try{let a=this.isIFlowMode&&(this.baseUrl==="https://apis.iflow.cn/v1"||this.baseUrl.includes("iflow"))?"qwen3-vl-plus":this.modelName;a=this.isAoneMode&&this.baseUrl==="https://ducky.code.alibaba-inc.com/v1/openai"?"Qwen2.5-VL-72B_aone":a;let c={model:a,messages:[{role:"user",content:[{type:"text",text:s},{type:"image_url",image_url:{url:`data:${r};base64,${e}`}}]}],temperature:.1,max_tokens:2e3},u=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl,d=await fetch(`${u}/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"user-agent":"iFlow-Cli-MultimodalHelper"},body:JSON.stringify(c)});if(!d.ok){let m=await d.text();throw new Error(`API error! status: ${d.status}, body: ${m} TraceID: ${d.headers.get("eagleeye-traceid")}`)}let f;try{f=await d.json()}catch{throw new Error(`Response format error. TraceID: ${d.headers.get("eagleeye-traceid")}`)}if(f.msg&&f.msg.includes("invalid apiKey"))throw new Error("Invalid API key provided for model");let p=f.choices?.[0]?.message?.content;if(!p)throw new Error("No description generated by model");let h=p.trim();return t.descriptionCache.set(n,h),h}catch(a){throw new Error(`Image description error: ${a instanceof Error?a.message:String(a)}`)}}async generateImageDescriptionFromPrompt(e,r,n){if(!this.isIFlowMode&&!this.modelName)throw new Error("No multimodal model specified for image description");let o=this.generateCacheKey(e,r,n),s=t.descriptionCache.get(o);if(s)return s;try{let a=this.isIFlowMode&&(this.baseUrl==="https://apis.iflow.cn/v1"||this.baseUrl.includes("iflow"))?"qwen3-vl-plus":this.modelName;a=this.isAoneMode&&this.baseUrl==="https://ducky.code.alibaba-inc.com/v1/openai"?"Qwen2.5-VL-72B_aone":a;let c={model:a,messages:[{role:"user",content:[{type:"text",text:n},{type:"image_url",image_url:{url:`data:${r};base64,${e}`}}]}],temperature:.1,max_tokens:2e3},u=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl,d=await fetch(`${u}/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"user-agent":"iFlow-Cli-MultimodalHelper"},body:JSON.stringify(c)});if(!d.ok){let m=await d.text();throw new Error(`API error! status: ${d.status}, body: ${m} TraceID: ${d.headers.get("eagleeye-traceid")}`)}let f;try{f=await d.json()}catch{throw new Error(`Response format error. TraceID: ${d.headers.get("eagleeye-traceid")}`)}if(f.msg&&f.msg.includes("invalid apiKey"))throw new Error("Invalid API key provided for model");let p=f.choices?.[0]?.message?.content;if(!p)throw new Error("No description generated by model");let h=p.trim();return t.descriptionCache.set(o,h),h}catch(a){throw new Error(`Image description error: ${a instanceof Error?a.message:String(a)}`)}}async generateContextAwareImageDescription(e,r,n){let o=this.createContextAwarePrompt(n);return await this.generateImageDescriptionFromPrompt(e,r,o)}createContextAwarePrompt(e){let r=this.createImageAnalysisPrompt();return!e||e.trim()===""?r:`${r}
873
873
 
874
874
  **\u7528\u6237\u7279\u522B\u5173\u6CE8\u7684\u4E0A\u4E0B\u6587\u4FE1\u606F\uFF1A**
875
875
  ${e}
@@ -945,7 +945,7 @@ ${JSON.stringify(e,null,2)}`;try{let o=dGr.dirname(this.logFilePath);await uGr.m
945
945
  [${new Date().toISOString()}]
946
946
  ${n}
947
947
  ${"=".repeat(80)}
948
- `;await uGr.appendFile(this.logFilePath,a,"utf-8")}catch(o){console.debug(R.t("openaiContentGenerator.errors.failedWriteDebugLog"),o)}}logTelemetryFailure(e,r){let n=r instanceof Error&&r.message?r.message:String(r);Ly(new Error(`${e}: ${n}`))}async generateContent(e,r){let n={"model.name":this.modelName,"model.provider":"openai","api.endpoint":`${this.baseUrl}/chat/completions`};return a3("model_call",n,async()=>{let o=Date.now(),s={},a;try{let c=await this.generateContentInternal(e,r,d=>{s=d},(d,f,p,h)=>{a=h;let m=Ms.getActiveSpan();if(m){let g=Date.now()-o,A={"request.model":h?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.http_status":d||200,"response.business_error_code":f,"response.finish_reason":p||"unknown","response.duration_ms":g,"response.success":!0};try{A["request.full_body"]=this.safeStringify(s),a&&(A["response.full_body"]=this.safeStringify(a))}catch(y){console.error("Failed to serialize request/response data for telemetry:",y),A["request.body_serialization_error"]=!0,A.serialization_error_message=y instanceof Error?y.message:String(y)}try{m.setAttributes(A)}catch(y){console.error("Failed to set span attributes:",y)}}}),u=Ms.getActiveSpan();if(u&&c.usageMetadata){let d={"response.prompt_tokens":c.usageMetadata.promptTokenCount,"response.completion_tokens":c.usageMetadata.candidatesTokenCount,"response.total_tokens":c.usageMetadata.totalTokenCount};try{d["request.full_body"]=this.safeStringify(s),a&&(d["response.full_body"]=this.safeStringify(a))}catch(f){console.error("Failed to serialize request/response data for telemetry:",f),d["request.body_serialization_error"]=!0,d.serialization_error_message=f instanceof Error?f.message:String(f)}try{u.setAttributes(d)}catch(f){console.error("Failed to set span attributes:",f)}}return c}catch(c){let u=Date.now()-o,d=c instanceof Error?c.message:String(c),f=Ms.getActiveSpan();if(f){let p={"request.model":a?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.duration_ms":u,"response.success":!1,"response.error_message":d};try{p["request.full_body"]=this.safeStringify(s),a&&(p["response.full_body"]=this.safeStringify(a))}catch(h){console.error("Failed to serialize request/response data for telemetry:",h),p["request.body_serialization_error"]=!0,p.serialization_error_message=h instanceof Error?h.message:String(h)}try{f.setAttributes(p)}catch(h){console.error("Failed to set span attributes:",h)}}throw c}})}safeStringify(e){let r=new WeakSet;return JSON.stringify(e,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular Reference]";r.add(o)}return o})}async generateContentInternal(e,r,n,o){let s=lI.api;s.start("OpenAI-GenerateContent-Total");let a=!1;try{if((this.authType===Jt.LOGIN_WITH_IFLOW||this.authType===Jt.IFLOW)&&await tX()){this.authType===Jt.LOGIN_WITH_IFLOW&&await Kwe();let{getCachedApiKey:O}=await Promise.resolve().then(()=>(EN(),kmt)),Q=await O();Q&&(this.apiKey=Q)}let c=await this.convertToOpenAIMessages(e),u=iGr(c);if(this.config){let N=this.config.getConversationId();if(N)try{await L4t(this.config,N,{model:this.modelName,tool:u})}catch(O){this.logTelemetryFailure("Telemetry initialization failed",O)}}let d=this.convertToOpenAITools(e.config?.tools),f={model:this.modelName,messages:c};(this.authType===Jt.LOGIN_WITH_IFLOW||this.authType===Jt.IFLOW)&&this.modelName==="glm-4.6"&&(f.model="glm-4.6-exp");let p=!1;this.config?.getTemperature()!==void 0&&this.config.getTemperature()!==-1?(f.temperature=this.config.getTemperature(),p=!0):e.config?.temperature!==void 0&&(this.config?.getTemperature()===void 0||this.config.getTemperature()!==-1)&&(f.temperature=e.config.temperature,p=!0),p||(this.config?.getTopP()!==void 0&&this.config.getTopP()!==-1?f.top_p=this.config.getTopP():e.config?.topP!==void 0&&(this.config?.getTopP()===void 0||this.config.getTopP()!==-1)&&(f.top_p=e.config.topP));let h=this.config?.getContentGeneratorConfig?.();h?.thinking&&h.thinking.maxTokens>0?ES.configureThinkingRequest(f.model,f,h.thinking)||console.debug(`Model ${this.modelName} does not support thinking mode`):ES.configureNonThinkingRequest(f.model,f);let m=await this.calculateInputTokens(e),g=q4t(f.model,m),A="global";A==="aone"&&(f.max_tokens=g),this.modelName.includes("deepseek")&&f.model!=="deepseek-v3.2-reasoner"&&(f.max_tokens=g),f.max_new_tokens=g,e.config?.stopSequences&&e.config.stopSequences.length>0&&(f.stop=e.config.stopSequences),d&&d.length>0&&(f.tools=d),await this.logToPromptFile(f,"INPUT REQUEST"),n&&n(f);let y=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl;["offline-whale-wave.alibaba-inc.com","whale.wave.vipserver.offline","whale-wave.alibaba-inc.com","pre-whale-wave.alibaba-inc.com","internal-offline-whale-wave.alibaba-inc.com","internal-whale-wave.alibaba-inc.com"].some(N=>y.includes(N))&&(f.extend_fields={sessionId:this.config?.getSessionId()||""});let v=Date.now(),b=$bt(),S={"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"user-agent":"iFlow-Cli","session-id":this.config?.getSessionId()||"","conversation-id":this.config?.getConversationId()||""};b&&(S={...S,traceparent:b}),A==="aone"&&(S={...S,"X-Client-Type":"iflow-cli","X-Client-Version":"0.4.9"}),SPe(this.config,new NZ(this.baseUrl,this.modelName,JSON.stringify(f),r,JSON.stringify(e.contents)));let w=await fetch(`${y}/chat/completions`,{signal:e.config?.abortSignal,method:"POST",headers:S,body:JSON.stringify(f)}),k=Date.now()-v;if(!w.ok){o&&o(w.status);let N=await w.text();if(this.config)try{await _Pe(this.config,new Error(N)),Uy(this.config,new S2(this.modelName,N,k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"http_error",w.status,w.status,void 0))}catch(O){this.logTelemetryFailure("Telemetry error recording failed",O)}throw w.status===511?(this.config&&Uy(this.config,new S2(this.modelName,"Content length exceeded",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"content_length_exceed",511,200,511)),new Error(R.t("openaiContentGenerator.errors.contentLengthExceed",{traceId:b||w.headers.get("eagleeye-traceid")}))):w.status===514?(this.config&&Uy(this.config,new S2(this.modelName,"model_error",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"model_error",514,200,514)),new Error(R.t("openaiContentGenerator.errors.modelError",{traceId:b||w.headers.get("eagleeye-traceid")}))):w.status===429?(this.config&&Uy(this.config,new S2(this.modelName,"Rate limit reached",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",429,200,429)),new Error(R.t("openaiContentGenerator.errors.modelRateLimitReached"))):new Error(R.t("openaiContentGenerator.errors.httpError",{status:w.status,body:N,traceId:b||w.headers.get("eagleeye-traceid")}))}let D;try{D=await w.json()}catch(N){throw Ly(N),new Error(R.t("openaiContentGenerator.errors.responseFormatError",{traceId:b||w.headers.get("eagleeye-traceid")}))}if(D.error_code&&(D.error_code===511||D.error_code===413))throw this.config&&Uy(this.config,new S2(this.modelName,"Content length exceeded",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"content_length_exceed",D.error_code,200,D.error_code)),new Error(R.t("openaiContentGenerator.errors.contentLengthExceed",{traceId:b||w.headers.get("eagleeye-traceid")}));if(D.error_code&&D.error_code===514)throw this.config&&Uy(this.config,new S2(this.modelName,"model_error",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"model_error",514,200,514)),new Error(R.t("openaiContentGenerator.errors.modelError",{traceId:b||w.headers.get("eagleeye-traceid")}));if(D.status&&D.status==="439"||D.error_code&&D.error_code===439)throw this.config&&Uy(this.config,new S2(this.modelName,"API token expired",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"token_expired",439,200,439)),new Error(R.t("openaiContentGenerator.errors.apiTokenExpired"));if(D.msg&&(D.msg.includes("invalid apiKey")||D.msg.includes("Invalid apiKey")))throw new Error(R.t("openaiContentGenerator.errors.invalidApiKey"));if(D.status&&(D.status==="434"||D.status===434))throw this.config&&Uy(this.config,new S2(this.modelName,"Invalid API key",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"invalid_api_key",434,200,434)),new Error(R.t("openaiContentGenerator.errors.invalidApiKey"));if(D.status&&(D.status==="435"||D.status===435))throw this.config&&Uy(this.config,new S2(this.modelName,"Model Not Support",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"Model Not Support",435,200,435)),new Error(R.t("openaiContentGenerator.errors.modelNotSupport"));if(D.status&&D.status==="429"||D.error_code&&(D.error_code===429||D.error_code===8211))throw this.config&&Uy(this.config,new S2(this.modelName,"Rate limit reached",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",D.error_code||D.status||429,200,D.error_code||D.status||429)),new Error(R.t("openaiContentGenerator.errors.modelRateLimitReached"));if(D.status&&D.status==="449"||D.error_code&&D.error_code===449)throw this.config&&Uy(this.config,new S2(this.modelName,"Rate limit reached",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",449,200,449)),new Error(R.t("openaiContentGenerator.errors.rateLimitReached"));if(e.config?.abortSignal?.aborted)throw new Error(R.t("openaiContentGenerator.errors.userCancel"));if(!D||!D.choices||!Array.isArray(D.choices)||D.choices.length===0){let N=b||w.headers.get("eagleeye-traceid");throw new Error(R.t("openaiContentGenerator.errors.invalidResponseFormat",{traceId:N}))}await this.logToPromptFile(D,"API RESPONSE"),D.usage&&(D.usage.cache_creation_input_tokens&&(D.usage.total_tokens=D.usage.total_tokens+D.usage.cache_creation_input_tokens,D.usage.prompt_tokens=D.usage.prompt_tokens+D.usage.cache_creation_input_tokens),D.usage.cache_read_input_tokens&&(D.usage.total_tokens=D.usage.total_tokens+D.usage.cache_read_input_tokens,D.usage.prompt_tokens=D.usage.prompt_tokens+D.usage.cache_read_input_tokens),this.lastUsageMetadata={total_tokens:D.usage.total_tokens,prompt_tokens:D.usage.prompt_tokens,completion_tokens:D.usage.completion_tokens});let{response:P,hadJsonFixes:T}=await this.convertFromOpenAIResponse(D);if(a=T,o){let N=D.choices[0]?.finish_reason,O=D.error_code;o(200,O,N,D)}if(this.config)try{let N=D.choices[0]?.finish_reason;wPe(this.config,new OZ(this.modelName,k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,D.usage?{promptTokenCount:D.usage.prompt_tokens||0,candidatesTokenCount:D.usage.completion_tokens||0,totalTokenCount:D.usage.total_tokens||0,cachedContentTokenCount:0,thoughtsTokenCount:0,toolUsePromptTokenCount:0}:void 0,JSON.stringify(D,null,2),void 0,N,200,void 0)),await wge(this.config),Obt(this.config,!0,!1,a)}catch(N){this.logTelemetryFailure("Telemetry cleanup failed",N)}return P}catch(c){if(Ly(c),this.config&&!(c instanceof Error&&c.message==="user cancel")&&c?.name!=="AbortError"&&(await _Pe(this.config,c instanceof Error?c:new Error(String(c))),Obt(this.config,!1,!1,a,c instanceof Error?c.message:String(c))),c instanceof Error&&c.cause?.name?.includes("InvalidArgumentError"))throw new Error(R.t("openaiContentGenerator.errors.apiKeyError"));if(c instanceof Error&&c.message&&["iFlow Login expired","Your iFlow Login expired","Your API Token has expired","platform rate limit","platform concurrency limit","Your input has exceeded","the network is unavailable","\u60A8\u7684 iFlow \u767B\u5F55\u5DF2\u8FC7\u671F","\u767B\u5F55\u5DF2\u8FC7\u671F","API Token \u5DF2\u8FC7\u671F","API Token\u5DF2\u8FC7\u671F","\u5E73\u53F0\u901F\u7387\u9650\u5236","\u5E73\u53F0\u5E76\u53D1\u9650\u5236","\u60A8\u7684\u8F93\u5165\u8D85\u8FC7\u4E86\u6A21\u578B\u7684\u4E0A\u4E0B\u6587\u957F\u5EA6","\u60A8\u7684\u8F93\u5165\u5DF2\u8D85\u51FA","\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"].some(f=>c.message.includes(f)))throw new Error(c.message);let u="";throw c instanceof Error?u=c.cause?`${c.message}:${c.cause.message}`:c.message:u=String(c),new Error(R.t("openaiContentGenerator.errors.generateDataError",{error:u}),{cause:c})}finally{s.end("OpenAI-GenerateContent-Total")}}async generateContentStream(e,r){let n=await this.generateContent(e,r);async function*o(){yield n}return o()}async countTokens(e,r=!1){let n=e.useCache??!0;if(!r&&this.lastUsageMetadata?.total_tokens)return{totalTokens:this.lastUsageMetadata.total_tokens};let o=this.extractTextFromRequest(e);return{totalTokens:Math.ceil(o.length/4)}}async calculateInputTokens(e){try{let r={model:this.modelName,contents:e.contents,config:{systemInstruction:e.config?.systemInstruction}};return(await this.countTokens(r)).totalTokens||0}catch{let n=this.extractTextFromRequest({model:this.modelName,contents:e.contents});return Math.ceil(n.length/4)}}async embedContent(e){try{let r=this.extractTextFromEmbedRequest(e),n=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl,o=await fetch(`${n}/v1/embeddings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:this.modelName,input:r})});if(!o.ok){let a=await o.text();throw new Error(`HTTP error! status: ${o.status}, body: ${a}`)}return{embeddings:[{values:(await o.json()).data[0].embedding}]}}catch(r){throw Ly(r),new Error(R.t("openaiContentGenerator.errors.embedContentFailed",{error:r instanceof Error?r.message:String(r)}))}}async convertToOpenAIMessages(e){let r=[],n=new Set,o=new Map;if(e.contents){let s=Array.isArray(e.contents)?e.contents:[e.contents];for(let a of s)if(typeof a=="object"&&a!==null&&"parts"in a&&a.parts){let c=Array.isArray(a.parts)?a.parts:[a.parts];for(let u of c){if(u.functionCall){let d=u.functionCall.id||`call_${Date.now()}_${Math.random().toString(36).substring(2,11)}`;n.add(d)}if(u.functionResponse){let d=u.functionResponse.id||u.functionResponse.name||"",f=u.functionResponse.response?.output??(u.functionResponse.response?JSON.stringify(u.functionResponse.response):"");o.set(d,{role:"tool",tool_call_id:d,content:f})}}}for(let[a]of o)n.has(a)||o.delete(a)}if(e.config?.systemInstruction){let s=this.extractSystemInstruction(e.config.systemInstruction);s&&r.push({role:"system",content:s})}if(e.contents){let s=Array.isArray(e.contents)?e.contents:[e.contents];for(let a of s){if(typeof a=="string"){r.push({role:"user",content:a});continue}if(typeof a=="object"&&a!==null&&"text"in a&&a.text){r.push({role:"user",content:a.text});continue}if(typeof a=="object"&&a!==null&&"parts"in a&&a.parts){let c=Array.isArray(a.parts)?a.parts:[a.parts];if(a.role==="model"){let u={role:"assistant",content:"",tool_calls:[]};for(let d of c)if(d.thought&&"text"in d?(u.reasoning_content=d.text,d.thoughtSignature&&(u.signature=d.thoughtSignature)):"text"in d&&d.text&&(u.content=d.text),d.functionCall){let f=d.functionCall.id||`call_${Date.now()}_${Math.random().toString(36).substring(2,11)}`;u.tool_calls.push({id:f,function:{name:d.functionCall.name||"",arguments:JSON.stringify(d.functionCall.args||{})},type:"function"})}if((u.content||u.tool_calls.length>0)&&(u.tool_calls.length===0&&delete u.tool_calls,r.push(u),u.tool_calls&&u.tool_calls.length>0))for(let d of u.tool_calls){let f=o.get(d.id);f?r.push(f):r.push({role:"tool",tool_call_id:d.id,content:R.t("openaiContentGenerator.messages.toolNotExecuted")})}}else{let u=[];for(let d of c)if("text"in d&&d.text)u.push({type:"text",text:d.text});else if(d.inlineData){let f=d.inlineData;if(f.mimeType&&f.mimeType.startsWith("image/")){let p=this.authType===Jt.IFLOW||this.authType===Jt.LOGIN_WITH_IFLOW||this.baseUrl&&this.baseUrl.toLowerCase().includes("apis.iflow.cn"),h=this.authType===Jt.AONE||this.authType===Jt.LOGIN_WITH_AONE;if(!p&&!h)r.push({role:"user",content:[{type:"image_url",image_url:{url:"data:"+f.mimeType+";base64,"+f.data}}]});else try{if(!f.data)throw new Error(R.t("openaiContentGenerator.errors.imageDataMissing"));let m=await this.multimodalHelper.generateImageDescription(f.data,f.mimeType);u.push({type:"text",text:`[Image Description]: ${m}`})}catch(m){Ly(m),u.push({type:"text",text:R.t("openaiContentGenerator.errors.imageContentCannotParse",{error:m instanceof Error?m.message:String(m)})})}}}u.length>0&&r.push({role:"user",content:u})}}}}return r}createGeminiResponse(){let e=new rX;return e.candidates=[{content:{parts:[],role:"model"}}],e}async convertFromOpenAIResponse(e){let r=e.choices[0],n=this.createGeminiResponse(),o=n.candidates?.[0],s=!1;if(!r||!r.message)return{response:n,hadJsonFixes:s};if(r.message.reasoning_content!==null&&r.message.reasoning_content!==void 0&&o?.content?.parts&&o.content.parts.push({thought:!0,text:r.message.reasoning_content,thoughtSignature:r.message.signature??null}),r.message.reasoning&&o?.content?.parts&&o.content.parts.push({thought:!0,text:r.message.reasoning}),r.message.content&&r.message.content.trim()&&o?.content?.parts&&o.content.parts.push({text:r.message.content}),r.message.tool_calls&&Array.isArray(r.message.tool_calls))for(let a of r.message.tool_calls){let c;try{c=JSON.parse(a.function.arguments)}catch(u){if(Ly(u),this.baseUrl==="https://apis.iflow.cn/v1"||this.baseUrl==="https://ducky.code.alibaba-inc.com/v1/openai")try{c=await this.fixInvalidJsonWithQwen(a.function.arguments),s=!0}catch(d){Ly(d),console.error("Failed to fix JSON",d),c={}}else c={}}o?.content?.parts?.push({functionCall:{id:a.id,name:a.function.name,args:c}})}return o&&r.finish_reason!=="tool_calls"&&r.finish_reason&&(o.finishReason=this.mapFinishReason(r.finish_reason)),n.usageMetadata={promptTokenCount:e.usage?.prompt_tokens||0,candidatesTokenCount:e.usage?.completion_tokens||0,totalTokenCount:e.usage?.total_tokens||0},{response:n,hadJsonFixes:s}}async fixInvalidJsonWithQwen(e){let r=`
948
+ `;await uGr.appendFile(this.logFilePath,a,"utf-8")}catch(o){console.debug(R.t("openaiContentGenerator.errors.failedWriteDebugLog"),o)}}logTelemetryFailure(e,r){let n=r instanceof Error&&r.message?r.message:String(r);Ly(new Error(`${e}: ${n}`))}async generateContent(e,r){let n={"model.name":this.modelName,"model.provider":"openai","api.endpoint":`${this.baseUrl}/chat/completions`};return a3("model_call",n,async()=>{let o=Date.now(),s={},a;try{let c=await this.generateContentInternal(e,r,d=>{s=d},(d,f,p,h)=>{a=h;let m=Ms.getActiveSpan();if(m){let g=Date.now()-o,A={"request.model":h?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.http_status":d||200,"response.business_error_code":f,"response.finish_reason":p||"unknown","response.duration_ms":g,"response.success":!0};try{A["request.full_body"]=this.safeStringify(s),a&&(A["response.full_body"]=this.safeStringify(a))}catch(y){console.error("Failed to serialize request/response data for telemetry:",y),A["request.body_serialization_error"]=!0,A.serialization_error_message=y instanceof Error?y.message:String(y)}try{m.setAttributes(A)}catch(y){console.error("Failed to set span attributes:",y)}}}),u=Ms.getActiveSpan();if(u&&c.usageMetadata){let d={"response.prompt_tokens":c.usageMetadata.promptTokenCount,"response.completion_tokens":c.usageMetadata.candidatesTokenCount,"response.total_tokens":c.usageMetadata.totalTokenCount};try{d["request.full_body"]=this.safeStringify(s),a&&(d["response.full_body"]=this.safeStringify(a))}catch(f){console.error("Failed to serialize request/response data for telemetry:",f),d["request.body_serialization_error"]=!0,d.serialization_error_message=f instanceof Error?f.message:String(f)}try{u.setAttributes(d)}catch(f){console.error("Failed to set span attributes:",f)}}return c}catch(c){let u=Date.now()-o,d=c instanceof Error?c.message:String(c),f=Ms.getActiveSpan();if(f){let p={"request.model":a?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.duration_ms":u,"response.success":!1,"response.error_message":d};try{p["request.full_body"]=this.safeStringify(s),a&&(p["response.full_body"]=this.safeStringify(a))}catch(h){console.error("Failed to serialize request/response data for telemetry:",h),p["request.body_serialization_error"]=!0,p.serialization_error_message=h instanceof Error?h.message:String(h)}try{f.setAttributes(p)}catch(h){console.error("Failed to set span attributes:",h)}}throw c}})}safeStringify(e){let r=new WeakSet;return JSON.stringify(e,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular Reference]";r.add(o)}return o})}async generateContentInternal(e,r,n,o){let s=lI.api;s.start("OpenAI-GenerateContent-Total");let a=!1;try{if((this.authType===Jt.LOGIN_WITH_IFLOW||this.authType===Jt.IFLOW)&&await tX()){this.authType===Jt.LOGIN_WITH_IFLOW&&await Kwe();let{getCachedApiKey:O}=await Promise.resolve().then(()=>(EN(),kmt)),Q=await O();Q&&(this.apiKey=Q)}let c=await this.convertToOpenAIMessages(e),u=iGr(c);if(this.config){let N=this.config.getConversationId();if(N)try{await L4t(this.config,N,{model:this.modelName,tool:u})}catch(O){this.logTelemetryFailure("Telemetry initialization failed",O)}}let d=this.convertToOpenAITools(e.config?.tools),f={model:this.modelName,messages:c};(this.authType===Jt.LOGIN_WITH_IFLOW||this.authType===Jt.IFLOW)&&this.modelName==="glm-4.6"&&(f.model="glm-4.6-exp");let p=!1;this.config?.getTemperature()!==void 0&&this.config.getTemperature()!==-1?(f.temperature=this.config.getTemperature(),p=!0):e.config?.temperature!==void 0&&(this.config?.getTemperature()===void 0||this.config.getTemperature()!==-1)&&(f.temperature=e.config.temperature,p=!0),p||(this.config?.getTopP()!==void 0&&this.config.getTopP()!==-1?f.top_p=this.config.getTopP():e.config?.topP!==void 0&&(this.config?.getTopP()===void 0||this.config.getTopP()!==-1)&&(f.top_p=e.config.topP));let h=this.config?.getContentGeneratorConfig?.();h?.thinking&&h.thinking.maxTokens>0?ES.configureThinkingRequest(f.model,f,h.thinking)||console.debug(`Model ${this.modelName} does not support thinking mode`):ES.configureNonThinkingRequest(f.model,f);let m=await this.calculateInputTokens(e),g=q4t(f.model,m),A="global";A==="aone"&&(f.max_tokens=g),this.modelName.includes("deepseek")&&f.model!=="deepseek-v3.2-reasoner"&&(f.max_tokens=g),f.max_new_tokens=g,e.config?.stopSequences&&e.config.stopSequences.length>0&&(f.stop=e.config.stopSequences),d&&d.length>0&&(f.tools=d),await this.logToPromptFile(f,"INPUT REQUEST"),n&&n(f);let y=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl;["offline-whale-wave.alibaba-inc.com","whale.wave.vipserver.offline","whale-wave.alibaba-inc.com","pre-whale-wave.alibaba-inc.com","internal-offline-whale-wave.alibaba-inc.com","internal-whale-wave.alibaba-inc.com"].some(N=>y.includes(N))&&(f.extend_fields={sessionId:this.config?.getSessionId()||""});let v=Date.now(),b=$bt(),S={"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"user-agent":"iFlow-Cli","session-id":this.config?.getSessionId()||"","conversation-id":this.config?.getConversationId()||""};b&&(S={...S,traceparent:b}),A==="aone"&&(S={...S,"X-Client-Type":"iflow-cli","X-Client-Version":"0.4.10"}),SPe(this.config,new NZ(this.baseUrl,this.modelName,JSON.stringify(f),r,JSON.stringify(e.contents)));let w=await fetch(`${y}/chat/completions`,{signal:e.config?.abortSignal,method:"POST",headers:S,body:JSON.stringify(f)}),k=Date.now()-v;if(!w.ok){o&&o(w.status);let N=await w.text();if(this.config)try{await _Pe(this.config,new Error(N)),Uy(this.config,new S2(this.modelName,N,k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"http_error",w.status,w.status,void 0))}catch(O){this.logTelemetryFailure("Telemetry error recording failed",O)}throw w.status===511?(this.config&&Uy(this.config,new S2(this.modelName,"Content length exceeded",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"content_length_exceed",511,200,511)),new Error(R.t("openaiContentGenerator.errors.contentLengthExceed",{traceId:b||w.headers.get("eagleeye-traceid")}))):w.status===514?(this.config&&Uy(this.config,new S2(this.modelName,"model_error",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"model_error",514,200,514)),new Error(R.t("openaiContentGenerator.errors.modelError",{traceId:b||w.headers.get("eagleeye-traceid")}))):w.status===429?(this.config&&Uy(this.config,new S2(this.modelName,"Rate limit reached",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",429,200,429)),new Error(R.t("openaiContentGenerator.errors.modelRateLimitReached"))):new Error(R.t("openaiContentGenerator.errors.httpError",{status:w.status,body:N,traceId:b||w.headers.get("eagleeye-traceid")}))}let D;try{D=await w.json()}catch(N){throw Ly(N),new Error(R.t("openaiContentGenerator.errors.responseFormatError",{traceId:b||w.headers.get("eagleeye-traceid")}))}if(D.error_code&&(D.error_code===511||D.error_code===413))throw this.config&&Uy(this.config,new S2(this.modelName,"Content length exceeded",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"content_length_exceed",D.error_code,200,D.error_code)),new Error(R.t("openaiContentGenerator.errors.contentLengthExceed",{traceId:b||w.headers.get("eagleeye-traceid")}));if(D.error_code&&D.error_code===514)throw this.config&&Uy(this.config,new S2(this.modelName,"model_error",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"model_error",514,200,514)),new Error(R.t("openaiContentGenerator.errors.modelError",{traceId:b||w.headers.get("eagleeye-traceid")}));if(D.status&&D.status==="439"||D.error_code&&D.error_code===439)throw this.config&&Uy(this.config,new S2(this.modelName,"API token expired",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"token_expired",439,200,439)),new Error(R.t("openaiContentGenerator.errors.apiTokenExpired"));if(D.msg&&(D.msg.includes("invalid apiKey")||D.msg.includes("Invalid apiKey")))throw new Error(R.t("openaiContentGenerator.errors.invalidApiKey"));if(D.status&&(D.status==="434"||D.status===434))throw this.config&&Uy(this.config,new S2(this.modelName,"Invalid API key",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"invalid_api_key",434,200,434)),new Error(R.t("openaiContentGenerator.errors.invalidApiKey"));if(D.status&&(D.status==="435"||D.status===435))throw this.config&&Uy(this.config,new S2(this.modelName,"Model Not Support",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"Model Not Support",435,200,435)),new Error(R.t("openaiContentGenerator.errors.modelNotSupport"));if(D.status&&D.status==="429"||D.error_code&&(D.error_code===429||D.error_code===8211))throw this.config&&Uy(this.config,new S2(this.modelName,"Rate limit reached",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",D.error_code||D.status||429,200,D.error_code||D.status||429)),new Error(R.t("openaiContentGenerator.errors.modelRateLimitReached"));if(D.status&&D.status==="449"||D.error_code&&D.error_code===449)throw this.config&&Uy(this.config,new S2(this.modelName,"Rate limit reached",k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",449,200,449)),new Error(R.t("openaiContentGenerator.errors.rateLimitReached"));if(e.config?.abortSignal?.aborted)throw new Error(R.t("openaiContentGenerator.errors.userCancel"));if(!D||!D.choices||!Array.isArray(D.choices)||D.choices.length===0){let N=b||w.headers.get("eagleeye-traceid");throw new Error(R.t("openaiContentGenerator.errors.invalidResponseFormat",{traceId:N}))}await this.logToPromptFile(D,"API RESPONSE"),D.usage&&(D.usage.cache_creation_input_tokens&&(D.usage.total_tokens=D.usage.total_tokens+D.usage.cache_creation_input_tokens,D.usage.prompt_tokens=D.usage.prompt_tokens+D.usage.cache_creation_input_tokens),D.usage.cache_read_input_tokens&&(D.usage.total_tokens=D.usage.total_tokens+D.usage.cache_read_input_tokens,D.usage.prompt_tokens=D.usage.prompt_tokens+D.usage.cache_read_input_tokens),this.lastUsageMetadata={total_tokens:D.usage.total_tokens,prompt_tokens:D.usage.prompt_tokens,completion_tokens:D.usage.completion_tokens});let{response:P,hadJsonFixes:T}=await this.convertFromOpenAIResponse(D);if(a=T,o){let N=D.choices[0]?.finish_reason,O=D.error_code;o(200,O,N,D)}if(this.config)try{let N=D.choices[0]?.finish_reason;wPe(this.config,new OZ(this.modelName,k,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,D.usage?{promptTokenCount:D.usage.prompt_tokens||0,candidatesTokenCount:D.usage.completion_tokens||0,totalTokenCount:D.usage.total_tokens||0,cachedContentTokenCount:0,thoughtsTokenCount:0,toolUsePromptTokenCount:0}:void 0,JSON.stringify(D,null,2),void 0,N,200,void 0)),await wge(this.config),Obt(this.config,!0,!1,a)}catch(N){this.logTelemetryFailure("Telemetry cleanup failed",N)}return P}catch(c){if(Ly(c),this.config&&!(c instanceof Error&&c.message==="user cancel")&&c?.name!=="AbortError"&&(await _Pe(this.config,c instanceof Error?c:new Error(String(c))),Obt(this.config,!1,!1,a,c instanceof Error?c.message:String(c))),c instanceof Error&&c.cause?.name?.includes("InvalidArgumentError"))throw new Error(R.t("openaiContentGenerator.errors.apiKeyError"));if(c instanceof Error&&c.message&&["iFlow Login expired","Your iFlow Login expired","Your API Token has expired","platform rate limit","platform concurrency limit","Your input has exceeded","the network is unavailable","\u60A8\u7684 iFlow \u767B\u5F55\u5DF2\u8FC7\u671F","\u767B\u5F55\u5DF2\u8FC7\u671F","API Token \u5DF2\u8FC7\u671F","API Token\u5DF2\u8FC7\u671F","\u5E73\u53F0\u901F\u7387\u9650\u5236","\u5E73\u53F0\u5E76\u53D1\u9650\u5236","\u60A8\u7684\u8F93\u5165\u8D85\u8FC7\u4E86\u6A21\u578B\u7684\u4E0A\u4E0B\u6587\u957F\u5EA6","\u60A8\u7684\u8F93\u5165\u5DF2\u8D85\u51FA","\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"].some(f=>c.message.includes(f)))throw new Error(c.message);let u="";throw c instanceof Error?u=c.cause?`${c.message}:${c.cause.message}`:c.message:u=String(c),new Error(R.t("openaiContentGenerator.errors.generateDataError",{error:u}),{cause:c})}finally{s.end("OpenAI-GenerateContent-Total")}}async generateContentStream(e,r){let n=await this.generateContent(e,r);async function*o(){yield n}return o()}async countTokens(e,r=!1){let n=e.useCache??!0;if(!r&&this.lastUsageMetadata?.total_tokens)return{totalTokens:this.lastUsageMetadata.total_tokens};let o=this.extractTextFromRequest(e);return{totalTokens:Math.ceil(o.length/4)}}async calculateInputTokens(e){try{let r={model:this.modelName,contents:e.contents,config:{systemInstruction:e.config?.systemInstruction}};return(await this.countTokens(r)).totalTokens||0}catch{let n=this.extractTextFromRequest({model:this.modelName,contents:e.contents});return Math.ceil(n.length/4)}}async embedContent(e){try{let r=this.extractTextFromEmbedRequest(e),n=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl,o=await fetch(`${n}/v1/embeddings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:this.modelName,input:r})});if(!o.ok){let a=await o.text();throw new Error(`HTTP error! status: ${o.status}, body: ${a}`)}return{embeddings:[{values:(await o.json()).data[0].embedding}]}}catch(r){throw Ly(r),new Error(R.t("openaiContentGenerator.errors.embedContentFailed",{error:r instanceof Error?r.message:String(r)}))}}async convertToOpenAIMessages(e){let r=[],n=new Set,o=new Map;if(e.contents){let s=Array.isArray(e.contents)?e.contents:[e.contents];for(let a of s)if(typeof a=="object"&&a!==null&&"parts"in a&&a.parts){let c=Array.isArray(a.parts)?a.parts:[a.parts];for(let u of c){if(u.functionCall){let d=u.functionCall.id||`call_${Date.now()}_${Math.random().toString(36).substring(2,11)}`;n.add(d)}if(u.functionResponse){let d=u.functionResponse.id||u.functionResponse.name||"",f=u.functionResponse.response?.output??(u.functionResponse.response?JSON.stringify(u.functionResponse.response):"");o.set(d,{role:"tool",tool_call_id:d,content:f})}}}for(let[a]of o)n.has(a)||o.delete(a)}if(e.config?.systemInstruction){let s=this.extractSystemInstruction(e.config.systemInstruction);s&&r.push({role:"system",content:s})}if(e.contents){let s=Array.isArray(e.contents)?e.contents:[e.contents];for(let a of s){if(typeof a=="string"){r.push({role:"user",content:a});continue}if(typeof a=="object"&&a!==null&&"text"in a&&a.text){r.push({role:"user",content:a.text});continue}if(typeof a=="object"&&a!==null&&"parts"in a&&a.parts){let c=Array.isArray(a.parts)?a.parts:[a.parts];if(a.role==="model"){let u={role:"assistant",content:"",tool_calls:[]};for(let d of c)if(d.thought&&"text"in d?(u.reasoning_content=d.text,d.thoughtSignature&&(u.signature=d.thoughtSignature)):"text"in d&&d.text&&(u.content=d.text),d.functionCall){let f=d.functionCall.id||`call_${Date.now()}_${Math.random().toString(36).substring(2,11)}`;u.tool_calls.push({id:f,function:{name:d.functionCall.name||"",arguments:JSON.stringify(d.functionCall.args||{})},type:"function"})}if((u.content||u.tool_calls.length>0)&&(u.tool_calls.length===0&&delete u.tool_calls,r.push(u),u.tool_calls&&u.tool_calls.length>0))for(let d of u.tool_calls){let f=o.get(d.id);f?r.push(f):r.push({role:"tool",tool_call_id:d.id,content:R.t("openaiContentGenerator.messages.toolNotExecuted")})}}else{let u=[];for(let d of c)if("text"in d&&d.text)u.push({type:"text",text:d.text});else if(d.inlineData){let f=d.inlineData;if(f.mimeType&&f.mimeType.startsWith("image/")){let p=this.authType===Jt.IFLOW||this.authType===Jt.LOGIN_WITH_IFLOW||this.baseUrl&&this.baseUrl.toLowerCase().includes("apis.iflow.cn"),h=this.authType===Jt.AONE||this.authType===Jt.LOGIN_WITH_AONE;if(!p&&!h)r.push({role:"user",content:[{type:"image_url",image_url:{url:"data:"+f.mimeType+";base64,"+f.data}}]});else try{if(!f.data)throw new Error(R.t("openaiContentGenerator.errors.imageDataMissing"));let m=await this.multimodalHelper.generateImageDescription(f.data,f.mimeType);u.push({type:"text",text:`[Image Description]: ${m}`})}catch(m){Ly(m),u.push({type:"text",text:R.t("openaiContentGenerator.errors.imageContentCannotParse",{error:m instanceof Error?m.message:String(m)})})}}}u.length>0&&r.push({role:"user",content:u})}}}}return r}createGeminiResponse(){let e=new rX;return e.candidates=[{content:{parts:[],role:"model"}}],e}async convertFromOpenAIResponse(e){let r=e.choices[0],n=this.createGeminiResponse(),o=n.candidates?.[0],s=!1;if(!r||!r.message)return{response:n,hadJsonFixes:s};if(r.message.reasoning_content!==null&&r.message.reasoning_content!==void 0&&o?.content?.parts&&o.content.parts.push({thought:!0,text:r.message.reasoning_content,thoughtSignature:r.message.signature??null}),r.message.reasoning&&o?.content?.parts&&o.content.parts.push({thought:!0,text:r.message.reasoning}),r.message.content&&r.message.content.trim()&&o?.content?.parts&&o.content.parts.push({text:r.message.content}),r.message.tool_calls&&Array.isArray(r.message.tool_calls))for(let a of r.message.tool_calls){let c;try{c=JSON.parse(a.function.arguments)}catch(u){if(Ly(u),this.baseUrl==="https://apis.iflow.cn/v1"||this.baseUrl==="https://ducky.code.alibaba-inc.com/v1/openai")try{c=await this.fixInvalidJsonWithQwen(a.function.arguments),s=!0}catch(d){Ly(d),console.error("Failed to fix JSON",d),c={}}else c={}}o?.content?.parts?.push({functionCall:{id:a.id,name:a.function.name,args:c}})}return o&&r.finish_reason!=="tool_calls"&&r.finish_reason&&(o.finishReason=this.mapFinishReason(r.finish_reason)),n.usageMetadata={promptTokenCount:e.usage?.prompt_tokens||0,candidatesTokenCount:e.usage?.completion_tokens||0,totalTokenCount:e.usage?.total_tokens||0},{response:n,hadJsonFixes:s}}async fixInvalidJsonWithQwen(e){let r=`
949
949
  \u4F60\u662F\u4E00\u4E2Ajson\u683C\u5F0F\u4F18\u5316\u4E13\u5BB6\uFF0C\u4F60\u7684\u5DE5\u4F5C\u662F\u5C06\u4E00\u4E32\u6587\u672C\uFF0C\u6839\u636Ejson schema\u7684\u5B9A\u4E49\u8F93\u51FA\u6210\u4E00\u4E2Avalid\u7684json
950
950
  \u8FD9\u4E2A\u662F\u9519\u8BEF\u7684json\u683C\u5F0F\uFF1A
951
951
  ${e}
@@ -958,7 +958,7 @@ Otherwise navigate to:
958
958
 
959
959
  ${e}
960
960
 
961
- `);try{(await a2(e)).on("error",s=>{throw new Error(`BROWSER_LAUNCH_FAILED: Failed to open browser automatically: ${s.message}. Please navigate to the URL manually.`)})}catch(o){throw new Error(`BROWSER_LAUNCH_FAILED: An unexpected error occurred while trying to open the browser: ${o}. Please navigate to the URL manually.`)}console.log("Waiting for authentication...");let n=0;for(;n<r.maxRetries;){await PGr(r.pollInterval);let o=await MGr(t,r);if(o.isSuccess()){let s=o.getPrivateToken();return await uI.savePrivateToken(s),console.log("Aone authentication successful!"),!0}o.getError()&&console.log(`Waiting for authentication... (${n+1}/${r.maxRetries})`),n++}throw new Error("Authentication timeout. Please try again.")}async function FPe(t=new fee){return await uI.hasValidToken()?(console.log("Using cached Aone authentication."),!0):await FGr(t)}async function db(){return await uI.loadPrivateToken()}async function LPe(){await uI.clearPrivateToken(),console.log("Aone authentication cleared.")}async function G4o(){return await uI.hasValidToken()}async function q4o(t=new fee){return await LPe(),await FPe(t)}var Mge=q(()=>{"use strict";J4t();x7();NGr();OGr();BGr();});async function Z4t(t,e,r,n,o){if(e===Jt.LOGIN_WITH_IFLOW){await LU(e,r,o);let s=await QC();if(!s)throw new Error("No API key found. Please re-authenticate.");let a=r.getContentGeneratorConfig();return new Ej({model:r.getModel(),apiKey:s,baseUrl:a?.baseUrl||Nge,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen3-vl-plus",config:r})}if(e===Jt.LOGIN_WITH_AONE){if(!await FPe())throw new Error("Aone authentication failed. Please try again.");let a=await db();if(!a)throw new Error("No Aone private token found. Please re-authenticate.");let c=r.getContentGeneratorConfig(),u=Buffer.from(a,"utf8").toString("base64");return new Ej({model:r.getModel(),apiKey:u,baseUrl:c?.baseUrl||"https://ducky.code.alibaba-inc.com/v1/openai",authType:e,debugMode:r.getDebugMode(),multimodalModelName:c?.multimodalModelName,config:r})}if(e===Jt.CLOUD_SHELL){let s=await LU(e,r),a=await Y_r(s);return new R7(s,a.projectId,t,n,a.userTier)}throw new Error(`Unsupported authType: ${e}`)}var eCt=q(()=>{"use strict";hE();EN();K_r();tTe();H4t();ub();Mge();});function H4o(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function Vw(t){let e=H4o(t),r=`IFLOW_${t}`;if(process.env[r])return process.env[r];let n=`IFLOW_${e}`;if(process.env[n])return process.env[n];let o=`iflow_${t}`;if(process.env[o])return process.env[o];let s=`iflow_${e}`;if(process.env[s])return process.env[s]}function Fge(){return Vw("apiKey")}function Lge(){return Vw("baseUrl")||Vw("url")}function Uge(){return Vw("modelName")||Vw("model")}function LGr(t){let e=Vw(t);if(e===void 0)return;let r=e.toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}function UGr(t){let e=Vw(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function QGr(t){let e=Vw(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function UPe(){return!!(Fge()||Lge()||Uge())}function tCt(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],r=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate","skipNextSpeakerCheck","useRipgrep","debugKeystrokeLogging","pasteFromClipboard","lightWeightPlan"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","compressionTokenThreshold","shellTimeout","temperature","topP"],o=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(s=>{let a=Vw(s);a!==void 0&&(t[s]=a)}),r.forEach(s=>{let a=LGr(s);a!==void 0&&(t[s]=a)}),n.forEach(s=>{let a=UGr(s);a!==void 0&&(t[s]=a)}),o.forEach(s=>{let a=QGr(s);a!==void 0&&(t[s]=a)}),t}function V4o(){return{apiKey:Fge(),baseUrl:Lge(),model:Uge()}}var rCt=q(()=>{"use strict";});async function nCt(t,e,r){if(await tX())try{await Xwe()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted.")}catch(p){throw p instanceof Error&&p.message.includes("SERVER_OAUTH2_REQUIRED"),p}let o=Fge(),s=Lge(),a=Uge(),c=r?.apiKey||o,u=r?.baseUrl||s||W4o[e],d=r?.modelName||t.getModel()||a||TE,f={model:d,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===Jt.CLOUD_SHELL?f:e===Jt.LOGIN_WITH_IFLOW?(f.baseUrl=u||Nge,f.multimodalModelName="qwen3-vl-plus",c&&(f.apiKey=c),f):([...IE,Jt.OPENAI_COMPATIBLE].includes(e)&&c&&(f.apiKey=c,f.baseUrl=u,f.model=d),f)}async function iCt(t,e,r,n){let s={headers:{"User-Agent":`iFlowCLI/0.4.9 (${process.platform}; ${process.arch})`}};if(t.authType&&[...IE,Jt.IDEA_LAB].includes(t.authType)||t.authType===Jt.OPENAI_COMPATIBLE)return new Ej({...t,config:e});if(t.authType===Jt.LOGIN_WITH_IFLOW||t.authType===Jt.LOGIN_WITH_AONE||t.authType===Jt.CLOUD_SHELL)return Z4t(s,t.authType,e,r,n);throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var Jt,IE,W4o,hE=q(()=>{"use strict";eCt();ub();H4t();rCt();EN();(function(t){t.LOGIN_WITH_IFLOW="oauth-iflow",t.LOGIN_WITH_AONE="oauth-aone",t.CLOUD_SHELL="cloud-shell",t.IFLOW="iflow",t.AONE="aone",t.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})(Jt||(Jt={}));IE=[Jt.IFLOW,Jt.AONE],W4o={[Jt.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[Jt.IFLOW]:Nge,[Jt.AONE]:fGr}});var QPe,jGr=q(()=>{"use strict";QPe=class{prompts=new Map;registerPrompt(e){if(this.prompts.has(e.name)){let r=`${e.serverName}_${e.name}`;console.warn(`Prompt with name "${e.name}" is already registered. Renaming to "${r}".`),this.prompts.set(r,{...e,name:r})}else this.prompts.set(e.name,e)}getAllPrompts(){return Array.from(this.prompts.values()).sort((e,r)=>e.name.localeCompare(r.name))}getPrompt(e){return this.prompts.get(e)}getPromptsByServer(e){let r=[];for(let n of this.prompts.values())n.serverName===e&&r.push(n);return r.sort((n,o)=>n.name.localeCompare(o.name))}clear(){this.prompts.clear()}removePromptsByServer(e){for(let[r,n]of this.prompts.entries())n.serverName===e&&this.prompts.delete(r)}}});var Or,T2=q(()=>{"use strict";(function(t){t.INVALID_TOOL_PARAMS="invalid_tool_params",t.UNKNOWN="unknown",t.UNHANDLED_EXCEPTION="unhandled_exception",t.TOOL_NOT_REGISTERED="tool_not_registered",t.EXECUTION_FAILED="execution_failed",t.FILE_NOT_FOUND="file_not_found",t.FILE_WRITE_FAILURE="file_write_failure",t.READ_CONTENT_FAILURE="read_content_failure",t.ATTEMPT_TO_CREATE_EXISTING_FILE="attempt_to_create_existing_file",t.FILE_TOO_LARGE="file_too_large",t.PERMISSION_DENIED="permission_denied",t.NO_SPACE_LEFT="no_space_left",t.TARGET_IS_DIRECTORY="target_is_directory",t.PATH_NOT_IN_WORKSPACE="path_not_in_workspace",t.SEARCH_PATH_NOT_FOUND="search_path_not_found",t.SEARCH_PATH_NOT_A_DIRECTORY="search_path_not_a_directory",t.EDIT_PREPARATION_FAILURE="edit_preparation_failure",t.EDIT_NO_OCCURRENCE_FOUND="edit_no_occurrence_found",t.EDIT_EXPECTED_OCCURRENCE_MISMATCH="edit_expected_occurrence_mismatch",t.EDIT_NO_CHANGE="edit_no_change",t.EDIT_NO_CHANGE_LLM_JUDGEMENT="edit_no_change_llm_judgement",t.GLOB_EXECUTION_ERROR="glob_execution_error",t.GREP_EXECUTION_ERROR="grep_execution_error",t.LS_EXECUTION_ERROR="ls_execution_error",t.PATH_IS_NOT_A_DIRECTORY="path_is_not_a_directory",t.MCP_TOOL_ERROR="mcp_tool_error",t.MEMORY_TOOL_EXECUTION_ERROR="memory_tool_execution_error",t.READ_MANY_FILES_SEARCH_ERROR="read_many_files_search_error",t.DISCOVERED_TOOL_EXECUTION_ERROR="discovered_tool_execution_error",t.WEB_FETCH_NO_URL_IN_PROMPT="web_fetch_no_url_in_prompt",t.WEB_FETCH_FALLBACK_FAILED="web_fetch_fallback_failed",t.WEB_FETCH_PROCESSING_ERROR="web_fetch_processing_error",t.WEB_SEARCH_FAILED="web_search_failed",t.HOOK_BLOCKED="hook_blocked",t.BASH_OUTPUT_EXECUTION_ERROR="bash_output_execution_error",t.TASK_NOT_FOUND="task_not_found"})(Or||(Or={}))});var ba,oCt,Gn,Ww,Qge=q(()=>{(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let s={};for(let a of o)s[a]=a;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(c=>typeof o[o[c]]!="number"),a={};for(let c of s)a[c]=o[c];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&s.push(a);return s},t.find=(o,s)=>{for(let a of o)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(ba||(ba={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(oCt||(oCt={}));Gn=ba.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ww=t=>{switch(typeof t){case"undefined":return Gn.undefined;case"string":return Gn.string;case"number":return Number.isNaN(t)?Gn.nan:Gn.number;case"boolean":return Gn.boolean;case"function":return Gn.function;case"bigint":return Gn.bigint;case"symbol":return Gn.symbol;case"object":return Array.isArray(t)?Gn.array:t===null?Gn.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Gn.promise:typeof Map<"u"&&t instanceof Map?Gn.map:typeof Set<"u"&&t instanceof Set?Gn.set:typeof Date<"u"&&t instanceof Date?Gn.date:Gn.object;default:return Gn.unknown}}});var Xr,z4o,Qy,jPe=q(()=>{Qge();Xr=ba.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"]),z4o=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Qy=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let c=n,u=0;for(;u<a.path.length;){let d=a.path[u];u===a.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(r(a))):c[d]=c[d]||{_errors:[]},c=c[d],u++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ba.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];r[s]=r[s]||[],r[s].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Qy.create=t=>new Qy(t)});var Y4o,dI,sCt=q(()=>{jPe();Qge();Y4o=(t,e)=>{let r;switch(t.code){case Xr.invalid_type:t.received===Gn.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Xr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ba.jsonStringifyReplacer)}`;break;case Xr.unrecognized_keys:r=`Unrecognized key(s) in object: ${ba.joinValues(t.keys,", ")}`;break;case Xr.invalid_union:r="Invalid input";break;case Xr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ba.joinValues(t.options)}`;break;case Xr.invalid_enum_value:r=`Invalid enum value. Expected ${ba.joinValues(t.options)}, received '${t.received}'`;break;case Xr.invalid_arguments:r="Invalid function arguments";break;case Xr.invalid_return_type:r="Invalid function return type";break;case Xr.invalid_date:r="Invalid date";break;case Xr.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ba.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Xr.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Xr.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Xr.custom:r="Invalid input";break;case Xr.invalid_intersection_types:r="Intersection results could not be merged";break;case Xr.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Xr.not_finite:r="Number must be finite";break;default:r=e.defaultError,ba.assertNever(t)}return{message:r}},dI=Y4o});function K4o(t){$Gr=t}function pee(){return $Gr}var $Gr,$Pe=q(()=>{sCt();$Gr=dI});function In(t,e){let r=pee(),n=jge({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===dI?void 0:dI].filter(o=>!!o)});t.common.issues.push(n)}var jge,X4o,eA,ho,vj,I2,GPe,qPe,qO,hee,aCt=q(()=>{$Pe();sCt();jge=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,s=[...r,...o.path||[]],a={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let c="",u=n.filter(d=>!!d).slice().reverse();for(let d of u)c=d(a,{data:e,defaultError:c}).message;return{...o,path:s,message:c}},X4o=[];eA=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return ho;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let s=await o.key,a=await o.value;n.push({key:s,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:s,value:a}=o;if(s.status==="aborted"||a.status==="aborted")return ho;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[s.value]=a.value)}return{status:e.value,value:n}}},ho=Object.freeze({status:"aborted"}),vj=t=>({status:"dirty",value:t}),I2=t=>({status:"valid",value:t}),GPe=t=>t.status==="aborted",qPe=t=>t.status==="dirty",qO=t=>t.status==="valid",hee=t=>typeof Promise<"u"&&t instanceof Promise});var GGr=q(()=>{});var Si,qGr=q(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Si||(Si={}))});function Ts(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,c)=>{let{message:u}=t;return a.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:u??n??c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:u??r??c.defaultError}},description:o}}function zGr(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function hCo(t){return new RegExp(`^${zGr(t)}$`)}function YGr(t){let e=`${WGr}T${zGr(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function mCo(t,e){return!!((e==="v4"||!e)&&aCo.test(t)||(e==="v6"||!e)&&lCo.test(t))}function gCo(t,e){if(!nCo.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function ACo(t,e){return!!((e==="v4"||!e)&&cCo.test(t)||(e==="v6"||!e)&&uCo.test(t))}function yCo(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}function mee(t){if(t instanceof jy){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=fb.create(mee(n))}return new jy({...t._def,shape:()=>e})}else return t instanceof hI?new hI({...t._def,type:mee(t.element)}):t instanceof fb?fb.create(mee(t.unwrap())):t instanceof Yw?Yw.create(mee(t.unwrap())):t instanceof zw?zw.create(t.items.map(e=>mee(e))):t}function lCt(t,e){let r=Ww(t),n=Ww(e);if(t===e)return{valid:!0,data:t};if(r===Gn.object&&n===Gn.object){let o=ba.objectKeys(e),s=ba.objectKeys(t).filter(c=>o.indexOf(c)!==-1),a={...t,...e};for(let c of s){let u=lCt(t[c],e[c]);if(!u.valid)return{valid:!1};a[c]=u.data}return{valid:!0,data:a}}else if(r===Gn.array&&n===Gn.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let a=t[s],c=e[s],u=lCt(a,c);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===Gn.date&&n===Gn.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function KGr(t,e){return new Nj({values:t,typeName:vo.ZodEnum,...Ts(e)})}function VGr(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function XGr(t,e={},r){return t?VO.create().superRefine((n,o)=>{let s=t(n);if(s instanceof Promise)return s.then(a=>{if(!a){let c=VGr(e,n),u=c.fatal??r??!0;o.addIssue({code:"custom",...c,fatal:u})}});if(!s){let a=VGr(e,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}}):VO.create()}var pb,HGr,Vs,J4o,Z4o,eCo,tCo,rCo,nCo,iCo,oCo,sCo,cCt,aCo,cCo,lCo,uCo,dCo,fCo,WGr,pCo,HO,bj,Cj,Sj,xj,gee,wj,Tj,VO,pI,vS,Aee,hI,jy,Ij,fI,HPe,Dj,zw,VPe,yee,_ee,WPe,Rj,kj,Nj,Oj,WO,hb,fb,Yw,Bj,Pj,Eee,_Co,$ge,Gge,Mj,ECo,vo,vCo,JGr,ZGr,bCo,CCo,eqr,SCo,xCo,wCo,TCo,ICo,DCo,RCo,kCo,NCo,OCo,BCo,PCo,MCo,FCo,LCo,UCo,QCo,jCo,$Co,GCo,qCo,HCo,VCo,WCo,zCo,YCo,KCo,XCo,JCo,ZCo,eSo,tSo,rSo,nSo,tqr=q(()=>{jPe();$Pe();qGr();aCt();Qge();pb=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}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}},HGr=(t,e)=>{if(qO(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;let r=new Qy(t.common.issues);return this._error=r,this._error}}};Vs=class{get description(){return this._def.description}_getType(e){return Ww(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ww(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new eA,ctx:{common:e.parent.common,data:e.data,parsedType:Ww(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(hee(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ww(e)},o=this._parseSync({data:e,path:n.path,parent:n});return HGr(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ww(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return qO(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>qO(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ww(e)},o=this._parse({data:e,path:n.path,parent:n}),s=await(hee(o)?o:Promise.resolve(o));return HGr(n,s)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,s)=>{let a=e(o),c=()=>s.addIssue({code:Xr.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new hb({schema:this,typeName:vo.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:r=>this["~validate"](r)}}optional(){return fb.create(this,this._def)}nullable(){return Yw.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hI.create(this)}promise(){return WO.create(this,this._def)}or(e){return Ij.create([this,e],this._def)}and(e){return Dj.create(this,e,this._def)}transform(e){return new hb({...Ts(this._def),schema:this,typeName:vo.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Bj({...Ts(this._def),innerType:this,defaultValue:r,typeName:vo.ZodDefault})}brand(){return new $ge({typeName:vo.ZodBranded,type:this,...Ts(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Pj({...Ts(this._def),innerType:this,catchValue:r,typeName:vo.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Gge.create(this,e)}readonly(){return Mj.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},J4o=/^c[^\s-]{8,}$/i,Z4o=/^[0-9a-z]+$/,eCo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tCo=/^[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,rCo=/^[a-z0-9_-]{21}$/i,nCo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,iCo=/^[-+]?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)?)??$/,oCo=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sCo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",aCo=/^(?:(?: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])$/,cCo=/^(?:(?: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])$/,lCo=/^(([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]))$/,uCo=/^(([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])$/,dCo=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fCo=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,WGr="((\\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])))",pCo=new RegExp(`^${WGr}$`);HO=class t extends Vs{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Gn.string){let s=this._getOrReturnCtx(e);return In(s,{code:Xr.invalid_type,expected:Gn.string,received:s.parsedType}),ho}let n=new eA,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let a=e.data.length>s.value,c=e.data.length<s.value;(a||c)&&(o=this._getOrReturnCtx(e,o),a?In(o,{code:Xr.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&In(o,{code:Xr.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")oCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"email",code:Xr.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")cCt||(cCt=new RegExp(sCo,"u")),cCt.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"emoji",code:Xr.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")tCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"uuid",code:Xr.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")rCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"nanoid",code:Xr.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")J4o.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"cuid",code:Xr.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Z4o.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"cuid2",code:Xr.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")eCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"ulid",code:Xr.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),In(o,{validation:"url",code:Xr.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"regex",code:Xr.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?YGr(s).test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?pCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?hCo(s).test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?iCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"duration",code:Xr.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?mCo(e.data,s.version)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"ip",code:Xr.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?gCo(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"jwt",code:Xr.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?ACo(e.data,s.version)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"cidr",code:Xr.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?dCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"base64",code:Xr.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?fCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"base64url",code:Xr.invalid_string,message:s.message}),n.dirty()):ba.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:Xr.invalid_string,...Si.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Si.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Si.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Si.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Si.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Si.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Si.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Si.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Si.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Si.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Si.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Si.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Si.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Si.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?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Si.errToObj(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?.precision>"u"?null:e?.precision,...Si.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Si.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Si.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Si.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Si.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Si.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Si.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Si.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Si.errToObj(r)})}nonempty(e){return this.min(1,Si.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...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(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};HO.create=t=>new HO({checks:[],typeName:vo.ZodString,coerce:t?.coerce??!1,...Ts(t)});bj=class t extends Vs{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)!==Gn.number){let s=this._getOrReturnCtx(e);return In(s,{code:Xr.invalid_type,expected:Gn.number,received:s.parsedType}),ho}let n,o=new eA;for(let s of this._def.checks)s.kind==="int"?ba.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?yCo(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.not_finite,message:s.message}),o.dirty()):ba.assertNever(s);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Si.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Si.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Si.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Si.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Si.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Si.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Si.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Si.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Si.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Si.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Si.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Si.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Si.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Si.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ba.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};bj.create=t=>new bj({checks:[],typeName:vo.ZodNumber,coerce:t?.coerce||!1,...Ts(t)});Cj=class t extends Vs{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)!==Gn.bigint)return this._getInvalidInput(e);let n,o=new eA;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):ba.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return In(r,{code:Xr.invalid_type,expected:Gn.bigint,received:r.parsedType}),ho}gte(e,r){return this.setLimit("min",e,!0,Si.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Si.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Si.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Si.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Si.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Si.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Si.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Si.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Si.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Si.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Cj.create=t=>new Cj({checks:[],typeName:vo.ZodBigInt,coerce:t?.coerce??!1,...Ts(t)});Sj=class extends Vs{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Gn.boolean){let n=this._getOrReturnCtx(e);return In(n,{code:Xr.invalid_type,expected:Gn.boolean,received:n.parsedType}),ho}return I2(e.data)}};Sj.create=t=>new Sj({typeName:vo.ZodBoolean,coerce:t?.coerce||!1,...Ts(t)});xj=class t extends Vs{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Gn.date){let s=this._getOrReturnCtx(e);return In(s,{code:Xr.invalid_type,expected:Gn.date,received:s.parsedType}),ho}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return In(s,{code:Xr.invalid_date}),ho}let n=new eA,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):ba.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Si.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Si.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};xj.create=t=>new xj({checks:[],coerce:t?.coerce||!1,typeName:vo.ZodDate,...Ts(t)});gee=class extends Vs{_parse(e){if(this._getType(e)!==Gn.symbol){let n=this._getOrReturnCtx(e);return In(n,{code:Xr.invalid_type,expected:Gn.symbol,received:n.parsedType}),ho}return I2(e.data)}};gee.create=t=>new gee({typeName:vo.ZodSymbol,...Ts(t)});wj=class extends Vs{_parse(e){if(this._getType(e)!==Gn.undefined){let n=this._getOrReturnCtx(e);return In(n,{code:Xr.invalid_type,expected:Gn.undefined,received:n.parsedType}),ho}return I2(e.data)}};wj.create=t=>new wj({typeName:vo.ZodUndefined,...Ts(t)});Tj=class extends Vs{_parse(e){if(this._getType(e)!==Gn.null){let n=this._getOrReturnCtx(e);return In(n,{code:Xr.invalid_type,expected:Gn.null,received:n.parsedType}),ho}return I2(e.data)}};Tj.create=t=>new Tj({typeName:vo.ZodNull,...Ts(t)});VO=class extends Vs{constructor(){super(...arguments),this._any=!0}_parse(e){return I2(e.data)}};VO.create=t=>new VO({typeName:vo.ZodAny,...Ts(t)});pI=class extends Vs{constructor(){super(...arguments),this._unknown=!0}_parse(e){return I2(e.data)}};pI.create=t=>new pI({typeName:vo.ZodUnknown,...Ts(t)});vS=class extends Vs{_parse(e){let r=this._getOrReturnCtx(e);return In(r,{code:Xr.invalid_type,expected:Gn.never,received:r.parsedType}),ho}};vS.create=t=>new vS({typeName:vo.ZodNever,...Ts(t)});Aee=class extends Vs{_parse(e){if(this._getType(e)!==Gn.undefined){let n=this._getOrReturnCtx(e);return In(n,{code:Xr.invalid_type,expected:Gn.void,received:n.parsedType}),ho}return I2(e.data)}};Aee.create=t=>new Aee({typeName:vo.ZodVoid,...Ts(t)});hI=class t extends Vs{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==Gn.array)return In(r,{code:Xr.invalid_type,expected:Gn.array,received:r.parsedType}),ho;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,c=r.data.length<o.exactLength.value;(a||c)&&(In(r,{code:a?Xr.too_big:Xr.too_small,minimum:c?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(In(r,{code:Xr.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(In(r,{code:Xr.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,c)=>o.type._parseAsync(new pb(r,a,r.path,c)))).then(a=>eA.mergeArray(n,a));let s=[...r.data].map((a,c)=>o.type._parseSync(new pb(r,a,r.path,c)));return eA.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Si.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Si.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Si.toString(r)}})}nonempty(e){return this.min(1,e)}};hI.create=(t,e)=>new hI({type:t,minLength:null,maxLength:null,exactLength:null,typeName:vo.ZodArray,...Ts(e)});jy=class t extends Vs{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ba.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==Gn.object){let d=this._getOrReturnCtx(e);return In(d,{code:Xr.invalid_type,expected:Gn.object,received:d.parsedType}),ho}let{status:n,ctx:o}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof vS&&this._def.unknownKeys==="strip"))for(let d in o.data)a.includes(d)||c.push(d);let u=[];for(let d of a){let f=s[d],p=o.data[d];u.push({key:{status:"valid",value:d},value:f._parse(new pb(o,p,o.path,d)),alwaysSet:d in o.data})}if(this._def.catchall instanceof vS){let d=this._def.unknownKeys;if(d==="passthrough")for(let f of c)u.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(d==="strict")c.length>0&&(In(o,{code:Xr.unrecognized_keys,keys:c}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let f of c){let p=o.data[f];u.push({key:{status:"valid",value:f},value:d._parse(new pb(o,p,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let d=[];for(let f of u){let p=await f.key,h=await f.value;d.push({key:p,value:h,alwaysSet:f.alwaysSet})}return d}).then(d=>eA.mergeObjectSync(n,d)):eA.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Si.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Si.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:vo.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of ba.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ba.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return mee(this)}partial(e){let r={};for(let n of ba.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of ba.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof fb;)s=s._def.innerType;r[n]=s}return new t({...this._def,shape:()=>r})}keyof(){return KGr(ba.objectKeys(this.shape))}};jy.create=(t,e)=>new jy({shape:()=>t,unknownKeys:"strip",catchall:vS.create(),typeName:vo.ZodObject,...Ts(e)});jy.strictCreate=(t,e)=>new jy({shape:()=>t,unknownKeys:"strict",catchall:vS.create(),typeName:vo.ZodObject,...Ts(e)});jy.lazycreate=(t,e)=>new jy({shape:t,unknownKeys:"strip",catchall:vS.create(),typeName:vo.ZodObject,...Ts(e)});Ij=class extends Vs{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(s){for(let c of s)if(c.result.status==="valid")return c.result;for(let c of s)if(c.result.status==="dirty")return r.common.issues.push(...c.ctx.common.issues),c.result;let a=s.map(c=>new Qy(c.ctx.common.issues));return In(r,{code:Xr.invalid_union,unionErrors:a}),ho}if(r.common.async)return Promise.all(n.map(async s=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let s,a=[];for(let u of n){let d={...r,common:{...r.common,issues:[]},parent:null},f=u._parseSync({data:r.data,path:r.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!s&&(s={result:f,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let c=a.map(u=>new Qy(u));return In(r,{code:Xr.invalid_union,unionErrors:c}),ho}}get options(){return this._def.options}};Ij.create=(t,e)=>new Ij({options:t,typeName:vo.ZodUnion,...Ts(e)});fI=t=>t instanceof Rj?fI(t.schema):t instanceof hb?fI(t.innerType()):t instanceof kj?[t.value]:t instanceof Nj?t.options:t instanceof Oj?ba.objectValues(t.enum):t instanceof Bj?fI(t._def.innerType):t instanceof wj?[void 0]:t instanceof Tj?[null]:t instanceof fb?[void 0,...fI(t.unwrap())]:t instanceof Yw?[null,...fI(t.unwrap())]:t instanceof $ge||t instanceof Mj?fI(t.unwrap()):t instanceof Pj?fI(t._def.innerType):[],HPe=class t extends Vs{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Gn.object)return In(r,{code:Xr.invalid_type,expected:Gn.object,received:r.parsedType}),ho;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(In(r,{code:Xr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ho)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let s of r){let a=fI(s.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of a){if(o.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);o.set(c,s)}}return new t({typeName:vo.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Ts(n)})}};Dj=class extends Vs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(s,a)=>{if(GPe(s)||GPe(a))return ho;let c=lCt(s.value,a.value);return c.valid?((qPe(s)||qPe(a))&&r.dirty(),{status:r.value,value:c.data}):(In(n,{code:Xr.invalid_intersection_types}),ho)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,a])=>o(s,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Dj.create=(t,e,r)=>new Dj({left:t,right:e,typeName:vo.ZodIntersection,...Ts(r)});zw=class t extends Vs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Gn.array)return In(n,{code:Xr.invalid_type,expected:Gn.array,received:n.parsedType}),ho;if(n.data.length<this._def.items.length)return In(n,{code:Xr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ho;!this._def.rest&&n.data.length>this._def.items.length&&(In(n,{code:Xr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((a,c)=>{let u=this._def.items[c]||this._def.rest;return u?u._parse(new pb(n,a,n.path,c)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>eA.mergeArray(r,a)):eA.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};zw.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new zw({items:t,typeName:vo.ZodTuple,rest:null,...Ts(e)})};VPe=class t extends Vs{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Gn.object)return In(n,{code:Xr.invalid_type,expected:Gn.object,received:n.parsedType}),ho;let o=[],s=this._def.keyType,a=this._def.valueType;for(let c in n.data)o.push({key:s._parse(new pb(n,c,n.path,c)),value:a._parse(new pb(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?eA.mergeObjectAsync(r,o):eA.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Vs?new t({keyType:e,valueType:r,typeName:vo.ZodRecord,...Ts(n)}):new t({keyType:HO.create(),valueType:e,typeName:vo.ZodRecord,...Ts(r)})}},yee=class extends Vs{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Gn.map)return In(n,{code:Xr.invalid_type,expected:Gn.map,received:n.parsedType}),ho;let o=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([c,u],d)=>({key:o._parse(new pb(n,c,n.path,[d,"key"])),value:s._parse(new pb(n,u,n.path,[d,"value"]))}));if(n.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let u of a){let d=await u.key,f=await u.value;if(d.status==="aborted"||f.status==="aborted")return ho;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),c.set(d.value,f.value)}return{status:r.value,value:c}})}else{let c=new Map;for(let u of a){let d=u.key,f=u.value;if(d.status==="aborted"||f.status==="aborted")return ho;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),c.set(d.value,f.value)}return{status:r.value,value:c}}}};yee.create=(t,e,r)=>new yee({valueType:e,keyType:t,typeName:vo.ZodMap,...Ts(r)});_ee=class t extends Vs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Gn.set)return In(n,{code:Xr.invalid_type,expected:Gn.set,received:n.parsedType}),ho;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(In(n,{code:Xr.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(In(n,{code:Xr.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function a(u){let d=new Set;for(let f of u){if(f.status==="aborted")return ho;f.status==="dirty"&&r.dirty(),d.add(f.value)}return{status:r.value,value:d}}let c=[...n.data.values()].map((u,d)=>s._parse(new pb(n,u,n.path,d)));return n.common.async?Promise.all(c).then(u=>a(u)):a(c)}min(e,r){return new t({...this._def,minSize:{value:e,message:Si.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Si.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};_ee.create=(t,e)=>new _ee({valueType:t,minSize:null,maxSize:null,typeName:vo.ZodSet,...Ts(e)});WPe=class t extends Vs{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Gn.function)return In(r,{code:Xr.invalid_type,expected:Gn.function,received:r.parsedType}),ho;function n(c,u){return jge({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pee(),dI].filter(d=>!!d),issueData:{code:Xr.invalid_arguments,argumentsError:u}})}function o(c,u){return jge({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pee(),dI].filter(d=>!!d),issueData:{code:Xr.invalid_return_type,returnTypeError:u}})}let s={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof WO){let c=this;return I2(async function(...u){let d=new Qy([]),f=await c._def.args.parseAsync(u,s).catch(m=>{throw d.addIssue(n(u,m)),d}),p=await Reflect.apply(a,this,f);return await c._def.returns._def.type.parseAsync(p,s).catch(m=>{throw d.addIssue(o(p,m)),d})})}else{let c=this;return I2(function(...u){let d=c._def.args.safeParse(u,s);if(!d.success)throw new Qy([n(u,d.error)]);let f=Reflect.apply(a,this,d.data),p=c._def.returns.safeParse(f,s);if(!p.success)throw new Qy([o(f,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:zw.create(e).rest(pI.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||zw.create([]).rest(pI.create()),returns:r||pI.create(),typeName:vo.ZodFunction,...Ts(n)})}},Rj=class extends Vs{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Rj.create=(t,e)=>new Rj({getter:t,typeName:vo.ZodLazy,...Ts(e)});kj=class extends Vs{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return In(r,{received:r.data,code:Xr.invalid_literal,expected:this._def.value}),ho}return{status:"valid",value:e.data}}get value(){return this._def.value}};kj.create=(t,e)=>new kj({value:t,typeName:vo.ZodLiteral,...Ts(e)});Nj=class t extends Vs{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return In(r,{expected:ba.joinValues(n),received:r.parsedType,code:Xr.invalid_type}),ho}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return In(r,{received:r.data,code:Xr.invalid_enum_value,options:n}),ho}return I2(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Nj.create=KGr;Oj=class extends Vs{_parse(e){let r=ba.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Gn.string&&n.parsedType!==Gn.number){let o=ba.objectValues(r);return In(n,{expected:ba.joinValues(o),received:n.parsedType,code:Xr.invalid_type}),ho}if(this._cache||(this._cache=new Set(ba.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=ba.objectValues(r);return In(n,{received:n.data,code:Xr.invalid_enum_value,options:o}),ho}return I2(e.data)}get enum(){return this._def.values}};Oj.create=(t,e)=>new Oj({values:t,typeName:vo.ZodNativeEnum,...Ts(e)});WO=class extends Vs{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Gn.promise&&r.common.async===!1)return In(r,{code:Xr.invalid_type,expected:Gn.promise,received:r.parsedType}),ho;let n=r.parsedType===Gn.promise?r.data:Promise.resolve(r.data);return I2(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};WO.create=(t,e)=>new WO({type:t,typeName:vo.ZodPromise,...Ts(e)});hb=class extends Vs{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===vo.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:a=>{In(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let a=o.transform(n.data,s);if(n.common.async)return Promise.resolve(a).then(async c=>{if(r.value==="aborted")return ho;let u=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return u.status==="aborted"?ho:u.status==="dirty"?vj(u.value):r.value==="dirty"?vj(u.value):u});{if(r.value==="aborted")return ho;let c=this._def.schema._parseSync({data:a,path:n.path,parent:n});return c.status==="aborted"?ho:c.status==="dirty"?vj(c.value):r.value==="dirty"?vj(c.value):c}}if(o.type==="refinement"){let a=c=>{let u=o.refinement(c,s);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?ho:(c.status==="dirty"&&r.dirty(),a(c.value),{status:r.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?ho:(c.status==="dirty"&&r.dirty(),a(c.value).then(()=>({status:r.value,value:c.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!qO(a))return ho;let c=o.transform(a.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>qO(a)?Promise.resolve(o.transform(a.value,s)).then(c=>({status:r.value,value:c})):ho);ba.assertNever(o)}};hb.create=(t,e,r)=>new hb({schema:t,typeName:vo.ZodEffects,effect:e,...Ts(r)});hb.createWithPreprocess=(t,e,r)=>new hb({schema:e,effect:{type:"preprocess",transform:t},typeName:vo.ZodEffects,...Ts(r)});fb=class extends Vs{_parse(e){return this._getType(e)===Gn.undefined?I2(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};fb.create=(t,e)=>new fb({innerType:t,typeName:vo.ZodOptional,...Ts(e)});Yw=class extends Vs{_parse(e){return this._getType(e)===Gn.null?I2(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Yw.create=(t,e)=>new Yw({innerType:t,typeName:vo.ZodNullable,...Ts(e)});Bj=class extends Vs{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===Gn.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Bj.create=(t,e)=>new Bj({innerType:t,typeName:vo.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ts(e)});Pj=class extends Vs{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return hee(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Qy(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Qy(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Pj.create=(t,e)=>new Pj({innerType:t,typeName:vo.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ts(e)});Eee=class extends Vs{_parse(e){if(this._getType(e)!==Gn.nan){let n=this._getOrReturnCtx(e);return In(n,{code:Xr.invalid_type,expected:Gn.nan,received:n.parsedType}),ho}return{status:"valid",value:e.data}}};Eee.create=t=>new Eee({typeName:vo.ZodNaN,...Ts(t)});_Co=Symbol("zod_brand"),$ge=class extends Vs{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Gge=class t extends Vs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ho:s.status==="dirty"?(r.dirty(),vj(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ho:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:vo.ZodPipeline})}},Mj=class extends Vs{_parse(e){let r=this._def.innerType._parse(e),n=o=>(qO(o)&&(o.value=Object.freeze(o.value)),o);return hee(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Mj.create=(t,e)=>new Mj({innerType:t,typeName:vo.ZodReadonly,...Ts(e)});ECo={object:jy.lazycreate};(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"})(vo||(vo={}));vCo=(t,e={message:`Input not instance of ${t.name}`})=>XGr(r=>r instanceof t,e),JGr=HO.create,ZGr=bj.create,bCo=Eee.create,CCo=Cj.create,eqr=Sj.create,SCo=xj.create,xCo=gee.create,wCo=wj.create,TCo=Tj.create,ICo=VO.create,DCo=pI.create,RCo=vS.create,kCo=Aee.create,NCo=hI.create,OCo=jy.create,BCo=jy.strictCreate,PCo=Ij.create,MCo=HPe.create,FCo=Dj.create,LCo=zw.create,UCo=VPe.create,QCo=yee.create,jCo=_ee.create,$Co=WPe.create,GCo=Rj.create,qCo=kj.create,HCo=Nj.create,VCo=Oj.create,WCo=WO.create,zCo=hb.create,YCo=fb.create,KCo=Yw.create,XCo=hb.createWithPreprocess,JCo=Gge.create,ZCo=()=>JGr().optional(),eSo=()=>ZGr().optional(),tSo=()=>eqr().optional(),rSo={string:(t=>HO.create({...t,coerce:!0})),number:(t=>bj.create({...t,coerce:!0})),boolean:(t=>Sj.create({...t,coerce:!0})),bigint:(t=>Cj.create({...t,coerce:!0})),date:(t=>xj.create({...t,coerce:!0}))},nSo=ho});var Ke={};ls(Ke,{BRAND:()=>_Co,DIRTY:()=>vj,EMPTY_PATH:()=>X4o,INVALID:()=>ho,NEVER:()=>nSo,OK:()=>I2,ParseStatus:()=>eA,Schema:()=>Vs,ZodAny:()=>VO,ZodArray:()=>hI,ZodBigInt:()=>Cj,ZodBoolean:()=>Sj,ZodBranded:()=>$ge,ZodCatch:()=>Pj,ZodDate:()=>xj,ZodDefault:()=>Bj,ZodDiscriminatedUnion:()=>HPe,ZodEffects:()=>hb,ZodEnum:()=>Nj,ZodError:()=>Qy,ZodFirstPartyTypeKind:()=>vo,ZodFunction:()=>WPe,ZodIntersection:()=>Dj,ZodIssueCode:()=>Xr,ZodLazy:()=>Rj,ZodLiteral:()=>kj,ZodMap:()=>yee,ZodNaN:()=>Eee,ZodNativeEnum:()=>Oj,ZodNever:()=>vS,ZodNull:()=>Tj,ZodNullable:()=>Yw,ZodNumber:()=>bj,ZodObject:()=>jy,ZodOptional:()=>fb,ZodParsedType:()=>Gn,ZodPipeline:()=>Gge,ZodPromise:()=>WO,ZodReadonly:()=>Mj,ZodRecord:()=>VPe,ZodSchema:()=>Vs,ZodSet:()=>_ee,ZodString:()=>HO,ZodSymbol:()=>gee,ZodTransformer:()=>hb,ZodTuple:()=>zw,ZodType:()=>Vs,ZodUndefined:()=>wj,ZodUnion:()=>Ij,ZodUnknown:()=>pI,ZodVoid:()=>Aee,addIssueToContext:()=>In,any:()=>ICo,array:()=>NCo,bigint:()=>CCo,boolean:()=>eqr,coerce:()=>rSo,custom:()=>XGr,date:()=>SCo,datetimeRegex:()=>YGr,defaultErrorMap:()=>dI,discriminatedUnion:()=>MCo,effect:()=>zCo,enum:()=>HCo,function:()=>$Co,getErrorMap:()=>pee,getParsedType:()=>Ww,instanceof:()=>vCo,intersection:()=>FCo,isAborted:()=>GPe,isAsync:()=>hee,isDirty:()=>qPe,isValid:()=>qO,late:()=>ECo,lazy:()=>GCo,literal:()=>qCo,makeIssue:()=>jge,map:()=>QCo,nan:()=>bCo,nativeEnum:()=>VCo,never:()=>RCo,null:()=>TCo,nullable:()=>KCo,number:()=>ZGr,object:()=>OCo,objectUtil:()=>oCt,oboolean:()=>tSo,onumber:()=>eSo,optional:()=>YCo,ostring:()=>ZCo,pipeline:()=>JCo,preprocess:()=>XCo,promise:()=>WCo,quotelessJson:()=>z4o,record:()=>UCo,set:()=>jCo,setErrorMap:()=>K4o,strictObject:()=>BCo,string:()=>JGr,symbol:()=>xCo,transformer:()=>zCo,tuple:()=>LCo,undefined:()=>wCo,union:()=>PCo,unknown:()=>DCo,util:()=>ba,void:()=>kCo});var uCt=q(()=>{$Pe();aCt();GGr();Qge();tqr();jPe()});function lr(t,e,r){function n(c,u){var d;Object.defineProperty(c,"_zod",{value:c._zod??{},enumerable:!1}),(d=c._zod).traits??(d.traits=new Set),c._zod.traits.add(t),e(c,u);for(let f in a.prototype)f in c||Object.defineProperty(c,f,{value:a.prototype[f].bind(c)});c._zod.constr=a,c._zod.def=u}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function a(c){var u;let d=r?.Parent?new s:this;n(d,c),(u=d._zod).deferred??(u.deferred=[]);for(let f of d._zod.deferred)f();return d}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}function DE(t){return t&&Object.assign(zPe,t),zPe}var dCt,iSo,mI,zPe,vee=q(()=>{dCt=Object.freeze({status:"aborted"});iSo=Symbol("zod_brand"),mI=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},zPe={}});var kc={};ls(kc,{BIGINT_FORMAT_RANGES:()=>nqr,Class:()=>pCt,NUMBER_FORMAT_RANGES:()=>vCt,aborted:()=>Lj,allowsEval:()=>yCt,assert:()=>lSo,assertEqual:()=>oSo,assertIs:()=>aSo,assertNever:()=>cSo,assertNotEqual:()=>sSo,assignProp:()=>ACt,cached:()=>Hge,captureStackTrace:()=>KPe,cleanEnum:()=>bSo,cleanRegex:()=>Wge,clone:()=>bS,createTransparentProxy:()=>mSo,defineLazy:()=>Ku,esc:()=>Fj,escapeRegex:()=>zO,extend:()=>ySo,finalizeIssue:()=>CS,floatSafeRemainder:()=>gCt,getElementAtPath:()=>uSo,getEnumValues:()=>hCt,getLengthableOrigin:()=>zge,getParsedType:()=>hSo,getSizableOrigin:()=>iqr,isObject:()=>bee,isPlainObject:()=>Cee,issue:()=>bCt,joinValues:()=>YPe,jsonStringifyReplacer:()=>mCt,merge:()=>_So,normalizeParams:()=>Hi,nullish:()=>Vge,numKeys:()=>pSo,omit:()=>ASo,optionalKeys:()=>ECt,partial:()=>ESo,pick:()=>gSo,prefixIssues:()=>Kw,primitiveTypes:()=>rqr,promiseAllObject:()=>dSo,propertyKeyTypes:()=>_Ct,randomString:()=>fSo,required:()=>vSo,stringifyPrimitive:()=>XPe,unwrapMessage:()=>qge});function oSo(t){return t}function sSo(t){return t}function aSo(t){}function cSo(t){throw new Error}function lSo(t){}function hCt(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function YPe(t,e="|"){return t.map(r=>XPe(r)).join(e)}function mCt(t,e){return typeof e=="bigint"?e.toString():e}function Hge(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Vge(t){return t==null}function Wge(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function gCt(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}function Ku(t,e,r){Object.defineProperty(t,e,{get(){{let o=r();return t[e]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function ACt(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function uSo(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function dSo(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<e.length;s++)o[e[s]]=n[s];return o})}function fSo(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function Fj(t){return JSON.stringify(t)}function bee(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Cee(t){if(bee(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(bee(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function pSo(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function zO(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bS(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function Hi(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function mSo(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,s){return e??(e=t()),Reflect.set(e,n,o,s)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function XPe(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function ECt(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function gSo(t,e){let r={},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(r[o]=n.shape[o])}return bS(t,{...t._zod.def,shape:r,checks:[]})}function ASo(t,e){let r={...t._zod.def.shape},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete r[o]}return bS(t,{...t._zod.def,shape:r,checks:[]})}function ySo(t,e){if(!Cee(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return ACt(this,"shape",n),n},checks:[]};return bS(t,r)}function _So(t,e){return bS(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return ACt(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function ESo(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=t?new t({type:"optional",innerType:n[s]}):n[s])}else for(let s in n)o[s]=t?new t({type:"optional",innerType:n[s]}):n[s];return bS(e,{...e._zod.def,shape:o,checks:[]})}function vSo(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:n[s]}))}else for(let s in n)o[s]=new t({type:"nonoptional",innerType:n[s]});return bS(e,{...e._zod.def,shape:o,checks:[]})}function Lj(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Kw(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function qge(t){return typeof t=="string"?t:t?.message}function CS(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=qge(t.inst?._zod.def?.error?.(t))??qge(e?.error?.(t))??qge(r.customError?.(t))??qge(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function iqr(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function zge(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function bCt(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function bSo(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var KPe,yCt,hSo,_Ct,rqr,vCt,nqr,pCt,gI=q(()=>{KPe=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};yCt=Hge(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});hSo=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},_Ct=new Set(["string","number","symbol"]),rqr=new Set(["string","number","bigint","boolean","symbol","undefined"]);vCt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},nqr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};pCt=class{constructor(...e){}}});function SCt(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function xCt(t,e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>o({issues:c}));else if(a.code==="invalid_key")o({issues:a.issues});else if(a.code==="invalid_element")o({issues:a.issues});else if(a.path.length===0)n._errors.push(r(a));else{let c=n,u=0;for(;u<a.path.length;){let d=a.path[u];u===a.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(r(a))):c[d]=c[d]||{_errors:[]},c=c[d],u++}}};return o(t),n}var oqr,JPe,CCt,wCt=q(()=>{vee();gI();oqr=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,mCt,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},JPe=lr("$ZodError",oqr),CCt=lr("$ZodError",oqr,{Parent:Error})});var sqr,aqr,TCt,Yge,ICt,ZPe,DCt=q(()=>{vee();wCt();gI();sqr=t=>(e,r,n,o)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new mI;if(a.issues.length){let c=new(o?.Err??t)(a.issues.map(u=>CS(u,s,DE())));throw KPe(c,o?.callee),c}return a.value},aqr=t=>async(e,r,n,o)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(o?.Err??t)(a.issues.map(u=>CS(u,s,DE())));throw KPe(c,o?.callee),c}return a.value},TCt=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new mI;return s.issues.length?{success:!1,error:new(t??JPe)(s.issues.map(a=>CS(a,o,DE())))}:{success:!0,data:s.value}},Yge=TCt(CCt),ICt=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(a=>CS(a,o,DE())))}:{success:!0,data:s.value}},ZPe=ICt(CCt)});function Aqr(){return new RegExp(SSo,"u")}function Tqr(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Iqr(t){return new RegExp(`^${Tqr(t)}$`)}function Dqr(t){let e=Tqr({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${xqr}T(?:${n})$`)}var cqr,lqr,uqr,dqr,fqr,pqr,hqr,mqr,RCt,gqr,SSo,yqr,_qr,Eqr,vqr,bqr,kCt,Cqr,Sqr,xqr,wqr,Rqr,kqr,Nqr,Oqr,Bqr,Pqr,Mqr,Fqr,tMe=q(()=>{cqr=/^[cC][^\s-]{8,}$/,lqr=/^[0-9a-z]+$/,uqr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,dqr=/^[0-9a-vA-V]{20}$/,fqr=/^[A-Za-z0-9]{27}$/,pqr=/^[a-zA-Z0-9_-]{21}$/,hqr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,mqr=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,RCt=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,gqr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,SSo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";yqr=/^(?:(?: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])$/,_qr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Eqr=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,vqr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bqr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,kCt=/^[A-Za-z0-9_-]*$/,Cqr=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Sqr=/^\+(?:[0-9]){6,14}[0-9]$/,xqr="(?:(?:\\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])))",wqr=new RegExp(`^${xqr}$`);Rqr=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},kqr=/^\d+n?$/,Nqr=/^\d+$/,Oqr=/^-?\d+(?:\.\d+)?/i,Bqr=/true|false/i,Pqr=/null/i,Mqr=/^[^A-Z]*$/,Fqr=/^[^a-z]*$/});var D2,Lqr,NCt,OCt,Uqr,Qqr,jqr,$qr,Gqr,Kge,qqr,Hqr,Vqr,Wqr,zqr,Yqr,Kqr,rMe=q(()=>{vee();tMe();gI();D2=lr("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Lqr={number:"number",bigint:"bigint",object:"date"},NCt=lr("$ZodCheckLessThan",(t,e)=>{D2.init(t,e);let r=Lqr[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),OCt=lr("$ZodCheckGreaterThan",(t,e)=>{D2.init(t,e);let r=Lqr[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Uqr=lr("$ZodCheckMultipleOf",(t,e)=>{D2.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):gCt(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Qqr=lr("$ZodCheckNumberFormat",(t,e)=>{D2.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,s]=vCt[e.format];t._zod.onattach.push(a=>{let c=a._zod.bag;c.format=e.format,c.minimum=o,c.maximum=s,r&&(c.pattern=Nqr)}),t._zod.check=a=>{let c=a.value;if(r){if(!Number.isInteger(c)){a.issues.push({expected:n,format:e.format,code:"invalid_type",input:c,inst:t});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}c<o&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inst:t})}}),jqr=lr("$ZodCheckMaxLength",(t,e)=>{var r;D2.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Vge(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let a=zge(o);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),$qr=lr("$ZodCheckMinLength",(t,e)=>{var r;D2.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Vge(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let a=zge(o);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Gqr=lr("$ZodCheckLengthEquals",(t,e)=>{var r;D2.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Vge(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,s=o.length;if(s===e.length)return;let a=zge(o),c=s>e.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Kge=lr("$ZodCheckStringFormat",(t,e)=>{var r,n;D2.init(t,e),t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),qqr=lr("$ZodCheckRegex",(t,e)=>{Kge.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Hqr=lr("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Mqr),Kge.init(t,e)}),Vqr=lr("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Fqr),Kge.init(t,e)}),Wqr=lr("$ZodCheckIncludes",(t,e)=>{D2.init(t,e);let r=zO(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),zqr=lr("$ZodCheckStartsWith",(t,e)=>{D2.init(t,e);let r=new RegExp(`^${zO(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),Yqr=lr("$ZodCheckEndsWith",(t,e)=>{D2.init(t,e);let r=new RegExp(`.*${zO(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}}),Kqr=lr("$ZodCheckOverwrite",(t,e)=>{D2.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var nMe,BCt=q(()=>{nMe=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
961
+ `);try{(await a2(e)).on("error",s=>{throw new Error(`BROWSER_LAUNCH_FAILED: Failed to open browser automatically: ${s.message}. Please navigate to the URL manually.`)})}catch(o){throw new Error(`BROWSER_LAUNCH_FAILED: An unexpected error occurred while trying to open the browser: ${o}. Please navigate to the URL manually.`)}console.log("Waiting for authentication...");let n=0;for(;n<r.maxRetries;){await PGr(r.pollInterval);let o=await MGr(t,r);if(o.isSuccess()){let s=o.getPrivateToken();return await uI.savePrivateToken(s),console.log("Aone authentication successful!"),!0}o.getError()&&console.log(`Waiting for authentication... (${n+1}/${r.maxRetries})`),n++}throw new Error("Authentication timeout. Please try again.")}async function FPe(t=new fee){return await uI.hasValidToken()?(console.log("Using cached Aone authentication."),!0):await FGr(t)}async function db(){return await uI.loadPrivateToken()}async function LPe(){await uI.clearPrivateToken(),console.log("Aone authentication cleared.")}async function G4o(){return await uI.hasValidToken()}async function q4o(t=new fee){return await LPe(),await FPe(t)}var Mge=q(()=>{"use strict";J4t();x7();NGr();OGr();BGr();});async function Z4t(t,e,r,n,o){if(e===Jt.LOGIN_WITH_IFLOW){await LU(e,r,o);let s=await QC();if(!s)throw new Error("No API key found. Please re-authenticate.");let a=r.getContentGeneratorConfig();return new Ej({model:r.getModel(),apiKey:s,baseUrl:a?.baseUrl||Nge,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen3-vl-plus",config:r})}if(e===Jt.LOGIN_WITH_AONE){if(!await FPe())throw new Error("Aone authentication failed. Please try again.");let a=await db();if(!a)throw new Error("No Aone private token found. Please re-authenticate.");let c=r.getContentGeneratorConfig(),u=Buffer.from(a,"utf8").toString("base64");return new Ej({model:r.getModel(),apiKey:u,baseUrl:c?.baseUrl||"https://ducky.code.alibaba-inc.com/v1/openai",authType:e,debugMode:r.getDebugMode(),multimodalModelName:c?.multimodalModelName,config:r})}if(e===Jt.CLOUD_SHELL){let s=await LU(e,r),a=await Y_r(s);return new R7(s,a.projectId,t,n,a.userTier)}throw new Error(`Unsupported authType: ${e}`)}var eCt=q(()=>{"use strict";hE();EN();K_r();tTe();H4t();ub();Mge();});function H4o(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function Vw(t){let e=H4o(t),r=`IFLOW_${t}`;if(process.env[r])return process.env[r];let n=`IFLOW_${e}`;if(process.env[n])return process.env[n];let o=`iflow_${t}`;if(process.env[o])return process.env[o];let s=`iflow_${e}`;if(process.env[s])return process.env[s]}function Fge(){return Vw("apiKey")}function Lge(){return Vw("baseUrl")||Vw("url")}function Uge(){return Vw("modelName")||Vw("model")}function LGr(t){let e=Vw(t);if(e===void 0)return;let r=e.toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}function UGr(t){let e=Vw(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function QGr(t){let e=Vw(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function UPe(){return!!(Fge()||Lge()||Uge())}function tCt(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],r=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate","skipNextSpeakerCheck","useRipgrep","debugKeystrokeLogging","pasteFromClipboard","lightWeightPlan"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","compressionTokenThreshold","shellTimeout","temperature","topP"],o=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(s=>{let a=Vw(s);a!==void 0&&(t[s]=a)}),r.forEach(s=>{let a=LGr(s);a!==void 0&&(t[s]=a)}),n.forEach(s=>{let a=UGr(s);a!==void 0&&(t[s]=a)}),o.forEach(s=>{let a=QGr(s);a!==void 0&&(t[s]=a)}),t}function V4o(){return{apiKey:Fge(),baseUrl:Lge(),model:Uge()}}var rCt=q(()=>{"use strict";});async function nCt(t,e,r){if(await tX())try{await Xwe()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted.")}catch(p){throw p instanceof Error&&p.message.includes("SERVER_OAUTH2_REQUIRED"),p}let o=Fge(),s=Lge(),a=Uge(),c=r?.apiKey||o,u=r?.baseUrl||s||W4o[e],d=r?.modelName||t.getModel()||a||TE,f={model:d,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===Jt.CLOUD_SHELL?f:e===Jt.LOGIN_WITH_IFLOW?(f.baseUrl=u||Nge,f.multimodalModelName="qwen3-vl-plus",c&&(f.apiKey=c),f):([...IE,Jt.OPENAI_COMPATIBLE].includes(e)&&c&&(f.apiKey=c,f.baseUrl=u,f.model=d),f)}async function iCt(t,e,r,n){let s={headers:{"User-Agent":`iFlowCLI/0.4.10 (${process.platform}; ${process.arch})`}};if(t.authType&&[...IE,Jt.IDEA_LAB].includes(t.authType)||t.authType===Jt.OPENAI_COMPATIBLE)return new Ej({...t,config:e});if(t.authType===Jt.LOGIN_WITH_IFLOW||t.authType===Jt.LOGIN_WITH_AONE||t.authType===Jt.CLOUD_SHELL)return Z4t(s,t.authType,e,r,n);throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var Jt,IE,W4o,hE=q(()=>{"use strict";eCt();ub();H4t();rCt();EN();(function(t){t.LOGIN_WITH_IFLOW="oauth-iflow",t.LOGIN_WITH_AONE="oauth-aone",t.CLOUD_SHELL="cloud-shell",t.IFLOW="iflow",t.AONE="aone",t.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})(Jt||(Jt={}));IE=[Jt.IFLOW,Jt.AONE],W4o={[Jt.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[Jt.IFLOW]:Nge,[Jt.AONE]:fGr}});var QPe,jGr=q(()=>{"use strict";QPe=class{prompts=new Map;registerPrompt(e){if(this.prompts.has(e.name)){let r=`${e.serverName}_${e.name}`;console.warn(`Prompt with name "${e.name}" is already registered. Renaming to "${r}".`),this.prompts.set(r,{...e,name:r})}else this.prompts.set(e.name,e)}getAllPrompts(){return Array.from(this.prompts.values()).sort((e,r)=>e.name.localeCompare(r.name))}getPrompt(e){return this.prompts.get(e)}getPromptsByServer(e){let r=[];for(let n of this.prompts.values())n.serverName===e&&r.push(n);return r.sort((n,o)=>n.name.localeCompare(o.name))}clear(){this.prompts.clear()}removePromptsByServer(e){for(let[r,n]of this.prompts.entries())n.serverName===e&&this.prompts.delete(r)}}});var Or,T2=q(()=>{"use strict";(function(t){t.INVALID_TOOL_PARAMS="invalid_tool_params",t.UNKNOWN="unknown",t.UNHANDLED_EXCEPTION="unhandled_exception",t.TOOL_NOT_REGISTERED="tool_not_registered",t.EXECUTION_FAILED="execution_failed",t.FILE_NOT_FOUND="file_not_found",t.FILE_WRITE_FAILURE="file_write_failure",t.READ_CONTENT_FAILURE="read_content_failure",t.ATTEMPT_TO_CREATE_EXISTING_FILE="attempt_to_create_existing_file",t.FILE_TOO_LARGE="file_too_large",t.PERMISSION_DENIED="permission_denied",t.NO_SPACE_LEFT="no_space_left",t.TARGET_IS_DIRECTORY="target_is_directory",t.PATH_NOT_IN_WORKSPACE="path_not_in_workspace",t.SEARCH_PATH_NOT_FOUND="search_path_not_found",t.SEARCH_PATH_NOT_A_DIRECTORY="search_path_not_a_directory",t.EDIT_PREPARATION_FAILURE="edit_preparation_failure",t.EDIT_NO_OCCURRENCE_FOUND="edit_no_occurrence_found",t.EDIT_EXPECTED_OCCURRENCE_MISMATCH="edit_expected_occurrence_mismatch",t.EDIT_NO_CHANGE="edit_no_change",t.EDIT_NO_CHANGE_LLM_JUDGEMENT="edit_no_change_llm_judgement",t.GLOB_EXECUTION_ERROR="glob_execution_error",t.GREP_EXECUTION_ERROR="grep_execution_error",t.LS_EXECUTION_ERROR="ls_execution_error",t.PATH_IS_NOT_A_DIRECTORY="path_is_not_a_directory",t.MCP_TOOL_ERROR="mcp_tool_error",t.MEMORY_TOOL_EXECUTION_ERROR="memory_tool_execution_error",t.READ_MANY_FILES_SEARCH_ERROR="read_many_files_search_error",t.DISCOVERED_TOOL_EXECUTION_ERROR="discovered_tool_execution_error",t.WEB_FETCH_NO_URL_IN_PROMPT="web_fetch_no_url_in_prompt",t.WEB_FETCH_FALLBACK_FAILED="web_fetch_fallback_failed",t.WEB_FETCH_PROCESSING_ERROR="web_fetch_processing_error",t.WEB_SEARCH_FAILED="web_search_failed",t.HOOK_BLOCKED="hook_blocked",t.BASH_OUTPUT_EXECUTION_ERROR="bash_output_execution_error",t.TASK_NOT_FOUND="task_not_found"})(Or||(Or={}))});var ba,oCt,Gn,Ww,Qge=q(()=>{(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let s={};for(let a of o)s[a]=a;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(c=>typeof o[o[c]]!="number"),a={};for(let c of s)a[c]=o[c];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&s.push(a);return s},t.find=(o,s)=>{for(let a of o)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(ba||(ba={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(oCt||(oCt={}));Gn=ba.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ww=t=>{switch(typeof t){case"undefined":return Gn.undefined;case"string":return Gn.string;case"number":return Number.isNaN(t)?Gn.nan:Gn.number;case"boolean":return Gn.boolean;case"function":return Gn.function;case"bigint":return Gn.bigint;case"symbol":return Gn.symbol;case"object":return Array.isArray(t)?Gn.array:t===null?Gn.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Gn.promise:typeof Map<"u"&&t instanceof Map?Gn.map:typeof Set<"u"&&t instanceof Set?Gn.set:typeof Date<"u"&&t instanceof Date?Gn.date:Gn.object;default:return Gn.unknown}}});var Xr,z4o,Qy,jPe=q(()=>{Qge();Xr=ba.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"]),z4o=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Qy=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let c=n,u=0;for(;u<a.path.length;){let d=a.path[u];u===a.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(r(a))):c[d]=c[d]||{_errors:[]},c=c[d],u++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ba.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];r[s]=r[s]||[],r[s].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Qy.create=t=>new Qy(t)});var Y4o,dI,sCt=q(()=>{jPe();Qge();Y4o=(t,e)=>{let r;switch(t.code){case Xr.invalid_type:t.received===Gn.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Xr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ba.jsonStringifyReplacer)}`;break;case Xr.unrecognized_keys:r=`Unrecognized key(s) in object: ${ba.joinValues(t.keys,", ")}`;break;case Xr.invalid_union:r="Invalid input";break;case Xr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ba.joinValues(t.options)}`;break;case Xr.invalid_enum_value:r=`Invalid enum value. Expected ${ba.joinValues(t.options)}, received '${t.received}'`;break;case Xr.invalid_arguments:r="Invalid function arguments";break;case Xr.invalid_return_type:r="Invalid function return type";break;case Xr.invalid_date:r="Invalid date";break;case Xr.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ba.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Xr.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Xr.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Xr.custom:r="Invalid input";break;case Xr.invalid_intersection_types:r="Intersection results could not be merged";break;case Xr.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Xr.not_finite:r="Number must be finite";break;default:r=e.defaultError,ba.assertNever(t)}return{message:r}},dI=Y4o});function K4o(t){$Gr=t}function pee(){return $Gr}var $Gr,$Pe=q(()=>{sCt();$Gr=dI});function In(t,e){let r=pee(),n=jge({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===dI?void 0:dI].filter(o=>!!o)});t.common.issues.push(n)}var jge,X4o,eA,ho,vj,I2,GPe,qPe,qO,hee,aCt=q(()=>{$Pe();sCt();jge=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,s=[...r,...o.path||[]],a={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let c="",u=n.filter(d=>!!d).slice().reverse();for(let d of u)c=d(a,{data:e,defaultError:c}).message;return{...o,path:s,message:c}},X4o=[];eA=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return ho;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let s=await o.key,a=await o.value;n.push({key:s,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:s,value:a}=o;if(s.status==="aborted"||a.status==="aborted")return ho;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[s.value]=a.value)}return{status:e.value,value:n}}},ho=Object.freeze({status:"aborted"}),vj=t=>({status:"dirty",value:t}),I2=t=>({status:"valid",value:t}),GPe=t=>t.status==="aborted",qPe=t=>t.status==="dirty",qO=t=>t.status==="valid",hee=t=>typeof Promise<"u"&&t instanceof Promise});var GGr=q(()=>{});var Si,qGr=q(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Si||(Si={}))});function Ts(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,c)=>{let{message:u}=t;return a.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:u??n??c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:u??r??c.defaultError}},description:o}}function zGr(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function hCo(t){return new RegExp(`^${zGr(t)}$`)}function YGr(t){let e=`${WGr}T${zGr(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function mCo(t,e){return!!((e==="v4"||!e)&&aCo.test(t)||(e==="v6"||!e)&&lCo.test(t))}function gCo(t,e){if(!nCo.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function ACo(t,e){return!!((e==="v4"||!e)&&cCo.test(t)||(e==="v6"||!e)&&uCo.test(t))}function yCo(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}function mee(t){if(t instanceof jy){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=fb.create(mee(n))}return new jy({...t._def,shape:()=>e})}else return t instanceof hI?new hI({...t._def,type:mee(t.element)}):t instanceof fb?fb.create(mee(t.unwrap())):t instanceof Yw?Yw.create(mee(t.unwrap())):t instanceof zw?zw.create(t.items.map(e=>mee(e))):t}function lCt(t,e){let r=Ww(t),n=Ww(e);if(t===e)return{valid:!0,data:t};if(r===Gn.object&&n===Gn.object){let o=ba.objectKeys(e),s=ba.objectKeys(t).filter(c=>o.indexOf(c)!==-1),a={...t,...e};for(let c of s){let u=lCt(t[c],e[c]);if(!u.valid)return{valid:!1};a[c]=u.data}return{valid:!0,data:a}}else if(r===Gn.array&&n===Gn.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let a=t[s],c=e[s],u=lCt(a,c);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===Gn.date&&n===Gn.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function KGr(t,e){return new Nj({values:t,typeName:vo.ZodEnum,...Ts(e)})}function VGr(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function XGr(t,e={},r){return t?VO.create().superRefine((n,o)=>{let s=t(n);if(s instanceof Promise)return s.then(a=>{if(!a){let c=VGr(e,n),u=c.fatal??r??!0;o.addIssue({code:"custom",...c,fatal:u})}});if(!s){let a=VGr(e,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}}):VO.create()}var pb,HGr,Vs,J4o,Z4o,eCo,tCo,rCo,nCo,iCo,oCo,sCo,cCt,aCo,cCo,lCo,uCo,dCo,fCo,WGr,pCo,HO,bj,Cj,Sj,xj,gee,wj,Tj,VO,pI,vS,Aee,hI,jy,Ij,fI,HPe,Dj,zw,VPe,yee,_ee,WPe,Rj,kj,Nj,Oj,WO,hb,fb,Yw,Bj,Pj,Eee,_Co,$ge,Gge,Mj,ECo,vo,vCo,JGr,ZGr,bCo,CCo,eqr,SCo,xCo,wCo,TCo,ICo,DCo,RCo,kCo,NCo,OCo,BCo,PCo,MCo,FCo,LCo,UCo,QCo,jCo,$Co,GCo,qCo,HCo,VCo,WCo,zCo,YCo,KCo,XCo,JCo,ZCo,eSo,tSo,rSo,nSo,tqr=q(()=>{jPe();$Pe();qGr();aCt();Qge();pb=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}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}},HGr=(t,e)=>{if(qO(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;let r=new Qy(t.common.issues);return this._error=r,this._error}}};Vs=class{get description(){return this._def.description}_getType(e){return Ww(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ww(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new eA,ctx:{common:e.parent.common,data:e.data,parsedType:Ww(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(hee(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ww(e)},o=this._parseSync({data:e,path:n.path,parent:n});return HGr(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ww(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return qO(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>qO(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ww(e)},o=this._parse({data:e,path:n.path,parent:n}),s=await(hee(o)?o:Promise.resolve(o));return HGr(n,s)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,s)=>{let a=e(o),c=()=>s.addIssue({code:Xr.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new hb({schema:this,typeName:vo.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:r=>this["~validate"](r)}}optional(){return fb.create(this,this._def)}nullable(){return Yw.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hI.create(this)}promise(){return WO.create(this,this._def)}or(e){return Ij.create([this,e],this._def)}and(e){return Dj.create(this,e,this._def)}transform(e){return new hb({...Ts(this._def),schema:this,typeName:vo.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Bj({...Ts(this._def),innerType:this,defaultValue:r,typeName:vo.ZodDefault})}brand(){return new $ge({typeName:vo.ZodBranded,type:this,...Ts(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Pj({...Ts(this._def),innerType:this,catchValue:r,typeName:vo.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Gge.create(this,e)}readonly(){return Mj.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},J4o=/^c[^\s-]{8,}$/i,Z4o=/^[0-9a-z]+$/,eCo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tCo=/^[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,rCo=/^[a-z0-9_-]{21}$/i,nCo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,iCo=/^[-+]?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)?)??$/,oCo=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sCo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",aCo=/^(?:(?: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])$/,cCo=/^(?:(?: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])$/,lCo=/^(([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]))$/,uCo=/^(([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])$/,dCo=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fCo=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,WGr="((\\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])))",pCo=new RegExp(`^${WGr}$`);HO=class t extends Vs{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Gn.string){let s=this._getOrReturnCtx(e);return In(s,{code:Xr.invalid_type,expected:Gn.string,received:s.parsedType}),ho}let n=new eA,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let a=e.data.length>s.value,c=e.data.length<s.value;(a||c)&&(o=this._getOrReturnCtx(e,o),a?In(o,{code:Xr.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&In(o,{code:Xr.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")oCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"email",code:Xr.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")cCt||(cCt=new RegExp(sCo,"u")),cCt.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"emoji",code:Xr.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")tCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"uuid",code:Xr.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")rCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"nanoid",code:Xr.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")J4o.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"cuid",code:Xr.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Z4o.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"cuid2",code:Xr.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")eCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"ulid",code:Xr.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),In(o,{validation:"url",code:Xr.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"regex",code:Xr.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?YGr(s).test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?pCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?hCo(s).test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?iCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"duration",code:Xr.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?mCo(e.data,s.version)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"ip",code:Xr.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?gCo(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"jwt",code:Xr.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?ACo(e.data,s.version)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"cidr",code:Xr.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?dCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"base64",code:Xr.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?fCo.test(e.data)||(o=this._getOrReturnCtx(e,o),In(o,{validation:"base64url",code:Xr.invalid_string,message:s.message}),n.dirty()):ba.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:Xr.invalid_string,...Si.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Si.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Si.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Si.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Si.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Si.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Si.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Si.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Si.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Si.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Si.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Si.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Si.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Si.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?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Si.errToObj(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?.precision>"u"?null:e?.precision,...Si.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Si.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Si.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Si.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Si.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Si.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Si.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Si.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Si.errToObj(r)})}nonempty(e){return this.min(1,Si.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...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(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};HO.create=t=>new HO({checks:[],typeName:vo.ZodString,coerce:t?.coerce??!1,...Ts(t)});bj=class t extends Vs{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)!==Gn.number){let s=this._getOrReturnCtx(e);return In(s,{code:Xr.invalid_type,expected:Gn.number,received:s.parsedType}),ho}let n,o=new eA;for(let s of this._def.checks)s.kind==="int"?ba.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?yCo(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.not_finite,message:s.message}),o.dirty()):ba.assertNever(s);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Si.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Si.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Si.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Si.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Si.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Si.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Si.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Si.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Si.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Si.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Si.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Si.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Si.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Si.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ba.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};bj.create=t=>new bj({checks:[],typeName:vo.ZodNumber,coerce:t?.coerce||!1,...Ts(t)});Cj=class t extends Vs{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)!==Gn.bigint)return this._getInvalidInput(e);let n,o=new eA;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),In(n,{code:Xr.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):ba.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return In(r,{code:Xr.invalid_type,expected:Gn.bigint,received:r.parsedType}),ho}gte(e,r){return this.setLimit("min",e,!0,Si.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Si.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Si.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Si.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Si.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Si.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Si.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Si.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Si.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Si.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Cj.create=t=>new Cj({checks:[],typeName:vo.ZodBigInt,coerce:t?.coerce??!1,...Ts(t)});Sj=class extends Vs{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Gn.boolean){let n=this._getOrReturnCtx(e);return In(n,{code:Xr.invalid_type,expected:Gn.boolean,received:n.parsedType}),ho}return I2(e.data)}};Sj.create=t=>new Sj({typeName:vo.ZodBoolean,coerce:t?.coerce||!1,...Ts(t)});xj=class t extends Vs{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Gn.date){let s=this._getOrReturnCtx(e);return In(s,{code:Xr.invalid_type,expected:Gn.date,received:s.parsedType}),ho}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return In(s,{code:Xr.invalid_date}),ho}let n=new eA,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),In(o,{code:Xr.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):ba.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Si.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Si.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};xj.create=t=>new xj({checks:[],coerce:t?.coerce||!1,typeName:vo.ZodDate,...Ts(t)});gee=class extends Vs{_parse(e){if(this._getType(e)!==Gn.symbol){let n=this._getOrReturnCtx(e);return In(n,{code:Xr.invalid_type,expected:Gn.symbol,received:n.parsedType}),ho}return I2(e.data)}};gee.create=t=>new gee({typeName:vo.ZodSymbol,...Ts(t)});wj=class extends Vs{_parse(e){if(this._getType(e)!==Gn.undefined){let n=this._getOrReturnCtx(e);return In(n,{code:Xr.invalid_type,expected:Gn.undefined,received:n.parsedType}),ho}return I2(e.data)}};wj.create=t=>new wj({typeName:vo.ZodUndefined,...Ts(t)});Tj=class extends Vs{_parse(e){if(this._getType(e)!==Gn.null){let n=this._getOrReturnCtx(e);return In(n,{code:Xr.invalid_type,expected:Gn.null,received:n.parsedType}),ho}return I2(e.data)}};Tj.create=t=>new Tj({typeName:vo.ZodNull,...Ts(t)});VO=class extends Vs{constructor(){super(...arguments),this._any=!0}_parse(e){return I2(e.data)}};VO.create=t=>new VO({typeName:vo.ZodAny,...Ts(t)});pI=class extends Vs{constructor(){super(...arguments),this._unknown=!0}_parse(e){return I2(e.data)}};pI.create=t=>new pI({typeName:vo.ZodUnknown,...Ts(t)});vS=class extends Vs{_parse(e){let r=this._getOrReturnCtx(e);return In(r,{code:Xr.invalid_type,expected:Gn.never,received:r.parsedType}),ho}};vS.create=t=>new vS({typeName:vo.ZodNever,...Ts(t)});Aee=class extends Vs{_parse(e){if(this._getType(e)!==Gn.undefined){let n=this._getOrReturnCtx(e);return In(n,{code:Xr.invalid_type,expected:Gn.void,received:n.parsedType}),ho}return I2(e.data)}};Aee.create=t=>new Aee({typeName:vo.ZodVoid,...Ts(t)});hI=class t extends Vs{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==Gn.array)return In(r,{code:Xr.invalid_type,expected:Gn.array,received:r.parsedType}),ho;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,c=r.data.length<o.exactLength.value;(a||c)&&(In(r,{code:a?Xr.too_big:Xr.too_small,minimum:c?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(In(r,{code:Xr.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(In(r,{code:Xr.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,c)=>o.type._parseAsync(new pb(r,a,r.path,c)))).then(a=>eA.mergeArray(n,a));let s=[...r.data].map((a,c)=>o.type._parseSync(new pb(r,a,r.path,c)));return eA.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Si.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Si.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Si.toString(r)}})}nonempty(e){return this.min(1,e)}};hI.create=(t,e)=>new hI({type:t,minLength:null,maxLength:null,exactLength:null,typeName:vo.ZodArray,...Ts(e)});jy=class t extends Vs{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ba.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==Gn.object){let d=this._getOrReturnCtx(e);return In(d,{code:Xr.invalid_type,expected:Gn.object,received:d.parsedType}),ho}let{status:n,ctx:o}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof vS&&this._def.unknownKeys==="strip"))for(let d in o.data)a.includes(d)||c.push(d);let u=[];for(let d of a){let f=s[d],p=o.data[d];u.push({key:{status:"valid",value:d},value:f._parse(new pb(o,p,o.path,d)),alwaysSet:d in o.data})}if(this._def.catchall instanceof vS){let d=this._def.unknownKeys;if(d==="passthrough")for(let f of c)u.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(d==="strict")c.length>0&&(In(o,{code:Xr.unrecognized_keys,keys:c}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let f of c){let p=o.data[f];u.push({key:{status:"valid",value:f},value:d._parse(new pb(o,p,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let d=[];for(let f of u){let p=await f.key,h=await f.value;d.push({key:p,value:h,alwaysSet:f.alwaysSet})}return d}).then(d=>eA.mergeObjectSync(n,d)):eA.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Si.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Si.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:vo.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of ba.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ba.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return mee(this)}partial(e){let r={};for(let n of ba.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of ba.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof fb;)s=s._def.innerType;r[n]=s}return new t({...this._def,shape:()=>r})}keyof(){return KGr(ba.objectKeys(this.shape))}};jy.create=(t,e)=>new jy({shape:()=>t,unknownKeys:"strip",catchall:vS.create(),typeName:vo.ZodObject,...Ts(e)});jy.strictCreate=(t,e)=>new jy({shape:()=>t,unknownKeys:"strict",catchall:vS.create(),typeName:vo.ZodObject,...Ts(e)});jy.lazycreate=(t,e)=>new jy({shape:t,unknownKeys:"strip",catchall:vS.create(),typeName:vo.ZodObject,...Ts(e)});Ij=class extends Vs{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(s){for(let c of s)if(c.result.status==="valid")return c.result;for(let c of s)if(c.result.status==="dirty")return r.common.issues.push(...c.ctx.common.issues),c.result;let a=s.map(c=>new Qy(c.ctx.common.issues));return In(r,{code:Xr.invalid_union,unionErrors:a}),ho}if(r.common.async)return Promise.all(n.map(async s=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let s,a=[];for(let u of n){let d={...r,common:{...r.common,issues:[]},parent:null},f=u._parseSync({data:r.data,path:r.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!s&&(s={result:f,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let c=a.map(u=>new Qy(u));return In(r,{code:Xr.invalid_union,unionErrors:c}),ho}}get options(){return this._def.options}};Ij.create=(t,e)=>new Ij({options:t,typeName:vo.ZodUnion,...Ts(e)});fI=t=>t instanceof Rj?fI(t.schema):t instanceof hb?fI(t.innerType()):t instanceof kj?[t.value]:t instanceof Nj?t.options:t instanceof Oj?ba.objectValues(t.enum):t instanceof Bj?fI(t._def.innerType):t instanceof wj?[void 0]:t instanceof Tj?[null]:t instanceof fb?[void 0,...fI(t.unwrap())]:t instanceof Yw?[null,...fI(t.unwrap())]:t instanceof $ge||t instanceof Mj?fI(t.unwrap()):t instanceof Pj?fI(t._def.innerType):[],HPe=class t extends Vs{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Gn.object)return In(r,{code:Xr.invalid_type,expected:Gn.object,received:r.parsedType}),ho;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(In(r,{code:Xr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ho)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let s of r){let a=fI(s.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of a){if(o.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);o.set(c,s)}}return new t({typeName:vo.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Ts(n)})}};Dj=class extends Vs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(s,a)=>{if(GPe(s)||GPe(a))return ho;let c=lCt(s.value,a.value);return c.valid?((qPe(s)||qPe(a))&&r.dirty(),{status:r.value,value:c.data}):(In(n,{code:Xr.invalid_intersection_types}),ho)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,a])=>o(s,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Dj.create=(t,e,r)=>new Dj({left:t,right:e,typeName:vo.ZodIntersection,...Ts(r)});zw=class t extends Vs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Gn.array)return In(n,{code:Xr.invalid_type,expected:Gn.array,received:n.parsedType}),ho;if(n.data.length<this._def.items.length)return In(n,{code:Xr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ho;!this._def.rest&&n.data.length>this._def.items.length&&(In(n,{code:Xr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((a,c)=>{let u=this._def.items[c]||this._def.rest;return u?u._parse(new pb(n,a,n.path,c)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>eA.mergeArray(r,a)):eA.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};zw.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new zw({items:t,typeName:vo.ZodTuple,rest:null,...Ts(e)})};VPe=class t extends Vs{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Gn.object)return In(n,{code:Xr.invalid_type,expected:Gn.object,received:n.parsedType}),ho;let o=[],s=this._def.keyType,a=this._def.valueType;for(let c in n.data)o.push({key:s._parse(new pb(n,c,n.path,c)),value:a._parse(new pb(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?eA.mergeObjectAsync(r,o):eA.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Vs?new t({keyType:e,valueType:r,typeName:vo.ZodRecord,...Ts(n)}):new t({keyType:HO.create(),valueType:e,typeName:vo.ZodRecord,...Ts(r)})}},yee=class extends Vs{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Gn.map)return In(n,{code:Xr.invalid_type,expected:Gn.map,received:n.parsedType}),ho;let o=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([c,u],d)=>({key:o._parse(new pb(n,c,n.path,[d,"key"])),value:s._parse(new pb(n,u,n.path,[d,"value"]))}));if(n.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let u of a){let d=await u.key,f=await u.value;if(d.status==="aborted"||f.status==="aborted")return ho;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),c.set(d.value,f.value)}return{status:r.value,value:c}})}else{let c=new Map;for(let u of a){let d=u.key,f=u.value;if(d.status==="aborted"||f.status==="aborted")return ho;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),c.set(d.value,f.value)}return{status:r.value,value:c}}}};yee.create=(t,e,r)=>new yee({valueType:e,keyType:t,typeName:vo.ZodMap,...Ts(r)});_ee=class t extends Vs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Gn.set)return In(n,{code:Xr.invalid_type,expected:Gn.set,received:n.parsedType}),ho;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(In(n,{code:Xr.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(In(n,{code:Xr.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function a(u){let d=new Set;for(let f of u){if(f.status==="aborted")return ho;f.status==="dirty"&&r.dirty(),d.add(f.value)}return{status:r.value,value:d}}let c=[...n.data.values()].map((u,d)=>s._parse(new pb(n,u,n.path,d)));return n.common.async?Promise.all(c).then(u=>a(u)):a(c)}min(e,r){return new t({...this._def,minSize:{value:e,message:Si.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Si.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};_ee.create=(t,e)=>new _ee({valueType:t,minSize:null,maxSize:null,typeName:vo.ZodSet,...Ts(e)});WPe=class t extends Vs{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Gn.function)return In(r,{code:Xr.invalid_type,expected:Gn.function,received:r.parsedType}),ho;function n(c,u){return jge({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pee(),dI].filter(d=>!!d),issueData:{code:Xr.invalid_arguments,argumentsError:u}})}function o(c,u){return jge({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pee(),dI].filter(d=>!!d),issueData:{code:Xr.invalid_return_type,returnTypeError:u}})}let s={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof WO){let c=this;return I2(async function(...u){let d=new Qy([]),f=await c._def.args.parseAsync(u,s).catch(m=>{throw d.addIssue(n(u,m)),d}),p=await Reflect.apply(a,this,f);return await c._def.returns._def.type.parseAsync(p,s).catch(m=>{throw d.addIssue(o(p,m)),d})})}else{let c=this;return I2(function(...u){let d=c._def.args.safeParse(u,s);if(!d.success)throw new Qy([n(u,d.error)]);let f=Reflect.apply(a,this,d.data),p=c._def.returns.safeParse(f,s);if(!p.success)throw new Qy([o(f,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:zw.create(e).rest(pI.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||zw.create([]).rest(pI.create()),returns:r||pI.create(),typeName:vo.ZodFunction,...Ts(n)})}},Rj=class extends Vs{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Rj.create=(t,e)=>new Rj({getter:t,typeName:vo.ZodLazy,...Ts(e)});kj=class extends Vs{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return In(r,{received:r.data,code:Xr.invalid_literal,expected:this._def.value}),ho}return{status:"valid",value:e.data}}get value(){return this._def.value}};kj.create=(t,e)=>new kj({value:t,typeName:vo.ZodLiteral,...Ts(e)});Nj=class t extends Vs{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return In(r,{expected:ba.joinValues(n),received:r.parsedType,code:Xr.invalid_type}),ho}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return In(r,{received:r.data,code:Xr.invalid_enum_value,options:n}),ho}return I2(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Nj.create=KGr;Oj=class extends Vs{_parse(e){let r=ba.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Gn.string&&n.parsedType!==Gn.number){let o=ba.objectValues(r);return In(n,{expected:ba.joinValues(o),received:n.parsedType,code:Xr.invalid_type}),ho}if(this._cache||(this._cache=new Set(ba.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=ba.objectValues(r);return In(n,{received:n.data,code:Xr.invalid_enum_value,options:o}),ho}return I2(e.data)}get enum(){return this._def.values}};Oj.create=(t,e)=>new Oj({values:t,typeName:vo.ZodNativeEnum,...Ts(e)});WO=class extends Vs{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Gn.promise&&r.common.async===!1)return In(r,{code:Xr.invalid_type,expected:Gn.promise,received:r.parsedType}),ho;let n=r.parsedType===Gn.promise?r.data:Promise.resolve(r.data);return I2(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};WO.create=(t,e)=>new WO({type:t,typeName:vo.ZodPromise,...Ts(e)});hb=class extends Vs{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===vo.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:a=>{In(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let a=o.transform(n.data,s);if(n.common.async)return Promise.resolve(a).then(async c=>{if(r.value==="aborted")return ho;let u=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return u.status==="aborted"?ho:u.status==="dirty"?vj(u.value):r.value==="dirty"?vj(u.value):u});{if(r.value==="aborted")return ho;let c=this._def.schema._parseSync({data:a,path:n.path,parent:n});return c.status==="aborted"?ho:c.status==="dirty"?vj(c.value):r.value==="dirty"?vj(c.value):c}}if(o.type==="refinement"){let a=c=>{let u=o.refinement(c,s);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?ho:(c.status==="dirty"&&r.dirty(),a(c.value),{status:r.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?ho:(c.status==="dirty"&&r.dirty(),a(c.value).then(()=>({status:r.value,value:c.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!qO(a))return ho;let c=o.transform(a.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>qO(a)?Promise.resolve(o.transform(a.value,s)).then(c=>({status:r.value,value:c})):ho);ba.assertNever(o)}};hb.create=(t,e,r)=>new hb({schema:t,typeName:vo.ZodEffects,effect:e,...Ts(r)});hb.createWithPreprocess=(t,e,r)=>new hb({schema:e,effect:{type:"preprocess",transform:t},typeName:vo.ZodEffects,...Ts(r)});fb=class extends Vs{_parse(e){return this._getType(e)===Gn.undefined?I2(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};fb.create=(t,e)=>new fb({innerType:t,typeName:vo.ZodOptional,...Ts(e)});Yw=class extends Vs{_parse(e){return this._getType(e)===Gn.null?I2(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Yw.create=(t,e)=>new Yw({innerType:t,typeName:vo.ZodNullable,...Ts(e)});Bj=class extends Vs{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===Gn.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Bj.create=(t,e)=>new Bj({innerType:t,typeName:vo.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ts(e)});Pj=class extends Vs{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return hee(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Qy(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Qy(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Pj.create=(t,e)=>new Pj({innerType:t,typeName:vo.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ts(e)});Eee=class extends Vs{_parse(e){if(this._getType(e)!==Gn.nan){let n=this._getOrReturnCtx(e);return In(n,{code:Xr.invalid_type,expected:Gn.nan,received:n.parsedType}),ho}return{status:"valid",value:e.data}}};Eee.create=t=>new Eee({typeName:vo.ZodNaN,...Ts(t)});_Co=Symbol("zod_brand"),$ge=class extends Vs{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Gge=class t extends Vs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ho:s.status==="dirty"?(r.dirty(),vj(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ho:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:vo.ZodPipeline})}},Mj=class extends Vs{_parse(e){let r=this._def.innerType._parse(e),n=o=>(qO(o)&&(o.value=Object.freeze(o.value)),o);return hee(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Mj.create=(t,e)=>new Mj({innerType:t,typeName:vo.ZodReadonly,...Ts(e)});ECo={object:jy.lazycreate};(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"})(vo||(vo={}));vCo=(t,e={message:`Input not instance of ${t.name}`})=>XGr(r=>r instanceof t,e),JGr=HO.create,ZGr=bj.create,bCo=Eee.create,CCo=Cj.create,eqr=Sj.create,SCo=xj.create,xCo=gee.create,wCo=wj.create,TCo=Tj.create,ICo=VO.create,DCo=pI.create,RCo=vS.create,kCo=Aee.create,NCo=hI.create,OCo=jy.create,BCo=jy.strictCreate,PCo=Ij.create,MCo=HPe.create,FCo=Dj.create,LCo=zw.create,UCo=VPe.create,QCo=yee.create,jCo=_ee.create,$Co=WPe.create,GCo=Rj.create,qCo=kj.create,HCo=Nj.create,VCo=Oj.create,WCo=WO.create,zCo=hb.create,YCo=fb.create,KCo=Yw.create,XCo=hb.createWithPreprocess,JCo=Gge.create,ZCo=()=>JGr().optional(),eSo=()=>ZGr().optional(),tSo=()=>eqr().optional(),rSo={string:(t=>HO.create({...t,coerce:!0})),number:(t=>bj.create({...t,coerce:!0})),boolean:(t=>Sj.create({...t,coerce:!0})),bigint:(t=>Cj.create({...t,coerce:!0})),date:(t=>xj.create({...t,coerce:!0}))},nSo=ho});var Ke={};ls(Ke,{BRAND:()=>_Co,DIRTY:()=>vj,EMPTY_PATH:()=>X4o,INVALID:()=>ho,NEVER:()=>nSo,OK:()=>I2,ParseStatus:()=>eA,Schema:()=>Vs,ZodAny:()=>VO,ZodArray:()=>hI,ZodBigInt:()=>Cj,ZodBoolean:()=>Sj,ZodBranded:()=>$ge,ZodCatch:()=>Pj,ZodDate:()=>xj,ZodDefault:()=>Bj,ZodDiscriminatedUnion:()=>HPe,ZodEffects:()=>hb,ZodEnum:()=>Nj,ZodError:()=>Qy,ZodFirstPartyTypeKind:()=>vo,ZodFunction:()=>WPe,ZodIntersection:()=>Dj,ZodIssueCode:()=>Xr,ZodLazy:()=>Rj,ZodLiteral:()=>kj,ZodMap:()=>yee,ZodNaN:()=>Eee,ZodNativeEnum:()=>Oj,ZodNever:()=>vS,ZodNull:()=>Tj,ZodNullable:()=>Yw,ZodNumber:()=>bj,ZodObject:()=>jy,ZodOptional:()=>fb,ZodParsedType:()=>Gn,ZodPipeline:()=>Gge,ZodPromise:()=>WO,ZodReadonly:()=>Mj,ZodRecord:()=>VPe,ZodSchema:()=>Vs,ZodSet:()=>_ee,ZodString:()=>HO,ZodSymbol:()=>gee,ZodTransformer:()=>hb,ZodTuple:()=>zw,ZodType:()=>Vs,ZodUndefined:()=>wj,ZodUnion:()=>Ij,ZodUnknown:()=>pI,ZodVoid:()=>Aee,addIssueToContext:()=>In,any:()=>ICo,array:()=>NCo,bigint:()=>CCo,boolean:()=>eqr,coerce:()=>rSo,custom:()=>XGr,date:()=>SCo,datetimeRegex:()=>YGr,defaultErrorMap:()=>dI,discriminatedUnion:()=>MCo,effect:()=>zCo,enum:()=>HCo,function:()=>$Co,getErrorMap:()=>pee,getParsedType:()=>Ww,instanceof:()=>vCo,intersection:()=>FCo,isAborted:()=>GPe,isAsync:()=>hee,isDirty:()=>qPe,isValid:()=>qO,late:()=>ECo,lazy:()=>GCo,literal:()=>qCo,makeIssue:()=>jge,map:()=>QCo,nan:()=>bCo,nativeEnum:()=>VCo,never:()=>RCo,null:()=>TCo,nullable:()=>KCo,number:()=>ZGr,object:()=>OCo,objectUtil:()=>oCt,oboolean:()=>tSo,onumber:()=>eSo,optional:()=>YCo,ostring:()=>ZCo,pipeline:()=>JCo,preprocess:()=>XCo,promise:()=>WCo,quotelessJson:()=>z4o,record:()=>UCo,set:()=>jCo,setErrorMap:()=>K4o,strictObject:()=>BCo,string:()=>JGr,symbol:()=>xCo,transformer:()=>zCo,tuple:()=>LCo,undefined:()=>wCo,union:()=>PCo,unknown:()=>DCo,util:()=>ba,void:()=>kCo});var uCt=q(()=>{$Pe();aCt();GGr();Qge();tqr();jPe()});function lr(t,e,r){function n(c,u){var d;Object.defineProperty(c,"_zod",{value:c._zod??{},enumerable:!1}),(d=c._zod).traits??(d.traits=new Set),c._zod.traits.add(t),e(c,u);for(let f in a.prototype)f in c||Object.defineProperty(c,f,{value:a.prototype[f].bind(c)});c._zod.constr=a,c._zod.def=u}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function a(c){var u;let d=r?.Parent?new s:this;n(d,c),(u=d._zod).deferred??(u.deferred=[]);for(let f of d._zod.deferred)f();return d}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}function DE(t){return t&&Object.assign(zPe,t),zPe}var dCt,iSo,mI,zPe,vee=q(()=>{dCt=Object.freeze({status:"aborted"});iSo=Symbol("zod_brand"),mI=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},zPe={}});var kc={};ls(kc,{BIGINT_FORMAT_RANGES:()=>nqr,Class:()=>pCt,NUMBER_FORMAT_RANGES:()=>vCt,aborted:()=>Lj,allowsEval:()=>yCt,assert:()=>lSo,assertEqual:()=>oSo,assertIs:()=>aSo,assertNever:()=>cSo,assertNotEqual:()=>sSo,assignProp:()=>ACt,cached:()=>Hge,captureStackTrace:()=>KPe,cleanEnum:()=>bSo,cleanRegex:()=>Wge,clone:()=>bS,createTransparentProxy:()=>mSo,defineLazy:()=>Ku,esc:()=>Fj,escapeRegex:()=>zO,extend:()=>ySo,finalizeIssue:()=>CS,floatSafeRemainder:()=>gCt,getElementAtPath:()=>uSo,getEnumValues:()=>hCt,getLengthableOrigin:()=>zge,getParsedType:()=>hSo,getSizableOrigin:()=>iqr,isObject:()=>bee,isPlainObject:()=>Cee,issue:()=>bCt,joinValues:()=>YPe,jsonStringifyReplacer:()=>mCt,merge:()=>_So,normalizeParams:()=>Hi,nullish:()=>Vge,numKeys:()=>pSo,omit:()=>ASo,optionalKeys:()=>ECt,partial:()=>ESo,pick:()=>gSo,prefixIssues:()=>Kw,primitiveTypes:()=>rqr,promiseAllObject:()=>dSo,propertyKeyTypes:()=>_Ct,randomString:()=>fSo,required:()=>vSo,stringifyPrimitive:()=>XPe,unwrapMessage:()=>qge});function oSo(t){return t}function sSo(t){return t}function aSo(t){}function cSo(t){throw new Error}function lSo(t){}function hCt(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function YPe(t,e="|"){return t.map(r=>XPe(r)).join(e)}function mCt(t,e){return typeof e=="bigint"?e.toString():e}function Hge(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Vge(t){return t==null}function Wge(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function gCt(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}function Ku(t,e,r){Object.defineProperty(t,e,{get(){{let o=r();return t[e]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function ACt(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function uSo(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function dSo(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<e.length;s++)o[e[s]]=n[s];return o})}function fSo(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function Fj(t){return JSON.stringify(t)}function bee(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Cee(t){if(bee(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(bee(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function pSo(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function zO(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bS(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function Hi(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function mSo(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,s){return e??(e=t()),Reflect.set(e,n,o,s)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function XPe(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function ECt(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function gSo(t,e){let r={},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(r[o]=n.shape[o])}return bS(t,{...t._zod.def,shape:r,checks:[]})}function ASo(t,e){let r={...t._zod.def.shape},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete r[o]}return bS(t,{...t._zod.def,shape:r,checks:[]})}function ySo(t,e){if(!Cee(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return ACt(this,"shape",n),n},checks:[]};return bS(t,r)}function _So(t,e){return bS(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return ACt(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function ESo(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=t?new t({type:"optional",innerType:n[s]}):n[s])}else for(let s in n)o[s]=t?new t({type:"optional",innerType:n[s]}):n[s];return bS(e,{...e._zod.def,shape:o,checks:[]})}function vSo(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:n[s]}))}else for(let s in n)o[s]=new t({type:"nonoptional",innerType:n[s]});return bS(e,{...e._zod.def,shape:o,checks:[]})}function Lj(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Kw(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function qge(t){return typeof t=="string"?t:t?.message}function CS(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=qge(t.inst?._zod.def?.error?.(t))??qge(e?.error?.(t))??qge(r.customError?.(t))??qge(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function iqr(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function zge(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function bCt(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function bSo(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var KPe,yCt,hSo,_Ct,rqr,vCt,nqr,pCt,gI=q(()=>{KPe=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};yCt=Hge(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});hSo=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},_Ct=new Set(["string","number","symbol"]),rqr=new Set(["string","number","bigint","boolean","symbol","undefined"]);vCt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},nqr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};pCt=class{constructor(...e){}}});function SCt(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function xCt(t,e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>o({issues:c}));else if(a.code==="invalid_key")o({issues:a.issues});else if(a.code==="invalid_element")o({issues:a.issues});else if(a.path.length===0)n._errors.push(r(a));else{let c=n,u=0;for(;u<a.path.length;){let d=a.path[u];u===a.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(r(a))):c[d]=c[d]||{_errors:[]},c=c[d],u++}}};return o(t),n}var oqr,JPe,CCt,wCt=q(()=>{vee();gI();oqr=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,mCt,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},JPe=lr("$ZodError",oqr),CCt=lr("$ZodError",oqr,{Parent:Error})});var sqr,aqr,TCt,Yge,ICt,ZPe,DCt=q(()=>{vee();wCt();gI();sqr=t=>(e,r,n,o)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new mI;if(a.issues.length){let c=new(o?.Err??t)(a.issues.map(u=>CS(u,s,DE())));throw KPe(c,o?.callee),c}return a.value},aqr=t=>async(e,r,n,o)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(o?.Err??t)(a.issues.map(u=>CS(u,s,DE())));throw KPe(c,o?.callee),c}return a.value},TCt=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new mI;return s.issues.length?{success:!1,error:new(t??JPe)(s.issues.map(a=>CS(a,o,DE())))}:{success:!0,data:s.value}},Yge=TCt(CCt),ICt=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(a=>CS(a,o,DE())))}:{success:!0,data:s.value}},ZPe=ICt(CCt)});function Aqr(){return new RegExp(SSo,"u")}function Tqr(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Iqr(t){return new RegExp(`^${Tqr(t)}$`)}function Dqr(t){let e=Tqr({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${xqr}T(?:${n})$`)}var cqr,lqr,uqr,dqr,fqr,pqr,hqr,mqr,RCt,gqr,SSo,yqr,_qr,Eqr,vqr,bqr,kCt,Cqr,Sqr,xqr,wqr,Rqr,kqr,Nqr,Oqr,Bqr,Pqr,Mqr,Fqr,tMe=q(()=>{cqr=/^[cC][^\s-]{8,}$/,lqr=/^[0-9a-z]+$/,uqr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,dqr=/^[0-9a-vA-V]{20}$/,fqr=/^[A-Za-z0-9]{27}$/,pqr=/^[a-zA-Z0-9_-]{21}$/,hqr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,mqr=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,RCt=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,gqr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,SSo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";yqr=/^(?:(?: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])$/,_qr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Eqr=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,vqr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bqr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,kCt=/^[A-Za-z0-9_-]*$/,Cqr=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Sqr=/^\+(?:[0-9]){6,14}[0-9]$/,xqr="(?:(?:\\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])))",wqr=new RegExp(`^${xqr}$`);Rqr=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},kqr=/^\d+n?$/,Nqr=/^\d+$/,Oqr=/^-?\d+(?:\.\d+)?/i,Bqr=/true|false/i,Pqr=/null/i,Mqr=/^[^A-Z]*$/,Fqr=/^[^a-z]*$/});var D2,Lqr,NCt,OCt,Uqr,Qqr,jqr,$qr,Gqr,Kge,qqr,Hqr,Vqr,Wqr,zqr,Yqr,Kqr,rMe=q(()=>{vee();tMe();gI();D2=lr("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Lqr={number:"number",bigint:"bigint",object:"date"},NCt=lr("$ZodCheckLessThan",(t,e)=>{D2.init(t,e);let r=Lqr[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),OCt=lr("$ZodCheckGreaterThan",(t,e)=>{D2.init(t,e);let r=Lqr[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Uqr=lr("$ZodCheckMultipleOf",(t,e)=>{D2.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):gCt(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Qqr=lr("$ZodCheckNumberFormat",(t,e)=>{D2.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,s]=vCt[e.format];t._zod.onattach.push(a=>{let c=a._zod.bag;c.format=e.format,c.minimum=o,c.maximum=s,r&&(c.pattern=Nqr)}),t._zod.check=a=>{let c=a.value;if(r){if(!Number.isInteger(c)){a.issues.push({expected:n,format:e.format,code:"invalid_type",input:c,inst:t});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}c<o&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inst:t})}}),jqr=lr("$ZodCheckMaxLength",(t,e)=>{var r;D2.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Vge(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let a=zge(o);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),$qr=lr("$ZodCheckMinLength",(t,e)=>{var r;D2.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Vge(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let a=zge(o);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Gqr=lr("$ZodCheckLengthEquals",(t,e)=>{var r;D2.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Vge(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,s=o.length;if(s===e.length)return;let a=zge(o),c=s>e.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Kge=lr("$ZodCheckStringFormat",(t,e)=>{var r,n;D2.init(t,e),t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),qqr=lr("$ZodCheckRegex",(t,e)=>{Kge.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Hqr=lr("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Mqr),Kge.init(t,e)}),Vqr=lr("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Fqr),Kge.init(t,e)}),Wqr=lr("$ZodCheckIncludes",(t,e)=>{D2.init(t,e);let r=zO(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),zqr=lr("$ZodCheckStartsWith",(t,e)=>{D2.init(t,e);let r=new RegExp(`^${zO(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),Yqr=lr("$ZodCheckEndsWith",(t,e)=>{D2.init(t,e);let r=new RegExp(`.*${zO(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}}),Kqr=lr("$ZodCheckOverwrite",(t,e)=>{D2.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var nMe,BCt=q(()=>{nMe=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
962
962
  `).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),s=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of s)this.content.push(a)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...r,o.join(`
963
963
  `))}}});var Jqr,PCt=q(()=>{Jqr={major:4,minor:0,patch:0}});function THr(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}function xSo(t){if(!kCt.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return THr(r)}function wSo(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}function Zqr(t,e,r){t.issues.length&&e.issues.push(...Kw(r,t.issues)),e.value[r]=t.value}function iMe(t,e,r){t.issues.length&&e.issues.push(...Kw(r,t.issues)),e.value[r]=t.value}function eHr(t,e,r,n){t.issues.length?n[r]===void 0?r in n?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...Kw(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function tHr(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>CS(s,n,DE())))}),e}function MCt(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Cee(t)&&Cee(e)){let r=Object.keys(e),n=Object.keys(t).filter(s=>r.indexOf(s)!==-1),o={...t,...e};for(let s of n){let a=MCt(t[s],e[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};o[s]=a.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],s=e[n],a=MCt(o,s);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function rHr(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),Lj(t))return t;let n=MCt(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}function nHr(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function iHr(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function oHr(t,e,r){return Lj(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}function sHr(t){return t.value=Object.freeze(t.value),t}function aHr(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(bCt(o))}}var Ol,oMe,Td,cHr,lHr,uHr,dHr,fHr,pHr,hHr,mHr,gHr,AHr,yHr,_Hr,EHr,vHr,bHr,CHr,SHr,xHr,wHr,IHr,DHr,RHr,kHr,FCt,NHr,OHr,BHr,PHr,MHr,FHr,LHr,UHr,QHr,jHr,LCt,$Hr,GHr,qHr,HHr,VHr,WHr,zHr,YHr,KHr,XHr,JHr,ZHr,eVr,tVr,rVr,nVr=q(()=>{rMe();vee();BCt();DCt();tMe();gI();PCt();gI();Ol=lr("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Jqr;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let s of o._zod.onattach)s(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(s,a,c)=>{let u=Lj(s),d;for(let f of a){if(f._zod.def.when){if(!f._zod.def.when(s))continue}else if(u)continue;let p=s.issues.length,h=f._zod.check(s);if(h instanceof Promise&&c?.async===!1)throw new mI;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,s.issues.length!==p&&(u||(u=Lj(s,p)))});else{if(s.issues.length===p)continue;u||(u=Lj(s,p))}}return d?d.then(()=>s):s};t._zod.run=(s,a)=>{let c=t._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new mI;return c.then(u=>o(u,n,a))}return o(c,n,a)}}t["~standard"]={validate:o=>{try{let s=Yge(t,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return ZPe(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),oMe=lr("$ZodString",(t,e)=>{Ol.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Rqr(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),Td=lr("$ZodStringFormat",(t,e)=>{Kge.init(t,e),oMe.init(t,e)}),cHr=lr("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=mqr),Td.init(t,e)}),lHr=lr("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=RCt(n))}else e.pattern??(e.pattern=RCt());Td.init(t,e)}),uHr=lr("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=gqr),Td.init(t,e)}),dHr=lr("$ZodURL",(t,e)=>{Td.init(t,e),t._zod.check=r=>{try{let n=r.value,o=new URL(n),s=o.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Cqr.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),!n.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),fHr=lr("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Aqr()),Td.init(t,e)}),pHr=lr("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=pqr),Td.init(t,e)}),hHr=lr("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=cqr),Td.init(t,e)}),mHr=lr("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=lqr),Td.init(t,e)}),gHr=lr("$ZodULID",(t,e)=>{e.pattern??(e.pattern=uqr),Td.init(t,e)}),AHr=lr("$ZodXID",(t,e)=>{e.pattern??(e.pattern=dqr),Td.init(t,e)}),yHr=lr("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=fqr),Td.init(t,e)}),_Hr=lr("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Dqr(e)),Td.init(t,e)}),EHr=lr("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=wqr),Td.init(t,e)}),vHr=lr("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Iqr(e)),Td.init(t,e)}),bHr=lr("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=hqr),Td.init(t,e)}),CHr=lr("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=yqr),Td.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4"})}),SHr=lr("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=_qr),Td.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),xHr=lr("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Eqr),Td.init(t,e)}),wHr=lr("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=vqr),Td.init(t,e),t._zod.check=r=>{let[n,o]=r.value.split("/");try{if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});IHr=lr("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=bqr),Td.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{THr(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});DHr=lr("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=kCt),Td.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{xSo(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),RHr=lr("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Sqr),Td.init(t,e)});kHr=lr("$ZodJWT",(t,e)=>{Td.init(t,e),t._zod.check=r=>{wSo(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),FCt=lr("$ZodNumber",(t,e)=>{Ol.init(t,e),t._zod.pattern=t._zod.bag.pattern??Oqr,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...s?{received:s}:{}}),r}}),NHr=lr("$ZodNumber",(t,e)=>{Qqr.init(t,e),FCt.init(t,e)}),OHr=lr("$ZodBoolean",(t,e)=>{Ol.init(t,e),t._zod.pattern=Bqr,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),BHr=lr("$ZodBigInt",(t,e)=>{Ol.init(t,e),t._zod.pattern=kqr,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),PHr=lr("$ZodNull",(t,e)=>{Ol.init(t,e),t._zod.pattern=Pqr,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),MHr=lr("$ZodAny",(t,e)=>{Ol.init(t,e),t._zod.parse=r=>r}),FHr=lr("$ZodUnknown",(t,e)=>{Ol.init(t,e),t._zod.parse=r=>r}),LHr=lr("$ZodNever",(t,e)=>{Ol.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),UHr=lr("$ZodDate",(t,e)=>{Ol.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:t}),r}});QHr=lr("$ZodArray",(t,e)=>{Ol.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let s=[];for(let a=0;a<o.length;a++){let c=o[a],u=e.element._zod.run({value:c,issues:[]},n);u instanceof Promise?s.push(u.then(d=>Zqr(d,r,a))):Zqr(u,r,a)}return s.length?Promise.all(s).then(()=>r):r}});jHr=lr("$ZodObject",(t,e)=>{Ol.init(t,e);let r=Hge(()=>{let p=Object.keys(e.shape);for(let m of p)if(!(e.shape[m]instanceof Ol))throw new Error(`Invalid element at key "${m}": expected a Zod schema`);let h=ECt(e.shape);return{shape:e.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(h)}});Ku(t._zod,"propValues",()=>{let p=e.shape,h={};for(let m in p){let g=p[m]._zod;if(g.values){h[m]??(h[m]=new Set);for(let A of g.values)h[m].add(A)}}return h});let n=p=>{let h=new nMe(["shape","payload","ctx"]),m=r.value,g=v=>{let b=Fj(v);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};h.write("const input = payload.value;");let A=Object.create(null),y=0;for(let v of m.keys)A[v]=`key_${y++}`;h.write("const newResult = {}");for(let v of m.keys)if(m.optionalKeys.has(v)){let b=A[v];h.write(`const ${b} = ${g(v)};`);let S=Fj(v);h.write(`
964
964
  if (${b}.issues.length) {
@@ -996,7 +996,7 @@ ${e}
996
996
  `;break;case"id":c=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?n(parseInt(y,10)):r(new SFe(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:E}));break;default:r(new SFe(`Unknown field "${A.length>20?`${A.slice(0,20)}\u2026`:A}"`,{type:"unknown-field",field:A,value:y,line:E}));break}}function m(){u.length>0&&e({id:c,event:d||void 0,data:u.endsWith(`
997
997
  `)?u.slice(0,-1):u}),c=void 0,u="",d=""}function g(A={}){s&&A.consume&&p(s),a=!0,c=void 0,u="",d="",s=""}return{feed:f,reset:g}}function BDo(t){let e=[],r="",n=0;for(;n<t.length;){let o=t.indexOf("\r",n),s=t.indexOf(`
998
998
  `,n),a=-1;if(o!==-1&&s!==-1?a=Math.min(o,s):o!==-1?o===t.length-1?a=-1:a=o:s!==-1&&(a=s),a===-1){r=t.slice(n);break}else{let c=t.slice(n,a);e.push(c),n=a+1,t[n-1]==="\r"&&t[n]===`
999
- `&&n++}}return[e,r]}var SFe,dwt=q(()=>{SFe=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}});function PDo(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function fwt(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(fwt).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${fwt(t.cause)}`:t.message:`${t}`}function YXr(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function MDo(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var TFe,XXr,Ewt,Ca,km,gf,xI,zy,t$,Zee,wFe,IFe,Q0e,rte,j0e,sB,ete,nte,tte,L0e,kS,pwt,hwt,mwt,KXr,gwt,Awt,U0e,ywt,_wt,r$,JXr=q(()=>{dwt();TFe=class extends Event{constructor(e,r){var n,o;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(o=r?.message)!=null?o:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(YXr(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(YXr(this),r)}};XXr=t=>{throw TypeError(t)},Ewt=(t,e,r)=>e.has(t)||XXr("Cannot "+r),Ca=(t,e,r)=>(Ewt(t,e,"read from private field"),r?r.call(t):e.get(t)),km=(t,e,r)=>e.has(t)?XXr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),gf=(t,e,r,n)=>(Ewt(t,e,"write to private field"),e.set(t,r),r),xI=(t,e,r)=>(Ewt(t,e,"access private method"),r),r$=class extends EventTarget{constructor(e,r){var n,o;super(),km(this,kS),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,km(this,zy),km(this,t$),km(this,Zee),km(this,wFe),km(this,IFe),km(this,Q0e),km(this,rte),km(this,j0e,null),km(this,sB),km(this,ete),km(this,nte,null),km(this,tte,null),km(this,L0e,null),km(this,hwt,async s=>{var a;Ca(this,ete).reset();let{body:c,redirected:u,status:d,headers:f}=s;if(d===204){xI(this,kS,U0e).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?gf(this,Zee,new URL(s.url)):gf(this,Zee,void 0),d!==200){xI(this,kS,U0e).call(this,`Non-200 status code (${d})`,d);return}if(!(f.get("content-type")||"").startsWith("text/event-stream")){xI(this,kS,U0e).call(this,'Invalid content type, expected "text/event-stream"',d);return}if(Ca(this,zy)===this.CLOSED)return;gf(this,zy,this.OPEN);let p=new Event("open");if((a=Ca(this,L0e))==null||a.call(this,p),this.dispatchEvent(p),typeof c!="object"||!c||!("getReader"in c)){xI(this,kS,U0e).call(this,"Invalid response body, expected a web ReadableStream",d),this.close();return}let h=new TextDecoder,m=c.getReader(),g=!0;do{let{done:A,value:y}=await m.read();y&&Ca(this,ete).feed(h.decode(y,{stream:!A})),A&&(g=!1,Ca(this,ete).reset(),xI(this,kS,ywt).call(this))}while(g)}),km(this,mwt,s=>{gf(this,sB,void 0),!(s.name==="AbortError"||s.type==="aborted")&&xI(this,kS,ywt).call(this,fwt(s))}),km(this,gwt,s=>{typeof s.id=="string"&&gf(this,j0e,s.id);let a=new MessageEvent(s.event||"message",{data:s.data,origin:Ca(this,Zee)?Ca(this,Zee).origin:Ca(this,t$).origin,lastEventId:s.id||""});Ca(this,tte)&&(!s.event||s.event==="message")&&Ca(this,tte).call(this,a),this.dispatchEvent(a)}),km(this,Awt,s=>{gf(this,Q0e,s)}),km(this,_wt,()=>{gf(this,rte,void 0),Ca(this,zy)===this.CONNECTING&&xI(this,kS,pwt).call(this)});try{if(e instanceof URL)gf(this,t$,e);else if(typeof e=="string")gf(this,t$,new URL(e,MDo()));else throw new Error("Invalid URL")}catch{throw PDo("An invalid or illegal string was specified")}gf(this,ete,xFe({onEvent:Ca(this,gwt),onRetry:Ca(this,Awt)})),gf(this,zy,this.CONNECTING),gf(this,Q0e,3e3),gf(this,IFe,(n=r?.fetch)!=null?n:globalThis.fetch),gf(this,wFe,(o=r?.withCredentials)!=null?o:!1),xI(this,kS,pwt).call(this)}get readyState(){return Ca(this,zy)}get url(){return Ca(this,t$).href}get withCredentials(){return Ca(this,wFe)}get onerror(){return Ca(this,nte)}set onerror(e){gf(this,nte,e)}get onmessage(){return Ca(this,tte)}set onmessage(e){gf(this,tte,e)}get onopen(){return Ca(this,L0e)}set onopen(e){gf(this,L0e,e)}addEventListener(e,r,n){let o=r;super.addEventListener(e,o,n)}removeEventListener(e,r,n){let o=r;super.removeEventListener(e,o,n)}close(){Ca(this,rte)&&clearTimeout(Ca(this,rte)),Ca(this,zy)!==this.CLOSED&&(Ca(this,sB)&&Ca(this,sB).abort(),gf(this,zy,this.CLOSED),gf(this,sB,void 0))}};zy=new WeakMap,t$=new WeakMap,Zee=new WeakMap,wFe=new WeakMap,IFe=new WeakMap,Q0e=new WeakMap,rte=new WeakMap,j0e=new WeakMap,sB=new WeakMap,ete=new WeakMap,nte=new WeakMap,tte=new WeakMap,L0e=new WeakMap,kS=new WeakSet,pwt=function(){gf(this,zy,this.CONNECTING),gf(this,sB,new AbortController),Ca(this,IFe)(Ca(this,t$),xI(this,kS,KXr).call(this)).then(Ca(this,hwt)).catch(Ca(this,mwt))},hwt=new WeakMap,mwt=new WeakMap,KXr=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ca(this,j0e)?{"Last-Event-ID":Ca(this,j0e)}:void 0},cache:"no-store",signal:(t=Ca(this,sB))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},gwt=new WeakMap,Awt=new WeakMap,U0e=function(t,e){var r;Ca(this,zy)!==this.CLOSED&&gf(this,zy,this.CLOSED);let n=new TFe("error",{code:e,message:t});(r=Ca(this,nte))==null||r.call(this,n),this.dispatchEvent(n)},ywt=function(t,e){var r;if(Ca(this,zy)===this.CLOSED)return;gf(this,zy,this.CONNECTING);let n=new TFe("error",{code:e,message:t});(r=Ca(this,nte))==null||r.call(this,n),this.dispatchEvent(n),gf(this,rte,setTimeout(Ca(this,_wt),Ca(this,Q0e)))},_wt=new WeakMap,r$.CONNECTING=0,r$.OPEN=1,r$.CLOSED=2});function ite(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function DFe(t=fetch,e){return e?async(r,n)=>{let o={...e,...n,headers:n?.headers?{...ite(e.headers),...ite(n.headers)}:e.headers};return t(r,o)}:t}var vwt=q(()=>{});async function FDo(t){return(await bwt).getRandomValues(new Uint8Array(t))}async function LDo(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await FDo(t);for(let o=0;o<t;o++){let s=n[o]%e.length;r+=e[s]}return r}async function UDo(t){return await LDo(t)}async function QDo(t){let e=await(await bwt).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Cwt(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await UDo(t),r=await QDo(e);return{code_verifier:e,code_challenge:r}}var bwt,ZXr=q(()=>{bwt=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var sA,tJr,Swt,jDo,rJr,nJr,iJr,eJr,$Do,GDo,oJr,rfc,nfc,xwt=q(()=>{hSt();sA=bWr().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:OWr.custom,message:"URL must be parseable",fatal:!0}),dCt}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),tJr=R2({resource:It().url(),authorization_servers:En(sA).optional(),jwks_uri:It().url().optional(),scopes_supported:En(It()).optional(),bearer_methods_supported:En(It()).optional(),resource_signing_alg_values_supported:En(It()).optional(),resource_name:It().optional(),resource_documentation:It().optional(),resource_policy_uri:It().url().optional(),resource_tos_uri:It().url().optional(),tls_client_certificate_bound_access_tokens:Ju().optional(),authorization_details_types_supported:En(It()).optional(),dpop_signing_alg_values_supported:En(It()).optional(),dpop_bound_access_tokens_required:Ju().optional()}),Swt=R2({issuer:It(),authorization_endpoint:sA,token_endpoint:sA,registration_endpoint:sA.optional(),scopes_supported:En(It()).optional(),response_types_supported:En(It()),response_modes_supported:En(It()).optional(),grant_types_supported:En(It()).optional(),token_endpoint_auth_methods_supported:En(It()).optional(),token_endpoint_auth_signing_alg_values_supported:En(It()).optional(),service_documentation:sA.optional(),revocation_endpoint:sA.optional(),revocation_endpoint_auth_methods_supported:En(It()).optional(),revocation_endpoint_auth_signing_alg_values_supported:En(It()).optional(),introspection_endpoint:It().optional(),introspection_endpoint_auth_methods_supported:En(It()).optional(),introspection_endpoint_auth_signing_alg_values_supported:En(It()).optional(),code_challenge_methods_supported:En(It()).optional(),client_id_metadata_document_supported:Ju().optional()}),jDo=R2({issuer:It(),authorization_endpoint:sA,token_endpoint:sA,userinfo_endpoint:sA.optional(),jwks_uri:sA,registration_endpoint:sA.optional(),scopes_supported:En(It()).optional(),response_types_supported:En(It()),response_modes_supported:En(It()).optional(),grant_types_supported:En(It()).optional(),acr_values_supported:En(It()).optional(),subject_types_supported:En(It()),id_token_signing_alg_values_supported:En(It()),id_token_encryption_alg_values_supported:En(It()).optional(),id_token_encryption_enc_values_supported:En(It()).optional(),userinfo_signing_alg_values_supported:En(It()).optional(),userinfo_encryption_alg_values_supported:En(It()).optional(),userinfo_encryption_enc_values_supported:En(It()).optional(),request_object_signing_alg_values_supported:En(It()).optional(),request_object_encryption_alg_values_supported:En(It()).optional(),request_object_encryption_enc_values_supported:En(It()).optional(),token_endpoint_auth_methods_supported:En(It()).optional(),token_endpoint_auth_signing_alg_values_supported:En(It()).optional(),display_values_supported:En(It()).optional(),claim_types_supported:En(It()).optional(),claims_supported:En(It()).optional(),service_documentation:It().optional(),claims_locales_supported:En(It()).optional(),ui_locales_supported:En(It()).optional(),claims_parameter_supported:Ju().optional(),request_parameter_supported:Ju().optional(),request_uri_parameter_supported:Ju().optional(),require_request_uri_registration:Ju().optional(),op_policy_uri:sA.optional(),op_tos_uri:sA.optional(),client_id_metadata_document_supported:Ju().optional()}),rJr=rn({...jDo.shape,...Swt.pick({code_challenge_methods_supported:!0}).shape}),nJr=rn({access_token:It(),id_token:It().optional(),token_type:It(),expires_in:mMe.number().optional(),scope:It().optional(),refresh_token:It().optional()}).strip(),iJr=rn({error:It(),error_description:It().optional(),error_uri:It().optional()}),eJr=sA.optional().or(Di("").transform(()=>{})),$Do=rn({redirect_uris:En(sA),token_endpoint_auth_method:It().optional(),grant_types:En(It()).optional(),response_types:En(It()).optional(),client_name:It().optional(),client_uri:sA.optional(),logo_uri:eJr,scope:It().optional(),contacts:En(It()).optional(),tos_uri:eJr,policy_uri:It().optional(),jwks_uri:sA.optional(),jwks:SWr().optional(),software_id:It().optional(),software_version:It().optional(),software_statement:It().optional()}).strip(),GDo=rn({client_id:It(),client_secret:It().optional(),client_id_issued_at:dl().optional(),client_secret_expires_at:dl().optional()}).strip(),oJr=$Do.merge(GDo),rfc=rn({error:It(),error_description:It().optional()}).strip(),nfc=rn({token:It(),token_type_hint:It().optional()}).strip()});function sJr(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function aJr({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}var cJr=q(()=>{});var Yp,$0e,n$,i$,o$,G0e,q0e,H0e,wI,V0e,W0e,z0e,Y0e,K0e,X0e,s$,J0e,Z0e,lJr,uJr=q(()=>{Yp=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},$0e=class extends Yp{};$0e.errorCode="invalid_request";n$=class extends Yp{};n$.errorCode="invalid_client";i$=class extends Yp{};i$.errorCode="invalid_grant";o$=class extends Yp{};o$.errorCode="unauthorized_client";G0e=class extends Yp{};G0e.errorCode="unsupported_grant_type";q0e=class extends Yp{};q0e.errorCode="invalid_scope";H0e=class extends Yp{};H0e.errorCode="access_denied";wI=class extends Yp{};wI.errorCode="server_error";V0e=class extends Yp{};V0e.errorCode="temporarily_unavailable";W0e=class extends Yp{};W0e.errorCode="unsupported_response_type";z0e=class extends Yp{};z0e.errorCode="unsupported_token_type";Y0e=class extends Yp{};Y0e.errorCode="invalid_token";K0e=class extends Yp{};K0e.errorCode="method_not_allowed";X0e=class extends Yp{};X0e.errorCode="too_many_requests";s$=class extends Yp{};s$.errorCode="invalid_client_metadata";J0e=class extends Yp{};J0e.errorCode="insufficient_scope";Z0e=class extends Yp{};Z0e.errorCode="invalid_target";lJr={[$0e.errorCode]:$0e,[n$.errorCode]:n$,[i$.errorCode]:i$,[o$.errorCode]:o$,[G0e.errorCode]:G0e,[q0e.errorCode]:q0e,[H0e.errorCode]:H0e,[wI.errorCode]:wI,[V0e.errorCode]:V0e,[W0e.errorCode]:W0e,[z0e.errorCode]:z0e,[Y0e.errorCode]:Y0e,[K0e.errorCode]:K0e,[X0e.errorCode]:X0e,[s$.errorCode]:s$,[J0e.errorCode]:J0e,[Z0e.errorCode]:Z0e}});function qDo(t){return["client_secret_basic","client_secret_post","none"].includes(t)}function HDo(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&qDo(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function VDo(t,e,r,n){let{client_id:o,client_secret:s}=e;switch(t){case"client_secret_basic":WDo(o,s,r);return;case"client_secret_post":zDo(o,s,n);return;case"none":YDo(o,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function WDo(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function zDo(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function YDo(t,e){e.set("client_id",t)}async function fJr(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=iJr.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:a}=n,c=lJr[o]||wI;return new c(s||"",a)}catch(n){let o=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new wI(o)}}async function TI(t,e){var r,n;try{return await Iwt(t,e)}catch(o){if(o instanceof n$||o instanceof o$)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await Iwt(t,e);if(o instanceof i$)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await Iwt(t,e);throw o}}async function Iwt(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){var a,c;let u,d;try{u=await JDo(e,{resourceMetadataUrl:o},s),u.authorization_servers&&u.authorization_servers.length>0&&(d=u.authorization_servers[0])}catch{}d||(d=new URL("/",e));let f=await XDo(e,t,u),p=await nRo(d,{fetchFn:s}),h=await Promise.resolve(t.clientInformation());if(!h){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let v=p?.client_id_metadata_document_supported===!0,b=t.clientMetadataUrl;if(b&&!KDo(b))throw new s$(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${b}`);if(v&&b)h={client_id:b},await((a=t.saveClientInformation)===null||a===void 0?void 0:a.call(t,h));else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let w=await sRo(d,{metadata:p,clientMetadata:t.clientMetadata,fetchFn:s});await t.saveClientInformation(w),h=w}}let m=!t.redirectUrl;if(r!==void 0||m){let v=await oRo(t,d,{metadata:p,resource:f,authorizationCode:r,fetchFn:s});return await t.saveTokens(v),"AUTHORIZED"}let g=await t.tokens();if(g?.refresh_token)try{let v=await Nwt(d,{metadata:p,clientInformation:h,refreshToken:g.refresh_token,resource:f,addClientAuthentication:t.addClientAuthentication,fetchFn:s});return await t.saveTokens(v),"AUTHORIZED"}catch(v){if(!(!(v instanceof Yp)||v instanceof wI))throw v}let A=t.state?await t.state():void 0,{authorizationUrl:y,codeVerifier:E}=await iRo(d,{metadata:p,clientInformation:h,state:A,redirectUrl:t.redirectUrl,scope:n||((c=u?.scopes_supported)===null||c===void 0?void 0:c.join(" "))||t.clientMetadata.scope,resource:f});return await t.saveCodeVerifier(E),await t.redirectToAuthorization(y),"REDIRECT"}function KDo(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function XDo(t,e,r){let n=sJr(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!aJr({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function ote(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=Dwt(t,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let a=Dwt(t,"scope")||void 0,c=Dwt(t,"error")||void 0;return{resourceMetadataUrl:s,scope:a,error:c}}function Dwt(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function JDo(t,e,r=fetch){var n,o;let s=await tRo(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!s||s.status===404)throw await((n=s?.body)===null||n===void 0?void 0:n.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw await((o=s.body)===null||o===void 0?void 0:o.cancel()),new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return tJr.parse(await s.json())}async function Rwt(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?Rwt(t,void 0,r):void 0;throw n}}function ZDo(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function dJr(t,e,r=fetch){return await Rwt(t,{"MCP-Protocol-Version":e},r)}function eRo(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function tRo(t,e,r,n){var o,s;let a=new URL(t),c=(o=n?.protocolVersion)!==null&&o!==void 0?o:Ree,u;if(n?.metadataUrl)u=new URL(n.metadataUrl);else{let f=ZDo(e,a.pathname);u=new URL(f,(s=n?.metadataServerUrl)!==null&&s!==void 0?s:a),u.search=a.search}let d=await dJr(u,c,r);if(!n?.metadataUrl&&eRo(d,a.pathname)){let f=new URL(`/.well-known/${e}`,a);d=await dJr(f,c,r)}return d}function rRo(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let o=e.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,e.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function nRo(t,{fetchFn:e=fetch,protocolVersion:r=Ree}={}){var n;let o={"MCP-Protocol-Version":r,Accept:"application/json"},s=rRo(t);for(let{url:a,type:c}of s){let u=await Rwt(a,o,e);if(u){if(!u.ok){if(await((n=u.body)===null||n===void 0?void 0:n.cancel()),u.status>=400&&u.status<500)continue;throw new Error(`HTTP ${u.status} trying to load ${c==="oauth"?"OAuth":"OpenID provider"} metadata from ${a}`)}return c==="oauth"?Swt.parse(await u.json()):rJr.parse(await u.json())}}}async function iRo(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:a}){let c;if(e){if(c=new URL(e.authorization_endpoint),!e.response_types_supported.includes(wwt))throw new Error(`Incompatible auth server: does not support response type ${wwt}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(Twt))throw new Error(`Incompatible auth server: does not support code challenge method ${Twt}`)}else c=new URL("/authorize",t);let u=await Cwt(),d=u.code_verifier,f=u.code_challenge;return c.searchParams.set("response_type",wwt),c.searchParams.set("client_id",r.client_id),c.searchParams.set("code_challenge",f),c.searchParams.set("code_challenge_method",Twt),c.searchParams.set("redirect_uri",String(n)),s&&c.searchParams.set("state",s),o&&c.searchParams.set("scope",o),o?.includes("offline_access")&&c.searchParams.append("prompt","consent"),a&&c.searchParams.set("resource",a.href),{authorizationUrl:c,codeVerifier:d}}function pJr(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function kwt(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:a}){var c;let u=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),d=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&r.set("resource",s.href),o)await o(d,r,u,e);else if(n){let p=(c=e?.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],h=HDo(n,p);VDo(h,n,d,r)}let f=await(a??fetch)(u,{method:"POST",headers:d,body:r});if(!f.ok)throw await fJr(f);return nJr.parse(await f.json())}async function hJr(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:o,redirectUri:s,resource:a,addClientAuthentication:c,fetchFn:u}){let d=pJr(n,o,s);return kwt(t,{metadata:e,tokenRequestParams:d,clientInformation:r,addClientAuthentication:c,resource:a,fetchFn:u})}async function Nwt(t,{metadata:e,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:a}){let c=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),u=await kwt(t,{metadata:e,tokenRequestParams:c,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:a});return{refresh_token:n,...u}}async function oRo(t,e,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let a=t.clientMetadata.scope,c;if(t.prepareTokenRequest&&(c=await t.prepareTokenRequest(a)),!c){if(!o)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let d=await t.codeVerifier();c=pJr(o,d,t.redirectUrl)}let u=await t.clientInformation();return kwt(e,{metadata:r,tokenRequestParams:c,clientInformation:u??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:s})}async function sRo(t,{metadata:e,clientMetadata:r,fetchFn:n}){let o;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");o=new URL(e.registration_endpoint)}else o=new URL("/register",t);let s=await(n??fetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok)throw await fJr(s);return oJr.parse(await s.json())}var f3,wwt,Twt,RFe=q(()=>{ZXr();yI();xwt();xwt();cJr();uJr();f3=class extends Error{constructor(e){super(e??"Unauthorized")}};wwt="code",Twt="S256"});var Owt,ste,mJr=q(()=>{JXr();vwt();yI();RFe();Owt=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},ste=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=DFe(r?.fetch,r?.requestInit)}async _authThenStart(){var e;if(!this._authProvider)throw new f3("No auth provider");let r;try{r=await TI(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new f3;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let o=await this._authProvider.tokens();o&&(r.Authorization=`Bearer ${o.access_token}`)}this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=ite((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}_startOrAuth(){var e,r,n;let o=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((s,a)=>{this._eventSource=new r$(this._url.href,{...this._eventSourceInit,fetch:async(c,u)=>{let d=await this._commonHeaders();d.set("Accept","text/event-stream");let f=await o(c,{...u,headers:d});if(f.status===401&&f.headers.has("www-authenticate")){let{resourceMetadataUrl:p,scope:h}=ote(f);this._resourceMetadataUrl=p,this._scope=h}return f}}),this._abortController=new AbortController,this._eventSource.onerror=c=>{var u;if(c.code===401&&this._authProvider){this._authThenStart().then(s,a);return}let d=new Owt(c.code,c.message,c);a(d),(u=this.onerror)===null||u===void 0||u.call(this,d)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",c=>{var u;let d=c;try{if(this._endpoint=new URL(d.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(f){a(f),(u=this.onerror)===null||u===void 0||u.call(this,f),this.close();return}s()}),this._eventSource.onmessage=c=>{var u,d;let f=c,p;try{p=YO.parse(JSON.parse(f.data))}catch(h){(u=this.onerror)===null||u===void 0||u.call(this,h);return}(d=this.onmessage)===null||d===void 0||d.call(this,p)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new f3("No auth provider");if(await TI(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new f3("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,o,s;if(!this._endpoint)throw new Error("Not connected");try{let a=await this._commonHeaders();a.set("content-type","application/json");let c={...this._requestInit,method:"POST",headers:a,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},u=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,c);if(!u.ok){let d=await u.text().catch(()=>null);if(u.status===401&&this._authProvider){let{resourceMetadataUrl:f,scope:p}=ote(u);if(this._resourceMetadataUrl=f,this._scope=p,await TI(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new f3;return this.send(e)}throw new Error(`Error POSTing to endpoint (HTTP ${u.status}): ${d}`)}await((o=u.body)===null||o===void 0?void 0:o.cancel())}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}setProtocolVersion(e){this._protocolVersion=e}}});var kFe,gJr=q(()=>{dwt();kFe=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let o;super({start(s){o=xFe({onEvent:a=>{s.enqueue(a)},onError(a){e==="terminate"?s.error(a):typeof e=="function"&&e(a)},onRetry:r,onComment:n})},transform(s){o.feed(s)}})}}});var aRo,aB,cB,Bwt=q(()=>{vwt();yI();RFe();gJr();aRo={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},aB=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},cB=class{constructor(e,r){var n;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=DFe(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:aRo}async _authThenStart(){var e;if(!this._authProvider)throw new f3("No auth provider");let r;try{r=await TI(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new f3;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let o=await this._authProvider.tokens();o&&(r.Authorization=`Bearer ${o.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=ite((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,o,s;let{resumptionToken:a}=e;try{let c=await this._commonHeaders();c.set("Accept","text/event-stream"),a&&c.set("last-event-id",a);let u=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:c,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!u.ok){if(await((o=u.body)===null||o===void 0?void 0:o.cancel()),u.status===401&&this._authProvider)return await this._authThenStart();if(u.status===405)return;throw new aB(u.status,`Failed to open SSE stream: ${u.statusText}`)}this._handleSseStream(u.body,e,!0)}catch(c){throw(s=this.onerror)===null||s===void 0||s.call(this,c),c}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),o)}_scheduleReconnection(e,r=0){var n;let o=this._reconnectionOptions.maxRetries;if(r>=o){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${o}) exceeded.`));return}let s=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(a=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,new Error(`Failed to reconnect SSE stream: ${a instanceof Error?a.message:String(a)}`)),this._scheduleReconnection(e,r+1)})},s)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:o,replayMessageId:s}=r,a,c=!1,u=!1;(async()=>{var f,p,h,m;try{let g=e.pipeThrough(new TextDecoderStream).pipeThrough(new kFe({onRetry:E=>{this._serverRetryMs=E}})).getReader();for(;;){let{value:E,done:v}=await g.read();if(v)break;if(E.id&&(a=E.id,c=!0,o?.(E.id)),!!E.data&&(!E.event||E.event==="message"))try{let b=YO.parse(JSON.parse(E.data));$j(b)&&(u=!0,s!==void 0&&(b.id=s)),(f=this.onmessage)===null||f===void 0||f.call(this,b)}catch(b){(p=this.onerror)===null||p===void 0||p.call(this,b)}}(n||c)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:s},0)}catch(g){if((h=this.onerror)===null||h===void 0||h.call(this,new Error(`SSE stream disconnected: ${g}`)),(n||c)&&!u&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:s},0)}catch(E){(m=this.onerror)===null||m===void 0||m.call(this,new Error(`Failed to reconnect: ${E instanceof Error?E.message:String(E)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new f3("No auth provider");if(await TI(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new f3("Failed to authorize")}async close(){var e,r;this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,o,s,a,c,u,d;try{let{resumptionToken:f,onresumptiontoken:p}=r||{};if(f){this._startOrAuthSse({resumptionToken:f,replayMessageId:e0e(e)?e.id:void 0}).catch(b=>{var S;return(S=this.onerror)===null||S===void 0?void 0:S.call(this,b)});return}let h=await this._commonHeaders();h.set("content-type","application/json"),h.set("accept","application/json, text/event-stream");let m={...this._requestInit,method:"POST",headers:h,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},g=await((o=this._fetch)!==null&&o!==void 0?o:fetch)(this._url,m),A=g.headers.get("mcp-session-id");if(A&&(this._sessionId=A),!g.ok){let b=await g.text().catch(()=>null);if(g.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new aB(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:S,scope:w}=ote(g);if(this._resourceMetadataUrl=S,this._scope=w,await TI(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new f3;return this._hasCompletedAuthFlow=!0,this.send(e)}if(g.status===403&&this._authProvider){let{resourceMetadataUrl:S,scope:w,error:k}=ote(g);if(k==="insufficient_scope"){let D=g.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===D)throw new aB(403,"Server returned 403 after trying upscoping");if(w&&(this._scope=w),S&&(this._resourceMetadataUrl=S),this._lastUpscopingHeader=D??void 0,await TI(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new f3;return this.send(e)}}throw new aB(g.status,`Error POSTing to endpoint: ${b}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,g.status===202){await((s=g.body)===null||s===void 0?void 0:s.cancel()),KWr(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(b=>{var S;return(S=this.onerror)===null||S===void 0?void 0:S.call(this,b)});return}let E=(Array.isArray(e)?e:[e]).filter(b=>"method"in b&&"id"in b&&b.id!==void 0).length>0,v=g.headers.get("content-type");if(E)if(v?.includes("text/event-stream"))this._handleSseStream(g.body,{onresumptiontoken:p},!1);else if(v?.includes("application/json")){let b=await g.json(),S=Array.isArray(b)?b.map(w=>YO.parse(w)):[YO.parse(b)];for(let w of S)(a=this.onmessage)===null||a===void 0||a.call(this,w)}else throw await((c=g.body)===null||c===void 0?void 0:c.cancel()),new aB(-1,`Unexpected content type: ${v}`);else await((u=g.body)===null||u===void 0?void 0:u.cancel())}catch(f){throw(d=this.onerror)===null||d===void 0||d.call(this,f),f}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n,o;if(this._sessionId)try{let s=await this._commonHeaders(),a={...this._requestInit,method:"DELETE",headers:s,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},c=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,a);if(await((n=c.body)===null||n===void 0?void 0:n.cancel()),!c.ok&&c.status!==405)throw new aB(c.status,`Failed to terminate session: ${c.statusText}`);this._sessionId=void 0}catch(s){throw(o=this.onerror)===null||o===void 0||o.call(this,s),s}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}}});import{readFile as cRo}from"node:fs/promises";var eAe,tAe,a$,Pwt=q(()=>{"use strict";Cfe();RFe();Xn();(function(t){t.CLI_CONNECT="cli_connect",t.PING="ping",t.GET_ACTIVE_FILE="get_active_file",t.GET_FILE_CONTENT="get_file_content",t.GET_SELECTED_TEXT="get_selected_text",t.SHOW_DIFF="show_diff"})(eAe||(eAe={}));tAe=class extends Error{code;constructor(e,r){super(r),this.code=e}},a$=class{_websocket;_url;_authProvider;_websocketOptions;_WebSocket;_protocolVersion;_isClosed=!1;_specialIds=new Set;onclose;onerror;onmessage;sessionId;constructor(e,r){this._url=e,this._authProvider=r?.authProvider,this._websocketOptions=r?.websocketOptions,this._WebSocket=r?.WebSocket||AU.default}async start(){if(this._isClosed)throw new Error(R.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let o=await this._authProvider.tokens();o?.access_token&&(e=o.access_token)}catch(o){try{let s=await this._authProvider.clientInformation();if(s){let a=await this._authProvider.tokens();if(a?.refresh_token){let c=await Nwt(this._url,{clientInformation:s,refreshToken:a.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(c),c?.access_token&&(e=c.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw s?(await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(R.t("websocketClient.errors.unauthorizedOAuth"))):new Error("Redirect URL is required for authorization")}throw o}}let r={...this._websocketOptions?.headers};e&&(r.Authorization=`Bearer ${e}`),this._protocolVersion&&(r["MCP-Protocol-Version"]=this._protocolVersion);let n=new URL(this._url.toString());return n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),new Promise((o,s)=>{try{let a={headers:r};this._websocket=new this._WebSocket(n.toString(),a),this._websocket.on("open",()=>{o()}),this._websocket.on("error",c=>{let u=c.code!==void 0?c.code:void 0;s(new tAe(u,`WebSocket error: ${c.message}`))}),this._websocket.on("message",async c=>{try{let u=c.toString(),d=JSON.parse(u);if(this._specialIds.has(Number(d.id))||d.type==="welcome")return;this.onmessage?.(await this._transformResponse(d))}catch(u){this.onerror?.(new Error(`Failed to parse WebSocket message: ${u instanceof Error?u.message:String(u)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(a){s(new tAe(void 0,`Failed to create WebSocket: ${a}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(R.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl;if(!n)throw new Error("Redirect URL is required for authorization");let o=typeof n=="string"?n:n.toString(),s=await hJr(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:o,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(s)}else throw new Error(R.t("websocketClient.errors.clientInfoNotAvailable"))}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===AU.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(R.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(R.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==AU.default.OPEN)throw new Error(R.t("websocketClient.errors.websocketNotOpen"));try{if(e.method==="notifications/initialized")return;let r=await this._transformRequest(e),n=JSON.stringify(r);this._websocket.send(n)}catch(r){throw new tAe(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:eAe.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.4.9",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:o}=r||{};return{type:eAe.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{filePath:n,originalText:await cRo(n,"utf8"),modifiedText:o}}}return e}async _transformResponse(e){if(e.type==="connection_ack")return{jsonrpc:"2.0",id:e.id,result:{protocolVersion:"2024-11-05",capabilities:{logging:{},prompts:{},resources:{},tools:{}},serverInfo:{name:"JetBrains Plugin Server",title:"JetBrains Plugin Server",version:"1.0.0"}}};if(e.type==="selection_changed"){let r=await this._getSelectedText();return{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0,selectedText:r}]}}}}return e.type==="active_file_changed"?{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0}]}}}:e}async _getSelectedText(){if(!this._websocket)return"";let e=performance.now();return this._specialIds.add(e),this._websocket.send(JSON.stringify({type:eAe.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",o=>{try{let s=JSON.parse(o.toString());Number(s.id)===e&&(this._specialIds.delete(e),s.payload.success?r(s.payload.data.text):n(s.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var yJr=I((kfc,AJr)=>{"use strict";AJr.exports=function(e){return e.map(function(r){return r===""?"''":r&&typeof r=="object"?r.op.replace(/(.)/g,"\\$1"):/["\s\\]/.test(r)&&!/'/.test(r)?"'"+r.replace(/(['])/g,"\\$1")+"'":/["'\s]/.test(r)?'"'+r.replace(/(["\\$`!])/g,"\\$1")+'"':String(r).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")}});var xJr=I((Nfc,SJr)=>{"use strict";var CJr="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",_Jr=new RegExp("^"+CJr+"$"),EJr="|&;()<> \\t",lRo='"((\\\\"|[^"])*?)"',uRo="'((\\\\'|[^'])*?)'",dRo=/^#$/,vJr="'",bJr='"',Mwt="$",c$="",fRo=4294967296;for(Fwt=0;Fwt<4;Fwt++)c$+=(fRo*Math.random()).toString(16);var Fwt,pRo=new RegExp("^"+c$);function hRo(t,e){for(var r=e.lastIndex,n=[],o;o=e.exec(t);)n.push(o),e.lastIndex===o.index&&(e.lastIndex+=1);return e.lastIndex=r,n}function mRo(t,e,r){var n=typeof t=="function"?t(r):t[r];return typeof n>"u"&&r!=""?n="":typeof n>"u"&&(n="$"),typeof n=="object"?e+c$+JSON.stringify(n)+c$:e+n}function gRo(t,e,r){r||(r={});var n=r.escape||"\\",o="(\\"+n+`['"`+EJr+`]|[^\\s'"`+EJr+"])+",s=new RegExp(["("+CJr+")","("+o+"|"+lRo+"|"+uRo+")+"].join("|"),"g"),a=hRo(t,s);if(a.length===0)return[];e||(e={});var c=!1;return a.map(function(u){var d=u[0];if(!d||c)return;if(_Jr.test(d))return{op:d};var f=!1,p=!1,h="",m=!1,g;function A(){g+=1;var v,b,S=d.charAt(g);if(S==="{"){if(g+=1,d.charAt(g)==="}")throw new Error("Bad substitution: "+d.slice(g-2,g+1));if(v=d.indexOf("}",g),v<0)throw new Error("Bad substitution: "+d.slice(g));b=d.slice(g,v),g=v}else if(/[*@#?$!_-]/.test(S))b=S,g+=1;else{var w=d.slice(g);v=w.match(/[^\w\d_]/),v?(b=w.slice(0,v.index),g+=v.index-1):(b=w,g=d.length)}return mRo(e,"",b)}for(g=0;g<d.length;g++){var y=d.charAt(g);if(m=m||!f&&(y==="*"||y==="?"),p)h+=y,p=!1;else if(f)y===f?f=!1:f==vJr?h+=y:y===n?(g+=1,y=d.charAt(g),y===bJr||y===n||y===Mwt?h+=y:h+=n+y):y===Mwt?h+=A():h+=y;else if(y===bJr||y===vJr)f=y;else{if(_Jr.test(y))return{op:d};if(dRo.test(y)){c=!0;var E={comment:t.slice(u.index+g+1)};return h.length?[h,E]:[E]}else y===n?p=!0:y===Mwt?h+=A():h+=y}}return m?{op:"glob",pattern:h}:h}).reduce(function(u,d){return typeof d>"u"?u:u.concat(d)},[])}SJr.exports=function(e,r,n){var o=gRo(e,r,n);return typeof r!="function"?o:o.reduce(function(s,a){if(typeof a=="object")return s.concat(a);var c=a.split(RegExp("("+c$+".*?"+c$+")","g"));return c.length===1?s.concat(c[0]):s.concat(c.filter(Boolean).map(function(u){return pRo.test(u)?JSON.parse(u.split(c$)[1]):u}))},[])}});var rAe=I(Lwt=>{"use strict";Lwt.quote=yJr();Lwt.parse=xJr()});var wJr,NFe,TJr=q(()=>{"use strict";wJr=we(kwe(),1);Xn();NFe=class{config;auth;redirectUrl="";clientMetadata={client_name:"iFlow CLI (Google ADC)",redirect_uris:[],grant_types:[],response_types:[],token_endpoint_auth_method:"none"};_clientInformation;constructor(e){this.config=e;let r=this.config?.oauth?.scopes;if(!r||r.length===0)throw new Error(R.t("mcp.auth.scopesRequired"));this.auth=new wJr.GoogleAuth({scopes:r})}clientInformation(){return this._clientInformation}saveClientInformation(e){this._clientInformation=e}async tokens(){let r=await(await this.auth.getClient()).getAccessToken();if(!r.token){console.error(R.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as ARo}from"node:child_process";import{promisify as yRo}from"node:util";import{platform as _Ro}from"node:os";import{URL as ERo}from"node:url";function vRo(t){let e;try{e=new ERo(t)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Unsafe protocol: ${e.protocol}. Only HTTP and HTTPS are allowed.`);if(/[\r\n\x00-\x1f]/.test(t))throw new Error("URL contains invalid characters")}async function DJr(t){vRo(t);let e=_Ro(),r,n;switch(e){case"darwin":r="open",n=[t];break;case"win32":r="powershell.exe",n=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${t.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":r="xdg-open",n=[t];break;default:throw new Error(`Unsupported platform: ${e}`)}let o={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await IJr(r,n,o)}catch(s){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let a=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let c of a)try{await IJr(c,[t],o);return}catch{continue}}throw new Error(`Failed to open browser: ${s instanceof Error?s.message:"Unknown error"}`)}}var IJr,RJr=q(()=>{"use strict";IJr=yRo(ARo)});function Ao(t){return t instanceof Error&&"code"in t}function br(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function Uwt(t){if(t&&typeof t=="object"&&"response"in t){let r=bRo(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new BFe(r.error.message);case 401:return new lB(r.error.message);case 403:return new OFe(r.error.message);default:}}return t}function bRo(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var OFe,lB,BFe,Zu=q(()=>{"use strict";OFe=class extends Error{},lB=class extends Error{},BFe=class extends Error{}});import{promises as ate}from"node:fs";import*as PFe from"node:path";import*as kJr from"node:os";var Pg,MFe=q(()=>{"use strict";Zu();Xn();Pg=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=kJr.homedir();return PFe.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=PFe.dirname(this.getTokenFilePath());await ate.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await ate.readFile(r,"utf-8"),o=JSON.parse(n);for(let s of o)e.set(s.serverName,s)}catch(r){r.code!=="ENOENT"&&console.error(R.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:br(r)}))}return e}static async saveToken(e,r,n,o,s){await this.ensureConfigDir();let a=await this.loadTokens(),c={serverName:e,token:r,clientId:n,tokenUrl:o,mcpServerUrl:s,updatedAt:Date.now()};a.set(e,c);let u=Array.from(a.values()),d=this.getTokenFilePath();try{await ate.writeFile(d,JSON.stringify(u,null,2),{mode:384})}catch(f){throw console.error(R.t("mcp.tokenStorage.errors.failedToSaveToken",{error:br(f)})),f}}static async getToken(e){return(await this.loadTokens()).get(e)||null}static async removeToken(e){let r=await this.loadTokens();if(r.delete(e)){let n=Array.from(r.values()),o=this.getTokenFilePath();try{n.length===0?await ate.unlink(o):await ate.writeFile(o,JSON.stringify(n,null,2),{mode:384})}catch(s){console.error(R.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:br(s)}))}}}static isTokenExpired(e){if(!e.expiresAt)return!1;let r=300*1e3;return Date.now()+r>=e.expiresAt}static async clearAllTokens(){try{let e=this.getTokenFilePath();await ate.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(R.t("mcp.tokenStorage.errors.failedToClearTokens",{error:br(e)}))}}}});var Mg,FFe=q(()=>{"use strict";Zu();Xn();Mg=class{static buildWellKnownUrls(e){let r=new URL(e),n=`${r.protocol}//${r.host}`;return{protectedResource:new URL("/.well-known/oauth-protected-resource",n).toString(),authorizationServer:new URL("/.well-known/oauth-authorization-server",n).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch protected resource metadata from ${e}: ${br(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch authorization server metadata from ${e}: ${br(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[]}}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(n?.authorization_servers?.length){let s=n.authorization_servers[0],a=new URL("/.well-known/oauth-authorization-server",s).toString(),c=await this.fetchAuthorizationServerMetadata(a);if(c){let u=this.metadataToOAuthConfig(c);return c.registration_endpoint&&console.log(R.t("mcp.oauth.discovery.dynamicRegistrationSupported"),c.registration_endpoint),u}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let o=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(o){let s=this.metadataToOAuthConfig(o);return o.registration_endpoint&&console.log(R.t("mcp.oauth.discovery.dynamicRegistrationSupported"),o.registration_endpoint),s}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${br(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e){let r=this.parseWWWAuthenticateHeader(e);if(!r)return null;console.log(R.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);return a?(console.log(R.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(a)):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}`}}});import*as NJr from"node:http";import*as nAe from"node:crypto";import{URL as Qwt}from"node:url";var kE,jwt=q(()=>{"use strict";RJr();MFe();Zu();FFe();Xn();kE=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let o={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${this.REDIRECT_PORT}${this.REDIRECT_PATH}`],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none",code_challenge_method:["S256"],scope:r.scopes?.join(" ")||""},s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!s.ok){let a=await s.text();throw new Error(R.t("mcp.auth.clientRegistrationFailed",{status:s.status,statusText:s.statusText,error:a}))}return await s.json()}static async discoverOAuthFromMCPServer(e){let r=Mg.extractBaseUrl(e);return Mg.discoverOAuthConfig(r)}static generatePKCEParams(){let e=nAe.randomBytes(32).toString("base64url"),r=nAe.createHash("sha256").update(e).digest("base64url"),n=nAe.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let o=NJr.createServer(async(s,a)=>{try{let c=new Qwt(s.url,`http://localhost:${this.REDIRECT_PORT}`);if(c.pathname!==this.REDIRECT_PATH){a.writeHead(404),a.end(R.t("mcp.ui.notFound"));return}let u=c.searchParams.get("code"),d=c.searchParams.get("state"),f=c.searchParams.get("error");if(f){a.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),a.end(`
999
+ `&&n++}}return[e,r]}var SFe,dwt=q(()=>{SFe=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}});function PDo(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function fwt(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(fwt).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${fwt(t.cause)}`:t.message:`${t}`}function YXr(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function MDo(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var TFe,XXr,Ewt,Ca,km,gf,xI,zy,t$,Zee,wFe,IFe,Q0e,rte,j0e,sB,ete,nte,tte,L0e,kS,pwt,hwt,mwt,KXr,gwt,Awt,U0e,ywt,_wt,r$,JXr=q(()=>{dwt();TFe=class extends Event{constructor(e,r){var n,o;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(o=r?.message)!=null?o:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(YXr(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(YXr(this),r)}};XXr=t=>{throw TypeError(t)},Ewt=(t,e,r)=>e.has(t)||XXr("Cannot "+r),Ca=(t,e,r)=>(Ewt(t,e,"read from private field"),r?r.call(t):e.get(t)),km=(t,e,r)=>e.has(t)?XXr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),gf=(t,e,r,n)=>(Ewt(t,e,"write to private field"),e.set(t,r),r),xI=(t,e,r)=>(Ewt(t,e,"access private method"),r),r$=class extends EventTarget{constructor(e,r){var n,o;super(),km(this,kS),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,km(this,zy),km(this,t$),km(this,Zee),km(this,wFe),km(this,IFe),km(this,Q0e),km(this,rte),km(this,j0e,null),km(this,sB),km(this,ete),km(this,nte,null),km(this,tte,null),km(this,L0e,null),km(this,hwt,async s=>{var a;Ca(this,ete).reset();let{body:c,redirected:u,status:d,headers:f}=s;if(d===204){xI(this,kS,U0e).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?gf(this,Zee,new URL(s.url)):gf(this,Zee,void 0),d!==200){xI(this,kS,U0e).call(this,`Non-200 status code (${d})`,d);return}if(!(f.get("content-type")||"").startsWith("text/event-stream")){xI(this,kS,U0e).call(this,'Invalid content type, expected "text/event-stream"',d);return}if(Ca(this,zy)===this.CLOSED)return;gf(this,zy,this.OPEN);let p=new Event("open");if((a=Ca(this,L0e))==null||a.call(this,p),this.dispatchEvent(p),typeof c!="object"||!c||!("getReader"in c)){xI(this,kS,U0e).call(this,"Invalid response body, expected a web ReadableStream",d),this.close();return}let h=new TextDecoder,m=c.getReader(),g=!0;do{let{done:A,value:y}=await m.read();y&&Ca(this,ete).feed(h.decode(y,{stream:!A})),A&&(g=!1,Ca(this,ete).reset(),xI(this,kS,ywt).call(this))}while(g)}),km(this,mwt,s=>{gf(this,sB,void 0),!(s.name==="AbortError"||s.type==="aborted")&&xI(this,kS,ywt).call(this,fwt(s))}),km(this,gwt,s=>{typeof s.id=="string"&&gf(this,j0e,s.id);let a=new MessageEvent(s.event||"message",{data:s.data,origin:Ca(this,Zee)?Ca(this,Zee).origin:Ca(this,t$).origin,lastEventId:s.id||""});Ca(this,tte)&&(!s.event||s.event==="message")&&Ca(this,tte).call(this,a),this.dispatchEvent(a)}),km(this,Awt,s=>{gf(this,Q0e,s)}),km(this,_wt,()=>{gf(this,rte,void 0),Ca(this,zy)===this.CONNECTING&&xI(this,kS,pwt).call(this)});try{if(e instanceof URL)gf(this,t$,e);else if(typeof e=="string")gf(this,t$,new URL(e,MDo()));else throw new Error("Invalid URL")}catch{throw PDo("An invalid or illegal string was specified")}gf(this,ete,xFe({onEvent:Ca(this,gwt),onRetry:Ca(this,Awt)})),gf(this,zy,this.CONNECTING),gf(this,Q0e,3e3),gf(this,IFe,(n=r?.fetch)!=null?n:globalThis.fetch),gf(this,wFe,(o=r?.withCredentials)!=null?o:!1),xI(this,kS,pwt).call(this)}get readyState(){return Ca(this,zy)}get url(){return Ca(this,t$).href}get withCredentials(){return Ca(this,wFe)}get onerror(){return Ca(this,nte)}set onerror(e){gf(this,nte,e)}get onmessage(){return Ca(this,tte)}set onmessage(e){gf(this,tte,e)}get onopen(){return Ca(this,L0e)}set onopen(e){gf(this,L0e,e)}addEventListener(e,r,n){let o=r;super.addEventListener(e,o,n)}removeEventListener(e,r,n){let o=r;super.removeEventListener(e,o,n)}close(){Ca(this,rte)&&clearTimeout(Ca(this,rte)),Ca(this,zy)!==this.CLOSED&&(Ca(this,sB)&&Ca(this,sB).abort(),gf(this,zy,this.CLOSED),gf(this,sB,void 0))}};zy=new WeakMap,t$=new WeakMap,Zee=new WeakMap,wFe=new WeakMap,IFe=new WeakMap,Q0e=new WeakMap,rte=new WeakMap,j0e=new WeakMap,sB=new WeakMap,ete=new WeakMap,nte=new WeakMap,tte=new WeakMap,L0e=new WeakMap,kS=new WeakSet,pwt=function(){gf(this,zy,this.CONNECTING),gf(this,sB,new AbortController),Ca(this,IFe)(Ca(this,t$),xI(this,kS,KXr).call(this)).then(Ca(this,hwt)).catch(Ca(this,mwt))},hwt=new WeakMap,mwt=new WeakMap,KXr=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ca(this,j0e)?{"Last-Event-ID":Ca(this,j0e)}:void 0},cache:"no-store",signal:(t=Ca(this,sB))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},gwt=new WeakMap,Awt=new WeakMap,U0e=function(t,e){var r;Ca(this,zy)!==this.CLOSED&&gf(this,zy,this.CLOSED);let n=new TFe("error",{code:e,message:t});(r=Ca(this,nte))==null||r.call(this,n),this.dispatchEvent(n)},ywt=function(t,e){var r;if(Ca(this,zy)===this.CLOSED)return;gf(this,zy,this.CONNECTING);let n=new TFe("error",{code:e,message:t});(r=Ca(this,nte))==null||r.call(this,n),this.dispatchEvent(n),gf(this,rte,setTimeout(Ca(this,_wt),Ca(this,Q0e)))},_wt=new WeakMap,r$.CONNECTING=0,r$.OPEN=1,r$.CLOSED=2});function ite(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function DFe(t=fetch,e){return e?async(r,n)=>{let o={...e,...n,headers:n?.headers?{...ite(e.headers),...ite(n.headers)}:e.headers};return t(r,o)}:t}var vwt=q(()=>{});async function FDo(t){return(await bwt).getRandomValues(new Uint8Array(t))}async function LDo(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await FDo(t);for(let o=0;o<t;o++){let s=n[o]%e.length;r+=e[s]}return r}async function UDo(t){return await LDo(t)}async function QDo(t){let e=await(await bwt).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Cwt(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await UDo(t),r=await QDo(e);return{code_verifier:e,code_challenge:r}}var bwt,ZXr=q(()=>{bwt=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var sA,tJr,Swt,jDo,rJr,nJr,iJr,eJr,$Do,GDo,oJr,rfc,nfc,xwt=q(()=>{hSt();sA=bWr().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:OWr.custom,message:"URL must be parseable",fatal:!0}),dCt}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),tJr=R2({resource:It().url(),authorization_servers:En(sA).optional(),jwks_uri:It().url().optional(),scopes_supported:En(It()).optional(),bearer_methods_supported:En(It()).optional(),resource_signing_alg_values_supported:En(It()).optional(),resource_name:It().optional(),resource_documentation:It().optional(),resource_policy_uri:It().url().optional(),resource_tos_uri:It().url().optional(),tls_client_certificate_bound_access_tokens:Ju().optional(),authorization_details_types_supported:En(It()).optional(),dpop_signing_alg_values_supported:En(It()).optional(),dpop_bound_access_tokens_required:Ju().optional()}),Swt=R2({issuer:It(),authorization_endpoint:sA,token_endpoint:sA,registration_endpoint:sA.optional(),scopes_supported:En(It()).optional(),response_types_supported:En(It()),response_modes_supported:En(It()).optional(),grant_types_supported:En(It()).optional(),token_endpoint_auth_methods_supported:En(It()).optional(),token_endpoint_auth_signing_alg_values_supported:En(It()).optional(),service_documentation:sA.optional(),revocation_endpoint:sA.optional(),revocation_endpoint_auth_methods_supported:En(It()).optional(),revocation_endpoint_auth_signing_alg_values_supported:En(It()).optional(),introspection_endpoint:It().optional(),introspection_endpoint_auth_methods_supported:En(It()).optional(),introspection_endpoint_auth_signing_alg_values_supported:En(It()).optional(),code_challenge_methods_supported:En(It()).optional(),client_id_metadata_document_supported:Ju().optional()}),jDo=R2({issuer:It(),authorization_endpoint:sA,token_endpoint:sA,userinfo_endpoint:sA.optional(),jwks_uri:sA,registration_endpoint:sA.optional(),scopes_supported:En(It()).optional(),response_types_supported:En(It()),response_modes_supported:En(It()).optional(),grant_types_supported:En(It()).optional(),acr_values_supported:En(It()).optional(),subject_types_supported:En(It()),id_token_signing_alg_values_supported:En(It()),id_token_encryption_alg_values_supported:En(It()).optional(),id_token_encryption_enc_values_supported:En(It()).optional(),userinfo_signing_alg_values_supported:En(It()).optional(),userinfo_encryption_alg_values_supported:En(It()).optional(),userinfo_encryption_enc_values_supported:En(It()).optional(),request_object_signing_alg_values_supported:En(It()).optional(),request_object_encryption_alg_values_supported:En(It()).optional(),request_object_encryption_enc_values_supported:En(It()).optional(),token_endpoint_auth_methods_supported:En(It()).optional(),token_endpoint_auth_signing_alg_values_supported:En(It()).optional(),display_values_supported:En(It()).optional(),claim_types_supported:En(It()).optional(),claims_supported:En(It()).optional(),service_documentation:It().optional(),claims_locales_supported:En(It()).optional(),ui_locales_supported:En(It()).optional(),claims_parameter_supported:Ju().optional(),request_parameter_supported:Ju().optional(),request_uri_parameter_supported:Ju().optional(),require_request_uri_registration:Ju().optional(),op_policy_uri:sA.optional(),op_tos_uri:sA.optional(),client_id_metadata_document_supported:Ju().optional()}),rJr=rn({...jDo.shape,...Swt.pick({code_challenge_methods_supported:!0}).shape}),nJr=rn({access_token:It(),id_token:It().optional(),token_type:It(),expires_in:mMe.number().optional(),scope:It().optional(),refresh_token:It().optional()}).strip(),iJr=rn({error:It(),error_description:It().optional(),error_uri:It().optional()}),eJr=sA.optional().or(Di("").transform(()=>{})),$Do=rn({redirect_uris:En(sA),token_endpoint_auth_method:It().optional(),grant_types:En(It()).optional(),response_types:En(It()).optional(),client_name:It().optional(),client_uri:sA.optional(),logo_uri:eJr,scope:It().optional(),contacts:En(It()).optional(),tos_uri:eJr,policy_uri:It().optional(),jwks_uri:sA.optional(),jwks:SWr().optional(),software_id:It().optional(),software_version:It().optional(),software_statement:It().optional()}).strip(),GDo=rn({client_id:It(),client_secret:It().optional(),client_id_issued_at:dl().optional(),client_secret_expires_at:dl().optional()}).strip(),oJr=$Do.merge(GDo),rfc=rn({error:It(),error_description:It().optional()}).strip(),nfc=rn({token:It(),token_type_hint:It().optional()}).strip()});function sJr(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function aJr({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}var cJr=q(()=>{});var Yp,$0e,n$,i$,o$,G0e,q0e,H0e,wI,V0e,W0e,z0e,Y0e,K0e,X0e,s$,J0e,Z0e,lJr,uJr=q(()=>{Yp=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},$0e=class extends Yp{};$0e.errorCode="invalid_request";n$=class extends Yp{};n$.errorCode="invalid_client";i$=class extends Yp{};i$.errorCode="invalid_grant";o$=class extends Yp{};o$.errorCode="unauthorized_client";G0e=class extends Yp{};G0e.errorCode="unsupported_grant_type";q0e=class extends Yp{};q0e.errorCode="invalid_scope";H0e=class extends Yp{};H0e.errorCode="access_denied";wI=class extends Yp{};wI.errorCode="server_error";V0e=class extends Yp{};V0e.errorCode="temporarily_unavailable";W0e=class extends Yp{};W0e.errorCode="unsupported_response_type";z0e=class extends Yp{};z0e.errorCode="unsupported_token_type";Y0e=class extends Yp{};Y0e.errorCode="invalid_token";K0e=class extends Yp{};K0e.errorCode="method_not_allowed";X0e=class extends Yp{};X0e.errorCode="too_many_requests";s$=class extends Yp{};s$.errorCode="invalid_client_metadata";J0e=class extends Yp{};J0e.errorCode="insufficient_scope";Z0e=class extends Yp{};Z0e.errorCode="invalid_target";lJr={[$0e.errorCode]:$0e,[n$.errorCode]:n$,[i$.errorCode]:i$,[o$.errorCode]:o$,[G0e.errorCode]:G0e,[q0e.errorCode]:q0e,[H0e.errorCode]:H0e,[wI.errorCode]:wI,[V0e.errorCode]:V0e,[W0e.errorCode]:W0e,[z0e.errorCode]:z0e,[Y0e.errorCode]:Y0e,[K0e.errorCode]:K0e,[X0e.errorCode]:X0e,[s$.errorCode]:s$,[J0e.errorCode]:J0e,[Z0e.errorCode]:Z0e}});function qDo(t){return["client_secret_basic","client_secret_post","none"].includes(t)}function HDo(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&qDo(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function VDo(t,e,r,n){let{client_id:o,client_secret:s}=e;switch(t){case"client_secret_basic":WDo(o,s,r);return;case"client_secret_post":zDo(o,s,n);return;case"none":YDo(o,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function WDo(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function zDo(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function YDo(t,e){e.set("client_id",t)}async function fJr(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=iJr.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:a}=n,c=lJr[o]||wI;return new c(s||"",a)}catch(n){let o=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new wI(o)}}async function TI(t,e){var r,n;try{return await Iwt(t,e)}catch(o){if(o instanceof n$||o instanceof o$)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await Iwt(t,e);if(o instanceof i$)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await Iwt(t,e);throw o}}async function Iwt(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){var a,c;let u,d;try{u=await JDo(e,{resourceMetadataUrl:o},s),u.authorization_servers&&u.authorization_servers.length>0&&(d=u.authorization_servers[0])}catch{}d||(d=new URL("/",e));let f=await XDo(e,t,u),p=await nRo(d,{fetchFn:s}),h=await Promise.resolve(t.clientInformation());if(!h){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let v=p?.client_id_metadata_document_supported===!0,b=t.clientMetadataUrl;if(b&&!KDo(b))throw new s$(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${b}`);if(v&&b)h={client_id:b},await((a=t.saveClientInformation)===null||a===void 0?void 0:a.call(t,h));else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let w=await sRo(d,{metadata:p,clientMetadata:t.clientMetadata,fetchFn:s});await t.saveClientInformation(w),h=w}}let m=!t.redirectUrl;if(r!==void 0||m){let v=await oRo(t,d,{metadata:p,resource:f,authorizationCode:r,fetchFn:s});return await t.saveTokens(v),"AUTHORIZED"}let g=await t.tokens();if(g?.refresh_token)try{let v=await Nwt(d,{metadata:p,clientInformation:h,refreshToken:g.refresh_token,resource:f,addClientAuthentication:t.addClientAuthentication,fetchFn:s});return await t.saveTokens(v),"AUTHORIZED"}catch(v){if(!(!(v instanceof Yp)||v instanceof wI))throw v}let A=t.state?await t.state():void 0,{authorizationUrl:y,codeVerifier:E}=await iRo(d,{metadata:p,clientInformation:h,state:A,redirectUrl:t.redirectUrl,scope:n||((c=u?.scopes_supported)===null||c===void 0?void 0:c.join(" "))||t.clientMetadata.scope,resource:f});return await t.saveCodeVerifier(E),await t.redirectToAuthorization(y),"REDIRECT"}function KDo(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function XDo(t,e,r){let n=sJr(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!aJr({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function ote(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=Dwt(t,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let a=Dwt(t,"scope")||void 0,c=Dwt(t,"error")||void 0;return{resourceMetadataUrl:s,scope:a,error:c}}function Dwt(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function JDo(t,e,r=fetch){var n,o;let s=await tRo(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!s||s.status===404)throw await((n=s?.body)===null||n===void 0?void 0:n.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw await((o=s.body)===null||o===void 0?void 0:o.cancel()),new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return tJr.parse(await s.json())}async function Rwt(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?Rwt(t,void 0,r):void 0;throw n}}function ZDo(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function dJr(t,e,r=fetch){return await Rwt(t,{"MCP-Protocol-Version":e},r)}function eRo(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function tRo(t,e,r,n){var o,s;let a=new URL(t),c=(o=n?.protocolVersion)!==null&&o!==void 0?o:Ree,u;if(n?.metadataUrl)u=new URL(n.metadataUrl);else{let f=ZDo(e,a.pathname);u=new URL(f,(s=n?.metadataServerUrl)!==null&&s!==void 0?s:a),u.search=a.search}let d=await dJr(u,c,r);if(!n?.metadataUrl&&eRo(d,a.pathname)){let f=new URL(`/.well-known/${e}`,a);d=await dJr(f,c,r)}return d}function rRo(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let o=e.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,e.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function nRo(t,{fetchFn:e=fetch,protocolVersion:r=Ree}={}){var n;let o={"MCP-Protocol-Version":r,Accept:"application/json"},s=rRo(t);for(let{url:a,type:c}of s){let u=await Rwt(a,o,e);if(u){if(!u.ok){if(await((n=u.body)===null||n===void 0?void 0:n.cancel()),u.status>=400&&u.status<500)continue;throw new Error(`HTTP ${u.status} trying to load ${c==="oauth"?"OAuth":"OpenID provider"} metadata from ${a}`)}return c==="oauth"?Swt.parse(await u.json()):rJr.parse(await u.json())}}}async function iRo(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:a}){let c;if(e){if(c=new URL(e.authorization_endpoint),!e.response_types_supported.includes(wwt))throw new Error(`Incompatible auth server: does not support response type ${wwt}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(Twt))throw new Error(`Incompatible auth server: does not support code challenge method ${Twt}`)}else c=new URL("/authorize",t);let u=await Cwt(),d=u.code_verifier,f=u.code_challenge;return c.searchParams.set("response_type",wwt),c.searchParams.set("client_id",r.client_id),c.searchParams.set("code_challenge",f),c.searchParams.set("code_challenge_method",Twt),c.searchParams.set("redirect_uri",String(n)),s&&c.searchParams.set("state",s),o&&c.searchParams.set("scope",o),o?.includes("offline_access")&&c.searchParams.append("prompt","consent"),a&&c.searchParams.set("resource",a.href),{authorizationUrl:c,codeVerifier:d}}function pJr(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function kwt(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:a}){var c;let u=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),d=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&r.set("resource",s.href),o)await o(d,r,u,e);else if(n){let p=(c=e?.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],h=HDo(n,p);VDo(h,n,d,r)}let f=await(a??fetch)(u,{method:"POST",headers:d,body:r});if(!f.ok)throw await fJr(f);return nJr.parse(await f.json())}async function hJr(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:o,redirectUri:s,resource:a,addClientAuthentication:c,fetchFn:u}){let d=pJr(n,o,s);return kwt(t,{metadata:e,tokenRequestParams:d,clientInformation:r,addClientAuthentication:c,resource:a,fetchFn:u})}async function Nwt(t,{metadata:e,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:a}){let c=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),u=await kwt(t,{metadata:e,tokenRequestParams:c,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:a});return{refresh_token:n,...u}}async function oRo(t,e,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let a=t.clientMetadata.scope,c;if(t.prepareTokenRequest&&(c=await t.prepareTokenRequest(a)),!c){if(!o)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let d=await t.codeVerifier();c=pJr(o,d,t.redirectUrl)}let u=await t.clientInformation();return kwt(e,{metadata:r,tokenRequestParams:c,clientInformation:u??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:s})}async function sRo(t,{metadata:e,clientMetadata:r,fetchFn:n}){let o;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");o=new URL(e.registration_endpoint)}else o=new URL("/register",t);let s=await(n??fetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok)throw await fJr(s);return oJr.parse(await s.json())}var f3,wwt,Twt,RFe=q(()=>{ZXr();yI();xwt();xwt();cJr();uJr();f3=class extends Error{constructor(e){super(e??"Unauthorized")}};wwt="code",Twt="S256"});var Owt,ste,mJr=q(()=>{JXr();vwt();yI();RFe();Owt=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},ste=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=DFe(r?.fetch,r?.requestInit)}async _authThenStart(){var e;if(!this._authProvider)throw new f3("No auth provider");let r;try{r=await TI(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new f3;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let o=await this._authProvider.tokens();o&&(r.Authorization=`Bearer ${o.access_token}`)}this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=ite((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}_startOrAuth(){var e,r,n;let o=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((s,a)=>{this._eventSource=new r$(this._url.href,{...this._eventSourceInit,fetch:async(c,u)=>{let d=await this._commonHeaders();d.set("Accept","text/event-stream");let f=await o(c,{...u,headers:d});if(f.status===401&&f.headers.has("www-authenticate")){let{resourceMetadataUrl:p,scope:h}=ote(f);this._resourceMetadataUrl=p,this._scope=h}return f}}),this._abortController=new AbortController,this._eventSource.onerror=c=>{var u;if(c.code===401&&this._authProvider){this._authThenStart().then(s,a);return}let d=new Owt(c.code,c.message,c);a(d),(u=this.onerror)===null||u===void 0||u.call(this,d)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",c=>{var u;let d=c;try{if(this._endpoint=new URL(d.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(f){a(f),(u=this.onerror)===null||u===void 0||u.call(this,f),this.close();return}s()}),this._eventSource.onmessage=c=>{var u,d;let f=c,p;try{p=YO.parse(JSON.parse(f.data))}catch(h){(u=this.onerror)===null||u===void 0||u.call(this,h);return}(d=this.onmessage)===null||d===void 0||d.call(this,p)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new f3("No auth provider");if(await TI(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new f3("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,o,s;if(!this._endpoint)throw new Error("Not connected");try{let a=await this._commonHeaders();a.set("content-type","application/json");let c={...this._requestInit,method:"POST",headers:a,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},u=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,c);if(!u.ok){let d=await u.text().catch(()=>null);if(u.status===401&&this._authProvider){let{resourceMetadataUrl:f,scope:p}=ote(u);if(this._resourceMetadataUrl=f,this._scope=p,await TI(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new f3;return this.send(e)}throw new Error(`Error POSTing to endpoint (HTTP ${u.status}): ${d}`)}await((o=u.body)===null||o===void 0?void 0:o.cancel())}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}setProtocolVersion(e){this._protocolVersion=e}}});var kFe,gJr=q(()=>{dwt();kFe=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let o;super({start(s){o=xFe({onEvent:a=>{s.enqueue(a)},onError(a){e==="terminate"?s.error(a):typeof e=="function"&&e(a)},onRetry:r,onComment:n})},transform(s){o.feed(s)}})}}});var aRo,aB,cB,Bwt=q(()=>{vwt();yI();RFe();gJr();aRo={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},aB=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},cB=class{constructor(e,r){var n;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=DFe(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:aRo}async _authThenStart(){var e;if(!this._authProvider)throw new f3("No auth provider");let r;try{r=await TI(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new f3;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let o=await this._authProvider.tokens();o&&(r.Authorization=`Bearer ${o.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=ite((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,o,s;let{resumptionToken:a}=e;try{let c=await this._commonHeaders();c.set("Accept","text/event-stream"),a&&c.set("last-event-id",a);let u=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:c,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!u.ok){if(await((o=u.body)===null||o===void 0?void 0:o.cancel()),u.status===401&&this._authProvider)return await this._authThenStart();if(u.status===405)return;throw new aB(u.status,`Failed to open SSE stream: ${u.statusText}`)}this._handleSseStream(u.body,e,!0)}catch(c){throw(s=this.onerror)===null||s===void 0||s.call(this,c),c}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),o)}_scheduleReconnection(e,r=0){var n;let o=this._reconnectionOptions.maxRetries;if(r>=o){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${o}) exceeded.`));return}let s=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(a=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,new Error(`Failed to reconnect SSE stream: ${a instanceof Error?a.message:String(a)}`)),this._scheduleReconnection(e,r+1)})},s)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:o,replayMessageId:s}=r,a,c=!1,u=!1;(async()=>{var f,p,h,m;try{let g=e.pipeThrough(new TextDecoderStream).pipeThrough(new kFe({onRetry:E=>{this._serverRetryMs=E}})).getReader();for(;;){let{value:E,done:v}=await g.read();if(v)break;if(E.id&&(a=E.id,c=!0,o?.(E.id)),!!E.data&&(!E.event||E.event==="message"))try{let b=YO.parse(JSON.parse(E.data));$j(b)&&(u=!0,s!==void 0&&(b.id=s)),(f=this.onmessage)===null||f===void 0||f.call(this,b)}catch(b){(p=this.onerror)===null||p===void 0||p.call(this,b)}}(n||c)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:s},0)}catch(g){if((h=this.onerror)===null||h===void 0||h.call(this,new Error(`SSE stream disconnected: ${g}`)),(n||c)&&!u&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:s},0)}catch(E){(m=this.onerror)===null||m===void 0||m.call(this,new Error(`Failed to reconnect: ${E instanceof Error?E.message:String(E)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new f3("No auth provider");if(await TI(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new f3("Failed to authorize")}async close(){var e,r;this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,o,s,a,c,u,d;try{let{resumptionToken:f,onresumptiontoken:p}=r||{};if(f){this._startOrAuthSse({resumptionToken:f,replayMessageId:e0e(e)?e.id:void 0}).catch(b=>{var S;return(S=this.onerror)===null||S===void 0?void 0:S.call(this,b)});return}let h=await this._commonHeaders();h.set("content-type","application/json"),h.set("accept","application/json, text/event-stream");let m={...this._requestInit,method:"POST",headers:h,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},g=await((o=this._fetch)!==null&&o!==void 0?o:fetch)(this._url,m),A=g.headers.get("mcp-session-id");if(A&&(this._sessionId=A),!g.ok){let b=await g.text().catch(()=>null);if(g.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new aB(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:S,scope:w}=ote(g);if(this._resourceMetadataUrl=S,this._scope=w,await TI(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new f3;return this._hasCompletedAuthFlow=!0,this.send(e)}if(g.status===403&&this._authProvider){let{resourceMetadataUrl:S,scope:w,error:k}=ote(g);if(k==="insufficient_scope"){let D=g.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===D)throw new aB(403,"Server returned 403 after trying upscoping");if(w&&(this._scope=w),S&&(this._resourceMetadataUrl=S),this._lastUpscopingHeader=D??void 0,await TI(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new f3;return this.send(e)}}throw new aB(g.status,`Error POSTing to endpoint: ${b}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,g.status===202){await((s=g.body)===null||s===void 0?void 0:s.cancel()),KWr(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(b=>{var S;return(S=this.onerror)===null||S===void 0?void 0:S.call(this,b)});return}let E=(Array.isArray(e)?e:[e]).filter(b=>"method"in b&&"id"in b&&b.id!==void 0).length>0,v=g.headers.get("content-type");if(E)if(v?.includes("text/event-stream"))this._handleSseStream(g.body,{onresumptiontoken:p},!1);else if(v?.includes("application/json")){let b=await g.json(),S=Array.isArray(b)?b.map(w=>YO.parse(w)):[YO.parse(b)];for(let w of S)(a=this.onmessage)===null||a===void 0||a.call(this,w)}else throw await((c=g.body)===null||c===void 0?void 0:c.cancel()),new aB(-1,`Unexpected content type: ${v}`);else await((u=g.body)===null||u===void 0?void 0:u.cancel())}catch(f){throw(d=this.onerror)===null||d===void 0||d.call(this,f),f}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n,o;if(this._sessionId)try{let s=await this._commonHeaders(),a={...this._requestInit,method:"DELETE",headers:s,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},c=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,a);if(await((n=c.body)===null||n===void 0?void 0:n.cancel()),!c.ok&&c.status!==405)throw new aB(c.status,`Failed to terminate session: ${c.statusText}`);this._sessionId=void 0}catch(s){throw(o=this.onerror)===null||o===void 0||o.call(this,s),s}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}}});import{readFile as cRo}from"node:fs/promises";var eAe,tAe,a$,Pwt=q(()=>{"use strict";Cfe();RFe();Xn();(function(t){t.CLI_CONNECT="cli_connect",t.PING="ping",t.GET_ACTIVE_FILE="get_active_file",t.GET_FILE_CONTENT="get_file_content",t.GET_SELECTED_TEXT="get_selected_text",t.SHOW_DIFF="show_diff"})(eAe||(eAe={}));tAe=class extends Error{code;constructor(e,r){super(r),this.code=e}},a$=class{_websocket;_url;_authProvider;_websocketOptions;_WebSocket;_protocolVersion;_isClosed=!1;_specialIds=new Set;onclose;onerror;onmessage;sessionId;constructor(e,r){this._url=e,this._authProvider=r?.authProvider,this._websocketOptions=r?.websocketOptions,this._WebSocket=r?.WebSocket||AU.default}async start(){if(this._isClosed)throw new Error(R.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let o=await this._authProvider.tokens();o?.access_token&&(e=o.access_token)}catch(o){try{let s=await this._authProvider.clientInformation();if(s){let a=await this._authProvider.tokens();if(a?.refresh_token){let c=await Nwt(this._url,{clientInformation:s,refreshToken:a.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(c),c?.access_token&&(e=c.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw s?(await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(R.t("websocketClient.errors.unauthorizedOAuth"))):new Error("Redirect URL is required for authorization")}throw o}}let r={...this._websocketOptions?.headers};e&&(r.Authorization=`Bearer ${e}`),this._protocolVersion&&(r["MCP-Protocol-Version"]=this._protocolVersion);let n=new URL(this._url.toString());return n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),new Promise((o,s)=>{try{let a={headers:r};this._websocket=new this._WebSocket(n.toString(),a),this._websocket.on("open",()=>{o()}),this._websocket.on("error",c=>{let u=c.code!==void 0?c.code:void 0;s(new tAe(u,`WebSocket error: ${c.message}`))}),this._websocket.on("message",async c=>{try{let u=c.toString(),d=JSON.parse(u);if(this._specialIds.has(Number(d.id))||d.type==="welcome")return;this.onmessage?.(await this._transformResponse(d))}catch(u){this.onerror?.(new Error(`Failed to parse WebSocket message: ${u instanceof Error?u.message:String(u)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(a){s(new tAe(void 0,`Failed to create WebSocket: ${a}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(R.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl;if(!n)throw new Error("Redirect URL is required for authorization");let o=typeof n=="string"?n:n.toString(),s=await hJr(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:o,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(s)}else throw new Error(R.t("websocketClient.errors.clientInfoNotAvailable"))}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===AU.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(R.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(R.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==AU.default.OPEN)throw new Error(R.t("websocketClient.errors.websocketNotOpen"));try{if(e.method==="notifications/initialized")return;let r=await this._transformRequest(e),n=JSON.stringify(r);this._websocket.send(n)}catch(r){throw new tAe(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:eAe.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.4.10",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:o}=r||{};return{type:eAe.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{filePath:n,originalText:await cRo(n,"utf8"),modifiedText:o}}}return e}async _transformResponse(e){if(e.type==="connection_ack")return{jsonrpc:"2.0",id:e.id,result:{protocolVersion:"2024-11-05",capabilities:{logging:{},prompts:{},resources:{},tools:{}},serverInfo:{name:"JetBrains Plugin Server",title:"JetBrains Plugin Server",version:"1.0.0"}}};if(e.type==="selection_changed"){let r=await this._getSelectedText();return{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0,selectedText:r}]}}}}return e.type==="active_file_changed"?{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0}]}}}:e}async _getSelectedText(){if(!this._websocket)return"";let e=performance.now();return this._specialIds.add(e),this._websocket.send(JSON.stringify({type:eAe.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",o=>{try{let s=JSON.parse(o.toString());Number(s.id)===e&&(this._specialIds.delete(e),s.payload.success?r(s.payload.data.text):n(s.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var yJr=I((kfc,AJr)=>{"use strict";AJr.exports=function(e){return e.map(function(r){return r===""?"''":r&&typeof r=="object"?r.op.replace(/(.)/g,"\\$1"):/["\s\\]/.test(r)&&!/'/.test(r)?"'"+r.replace(/(['])/g,"\\$1")+"'":/["'\s]/.test(r)?'"'+r.replace(/(["\\$`!])/g,"\\$1")+'"':String(r).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")}});var xJr=I((Nfc,SJr)=>{"use strict";var CJr="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",_Jr=new RegExp("^"+CJr+"$"),EJr="|&;()<> \\t",lRo='"((\\\\"|[^"])*?)"',uRo="'((\\\\'|[^'])*?)'",dRo=/^#$/,vJr="'",bJr='"',Mwt="$",c$="",fRo=4294967296;for(Fwt=0;Fwt<4;Fwt++)c$+=(fRo*Math.random()).toString(16);var Fwt,pRo=new RegExp("^"+c$);function hRo(t,e){for(var r=e.lastIndex,n=[],o;o=e.exec(t);)n.push(o),e.lastIndex===o.index&&(e.lastIndex+=1);return e.lastIndex=r,n}function mRo(t,e,r){var n=typeof t=="function"?t(r):t[r];return typeof n>"u"&&r!=""?n="":typeof n>"u"&&(n="$"),typeof n=="object"?e+c$+JSON.stringify(n)+c$:e+n}function gRo(t,e,r){r||(r={});var n=r.escape||"\\",o="(\\"+n+`['"`+EJr+`]|[^\\s'"`+EJr+"])+",s=new RegExp(["("+CJr+")","("+o+"|"+lRo+"|"+uRo+")+"].join("|"),"g"),a=hRo(t,s);if(a.length===0)return[];e||(e={});var c=!1;return a.map(function(u){var d=u[0];if(!d||c)return;if(_Jr.test(d))return{op:d};var f=!1,p=!1,h="",m=!1,g;function A(){g+=1;var v,b,S=d.charAt(g);if(S==="{"){if(g+=1,d.charAt(g)==="}")throw new Error("Bad substitution: "+d.slice(g-2,g+1));if(v=d.indexOf("}",g),v<0)throw new Error("Bad substitution: "+d.slice(g));b=d.slice(g,v),g=v}else if(/[*@#?$!_-]/.test(S))b=S,g+=1;else{var w=d.slice(g);v=w.match(/[^\w\d_]/),v?(b=w.slice(0,v.index),g+=v.index-1):(b=w,g=d.length)}return mRo(e,"",b)}for(g=0;g<d.length;g++){var y=d.charAt(g);if(m=m||!f&&(y==="*"||y==="?"),p)h+=y,p=!1;else if(f)y===f?f=!1:f==vJr?h+=y:y===n?(g+=1,y=d.charAt(g),y===bJr||y===n||y===Mwt?h+=y:h+=n+y):y===Mwt?h+=A():h+=y;else if(y===bJr||y===vJr)f=y;else{if(_Jr.test(y))return{op:d};if(dRo.test(y)){c=!0;var E={comment:t.slice(u.index+g+1)};return h.length?[h,E]:[E]}else y===n?p=!0:y===Mwt?h+=A():h+=y}}return m?{op:"glob",pattern:h}:h}).reduce(function(u,d){return typeof d>"u"?u:u.concat(d)},[])}SJr.exports=function(e,r,n){var o=gRo(e,r,n);return typeof r!="function"?o:o.reduce(function(s,a){if(typeof a=="object")return s.concat(a);var c=a.split(RegExp("("+c$+".*?"+c$+")","g"));return c.length===1?s.concat(c[0]):s.concat(c.filter(Boolean).map(function(u){return pRo.test(u)?JSON.parse(u.split(c$)[1]):u}))},[])}});var rAe=I(Lwt=>{"use strict";Lwt.quote=yJr();Lwt.parse=xJr()});var wJr,NFe,TJr=q(()=>{"use strict";wJr=we(kwe(),1);Xn();NFe=class{config;auth;redirectUrl="";clientMetadata={client_name:"iFlow CLI (Google ADC)",redirect_uris:[],grant_types:[],response_types:[],token_endpoint_auth_method:"none"};_clientInformation;constructor(e){this.config=e;let r=this.config?.oauth?.scopes;if(!r||r.length===0)throw new Error(R.t("mcp.auth.scopesRequired"));this.auth=new wJr.GoogleAuth({scopes:r})}clientInformation(){return this._clientInformation}saveClientInformation(e){this._clientInformation=e}async tokens(){let r=await(await this.auth.getClient()).getAccessToken();if(!r.token){console.error(R.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as ARo}from"node:child_process";import{promisify as yRo}from"node:util";import{platform as _Ro}from"node:os";import{URL as ERo}from"node:url";function vRo(t){let e;try{e=new ERo(t)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Unsafe protocol: ${e.protocol}. Only HTTP and HTTPS are allowed.`);if(/[\r\n\x00-\x1f]/.test(t))throw new Error("URL contains invalid characters")}async function DJr(t){vRo(t);let e=_Ro(),r,n;switch(e){case"darwin":r="open",n=[t];break;case"win32":r="powershell.exe",n=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${t.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":r="xdg-open",n=[t];break;default:throw new Error(`Unsupported platform: ${e}`)}let o={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await IJr(r,n,o)}catch(s){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let a=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let c of a)try{await IJr(c,[t],o);return}catch{continue}}throw new Error(`Failed to open browser: ${s instanceof Error?s.message:"Unknown error"}`)}}var IJr,RJr=q(()=>{"use strict";IJr=yRo(ARo)});function Ao(t){return t instanceof Error&&"code"in t}function br(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function Uwt(t){if(t&&typeof t=="object"&&"response"in t){let r=bRo(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new BFe(r.error.message);case 401:return new lB(r.error.message);case 403:return new OFe(r.error.message);default:}}return t}function bRo(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var OFe,lB,BFe,Zu=q(()=>{"use strict";OFe=class extends Error{},lB=class extends Error{},BFe=class extends Error{}});import{promises as ate}from"node:fs";import*as PFe from"node:path";import*as kJr from"node:os";var Pg,MFe=q(()=>{"use strict";Zu();Xn();Pg=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=kJr.homedir();return PFe.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=PFe.dirname(this.getTokenFilePath());await ate.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await ate.readFile(r,"utf-8"),o=JSON.parse(n);for(let s of o)e.set(s.serverName,s)}catch(r){r.code!=="ENOENT"&&console.error(R.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:br(r)}))}return e}static async saveToken(e,r,n,o,s){await this.ensureConfigDir();let a=await this.loadTokens(),c={serverName:e,token:r,clientId:n,tokenUrl:o,mcpServerUrl:s,updatedAt:Date.now()};a.set(e,c);let u=Array.from(a.values()),d=this.getTokenFilePath();try{await ate.writeFile(d,JSON.stringify(u,null,2),{mode:384})}catch(f){throw console.error(R.t("mcp.tokenStorage.errors.failedToSaveToken",{error:br(f)})),f}}static async getToken(e){return(await this.loadTokens()).get(e)||null}static async removeToken(e){let r=await this.loadTokens();if(r.delete(e)){let n=Array.from(r.values()),o=this.getTokenFilePath();try{n.length===0?await ate.unlink(o):await ate.writeFile(o,JSON.stringify(n,null,2),{mode:384})}catch(s){console.error(R.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:br(s)}))}}}static isTokenExpired(e){if(!e.expiresAt)return!1;let r=300*1e3;return Date.now()+r>=e.expiresAt}static async clearAllTokens(){try{let e=this.getTokenFilePath();await ate.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(R.t("mcp.tokenStorage.errors.failedToClearTokens",{error:br(e)}))}}}});var Mg,FFe=q(()=>{"use strict";Zu();Xn();Mg=class{static buildWellKnownUrls(e){let r=new URL(e),n=`${r.protocol}//${r.host}`;return{protectedResource:new URL("/.well-known/oauth-protected-resource",n).toString(),authorizationServer:new URL("/.well-known/oauth-authorization-server",n).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch protected resource metadata from ${e}: ${br(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch authorization server metadata from ${e}: ${br(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[]}}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(n?.authorization_servers?.length){let s=n.authorization_servers[0],a=new URL("/.well-known/oauth-authorization-server",s).toString(),c=await this.fetchAuthorizationServerMetadata(a);if(c){let u=this.metadataToOAuthConfig(c);return c.registration_endpoint&&console.log(R.t("mcp.oauth.discovery.dynamicRegistrationSupported"),c.registration_endpoint),u}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let o=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(o){let s=this.metadataToOAuthConfig(o);return o.registration_endpoint&&console.log(R.t("mcp.oauth.discovery.dynamicRegistrationSupported"),o.registration_endpoint),s}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${br(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e){let r=this.parseWWWAuthenticateHeader(e);if(!r)return null;console.log(R.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);return a?(console.log(R.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(a)):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}`}}});import*as NJr from"node:http";import*as nAe from"node:crypto";import{URL as Qwt}from"node:url";var kE,jwt=q(()=>{"use strict";RJr();MFe();Zu();FFe();Xn();kE=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let o={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${this.REDIRECT_PORT}${this.REDIRECT_PATH}`],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none",code_challenge_method:["S256"],scope:r.scopes?.join(" ")||""},s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!s.ok){let a=await s.text();throw new Error(R.t("mcp.auth.clientRegistrationFailed",{status:s.status,statusText:s.statusText,error:a}))}return await s.json()}static async discoverOAuthFromMCPServer(e){let r=Mg.extractBaseUrl(e);return Mg.discoverOAuthConfig(r)}static generatePKCEParams(){let e=nAe.randomBytes(32).toString("base64url"),r=nAe.createHash("sha256").update(e).digest("base64url"),n=nAe.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let o=NJr.createServer(async(s,a)=>{try{let c=new Qwt(s.url,`http://localhost:${this.REDIRECT_PORT}`);if(c.pathname!==this.REDIRECT_PATH){a.writeHead(404),a.end(R.t("mcp.ui.notFound"));return}let u=c.searchParams.get("code"),d=c.searchParams.get("state"),f=c.searchParams.get("error");if(f){a.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),a.end(`
1000
1000
  <html>
1001
1001
  <body>
1002
1002
  <h1>${R.t("mcp.ui.authenticationFailed")}</h1>
@@ -3133,7 +3133,7 @@ ${o.map(h=>` - ${h}`).join(`
3133
3133
  ${h.llmContent}`}):console.warn("Full context requested, but read_many_files returned no content.")}else console.warn("Full context requested, but read_many_files tool not found.")}catch(p){console.error("Error reading full file context:",p),d.push({text:`
3134
3134
  --- Error reading full file context ---`})}return d}async startChat(e){this.forceFullIdeContext=!0;let r=await this.getEnvironment(),n=await this.enhanceEnvironment(r),o=await this.config.getToolRegistry();this.currentChatApprovalMode=this.config.getApprovalMode();let s=this.config.getUsageMode(),a;if(this.currentChatApprovalMode===yn.PLAN){let d=[Qs.Name,_f.Name,r1.Name,Gd.Name,Aa.Name,jm.Name,Hh.Name,J2.Name,vc.Name,t0.Name,c8.Name,Ul.Name];a=o.getFunctionDeclarations().filter(p=>d.includes(p.name||""))}else a=o.getFunctionDeclarations().filter(d=>d.name!==p5.Name);s==="non-interactive"&&(a=a.filter(d=>d.name!==jm.Name&&d.name!==tm.Name));let c=[{functionDeclarations:a}],u=e??[];try{let d=this.config.getUserMemory(),f;this.systemPrompt?f=this.systemPrompt:this.currentChatApprovalMode===yn.PLAN?f=await HWt(this.config,d):f=await dse(this.config,d),this.appendSystemPrompt&&(f=f+`
3135
3135
  `+this.appendSystemPrompt);let p=qDs(this.config.getModel())?{...this.generateContentConfig,thinkingConfig:{includeThoughts:!0}}:this.generateContentConfig;return new LEe(this.config,this.getContentGenerator(),{systemInstruction:f,...p,tools:c},u,this.reminderManager,n)}catch(d){throw await nR(d,"Error initializing iFlow chat session.",u,"startChat"),new Error(`Failed to initialize chat: ${br(d)}`)}}async*sendMessageStream(e,r,n,o=this.MAX_TURNS,s){let a=lI.client;a.start("SendMessageStream-Total");let c=fS.getRootSpan();o===this.MAX_TURNS&&(this.lastPromptId!==n?(c=fS.startRootSpan("iflow_cli_request",!0),fS.setSpanAttributes({prompt_id:n,model:this.config.getModel(),request_type:"user_message"})):c&&fS.setSpanAttributes({prompt_id:n,model:this.config.getModel(),request_type:"user_message"}));let u=Date.now(),d=!0,f,p=async function*(){try{let h=this.config.getApprovalMode();if(this.currentChatApprovalMode!==h){let k=this.getHistory();this.chat=await this.startChat(k)}let m=this.config.getPendingHistoryRestore();if(m&&m.length>0&&(this.getChat().setHistory(m),this.config.clearPendingHistoryRestore()),await this.updateChatTools(),this.lastPromptId!==n&&(this.config.getSkipLoopDetector()||this.loopDetector.reset(n),this.lastPromptId=n),this.sessionTurnCount++,this.config.getApprovalMode()===yn.PLAN){let k=this.getChat();k&&k.reminderManager&&k.reminderManager.emitEvent(oi.PLAN_MODE_ACTIVATED,this.config.getSessionId(),{approvalMode:yn.PLAN,timestamp:Date.now()},"high")}if(this.config.getMaxSessionTurns()>0&&this.sessionTurnCount>this.config.getMaxSessionTurns())return yield{type:Es.MaxSessionTurns},new yH(this.getChat(),n);let g=Math.min(o,this.MAX_TURNS);if(!g)return new yH(this.getChat(),n);let A=s||this.config.getModel(),y=await this.tryCompressChat(n);y&&(yield{type:Es.ChatCompressed,value:y});let E=this.getHistory(),v=E.length>0?E[E.length-1]:void 0,b=!!v&&v.role==="model"&&(v.parts?.some(k=>"functionCall"in k)||!1);if(this.config.getIdeClient().getConnectionStatus().status===Ks.Connected&&!b){let{contextParts:k,newIdeContext:D}=this.getIdeContextParts(this.forceFullIdeContext||E.length===0);k.length>0&&this.getChat().addHistory({role:"user",parts:[{text:k.join(`
3136
- `)}]}),this.lastSentIdeContext=D,this.forceFullIdeContext=!1}let S=new yH(this.getChat(),n);this.config.getSkipLoopDetector()||await this.loopDetector.turnStarted(r);let w=S.run(e,r);for await(let k of w)this.config.getSkipLoopDetector()||this.loopDetector.addAndCheck(k),yield k;if(!S.pendingToolCalls.length&&r&&!r.aborted){if(this.config.getModel()!==A||this.config.getSkipNextSpeakerCheck())return S;let D=await yMn(this.getChat(),this,r);if(nGr(this.config,new yBe(n,S.finishReason?.toString()||"",D?.next_speaker||"")),D?.next_speaker==="model"){let P=[{text:"Please continue."}];yield*this.sendMessageStream(P,r,n,g-1,A)}}return S}catch(h){throw d=!1,f=h instanceof Error?h.message:"Unknown error",h}finally{let h=Date.now()-u;TQr(this.config,n,h,d,f),(o===1||!o)&&await fS.endRootSpan(),a.end("SendMessageStream-Total")}}.bind(this);return c?yield*H0.with(Ms.setSpan(H0.active(),c),p):yield*p()}async generateJson(e,r,n,o,s={},a){let c=o||this.config.getModel()||hf;try{let u=this.config.getUserMemory(),d=a??await dse(this.config,u),f={abortSignal:n,...this.generateContentConfig,...s},h=await this.getContentGenerator().generateContent({model:c,config:{...f,systemInstruction:d,responseSchema:r,responseMimeType:"application/json"},contents:e},this.lastPromptId),m=n1(h);if(!m){let y=new Error("API returned an empty response for generateJson.");throw await nR(y,"Error in generateJson: API returned an empty response.",e,"generateJson-empty-response"),y}let g=/```json\s*([\s\S]*?)\s*```/,A=m.match(g);A&&(Im.getInstance(this.config)?.logMalformedJsonResponseEvent(new _Be(c)),m=A[1].trim());try{return JSON.parse(m)}catch(y){throw await nR(y,"Failed to parse JSON response from generateJson.",{responseTextFailedToParse:m,originalRequestContents:e},"generateJson-parse"),new Error(`Failed to parse API response as JSON: ${br(y)}`)}}catch(u){throw n.aborted||u instanceof Error&&u.message==="API returned an empty response for generateJson."?u:(await nR(u,"Error generating JSON content via API.",e,"generateJson-api"),new Error(`Failed to generate JSON content: ${br(u)}`))}}async generateContent(e,r,n,o,s){let a=o??this.config.getModel(),c={...this.generateContentConfig,...r};try{let u=this.config.getUserMemory(),d=await dse(this.config,u),f={abortSignal:n,...c,systemInstruction:d};return await bH(()=>this.getContentGenerator().generateContent({model:a,config:f,contents:e},s||this.lastPromptId),{onPersistent429:async(m,g)=>await this.handleFlashFallback(m,g),authType:this.config.getContentGeneratorConfig()?.authType})}catch(u){throw n.aborted?u:(await nR(u,`Error generating content via API with model ${a}.`,{requestContents:e,requestConfig:c},"generateContent-api"),new Error(`Failed to generate content with model ${a}: ${br(u)}`))}}async generateTextOnly(e,r,n,o){let s=o??this.config.getModel(),a={...this.generateContentConfig,...r};try{let c={abortSignal:n,...a};return await bH(()=>this.getContentGenerator().generateContent({model:s,config:c,contents:e},this.lastPromptId),{onPersistent429:async(f,p)=>await this.handleFlashFallback(f,p),authType:this.config.getContentGeneratorConfig()?.authType})}catch(c){throw nR({error:c,debugInfo:{userId:"",sessionId:this.config.getSessionId(),conversationId:"",model:s,authType:this.config.getContentGeneratorConfig()?.authType}},"generateTextOnly-api"),new Error(`Failed to generate text content with model ${s}: ${br(c)}`)}}async generateEmbedding(e){if(!e||e.length===0)return[];let r={model:this.embeddingModel,contents:e},n=await this.getContentGenerator().embedContent(r);if(!n.embeddings||n.embeddings.length===0)throw new Error("No embeddings found in API response.");if(n.embeddings.length!==e.length)throw new Error(`API returned a mismatched number of embeddings. Expected ${e.length}, got ${n.embeddings.length}.`);return n.embeddings.map((o,s)=>{let a=o.values;if(!a||a.length===0)throw new Error(`API returned an empty embedding for input text at index ${s}: "${e[s]}"`);return a})}async shouldCompressChat(e=!1){let r=this.getChat().getHistory(!0),n=this.getChat().getEnvironmentParts();if(r.length===0)return!1;let o=[];n.length>0&&(o=[{role:"user",parts:n}]),o=o.concat(r);let s=this.config.getModel(),{totalTokens:a}=await this.getContentGenerator().countTokens({model:s,contents:o});return!(a===void 0||!e&&a<this.COMPRESSION_TOKEN_THRESHOLD*_j(s,this.config.getTokensLimit()))}async tryCompressChat(e,r=!1){return this.compressManager.tryCompress(e,r)}async handleFlashFallback(e,r){if(e!==Jt.LOGIN_WITH_IFLOW)return null;let n=this.config.getModel(),o=hf;if(n===o)return null;let s=this.config.flashFallbackHandler;if(typeof s=="function")try{let a=await s(n,o,r);if(a!==!1&&a!==null)return this.config.setModel(o),this.config.setFallbackMode(!0),o;if(this.config.getModel()===o)return null}catch(a){console.warn("Flash fallback handler failed:",a)}return null}emitReminderEvent(e,r,n,o="medium"){this.reminderManager.emitEvent(e,r,n,o)}getReminderManager(){return this.reminderManager}restoreHistory(e){if(!this.chat)throw new Error("Chat not initialized. Call startChat() first.");this.getChat().setHistory(e)}async enhanceEnvironment(e){return await new SYe(this.config).enhanceEnvironmentParts(e)}}});var QYe,FMn=q(()=>{"use strict";UEe();_H();Xn();QYe=class{sessions=new Map;async initializeClientTools(e,r,n){if(n&&n.length>0){let o=await r.getToolRegistry(),s=new Set(n.map(u=>u.name)),a=o.getAllTools(),c=[...n,...a.filter(u=>s.has(u.name)&&!n.some(d=>d.name===u.name))];o.tools=new Map,c.forEach(u=>o.registerTool(u))}else{let o=await r.getToolRegistry();o.tools=new Map}await e.setTools(),r.setGeminiClient(e)}async createSession(e,r,n,o,s,a){let c=await n.clone();c.setAgentCoreSystemPrompt(o.systemPrompt),c.setAgentColor(o.color);let u=new sR(c),d=c.getContentGeneratorConfig();if(!d)throw new Error(R.t("subAgentSessionManager.errors.contentGeneratorConfigNotAvailable"));await u.initialize(d),await this.initializeClientTools(u,c,a);let f={sessionId:o.sessionId,agentId:e,config:c,geminiClient:u,sessionConfig:o,messageHistory:[],startTime:Date.now(),currentRound:0};return this.sessions.set(o.sessionId,f),s.emit({type:Pn.SESSION_CREATED,agentId:e,agentIndex:r,timestamp:Date.now(),sessionConfig:o,data:{messageCount:0}}),f}getSession(e){return this.sessions.get(e)}addMessageToSession(e,r,n,o){let s=this.sessions.get(e);s&&(s.messageHistory.push(r),o.emit({type:Pn.SESSION_MESSAGE_ADDED,agentId:s.agentId,agentIndex:n,timestamp:Date.now(),sessionConfig:s.sessionConfig,data:{messageCount:s.messageHistory.length}}))}cleanupSession(e){this.sessions.delete(e)}getAllActiveSessions(){return Array.from(this.sessions.values())}getSessionCount(){return this.sessions.size}}});var hse,LMn=q(()=>{"use strict";ub();hse=class{static SUPPORTED_MODELS=[{label:"GLM-4.6(recommend)",value:"glm-4.6"},{label:"DeepSeek-V3.2",value:"deepseek-v3.2-chat"},{label:"Qwen3-Coder-Plus",value:"qwen3-coder-plus"},{label:"Kimi-K2-Thinking",value:"kimi-k2-thinking"},{label:"MiniMax-M2",value:"minimax-m2"},{label:"Kimi-K2-0905",value:"kimi-k2-0905"}];static isModelSupported(e){return e?this.SUPPORTED_MODELS.some(r=>r.value===e):!1}static getAvailableModels(){return[...this.SUPPORTED_MODELS]}static getSupportedModelValues(){return this.SUPPORTED_MODELS.map(e=>e.value)}static getDefaultModel(){return TE}static getClosestSupportedModel(e,r){if(this.isModelSupported(e))return e;let n=e.toLowerCase(),o=this.SUPPORTED_MODELS.find(s=>s.value.toLowerCase().includes(n)||n.includes(s.value.toLowerCase()));return o?o.value:r||this.getDefaultModel()}static getModelLabel(e){let r=this.SUPPORTED_MODELS.find(n=>n.value===e);return r?r.label:e}static validateModel(e,r,n){if(!e)return{isValid:!1,model:e,reason:"Model name is empty",suggestedModel:r};if(n==="openai-compatible")return{isValid:!0,model:e};if(r&&e===r)return{isValid:!0,model:e};if(this.isModelSupported(e))return{isValid:!0,model:e};let o=this.getClosestSupportedModel(e,r);return{isValid:!1,model:e,reason:`Model '${e}' is not supported`,suggestedModel:o,availableModels:this.getAvailableModels()}}}});import*as jYe from"fs";import*as YWt from"path";import*as UMn from"os";var mse,KWt=q(()=>{"use strict";_H();mse=class t{static SESSION_PREFERENCES=new Map;static CONFIG_DIR=YWt.join(UMn.homedir(),".iflow");static PREFERENCES_FILE=YWt.join(t.CONFIG_DIR,"model-preferences.json");static setSessionPreference(e,r){this.SESSION_PREFERENCES.set(e,r)}static getSessionPreference(e){return this.SESSION_PREFERENCES.get(e)||null}static clearSessionPreferences(){this.SESSION_PREFERENCES.clear()}static async setUserPreference(e,r){try{await this.ensureConfigDir();let n=await this.loadUserPreferences();n[e]={originalModel:e,fallbackModel:r,preference:k3.RememberAlways,createdAt:Date.now()},await this.saveUserPreferences(n)}catch(n){console.error("Failed to save user model preference:",n)}}static async getUserPreference(e){try{let n=(await this.loadUserPreferences())[e];return n?n.fallbackModel:null}catch(r){return console.error("Failed to load user model preference:",r),null}}static async getPreferredFallback(e){let r=this.getSessionPreference(e);return r||await this.getUserPreference(e)}static async savePreference(e,r,n){switch(n){case k3.OnceOnly:break;case k3.RememberSession:this.setSessionPreference(e,r);break;case k3.RememberAlways:await this.setUserPreference(e,r);break}}static async removeUserPreference(e){try{let r=await this.loadUserPreferences();delete r[e],await this.saveUserPreferences(r)}catch(r){console.error("Failed to remove user model preference:",r)}}static async getAllUserPreferences(){try{let e=await this.loadUserPreferences();return Object.values(e)}catch(e){return console.error("Failed to load user preferences:",e),[]}}static async clearAllUserPreferences(){try{await this.saveUserPreferences({})}catch(e){console.error("Failed to clear user preferences:",e)}}static async ensureConfigDir(){try{await jYe.promises.mkdir(this.CONFIG_DIR,{recursive:!0})}catch{}}static async loadUserPreferences(){try{let e=await jYe.promises.readFile(this.PREFERENCES_FILE,"utf-8");return JSON.parse(e)}catch{return{}}}static async saveUserPreferences(e){let r=JSON.stringify(e,null,2);await jYe.promises.writeFile(this.PREFERENCES_FILE,r,"utf-8")}}});function QEe(t){let e=/^---\s*\n([\s\S]*?)---\s*\n?/,r=t.match(e);if(!r)return{frontmatter:{},content:t};let n=r[1]||"",o=t.slice(r[0].length),s={},a=n.split(`
3136
+ `)}]}),this.lastSentIdeContext=D,this.forceFullIdeContext=!1}let S=new yH(this.getChat(),n);this.config.getSkipLoopDetector()||await this.loopDetector.turnStarted(r);let w=S.run(e,r);for await(let k of w)this.config.getSkipLoopDetector()||this.loopDetector.addAndCheck(k),yield k;if(!S.pendingToolCalls.length&&r&&!r.aborted){if(this.config.getModel()!==A||this.config.getSkipNextSpeakerCheck())return S;let D=await yMn(this.getChat(),this,r);if(nGr(this.config,new yBe(n,S.finishReason?.toString()||"",D?.next_speaker||"")),D?.next_speaker==="model"){let P=[{text:"Please continue."}];yield*this.sendMessageStream(P,r,n,g-1,A)}}return S}catch(h){throw d=!1,f=h instanceof Error?h.message:"Unknown error",h}finally{let h=Date.now()-u;TQr(this.config,n,h,d,f),(o===1||!o)&&await fS.endRootSpan(),a.end("SendMessageStream-Total")}}.bind(this);return c?yield*H0.with(Ms.setSpan(H0.active(),c),p):yield*p()}async generateJson(e,r,n,o,s={},a){let c=o||this.config.getModel()||hf;try{let u=this.config.getUserMemory(),d=a??await dse(this.config,u),f={abortSignal:n,...this.generateContentConfig,...s},h=await this.getContentGenerator().generateContent({model:c,config:{...f,systemInstruction:d,responseSchema:r,responseMimeType:"application/json"},contents:e},this.lastPromptId),m=n1(h);if(!m){let y=new Error("API returned an empty response for generateJson.");throw await nR(y,"Error in generateJson: API returned an empty response.",e,"generateJson-empty-response"),y}let g=/```json\s*([\s\S]*?)\s*```/,A=m.match(g);A&&(Im.getInstance(this.config)?.logMalformedJsonResponseEvent(new _Be(c)),m=A[1].trim());try{return JSON.parse(m)}catch(y){throw await nR(y,"Failed to parse JSON response from generateJson.",{responseTextFailedToParse:m,originalRequestContents:e},"generateJson-parse"),new Error(`Failed to parse API response as JSON: ${br(y)}`)}}catch(u){throw n.aborted||u instanceof Error&&u.message==="API returned an empty response for generateJson."?u:(await nR(u,"Error generating JSON content via API.",e,"generateJson-api"),new Error(`Failed to generate JSON content: ${br(u)}`))}}async generateContent(e,r,n,o,s){let a=o??this.config.getModel(),c={...this.generateContentConfig,...r};try{let u=this.config.getUserMemory(),d=await dse(this.config,u),f={abortSignal:n,...c,systemInstruction:d};return await bH(()=>this.getContentGenerator().generateContent({model:a,config:f,contents:e},s||this.lastPromptId),{onPersistent429:async(m,g)=>await this.handleFlashFallback(m,g),authType:this.config.getContentGeneratorConfig()?.authType})}catch(u){throw n.aborted?u:(await nR(u,`Error generating content via API with model ${a}.`,{requestContents:e,requestConfig:c},"generateContent-api"),new Error(`Failed to generate content with model ${a}: ${br(u)}`))}}async generateTextOnly(e,r,n,o){let s=o??this.config.getModel(),a={...this.generateContentConfig,...r};try{let c={abortSignal:n,...a};return await bH(()=>this.getContentGenerator().generateContent({model:s,config:c,contents:e},this.lastPromptId),{onPersistent429:async(f,p)=>await this.handleFlashFallback(f,p),authType:this.config.getContentGeneratorConfig()?.authType})}catch(c){throw nR({error:c,debugInfo:{userId:"",sessionId:this.config.getSessionId(),conversationId:"",model:s,authType:this.config.getContentGeneratorConfig()?.authType}},"generateTextOnly-api"),new Error(`Failed to generate text content with model ${s}: ${br(c)}`)}}async generateEmbedding(e){if(!e||e.length===0)return[];let r={model:this.embeddingModel,contents:e},n=await this.getContentGenerator().embedContent(r);if(!n.embeddings||n.embeddings.length===0)throw new Error("No embeddings found in API response.");if(n.embeddings.length!==e.length)throw new Error(`API returned a mismatched number of embeddings. Expected ${e.length}, got ${n.embeddings.length}.`);return n.embeddings.map((o,s)=>{let a=o.values;if(!a||a.length===0)throw new Error(`API returned an empty embedding for input text at index ${s}: "${e[s]}"`);return a})}async shouldCompressChat(e=!1){let r=this.getChat().getHistory(!0),n=this.getChat().getEnvironmentParts();if(r.length===0)return!1;let o=[];n.length>0&&(o=[{role:"user",parts:n}]),o=o.concat(r);let s=this.config.getModel(),{totalTokens:a}=await this.getContentGenerator().countTokens({model:s,contents:o});return!(a===void 0||!e&&a<this.COMPRESSION_TOKEN_THRESHOLD*_j(s,this.config.getTokensLimit()))}async tryCompressChat(e,r=!1){return this.compressManager.tryCompress(e,r)}async handleFlashFallback(e,r){if(e!==Jt.LOGIN_WITH_IFLOW)return null;let n=this.config.getModel(),o=hf;if(n===o)return null;let s=this.config.flashFallbackHandler;if(typeof s=="function")try{let a=await s(n,o,r);if(a!==!1&&a!==null)return this.config.setModel(o),this.config.setFallbackMode(!0),o;if(this.config.getModel()===o)return null}catch(a){console.warn("Flash fallback handler failed:",a)}return null}emitReminderEvent(e,r,n,o="medium"){this.reminderManager.emitEvent(e,r,n,o)}getReminderManager(){return this.reminderManager}restoreHistory(e){if(!this.chat)throw new Error("Chat not initialized. Call startChat() first.");this.getChat().setHistory(e)}async enhanceEnvironment(e){return await new SYe(this.config).enhanceEnvironmentParts(e)}}});var QYe,FMn=q(()=>{"use strict";UEe();_H();Xn();QYe=class{sessions=new Map;async initializeClientTools(e,r,n){if(n&&n.length>0){let o=await r.getToolRegistry(),s=new Set(n.map(u=>u.name)),a=o.getAllTools(),c=[...n,...a.filter(u=>s.has(u.name)&&!n.some(d=>d.name===u.name))];o.tools=new Map,c.forEach(u=>o.registerTool(u))}else{let o=await r.getToolRegistry();o.tools=new Map}await e.setTools(),r.setGeminiClient(e)}async createSession(e,r,n,o,s,a){let c=await n.clone();c.setAgentCoreSystemPrompt(o.systemPrompt),c.setAgentColor(o.color);let u=new sR(c),d=c.getContentGeneratorConfig();if(!d)throw new Error(R.t("subAgentSessionManager.errors.contentGeneratorConfigNotAvailable"));await u.initialize(d),await this.initializeClientTools(u,c,a);let f={sessionId:o.sessionId,agentId:e,config:c,geminiClient:u,sessionConfig:o,messageHistory:[],startTime:Date.now(),currentRound:0};return this.sessions.set(o.sessionId,f),s.emit({type:Pn.SESSION_CREATED,agentId:e,agentIndex:r,timestamp:Date.now(),sessionConfig:o,data:{messageCount:0}}),f}getSession(e){return this.sessions.get(e)}addMessageToSession(e,r,n,o){let s=this.sessions.get(e);s&&(s.messageHistory.push(r),o.emit({type:Pn.SESSION_MESSAGE_ADDED,agentId:s.agentId,agentIndex:n,timestamp:Date.now(),sessionConfig:s.sessionConfig,data:{messageCount:s.messageHistory.length}}))}cleanupSession(e){this.sessions.delete(e)}getAllActiveSessions(){return Array.from(this.sessions.values())}getSessionCount(){return this.sessions.size}}});var hse,LMn=q(()=>{"use strict";ub();hse=class{static SUPPORTED_MODELS=[{label:"GLM-4.7(recommend)",value:"glm-4.7"},{label:"DeepSeek-V3.2",value:"deepseek-v3.2-chat"},{label:"Qwen3-Coder-Plus",value:"qwen3-coder-plus"},{label:"Kimi-K2-Thinking",value:"kimi-k2-thinking"},{label:"MiniMax-M2.1",value:"minimax-m2.1"},{label:"Kimi-K2-0905",value:"kimi-k2-0905"}];static isModelSupported(e){return e?this.SUPPORTED_MODELS.some(r=>r.value===e):!1}static getAvailableModels(){return[...this.SUPPORTED_MODELS]}static getSupportedModelValues(){return this.SUPPORTED_MODELS.map(e=>e.value)}static getDefaultModel(){return TE}static getClosestSupportedModel(e,r){if(this.isModelSupported(e))return e;let n=e.toLowerCase(),o=this.SUPPORTED_MODELS.find(s=>s.value.toLowerCase().includes(n)||n.includes(s.value.toLowerCase()));return o?o.value:r||this.getDefaultModel()}static getModelLabel(e){let r=this.SUPPORTED_MODELS.find(n=>n.value===e);return r?r.label:e}static validateModel(e,r,n){if(!e)return{isValid:!1,model:e,reason:"Model name is empty",suggestedModel:r};if(n==="openai-compatible")return{isValid:!0,model:e};if(r&&e===r)return{isValid:!0,model:e};if(this.isModelSupported(e))return{isValid:!0,model:e};let o=this.getClosestSupportedModel(e,r);return{isValid:!1,model:e,reason:`Model '${e}' is not supported`,suggestedModel:o,availableModels:this.getAvailableModels()}}}});import*as jYe from"fs";import*as YWt from"path";import*as UMn from"os";var mse,KWt=q(()=>{"use strict";_H();mse=class t{static SESSION_PREFERENCES=new Map;static CONFIG_DIR=YWt.join(UMn.homedir(),".iflow");static PREFERENCES_FILE=YWt.join(t.CONFIG_DIR,"model-preferences.json");static setSessionPreference(e,r){this.SESSION_PREFERENCES.set(e,r)}static getSessionPreference(e){return this.SESSION_PREFERENCES.get(e)||null}static clearSessionPreferences(){this.SESSION_PREFERENCES.clear()}static async setUserPreference(e,r){try{await this.ensureConfigDir();let n=await this.loadUserPreferences();n[e]={originalModel:e,fallbackModel:r,preference:k3.RememberAlways,createdAt:Date.now()},await this.saveUserPreferences(n)}catch(n){console.error("Failed to save user model preference:",n)}}static async getUserPreference(e){try{let n=(await this.loadUserPreferences())[e];return n?n.fallbackModel:null}catch(r){return console.error("Failed to load user model preference:",r),null}}static async getPreferredFallback(e){let r=this.getSessionPreference(e);return r||await this.getUserPreference(e)}static async savePreference(e,r,n){switch(n){case k3.OnceOnly:break;case k3.RememberSession:this.setSessionPreference(e,r);break;case k3.RememberAlways:await this.setUserPreference(e,r);break}}static async removeUserPreference(e){try{let r=await this.loadUserPreferences();delete r[e],await this.saveUserPreferences(r)}catch(r){console.error("Failed to remove user model preference:",r)}}static async getAllUserPreferences(){try{let e=await this.loadUserPreferences();return Object.values(e)}catch(e){return console.error("Failed to load user preferences:",e),[]}}static async clearAllUserPreferences(){try{await this.saveUserPreferences({})}catch(e){console.error("Failed to clear user preferences:",e)}}static async ensureConfigDir(){try{await jYe.promises.mkdir(this.CONFIG_DIR,{recursive:!0})}catch{}}static async loadUserPreferences(){try{let e=await jYe.promises.readFile(this.PREFERENCES_FILE,"utf-8");return JSON.parse(e)}catch{return{}}}static async saveUserPreferences(e){let r=JSON.stringify(e,null,2);await jYe.promises.writeFile(this.PREFERENCES_FILE,r,"utf-8")}}});function QEe(t){let e=/^---\s*\n([\s\S]*?)---\s*\n?/,r=t.match(e);if(!r)return{frontmatter:{},content:t};let n=r[1]||"",o=t.slice(r[0].length),s={},a=n.split(`
3137
3137
  `);for(let c of a){let u=c.trim();if(!u||u.startsWith("#"))continue;let d=u.indexOf(":");if(d>0){let f=u.slice(0,d).trim(),p=u.slice(d+1).trim();if(f&&p){let h=VDs(p);s[f]=h}}}return{frontmatter:s,content:o}}function VDs(t){return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t==="true"||t==="yes"||t==="on"?!0:t==="false"||t==="no"||t==="off"?!1:t==="null"||t==="~"?null:/^-?\d+$/.test(t)?parseInt(t,10):/^-?\d*\.\d+$/.test(t)?parseFloat(t):t.includes(",")?t.split(",").map(e=>e.trim()):t}function WDs(t,e){if(Object.keys(t).length===0)return e;let r=`---
3138
3138
  `;for(let[n,o]of Object.entries(t))r+=`${n}: ${zDs(o)}
3139
3139
  `;return r+=`---
@@ -5206,7 +5206,7 @@ ${h}`),n?o.reset(h):h}function F3a(t,e,r,n={}){if(!Mpi){Mpi=!0;let s="Passing li
5206
5206
 
5207
5207
  ${e}
5208
5208
  `:""}`}set message(e){this.#r=e}#o(e){if(!this.#t)return;let r=this.#e,n=j3a(r,this.#t.message);if(n)return(0,Hpi.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#n??=this.#o(!0),this.#n}get rawCodeFrame(){return this.#i??=this.#o(!1),this.#i}},j3a=(t,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:o,column:s}=r.groups;return o&&s?{line:Number(o),column:Number(s)}:isr(t,Number(n),{oneBased:!0})},$3a=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${Q3a(n)})`)});var m4e=I((lpl,Wpi)=>{"use strict";var G3a=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Wpi.exports=G3a});var g4e=I((upl,zpi)=>{"use strict";var q3a="2.0.0",H3a=Number.MAX_SAFE_INTEGER||9007199254740991,V3a=16,W3a=250,z3a=["major","premajor","minor","preminor","patch","prepatch","prerelease"];zpi.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:V3a,MAX_SAFE_BUILD_LENGTH:W3a,MAX_SAFE_INTEGER:H3a,RELEASE_TYPES:z3a,SEMVER_SPEC_VERSION:q3a,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Tle=I((Y8,Ypi)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:asr,MAX_SAFE_BUILD_LENGTH:Y3a,MAX_LENGTH:K3a}=g4e(),X3a=m4e();Y8=Ypi.exports={};var J3a=Y8.re=[],Z3a=Y8.safeRe=[],Zn=Y8.src=[],eya=Y8.safeSrc=[],ei=Y8.t={},tya=0,csr="[a-zA-Z0-9-]",rya=[["\\s",1],["\\d",K3a],[csr,Y3a]],nya=t=>{for(let[e,r]of rya)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},vs=(t,e,r)=>{let n=nya(e),o=tya++;X3a(t,o,e),ei[t]=o,Zn[o]=e,eya[o]=n,J3a[o]=new RegExp(e,r?"g":void 0),Z3a[o]=new RegExp(n,r?"g":void 0)};vs("NUMERICIDENTIFIER","0|[1-9]\\d*");vs("NUMERICIDENTIFIERLOOSE","\\d+");vs("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${csr}*`);vs("MAINVERSION",`(${Zn[ei.NUMERICIDENTIFIER]})\\.(${Zn[ei.NUMERICIDENTIFIER]})\\.(${Zn[ei.NUMERICIDENTIFIER]})`);vs("MAINVERSIONLOOSE",`(${Zn[ei.NUMERICIDENTIFIERLOOSE]})\\.(${Zn[ei.NUMERICIDENTIFIERLOOSE]})\\.(${Zn[ei.NUMERICIDENTIFIERLOOSE]})`);vs("PRERELEASEIDENTIFIER",`(?:${Zn[ei.NONNUMERICIDENTIFIER]}|${Zn[ei.NUMERICIDENTIFIER]})`);vs("PRERELEASEIDENTIFIERLOOSE",`(?:${Zn[ei.NONNUMERICIDENTIFIER]}|${Zn[ei.NUMERICIDENTIFIERLOOSE]})`);vs("PRERELEASE",`(?:-(${Zn[ei.PRERELEASEIDENTIFIER]}(?:\\.${Zn[ei.PRERELEASEIDENTIFIER]})*))`);vs("PRERELEASELOOSE",`(?:-?(${Zn[ei.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Zn[ei.PRERELEASEIDENTIFIERLOOSE]})*))`);vs("BUILDIDENTIFIER",`${csr}+`);vs("BUILD",`(?:\\+(${Zn[ei.BUILDIDENTIFIER]}(?:\\.${Zn[ei.BUILDIDENTIFIER]})*))`);vs("FULLPLAIN",`v?${Zn[ei.MAINVERSION]}${Zn[ei.PRERELEASE]}?${Zn[ei.BUILD]}?`);vs("FULL",`^${Zn[ei.FULLPLAIN]}$`);vs("LOOSEPLAIN",`[v=\\s]*${Zn[ei.MAINVERSIONLOOSE]}${Zn[ei.PRERELEASELOOSE]}?${Zn[ei.BUILD]}?`);vs("LOOSE",`^${Zn[ei.LOOSEPLAIN]}$`);vs("GTLT","((?:<|>)?=?)");vs("XRANGEIDENTIFIERLOOSE",`${Zn[ei.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);vs("XRANGEIDENTIFIER",`${Zn[ei.NUMERICIDENTIFIER]}|x|X|\\*`);vs("XRANGEPLAIN",`[v=\\s]*(${Zn[ei.XRANGEIDENTIFIER]})(?:\\.(${Zn[ei.XRANGEIDENTIFIER]})(?:\\.(${Zn[ei.XRANGEIDENTIFIER]})(?:${Zn[ei.PRERELEASE]})?${Zn[ei.BUILD]}?)?)?`);vs("XRANGEPLAINLOOSE",`[v=\\s]*(${Zn[ei.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Zn[ei.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Zn[ei.XRANGEIDENTIFIERLOOSE]})(?:${Zn[ei.PRERELEASELOOSE]})?${Zn[ei.BUILD]}?)?)?`);vs("XRANGE",`^${Zn[ei.GTLT]}\\s*${Zn[ei.XRANGEPLAIN]}$`);vs("XRANGELOOSE",`^${Zn[ei.GTLT]}\\s*${Zn[ei.XRANGEPLAINLOOSE]}$`);vs("COERCEPLAIN",`(^|[^\\d])(\\d{1,${asr}})(?:\\.(\\d{1,${asr}}))?(?:\\.(\\d{1,${asr}}))?`);vs("COERCE",`${Zn[ei.COERCEPLAIN]}(?:$|[^\\d])`);vs("COERCEFULL",Zn[ei.COERCEPLAIN]+`(?:${Zn[ei.PRERELEASE]})?(?:${Zn[ei.BUILD]})?(?:$|[^\\d])`);vs("COERCERTL",Zn[ei.COERCE],!0);vs("COERCERTLFULL",Zn[ei.COERCEFULL],!0);vs("LONETILDE","(?:~>?)");vs("TILDETRIM",`(\\s*)${Zn[ei.LONETILDE]}\\s+`,!0);Y8.tildeTrimReplace="$1~";vs("TILDE",`^${Zn[ei.LONETILDE]}${Zn[ei.XRANGEPLAIN]}$`);vs("TILDELOOSE",`^${Zn[ei.LONETILDE]}${Zn[ei.XRANGEPLAINLOOSE]}$`);vs("LONECARET","(?:\\^)");vs("CARETTRIM",`(\\s*)${Zn[ei.LONECARET]}\\s+`,!0);Y8.caretTrimReplace="$1^";vs("CARET",`^${Zn[ei.LONECARET]}${Zn[ei.XRANGEPLAIN]}$`);vs("CARETLOOSE",`^${Zn[ei.LONECARET]}${Zn[ei.XRANGEPLAINLOOSE]}$`);vs("COMPARATORLOOSE",`^${Zn[ei.GTLT]}\\s*(${Zn[ei.LOOSEPLAIN]})$|^$`);vs("COMPARATOR",`^${Zn[ei.GTLT]}\\s*(${Zn[ei.FULLPLAIN]})$|^$`);vs("COMPARATORTRIM",`(\\s*)${Zn[ei.GTLT]}\\s*(${Zn[ei.LOOSEPLAIN]}|${Zn[ei.XRANGEPLAIN]})`,!0);Y8.comparatorTrimReplace="$1$2$3";vs("HYPHENRANGE",`^\\s*(${Zn[ei.XRANGEPLAIN]})\\s+-\\s+(${Zn[ei.XRANGEPLAIN]})\\s*$`);vs("HYPHENRANGELOOSE",`^\\s*(${Zn[ei.XRANGEPLAINLOOSE]})\\s+-\\s+(${Zn[ei.XRANGEPLAINLOOSE]})\\s*$`);vs("STAR","(<|>)?=?\\s*\\*");vs("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");vs("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var dot=I((dpl,Kpi)=>{"use strict";var iya=Object.freeze({loose:!0}),oya=Object.freeze({}),sya=t=>t?typeof t!="object"?iya:t:oya;Kpi.exports=sya});var lsr=I((fpl,Zpi)=>{"use strict";var Xpi=/^[0-9]+$/,Jpi=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=Xpi.test(t),n=Xpi.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},aya=(t,e)=>Jpi(e,t);Zpi.exports={compareIdentifiers:Jpi,rcompareIdentifiers:aya}});var C1=I((ppl,thi)=>{"use strict";var fot=m4e(),{MAX_LENGTH:ehi,MAX_SAFE_INTEGER:pot}=g4e(),{safeRe:hot,t:mot}=Tle(),cya=dot(),{compareIdentifiers:usr}=lsr(),dsr=class t{constructor(e,r){if(r=cya(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>ehi)throw new TypeError(`version is longer than ${ehi} characters`);fot("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?hot[mot.LOOSE]:hot[mot.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>pot||this.major<0)throw new TypeError("Invalid major version");if(this.minor>pot||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>pot||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<pot)return s}return o}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(fot("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(fot("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return usr(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(fot("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return usr(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?hot[mot.PRERELEASELOOSE]:hot[mot.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let s=[r,o];n===!1&&(s=[r]),usr(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};thi.exports=dsr});var RW=I((hpl,nhi)=>{"use strict";var rhi=C1(),lya=(t,e,r=!1)=>{if(t instanceof rhi)return t;try{return new rhi(t,e)}catch(n){if(!r)return null;throw n}};nhi.exports=lya});var fsr=I((mpl,ihi)=>{"use strict";var uya=RW(),dya=(t,e)=>{let r=uya(t,e);return r?r.version:null};ihi.exports=dya});var psr=I((gpl,ohi)=>{"use strict";var fya=RW(),pya=(t,e)=>{let r=fya(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};ohi.exports=pya});var hsr=I((Apl,hya)=>{hya.exports=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","W3C","W3C-19980720","W3C-20150513","WTFPL","Watcom-1.0","Widget-Workshop","Wsuipa","X11","X11-distribute-modifications-variant","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"]});var shi=I((ypl,mya)=>{mya.exports=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"]});var ahi=I((_pl,gya)=>{gya.exports=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"]});var lhi=I((Epl,chi)=>{"use strict";var Aya=[].concat(hsr()).concat(shi()),yya=ahi();chi.exports=function(t){var e=0;function r(){return e<t.length}function n(g){if(g instanceof RegExp){var A=t.slice(e),y=A.match(g);if(y)return e+=y[0].length,y[0]}else if(t.indexOf(g,e)===e)return e+=g.length,g}function o(){n(/[ ]*/)}function s(){for(var g,A=["WITH","AND","OR","(",")",":","+"],y=0;y<A.length&&(g=n(A[y]),!g);y++);if(g==="+"&&e>1&&t[e-2]===" ")throw new Error("Space before `+`");return g&&{type:"OPERATOR",string:g}}function a(){return n(/[A-Za-z0-9-.]+/)}function c(){var g=a();if(!g)throw new Error("Expected idstring at offset "+e);return g}function u(){if(n("DocumentRef-")){var g=c();return{type:"DOCUMENTREF",string:g}}}function d(){if(n("LicenseRef-")){var g=c();return{type:"LICENSEREF",string:g}}}function f(){var g=e,A=a();if(Aya.indexOf(A)!==-1)return{type:"LICENSE",string:A};if(yya.indexOf(A)!==-1)return{type:"EXCEPTION",string:A};e=g}function p(){return s()||u()||d()||f()}for(var h=[];r()&&(o(),!!r());){var m=p();if(!m)throw new Error("Unexpected `"+t[e]+"` at offset "+e);h.push(m)}return h}});var dhi=I((vpl,uhi)=>{"use strict";uhi.exports=function(t){var e=0;function r(){return e<t.length}function n(){return r()?t[e]:null}function o(){if(!r())throw new Error;e++}function s(A){var y=n();if(y&&y.type==="OPERATOR"&&A===y.string)return o(),y.string}function a(){if(s("WITH")){var A=n();if(A&&A.type==="EXCEPTION")return o(),A.string;throw new Error("Expected exception after `WITH`")}}function c(){var A=e,y="",E=n();if(E.type==="DOCUMENTREF"&&(o(),y+="DocumentRef-"+E.string+":",!s(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(E=n(),E.type==="LICENSEREF")return o(),y+="LicenseRef-"+E.string,{license:y};e=A}function u(){var A=n();if(A&&A.type==="LICENSE"){o();var y={license:A.string};s("+")&&(y.plus=!0);var E=a();return E&&(y.exception=E),y}}function d(){var A=s("(");if(A){var y=m();if(!s(")"))throw new Error("Expected `)`");return y}}function f(){return d()||c()||u()}function p(A,y){return function E(){var v=y();if(v){if(!s(A))return v;var b=E();if(!b)throw new Error("Expected expression");return{left:v,conjunction:A.toLowerCase(),right:b}}}}var h=p("AND",f),m=p("OR",h),g=m();if(!g||r())throw new Error("Syntax error");return g}});var msr=I((bpl,fhi)=>{"use strict";var _ya=lhi(),Eya=dhi();fhi.exports=function(t){return Eya(_ya(t))}});var vhi=I((Cpl,Ehi)=>{var vya=msr(),bya=hsr();function got(t){try{return vya(t),!0}catch{return!1}}function _hi(t,e){var r=e[0].length-t[0].length;return r!==0?r:t[0].toUpperCase().localeCompare(e[0].toUpperCase())}var phi=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(_hi),Cya=0,Sya=1,hhi=[function(t){return t.toUpperCase()},function(t){return t.trim()},function(t){return t.replace(/\./g,"")},function(t){return t.replace(/\s+/g,"")},function(t){return t.replace(/\s+/g,"-")},function(t){return t.replace("v","-")},function(t){return t.replace(/,?\s*(\d)/,"-$1")},function(t){return t.replace(/,?\s*(\d)/,"-$1.0")},function(t){return t.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(t){return t.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(t){return t[0].toUpperCase()+t.slice(1)},function(t){return t.replace("/","-")},function(t){return t.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(t){return t.indexOf("3.0")!==-1?t+"-or-later":t+"-only"},function(t){return t+"only"},function(t){return t.replace(/(\d)$/,"-$1.0")},function(t){return t.replace(/(-| )?(\d)$/,"-$2-Clause")},function(t){return t.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(t){return t.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(t){return t.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(t){return t.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(t){return t.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(t){return t.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(t){return"CC-"+t},function(t){return"CC-"+t+"-4.0"},function(t){return t.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(t){return"CC-"+t.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],gsr=bya.map(function(t){var e=/^(.*)-\d+\.\d+$/.exec(t);return e?[e[0],e[1]]:[t,null]}).reduce(function(t,e){var r=e[1];return t[r]=t[r]||[],t[r].push(e[0]),t},{}),xya=Object.keys(gsr).map(function(e){return[e,gsr[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!=="APL"}).map(function(e){return[e[0],e[1][0]]});gsr=void 0;var mhi=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(xya).sort(_hi),wya=0,Tya=1,ghi=function(t){for(var e=0;e<hhi.length;e++){var r=hhi[e](t).trim();if(r!==t&&got(r))return r}return null},Ahi=function(t){for(var e=t.toUpperCase(),r=0;r<mhi.length;r++){var n=mhi[r];if(e.indexOf(n[wya])>-1)return n[Tya]}return null},yhi=function(t,e){for(var r=0;r<phi.length;r++){var n=phi[r],o=n[Cya];if(t.indexOf(o)>-1){var s=t.replace(o,n[Sya]),a=e(s);if(a!==null)return a}}return null};Ehi.exports=function(t,e){e=e||{};var r=e.upgrade===void 0?!0:!!e.upgrade;function n(c){return r?Iya(c):c}var o=typeof t=="string"&&t.trim().length!==0;if(!o)throw Error("Invalid argument. Expected non-empty string.");if(t=t.trim(),got(t))return n(t);var s=t.replace(/\+$/,"").trim();if(got(s))return n(s);var a=ghi(t);return a!==null||(a=yhi(t,function(c){return got(c)?c:ghi(c)}),a!==null)||(a=Ahi(t),a!==null)||(a=yhi(t,Ahi),a!==null)?n(a):null};function Iya(t){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(t)!==-1?t+"-only":["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(t)!==-1?t.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(t)!==-1?t+"-or-later":t}});var xhi=I((Spl,Shi)=>{var Dya=msr(),Rya=vhi(),bhi='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',kya=/^SEE LICEN[CS]E IN (.+)$/;function Chi(t,e){return e.slice(0,t.length)===t}function Asr(t){if(t.hasOwnProperty("license")){var e=t.license;return Chi("LicenseRef",e)||Chi("DocumentRef",e)}else return Asr(t.left)||Asr(t.right)}Shi.exports=function(t){var e;try{e=Dya(t)}catch{var r;if(t==="UNLICENSED"||t==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(r=kya.exec(t))return{validForOldPackages:!0,validForNewPackages:!0,inFile:r[1]};var n={validForOldPackages:!1,validForNewPackages:!1,warnings:[bhi]};if(t.trim().length!==0){var o=Rya(t);o&&n.warnings.push('license is similar to the valid expression "'+o+'"')}return n}return Asr(e)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[bhi]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var Rhi=I(yot=>{"use strict";Object.defineProperty(yot,"__esModule",{value:!0});yot.LRUCache=void 0;var Ile=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Thi=new Set,ysr=typeof process=="object"&&process?process:{},Ihi=(t,e,r,n)=>{typeof ysr.emitWarning=="function"?ysr.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)},Aot=globalThis.AbortController,whi=globalThis.AbortSignal;if(typeof Aot>"u"){whi=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,o){this._onabort.push(o)}},Aot=class{constructor(){e()}signal=new whi;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let o of this.signal._onabort)o(n);this.signal.onabort?.(n)}}};let t=ysr.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,Ihi("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var Nya=t=>!Thi.has(t),Tpl=Symbol("type"),UF=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Dhi=t=>UF(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Dle:null:null,Dle=class extends Array{constructor(e){super(e),this.fill(0)}},_sr=class t{heap;length;static#e=!1;static create(e){let r=Dhi(e);if(!r)return[];t.#e=!0;let n=new t(e,r);return t.#e=!1,n}constructor(e,r){if(!t.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Esr=class t{#e;#t;#r;#n;#i;#o;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#a;#s;#u;#l;#p;#g;#h;#m;#v;#A;#C;#S;#E;#b;#x;#y;static unsafeExposeInternals(e){return{starts:e.#S,ttls:e.#E,sizes:e.#C,keyMap:e.#s,keyList:e.#u,valList:e.#l,next:e.#p,prev:e.#g,get head(){return e.#h},get tail(){return e.#m},free:e.#v,isBackgroundFetch:r=>e.#f(r),backgroundFetch:(r,n,o,s)=>e.#U(r,n,o,s),moveToTail:r=>e.#P(r),indexes:r=>e.#w(r),rindexes:r=>e.#T(r),isStale:r=>e.#_(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#a}get size(){return this.#c}get fetchMethod(){return this.#i}get memoMethod(){return this.#o}get dispose(){return this.#r}get disposeAfter(){return this.#n}constructor(e){let{max:r=0,ttl:n,ttlResolution:o=1,ttlAutopurge:s,updateAgeOnGet:a,updateAgeOnHas:c,allowStale:u,dispose:d,disposeAfter:f,noDisposeOnSet:p,noUpdateTTL:h,maxSize:m=0,maxEntrySize:g=0,sizeCalculation:A,fetchMethod:y,memoMethod:E,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:w,ignoreFetchAbort:k}=e;if(r!==0&&!UF(r))throw new TypeError("max option must be a nonnegative integer");let D=r?Dhi(r):Array;if(!D)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=m,this.maxEntrySize=g||this.#t,this.sizeCalculation=A,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(E!==void 0&&typeof E!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#o=E,y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#i=y,this.#x=!!y,this.#s=new Map,this.#u=new Array(r).fill(void 0),this.#l=new Array(r).fill(void 0),this.#p=new D(r),this.#g=new D(r),this.#h=0,this.#m=0,this.#v=_sr.create(r),this.#c=0,this.#a=0,typeof d=="function"&&(this.#r=d),typeof f=="function"?(this.#n=f,this.#A=[]):(this.#n=void 0,this.#A=void 0),this.#b=!!this.#r,this.#y=!!this.#n,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!k,this.maxEntrySize!==0){if(this.#t!==0&&!UF(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!UF(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#N()}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=UF(o)||o===0?o:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!UF(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#R()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let P="LRU_CACHE_UNBOUNDED";Nya(P)&&(Thi.add(P),Ihi("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",P,t))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#R(){let e=new Dle(this.#e),r=new Dle(this.#e);this.#E=e,this.#S=r,this.#M=(s,a,c=Ile.now())=>{if(r[s]=a!==0?c:0,e[s]=a,a!==0&&this.ttlAutopurge){let u=setTimeout(()=>{this.#_(s)&&this.#I(this.#u[s],"expire")},a+1);u.unref&&u.unref()}},this.#D=s=>{r[s]=e[s]!==0?Ile.now():0},this.#d=(s,a)=>{if(e[a]){let c=e[a],u=r[a];if(!c||!u)return;s.ttl=c,s.start=u,s.now=n||o();let d=s.now-u;s.remainingTTL=c-d}};let n=0,o=()=>{let s=Ile.now();if(this.ttlResolution>0){n=s;let a=setTimeout(()=>n=0,this.ttlResolution);a.unref&&a.unref()}return s};this.getRemainingTTL=s=>{let a=this.#s.get(s);if(a===void 0)return 0;let c=e[a],u=r[a];if(!c||!u)return 1/0;let d=(n||o())-u;return c-d},this.#_=s=>{let a=r[s],c=e[s];return!!c&&!!a&&(n||o())-a>c}}#D=()=>{};#d=()=>{};#M=()=>{};#_=()=>!1;#N(){let e=new Dle(this.#e);this.#a=0,this.#C=e,this.#k=r=>{this.#a-=e[r],e[r]=0},this.#F=(r,n,o,s)=>{if(this.#f(n))return 0;if(!UF(o))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(o=s(n,r),!UF(o))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return o},this.#O=(r,n,o)=>{if(e[r]=n,this.#t){let s=this.#t-e[r];for(;this.#a>s;)this.#B(!0)}this.#a+=e[r],o&&(o.entrySize=n,o.totalCalculatedSize=this.#a)}}#k=e=>{};#O=(e,r,n)=>{};#F=(e,r,n,o)=>{if(n||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#w({allowStale:e=this.allowStale}={}){if(this.#c)for(let r=this.#m;!(!this.#L(r)||((e||!this.#_(r))&&(yield r),r===this.#h));)r=this.#g[r]}*#T({allowStale:e=this.allowStale}={}){if(this.#c)for(let r=this.#h;!(!this.#L(r)||((e||!this.#_(r))&&(yield r),r===this.#m));)r=this.#p[r]}#L(e){return e!==void 0&&this.#s.get(this.#u[e])===e}*entries(){for(let e of this.#w())this.#l[e]!==void 0&&this.#u[e]!==void 0&&!this.#f(this.#l[e])&&(yield[this.#u[e],this.#l[e]])}*rentries(){for(let e of this.#T())this.#l[e]!==void 0&&this.#u[e]!==void 0&&!this.#f(this.#l[e])&&(yield[this.#u[e],this.#l[e]])}*keys(){for(let e of this.#w()){let r=this.#u[e];r!==void 0&&!this.#f(this.#l[e])&&(yield r)}}*rkeys(){for(let e of this.#T()){let r=this.#u[e];r!==void 0&&!this.#f(this.#l[e])&&(yield r)}}*values(){for(let e of this.#w())this.#l[e]!==void 0&&!this.#f(this.#l[e])&&(yield this.#l[e])}*rvalues(){for(let e of this.#T())this.#l[e]!==void 0&&!this.#f(this.#l[e])&&(yield this.#l[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#w()){let o=this.#l[n],s=this.#f(o)?o.__staleWhileFetching:o;if(s!==void 0&&e(s,this.#u[n],this))return this.get(this.#u[n],r)}}forEach(e,r=this){for(let n of this.#w()){let o=this.#l[n],s=this.#f(o)?o.__staleWhileFetching:o;s!==void 0&&e.call(r,s,this.#u[n],this)}}rforEach(e,r=this){for(let n of this.#T()){let o=this.#l[n],s=this.#f(o)?o.__staleWhileFetching:o;s!==void 0&&e.call(r,s,this.#u[n],this)}}purgeStale(){let e=!1;for(let r of this.#T({allowStale:!0}))this.#_(r)&&(this.#I(this.#u[r],"expire"),e=!0);return e}info(e){let r=this.#s.get(e);if(r===void 0)return;let n=this.#l[r],o=this.#f(n)?n.__staleWhileFetching:n;if(o===void 0)return;let s={value:o};if(this.#E&&this.#S){let a=this.#E[r],c=this.#S[r];if(a&&c){let u=a-(Ile.now()-c);s.ttl=u,s.start=Date.now()}}return this.#C&&(s.size=this.#C[r]),s}dump(){let e=[];for(let r of this.#w({allowStale:!0})){let n=this.#u[r],o=this.#l[r],s=this.#f(o)?o.__staleWhileFetching:o;if(s===void 0||n===void 0)continue;let a={value:s};if(this.#E&&this.#S){a.ttl=this.#E[r];let c=Ile.now()-this.#S[r];a.start=Math.floor(Date.now()-c)}this.#C&&(a.size=this.#C[r]),e.unshift([n,a])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let o=Date.now()-n.start;n.start=Ile.now()-o}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:o=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:u}=n,{noUpdateTTL:d=this.noUpdateTTL}=n,f=this.#F(e,r,n.size||0,c);if(this.maxEntrySize&&f>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this.#I(e,"set"),this;let p=this.#c===0?void 0:this.#s.get(e);if(p===void 0)p=this.#c===0?this.#m:this.#v.length!==0?this.#v.pop():this.#c===this.#e?this.#B(!1):this.#c,this.#u[p]=e,this.#l[p]=r,this.#s.set(e,p),this.#p[this.#m]=p,this.#g[p]=this.#m,this.#m=p,this.#c++,this.#O(p,f,u),u&&(u.set="add"),d=!1;else{this.#P(p);let h=this.#l[p];if(r!==h){if(this.#x&&this.#f(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=h;m!==void 0&&!a&&(this.#b&&this.#r?.(m,e,"set"),this.#y&&this.#A?.push([m,e,"set"]))}else a||(this.#b&&this.#r?.(h,e,"set"),this.#y&&this.#A?.push([h,e,"set"]));if(this.#k(p),this.#O(p,f,u),this.#l[p]=r,u){u.set="replace";let m=h&&this.#f(h)?h.__staleWhileFetching:h;m!==void 0&&(u.oldValue=m)}}else u&&(u.set="update")}if(o!==0&&!this.#E&&this.#R(),this.#E&&(d||this.#M(p,o,s),u&&this.#d(u,p)),!a&&this.#y&&this.#A){let h=this.#A,m;for(;m=h?.shift();)this.#n?.(...m)}return this}pop(){try{for(;this.#c;){let e=this.#l[this.#h];if(this.#B(!0),this.#f(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#y&&this.#A){let e=this.#A,r;for(;r=e?.shift();)this.#n?.(...r)}}}#B(e){let r=this.#h,n=this.#u[r],o=this.#l[r];return this.#x&&this.#f(o)?o.__abortController.abort(new Error("evicted")):(this.#b||this.#y)&&(this.#b&&this.#r?.(o,n,"evict"),this.#y&&this.#A?.push([o,n,"evict"])),this.#k(r),e&&(this.#u[r]=void 0,this.#l[r]=void 0,this.#v.push(r)),this.#c===1?(this.#h=this.#m=0,this.#v.length=0):this.#h=this.#p[r],this.#s.delete(n),this.#c--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:o}=r,s=this.#s.get(e);if(s!==void 0){let a=this.#l[s];if(this.#f(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#_(s))o&&(o.has="stale",this.#d(o,s));else return n&&this.#D(s),o&&(o.has="hit",this.#d(o,s)),!0}else o&&(o.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,o=this.#s.get(e);if(o===void 0||!n&&this.#_(o))return;let s=this.#l[o];return this.#f(s)?s.__staleWhileFetching:s}#U(e,r,n,o){let s=r===void 0?void 0:this.#l[r];if(this.#f(s))return s;let a=new Aot,{signal:c}=n;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let u={signal:a.signal,options:n,context:o},d=(A,y=!1)=>{let{aborted:E}=a.signal,v=n.ignoreFetchAbort&&A!==void 0;if(n.status&&(E&&!y?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,v&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),E&&!v&&!y)return p(a.signal.reason);let b=m;return this.#l[r]===m&&(A===void 0?b.__staleWhileFetching?this.#l[r]=b.__staleWhileFetching:this.#I(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,A,u.options))),A},f=A=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=A),p(A)),p=A=>{let{aborted:y}=a.signal,E=y&&n.allowStaleOnFetchAbort,v=E||n.allowStaleOnFetchRejection,b=v||n.noDeleteOnFetchRejection,S=m;if(this.#l[r]===m&&(!b||S.__staleWhileFetching===void 0?this.#I(e,"fetch"):E||(this.#l[r]=S.__staleWhileFetching)),v)return n.status&&S.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw A},h=(A,y)=>{let E=this.#i?.(e,s,u);E&&E instanceof Promise&&E.then(v=>A(v===void 0?void 0:v),y),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(A(void 0),n.allowStaleOnFetchAbort&&(A=v=>d(v,!0)))})};n.status&&(n.status.fetchDispatched=!0);let m=new Promise(h).then(d,f),g=Object.assign(m,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.set(e,g,{...u.options,status:void 0}),r=this.#s.get(e)):this.#l[r]=g,g}#f(e){if(!this.#x)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof Aot}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:u=0,sizeCalculation:d=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:A,forceRefresh:y=!1,status:E,signal:v}=r;if(!this.#x)return E&&(E.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:o,noDeleteOnStaleGet:s,status:E});let b={allowStale:n,updateAgeOnGet:o,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:c,size:u,sizeCalculation:d,noUpdateTTL:f,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:g,ignoreFetchAbort:m,status:E,signal:v},S=this.#s.get(e);if(S===void 0){E&&(E.fetch="miss");let w=this.#U(e,S,b,A);return w.__returned=w}else{let w=this.#l[S];if(this.#f(w)){let N=n&&w.__staleWhileFetching!==void 0;return E&&(E.fetch="inflight",N&&(E.returnedStale=!0)),N?w.__staleWhileFetching:w.__returned=w}let k=this.#_(S);if(!y&&!k)return E&&(E.fetch="hit"),this.#P(S),o&&this.#D(S),E&&this.#d(E,S),w;let D=this.#U(e,S,b,A),T=D.__staleWhileFetching!==void 0&&n;return E&&(E.fetch=k?"stale":"refresh",T&&k&&(E.returnedStale=!0)),T?D.__staleWhileFetching:D.__returned=D}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#o;if(!n)throw new Error("no memoMethod provided to constructor");let{context:o,forceRefresh:s,...a}=r,c=this.get(e,a);if(!s&&c!==void 0)return c;let u=n(e,c,{options:a,context:o});return this.set(e,u,a),u}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:a}=r,c=this.#s.get(e);if(c!==void 0){let u=this.#l[c],d=this.#f(u);return a&&this.#d(a,c),this.#_(c)?(a&&(a.get="stale"),d?(a&&n&&u.__staleWhileFetching!==void 0&&(a.returnedStale=!0),n?u.__staleWhileFetching:void 0):(s||this.#I(e,"expire"),a&&n&&(a.returnedStale=!0),n?u:void 0)):(a&&(a.get="hit"),d?u.__staleWhileFetching:(this.#P(c),o&&this.#D(c),u))}else a&&(a.get="miss")}#Q(e,r){this.#g[r]=e,this.#p[e]=r}#P(e){e!==this.#m&&(e===this.#h?this.#h=this.#p[e]:this.#Q(this.#g[e],this.#p[e]),this.#Q(this.#m,e),this.#m=e)}delete(e){return this.#I(e,"delete")}#I(e,r){let n=!1;if(this.#c!==0){let o=this.#s.get(e);if(o!==void 0)if(n=!0,this.#c===1)this.#j(r);else{this.#k(o);let s=this.#l[o];if(this.#f(s)?s.__abortController.abort(new Error("deleted")):(this.#b||this.#y)&&(this.#b&&this.#r?.(s,e,r),this.#y&&this.#A?.push([s,e,r])),this.#s.delete(e),this.#u[o]=void 0,this.#l[o]=void 0,o===this.#m)this.#m=this.#g[o];else if(o===this.#h)this.#h=this.#p[o];else{let a=this.#g[o];this.#p[a]=this.#p[o];let c=this.#p[o];this.#g[c]=this.#g[o]}this.#c--,this.#v.push(o)}}if(this.#y&&this.#A?.length){let o=this.#A,s;for(;s=o?.shift();)this.#n?.(...s)}return n}clear(){return this.#j("delete")}#j(e){for(let r of this.#T({allowStale:!0})){let n=this.#l[r];if(this.#f(n))n.__abortController.abort(new Error("deleted"));else{let o=this.#u[r];this.#b&&this.#r?.(n,o,e),this.#y&&this.#A?.push([n,o,e])}}if(this.#s.clear(),this.#l.fill(void 0),this.#u.fill(void 0),this.#E&&this.#S&&(this.#E.fill(0),this.#S.fill(0)),this.#C&&this.#C.fill(0),this.#h=0,this.#m=0,this.#v.length=0,this.#a=0,this.#c=0,this.#y&&this.#A){let r=this.#A,n;for(;n=r?.shift();)this.#n?.(...n)}}};yot.LRUCache=Esr});var Ohi=I((Dpl,Nhi)=>{"use strict";var Qc=(...t)=>t.every(e=>e)?t.join(""):"",cm=t=>t?encodeURIComponent(t):"",khi=t=>t.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),Oya={sshtemplate:({domain:t,user:e,project:r,committish:n})=>`git@${t}:${e}/${r}.git${Qc("#",n)}`,sshurltemplate:({domain:t,user:e,project:r,committish:n})=>`git+ssh://git@${t}/${e}/${r}.git${Qc("#",n)}`,edittemplate:({domain:t,user:e,project:r,committish:n,editpath:o,path:s})=>`https://${t}/${e}/${r}${Qc("/",o,"/",cm(n||"HEAD"),"/",s)}`,browsetemplate:({domain:t,user:e,project:r,committish:n,treepath:o})=>`https://${t}/${e}/${r}${Qc("/",o,"/",cm(n))}`,browsetreetemplate:({domain:t,user:e,project:r,committish:n,treepath:o,path:s,fragment:a,hashformat:c})=>`https://${t}/${e}/${r}/${o}/${cm(n||"HEAD")}/${s}${Qc("#",c(a||""))}`,browseblobtemplate:({domain:t,user:e,project:r,committish:n,blobpath:o,path:s,fragment:a,hashformat:c})=>`https://${t}/${e}/${r}/${o}/${cm(n||"HEAD")}/${s}${Qc("#",c(a||""))}`,docstemplate:({domain:t,user:e,project:r,treepath:n,committish:o})=>`https://${t}/${e}/${r}${Qc("/",n,"/",cm(o))}#readme`,httpstemplate:({auth:t,domain:e,user:r,project:n,committish:o})=>`git+https://${Qc(t,"@")}${e}/${r}/${n}.git${Qc("#",o)}`,filetemplate:({domain:t,user:e,project:r,committish:n,path:o})=>`https://${t}/${e}/${r}/raw/${cm(n||"HEAD")}/${o}`,shortcuttemplate:({type:t,user:e,project:r,committish:n})=>`${t}:${e}/${r}${Qc("#",n)}`,pathtemplate:({user:t,project:e,committish:r})=>`${t}/${e}${Qc("#",r)}`,bugstemplate:({domain:t,user:e,project:r})=>`https://${t}/${e}/${r}/issues`,hashformat:khi},QF={};QF.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:t,user:e,project:r,committish:n,path:o})=>`https://${Qc(t,"@")}raw.githubusercontent.com/${e}/${r}/${cm(n||"HEAD")}/${o}`,gittemplate:({auth:t,domain:e,user:r,project:n,committish:o})=>`git://${Qc(t,"@")}${e}/${r}/${n}.git${Qc("#",o)}`,tarballtemplate:({domain:t,user:e,project:r,committish:n})=>`https://codeload.${t}/${e}/${r}/tar.gz/${cm(n||"HEAD")}`,extract:t=>{let[,e,r,n,o]=t.pathname.split("/",5);if(!(n&&n!=="tree")&&(n||(o=t.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:o}}};QF.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:t,user:e,project:r,committish:n,treepath:o,path:s,editpath:a})=>`https://${t}/${e}/${r}${Qc("/",o,"/",cm(n||"HEAD"),"/",s,a)}`,tarballtemplate:({domain:t,user:e,project:r,committish:n})=>`https://${t}/${e}/${r}/get/${cm(n||"HEAD")}.tar.gz`,extract:t=>{let[,e,r,n]=t.pathname.split("/",4);if(!["get"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:t.hash.slice(1)}}};QF.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:t,domain:e,user:r,project:n,committish:o})=>`git+https://${Qc(t,"@")}${e}/${r}/${n}.git${Qc("#",o)}`,tarballtemplate:({domain:t,user:e,project:r,committish:n})=>`https://${t}/${e}/${r}/repository/archive.tar.gz?ref=${cm(n||"HEAD")}`,extract:t=>{let e=t.pathname.slice(1);if(e.includes("/-/")||e.includes("/archive.tar.gz"))return;let r=e.split("/"),n=r.pop();n.endsWith(".git")&&(n=n.slice(0,-4));let o=r.join("/");if(!(!o||!n))return{user:o,project:n,committish:t.hash.slice(1)}}};QF.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:t,project:e,committish:r})=>`git@${t}:${e}.git${Qc("#",r)}`,sshurltemplate:({domain:t,project:e,committish:r})=>`git+ssh://git@${t}/${e}.git${Qc("#",r)}`,edittemplate:({domain:t,user:e,project:r,committish:n,editpath:o})=>`https://${t}/${e}/${r}${Qc("/",cm(n))}/${o}`,browsetemplate:({domain:t,project:e,committish:r})=>`https://${t}/${e}${Qc("/",cm(r))}`,browsetreetemplate:({domain:t,project:e,committish:r,path:n,hashformat:o})=>`https://${t}/${e}${Qc("/",cm(r))}${Qc("#",o(n))}`,browseblobtemplate:({domain:t,project:e,committish:r,path:n,hashformat:o})=>`https://${t}/${e}${Qc("/",cm(r))}${Qc("#",o(n))}`,docstemplate:({domain:t,project:e,committish:r})=>`https://${t}/${e}${Qc("/",cm(r))}`,httpstemplate:({domain:t,project:e,committish:r})=>`git+https://${t}/${e}.git${Qc("#",r)}`,filetemplate:({user:t,project:e,committish:r,path:n})=>`https://gist.githubusercontent.com/${t}/${e}/raw${Qc("/",cm(r))}/${n}`,shortcuttemplate:({type:t,project:e,committish:r})=>`${t}:${e}${Qc("#",r)}`,pathtemplate:({project:t,committish:e})=>`${t}${Qc("#",e)}`,bugstemplate:({domain:t,project:e})=>`https://${t}/${e}`,gittemplate:({domain:t,project:e,committish:r})=>`git://${t}/${e}.git${Qc("#",r)}`,tarballtemplate:({project:t,committish:e})=>`https://codeload.github.com/gist/${t}/tar.gz/${cm(e||"HEAD")}`,extract:t=>{let[,e,r,n]=t.pathname.split("/",4);if(n!=="raw"){if(!r){if(!e)return;r=e,e=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:e,project:r,committish:t.hash.slice(1)}}},hashformat:function(t){return t&&"file-"+khi(t)}};QF.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:t,user:e,project:r,committish:n,path:o})=>`https://${t}/${e}/${r}/blob/${cm(n)||"HEAD"}/${o}`,httpstemplate:({domain:t,user:e,project:r,committish:n})=>`https://${t}/${e}/${r}.git${Qc("#",n)}`,tarballtemplate:({domain:t,user:e,project:r,committish:n})=>`https://${t}/${e}/${r}/archive/${cm(n)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:t=>{let[,e,r,n]=t.pathname.split("/",4);if(!["archive"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:t.hash.slice(1)}}};for(let[t,e]of Object.entries(QF))QF[t]=Object.assign({},Oya,e);Nhi.exports=QF});var bsr=I((Rpl,Phi)=>{var Bya=_e("url"),vsr=(t,e,r)=>{let n=t.indexOf(r);return t.lastIndexOf(e,n>-1?n:1/0)},Bhi=t=>{try{return new Bya.URL(t)}catch{}},Pya=(t,e)=>{let r=t.indexOf(":"),n=t.slice(0,r+1);if(Object.prototype.hasOwnProperty.call(e,n))return t;let o=t.indexOf("@");return o>-1?o>r?`git+ssh://${t}`:t:t.indexOf("//")===r+1?t:`${t.slice(0,r+1)}//${t.slice(r+1)}`},Mya=t=>{let e=vsr(t,"@","#"),r=vsr(t,":","#");return r>e&&(t=t.slice(0,r)+"/"+t.slice(r+1)),vsr(t,":","#")===-1&&t.indexOf("//")===-1&&(t=`git+ssh://${t}`),t};Phi.exports=(t,e)=>{let r=e?Pya(t,e):t;return Bhi(r)||Bhi(Mya(r))}});var Fhi=I((kpl,Mhi)=>{"use strict";var Fya=bsr(),Lya=t=>{let e=t.indexOf("#"),r=t.indexOf("/"),n=t.indexOf("/",r+1),o=t.indexOf(":"),s=/\s/.exec(t),a=t.indexOf("@"),c=!s||e>-1&&s.index>e,u=a===-1||e>-1&&a>e,d=o===-1||e>-1&&o>e,f=n===-1||e>-1&&n>e,p=r>0,h=e>-1?t[e-1]!=="/":!t.endsWith("/"),m=!t.startsWith(".");return c&&p&&h&&m&&u&&d&&f};Mhi.exports=(t,e,{gitHosts:r,protocols:n})=>{if(!t)return;let o=Lya(t)?`github:${t}`:t,s=Fya(o,n);if(!s)return;let a=r.byShortcut[s.protocol],c=r.byDomain[s.hostname.startsWith("www.")?s.hostname.slice(4):s.hostname],u=a||c;if(!u)return;let d=r[a||c],f=null;n[s.protocol]?.auth&&(s.username||s.password)&&(f=`${s.username}${s.password?":"+s.password:""}`);let p=null,h=null,m=null,g=null;try{if(a){let A=s.pathname.startsWith("/")?s.pathname.slice(1):s.pathname,y=A.indexOf("@");y>-1&&(A=A.slice(y+1));let E=A.lastIndexOf("/");E>-1?(h=decodeURIComponent(A.slice(0,E)),h||(h=null),m=decodeURIComponent(A.slice(E+1))):m=decodeURIComponent(A),m.endsWith(".git")&&(m=m.slice(0,-4)),s.hash&&(p=decodeURIComponent(s.hash.slice(1))),g="shortcut"}else{if(!d.protocols.includes(s.protocol))return;let A=d.extract(s);if(!A)return;h=A.user&&decodeURIComponent(A.user),m=decodeURIComponent(A.project),p=decodeURIComponent(A.committish),g=n[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(A){if(A instanceof URIError)return;throw A}return[u,h,f,m,p,g,e]}});var Uhi=I((Npl,Lhi)=>{"use strict";var{LRUCache:Uya}=Rhi(),Qya=Ohi(),jya=Fhi(),$ya=bsr(),Csr=new Uya({max:1e3}),_ot=class t{constructor(e,r,n,o,s,a,c={}){Object.assign(this,t.#e[e],{type:e,user:r,auth:n,project:o,committish:s,default:a,opts:c})}static#e={byShortcut:{},byDomain:{}};static#t={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(e,r){t.#e[e]=r,t.#e.byDomain[r.domain]=e,t.#e.byShortcut[`${e}:`]=e,t.#t[`${e}:`]={name:e}}static fromUrl(e,r){if(typeof e!="string")return;let n=e+JSON.stringify(r||{});if(!Csr.has(n)){let o=jya(e,r,{gitHosts:t.#e,protocols:t.#t});Csr.set(n,o?new t(...o):void 0)}return Csr.get(n)}static parseUrl(e){return $ya(e)}#r(e,r){if(typeof e!="function")return null;let n={...this,...this.opts,...r};n.path||(n.path=""),n.path.startsWith("/")&&(n.path=n.path.slice(1)),n.noCommittish&&(n.committish=null);let o=e(n);return n.noGitPlus&&o.startsWith("git+")?o.slice(4):o}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#r(this.sshtemplate,e)}sshurl(e){return this.#r(this.sshurltemplate,e)}browse(e,...r){return typeof e!="string"?this.#r(this.browsetemplate,e):typeof r[0]!="string"?this.#r(this.browsetreetemplate,{...r[0],path:e}):this.#r(this.browsetreetemplate,{...r[1],fragment:r[0],path:e})}browseFile(e,...r){return typeof r[0]!="string"?this.#r(this.browseblobtemplate,{...r[0],path:e}):this.#r(this.browseblobtemplate,{...r[1],fragment:r[0],path:e})}docs(e){return this.#r(this.docstemplate,e)}bugs(e){return this.#r(this.bugstemplate,e)}https(e){return this.#r(this.httpstemplate,e)}git(e){return this.#r(this.gittemplate,e)}shortcut(e){return this.#r(this.shortcuttemplate,e)}path(e){return this.#r(this.pathtemplate,e)}tarball(e){return this.#r(this.tarballtemplate,{...e,noCommittish:!1})}file(e,r){return this.#r(this.filetemplate,{...r,path:e})}edit(e,r){return this.#r(this.edittemplate,{...r,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&typeof this[this.default]=="function"?this[this.default](e):this.sshurl(e)}};for(let[t,e]of Object.entries(Qya))_ot.addHost(t,e);Lhi.exports=_ot});var jhi=I((Opl,Qhi)=>{Qhi.exports=Gya;function Gya(t){if(!t||t==="ERROR: No README data found!")return;t=t.trim().split(`
5209
- `);let e=0;for(;t[e]&&t[e].trim().match(/^(#|$)/);)e++;let r=t.length,n=e+1;for(;n<r&&t[n].trim();)n++;return t.slice(e,n).join(" ").trim()}});var $hi=I((Bpl,qya)=>{qya.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var Vhi=I((Ppl,Hhi)=>{var Hya=fsr(),Vya=psr(),Wya=xhi(),Eot=Uhi(),zya=_e("node:module"),Yya=["dependencies","devDependencies","optionalDependencies"],Kya=jhi(),Ssr=_e("url"),jF=$hi(),Ghi=t=>t.includes("@")&&t.indexOf("@")<t.lastIndexOf(".");Hhi.exports={warn:function(){},fixRepositoryField:function(t){if(t.repositories&&(this.warn("repositories"),t.repository=t.repositories[0]),!t.repository)return this.warn("missingRepository");typeof t.repository=="string"&&(t.repository={type:"git",url:t.repository});var e=t.repository.url||"";if(e){var r=Eot.fromUrl(e);r&&(e=t.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(t){Object.keys(jF.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(t,e)&&this.warn("typo",e,jF.topLevel[e])},this)},fixScriptsField:function(t){if(t.scripts){if(typeof t.scripts!="object"){this.warn("nonObjectScripts"),delete t.scripts;return}Object.keys(t.scripts).forEach(function(e){typeof t.scripts[e]!="string"?(this.warn("nonStringScript"),delete t.scripts[e]):jF.script[e]&&!t.scripts[jF.script[e]]&&this.warn("typo",e,jF.script[e],"scripts")},this)}},fixFilesField:function(t){var e=t.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete t.files):t.files&&(t.files=t.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(t){if(t.bin&&typeof t.bin=="string"){var e={},r;(r=t.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=t.bin:e[t.name]=t.bin,t.bin=e}},fixManField:function(t){t.man&&typeof t.man=="string"&&(t.man=[t.man])},fixBundleDependenciesField:function(t){var e="bundledDependencies",r="bundleDependencies";t[e]&&!t[r]&&(t[r]=t[e],delete t[e]),t[r]&&!Array.isArray(t[r])?(this.warn("nonArrayBundleDependencies"),delete t[r]):t[r]&&(t[r]=t[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(t.dependencies||(t.dependencies={}),Object.prototype.hasOwnProperty.call(t.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),t.dependencies[n]="*"),!0)},this))},fixDependencies:function(t){i_a(t,this.warn),r_a(t,this.warn),this.fixBundleDependenciesField(t),["dependencies","devDependencies"].forEach(function(e){if(e in t){if(!t[e]||typeof t[e]!="object"){this.warn("nonObjectDependencies",e),delete t[e];return}Object.keys(t[e]).forEach(function(r){var n=t[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete t[e][r]);var o=Eot.fromUrl(t[e][r]);o&&(t[e][r]=o.toString())},this)}},this)},fixModulesField:function(t){t.modules&&(this.warn("deprecatedModules"),delete t.modules)},fixKeywordsField:function(t){typeof t.keywords=="string"&&(t.keywords=t.keywords.split(/,\s+/)),t.keywords&&!Array.isArray(t.keywords)?(delete t.keywords,this.warn("nonArrayKeywords")):t.keywords&&(t.keywords=t.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(t,e){var r=!e;if(!t.version)return t.version="",!0;if(!Hya(t.version,r))throw new Error('Invalid version: "'+t.version+'"');return t.version=Vya(t.version,r),!0},fixPeople:function(t){qhi(t,e_a),qhi(t,t_a)},fixNameField:function(t,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!t.name&&!r){t.name="";return}if(typeof t.name!="string")throw new Error("name field must be a string.");r||(t.name=t.name.trim()),Zya(t.name,r,e.allowLegacyCase),zya.builtinModules.includes(t.name)&&this.warn("conflictingName",t.name)},fixDescriptionField:function(t){t.description&&typeof t.description!="string"&&(this.warn("nonStringDescription"),delete t.description),t.readme&&!t.description&&(t.description=Kya(t.readme)),t.description===void 0&&delete t.description,t.description||this.warn("missingDescription")},fixReadmeField:function(t){t.readme||(this.warn("missingReadme"),t.readme="ERROR: No README data found!")},fixBugsField:function(t){if(!t.bugs&&t.repository&&t.repository.url){var e=Eot.fromUrl(t.repository.url);e&&e.bugs()&&(t.bugs={url:e.bugs()})}else if(t.bugs){if(typeof t.bugs=="string")Ghi(t.bugs)?t.bugs={email:t.bugs}:Ssr.parse(t.bugs).protocol?t.bugs={url:t.bugs}:this.warn("nonEmailUrlBugsString");else{o_a(t.bugs,this.warn);var r=t.bugs;t.bugs={},r.url&&(typeof r.url=="string"&&Ssr.parse(r.url).protocol?t.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&Ghi(r.email)?t.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!t.bugs.email&&!t.bugs.url&&(delete t.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(t){if(!t.homepage&&t.repository&&t.repository.url){var e=Eot.fromUrl(t.repository.url);e&&e.docs()&&(t.homepage=e.docs())}if(t.homepage){if(typeof t.homepage!="string")return this.warn("nonUrlHomepage"),delete t.homepage;Ssr.parse(t.homepage).protocol||(t.homepage="http://"+t.homepage)}},fixLicenseField:function(t){let e=t.license||t.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Wya(e).validForNewPackages)return this.warn("invalidLicense")}};function Xya(t){if(t.charAt(0)!=="@")return!1;var e=t.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function Jya(t){return!t.match(/[/@\s+%:]/)&&t===encodeURIComponent(t)}function Zya(t,e,r){if(t.charAt(0)==="."||!(Xya(t)||Jya(t))||e&&!r&&t!==t.toLowerCase()||t.toLowerCase()==="node_modules"||t.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(t))}function qhi(t,e){return t.author&&(t.author=e(t.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(t[r])&&(t[r]=t[r].map(e))}),t}function e_a(t){if(typeof t=="string")return t;var e=t.name||"",r=t.url||t.web,n=r?" ("+r+")":"",o=t.email||t.mail,s=o?" <"+o+">":"";return e+s+n}function t_a(t){if(typeof t!="string")return t;var e=t.match(/^([^(<]+)/),r=t.match(/\(([^()]+)\)/),n=t.match(/<([^<>]+)>/),o={};return e&&e[0].trim()&&(o.name=e[0].trim()),n&&(o.email=n[1]),r&&(o.url=r[1]),o}function r_a(t){var e=t.optionalDependencies;if(e){var r=t.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),t.dependencies=r}}function n_a(t,e,r){if(!t)return{};if(typeof t=="string"&&(t=t.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(t))return t;r("deprecatedArrayDependencies",e);var n={};return t.filter(function(o){return typeof o=="string"}).forEach(function(o){o=o.trim().split(/(:?[@\s><=])/);var s=o.shift(),a=o.join("");a=a.trim(),a=a.replace(/^@/,""),n[s]=a}),n}function i_a(t,e){Yya.forEach(function(r){t[r]&&(t[r]=n_a(t[r],r,e))})}function o_a(t,e){t&&Object.keys(t).forEach(function(r){jF.bugs[r]&&(e("typo",r,jF.bugs[r],"bugs"),t[jF.bugs[r]]=t[r],delete t[r])})}});var Whi=I((Mpl,s_a)=>{s_a.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var Khi=I((Fpl,Yhi)=>{var zhi=_e("util"),xsr=Whi();Yhi.exports=function(){var t=Array.prototype.slice.call(arguments,0),e=t.shift();if(e==="typo")return a_a.apply(null,t);var r=xsr[e]?xsr[e]:e+": '%s'";return t.unshift(r),zhi.format.apply(null,t)};function a_a(t,e,r){return r&&(t=r+"['"+t+"']",e=r+"['"+e+"']"),zhi.format(xsr.typo,t,e)}});var emi=I((Lpl,Zhi)=>{Zhi.exports=Xhi;var wsr=Vhi();Xhi.fixer=wsr;var c_a=Khi(),l_a=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],u_a=["dependencies","people","typos"],Tsr=l_a.map(function(t){return Jhi(t)+"Field"});Tsr=Tsr.concat(u_a);function Xhi(t,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||t.private)&&(e=function(){}),t.scripts&&t.scripts.install==="node-gyp rebuild"&&!t.scripts.preinstall&&(t.gypfile=!0),wsr.warn=function(){e(c_a.apply(null,arguments))},Tsr.forEach(function(n){wsr["fix"+Jhi(n)](t,r)}),t._id=t.name+"@"+t.version}function Jhi(t){return t.charAt(0).toUpperCase()+t.slice(1)}});var tmi=q(()=>{});import{fileURLToPath as d_a}from"node:url";function rmi(t){return t instanceof URL?d_a(t):t}var nmi=q(()=>{tmi()});import f_a from"node:fs/promises";import p_a from"node:path";async function omi({cwd:t,normalize:e=!0}={}){let r=await f_a.readFile(h_a(t),"utf8");return m_a(r,e)}var imi,h_a,m_a,smi=q(()=>{Vpi();imi=we(emi(),1);nmi();h_a=t=>p_a.resolve(rmi(t)??".","package.json"),m_a=(t,e)=>{let r=typeof t=="string"?ssr(t):t;return e&&(0,imi.default)(r),r}});import g_a from"node:path";async function ami(t){let e=await ypi("package.json",t);if(e)return{packageJson:await omi({...t,cwd:g_a.dirname(e)}),path:e}}var cmi=q(()=>{_pi();smi()});import{fileURLToPath as A_a}from"url";import y_a from"path";async function $F(){if(vot)return vot;let t=await ami({cwd:E_a});if(t)return vot=t.packageJson,vot}var __a,E_a,vot,A4e=q(()=>{"use strict";cmi();__a=A_a(import.meta.url),E_a=y_a.dirname(__a)});async function GF(){let t=await $F();return"0.4.9"}var y4e=q(()=>{"use strict";A4e();});var hmi=I((shl,Rsr)=>{"use strict";var umi=_e("child_process").exec,dmi=_e("child_process").execSync,bot=_e("fs"),lmi=_e("path"),fmi=bot.access,pmi=bot.accessSync,Rle=bot.constants||bot,Isr=process.platform=="win32",v_a=function(t,e){fmi(t,Rle.F_OK,function(r){e(!r)})},b_a=function(t){try{return pmi(t,Rle.F_OK),!1}catch{return!0}},C_a=function(t,e){fmi(t,Rle.F_OK|Rle.X_OK,function(r){e(null,!r)})},S_a=function(t){try{return pmi(t,Rle.F_OK|Rle.X_OK),!0}catch{return!1}},x_a=function(t,e,r){v_a(t,function(n){if(!n){var o=umi("command -v "+e+" 2>/dev/null && { echo >&1 "+e+"; exit 0; }",function(s,a,c){r(null,!!a)});return}C_a(t,r)})},w_a=function(t,e,r){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(t)){r(null,!1);return}var n=umi("where "+e,function(o){o!==null?r(null,!1):r(null,!0)})},T_a=function(t,e){if(b_a(t))try{var r=dmi("command -v "+e+" 2>/dev/null && { echo >&1 "+e+"; exit 0; }");return!!r}catch{return!1}return S_a(t)},I_a=function(t,e,r){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(t))return!1;try{var n=dmi("where "+e,{stdio:[]});return!!n}catch{return!1}},Dsr=function(t){return/[^A-Za-z0-9_\/:=-]/.test(t)&&(t="'"+t.replace(/'/g,"'\\''")+"'",t=t.replace(/^(?:'')+/g,"").replace(/\\'''/g,"\\'")),t};Isr&&(Dsr=function(t){var e=/[\\]/.test(t);if(e){var r='"'+lmi.dirname(t)+'"',n='"'+lmi.basename(t)+'"';return r+":"+n}return'"'+t+'"'});Rsr.exports=function t(e,r){var n=Dsr(e);if(!r&&typeof Promise<"u")return new Promise(function(o,s){t(e,function(a,c){c?o(e):s(a)})});Isr?w_a(e,n,r):x_a(e,n,r)};Rsr.exports.sync=function(t){var e=Dsr(t);return Isr?I_a(t,e):T_a(t,e)}});var gmi=I((ahl,mmi)=>{mmi.exports=hmi()});import Osr from"fs/promises";import Bsr from"path";import J_a from"os";function eEa(t,e){if(t==="global")return Bsr.join(J_a.homedir(),".iflow","commands");{let r=e||process.cwd();return Bsr.join(r,".iflow","commands")}}function Dmi(t){return t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function rEa(t,e){let{scope:r}=e;if(r!=="project"&&r!=="global"){console.error(R.t("commandsAdd.invalidScope",{scope:r}));return}let o=tl(process.cwd()).merged.apiKey;if(!o){console.error(R.t("commandsAdd.apiKeyNotFound")),console.error(R.t("commandsAdd.pleaseAuthenticateFirst"));return}console.log(R.t("commandsAdd.searchingCommand",{nameOrId:t}));try{let s=null;if(/^\d+$/.test(t)){let u=parseInt(t,10);s=await Z_a(o,u)}if(!s){let u=await Imi(o,1,1e3,t,"public");if(!u.success){console.error(`Error: ${u.message}`);return}s=u.commands?.find(d=>d.name.toLowerCase()===t.toLowerCase())||null}if(!s){let u=await Imi(o,1,1e3,t,"private");if(!u.success){console.error(`Error: ${u.message}`);return}s=u.commands?.find(d=>d.name.toLowerCase()===t.toLowerCase())||null}if(!s){console.error(R.t("commandsAdd.commandNotFound",{nameOrId:t}));return}console.log(R.t("commandsAdd.foundCommand",{name:s.name})),console.log(R.t("commandsAdd.commandDescription",{description:s.description})),console.log(R.t("commandsAdd.commandCategory",{category:s.category})),console.log(R.t("commandsAdd.installingToScope",{scope:r}));let a=process.cwd(),c=await tEa(s,r,a);c.success?(console.log(c.message),console.log(""),console.log(R.t("commandsAdd.restartRequired"))):console.error(c.message)}catch(s){console.error(R.t("commandsAdd.errorAddingCommand",{error:s}))}}var Imi,Z_a,tEa,Rmi,kmi=q(()=>{"use strict";Tl();qt();Imi=async(t,e=1,r=20,n,o)=>{try{if(!t)return{success:!1,message:R.t("commandsAdd.pleaseAuthenticate")};let s={page:e,size:r,usePage:!0,visibility:o};n&&(s.name=n);let a={"User-Agent":"iFlow-Cli","Content-Type":"application/json"};o==="private"&&(a.Authorization=`Bearer ${t}`);let c=await fetch("https://apis.iflow.cn/v1/commands/list",{method:"POST",headers:a,body:JSON.stringify(s)});if(!c.ok){let f=R.t("commandsAdd.unableToLoadCommands");return c.status===401?f=R.t("commandsAdd.authenticationFailed"):c.status===403?f=R.t("commandsAdd.accessDenied"):c.status===404?f=R.t("commandsAdd.serviceNotFound"):c.status>=500&&(f=R.t("commandsAdd.serverError")),{success:!1,message:f}}let u=await c.json();return u.success?{success:!0,commands:Array.isArray(u.data.data)?u.data.data:[],total:u.data.total||0}:{success:!1,message:u.message||R.t("commandsAdd.failedToLoadFromServer")}}catch(s){let a=R.t("commandsAdd.connectionError");return s instanceof Error&&s.message.includes("Failed to fetch")&&(a=R.t("commandsAdd.networkError")),{success:!1,message:a}}},Z_a=async(t,e)=>{try{let r=await fetch(`https://apis.iflow.cn/v1/commands/get/${e}`,{headers:{Authorization:`Bearer ${t}`}});if(!r.ok)throw new Error(`HTTP ${r.status}: ${r.statusText}`);let n=await r.json();if(!n.success)throw new Error(n.message||R.t("commandsAdd.failedToFetchDetails"));return n.data||null}catch(r){return console.error(R.t("commandsAdd.failedToFetchDetails"),r),null}};tEa=async(t,e,r)=>{try{let n=eEa(e,r);await Osr.mkdir(n,{recursive:!0});let o=`${Dmi(t.name)}.toml`,s=Bsr.join(n,o);try{return await Osr.access(s),{success:!1,message:R.t("commandsAdd.alreadyInstalled",{commandName:t.name,scope:e})}}catch{}let a=`# Command: ${t.name}
5209
+ `);let e=0;for(;t[e]&&t[e].trim().match(/^(#|$)/);)e++;let r=t.length,n=e+1;for(;n<r&&t[n].trim();)n++;return t.slice(e,n).join(" ").trim()}});var $hi=I((Bpl,qya)=>{qya.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var Vhi=I((Ppl,Hhi)=>{var Hya=fsr(),Vya=psr(),Wya=xhi(),Eot=Uhi(),zya=_e("node:module"),Yya=["dependencies","devDependencies","optionalDependencies"],Kya=jhi(),Ssr=_e("url"),jF=$hi(),Ghi=t=>t.includes("@")&&t.indexOf("@")<t.lastIndexOf(".");Hhi.exports={warn:function(){},fixRepositoryField:function(t){if(t.repositories&&(this.warn("repositories"),t.repository=t.repositories[0]),!t.repository)return this.warn("missingRepository");typeof t.repository=="string"&&(t.repository={type:"git",url:t.repository});var e=t.repository.url||"";if(e){var r=Eot.fromUrl(e);r&&(e=t.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(t){Object.keys(jF.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(t,e)&&this.warn("typo",e,jF.topLevel[e])},this)},fixScriptsField:function(t){if(t.scripts){if(typeof t.scripts!="object"){this.warn("nonObjectScripts"),delete t.scripts;return}Object.keys(t.scripts).forEach(function(e){typeof t.scripts[e]!="string"?(this.warn("nonStringScript"),delete t.scripts[e]):jF.script[e]&&!t.scripts[jF.script[e]]&&this.warn("typo",e,jF.script[e],"scripts")},this)}},fixFilesField:function(t){var e=t.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete t.files):t.files&&(t.files=t.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(t){if(t.bin&&typeof t.bin=="string"){var e={},r;(r=t.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=t.bin:e[t.name]=t.bin,t.bin=e}},fixManField:function(t){t.man&&typeof t.man=="string"&&(t.man=[t.man])},fixBundleDependenciesField:function(t){var e="bundledDependencies",r="bundleDependencies";t[e]&&!t[r]&&(t[r]=t[e],delete t[e]),t[r]&&!Array.isArray(t[r])?(this.warn("nonArrayBundleDependencies"),delete t[r]):t[r]&&(t[r]=t[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(t.dependencies||(t.dependencies={}),Object.prototype.hasOwnProperty.call(t.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),t.dependencies[n]="*"),!0)},this))},fixDependencies:function(t){i_a(t,this.warn),r_a(t,this.warn),this.fixBundleDependenciesField(t),["dependencies","devDependencies"].forEach(function(e){if(e in t){if(!t[e]||typeof t[e]!="object"){this.warn("nonObjectDependencies",e),delete t[e];return}Object.keys(t[e]).forEach(function(r){var n=t[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete t[e][r]);var o=Eot.fromUrl(t[e][r]);o&&(t[e][r]=o.toString())},this)}},this)},fixModulesField:function(t){t.modules&&(this.warn("deprecatedModules"),delete t.modules)},fixKeywordsField:function(t){typeof t.keywords=="string"&&(t.keywords=t.keywords.split(/,\s+/)),t.keywords&&!Array.isArray(t.keywords)?(delete t.keywords,this.warn("nonArrayKeywords")):t.keywords&&(t.keywords=t.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(t,e){var r=!e;if(!t.version)return t.version="",!0;if(!Hya(t.version,r))throw new Error('Invalid version: "'+t.version+'"');return t.version=Vya(t.version,r),!0},fixPeople:function(t){qhi(t,e_a),qhi(t,t_a)},fixNameField:function(t,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!t.name&&!r){t.name="";return}if(typeof t.name!="string")throw new Error("name field must be a string.");r||(t.name=t.name.trim()),Zya(t.name,r,e.allowLegacyCase),zya.builtinModules.includes(t.name)&&this.warn("conflictingName",t.name)},fixDescriptionField:function(t){t.description&&typeof t.description!="string"&&(this.warn("nonStringDescription"),delete t.description),t.readme&&!t.description&&(t.description=Kya(t.readme)),t.description===void 0&&delete t.description,t.description||this.warn("missingDescription")},fixReadmeField:function(t){t.readme||(this.warn("missingReadme"),t.readme="ERROR: No README data found!")},fixBugsField:function(t){if(!t.bugs&&t.repository&&t.repository.url){var e=Eot.fromUrl(t.repository.url);e&&e.bugs()&&(t.bugs={url:e.bugs()})}else if(t.bugs){if(typeof t.bugs=="string")Ghi(t.bugs)?t.bugs={email:t.bugs}:Ssr.parse(t.bugs).protocol?t.bugs={url:t.bugs}:this.warn("nonEmailUrlBugsString");else{o_a(t.bugs,this.warn);var r=t.bugs;t.bugs={},r.url&&(typeof r.url=="string"&&Ssr.parse(r.url).protocol?t.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&Ghi(r.email)?t.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!t.bugs.email&&!t.bugs.url&&(delete t.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(t){if(!t.homepage&&t.repository&&t.repository.url){var e=Eot.fromUrl(t.repository.url);e&&e.docs()&&(t.homepage=e.docs())}if(t.homepage){if(typeof t.homepage!="string")return this.warn("nonUrlHomepage"),delete t.homepage;Ssr.parse(t.homepage).protocol||(t.homepage="http://"+t.homepage)}},fixLicenseField:function(t){let e=t.license||t.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Wya(e).validForNewPackages)return this.warn("invalidLicense")}};function Xya(t){if(t.charAt(0)!=="@")return!1;var e=t.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function Jya(t){return!t.match(/[/@\s+%:]/)&&t===encodeURIComponent(t)}function Zya(t,e,r){if(t.charAt(0)==="."||!(Xya(t)||Jya(t))||e&&!r&&t!==t.toLowerCase()||t.toLowerCase()==="node_modules"||t.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(t))}function qhi(t,e){return t.author&&(t.author=e(t.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(t[r])&&(t[r]=t[r].map(e))}),t}function e_a(t){if(typeof t=="string")return t;var e=t.name||"",r=t.url||t.web,n=r?" ("+r+")":"",o=t.email||t.mail,s=o?" <"+o+">":"";return e+s+n}function t_a(t){if(typeof t!="string")return t;var e=t.match(/^([^(<]+)/),r=t.match(/\(([^()]+)\)/),n=t.match(/<([^<>]+)>/),o={};return e&&e[0].trim()&&(o.name=e[0].trim()),n&&(o.email=n[1]),r&&(o.url=r[1]),o}function r_a(t){var e=t.optionalDependencies;if(e){var r=t.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),t.dependencies=r}}function n_a(t,e,r){if(!t)return{};if(typeof t=="string"&&(t=t.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(t))return t;r("deprecatedArrayDependencies",e);var n={};return t.filter(function(o){return typeof o=="string"}).forEach(function(o){o=o.trim().split(/(:?[@\s><=])/);var s=o.shift(),a=o.join("");a=a.trim(),a=a.replace(/^@/,""),n[s]=a}),n}function i_a(t,e){Yya.forEach(function(r){t[r]&&(t[r]=n_a(t[r],r,e))})}function o_a(t,e){t&&Object.keys(t).forEach(function(r){jF.bugs[r]&&(e("typo",r,jF.bugs[r],"bugs"),t[jF.bugs[r]]=t[r],delete t[r])})}});var Whi=I((Mpl,s_a)=>{s_a.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var Khi=I((Fpl,Yhi)=>{var zhi=_e("util"),xsr=Whi();Yhi.exports=function(){var t=Array.prototype.slice.call(arguments,0),e=t.shift();if(e==="typo")return a_a.apply(null,t);var r=xsr[e]?xsr[e]:e+": '%s'";return t.unshift(r),zhi.format.apply(null,t)};function a_a(t,e,r){return r&&(t=r+"['"+t+"']",e=r+"['"+e+"']"),zhi.format(xsr.typo,t,e)}});var emi=I((Lpl,Zhi)=>{Zhi.exports=Xhi;var wsr=Vhi();Xhi.fixer=wsr;var c_a=Khi(),l_a=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],u_a=["dependencies","people","typos"],Tsr=l_a.map(function(t){return Jhi(t)+"Field"});Tsr=Tsr.concat(u_a);function Xhi(t,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||t.private)&&(e=function(){}),t.scripts&&t.scripts.install==="node-gyp rebuild"&&!t.scripts.preinstall&&(t.gypfile=!0),wsr.warn=function(){e(c_a.apply(null,arguments))},Tsr.forEach(function(n){wsr["fix"+Jhi(n)](t,r)}),t._id=t.name+"@"+t.version}function Jhi(t){return t.charAt(0).toUpperCase()+t.slice(1)}});var tmi=q(()=>{});import{fileURLToPath as d_a}from"node:url";function rmi(t){return t instanceof URL?d_a(t):t}var nmi=q(()=>{tmi()});import f_a from"node:fs/promises";import p_a from"node:path";async function omi({cwd:t,normalize:e=!0}={}){let r=await f_a.readFile(h_a(t),"utf8");return m_a(r,e)}var imi,h_a,m_a,smi=q(()=>{Vpi();imi=we(emi(),1);nmi();h_a=t=>p_a.resolve(rmi(t)??".","package.json"),m_a=(t,e)=>{let r=typeof t=="string"?ssr(t):t;return e&&(0,imi.default)(r),r}});import g_a from"node:path";async function ami(t){let e=await ypi("package.json",t);if(e)return{packageJson:await omi({...t,cwd:g_a.dirname(e)}),path:e}}var cmi=q(()=>{_pi();smi()});import{fileURLToPath as A_a}from"url";import y_a from"path";async function $F(){if(vot)return vot;let t=await ami({cwd:E_a});if(t)return vot=t.packageJson,vot}var __a,E_a,vot,A4e=q(()=>{"use strict";cmi();__a=A_a(import.meta.url),E_a=y_a.dirname(__a)});async function GF(){let t=await $F();return"0.4.10"}var y4e=q(()=>{"use strict";A4e();});var hmi=I((shl,Rsr)=>{"use strict";var umi=_e("child_process").exec,dmi=_e("child_process").execSync,bot=_e("fs"),lmi=_e("path"),fmi=bot.access,pmi=bot.accessSync,Rle=bot.constants||bot,Isr=process.platform=="win32",v_a=function(t,e){fmi(t,Rle.F_OK,function(r){e(!r)})},b_a=function(t){try{return pmi(t,Rle.F_OK),!1}catch{return!0}},C_a=function(t,e){fmi(t,Rle.F_OK|Rle.X_OK,function(r){e(null,!r)})},S_a=function(t){try{return pmi(t,Rle.F_OK|Rle.X_OK),!0}catch{return!1}},x_a=function(t,e,r){v_a(t,function(n){if(!n){var o=umi("command -v "+e+" 2>/dev/null && { echo >&1 "+e+"; exit 0; }",function(s,a,c){r(null,!!a)});return}C_a(t,r)})},w_a=function(t,e,r){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(t)){r(null,!1);return}var n=umi("where "+e,function(o){o!==null?r(null,!1):r(null,!0)})},T_a=function(t,e){if(b_a(t))try{var r=dmi("command -v "+e+" 2>/dev/null && { echo >&1 "+e+"; exit 0; }");return!!r}catch{return!1}return S_a(t)},I_a=function(t,e,r){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(t))return!1;try{var n=dmi("where "+e,{stdio:[]});return!!n}catch{return!1}},Dsr=function(t){return/[^A-Za-z0-9_\/:=-]/.test(t)&&(t="'"+t.replace(/'/g,"'\\''")+"'",t=t.replace(/^(?:'')+/g,"").replace(/\\'''/g,"\\'")),t};Isr&&(Dsr=function(t){var e=/[\\]/.test(t);if(e){var r='"'+lmi.dirname(t)+'"',n='"'+lmi.basename(t)+'"';return r+":"+n}return'"'+t+'"'});Rsr.exports=function t(e,r){var n=Dsr(e);if(!r&&typeof Promise<"u")return new Promise(function(o,s){t(e,function(a,c){c?o(e):s(a)})});Isr?w_a(e,n,r):x_a(e,n,r)};Rsr.exports.sync=function(t){var e=Dsr(t);return Isr?I_a(t,e):T_a(t,e)}});var gmi=I((ahl,mmi)=>{mmi.exports=hmi()});import Osr from"fs/promises";import Bsr from"path";import J_a from"os";function eEa(t,e){if(t==="global")return Bsr.join(J_a.homedir(),".iflow","commands");{let r=e||process.cwd();return Bsr.join(r,".iflow","commands")}}function Dmi(t){return t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function rEa(t,e){let{scope:r}=e;if(r!=="project"&&r!=="global"){console.error(R.t("commandsAdd.invalidScope",{scope:r}));return}let o=tl(process.cwd()).merged.apiKey;if(!o){console.error(R.t("commandsAdd.apiKeyNotFound")),console.error(R.t("commandsAdd.pleaseAuthenticateFirst"));return}console.log(R.t("commandsAdd.searchingCommand",{nameOrId:t}));try{let s=null;if(/^\d+$/.test(t)){let u=parseInt(t,10);s=await Z_a(o,u)}if(!s){let u=await Imi(o,1,1e3,t,"public");if(!u.success){console.error(`Error: ${u.message}`);return}s=u.commands?.find(d=>d.name.toLowerCase()===t.toLowerCase())||null}if(!s){let u=await Imi(o,1,1e3,t,"private");if(!u.success){console.error(`Error: ${u.message}`);return}s=u.commands?.find(d=>d.name.toLowerCase()===t.toLowerCase())||null}if(!s){console.error(R.t("commandsAdd.commandNotFound",{nameOrId:t}));return}console.log(R.t("commandsAdd.foundCommand",{name:s.name})),console.log(R.t("commandsAdd.commandDescription",{description:s.description})),console.log(R.t("commandsAdd.commandCategory",{category:s.category})),console.log(R.t("commandsAdd.installingToScope",{scope:r}));let a=process.cwd(),c=await tEa(s,r,a);c.success?(console.log(c.message),console.log(""),console.log(R.t("commandsAdd.restartRequired"))):console.error(c.message)}catch(s){console.error(R.t("commandsAdd.errorAddingCommand",{error:s}))}}var Imi,Z_a,tEa,Rmi,kmi=q(()=>{"use strict";Tl();qt();Imi=async(t,e=1,r=20,n,o)=>{try{if(!t)return{success:!1,message:R.t("commandsAdd.pleaseAuthenticate")};let s={page:e,size:r,usePage:!0,visibility:o};n&&(s.name=n);let a={"User-Agent":"iFlow-Cli","Content-Type":"application/json"};o==="private"&&(a.Authorization=`Bearer ${t}`);let c=await fetch("https://apis.iflow.cn/v1/commands/list",{method:"POST",headers:a,body:JSON.stringify(s)});if(!c.ok){let f=R.t("commandsAdd.unableToLoadCommands");return c.status===401?f=R.t("commandsAdd.authenticationFailed"):c.status===403?f=R.t("commandsAdd.accessDenied"):c.status===404?f=R.t("commandsAdd.serviceNotFound"):c.status>=500&&(f=R.t("commandsAdd.serverError")),{success:!1,message:f}}let u=await c.json();return u.success?{success:!0,commands:Array.isArray(u.data.data)?u.data.data:[],total:u.data.total||0}:{success:!1,message:u.message||R.t("commandsAdd.failedToLoadFromServer")}}catch(s){let a=R.t("commandsAdd.connectionError");return s instanceof Error&&s.message.includes("Failed to fetch")&&(a=R.t("commandsAdd.networkError")),{success:!1,message:a}}},Z_a=async(t,e)=>{try{let r=await fetch(`https://apis.iflow.cn/v1/commands/get/${e}`,{headers:{Authorization:`Bearer ${t}`}});if(!r.ok)throw new Error(`HTTP ${r.status}: ${r.statusText}`);let n=await r.json();if(!n.success)throw new Error(n.message||R.t("commandsAdd.failedToFetchDetails"));return n.data||null}catch(r){return console.error(R.t("commandsAdd.failedToFetchDetails"),r),null}};tEa=async(t,e,r)=>{try{let n=eEa(e,r);await Osr.mkdir(n,{recursive:!0});let o=`${Dmi(t.name)}.toml`,s=Bsr.join(n,o);try{return await Osr.access(s),{success:!1,message:R.t("commandsAdd.alreadyInstalled",{commandName:t.name,scope:e})}}catch{}let a=`# Command: ${t.name}
5210
5210
  # Description: ${t.description}
5211
5211
  # Category: ${t.category}
5212
5212
  # Version: ${t.version}
@@ -5232,7 +5232,7 @@ ${REa}${R.t("agentsGet.fileContent")}:${S1}`),console.log("\u2500".repeat(50)),c
5232
5232
  ${OEa}${R.t("agentsOnline.onlineAgents")}${n?` ${R.t("agentsOnline.filteredBy",{search:n})}`:""}:${lm}
5233
5233
  `);for(let u of c){if(console.log(`${NEa}\u2022 ${u.name}${lm} (ID: ${u.id})`),console.log(` ${x1}${R.t("agentsOnline.agentDescription")}:${lm} ${u.description}`),console.log(` ${x1}${R.t("agentsOnline.category")}:${lm} ${u.category}`),console.log(` ${x1}${R.t("agentsOnline.model")}:${lm} ${u.modelName}`),u.tags&&console.log(` ${x1}${R.t("agentsOnline.tags")}:${lm} ${u.tags}`),console.log(` ${x1}${R.t("agentsOnline.author")}:${lm} ${u.authorId}`),console.log(` ${x1}${R.t("agentsOnline.version")}:${lm} ${u.version}`),u.extInfo){if(u.extInfo["allowed-tools"]){let p=u.extInfo["allowed-tools"].split(",").map(h=>h.trim()).filter(h=>h);p.length>0?console.log(` ${x1}${R.t("agentsOnline.allowedTools")}:${lm} ${p.join(", ")}`):u.extInfo["is-inherit-tools"]?console.log(` ${x1}${R.t("agentsOnline.allowedTools")}:${lm} ${R.t("agentsOnline.allToolsAvailable")}`):console.log(` ${x1}${R.t("agentsOnline.allowedTools")}:${lm} ${R.t("agentsOnline.noToolsAvailable")}`)}let d=u.extInfo["is-inherit-tools"];if(console.log(` ${x1}${R.t("agentsOnline.inheritTools")}:${lm} ${d?R.t("agentsOnline.yes"):R.t("agentsOnline.no")}`),u.extInfo.mcps){let p=u.extInfo.mcps.split(",").map(h=>h.trim()).filter(h=>h);p.length>0?console.log(` ${x1}${R.t("agentsOnline.mcpServers")}:${lm} ${p.join(", ")}`):u.extInfo["is-inherit-mcps"]?console.log(` ${x1}${R.t("agentsOnline.mcpServers")}:${lm} ${R.t("agentsOnline.allMcpServersAvailable")}`):console.log(` ${x1}${R.t("agentsOnline.mcpServers")}:${lm} ${R.t("agentsOnline.noMcpServersAvailable")}`)}else u.extInfo["is-inherit-mcps"]?console.log(` ${x1}${R.t("agentsOnline.mcpServers")}:${lm} ${R.t("agentsOnline.allMcpServersAvailable")}`):console.log(` ${x1}${R.t("agentsOnline.mcpServers")}:${lm} ${R.t("agentsOnline.noMcpServersAvailable")}`);let f=u.extInfo["is-inherit-mcps"];console.log(` ${x1}${R.t("agentsOnline.inheritMcps")}:${lm} ${f?R.t("agentsOnline.yes"):R.t("agentsOnline.no")}`)}console.log()}console.log(`${Zmi}${R.t("agentsOnline.totalShown",{count:c.length,total:a.total})}${lm}`),console.log(`${Zmi}${R.t("agentsOnline.installHint")}${lm}`)}catch(a){console.error(R.t("agentsOnline.errorBrowsing",{error:a})),process.exit(1)}}var NEa,Zmi,OEa,x1,lm,BEa,egi,tgi=q(()=>{"use strict";Tl();qt();NEa="\x1B[32m",Zmi="\x1B[33m",OEa="\x1B[34m",x1="\x1B[36m",lm="\x1B[0m",BEa=async(t,e=1,r=20)=>{try{if(!t)return{success:!1,message:R.t("agentsOnline.pleaseAuthenticate")};let o=await fetch("https://apis.iflow.cn/v1/agents/list",{method:"POST",headers:{"User-Agent":"iFlow-Cli","Content-Type":"application/json"},body:JSON.stringify({page:e,size:r,visibility:"public"})});if(!o.ok){let c=R.t("agentsOnline.unableToLoadAgents");return o.status===401?c=R.t("agentsOnline.authenticationFailed"):o.status===403?c=R.t("agentsOnline.accessDenied"):o.status===404?c=R.t("agentsOnline.serviceNotFound"):o.status>=500&&(c=R.t("agentsOnline.serverError")),{success:!1,message:c}}let s=await o.json();return s.success?{success:!0,agents:Array.isArray(s.data.data)?s.data.data:[],total:s.data.total||0}:{success:!1,message:s.message||R.t("agentsOnline.failedToLoadFromServer")}}catch(n){let o=R.t("agentsOnline.connectionError");return n instanceof Error&&n.message.includes("Failed to fetch")&&(o=R.t("agentsOnline.networkError")),{success:!1,message:o}}};egi={command:"online",describe:R.t("agentsOnline.description"),builder:t=>t.usage(R.t("agentsOnline.usage")).option("page",{alias:"p",describe:R.t("agentsOnline.pageOption"),type:"number",default:1}).option("size",{alias:"s",describe:R.t("agentsOnline.sizeOption"),type:"number",default:20}).option("search",{describe:R.t("agentsOnline.searchOption"),type:"string"}),handler:async t=>{await PEa({page:t.page,size:t.size,search:t.search})}}});var rgi={};ls(rgi,{agentCommand:()=>Lsr});var Lsr,Usr=q(()=>{"use strict";Hmi();zmi();Kmi();Jmi();tgi();qt();Lsr={command:"agent",describe:R.t("agentCommand.description"),builder:t=>t.command(qmi).command(Wmi).command(Ymi).command(Xmi).command(egi).demandCommand(1,R.t("agentCommand.demandCommand")).version(!1),handler:()=>{}}});import{EventEmitter as r6a}from"events";var Fo,tk=q(()=>{"use strict";Fo=new r6a;Fo.setMaxListeners(20)});import*as Nle from"fs";import*as kot from"path";function Not(t,e){let r=process.argv[1];if(!r)return{packageManager:"unknown",isGlobal:!1};try{let n=Nle.realpathSync(r).replace(/\\/g,"/"),o=t?.replace(/\\/g,"/");if(_l(process.cwd())&&o&&n.startsWith(o)&&!n.includes("/node_modules/"))return{packageManager:"unknown",isGlobal:!1,updateMessage:'Running from a local git clone. Please update with "git pull".'};if(n.includes("/.npm/_npx")||n.includes("/npm/_npx"))return{packageManager:"npx",isGlobal:!1,updateMessage:"Running via npx, update not applicable."};if(n.includes("/.pnpm/_pnpx"))return{packageManager:"pnpx",isGlobal:!1,updateMessage:"Running via pnpx, update not applicable."};if(n.includes("/.pnpm/global")){let u="pnpm add -g @iflow-ai/iflow-cli@latest";return{packageManager:"pnpm",isGlobal:!0,updateCommand:u,updateMessage:e?`Please run ${u} to update`:"Installed with pnpm. Attempting to automatically update now..."}}if(n.includes("/.yarn/global")){let u="yarn global add @iflow-ai/iflow-cli@latest";return{packageManager:"yarn",isGlobal:!0,updateCommand:u,updateMessage:e?`Please run ${u} to update`:"Installed with yarn. Attempting to automatically update now..."}}if(n.includes("/.bun/install/cache"))return{packageManager:"bunx",isGlobal:!1,updateMessage:"Running via bunx, update not applicable."};if(n.includes("/.bun/bin")){let u="bun add -g @iflow-ai/iflow-cli@latest";return{packageManager:"bun",isGlobal:!0,updateCommand:u,updateMessage:e?`Please run ${u} to update`:"Installed with bun. Attempting to automatically update now..."}}if(o&&n.startsWith(`${o}/node_modules`)){let u="npm";return Nle.existsSync(kot.join(t,"yarn.lock"))?u="yarn":Nle.existsSync(kot.join(t,"pnpm-lock.yaml"))?u="pnpm":Nle.existsSync(kot.join(t,"bun.lockb"))&&(u="bun"),{packageManager:u,isGlobal:!1,updateMessage:"Locally installed. Please update via your project's package.json."}}let c="global"==="aone"?"npm install -g @ali/iflow-cli@latest":"npm install -g @iflow-ai/iflow-cli@latest";return{packageManager:"npm",isGlobal:!0,updateCommand:c,updateMessage:e?R.t("autoUpdate.fallback",{updateCommand:c}):R.t("autoUpdate.installWithNpm")}}catch(n){return console.log(n),{packageManager:"unknown",isGlobal:!1}}}var qsr=q(()=>{"use strict";qt();});import{EventEmitter as n6a}from"events";var C0,Hsr=q(()=>{"use strict";C0=new n6a});var ks=q(()=>{"use strict";});import{spawn as i6a}from"child_process";var Oot,Vsr=q(()=>{"use strict";Oot=i6a});var Yf,dgi,fgi=q(()=>{"use strict";b1();Yf={type:"dark",Background:"#0b0e14",UserMessageBackground:"#3C3C3C",UserMessageColor:"#c0c0c0",Foreground:"#bfbdb6",LightBlue:"#59C2FF",AccentBlue:"#39BAE6",AccentPurple:"#D2A6FF",AccentCyan:"#95E6CB",AccentGreen:"#AAD94C",AccentYellow:"#FFB454",AccentRed:"#F26D78",DiffAdded:"#293022",DiffRemoved:"#3D1215",Comment:"#646A71",Gray:"#3D4149",GradientColors:["#FFB454","#F26D78"]},dgi=new el("Ayu","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:Yf.Background,color:Yf.Foreground},"hljs-keyword":{color:Yf.AccentYellow},"hljs-literal":{color:Yf.AccentPurple},"hljs-symbol":{color:Yf.AccentCyan},"hljs-name":{color:Yf.LightBlue},"hljs-link":{color:Yf.AccentBlue},"hljs-function .hljs-keyword":{color:Yf.AccentYellow},"hljs-subst":{color:Yf.Foreground},"hljs-string":{color:Yf.AccentGreen},"hljs-title":{color:Yf.AccentYellow},"hljs-type":{color:Yf.AccentBlue},"hljs-attribute":{color:Yf.AccentYellow},"hljs-bullet":{color:Yf.AccentYellow},"hljs-addition":{color:Yf.AccentGreen},"hljs-variable":{color:Yf.Foreground},"hljs-template-tag":{color:Yf.AccentYellow},"hljs-template-variable":{color:Yf.AccentYellow},"hljs-comment":{color:Yf.Comment,fontStyle:"italic"},"hljs-quote":{color:Yf.AccentCyan,fontStyle:"italic"},"hljs-deletion":{color:Yf.AccentRed},"hljs-meta":{color:Yf.AccentYellow},"hljs-doctag":{fontWeight:"bold"},"hljs-strong":{fontWeight:"bold"},"hljs-emphasis":{fontStyle:"italic"}},Yf)});var jc,pgi,hgi=q(()=>{"use strict";b1();jc={type:"light",Background:"#f8f9fa",UserMessageBackground:"#F5F5F5",UserMessageColor:"#6a6a6a",Foreground:"#5c6166",LightBlue:"#55b4d4",AccentBlue:"#399ee6",AccentPurple:"#a37acc",AccentCyan:"#4cbf99",AccentGreen:"#86b300",AccentYellow:"#f2ae49",AccentRed:"#f07171",DiffAdded:"#C6EAD8",DiffRemoved:"#FFCCCC",Comment:"#ABADB1",Gray:"#a6aaaf",GradientColors:["#399ee6","#86b300"]},pgi=new el("Ayu Light","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:jc.Background,color:jc.Foreground},"hljs-comment":{color:jc.Comment,fontStyle:"italic"},"hljs-quote":{color:jc.AccentCyan,fontStyle:"italic"},"hljs-string":{color:jc.AccentGreen},"hljs-constant":{color:jc.AccentCyan},"hljs-number":{color:jc.AccentPurple},"hljs-keyword":{color:jc.AccentYellow},"hljs-selector-tag":{color:jc.AccentYellow},"hljs-attribute":{color:jc.AccentYellow},"hljs-variable":{color:jc.Foreground},"hljs-variable.language":{color:jc.LightBlue,fontStyle:"italic"},"hljs-title":{color:jc.AccentBlue},"hljs-section":{color:jc.AccentGreen,fontWeight:"bold"},"hljs-type":{color:jc.LightBlue},"hljs-class .hljs-title":{color:jc.AccentBlue},"hljs-tag":{color:jc.LightBlue},"hljs-name":{color:jc.AccentBlue},"hljs-builtin-name":{color:jc.AccentYellow},"hljs-meta":{color:jc.AccentYellow},"hljs-symbol":{color:jc.AccentRed},"hljs-bullet":{color:jc.AccentYellow},"hljs-regexp":{color:jc.AccentCyan},"hljs-link":{color:jc.LightBlue},"hljs-deletion":{color:jc.AccentRed},"hljs-addition":{color:jc.AccentGreen},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"},"hljs-literal":{color:jc.AccentCyan},"hljs-built_in":{color:jc.AccentRed},"hljs-doctag":{color:jc.AccentRed},"hljs-template-variable":{color:jc.AccentCyan},"hljs-selector-id":{color:jc.AccentRed}},jc)});var Ya,mgi,ggi=q(()=>{"use strict";b1();Ya={type:"dark",Background:"#282c34",UserMessageBackground:"#3C3C3C",UserMessageColor:"#c0c0c0",Foreground:"#abb2bf",LightBlue:"#61aeee",AccentBlue:"#61aeee",AccentPurple:"#c678dd",AccentCyan:"#56b6c2",AccentGreen:"#98c379",AccentYellow:"#e6c07b",AccentRed:"#e06c75",DiffAdded:"#39544E",DiffRemoved:"#562B2F",Comment:"#5c6370",Gray:"#5c6370",GradientColors:["#61aeee","#98c379"]},mgi=new el("Atom One","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",color:Ya.Foreground,background:Ya.Background},"hljs-comment":{color:Ya.Comment,fontStyle:"italic"},"hljs-quote":{color:Ya.Comment,fontStyle:"italic"},"hljs-doctag":{color:Ya.AccentPurple},"hljs-keyword":{color:Ya.AccentPurple},"hljs-formula":{color:Ya.AccentPurple},"hljs-section":{color:Ya.AccentRed},"hljs-name":{color:Ya.AccentRed},"hljs-selector-tag":{color:Ya.AccentRed},"hljs-deletion":{color:Ya.AccentRed},"hljs-subst":{color:Ya.AccentRed},"hljs-literal":{color:Ya.AccentCyan},"hljs-string":{color:Ya.AccentGreen},"hljs-regexp":{color:Ya.AccentGreen},"hljs-addition":{color:Ya.AccentGreen},"hljs-attribute":{color:Ya.AccentGreen},"hljs-meta-string":{color:Ya.AccentGreen},"hljs-built_in":{color:Ya.AccentYellow},"hljs-class .hljs-title":{color:Ya.AccentYellow},"hljs-attr":{color:Ya.AccentYellow},"hljs-variable":{color:Ya.AccentYellow},"hljs-template-variable":{color:Ya.AccentYellow},"hljs-type":{color:Ya.AccentYellow},"hljs-selector-class":{color:Ya.AccentYellow},"hljs-selector-attr":{color:Ya.AccentYellow},"hljs-selector-pseudo":{color:Ya.AccentYellow},"hljs-number":{color:Ya.AccentYellow},"hljs-symbol":{color:Ya.AccentBlue},"hljs-bullet":{color:Ya.AccentBlue},"hljs-link":{color:Ya.AccentBlue,textDecoration:"underline"},"hljs-meta":{color:Ya.AccentBlue},"hljs-selector-id":{color:Ya.AccentBlue},"hljs-title":{color:Ya.AccentBlue},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"}},Ya)});var zd,Agi,ygi=q(()=>{"use strict";b1();zd={type:"dark",Background:"#282a36",UserMessageBackground:"#3C3C3C",UserMessageColor:"#c0c0c0",Foreground:"#f8f8f2",LightBlue:"#8be9fd",AccentBlue:"#8be9fd",AccentPurple:"#ff79c6",AccentCyan:"#8be9fd",AccentGreen:"#50fa7b",AccentYellow:"#f1fa8c",AccentRed:"#ff5555",DiffAdded:"#11431d",DiffRemoved:"#6e1818",Comment:"#6272a4",Gray:"#6272a4",GradientColors:["#ff79c6","#8be9fd"]},Agi=new el("Dracula","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:zd.Background,color:zd.Foreground},"hljs-keyword":{color:zd.AccentBlue,fontWeight:"bold"},"hljs-selector-tag":{color:zd.AccentBlue,fontWeight:"bold"},"hljs-literal":{color:zd.AccentBlue,fontWeight:"bold"},"hljs-section":{color:zd.AccentBlue,fontWeight:"bold"},"hljs-link":{color:zd.AccentBlue},"hljs-function .hljs-keyword":{color:zd.AccentPurple},"hljs-subst":{color:zd.Foreground},"hljs-string":{color:zd.AccentYellow},"hljs-title":{color:zd.AccentYellow,fontWeight:"bold"},"hljs-name":{color:zd.AccentYellow,fontWeight:"bold"},"hljs-type":{color:zd.AccentYellow,fontWeight:"bold"},"hljs-attribute":{color:zd.AccentYellow},"hljs-symbol":{color:zd.AccentYellow},"hljs-bullet":{color:zd.AccentYellow},"hljs-addition":{color:zd.AccentGreen},"hljs-variable":{color:zd.AccentYellow},"hljs-template-tag":{color:zd.AccentYellow},"hljs-template-variable":{color:zd.AccentYellow},"hljs-comment":{color:zd.Comment},"hljs-quote":{color:zd.Comment},"hljs-deletion":{color:zd.AccentRed},"hljs-meta":{color:zd.Comment},"hljs-doctag":{fontWeight:"bold"},"hljs-strong":{fontWeight:"bold"},"hljs-emphasis":{fontStyle:"italic"}},zd)});var $c,_gi,Egi=q(()=>{"use strict";b1();$c={type:"dark",Background:"#24292e",UserMessageBackground:"#3C3C3C",UserMessageColor:"#c0c0c0",Foreground:"#d1d5da",LightBlue:"#79B8FF",AccentBlue:"#79B8FF",AccentPurple:"#B392F0",AccentCyan:"#9ECBFF",AccentGreen:"#85E89D",AccentYellow:"#FFAB70",AccentRed:"#F97583",DiffAdded:"#3C4636",DiffRemoved:"#502125",Comment:"#6A737D",Gray:"#6A737D",GradientColors:["#79B8FF","#85E89D"]},_gi=new el("GitHub","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",color:$c.Foreground,background:$c.Background},"hljs-comment":{color:$c.Comment,fontStyle:"italic"},"hljs-quote":{color:$c.Comment,fontStyle:"italic"},"hljs-keyword":{color:$c.AccentRed,fontWeight:"bold"},"hljs-selector-tag":{color:$c.AccentRed,fontWeight:"bold"},"hljs-subst":{color:$c.Foreground},"hljs-number":{color:$c.LightBlue},"hljs-literal":{color:$c.LightBlue},"hljs-variable":{color:$c.AccentYellow},"hljs-template-variable":{color:$c.AccentYellow},"hljs-tag .hljs-attr":{color:$c.AccentYellow},"hljs-string":{color:$c.AccentCyan},"hljs-doctag":{color:$c.AccentCyan},"hljs-title":{color:$c.AccentPurple,fontWeight:"bold"},"hljs-section":{color:$c.AccentPurple,fontWeight:"bold"},"hljs-selector-id":{color:$c.AccentPurple,fontWeight:"bold"},"hljs-type":{color:$c.AccentGreen,fontWeight:"bold"},"hljs-class .hljs-title":{color:$c.AccentGreen,fontWeight:"bold"},"hljs-tag":{color:$c.AccentGreen},"hljs-name":{color:$c.AccentGreen},"hljs-attribute":{color:$c.LightBlue},"hljs-regexp":{color:$c.AccentCyan},"hljs-link":{color:$c.AccentCyan},"hljs-symbol":{color:$c.AccentPurple},"hljs-bullet":{color:$c.AccentPurple},"hljs-built_in":{color:$c.LightBlue},"hljs-builtin-name":{color:$c.LightBlue},"hljs-meta":{color:$c.LightBlue,fontWeight:"bold"},"hljs-deletion":{background:"#86181D",color:$c.AccentRed},"hljs-addition":{background:"#144620",color:$c.AccentGreen},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"}},$c)});var Il,vgi,bgi=q(()=>{"use strict";b1();Il={type:"light",Background:"#f8f8f8",UserMessageBackground:"#F5F5F5",UserMessageColor:"#6a6a6a",Foreground:"#24292E",LightBlue:"#0086b3",AccentBlue:"#458",AccentPurple:"#900",AccentCyan:"#009926",AccentGreen:"#008080",AccentYellow:"#990073",AccentRed:"#d14",DiffAdded:"#C6EAD8",DiffRemoved:"#FFCCCC",Comment:"#998",Gray:"#999",GradientColors:["#458","#008080"]},vgi=new el("GitHub Light","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",color:Il.Foreground,background:Il.Background},"hljs-comment":{color:Il.Comment,fontStyle:"italic"},"hljs-quote":{color:Il.Comment,fontStyle:"italic"},"hljs-keyword":{color:Il.Foreground,fontWeight:"bold"},"hljs-selector-tag":{color:Il.Foreground,fontWeight:"bold"},"hljs-subst":{color:Il.Foreground,fontWeight:"normal"},"hljs-number":{color:Il.AccentGreen},"hljs-literal":{color:Il.AccentGreen},"hljs-variable":{color:Il.AccentGreen},"hljs-template-variable":{color:Il.AccentGreen},"hljs-tag .hljs-attr":{color:Il.AccentGreen},"hljs-string":{color:Il.AccentRed},"hljs-doctag":{color:Il.AccentRed},"hljs-title":{color:Il.AccentPurple,fontWeight:"bold"},"hljs-section":{color:Il.AccentPurple,fontWeight:"bold"},"hljs-selector-id":{color:Il.AccentPurple,fontWeight:"bold"},"hljs-type":{color:Il.AccentBlue,fontWeight:"bold"},"hljs-class .hljs-title":{color:Il.AccentBlue,fontWeight:"bold"},"hljs-tag":{color:Il.AccentBlue,fontWeight:"normal"},"hljs-name":{color:Il.AccentBlue,fontWeight:"normal"},"hljs-attribute":{color:Il.AccentBlue,fontWeight:"normal"},"hljs-regexp":{color:Il.AccentCyan},"hljs-link":{color:Il.AccentCyan},"hljs-symbol":{color:Il.AccentYellow},"hljs-bullet":{color:Il.AccentYellow},"hljs-built_in":{color:Il.LightBlue},"hljs-builtin-name":{color:Il.LightBlue},"hljs-meta":{color:Il.Gray,fontWeight:"bold"},"hljs-deletion":{background:"#fdd"},"hljs-addition":{background:"#dfd"},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"}},Il)});var Gc,Cgi,Sgi=q(()=>{"use strict";b1();Gc={type:"light",Background:"white",UserMessageBackground:"#F5F5F5",UserMessageColor:"#6a6a6a",Foreground:"#444",LightBlue:"#066",AccentBlue:"#008",AccentPurple:"#606",AccentCyan:"#066",AccentGreen:"#080",AccentYellow:"#660",AccentRed:"#800",DiffAdded:"#C6EAD8",DiffRemoved:"#FEDEDE",Comment:"#5f6368",Gray:Uc.Gray,GradientColors:["#066","#606"]},Cgi=new el("Google Code","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:Gc.Background,color:Gc.Foreground},"hljs-comment":{color:Gc.AccentRed},"hljs-quote":{color:Gc.AccentRed},"hljs-keyword":{color:Gc.AccentBlue},"hljs-selector-tag":{color:Gc.AccentBlue},"hljs-section":{color:Gc.AccentBlue},"hljs-title":{color:Gc.AccentPurple},"hljs-name":{color:Gc.AccentBlue},"hljs-variable":{color:Gc.AccentYellow},"hljs-template-variable":{color:Gc.AccentYellow},"hljs-string":{color:Gc.AccentGreen},"hljs-selector-attr":{color:Gc.AccentGreen},"hljs-selector-pseudo":{color:Gc.AccentGreen},"hljs-regexp":{color:Gc.AccentGreen},"hljs-literal":{color:Gc.AccentCyan},"hljs-symbol":{color:Gc.AccentCyan},"hljs-bullet":{color:Gc.AccentCyan},"hljs-meta":{color:Gc.AccentCyan},"hljs-number":{color:Gc.AccentCyan},"hljs-link":{color:Gc.AccentCyan},"hljs-doctag":{color:Gc.AccentPurple,fontWeight:"bold"},"hljs-type":{color:Gc.AccentPurple},"hljs-attr":{color:Gc.AccentPurple},"hljs-built_in":{color:Gc.AccentPurple},"hljs-builtin-name":{color:Gc.AccentPurple},"hljs-params":{color:Gc.AccentPurple},"hljs-attribute":{color:Gc.Foreground},"hljs-subst":{color:Gc.Foreground},"hljs-formula":{backgroundColor:"#eee",fontStyle:"italic"},"hljs-selector-id":{color:Gc.AccentYellow},"hljs-selector-class":{color:Gc.AccentYellow},"hljs-addition":{backgroundColor:"#baeeba"},"hljs-deletion":{backgroundColor:"#ffc8bd"},"hljs-strong":{fontWeight:"bold"},"hljs-emphasis":{fontStyle:"italic"}},Gc)});var Yo,Zm,xgi,wgi=q(()=>{"use strict";b1();Yo={type:"dark",Background:"#2d2b57",UserMessageBackground:"#3C3C3C",UserMessageColor:"#c0c0c0",Foreground:"#e3dfff",LightBlue:"#847ace",AccentBlue:"#a599e9",AccentPurple:"#ac65ff",AccentCyan:"#a1feff",AccentGreen:"#A5FF90",AccentYellow:"#fad000",AccentRed:"#ff628c",DiffAdded:"#383E45",DiffRemoved:"#572244",Comment:"#B362FF",Gray:"#726c86",GradientColors:["#4d21fc","#847ace","#ff628c"]},Zm={AccentYellowAlt:"#f8d000",AccentOrange:"#fb9e00",AccentPink:"#fa658d",AccentLightPurple:"#c991ff",AccentDarkPurple:"#6943ff",AccentTeal:"#2ee2fa"},xgi=new el("Shades Of Purple","dark",{hljs:{display:"block",overflowX:"auto",background:Yo.Background,color:Yo.Foreground},"hljs-title":{color:Yo.AccentYellow,fontWeight:"normal"},"hljs-name":{color:Yo.AccentCyan,fontWeight:"normal"},"hljs-tag":{color:Yo.Foreground},"hljs-attr":{color:Zm.AccentYellowAlt,fontStyle:"italic"},"hljs-built_in":{color:Zm.AccentOrange},"hljs-selector-tag":{color:Zm.AccentOrange,fontWeight:"normal"},"hljs-section":{color:Zm.AccentOrange},"hljs-keyword":{color:Zm.AccentOrange,fontWeight:"normal"},"hljs-subst":{color:Yo.Foreground},"hljs-string":{color:Yo.AccentGreen},"hljs-attribute":{color:Yo.AccentGreen},"hljs-symbol":{color:Yo.AccentGreen},"hljs-bullet":{color:Yo.AccentGreen},"hljs-addition":{color:Yo.AccentGreen},"hljs-code":{color:Yo.AccentGreen},"hljs-regexp":{color:Yo.AccentGreen},"hljs-selector-class":{color:Yo.AccentGreen},"hljs-selector-attr":{color:Yo.AccentGreen},"hljs-selector-pseudo":{color:Yo.AccentGreen},"hljs-template-tag":{color:Yo.AccentGreen},"hljs-quote":{color:Yo.AccentGreen},"hljs-deletion":{color:Yo.AccentRed},"hljs-meta":{color:Zm.AccentOrange},"hljs-meta-string":{color:Zm.AccentOrange},"hljs-comment":{color:Yo.AccentPurple},"hljs-literal":{color:Zm.AccentPink,fontWeight:"normal"},"hljs-number":{color:Zm.AccentPink},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"},"hljs-diff":{color:Yo.Foreground},"hljs-meta.hljs-diff":{color:Yo.AccentBlue},"hljs-ln":{color:Yo.Gray},"hljs-type":{color:Yo.AccentYellow,fontWeight:"normal"},"hljs-variable":{color:Yo.AccentYellow},"hljs-template-variable":{color:Yo.AccentGreen},"hljs-function .hljs-keyword":{color:Zm.AccentOrange},"hljs-link":{color:Yo.LightBlue},"hljs-doctag":{fontWeight:"bold"},"hljs-params":{color:Zm.AccentLightPurple,fontStyle:"italic"},"hljs-class":{color:Yo.AccentCyan,fontWeight:"bold"},"hljs-function":{color:Yo.AccentCyan},"hljs-property":{color:Yo.AccentBlue},"hljs-operator":{color:Zm.AccentDarkPurple},"hljs-punctuation":{color:Yo.Gray},"hljs-selector-id":{color:Yo.AccentYellow,fontWeight:"bold"},"hljs-char":{color:Yo.AccentGreen},"hljs-escape":{color:Zm.AccentPink,fontWeight:"bold"},"hljs-meta-keyword":{color:Zm.AccentOrange,fontWeight:"bold"},"hljs-builtin-name":{color:Zm.AccentTeal},"hljs-module":{color:Yo.AccentCyan},"hljs-namespace":{color:Yo.LightBlue},"hljs-important":{color:Yo.AccentRed,fontWeight:"bold"},"hljs-formula":{color:Yo.AccentCyan,fontStyle:"italic"},"hljs-decorator":{color:Zm.AccentTeal,fontWeight:"bold"},"hljs-symbol.ruby":{color:Zm.AccentPink},"hljs-keyword.sql":{color:Zm.AccentOrange,textTransform:"uppercase"},"hljs-section.markdown":{color:Yo.AccentYellow,fontWeight:"bold"},"hljs-attr.json":{color:Yo.AccentCyan},"hljs-tag .hljs-name":{color:Yo.AccentRed},"hljs-tag .hljs-attr":{color:Zm.AccentYellowAlt},"hljs.hljs-line-numbers":{borderRight:`1px solid ${Yo.Gray}`},"hljs.hljs-line-numbers .hljs-ln-numbers":{color:Yo.Gray,paddingRight:"1em"},"hljs.hljs-line-numbers .hljs-ln-code":{paddingLeft:"1em"},"hljs::selection":{background:Yo.AccentBlue+"40"},"hljs ::-moz-selection":{background:Yo.AccentBlue+"40"},"hljs .hljs-highlight":{background:Yo.AccentPurple+"20",display:"block",width:"100%"}},Yo)});var dc,Tgi,Igi=q(()=>{"use strict";b1();dc={type:"light",Background:"#fff",UserMessageBackground:"#F5F5F5",UserMessageColor:"#6a6a6a",Foreground:"#444",LightBlue:"#0E0EFF",AccentBlue:"#1c00cf",AccentPurple:"#aa0d91",AccentCyan:"#3F6E74",AccentGreen:"#007400",AccentYellow:"#836C28",AccentRed:"#c41a16",DiffAdded:"#C6EAD8",DiffRemoved:"#FEDEDE",Comment:"#007400",Gray:"#c0c0c0",GradientColors:["#1c00cf","#007400"]},Tgi=new el("Xcode","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:dc.Background,color:dc.Foreground},"xml .hljs-meta":{color:dc.Gray},"hljs-comment":{color:dc.Comment},"hljs-quote":{color:dc.Comment},"hljs-tag":{color:dc.AccentPurple},"hljs-attribute":{color:dc.AccentPurple},"hljs-keyword":{color:dc.AccentPurple},"hljs-selector-tag":{color:dc.AccentPurple},"hljs-literal":{color:dc.AccentPurple},"hljs-name":{color:dc.AccentPurple},"hljs-variable":{color:dc.AccentCyan},"hljs-template-variable":{color:dc.AccentCyan},"hljs-code":{color:dc.AccentRed},"hljs-string":{color:dc.AccentRed},"hljs-meta-string":{color:dc.AccentRed},"hljs-regexp":{color:dc.LightBlue},"hljs-link":{color:dc.LightBlue},"hljs-title":{color:dc.AccentBlue},"hljs-symbol":{color:dc.AccentBlue},"hljs-bullet":{color:dc.AccentBlue},"hljs-number":{color:dc.AccentBlue},"hljs-section":{color:dc.AccentYellow},"hljs-meta":{color:dc.AccentYellow},"hljs-class .hljs-title":{color:dc.AccentPurple},"hljs-type":{color:dc.AccentPurple},"hljs-built_in":{color:dc.AccentPurple},"hljs-builtin-name":{color:dc.AccentPurple},"hljs-params":{color:dc.AccentPurple},"hljs-attr":{color:dc.AccentYellow},"hljs-subst":{color:dc.Foreground},"hljs-formula":{backgroundColor:"#eee",fontStyle:"italic"},"hljs-addition":{backgroundColor:"#baeeba"},"hljs-deletion":{backgroundColor:"#ffc8bd"},"hljs-selector-id":{color:dc.AccentYellow},"hljs-selector-class":{color:dc.AccentYellow},"hljs-doctag":{fontWeight:"bold"},"hljs-strong":{fontWeight:"bold"},"hljs-emphasis":{fontStyle:"italic"}},dc)});var f6a,Dgi,Rgi=q(()=>{"use strict";b1();f6a={type:"dark",Background:"black",UserMessageBackground:"#3C3C3C",UserMessageColor:"#c0c0c0",Foreground:"white",LightBlue:"bluebright",AccentBlue:"blue",AccentPurple:"magenta",AccentCyan:"cyan",AccentGreen:"green",AccentYellow:"yellow",AccentRed:"red",DiffAdded:"#003300",DiffRemoved:"#4D0000",Comment:"gray",Gray:"gray",GradientColors:["cyan","green"]},Dgi=new el("ANSI","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:"black",color:"white"},"hljs-keyword":{color:"blue"},"hljs-literal":{color:"blue"},"hljs-symbol":{color:"blue"},"hljs-name":{color:"blue"},"hljs-link":{color:"blue"},"hljs-built_in":{color:"cyan"},"hljs-type":{color:"cyan"},"hljs-number":{color:"green"},"hljs-class":{color:"green"},"hljs-string":{color:"yellow"},"hljs-meta-string":{color:"yellow"},"hljs-regexp":{color:"red"},"hljs-template-tag":{color:"red"},"hljs-subst":{color:"white"},"hljs-function":{color:"white"},"hljs-title":{color:"white"},"hljs-params":{color:"white"},"hljs-formula":{color:"white"},"hljs-comment":{color:"green"},"hljs-quote":{color:"green"},"hljs-doctag":{color:"green"},"hljs-meta":{color:"gray"},"hljs-meta-keyword":{color:"gray"},"hljs-tag":{color:"gray"},"hljs-variable":{color:"magenta"},"hljs-template-variable":{color:"magenta"},"hljs-attr":{color:"bluebright"},"hljs-attribute":{color:"bluebright"},"hljs-builtin-name":{color:"bluebright"},"hljs-section":{color:"yellow"},"hljs-emphasis":{},"hljs-strong":{},"hljs-bullet":{color:"yellow"},"hljs-selector-tag":{color:"yellow"},"hljs-selector-id":{color:"yellow"},"hljs-selector-class":{color:"yellow"},"hljs-selector-attr":{color:"yellow"},"hljs-selector-pseudo":{color:"yellow"}},f6a)});var p6a,kgi,Ngi=q(()=>{"use strict";b1();p6a={type:"light",Background:"white",UserMessageBackground:"#F5F5F5",UserMessageColor:"#6a6a6a",Foreground:"#444",LightBlue:"blue",AccentBlue:"blue",AccentPurple:"purple",AccentCyan:"cyan",AccentGreen:"green",AccentYellow:"orange",AccentRed:"red",DiffAdded:"#E5F2E5",DiffRemoved:"#FFE5E5",Comment:"gray",Gray:"gray",GradientColors:["blue","green"]},kgi=new el("ANSI Light","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:"white",color:"black"},"hljs-keyword":{color:"blue"},"hljs-literal":{color:"blue"},"hljs-symbol":{color:"blue"},"hljs-name":{color:"blue"},"hljs-link":{color:"blue"},"hljs-built_in":{color:"cyan"},"hljs-type":{color:"cyan"},"hljs-number":{color:"green"},"hljs-class":{color:"green"},"hljs-string":{color:"red"},"hljs-meta-string":{color:"red"},"hljs-regexp":{color:"magenta"},"hljs-template-tag":{color:"magenta"},"hljs-subst":{color:"black"},"hljs-function":{color:"black"},"hljs-title":{color:"black"},"hljs-params":{color:"black"},"hljs-formula":{color:"black"},"hljs-comment":{color:"gray"},"hljs-quote":{color:"gray"},"hljs-doctag":{color:"gray"},"hljs-meta":{color:"gray"},"hljs-meta-keyword":{color:"gray"},"hljs-tag":{color:"gray"},"hljs-variable":{color:"purple"},"hljs-template-variable":{color:"purple"},"hljs-attr":{color:"blue"},"hljs-attribute":{color:"blue"},"hljs-builtin-name":{color:"blue"},"hljs-section":{color:"orange"},"hljs-bullet":{color:"orange"},"hljs-selector-tag":{color:"orange"},"hljs-selector-id":{color:"orange"},"hljs-selector-class":{color:"orange"},"hljs-selector-attr":{color:"orange"},"hljs-selector-pseudo":{color:"orange"}},p6a)});var h6a,Ogi,Bgi=q(()=>{"use strict";b1();h6a={type:"ansi",Background:"",Foreground:"",LightBlue:"",AccentBlue:"",AccentPurple:"",AccentCyan:"",AccentGreen:"",AccentYellow:"",AccentRed:"",DiffAdded:"",DiffRemoved:"",Comment:"",Gray:""},Ogi=new el("NoColor","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em"},"hljs-keyword":{},"hljs-literal":{},"hljs-symbol":{},"hljs-name":{},"hljs-link":{textDecoration:"underline"},"hljs-built_in":{},"hljs-type":{},"hljs-number":{},"hljs-class":{},"hljs-string":{},"hljs-meta-string":{},"hljs-regexp":{},"hljs-template-tag":{},"hljs-subst":{},"hljs-function":{},"hljs-title":{},"hljs-params":{},"hljs-formula":{},"hljs-comment":{fontStyle:"italic"},"hljs-quote":{fontStyle:"italic"},"hljs-doctag":{},"hljs-meta":{},"hljs-meta-keyword":{},"hljs-tag":{},"hljs-variable":{},"hljs-template-variable":{},"hljs-attr":{},"hljs-attribute":{},"hljs-builtin-name":{},"hljs-section":{},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"},"hljs-bullet":{},"hljs-selector-tag":{},"hljs-selector-id":{},"hljs-selector-class":{},"hljs-selector-attr":{},"hljs-selector-pseudo":{},"hljs-addition":{display:"inline-block",width:"100%"},"hljs-deletion":{display:"inline-block",width:"100%"}},h6a)});import*as Mot from"node:fs";import*as S4e from"node:path";import*as Pgi from"node:os";import m6a from"node:process";var J8,Xsr,ta,qF=q(()=>{"use strict";fgi();hgi();ggi();ygi();Egi();bgi();Sgi();Fir();Lir();wgi();Igi();b1();Rgi();Ngi();Bgi();qt();J8=dle,Xsr=class{availableThemes;activeTheme;customThemes=new Map;constructor(){this.availableThemes=[dgi,pgi,mgi,Agi,Wbe,dle,_gi,vgi,Cgi,xgi,Tgi,Dgi,kgi],this.activeTheme=J8}loadCustomThemes(e){if(this.customThemes.clear(),!!e){for(let[r,n]of Object.entries(e)){let o=Mir(n);if(o.isValid){o.warning&&$m.warn(`Theme "${r}": ${o.warning}`);let s={...J8.colors,...n,name:n.name||r,type:"custom"};try{let a=Pir(s);this.customThemes.set(r,a)}catch(a){$m.warn(`Failed to load custom theme "${r}":`,a)}}else $m.warn(`Invalid custom theme "${r}": ${o.error}`)}this.activeTheme&&this.activeTheme.type==="custom"&&this.customThemes.has(this.activeTheme.name)&&(this.activeTheme=this.customThemes.get(this.activeTheme.name))}}setActiveTheme(e){let r=this.findThemeByName(e);return r?(this.activeTheme=r,!0):!1}getActiveTheme(){if(m6a.env.NO_COLOR)return Ogi;if(this.activeTheme){let e=this.availableThemes.some(n=>n.name===this.activeTheme.name),r=[...this.customThemes.values()].includes(this.activeTheme);if(e||r)return this.activeTheme}return this.activeTheme=J8,this.activeTheme}getSemanticColors(){return this.getActiveTheme().semanticColors}getCustomThemeNames(){return Array.from(this.customThemes.keys())}isCustomTheme(e){return this.customThemes.has(e)}getAvailableThemes(){let e=this.availableThemes.map(s=>({name:s.name,type:s.type,isCustom:!1})),r=Array.from(this.customThemes.values()).map(s=>({name:s.name,type:s.type,isCustom:!0}));return[...e,...r].sort((s,a)=>{let c=d=>{switch(d){case"dark":return 1;case"light":return 2;case"ansi":return 3;case"custom":return 4;default:return 5}},u=c(s.type)-c(a.type);return u!==0?u:s.name.localeCompare(a.name)})}getTheme(e){return this.findThemeByName(e)}isPath(e){return e.endsWith(".json")||e.startsWith(".")||S4e.isAbsolute(e)}loadThemeFromFile(e){try{let r=Mot.realpathSync(S4e.resolve(e));if(this.customThemes.has(r))return this.customThemes.get(r);let n=S4e.resolve(Pgi.homedir());if(!r.startsWith(n)){$m.warn(`Theme file at "${e}" is outside your home directory. Only load themes from trusted sources.`);return}let o=Mot.readFileSync(r,"utf-8"),s=JSON.parse(o),a=Mir(s);if(!a.isValid){$m.warn(`Invalid custom theme from file "${e}": ${a.error}`);return}a.warning&&$m.warn(`Theme from "${e}": ${a.warning}`);let c={...J8.colors,...s,name:s.name||r,type:"custom"},u=Pir(c);return this.customThemes.set(r,u),u}catch(r){r instanceof Error&&"code"in r&&r.code==="ENOENT"||$m.warn(`Could not load theme from file "${e}":`,r);return}}findThemeByName(e){if(!e)return J8;let r=this.availableThemes.find(n=>n.name===e);if(r)return r;if(this.isPath(e))return this.loadThemeFromFile(e);if(this.customThemes.has(e))return this.customThemes.get(e)}},ta=new Xsr});var de,Nn=q(()=>{"use strict";qF();de={get type(){return ta.getActiveTheme().colors.type},get Foreground(){return ta.getActiveTheme().colors.Foreground},get Background(){return ta.getActiveTheme().colors.Background},get UserMessageColor(){return ta.getActiveTheme().colors?.UserMessageColor},get UserMessageBackground(){return ta.getActiveTheme().colors?.UserMessageBackground},get LightBlue(){return ta.getActiveTheme().colors.LightBlue},get AccentBlue(){return ta.getActiveTheme().colors.AccentBlue},get AccentPurple(){return ta.getActiveTheme().colors.AccentPurple},get AccentCyan(){return ta.getActiveTheme().colors.AccentCyan},get AccentGreen(){return ta.getActiveTheme().colors.AccentGreen},get AccentYellow(){return ta.getActiveTheme().colors.AccentYellow},get AccentRed(){return ta.getActiveTheme().colors.AccentRed},get DiffAdded(){return ta.getActiveTheme().colors.DiffAdded},get DiffRemoved(){return ta.getActiveTheme().colors.DiffRemoved},get Comment(){return ta.getActiveTheme().colors.Comment},get Gray(){return ta.getActiveTheme().colors.Gray},get GradientColors(){return ta.getActiveTheme().colors.GradientColors}}});var Fgi=I(Fot=>{"use strict";var g6a=Symbol.for("react.transitional.element"),A6a=Symbol.for("react.fragment");function Mgi(t,e,r){var n=null;if(r!==void 0&&(n=""+r),e.key!==void 0&&(n=""+e.key),"key"in e){r={};for(var o in e)o!=="key"&&(r[o]=e[o])}else r=e;return e=r.ref,{$$typeof:g6a,type:t,key:n,ref:e!==void 0?e:null,props:r}}Fot.Fragment=A6a;Fot.jsx=Mgi;Fot.jsxs=Mgi});var Pt=I((k0l,Lgi)=>{"use strict";Lgi.exports=Fgi()});import{spawn as Zgi}from"child_process";import*as Kot from"fs/promises";import*as e0i from"path";import*as t0i from"os";var r0i,n0i,i0i,o0i,Qle,s0i,OW=q(()=>{"use strict";r0i=t=>t.startsWith("@")||/\s@/.test(t),n0i=t=>{if(!t.startsWith("/")||t.startsWith("//")||t.startsWith("/*"))return!1;let e=t.substring(1);return e.includes("/")&&!/\s+\//.test(e)?!1:e===""?!0:!!e.match(/^([a-zA-Z0-9_-]+)/)},i0i=t=>t==="/init",o0i=t=>t.startsWith("$"),Qle=async t=>{let e=(n,o,s)=>new Promise((a,c)=>{let u=s?Zgi(n,o,s):Zgi(n,o),d="";u.stderr&&u.stderr.on("data",f=>d+=f.toString()),u.on("error",c),u.on("close",f=>{if(f===0)return a();let p=d.trim();c(new Error(`'${n}' exited with code ${f}${p?`: ${p}`:""}`))}),u.stdin?(u.stdin.on("error",c),u.stdin.write(t),u.stdin.end()):c(new Error("Child process has no stdin stream to write to."))}),r={stdio:["pipe","inherit","pipe"]};switch(process.platform){case"win32":return(async()=>{let n=e0i.join(t0i.tmpdir(),`iflow-clipboard-${Date.now()}.txt`);try{await Kot.writeFile(n,t,"utf8"),await e("powershell",["-NoProfile","-NonInteractive","-Command",`Get-Content -Path '${n}' -Encoding UTF8 -Raw | Set-Clipboard`])}finally{try{await Kot.unlink(n)}catch{}}})();case"darwin":return e("pbcopy",[]);case"linux":try{await e("xclip",["-selection","clipboard"],r)}catch(n){try{await e("xsel",["--clipboard","--input"],r)}catch(o){let s=n instanceof Error&&n.code==="ENOENT",a=o instanceof Error&&o.code==="ENOENT";if(s&&a)throw new Error("Please ensure xclip or xsel is installed and configured.");let c=n instanceof Error?n.message:String(n);s&&(c="xclip not found");let u=o instanceof Error?o.message:String(o);throw a&&(u="xsel not found"),new Error(`All copy commands failed. "${c}", "${u}". `)}}return;default:throw new Error(`Unsupported platform: ${process.platform}`)}},s0i=()=>{let t;switch(process.platform){case"darwin":t="open";break;case"win32":t="start";break;case"linux":t="xdg-open";break;default:t="xdg-open",console.warn(`Unknown platform: ${process.platform}. Attempting to open URLs with: ${t}.`);break}return t}});var u0i=I((r2l,P6a)=>{P6a.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var p0i=I((n2l,f0i)=>{"use strict";var Xot=Object.assign({},u0i()),d0i=Object.keys(Xot);Object.defineProperty(Xot,"random",{get(){let t=Math.floor(Math.random()*d0i.length),e=d0i[t];return Xot[e]}});f0i.exports=Xot});function nl(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=e;if(n||(t=Sd(t)),t.length===0)return 0;let o=0,s={ambiguousAsWide:!r};for(let{segment:a}of L6a.segment(t)){let c=a.codePointAt(0);if(!(c<=31||c>=127&&c<=159)&&!(c>=8203&&c<=8207||c===65279)&&!(c>=768&&c<=879||c>=6832&&c<=6911||c>=7616&&c<=7679||c>=8400&&c<=8447||c>=65056&&c<=65071)&&!(c>=55296&&c<=57343)&&!(c>=65024&&c<=65039)&&!U6a.test(a)){if((0,C0i.default)().test(a)){o+=2;continue}o+=pv(c,s)}}return o}var C0i,L6a,U6a,zF=q(()=>{SC();lU();C0i=we(g5e(),1),L6a=new Intl.Segmenter,U6a=/^\p{Default_Ignorable_Code_Point}$/u});var B0i=I(($1l,O0i)=>{"use strict";var q6a="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";O0i.exports=q6a});var L0i=I((G1l,F0i)=>{"use strict";var H6a=B0i();function P0i(){}function M0i(){}M0i.resetWarningCache=P0i;F0i.exports=function(){function t(n,o,s,a,c,u){if(u!==H6a){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}t.isRequired=t;function e(){return t}var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:M0i,resetWarningCache:P0i};return r.PropTypes=r,r}});var Q0i=I((V1l,U0i)=>{U0i.exports=L0i()();var q1l,H1l});var j0i=I((lar,uar)=>{(function(t,e){typeof lar=="object"&&typeof uar<"u"?uar.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t.tinycolor=e())})(lar,(function(){"use strict";function t(le){"@babel/helpers - typeof";return t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Ce){return typeof Ce}:function(Ce){return Ce&&typeof Symbol=="function"&&Ce.constructor===Symbol&&Ce!==Symbol.prototype?"symbol":typeof Ce},t(le)}var e=/^\s+/,r=/\s+$/;function n(le,Ce){if(le=le||"",Ce=Ce||{},le instanceof n)return le;if(!(this instanceof n))return new n(le,Ce);var ee=o(le);this._originalInput=le,this._r=ee.r,this._g=ee.g,this._b=ee.b,this._a=ee.a,this._roundA=Math.round(100*this._a)/100,this._format=Ce.format||ee.format,this._gradientType=Ce.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=ee.ok}n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var Ce=this.toRgb();return(Ce.r*299+Ce.g*587+Ce.b*114)/1e3},getLuminance:function(){var Ce=this.toRgb(),ee,ie,se,ye,oe,me;return ee=Ce.r/255,ie=Ce.g/255,se=Ce.b/255,ee<=.03928?ye=ee/12.92:ye=Math.pow((ee+.055)/1.055,2.4),ie<=.03928?oe=ie/12.92:oe=Math.pow((ie+.055)/1.055,2.4),se<=.03928?me=se/12.92:me=Math.pow((se+.055)/1.055,2.4),.2126*ye+.7152*oe+.0722*me},setAlpha:function(Ce){return this._a=Q(Ce),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var Ce=u(this._r,this._g,this._b);return{h:Ce.h*360,s:Ce.s,v:Ce.v,a:this._a}},toHsvString:function(){var Ce=u(this._r,this._g,this._b),ee=Math.round(Ce.h*360),ie=Math.round(Ce.s*100),se=Math.round(Ce.v*100);return this._a==1?"hsv("+ee+", "+ie+"%, "+se+"%)":"hsva("+ee+", "+ie+"%, "+se+"%, "+this._roundA+")"},toHsl:function(){var Ce=a(this._r,this._g,this._b);return{h:Ce.h*360,s:Ce.s,l:Ce.l,a:this._a}},toHslString:function(){var Ce=a(this._r,this._g,this._b),ee=Math.round(Ce.h*360),ie=Math.round(Ce.s*100),se=Math.round(Ce.l*100);return this._a==1?"hsl("+ee+", "+ie+"%, "+se+"%)":"hsla("+ee+", "+ie+"%, "+se+"%, "+this._roundA+")"},toHex:function(Ce){return f(this._r,this._g,this._b,Ce)},toHexString:function(Ce){return"#"+this.toHex(Ce)},toHex8:function(Ce){return p(this._r,this._g,this._b,this._a,Ce)},toHex8String:function(Ce){return"#"+this.toHex8(Ce)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(F(this._r,255)*100)+"%",g:Math.round(F(this._g,255)*100)+"%",b:Math.round(F(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(F(this._r,255)*100)+"%, "+Math.round(F(this._g,255)*100)+"%, "+Math.round(F(this._b,255)*100)+"%)":"rgba("+Math.round(F(this._r,255)*100)+"%, "+Math.round(F(this._g,255)*100)+"%, "+Math.round(F(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:N[f(this._r,this._g,this._b,!0)]||!1},toFilter:function(Ce){var ee="#"+h(this._r,this._g,this._b,this._a),ie=ee,se=this._gradientType?"GradientType = 1, ":"";if(Ce){var ye=n(Ce);ie="#"+h(ye._r,ye._g,ye._b,ye._a)}return"progid:DXImageTransform.Microsoft.gradient("+se+"startColorstr="+ee+",endColorstr="+ie+")"},toString:function(Ce){var ee=!!Ce;Ce=Ce||this._format;var ie=!1,se=this._a<1&&this._a>=0,ye=!ee&&se&&(Ce==="hex"||Ce==="hex6"||Ce==="hex3"||Ce==="hex4"||Ce==="hex8"||Ce==="name");return ye?Ce==="name"&&this._a===0?this.toName():this.toRgbString():(Ce==="rgb"&&(ie=this.toRgbString()),Ce==="prgb"&&(ie=this.toPercentageRgbString()),(Ce==="hex"||Ce==="hex6")&&(ie=this.toHexString()),Ce==="hex3"&&(ie=this.toHexString(!0)),Ce==="hex4"&&(ie=this.toHex8String(!0)),Ce==="hex8"&&(ie=this.toHex8String()),Ce==="name"&&(ie=this.toName()),Ce==="hsl"&&(ie=this.toHslString()),Ce==="hsv"&&(ie=this.toHsvString()),ie||this.toHexString())},clone:function(){return n(this.toString())},_applyModification:function(Ce,ee){var ie=Ce.apply(null,[this].concat([].slice.call(ee)));return this._r=ie._r,this._g=ie._g,this._b=ie._b,this.setAlpha(ie._a),this},lighten:function(){return this._applyModification(y,arguments)},brighten:function(){return this._applyModification(E,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(m,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(A,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(Ce,ee){return Ce.apply(null,[this].concat([].slice.call(ee)))},analogous:function(){return this._applyCombination(D,arguments)},complement:function(){return this._applyCombination(S,arguments)},monochromatic:function(){return this._applyCombination(P,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(w,[3])},tetrad:function(){return this._applyCombination(w,[4])}},n.fromRatio=function(le,Ce){if(t(le)=="object"){var ee={};for(var ie in le)le.hasOwnProperty(ie)&&(ie==="a"?ee[ie]=le[ie]:ee[ie]=L(le[ie]));le=ee}return n(le,Ce)};function o(le){var Ce={r:0,g:0,b:0},ee=1,ie=null,se=null,ye=null,oe=!1,me=!1;return typeof le=="string"&&(le=ae(le)),t(le)=="object"&&(K(le.r)&&K(le.g)&&K(le.b)?(Ce=s(le.r,le.g,le.b),oe=!0,me=String(le.r).substr(-1)==="%"?"prgb":"rgb"):K(le.h)&&K(le.s)&&K(le.v)?(ie=L(le.s),se=L(le.v),Ce=d(le.h,ie,se),oe=!0,me="hsv"):K(le.h)&&K(le.s)&&K(le.l)&&(ie=L(le.s),ye=L(le.l),Ce=c(le.h,ie,ye),oe=!0,me="hsl"),le.hasOwnProperty("a")&&(ee=le.a)),ee=Q(ee),{ok:oe,format:le.format||me,r:Math.min(255,Math.max(Ce.r,0)),g:Math.min(255,Math.max(Ce.g,0)),b:Math.min(255,Math.max(Ce.b,0)),a:ee}}function s(le,Ce,ee){return{r:F(le,255)*255,g:F(Ce,255)*255,b:F(ee,255)*255}}function a(le,Ce,ee){le=F(le,255),Ce=F(Ce,255),ee=F(ee,255);var ie=Math.max(le,Ce,ee),se=Math.min(le,Ce,ee),ye,oe,me=(ie+se)/2;if(ie==se)ye=oe=0;else{var ge=ie-se;switch(oe=me>.5?ge/(2-ie-se):ge/(ie+se),ie){case le:ye=(Ce-ee)/ge+(Ce<ee?6:0);break;case Ce:ye=(ee-le)/ge+2;break;case ee:ye=(le-Ce)/ge+4;break}ye/=6}return{h:ye,s:oe,l:me}}function c(le,Ce,ee){var ie,se,ye;le=F(le,360),Ce=F(Ce,100),ee=F(ee,100);function oe(H,Z,Ae){return Ae<0&&(Ae+=1),Ae>1&&(Ae-=1),Ae<1/6?H+(Z-H)*6*Ae:Ae<1/2?Z:Ae<2/3?H+(Z-H)*(2/3-Ae)*6:H}if(Ce===0)ie=se=ye=ee;else{var me=ee<.5?ee*(1+Ce):ee+Ce-ee*Ce,ge=2*ee-me;ie=oe(ge,me,le+1/3),se=oe(ge,me,le),ye=oe(ge,me,le-1/3)}return{r:ie*255,g:se*255,b:ye*255}}function u(le,Ce,ee){le=F(le,255),Ce=F(Ce,255),ee=F(ee,255);var ie=Math.max(le,Ce,ee),se=Math.min(le,Ce,ee),ye,oe,me=ie,ge=ie-se;if(oe=ie===0?0:ge/ie,ie==se)ye=0;else{switch(ie){case le:ye=(Ce-ee)/ge+(Ce<ee?6:0);break;case Ce:ye=(ee-le)/ge+2;break;case ee:ye=(le-Ce)/ge+4;break}ye/=6}return{h:ye,s:oe,v:me}}function d(le,Ce,ee){le=F(le,360)*6,Ce=F(Ce,100),ee=F(ee,100);var ie=Math.floor(le),se=le-ie,ye=ee*(1-Ce),oe=ee*(1-se*Ce),me=ee*(1-(1-se)*Ce),ge=ie%6,H=[ee,oe,ye,ye,me,ee][ge],Z=[me,ee,ee,oe,ye,ye][ge],Ae=[ye,ye,me,ee,ee,oe][ge];return{r:H*255,g:Z*255,b:Ae*255}}function f(le,Ce,ee,ie){var se=[V(Math.round(le).toString(16)),V(Math.round(Ce).toString(16)),V(Math.round(ee).toString(16))];return ie&&se[0].charAt(0)==se[0].charAt(1)&&se[1].charAt(0)==se[1].charAt(1)&&se[2].charAt(0)==se[2].charAt(1)?se[0].charAt(0)+se[1].charAt(0)+se[2].charAt(0):se.join("")}function p(le,Ce,ee,ie,se){var ye=[V(Math.round(le).toString(16)),V(Math.round(Ce).toString(16)),V(Math.round(ee).toString(16)),V(X(ie))];return se&&ye[0].charAt(0)==ye[0].charAt(1)&&ye[1].charAt(0)==ye[1].charAt(1)&&ye[2].charAt(0)==ye[2].charAt(1)&&ye[3].charAt(0)==ye[3].charAt(1)?ye[0].charAt(0)+ye[1].charAt(0)+ye[2].charAt(0)+ye[3].charAt(0):ye.join("")}function h(le,Ce,ee,ie){var se=[V(X(ie)),V(Math.round(le).toString(16)),V(Math.round(Ce).toString(16)),V(Math.round(ee).toString(16))];return se.join("")}n.equals=function(le,Ce){return!le||!Ce?!1:n(le).toRgbString()==n(Ce).toRgbString()},n.random=function(){return n.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function m(le,Ce){Ce=Ce===0?0:Ce||10;var ee=n(le).toHsl();return ee.s-=Ce/100,ee.s=B(ee.s),n(ee)}function g(le,Ce){Ce=Ce===0?0:Ce||10;var ee=n(le).toHsl();return ee.s+=Ce/100,ee.s=B(ee.s),n(ee)}function A(le){return n(le).desaturate(100)}function y(le,Ce){Ce=Ce===0?0:Ce||10;var ee=n(le).toHsl();return ee.l+=Ce/100,ee.l=B(ee.l),n(ee)}function E(le,Ce){Ce=Ce===0?0:Ce||10;var ee=n(le).toRgb();return ee.r=Math.max(0,Math.min(255,ee.r-Math.round(255*-(Ce/100)))),ee.g=Math.max(0,Math.min(255,ee.g-Math.round(255*-(Ce/100)))),ee.b=Math.max(0,Math.min(255,ee.b-Math.round(255*-(Ce/100)))),n(ee)}function v(le,Ce){Ce=Ce===0?0:Ce||10;var ee=n(le).toHsl();return ee.l-=Ce/100,ee.l=B(ee.l),n(ee)}function b(le,Ce){var ee=n(le).toHsl(),ie=(ee.h+Ce)%360;return ee.h=ie<0?360+ie:ie,n(ee)}function S(le){var Ce=n(le).toHsl();return Ce.h=(Ce.h+180)%360,n(Ce)}function w(le,Ce){if(isNaN(Ce)||Ce<=0)throw new Error("Argument to polyad must be a positive number");for(var ee=n(le).toHsl(),ie=[n(le)],se=360/Ce,ye=1;ye<Ce;ye++)ie.push(n({h:(ee.h+ye*se)%360,s:ee.s,l:ee.l}));return ie}function k(le){var Ce=n(le).toHsl(),ee=Ce.h;return[n(le),n({h:(ee+72)%360,s:Ce.s,l:Ce.l}),n({h:(ee+216)%360,s:Ce.s,l:Ce.l})]}function D(le,Ce,ee){Ce=Ce||6,ee=ee||30;var ie=n(le).toHsl(),se=360/ee,ye=[n(le)];for(ie.h=(ie.h-(se*Ce>>1)+720)%360;--Ce;)ie.h=(ie.h+se)%360,ye.push(n(ie));return ye}function P(le,Ce){Ce=Ce||6;for(var ee=n(le).toHsv(),ie=ee.h,se=ee.s,ye=ee.v,oe=[],me=1/Ce;Ce--;)oe.push(n({h:ie,s:se,v:ye})),ye=(ye+me)%1;return oe}n.mix=function(le,Ce,ee){ee=ee===0?0:ee||50;var ie=n(le).toRgb(),se=n(Ce).toRgb(),ye=ee/100,oe={r:(se.r-ie.r)*ye+ie.r,g:(se.g-ie.g)*ye+ie.g,b:(se.b-ie.b)*ye+ie.b,a:(se.a-ie.a)*ye+ie.a};return n(oe)},n.readability=function(le,Ce){var ee=n(le),ie=n(Ce);return(Math.max(ee.getLuminance(),ie.getLuminance())+.05)/(Math.min(ee.getLuminance(),ie.getLuminance())+.05)},n.isReadable=function(le,Ce,ee){var ie=n.readability(le,Ce),se,ye;switch(ye=!1,se=be(ee),se.level+se.size){case"AAsmall":case"AAAlarge":ye=ie>=4.5;break;case"AAlarge":ye=ie>=3;break;case"AAAsmall":ye=ie>=7;break}return ye},n.mostReadable=function(le,Ce,ee){var ie=null,se=0,ye,oe,me,ge;ee=ee||{},oe=ee.includeFallbackColors,me=ee.level,ge=ee.size;for(var H=0;H<Ce.length;H++)ye=n.readability(le,Ce[H]),ye>se&&(se=ye,ie=n(Ce[H]));return n.isReadable(le,ie,{level:me,size:ge})||!oe?ie:(ee.includeFallbackColors=!1,n.mostReadable(le,["#fff","#000"],ee))};var T=n.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},N=n.hexNames=O(T);function O(le){var Ce={};for(var ee in le)le.hasOwnProperty(ee)&&(Ce[le[ee]]=ee);return Ce}function Q(le){return le=parseFloat(le),(isNaN(le)||le<0||le>1)&&(le=1),le}function F(le,Ce){j(le)&&(le="100%");var ee=Y(le);return le=Math.min(Ce,Math.max(0,parseFloat(le))),ee&&(le=parseInt(le*Ce,10)/100),Math.abs(le-Ce)<1e-6?1:le%Ce/parseFloat(Ce)}function B(le){return Math.min(1,Math.max(0,le))}function G(le){return parseInt(le,16)}function j(le){return typeof le=="string"&&le.indexOf(".")!=-1&&parseFloat(le)===1}function Y(le){return typeof le=="string"&&le.indexOf("%")!=-1}function V(le){return le.length==1?"0"+le:""+le}function L(le){return le<=1&&(le=le*100+"%"),le}function X(le){return Math.round(parseFloat(le)*255).toString(16)}function J(le){return G(le)/255}var z=(function(){var le="[-\\+]?\\d+%?",Ce="[-\\+]?\\d*\\.\\d+%?",ee="(?:"+Ce+")|(?:"+le+")",ie="[\\s|\\(]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")\\s*\\)?",se="[\\s|\\(]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")\\s*\\)?";return{CSS_UNIT:new RegExp(ee),rgb:new RegExp("rgb"+ie),rgba:new RegExp("rgba"+se),hsl:new RegExp("hsl"+ie),hsla:new RegExp("hsla"+se),hsv:new RegExp("hsv"+ie),hsva:new RegExp("hsva"+se),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function K(le){return!!z.CSS_UNIT.exec(le)}function ae(le){le=le.replace(e,"").replace(r,"").toLowerCase();var Ce=!1;if(T[le])le=T[le],Ce=!0;else if(le=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ee;return(ee=z.rgb.exec(le))?{r:ee[1],g:ee[2],b:ee[3]}:(ee=z.rgba.exec(le))?{r:ee[1],g:ee[2],b:ee[3],a:ee[4]}:(ee=z.hsl.exec(le))?{h:ee[1],s:ee[2],l:ee[3]}:(ee=z.hsla.exec(le))?{h:ee[1],s:ee[2],l:ee[3],a:ee[4]}:(ee=z.hsv.exec(le))?{h:ee[1],s:ee[2],v:ee[3]}:(ee=z.hsva.exec(le))?{h:ee[1],s:ee[2],v:ee[3],a:ee[4]}:(ee=z.hex8.exec(le))?{r:G(ee[1]),g:G(ee[2]),b:G(ee[3]),a:J(ee[4]),format:Ce?"name":"hex8"}:(ee=z.hex6.exec(le))?{r:G(ee[1]),g:G(ee[2]),b:G(ee[3]),format:Ce?"name":"hex"}:(ee=z.hex4.exec(le))?{r:G(ee[1]+""+ee[1]),g:G(ee[2]+""+ee[2]),b:G(ee[3]+""+ee[3]),a:J(ee[4]+""+ee[4]),format:Ce?"name":"hex8"}:(ee=z.hex3.exec(le))?{r:G(ee[1]+""+ee[1]),g:G(ee[2]+""+ee[2]),b:G(ee[3]+""+ee[3]),format:Ce?"name":"hex"}:!1}function be(le){var Ce,ee;return le=le||{level:"AA",size:"small"},Ce=(le.level||"AA").toUpperCase(),ee=(le.size||"small").toLowerCase(),Ce!=="AA"&&Ce!=="AAA"&&(Ce="AA"),ee!=="small"&&ee!=="large"&&(ee="small"),{level:Ce,size:ee}}return n}))});var z0i=I((W1l,W0i)=>{var D4e=j0i(),H0i={r:256,g:256,b:256,a:1},V0i={h:360,s:1,v:1,a:1};function par(t,e,r){let n={};for(let o in t)t.hasOwnProperty(o)&&(n[o]=r===0?0:(e[o]-t[o])/r);return n}function har(t,e,r,n){let o={};for(let s in e)e.hasOwnProperty(s)&&(o[s]=t[s]*r+e[s],o[s]=o[s]<0?o[s]+n[s]:n[s]!==1?o[s]%n[s]:o[s]);return o}function dar(t,e,r){let n=t.color.toRgb(),o=e.color.toRgb(),s=par(n,o,r),a=[t.color];for(let c=1;c<r;c++){let u=har(s,n,c,H0i);a.push(D4e(u))}return a}function $0i(t,e,r,n){let o=t.color.toHsv(),s=e.color.toHsv();if(o.s===0||s.s===0)return dar(t,e,r);let a;if(typeof n=="boolean")a=n;else{let f=o.h<s.h&&s.h-o.h<180||o.h>s.h&&o.h-s.h>180;a=n==="long"&&f||n==="short"&&!f}let c=par(o,s,r),u=[t.color],d;o.h<=s.h&&!a||o.h>=s.h&&a?d=s.h-o.h:a?d=360-s.h+o.h:d=360-o.h+s.h,c.h=Math.pow(-1,a?1:0)*Math.abs(d)/r;for(let f=1;f<r;f++){let p=har(c,o,f,V0i);u.push(D4e(p))}return u}function G0i(t,e){let r=t.length;if(e=parseInt(e,10),isNaN(e)||e<2)throw new Error("Invalid number of steps (< 2)");if(e<r)throw new Error("Number of steps cannot be inferior to number of stops");let n=[];for(let s=1;s<r;s++){let a=(e-1)*(t[s].pos-t[s-1].pos);n.push(Math.max(1,Math.round(a)))}let o=1;for(let s=r-1;s--;)o+=n[s];for(;o!==e;)if(o<e){let s=Math.min.apply(null,n);n[n.indexOf(s)]++,o++}else{let s=Math.max.apply(null,n);n[n.indexOf(s)]--,o--}return n}function q0i(t,e,r,n){if(e<0||e>1)throw new Error("Position must be between 0 and 1");let o,s;for(let u=0,d=t.length;u<d-1;u++)if(e>=t[u].pos&&e<t[u+1].pos){o=t[u],s=t[u+1];break}o||(o=s=t[t.length-1]);let a=par(o.color[r](),s.color[r](),(s.pos-o.pos)*100),c=har(a,o.color[r](),(e-o.pos)*100,n);return D4e(c)}var far=class t{constructor(e){if(e.length<2)throw new Error("Invalid number of stops (< 2)");let r=e[0].pos!==void 0,n=e.length,o=-1,s=!1;this.stops=e.map((a,c)=>{let u=a.pos!==void 0;if(r^u)throw new Error("Cannot mix positionned and not posionned color stops");if(u){let d=a.color!==void 0;if(!d&&(s||c===0||c===n-1))throw new Error("Cannot define two consecutive position-only stops");if(s=!d,a={color:d?D4e(a.color):null,colorLess:!d,pos:a.pos},a.pos<0||a.pos>1)throw new Error("Color stops positions must be between 0 and 1");if(a.pos<o)throw new Error("Color stops positions are not ordered");o=a.pos}else a={color:D4e(a.color!==void 0?a.color:a),pos:c/(n-1)};return a}),this.stops[0].pos!==0&&(this.stops.unshift({color:this.stops[0].color,pos:0}),n++),this.stops[n-1].pos!==1&&this.stops.push({color:this.stops[n-1].color,pos:1})}reverse(){let e=[];return this.stops.forEach(function(r){e.push({color:r.color,pos:1-r.pos})}),new t(e.reverse())}loop(){let e=[],r=[];return this.stops.forEach(n=>{e.push({color:n.color,pos:n.pos/2})}),this.stops.slice(0,-1).forEach(n=>{r.push({color:n.color,pos:1-n.pos/2})}),new t(e.concat(r.reverse()))}rgb(e){let r=G0i(this.stops,e),n=[];this.stops.forEach((o,s)=>{o.colorLess&&(o.color=dar(this.stops[s-1],this.stops[s+1],2)[1])});for(let o=0,s=this.stops.length;o<s-1;o++){let a=dar(this.stops[o],this.stops[o+1],r[o]);n.splice(n.length,0,...a)}return n.push(this.stops[this.stops.length-1].color),n}hsv(e,r){let n=G0i(this.stops,e),o=[];this.stops.forEach((s,a)=>{s.colorLess&&(s.color=$0i(this.stops[a-1],this.stops[a+1],2,r)[1])});for(let s=0,a=this.stops.length;s<a-1;s++){let c=$0i(this.stops[s],this.stops[s+1],n[s],r);o.splice(o.length,0,...c)}return o.push(this.stops[this.stops.length-1].color),o}css(e,r){e=e||"linear",r=r||(e==="linear"?"to right":"ellipse at center");let n=e+"-gradient("+r;return this.stops.forEach(function(o){n+=", "+(o.colorLess?"":o.color.toRgbString()+" ")+o.pos*100+"%"}),n+=")",n}rgbAt(e){return q0i(this.stops,e,"toRgb",H0i)}hsvAt(e){return q0i(this.stops,e,"toHsv",V0i)}};W0i.exports=function(t){if(arguments.length===1){if(!Array.isArray(arguments[0]))throw new Error('"stops" is not an array');t=arguments[0]}else t=Array.prototype.slice.call(arguments);return new far(t)}});var qle,I1,X5=q(()=>{"use strict";qle=t=>{let e=t/1073741824;return t<1048576?`${(t/1024).toFixed(1)} KB`:t<1073741824?`${(t/1048576).toFixed(1)} MB`:`${e.toFixed(2)} GB`},I1=t=>{if(t<=0)return"0s";if(t<1e3)return`${Math.round(t)}ms`;let e=t/1e3;if(e<60)return`${e.toFixed(1)}s`;let r=Math.floor(e/3600),n=Math.floor(e%3600/60),o=Math.floor(e%60),s=[];return r>0&&s.push(`${r}h`),n>0&&s.push(`${n}m`),o>0&&s.push(`${o}s`),s.length===0?r>0?`${r}h`:n>0?`${n}m`:`${o}s`:s.join(" ")}});var F2i=I((S_l,M2i)=>{function S2i(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{let r=t[e],n=typeof r;(n==="object"||n==="function")&&!Object.isFrozen(r)&&S2i(r)}),t}var pst=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function x2i(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function KF(t,...e){let r=Object.create(null);for(let n in t)r[n]=t[n];return e.forEach(function(n){for(let o in n)r[o]=n[o]}),r}var Wva="</span>",y2i=t=>!!t.scope,zva=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let r=t.split(".");return[`${e}${r.shift()}`,...r.map((n,o)=>`${n}${"_".repeat(o+1)}`)].join(" ")}return`${e}${t}`},Tar=class{constructor(e,r){this.buffer="",this.classPrefix=r.classPrefix,e.walk(this)}addText(e){this.buffer+=x2i(e)}openNode(e){if(!y2i(e))return;let r=zva(e.scope,{prefix:this.classPrefix});this.span(r)}closeNode(e){y2i(e)&&(this.buffer+=Wva)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},_2i=(t={})=>{let e={children:[]};return Object.assign(e,t),e},Iar=class t{constructor(){this.rootNode=_2i(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let r=_2i({scope:e});this.add(r),this.stack.push(r)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,r){return typeof r=="string"?e.addText(r):r.children&&(e.openNode(r),r.children.forEach(n=>this._walk(e,n)),e.closeNode(r)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(r=>typeof r=="string")?e.children=[e.children.join("")]:e.children.forEach(r=>{t._collapse(r)}))}},Dar=class extends Iar{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,r){let n=e.root;r&&(n.scope=`language:${r}`),this.add(n)}toHTML(){return new Tar(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function P4e(t){return t?typeof t=="string"?t:t.source:null}function w2i(t){return LW("(?=",t,")")}function Yva(t){return LW("(?:",t,")*")}function Kva(t){return LW("(?:",t,")?")}function LW(...t){return t.map(r=>P4e(r)).join("")}function Xva(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function kar(...t){return"("+(Xva(t).capture?"":"?:")+t.map(n=>P4e(n)).join("|")+")"}function T2i(t){return new RegExp(t.toString()+"|").exec("").length-1}function Jva(t,e){let r=t&&t.exec(e);return r&&r.index===0}var Zva=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Nar(t,{joinWith:e}){let r=0;return t.map(n=>{r+=1;let o=r,s=P4e(n),a="";for(;s.length>0;){let c=Zva.exec(s);if(!c){a+=s;break}a+=s.substring(0,c.index),s=s.substring(c.index+c[0].length),c[0][0]==="\\"&&c[1]?a+="\\"+String(Number(c[1])+o):(a+=c[0],c[0]==="("&&r++)}return a}).map(n=>`(${n})`).join(e)}var eba=/\b\B/,I2i="[a-zA-Z]\\w*",Oar="[a-zA-Z_]\\w*",D2i="\\b\\d+(\\.\\d+)?",R2i="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",k2i="\\b(0b[01]+)",tba="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",rba=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=LW(e,/.*\b/,t.binary,/\b.*/)),KF({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(r,n)=>{r.index!==0&&n.ignoreMatch()}},t)},M4e={begin:"\\\\[\\s\\S]",relevance:0},nba={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[M4e]},iba={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[M4e]},oba={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},mst=function(t,e,r={}){let n=KF({scope:"comment",begin:t,end:e,contains:[]},r);n.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let o=kar("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return n.contains.push({begin:LW(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),n},sba=mst("//","$"),aba=mst("/\\*","\\*/"),cba=mst("#","$"),lba={scope:"number",begin:D2i,relevance:0},uba={scope:"number",begin:R2i,relevance:0},dba={scope:"number",begin:k2i,relevance:0},fba={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[M4e,{begin:/\[/,end:/\]/,relevance:0,contains:[M4e]}]},pba={scope:"title",begin:I2i,relevance:0},hba={scope:"title",begin:Oar,relevance:0},mba={begin:"\\.\\s*"+Oar,relevance:0},gba=function(t){return Object.assign(t,{"on:begin":(e,r)=>{r.data._beginMatch=e[1]},"on:end":(e,r)=>{r.data._beginMatch!==e[1]&&r.ignoreMatch()}})},fst=Object.freeze({__proto__:null,APOS_STRING_MODE:nba,BACKSLASH_ESCAPE:M4e,BINARY_NUMBER_MODE:dba,BINARY_NUMBER_RE:k2i,COMMENT:mst,C_BLOCK_COMMENT_MODE:aba,C_LINE_COMMENT_MODE:sba,C_NUMBER_MODE:uba,C_NUMBER_RE:R2i,END_SAME_AS_BEGIN:gba,HASH_COMMENT_MODE:cba,IDENT_RE:I2i,MATCH_NOTHING_RE:eba,METHOD_GUARD:mba,NUMBER_MODE:lba,NUMBER_RE:D2i,PHRASAL_WORDS_MODE:oba,QUOTE_STRING_MODE:iba,REGEXP_MODE:fba,RE_STARTERS_RE:tba,SHEBANG:rba,TITLE_MODE:pba,UNDERSCORE_IDENT_RE:Oar,UNDERSCORE_TITLE_MODE:hba});function Aba(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function yba(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function _ba(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=Aba,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function Eba(t,e){Array.isArray(t.illegal)&&(t.illegal=kar(...t.illegal))}function vba(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function bba(t,e){t.relevance===void 0&&(t.relevance=1)}var Cba=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");let r=Object.assign({},t);Object.keys(t).forEach(n=>{delete t[n]}),t.keywords=r.keywords,t.begin=LW(r.beforeMatch,w2i(r.begin)),t.starts={relevance:0,contains:[Object.assign(r,{endsParent:!0})]},t.relevance=0,delete r.beforeMatch},Sba=["of","and","for","in","not","or","if","then","parent","list","value"],xba="keyword";function N2i(t,e,r=xba){let n=Object.create(null);return typeof t=="string"?o(r,t.split(" ")):Array.isArray(t)?o(r,t):Object.keys(t).forEach(function(s){Object.assign(n,N2i(t[s],e,s))}),n;function o(s,a){e&&(a=a.map(c=>c.toLowerCase())),a.forEach(function(c){let u=c.split("|");n[u[0]]=[s,wba(u[0],u[1])]})}}function wba(t,e){return e?Number(e):Tba(t)?0:1}function Tba(t){return Sba.includes(t.toLowerCase())}var E2i={},FW=t=>{console.error(t)},v2i=(t,...e)=>{console.log(`WARN: ${t}`,...e)},Kle=(t,e)=>{E2i[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),E2i[`${t}/${e}`]=!0)},hst=new Error;function O2i(t,e,{key:r}){let n=0,o=t[r],s={},a={};for(let c=1;c<=e.length;c++)a[c+n]=o[c],s[c+n]=!0,n+=T2i(e[c-1]);t[r]=a,t[r]._emit=s,t[r]._multi=!0}function Iba(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw FW("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),hst;if(typeof t.beginScope!="object"||t.beginScope===null)throw FW("beginScope must be object"),hst;O2i(t,t.begin,{key:"beginScope"}),t.begin=Nar(t.begin,{joinWith:""})}}function Dba(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw FW("skip, excludeEnd, returnEnd not compatible with endScope: {}"),hst;if(typeof t.endScope!="object"||t.endScope===null)throw FW("endScope must be object"),hst;O2i(t,t.end,{key:"endScope"}),t.end=Nar(t.end,{joinWith:""})}}function Rba(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function kba(t){Rba(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),Iba(t),Dba(t)}function Nba(t){function e(a,c){return new RegExp(P4e(a),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(c?"g":""))}class r{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(c,u){u.position=this.position++,this.matchIndexes[this.matchAt]=u,this.regexes.push([u,c]),this.matchAt+=T2i(c)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let c=this.regexes.map(u=>u[1]);this.matcherRe=e(Nar(c,{joinWith:"|"}),!0),this.lastIndex=0}exec(c){this.matcherRe.lastIndex=this.lastIndex;let u=this.matcherRe.exec(c);if(!u)return null;let d=u.findIndex((p,h)=>h>0&&p!==void 0),f=this.matchIndexes[d];return u.splice(0,d),Object.assign(u,f)}}class n{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(c){if(this.multiRegexes[c])return this.multiRegexes[c];let u=new r;return this.rules.slice(c).forEach(([d,f])=>u.addRule(d,f)),u.compile(),this.multiRegexes[c]=u,u}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(c,u){this.rules.push([c,u]),u.type==="begin"&&this.count++}exec(c){let u=this.getMatcher(this.regexIndex);u.lastIndex=this.lastIndex;let d=u.exec(c);if(this.resumingScanAtSamePosition()&&!(d&&d.index===this.lastIndex)){let f=this.getMatcher(0);f.lastIndex=this.lastIndex+1,d=f.exec(c)}return d&&(this.regexIndex+=d.position+1,this.regexIndex===this.count&&this.considerAll()),d}}function o(a){let c=new n;return a.contains.forEach(u=>c.addRule(u.begin,{rule:u,type:"begin"})),a.terminatorEnd&&c.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&c.addRule(a.illegal,{type:"illegal"}),c}function s(a,c){let u=a;if(a.isCompiled)return u;[yba,vba,kba,Cba].forEach(f=>f(a,c)),t.compilerExtensions.forEach(f=>f(a,c)),a.__beforeBegin=null,[_ba,Eba,bba].forEach(f=>f(a,c)),a.isCompiled=!0;let d=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),d=a.keywords.$pattern,delete a.keywords.$pattern),d=d||/\w+/,a.keywords&&(a.keywords=N2i(a.keywords,t.case_insensitive)),u.keywordPatternRe=e(d,!0),c&&(a.begin||(a.begin=/\B|\b/),u.beginRe=e(u.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(u.endRe=e(u.end)),u.terminatorEnd=P4e(u.end)||"",a.endsWithParent&&c.terminatorEnd&&(u.terminatorEnd+=(a.end?"|":"")+c.terminatorEnd)),a.illegal&&(u.illegalRe=e(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(f){return Oba(f==="self"?a:f)})),a.contains.forEach(function(f){s(f,u)}),a.starts&&s(a.starts,c),u.matcher=o(u),u}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=KF(t.classNameAliases||{}),s(t)}function B2i(t){return t?t.endsWithParent||B2i(t.starts):!1}function Oba(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return KF(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:B2i(t)?KF(t,{starts:t.starts?KF(t.starts):null}):Object.isFrozen(t)?KF(t):t}var Bba="11.11.1",Rar=class extends Error{constructor(e,r){super(e),this.name="HTMLInjectionError",this.html=r}},war=x2i,b2i=KF,C2i=Symbol("nomatch"),Pba=7,P2i=function(t){let e=Object.create(null),r=Object.create(null),n=[],o=!0,s="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]},c={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Dar};function u(j){return c.noHighlightRe.test(j)}function d(j){let Y=j.className+" ";Y+=j.parentNode?j.parentNode.className:"";let V=c.languageDetectRe.exec(Y);if(V){let L=P(V[1]);return L||(v2i(s.replace("{}",V[1])),v2i("Falling back to no-highlight mode for this block.",j)),L?V[1]:"no-highlight"}return Y.split(/\s+/).find(L=>u(L)||P(L))}function f(j,Y,V){let L="",X="";typeof Y=="object"?(L=j,V=Y.ignoreIllegals,X=Y.language):(Kle("10.7.0","highlight(lang, code, ...args) has been deprecated."),Kle("10.7.0",`Please use highlight(code, options) instead.
5234
5234
  https://github.com/highlightjs/highlight.js/issues/2277`),X=j,L=Y),V===void 0&&(V=!0);let J={code:L,language:X};B("before:highlight",J);let z=J.result?J.result:p(J.language,J.code,V);return z.code=J.code,B("after:highlight",z),z}function p(j,Y,V,L){let X=Object.create(null);function J(Ie,Oe){return Ie.keywords[Oe]}function z(){if(!Ee.keywords){Fe.addText(Qe);return}let Ie=0;Ee.keywordPatternRe.lastIndex=0;let Oe=Ee.keywordPatternRe.exec(Qe),De="";for(;Oe;){De+=Qe.substring(Ie,Oe.index);let Re=H.case_insensitive?Oe[0].toLowerCase():Oe[0],je=J(Ee,Re);if(je){let[qe,Je]=je;if(Fe.addText(De),De="",X[Re]=(X[Re]||0)+1,X[Re]<=Pba&&(We+=Je),qe.startsWith("_"))De+=Oe[0];else{let At=H.classNameAliases[qe]||qe;be(Oe[0],At)}}else De+=Oe[0];Ie=Ee.keywordPatternRe.lastIndex,Oe=Ee.keywordPatternRe.exec(Qe)}De+=Qe.substring(Ie),Fe.addText(De)}function K(){if(Qe==="")return;let Ie=null;if(typeof Ee.subLanguage=="string"){if(!e[Ee.subLanguage]){Fe.addText(Qe);return}Ie=p(Ee.subLanguage,Qe,!0,he[Ee.subLanguage]),he[Ee.subLanguage]=Ie._top}else Ie=m(Qe,Ee.subLanguage.length?Ee.subLanguage:null);Ee.relevance>0&&(We+=Ie.relevance),Fe.__addSublanguage(Ie._emitter,Ie.language)}function ae(){Ee.subLanguage!=null?K():z(),Qe=""}function be(Ie,Oe){Ie!==""&&(Fe.startScope(Oe),Fe.addText(Ie),Fe.endScope())}function le(Ie,Oe){let De=1,Re=Oe.length-1;for(;De<=Re;){if(!Ie._emit[De]){De++;continue}let je=H.classNameAliases[Ie[De]]||Ie[De],qe=Oe[De];je?be(qe,je):(Qe=qe,z(),Qe=""),De++}}function Ce(Ie,Oe){return Ie.scope&&typeof Ie.scope=="string"&&Fe.openNode(H.classNameAliases[Ie.scope]||Ie.scope),Ie.beginScope&&(Ie.beginScope._wrap?(be(Qe,H.classNameAliases[Ie.beginScope._wrap]||Ie.beginScope._wrap),Qe=""):Ie.beginScope._multi&&(le(Ie.beginScope,Oe),Qe="")),Ee=Object.create(Ie,{parent:{value:Ee}}),Ee}function ee(Ie,Oe,De){let Re=Jva(Ie.endRe,De);if(Re){if(Ie["on:end"]){let je=new pst(Ie);Ie["on:end"](Oe,je),je.isMatchIgnored&&(Re=!1)}if(Re){for(;Ie.endsParent&&Ie.parent;)Ie=Ie.parent;return Ie}}if(Ie.endsWithParent)return ee(Ie.parent,Oe,De)}function ie(Ie){return Ee.matcher.regexIndex===0?(Qe+=Ie[0],1):(xe=!0,0)}function se(Ie){let Oe=Ie[0],De=Ie.rule,Re=new pst(De),je=[De.__beforeBegin,De["on:begin"]];for(let qe of je)if(qe&&(qe(Ie,Re),Re.isMatchIgnored))return ie(Oe);return De.skip?Qe+=Oe:(De.excludeBegin&&(Qe+=Oe),ae(),!De.returnBegin&&!De.excludeBegin&&(Qe=Oe)),Ce(De,Ie),De.returnBegin?0:Oe.length}function ye(Ie){let Oe=Ie[0],De=Y.substring(Ie.index),Re=ee(Ee,Ie,De);if(!Re)return C2i;let je=Ee;Ee.endScope&&Ee.endScope._wrap?(ae(),be(Oe,Ee.endScope._wrap)):Ee.endScope&&Ee.endScope._multi?(ae(),le(Ee.endScope,Ie)):je.skip?Qe+=Oe:(je.returnEnd||je.excludeEnd||(Qe+=Oe),ae(),je.excludeEnd&&(Qe=Oe));do Ee.scope&&Fe.closeNode(),!Ee.skip&&!Ee.subLanguage&&(We+=Ee.relevance),Ee=Ee.parent;while(Ee!==Re.parent);return Re.starts&&Ce(Re.starts,Ie),je.returnEnd?0:Oe.length}function oe(){let Ie=[];for(let Oe=Ee;Oe!==H;Oe=Oe.parent)Oe.scope&&Ie.unshift(Oe.scope);Ie.forEach(Oe=>Fe.openNode(Oe))}let me={};function ge(Ie,Oe){let De=Oe&&Oe[0];if(Qe+=Ie,De==null)return ae(),0;if(me.type==="begin"&&Oe.type==="end"&&me.index===Oe.index&&De===""){if(Qe+=Y.slice(Oe.index,Oe.index+1),!o){let Re=new Error(`0 width match regex (${j})`);throw Re.languageName=j,Re.badRule=me.rule,Re}return 1}if(me=Oe,Oe.type==="begin")return se(Oe);if(Oe.type==="illegal"&&!V){let Re=new Error('Illegal lexeme "'+De+'" for mode "'+(Ee.scope||"<unnamed>")+'"');throw Re.mode=Ee,Re}else if(Oe.type==="end"){let Re=ye(Oe);if(Re!==C2i)return Re}if(Oe.type==="illegal"&&De==="")return Qe+=`
5235
- `,1;if(fe>1e5&&fe>Oe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Qe+=De,De.length}let H=P(j);if(!H)throw FW(s.replace("{}",j)),new Error('Unknown language: "'+j+'"');let Z=Nba(H),Ae="",Ee=L||Z,he={},Fe=new c.__emitter(c);oe();let Qe="",We=0,Ye=0,fe=0,xe=!1;try{if(H.__emitTokens)H.__emitTokens(Y,Fe);else{for(Ee.matcher.considerAll();;){fe++,xe?xe=!1:Ee.matcher.considerAll(),Ee.matcher.lastIndex=Ye;let Ie=Ee.matcher.exec(Y);if(!Ie)break;let Oe=Y.substring(Ye,Ie.index),De=ge(Oe,Ie);Ye=Ie.index+De}ge(Y.substring(Ye))}return Fe.finalize(),Ae=Fe.toHTML(),{language:j,value:Ae,relevance:We,illegal:!1,_emitter:Fe,_top:Ee}}catch(Ie){if(Ie.message&&Ie.message.includes("Illegal"))return{language:j,value:war(Y),illegal:!0,relevance:0,_illegalBy:{message:Ie.message,index:Ye,context:Y.slice(Ye-100,Ye+100),mode:Ie.mode,resultSoFar:Ae},_emitter:Fe};if(o)return{language:j,value:war(Y),illegal:!1,relevance:0,errorRaised:Ie,_emitter:Fe,_top:Ee};throw Ie}}function h(j){let Y={value:war(j),illegal:!1,relevance:0,_top:a,_emitter:new c.__emitter(c)};return Y._emitter.addText(j),Y}function m(j,Y){Y=Y||c.languages||Object.keys(e);let V=h(j),L=Y.filter(P).filter(N).map(ae=>p(ae,j,!1));L.unshift(V);let X=L.sort((ae,be)=>{if(ae.relevance!==be.relevance)return be.relevance-ae.relevance;if(ae.language&&be.language){if(P(ae.language).supersetOf===be.language)return 1;if(P(be.language).supersetOf===ae.language)return-1}return 0}),[J,z]=X,K=J;return K.secondBest=z,K}function g(j,Y,V){let L=Y&&r[Y]||V;j.classList.add("hljs"),j.classList.add(`language-${L}`)}function A(j){let Y=null,V=d(j);if(u(V))return;if(B("before:highlightElement",{el:j,language:V}),j.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",j);return}if(j.children.length>0&&(c.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(j)),c.throwUnescapedHTML))throw new Rar("One of your code blocks includes unescaped HTML.",j.innerHTML);Y=j;let L=Y.textContent,X=V?f(L,{language:V,ignoreIllegals:!0}):m(L);j.innerHTML=X.value,j.dataset.highlighted="yes",g(j,V,X.language),j.result={language:X.language,re:X.relevance,relevance:X.relevance},X.secondBest&&(j.secondBest={language:X.secondBest.language,relevance:X.secondBest.relevance}),B("after:highlightElement",{el:j,result:X,text:L})}function y(j){c=b2i(c,j)}let E=()=>{S(),Kle("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function v(){S(),Kle("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let b=!1;function S(){function j(){S()}if(document.readyState==="loading"){b||window.addEventListener("DOMContentLoaded",j,!1),b=!0;return}document.querySelectorAll(c.cssSelector).forEach(A)}function w(j,Y){let V=null;try{V=Y(t)}catch(L){if(FW("Language definition for '{}' could not be registered.".replace("{}",j)),o)FW(L);else throw L;V=a}V.name||(V.name=j),e[j]=V,V.rawDefinition=Y.bind(null,t),V.aliases&&T(V.aliases,{languageName:j})}function k(j){delete e[j];for(let Y of Object.keys(r))r[Y]===j&&delete r[Y]}function D(){return Object.keys(e)}function P(j){return j=(j||"").toLowerCase(),e[j]||e[r[j]]}function T(j,{languageName:Y}){typeof j=="string"&&(j=[j]),j.forEach(V=>{r[V.toLowerCase()]=Y})}function N(j){let Y=P(j);return Y&&!Y.disableAutodetect}function O(j){j["before:highlightBlock"]&&!j["before:highlightElement"]&&(j["before:highlightElement"]=Y=>{j["before:highlightBlock"](Object.assign({block:Y.el},Y))}),j["after:highlightBlock"]&&!j["after:highlightElement"]&&(j["after:highlightElement"]=Y=>{j["after:highlightBlock"](Object.assign({block:Y.el},Y))})}function Q(j){O(j),n.push(j)}function F(j){let Y=n.indexOf(j);Y!==-1&&n.splice(Y,1)}function B(j,Y){let V=j;n.forEach(function(L){L[V]&&L[V](Y)})}function G(j){return Kle("10.7.0","highlightBlock will be removed entirely in v12.0"),Kle("10.7.0","Please use highlightElement now."),A(j)}Object.assign(t,{highlight:f,highlightAuto:m,highlightAll:S,highlightElement:A,highlightBlock:G,configure:y,initHighlighting:E,initHighlightingOnLoad:v,registerLanguage:w,unregisterLanguage:k,listLanguages:D,getLanguage:P,registerAliases:T,autoDetection:N,inherit:b2i,addPlugin:Q,removePlugin:F}),t.debugMode=function(){o=!1},t.safeMode=function(){o=!0},t.versionString=Bba,t.regex={concat:LW,lookahead:w2i,either:kar,optional:Kva,anyNumberOfTimes:Yva};for(let j in fst)typeof fst[j]=="object"&&S2i(fst[j]);return Object.assign(t,fst),t},Xle=P2i({});Xle.newInstance=()=>P2i({});M2i.exports=Xle;Xle.HighlightJS=Xle;Xle.default=Xle});var rue,Zar=q(()=>{"use strict";rue="66e461c (local modifications)"});async function Y1i(){return Lst?Ust:new Promise(t=>{if(!process.stdin.isTTY||!process.stdout.isTTY){Lst=!0,t(!1);return}let e=process.stdin.isRaw;e||process.stdin.setRawMode(!0);let r="",n=!1,o,s=()=>{o=void 0,process.stdin.removeListener("data",a),e||process.stdin.setRawMode(!1),Lst=!0,t(!1)},a=c=>{o!==void 0&&(r+=c.toString(),r.includes("\x1B[?")&&r.includes("u")&&(n=!0,clearTimeout(o),o=setTimeout(s,1e3)),r.includes("\x1B[?")&&r.includes("c")&&(clearTimeout(o),o=void 0,process.stdin.removeListener("data",a),e||process.stdin.setRawMode(!1),n&&(process.stdout.write("\x1B[>1u"),Ust=!0,Qst=!0,process.on("exit",z1i),process.on("SIGTERM",z1i)),Lst=!0,t(Ust)))};process.stdin.on("data",a),process.stdout.write("\x1B[?u"),process.stdout.write("\x1B[c"),o=setTimeout(s,200)})}function z1i(){Qst&&(process.stdout.write("\x1B[<u"),Qst=!1)}function jst(){return Qst}function K1i(){return Ust}var Lst,Ust,Qst,$st=q(()=>{"use strict";Lst=!1,Ust=!1,Qst=!1});var nL,aat=q(()=>{"use strict";nL=class t{constructor(e){this.commands=e}static async create(e,r){let n=await Promise.allSettled(e.map(c=>c.loadCommands(r))),o=[];for(let c of n)c.status==="fulfilled"?o.push(...c.value):console.debug("A command loader failed:",c.reason);let s=new Map;for(let c of o){let u=c.name;if(c.extensionName&&s.has(c.name)){let d=`${c.extensionName}.${c.name}`,f=1;for(;s.has(d);)d=`${c.extensionName}.${c.name}${f}`,f++;u=d}s.set(u,{...c,name:u})}let a=Object.freeze(Array.from(s.values()));return new t(a)}getCommands(){return this.commands}}});var Ns=q(()=>{"use strict";});import XW from"node:process";var B3i,P3i=q(()=>{"use strict";y4e();Ns();ks();qt();B3i={name:"about",description:R.t("command.about"),kind:"built-in",action:async t=>{let e=XW.platform,r=R.t("aboutCommand.noSandbox");XW.env.SANDBOX&&XW.env.SANDBOX!=="sandbox-exec"?r=XW.env.SANDBOX:XW.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${XW.env.SEATBELT_PROFILE||R.t("aboutCommand.unknown")})`);let n=t.services.config?.getModel()||R.t("aboutCommand.unknown"),o=await GF(),s=t.services.settings.merged.selectedAuthType||"",a=XW.env.GOOGLE_CLOUD_PROJECT||"",c={type:"about",cliVersion:o,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:s,gcpProject:a};t.ui.addItem(c,Date.now())}}});function cat(t,e,r,n=!1){let o="";if(t.length===0)return o="\u{1F534} ",`${o}${e}
5235
+ `,1;if(fe>1e5&&fe>Oe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Qe+=De,De.length}let H=P(j);if(!H)throw FW(s.replace("{}",j)),new Error('Unknown language: "'+j+'"');let Z=Nba(H),Ae="",Ee=L||Z,he={},Fe=new c.__emitter(c);oe();let Qe="",We=0,Ye=0,fe=0,xe=!1;try{if(H.__emitTokens)H.__emitTokens(Y,Fe);else{for(Ee.matcher.considerAll();;){fe++,xe?xe=!1:Ee.matcher.considerAll(),Ee.matcher.lastIndex=Ye;let Ie=Ee.matcher.exec(Y);if(!Ie)break;let Oe=Y.substring(Ye,Ie.index),De=ge(Oe,Ie);Ye=Ie.index+De}ge(Y.substring(Ye))}return Fe.finalize(),Ae=Fe.toHTML(),{language:j,value:Ae,relevance:We,illegal:!1,_emitter:Fe,_top:Ee}}catch(Ie){if(Ie.message&&Ie.message.includes("Illegal"))return{language:j,value:war(Y),illegal:!0,relevance:0,_illegalBy:{message:Ie.message,index:Ye,context:Y.slice(Ye-100,Ye+100),mode:Ie.mode,resultSoFar:Ae},_emitter:Fe};if(o)return{language:j,value:war(Y),illegal:!1,relevance:0,errorRaised:Ie,_emitter:Fe,_top:Ee};throw Ie}}function h(j){let Y={value:war(j),illegal:!1,relevance:0,_top:a,_emitter:new c.__emitter(c)};return Y._emitter.addText(j),Y}function m(j,Y){Y=Y||c.languages||Object.keys(e);let V=h(j),L=Y.filter(P).filter(N).map(ae=>p(ae,j,!1));L.unshift(V);let X=L.sort((ae,be)=>{if(ae.relevance!==be.relevance)return be.relevance-ae.relevance;if(ae.language&&be.language){if(P(ae.language).supersetOf===be.language)return 1;if(P(be.language).supersetOf===ae.language)return-1}return 0}),[J,z]=X,K=J;return K.secondBest=z,K}function g(j,Y,V){let L=Y&&r[Y]||V;j.classList.add("hljs"),j.classList.add(`language-${L}`)}function A(j){let Y=null,V=d(j);if(u(V))return;if(B("before:highlightElement",{el:j,language:V}),j.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",j);return}if(j.children.length>0&&(c.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(j)),c.throwUnescapedHTML))throw new Rar("One of your code blocks includes unescaped HTML.",j.innerHTML);Y=j;let L=Y.textContent,X=V?f(L,{language:V,ignoreIllegals:!0}):m(L);j.innerHTML=X.value,j.dataset.highlighted="yes",g(j,V,X.language),j.result={language:X.language,re:X.relevance,relevance:X.relevance},X.secondBest&&(j.secondBest={language:X.secondBest.language,relevance:X.secondBest.relevance}),B("after:highlightElement",{el:j,result:X,text:L})}function y(j){c=b2i(c,j)}let E=()=>{S(),Kle("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function v(){S(),Kle("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let b=!1;function S(){function j(){S()}if(document.readyState==="loading"){b||window.addEventListener("DOMContentLoaded",j,!1),b=!0;return}document.querySelectorAll(c.cssSelector).forEach(A)}function w(j,Y){let V=null;try{V=Y(t)}catch(L){if(FW("Language definition for '{}' could not be registered.".replace("{}",j)),o)FW(L);else throw L;V=a}V.name||(V.name=j),e[j]=V,V.rawDefinition=Y.bind(null,t),V.aliases&&T(V.aliases,{languageName:j})}function k(j){delete e[j];for(let Y of Object.keys(r))r[Y]===j&&delete r[Y]}function D(){return Object.keys(e)}function P(j){return j=(j||"").toLowerCase(),e[j]||e[r[j]]}function T(j,{languageName:Y}){typeof j=="string"&&(j=[j]),j.forEach(V=>{r[V.toLowerCase()]=Y})}function N(j){let Y=P(j);return Y&&!Y.disableAutodetect}function O(j){j["before:highlightBlock"]&&!j["before:highlightElement"]&&(j["before:highlightElement"]=Y=>{j["before:highlightBlock"](Object.assign({block:Y.el},Y))}),j["after:highlightBlock"]&&!j["after:highlightElement"]&&(j["after:highlightElement"]=Y=>{j["after:highlightBlock"](Object.assign({block:Y.el},Y))})}function Q(j){O(j),n.push(j)}function F(j){let Y=n.indexOf(j);Y!==-1&&n.splice(Y,1)}function B(j,Y){let V=j;n.forEach(function(L){L[V]&&L[V](Y)})}function G(j){return Kle("10.7.0","highlightBlock will be removed entirely in v12.0"),Kle("10.7.0","Please use highlightElement now."),A(j)}Object.assign(t,{highlight:f,highlightAuto:m,highlightAll:S,highlightElement:A,highlightBlock:G,configure:y,initHighlighting:E,initHighlightingOnLoad:v,registerLanguage:w,unregisterLanguage:k,listLanguages:D,getLanguage:P,registerAliases:T,autoDetection:N,inherit:b2i,addPlugin:Q,removePlugin:F}),t.debugMode=function(){o=!1},t.safeMode=function(){o=!0},t.versionString=Bba,t.regex={concat:LW,lookahead:w2i,either:kar,optional:Kva,anyNumberOfTimes:Yva};for(let j in fst)typeof fst[j]=="object"&&S2i(fst[j]);return Object.assign(t,fst),t},Xle=P2i({});Xle.newInstance=()=>P2i({});M2i.exports=Xle;Xle.HighlightJS=Xle;Xle.default=Xle});var rue,Zar=q(()=>{"use strict";rue="24356fe (local modifications)"});async function Y1i(){return Lst?Ust:new Promise(t=>{if(!process.stdin.isTTY||!process.stdout.isTTY){Lst=!0,t(!1);return}let e=process.stdin.isRaw;e||process.stdin.setRawMode(!0);let r="",n=!1,o,s=()=>{o=void 0,process.stdin.removeListener("data",a),e||process.stdin.setRawMode(!1),Lst=!0,t(!1)},a=c=>{o!==void 0&&(r+=c.toString(),r.includes("\x1B[?")&&r.includes("u")&&(n=!0,clearTimeout(o),o=setTimeout(s,1e3)),r.includes("\x1B[?")&&r.includes("c")&&(clearTimeout(o),o=void 0,process.stdin.removeListener("data",a),e||process.stdin.setRawMode(!1),n&&(process.stdout.write("\x1B[>1u"),Ust=!0,Qst=!0,process.on("exit",z1i),process.on("SIGTERM",z1i)),Lst=!0,t(Ust)))};process.stdin.on("data",a),process.stdout.write("\x1B[?u"),process.stdout.write("\x1B[c"),o=setTimeout(s,200)})}function z1i(){Qst&&(process.stdout.write("\x1B[<u"),Qst=!1)}function jst(){return Qst}function K1i(){return Ust}var Lst,Ust,Qst,$st=q(()=>{"use strict";Lst=!1,Ust=!1,Qst=!1});var nL,aat=q(()=>{"use strict";nL=class t{constructor(e){this.commands=e}static async create(e,r){let n=await Promise.allSettled(e.map(c=>c.loadCommands(r))),o=[];for(let c of n)c.status==="fulfilled"?o.push(...c.value):console.debug("A command loader failed:",c.reason);let s=new Map;for(let c of o){let u=c.name;if(c.extensionName&&s.has(c.name)){let d=`${c.extensionName}.${c.name}`,f=1;for(;s.has(d);)d=`${c.extensionName}.${c.name}${f}`,f++;u=d}s.set(u,{...c,name:u})}let a=Object.freeze(Array.from(s.values()));return new t(a)}getCommands(){return this.commands}}});var Ns=q(()=>{"use strict";});import XW from"node:process";var B3i,P3i=q(()=>{"use strict";y4e();Ns();ks();qt();B3i={name:"about",description:R.t("command.about"),kind:"built-in",action:async t=>{let e=XW.platform,r=R.t("aboutCommand.noSandbox");XW.env.SANDBOX&&XW.env.SANDBOX!=="sandbox-exec"?r=XW.env.SANDBOX:XW.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${XW.env.SEATBELT_PROFILE||R.t("aboutCommand.unknown")})`);let n=t.services.config?.getModel()||R.t("aboutCommand.unknown"),o=await GF(),s=t.services.settings.merged.selectedAuthType||"",a=XW.env.GOOGLE_CLOUD_PROJECT||"",c={type:"about",cliVersion:o,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:s,gcpProject:a};t.ui.addItem(c,Date.now())}}});function cat(t,e,r,n=!1){let o="";if(t.length===0)return o="\u{1F534} ",`${o}${e}
5236
5236
  ${F3i}${R.t("agentsCommand.list.noAgentsFound")}${ol}
5237
5237
  `;o="\u{1F7E2} ";let s=`${o}${e}
5238
5238
  `;for(let a of t)n?s+=hCa(a):s+=`${lat}- ${a.agentType}${ol}
@@ -6233,7 +6233,7 @@ ${g.join(`
6233
6233
  `,"f"),gi(this,R0,st(this,R0,"f")+e.join(" "),"f")}}}[rdr](e){que(st(this,Li,"f")).forEach(r=>{if((o=>o==="configObjects")(r))return;let n=st(this,Li,"f")[r];Array.isArray(n)?n.includes(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete st(this,ns,"f").getDescriptions()[e]}[cxi](e,r,n){st(this,Kct,"f")[n]||(st(this,No,"f").process.emitWarning(e,r),st(this,Kct,"f")[n]=!0)}[lxi](){st(this,Xct,"f").push({options:st(this,Li,"f"),configObjects:st(this,Li,"f").configObjects.slice(0),exitProcess:st(this,sC,"f"),groups:st(this,E9,"f"),strict:st(this,jz,"f"),strictCommands:st(this,$z,"f"),strictOptions:st(this,Gz,"f"),completionCommand:st(this,Y6,"f"),output:st(this,R0,"f"),exitError:st(this,xL,"f"),hasOutput:st(this,K6,"f"),parsed:this.parsed,parseFn:st(this,X6,"f"),parseContext:st(this,Uz,"f")}),st(this,ns,"f").freeze(),st(this,Bp,"f").freeze(),st(this,Eh,"f").freeze(),st(this,aC,"f").freeze()}[uxi](){let e="",r;return/\b(node|iojs|electron)(\.exe)?$/.test(st(this,No,"f").process.argv()[0])?r=st(this,No,"f").process.argv().slice(1,2):r=st(this,No,"f").process.argv().slice(0,1),e=r.map(n=>{let o=this[Cxi](st(this,Fz,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&o.length<n.length?o:n}).join(" ").trim(),st(this,No,"f").getEnv("_")&&st(this,No,"f").getProcessArgvBin()===st(this,No,"f").getEnv("_")&&(e=st(this,No,"f").getEnv("_").replace(`${st(this,No,"f").path.dirname(st(this,No,"f").process.execPath())}/`,"")),e}[qz](){return st(this,elt,"f")}[dxi](){return st(this,rlt,"f")}[ndr](){if(!st(this,Lz,"f"))return;let e=st(this,No,"f").getEnv("LC_ALL")||st(this,No,"f").getEnv("LC_MESSAGES")||st(this,No,"f").getEnv("LANG")||st(this,No,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[fxi](){return this[idr]().version||"unknown"}[pxi](e){let r=e["--"]?e["--"]:e._;for(let n=0,o;(o=r[n])!==void 0;n++)st(this,No,"f").Parser.looksLikeNumber(o)&&Number.isSafeInteger(Math.floor(parseFloat(`${o}`)))&&(r[n]=Number(o));return e}[idr](e){let r=e||"*";if(st(this,Yue,"f")[r])return st(this,Yue,"f")[r];let n={};try{let o=e||st(this,No,"f").mainFilename;!e&&st(this,No,"f").path.extname(o)&&(o=st(this,No,"f").path.dirname(o));let s=st(this,No,"f").findUp(o,(a,c)=>{if(c.includes("package.json"))return"package.json"});Z3(s,void 0,st(this,No,"f")),n=JSON.parse(st(this,No,"f").readFileSync(s,"utf8"))}catch{}return st(this,Yue,"f")[r]=n||{},st(this,Yue,"f")[r]}[TL](e,r){r=[].concat(r),r.forEach(n=>{n=this[adr](n),st(this,Li,"f")[e].push(n)})}[Kue](e,r,n,o){this[sdr](e,r,n,o,(s,a,c)=>{st(this,Li,"f")[s][a]=c})}[odr](e,r,n,o){this[sdr](e,r,n,o,(s,a,c)=>{st(this,Li,"f")[s][a]=(st(this,Li,"f")[s][a]||[]).concat(c)})}[sdr](e,r,n,o,s){if(Array.isArray(n))n.forEach(a=>{e(a,o)});else if((a=>typeof a=="object")(n))for(let a of que(n))e(a,n[a]);else s(r,this[adr](n),o)}[adr](e){return e==="__proto__"?"___proto___":e}[cdr](e,r){return this[Kue](this[cdr].bind(this),"key",e,r),this}[ldr](){var e,r,n,o,s,a,c,u,d,f,p,h;let m=st(this,Xct,"f").pop();Z3(m,void 0,st(this,No,"f"));let g;e=this,r=this,n=this,o=this,s=this,a=this,c=this,u=this,d=this,f=this,p=this,h=this,{options:{set value(A){gi(e,Li,A,"f")}}.value,configObjects:g,exitProcess:{set value(A){gi(r,sC,A,"f")}}.value,groups:{set value(A){gi(n,E9,A,"f")}}.value,output:{set value(A){gi(o,R0,A,"f")}}.value,exitError:{set value(A){gi(s,xL,A,"f")}}.value,hasOutput:{set value(A){gi(a,K6,A,"f")}}.value,parsed:this.parsed,strict:{set value(A){gi(c,jz,A,"f")}}.value,strictCommands:{set value(A){gi(u,$z,A,"f")}}.value,strictOptions:{set value(A){gi(d,Gz,A,"f")}}.value,completionCommand:{set value(A){gi(f,Y6,A,"f")}}.value,parseFn:{set value(A){gi(p,X6,A,"f")}}.value,parseContext:{set value(A){gi(h,Uz,A,"f")}}.value}=m,st(this,Li,"f").configObjects=g,st(this,ns,"f").unfreeze(),st(this,Bp,"f").unfreeze(),st(this,Eh,"f").unfreeze(),st(this,aC,"f").unfreeze()}[hxi](e,r){return Mz(r,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[mxi].bind(this),getContext:this[gxi].bind(this),getHasOutput:this[Axi].bind(this),getLoggerInstance:this[yxi].bind(this),getParseContext:this[_xi].bind(this),getParserConfiguration:this[qz].bind(this),getUsageConfiguration:this[dxi].bind(this),getUsageInstance:this[Exi].bind(this),getValidationInstance:this[vxi].bind(this),hasParseCallback:this[nlt].bind(this),isGlobalContext:this[bxi].bind(this),postProcess:this[Hz].bind(this),reset:this[udr].bind(this),runValidation:this[ddr].bind(this),runYargsParserAndExecuteCommands:this[FCe].bind(this),setHasOutput:this[Sxi].bind(this)}}[mxi](){return st(this,Eh,"f")}[gxi](){return st(this,MCe,"f")}[Axi](){return st(this,K6,"f")}[yxi](){return st(this,zue,"f")}[_xi](){return st(this,Uz,"f")||{}}[Exi](){return st(this,ns,"f")}[vxi](){return st(this,Bp,"f")}[nlt](){return!!st(this,X6,"f")}[bxi](){return st(this,Jct,"f")}[Hz](e,r,n,o){return n||Xd(e)||(r||(e=this[sxi](e)),(this[qz]()["parse-positional-numbers"]||this[qz]()["parse-positional-numbers"]===void 0)&&(e=this[pxi](e)),o&&(e=Pz(e,this,st(this,aC,"f").getMiddleware(),!1))),e}[udr](e={}){gi(this,Li,st(this,Li,"f")||{},"f");let r={};r.local=st(this,Li,"f").local||[],r.configObjects=st(this,Li,"f").configObjects||[];let n={};r.local.forEach(a=>{n[a]=!0,(e[a]||[]).forEach(c=>{n[c]=!0})}),Object.assign(st(this,Qz,"f"),Object.keys(st(this,E9,"f")).reduce((a,c)=>{let u=st(this,E9,"f")[c].filter(d=>!(d in n));return u.length>0&&(a[c]=u),a},{})),gi(this,E9,{},"f");let o=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return o.forEach(a=>{r[a]=(st(this,Li,"f")[a]||[]).filter(c=>!n[c])}),s.forEach(a=>{r[a]=CL(st(this,Li,"f")[a],c=>!n[c])}),r.envPrefix=st(this,Li,"f").envPrefix,gi(this,Li,r,"f"),gi(this,ns,st(this,ns,"f")?st(this,ns,"f").reset(n):z5i(this,st(this,No,"f")),"f"),gi(this,Bp,st(this,Bp,"f")?st(this,Bp,"f").reset(n):ixi(this,st(this,ns,"f"),st(this,No,"f")),"f"),gi(this,Eh,st(this,Eh,"f")?st(this,Eh,"f").reset():H5i(st(this,ns,"f"),st(this,Bp,"f"),st(this,aC,"f"),st(this,No,"f")),"f"),st(this,oC,"f")||gi(this,oC,Z5i(this,st(this,ns,"f"),st(this,Eh,"f"),st(this,No,"f")),"f"),st(this,aC,"f").reset(),gi(this,Y6,null,"f"),gi(this,R0,"","f"),gi(this,xL,null,"f"),gi(this,K6,!1,"f"),this.parsed=!1,this}[Cxi](e,r){return st(this,No,"f").path.relative(e,r)}[FCe](e,r,n,o=0,s=!1){let a=!!n||s;e=e||st(this,wL,"f"),st(this,Li,"f").__=st(this,No,"f").y18n.__,st(this,Li,"f").configuration=this[qz]();let c=!!st(this,Li,"f").configuration["populate--"],u=Object.assign({},st(this,Li,"f").configuration,{"populate--":!0}),d=st(this,No,"f").Parser.detailed(e,Object.assign({},st(this,Li,"f"),{configuration:{"parse-positional-numbers":!1,...u}})),f=Object.assign(d.argv,st(this,Uz,"f")),p,h=d.aliases,m=!1,g=!1;Object.keys(f).forEach(A=>{A===st(this,cC,"f")&&f[A]?m=!0:A===st(this,v9,"f")&&f[A]&&(g=!0)}),f.$0=this.$0,this.parsed=d,o===0&&st(this,ns,"f").clearCachedHelpMessage();try{if(this[ndr](),r)return this[Hz](f,c,!!n,!1);st(this,cC,"f")&&[st(this,cC,"f")].concat(h[st(this,cC,"f")]||[]).filter(b=>b.length>1).includes(""+f._[f._.length-1])&&(f._.pop(),m=!0),gi(this,Jct,!1,"f");let A=st(this,Eh,"f").getCommands(),y=st(this,oC,"f").completionKey in f,E=m||y||s;if(f._.length){if(A.length){let v;for(let b=o||0,S;f._[b]!==void 0;b++)if(S=String(f._[b]),A.includes(S)&&S!==st(this,Y6,"f")){let w=st(this,Eh,"f").runCommand(S,this,d,b+1,s,m||g||s);return this[Hz](w,c,!!n,!1)}else if(!v&&S!==st(this,Y6,"f")){v=S;break}!st(this,Eh,"f").hasDefaultCommand()&&st(this,tlt,"f")&&v&&!E&&st(this,Bp,"f").recommendCommands(v,A)}st(this,Y6,"f")&&f._.includes(st(this,Y6,"f"))&&!y&&(st(this,sC,"f")&&SL(!0),this.showCompletionScript(),this.exit(0))}if(st(this,Eh,"f").hasDefaultCommand()&&!E){let v=st(this,Eh,"f").runCommand(null,this,d,0,s,m||g||s);return this[Hz](v,c,!!n,!1)}if(y){st(this,sC,"f")&&SL(!0),e=[].concat(e);let v=e.slice(e.indexOf(`--${st(this,oC,"f").completionKey}`)+1);return st(this,oC,"f").getCompletion(v,(b,S)=>{if(b)throw new Vd(b.message);(S||[]).forEach(w=>{st(this,zue,"f").log(w)}),this.exit(0)}),this[Hz](f,!c,!!n,!1)}if(st(this,K6,"f")||(m?(st(this,sC,"f")&&SL(!0),a=!0,this.showHelp("log"),this.exit(0)):g&&(st(this,sC,"f")&&SL(!0),a=!0,st(this,ns,"f").showVersion("log"),this.exit(0))),!a&&st(this,Li,"f").skipValidation.length>0&&(a=Object.keys(f).some(v=>st(this,Li,"f").skipValidation.indexOf(v)>=0&&f[v]===!0)),!a){if(d.error)throw new Vd(d.error.message);if(!y){let v=this[ddr](h,{},d.error);n||(p=Pz(f,this,st(this,aC,"f").getMiddleware(),!0)),p=this[hxi](v,p??f),Xd(p)&&!n&&(p=p.then(()=>Pz(f,this,st(this,aC,"f").getMiddleware(),!1)))}}}catch(A){if(A instanceof Vd)st(this,ns,"f").fail(A.message,A);else throw A}return this[Hz](p??f,c,!!n,!0)}[ddr](e,r,n,o){let s={...this.getDemandedOptions()};return a=>{if(n)throw new Vd(n.message);st(this,Bp,"f").nonOptionCount(a),st(this,Bp,"f").requiredArguments(a,s);let c=!1;st(this,$z,"f")&&(c=st(this,Bp,"f").unknownCommands(a)),st(this,jz,"f")&&!c?st(this,Bp,"f").unknownArguments(a,e,r,!!o):st(this,Gz,"f")&&st(this,Bp,"f").unknownArguments(a,e,{},!1,!1),st(this,Bp,"f").limitedChoices(a),st(this,Bp,"f").implications(a),st(this,Bp,"f").conflicting(a)}}[Sxi](){gi(this,K6,!0,"f")}[Vz](e){if(typeof e=="string")st(this,Li,"f").key[e]=!0;else for(let r of e)st(this,Li,"f").key[r]=!0}}});var pdr={};ls(pdr,{default:()=>dIa});var uIa,dIa,hdr=q(()=>{"use strict";Hor();Jur();uIa=xxi(qor),dIa=uIa});var mdr=we(tr(),1);await tn();import fIa,{basename as wxi}from"node:path";import pIa from"node:v8";import Ixi from"node:os";import hIa from"node:dns";import{spawn as mIa}from"node:child_process";import gIa from"node:fs";qt();tfe();await tn();var nn=we(tr(),1);ui();import*as Oct from"fs";import yk from"node:process";qt();Tl();var OF=t=>(Bit(),t===Jt.LOGIN_WITH_IFLOW||t===Jt.LOGIN_WITH_AONE||t===Jt.CLOUD_SHELL||[...IE,Jt.OPENAI_COMPATIBLE].includes(t)?null:"Invalid auth method selected.");import*as Qsr from"fs";import*as jsr from"path";import{homedir as YEa}from"node:os";var Pfi=we(Bfi(),1),{applyExtends:v1a,cjsPlatformShim:b1a,Parser:C1a,processArgv:S1a,Yargs:Zit}=Pfi.default;Zit.applyExtends=(t,e,r)=>v1a(t,e,r,b1a);Zit.hideBin=S1a.hideBin;Zit.Parser=C1a;var Mfi=Zit;Ror();Nor();Uor();Hor();qt();H5();import Jm from"node:process";import*as W8 from"fs";import*as xle from"path";import*as mpi from"os";var d3a=xle.join(".iflow","extensions"),f3a="iflow-extension.json";function LF(t){let e=[...hpi(t),...hpi(mpi.homedir())],r=new Map;for(let n of e)r.has(n.config.name)||r.set(n.config.name,n);return Array.from(r.values())}function hpi(t){let e=xle.join(t,d3a);if(!W8.existsSync(e))return[];let r=[];for(let n of W8.readdirSync(e)){let o=xle.join(e,n),s=p3a(o);s!=null&&r.push(s)}return r}function p3a(t){if(!W8.statSync(t).isDirectory())return console.error(`Warning: unexpected file ${t} in extensions directory.`),null;let e=xle.join(t,f3a);if(!W8.existsSync(e))return console.error(`Warning: extension directory ${t} does not contain a config file ${e}.`),null;try{let r=W8.readFileSync(e,"utf-8"),n=JSON.parse(r);if(!n.name||!n.version)return console.error(`Invalid extension config in ${e}: missing name or version.`),null;let o=h3a(n).map(s=>xle.join(t,s)).filter(s=>W8.existsSync(s));return{path:t,config:n,contextFiles:o}}catch(r){return console.error(`Warning: error parsing extension config in ${e}: ${r}`),null}}function h3a(t){if(t.contextFileName){if(!Array.isArray(t.contextFileName))return[t.contextFileName]}else return["IFLOW.md"];return t.contextFileName}function gpi(t,e){let r=[];if(e.length===0)return t.map(s=>({name:s.config.name,version:s.config.version,isActive:!0,path:s.path}));let n=new Set(e.map(s=>s.trim().toLowerCase()));if(n.size===1&&n.has("none"))return t.map(s=>({name:s.config.name,version:s.config.version,isActive:!1,path:s.path}));let o=new Set(n);for(let s of t){let a=s.config.name.toLowerCase(),c=n.has(a);c&&o.delete(a),r.push({name:s.config.name,version:s.config.version,isActive:c,path:s.path})}for(let s of o)console.error(`Extension not found: ${s}`);return r}y4e();var _4e=we(gmi(),1);A4e();import*as Ami from"node:os";var ymi=["docker","podman","sandbox-exec"];function D_a(t){return ymi.includes(t)}function R_a(t){if(process.env.SANDBOX)return"";let e=process.env.IFLOW_SANDBOX?.toLowerCase().trim()??"";if(t=e?.length>0?e:t,t==="1"||t==="true"?t=!0:(t==="0"||t==="false"||!t)&&(t=!1),t===!1)return"";if(typeof t=="string"&&t){if(D_a(t)||(console.error(`ERROR: invalid sandbox command '${t}'. Must be one of ${ymi.join(", ")}`),process.exit(1)),_4e.default.sync(t))return t;console.error(`ERROR: missing sandbox command '${t}' (from IFLOW_SANDBOX)`),process.exit(1)}return Ami.platform()==="darwin"&&_4e.default.sync("sandbox-exec")?"sandbox-exec":_4e.default.sync("docker")&&t===!0?"docker":_4e.default.sync("podman")&&t===!0?"podman":(t===!0&&(console.error("ERROR: IFLOW_SANDBOX is true but failed to determine command for sandbox; install docker or podman or specify command in IFLOW_SANDBOX"),process.exit(1)),"")}async function _mi(t,e){let r=e.sandbox??t.sandbox,n=R_a(r),o=await $F(),s=e.sandboxImage??process.env.IFLOW_SANDBOX_IMAGE??o?.config?.sandboxImageUri;return n==="sandbox-exec"?{command:n,image:s||"n/a"}:n&&s?{command:n,image:s}:void 0}Tl();qt();import*as ksr from"path";import{homedir as k_a}from"os";import*as E4e from"fs";function N_a(t){try{let e=ksr.resolve(t),r=ksr.resolve(k_a()),n=E4e.existsSync(e)?E4e.realpathSync(e):e,o=E4e.realpathSync(r);return n===o}catch{return!1}}async function O_a(t,e,r,n){let{scope:o,transport:s,env:a,header:c,timeout:u,trust:d,description:f,includeTools:p,excludeTools:h}=n,m=process.cwd();o==="project"&&N_a(m)&&(console.log(R.t("mcpAdd.info.detectedHomeDirectory")),o="user");let g=o==="user"?"User":"Workspace",A=tl(process.cwd()),y={},E=c?.reduce((w,k)=>{let[D,...P]=k.split(":"),T=P.join(":").trim();return D.trim()&&T&&(w[D.trim()]=T),w},{});switch(s){case"sse":y={url:e,headers:E,timeout:u,trust:d,description:f,includeTools:p,excludeTools:h};break;case"http":y={httpUrl:e,headers:E,timeout:u,trust:d,description:f,includeTools:p,excludeTools:h};break;case"stdio":default:y={command:e,args:r?.map(String),env:a?.reduce((w,k)=>{let[D,P]=k.split("=");return D&&P&&(w[D]=P),w},{}),timeout:u,trust:d,description:f,includeTools:p,excludeTools:h};break}let b=A.forScope(g).settings.mcpServers||{},S=!!b[t];S&&console.log(R.t("mcpAdd.info.serverAlreadyConfigured",{name:t,scope:o})),b[t]=y,A.setValue(g,"mcpServers",b),console.log(S?R.t("mcpAdd.info.serverUpdated",{name:t,scope:o}):R.t("mcpAdd.info.serverAdded",{name:t,scope:o,transport:s}))}var Emi={command:"add <name> <commandOrUrl> [args...]",describe:R.t("mcpAdd.description"),builder:t=>t.usage(R.t("mcpAdd.usage")).parserConfiguration({"unknown-options-as-args":!0,"populate--":!0}).positional("name",{describe:R.t("mcpAdd.options.name"),type:"string",demandOption:!0}).positional("commandOrUrl",{describe:R.t("mcpAdd.options.commandOrUrl"),type:"string",demandOption:!0}).option("scope",{alias:"s",describe:R.t("mcpAdd.options.scope"),type:"string",default:"project",choices:["user","project"]}).option("transport",{alias:"t",describe:R.t("mcpAdd.options.transport"),type:"string",default:"stdio",choices:["stdio","sse","http"]}).option("env",{alias:"e",describe:R.t("mcpAdd.options.env"),type:"array",string:!0}).option("header",{alias:"H",describe:R.t("mcpAdd.options.header"),type:"array",string:!0}).option("timeout",{describe:R.t("mcpAdd.options.timeout"),type:"number"}).option("trust",{describe:R.t("mcpAdd.options.trust"),type:"boolean"}).option("description",{describe:R.t("mcpAdd.options.description"),type:"string"}).option("include-tools",{describe:R.t("mcpAdd.options.includeTools"),type:"array",string:!0}).option("exclude-tools",{describe:R.t("mcpAdd.options.excludeTools"),type:"array",string:!0}).middleware(e=>{if(e["--"]){let r=e.args||[];e.args=[...r,...e["--"]]}}),handler:async t=>{await O_a(t.name,t.commandOrUrl,t.args,{scope:t.scope,transport:t.transport,env:t.env,header:t.header,timeout:t.timeout,trust:t.trust,description:t.description,includeTools:t.includeTools,excludeTools:t.excludeTools})}};Tl();qt();async function B_a(t,e){let{scope:r}=e,n=r==="user"?"User":"Workspace",o=tl(process.cwd()),a=o.forScope(n).settings.mcpServers||{};if(!a[t]){console.log(R.t("mcpRemove.errors.serverNotFound",{name:t,scope:r}));return}delete a[t],o.setValue(n,"mcpServers",a),console.log(R.t("mcpRemove.info.serverRemoved",{name:t,scope:r}))}var vmi={command:"remove <name>",describe:R.t("mcpRemove.description"),builder:t=>t.usage(R.t("mcpRemove.usage")).positional("name",{describe:R.t("mcpRemove.options.name"),type:"string",demandOption:!0}).option("scope",{alias:"s",describe:R.t("mcpRemove.options.scope"),type:"string",default:"project",choices:["user","project"]}),handler:async t=>{await B_a(t.name,{scope:t.scope})}};Tl();qt();Yee();var P_a="\x1B[32m",M_a="\x1B[33m",F_a="\x1B[31m",L_a="\x1B[90m",Cot="\x1B[0m";async function U_a(){let t=tl(process.cwd()),e=LF(process.cwd()),r={...t.merged.mcpServers||{}};for(let n of e)Object.entries(n.config.mcpServers||{}).forEach(([o,s])=>{r[o]||(r[o]={...s,extensionName:n.config.name})});return r}async function Q_a(t,e){let r=new RE({name:"mcp-test-client",version:"0.0.1"}),n;try{n=await lAe(t,e,!1)}catch{return await r.close(),Jo.DISCONNECTED}try{return await r.connect(n,{timeout:5e3}),await r.ping(),await r.close(),Jo.CONNECTED}catch{return await n.close(),Jo.DISCONNECTED}}async function j_a(t,e){return await Q_a(t,e)}async function $_a(){let t=await U_a(),e=Object.keys(t);if(e.length===0){console.log(R.t("mcpList.info.noServersConfigured"));return}console.log(R.t("mcpList.info.configuredServers"));for(let r of e){let n=t[r],o=await j_a(r,n),s="",a="";if(n?.disabled)s=L_a+"\u26A0"+Cot,a=R.t("mcpList.status.disabled");else switch(o){case Jo.CONNECTED:s=P_a+"\u2713"+Cot,a=R.t("mcpList.status.connected");break;case Jo.CONNECTING:s=M_a+"\u2026"+Cot,a=R.t("mcpList.status.connecting");break;case Jo.DISCONNECTED:default:s=F_a+"\u2717"+Cot,a=R.t("mcpList.status.disconnected");break}let c=`${r}: `;if(n.httpUrl)c+=R.t("mcpList.info.serverInfoHttp",{url:n.httpUrl});else if(n.url)c+=R.t("mcpList.info.serverInfoSse",{url:n.url});else if(n.command){let u=n.args?.join(" ")||"";c+=R.t("mcpList.info.serverInfoStdio",{command:n.command,args:u})}console.log(R.t("mcpList.info.serverStatusLine",{statusIndicator:s,serverInfo:c,statusText:a}))}}var bmi={command:"list",describe:R.t("mcpList.description"),handler:async()=>{await $_a()}};Tl();qt();import*as Nsr from"path";import{homedir as G_a}from"os";import*as v4e from"fs";import{execSync as q_a}from"child_process";function H_a(t){try{let e=Nsr.resolve(t),r=Nsr.resolve(G_a()),n=v4e.existsSync(e)?v4e.realpathSync(e):e,o=v4e.realpathSync(r);return n===o}catch{return!1}}function V_a(){try{return q_a("uv --version",{stdio:"pipe"}),!0}catch{return!1}}function W_a(t){return t.search(/uvx/)!==-1}async function z_a(t,e,r){let{scope:n}=r,o=process.cwd();n==="project"&&H_a(o)&&(console.log(R.t("mcpAdd.info.detectedHomeDirectory")),n="user");let s=n==="user"?"User":"Workspace",a=tl(process.cwd()),c;try{c=JSON.parse(e)}catch(m){console.error(R.t("mcpAddJson.errors.invalidJson")),console.error(m);return}if(typeof c!="object"||c===null||Array.isArray(c)){console.error(R.t("mcpAddJson.errors.mustBeObject"));return}let u=c,d=u;if(d.command&&W_a(d.command)&&!V_a()){console.error(R.t("mcpAddJson.errors.uvxRequiresUv")),console.error(R.t("mcpAddJson.errors.uvInstallationGuide")),console.error(""),console.error("Installation methods:"),console.error(" - macOS/Linux: curl -LsSf https://astral.sh/uv/install.sh | sh"),console.error(' - Windows: powershell -c "irm https://astral.sh/uv/install.ps1 | iex"'),console.error(" - Via package managers:"),console.error(" * Homebrew (macOS): brew install uv"),console.error(" * Cargo (cross-platform): cargo install uv"),console.error("");return}if(u.type==="http"&&u.url&&!u.httpUrl&&(u.httpUrl=u.url,delete u.url),!u.command&&!u.url&&!u.httpUrl&&!u.tcp){console.error(R.t("mcpAddJson.errors.noTransport"));return}let p=a.forScope(s).settings.mcpServers||{},h=!!p[t];h&&console.log(R.t("mcpAdd.info.serverAlreadyConfigured",{name:t,scope:n})),p[t]=u,a.setValue(s,"mcpServers",p),console.log(h?R.t("mcpAdd.info.serverUpdated",{name:t,scope:n}):R.t("mcpAddJson.info.serverAdded",{name:t,scope:n})),d.command?(console.log(R.t("mcpAddJson.info.transportStdio")),console.log(R.t("mcpAddJson.info.command",{command:d.command})),d.args&&Array.isArray(d.args)&&d.args.length>0&&console.log(R.t("mcpAddJson.info.arguments",{args:d.args.join(" ")}))):d.url?(console.log(R.t("mcpAddJson.info.transportSse")),console.log(R.t("mcpAddJson.info.url",{url:d.url}))):d.httpUrl?(console.log(R.t("mcpAddJson.info.transportHttp")),console.log(R.t("mcpAddJson.info.url",{url:d.httpUrl}))):d.tcp&&(console.log(R.t("mcpAddJson.info.transportWebsocket")),console.log(R.t("mcpAddJson.info.tcp",{tcp:d.tcp}))),d.description&&console.log(R.t("mcpAddJson.info.description",{description:d.description})),d.env&&typeof d.env=="object"&&Object.keys(d.env).length>0&&console.log(R.t("mcpAddJson.info.envVars",{vars:Object.keys(d.env).join(", ")})),d.headers&&typeof d.headers=="object"&&Object.keys(d.headers).length>0&&console.log(R.t("mcpAddJson.info.headers",{headers:Object.keys(d.headers).join(", ")})),d.oauth?.enabled&&console.log(R.t("mcpAddJson.info.oauthEnabled"))}var Cmi={command:"add-json <name> <json>",describe:R.t("mcpAddJson.description"),builder:t=>t.usage(R.t("mcpAddJson.usage")).positional("name",{describe:R.t("mcpAdd.options.name"),type:"string",demandOption:!0}).positional("json",{describe:R.t("mcpAddJson.options.json"),type:"string",demandOption:!0}).option("scope",{alias:"s",describe:R.t("mcpAdd.options.scope"),type:"string",default:"project",choices:["user","project"]}),handler:async t=>{await z_a(t.name,t.json,{scope:t.scope})}};Tl();qt();async function Y_a(){let t=tl(process.cwd()),e=LF(process.cwd()),r={...t.merged.mcpServers||{}};for(let n of e)Object.entries(n.config.mcpServers||{}).forEach(([o,s])=>{r[o]||(r[o]={...s,extensionName:n.config.name})});return r}async function K_a(t){let e=await Y_a();if(!e[t]){console.log(R.t("mcpGet.errors.serverNotFound",{name:t}));return}let r=e[t];if(console.log(R.t("mcpGet.info.serverTitle",{name:t})),console.log(),console.log(R.t("mcpGet.info.configuration")),r.command?(console.log(R.t("mcpGet.info.transportStdio")),console.log(R.t("mcpGet.info.command",{command:r.command})),r.args&&r.args.length>0&&(console.log(R.t("mcpGet.info.arguments")),r.args.forEach((n,o)=>{console.log(R.t("mcpGet.info.argumentItem",{index:o,arg:n}))}))):r.url?(console.log(R.t("mcpGet.info.transportSse")),console.log(R.t("mcpGet.info.url",{url:r.url}))):r.httpUrl?(console.log(R.t("mcpGet.info.transportHttp")),console.log(R.t("mcpGet.info.url",{url:r.httpUrl}))):console.log(R.t("mcpGet.info.transportUnknown")),r.env&&Object.keys(r.env).length>0){console.log(R.t("mcpGet.info.environmentVariables"));for(let[n,o]of Object.entries(r.env))console.log(R.t("mcpGet.info.envVar",{key:n,value:o}))}if(r.headers&&Object.keys(r.headers).length>0){console.log(R.t("mcpGet.info.headers"));for(let[n,o]of Object.entries(r.headers))console.log(R.t("mcpGet.info.header",{key:n,value:o}))}r.description&&console.log(R.t("mcpGet.info.description",{description:r.description})),r.timeout!==void 0&&console.log(R.t("mcpGet.info.timeout",{timeout:r.timeout})),r.trust!==void 0&&console.log(R.t("mcpGet.info.trusted",{trusted:r.trust?R.t("mcpGet.common.yes"):R.t("mcpGet.common.no")})),r.includeTools&&r.includeTools.length>0&&(console.log(R.t("mcpGet.info.includeTools")),r.includeTools.forEach((n,o)=>{console.log(R.t("mcpGet.info.toolItem",{index:o,tool:n}))})),r.excludeTools&&r.excludeTools.length>0&&(console.log(R.t("mcpGet.info.excludeTools")),r.excludeTools.forEach((n,o)=>{console.log(R.t("mcpGet.info.toolItem",{index:o,tool:n}))})),r.extensionName&&console.log(R.t("mcpGet.info.extension",{extension:r.extensionName})),console.log(),console.log(R.t("mcpGet.info.rawJsonConfiguration")),console.log(JSON.stringify(r,null,2))}var Smi={command:"get <name>",describe:R.t("mcpGet.description"),builder:t=>t.usage(R.t("mcpGet.usage")).positional("name",{describe:R.t("mcpGet.options.name"),type:"string",demandOption:!0}),handler:async t=>{await K_a(t.name)}};PP();qt();import*as Sot from"fs";import*as xmi from"path";async function X_a(){let t=process.cwd();try{let e=await $b("**/.mcp.json",{cwd:t,absolute:!0,ignore:["**/node_modules/**","**/.*/**"]});if(e.length===0){console.log(R.t("mcpResetProjectChoices.info.noFilesFound"));return}console.log(R.t("mcpResetProjectChoices.info.foundFiles",{count:e.length}));let r=0,n=0;for(let o of e){let s=xmi.relative(t,o);try{let a=Sot.readFileSync(o,"utf8"),c;try{c=JSON.parse(a)}catch{console.log(R.t("mcpResetProjectChoices.info.invalidJson",{path:s}));continue}c.approvedServers||c.rejectedServers||c.mcpServerChoices?(Sot.unlinkSync(o),console.log(R.t("mcpResetProjectChoices.info.fileDeleted",{path:s})),r++):console.log(R.t("mcpResetProjectChoices.info.noChoicesSkipping",{path:s}))}catch(a){console.log(R.t("mcpResetProjectChoices.errors.fileError",{path:s,error:a})),n++}}console.log(),console.log(R.t("mcpResetProjectChoices.info.summary")),console.log(R.t("mcpResetProjectChoices.info.deletedFiles",{count:r})),n>0&&console.log(R.t("mcpResetProjectChoices.info.errorFiles",{count:n})),r>0&&(console.log(),console.log(R.t("mcpResetProjectChoices.info.resetComplete")),console.log(R.t("mcpResetProjectChoices.info.extensionPrompt")))}catch(e){console.error(R.t("mcpResetProjectChoices.errors.searchError"),e)}}var wmi={command:"reset-project-choices",describe:R.t("mcpResetProjectChoices.description"),builder:t=>t.usage(R.t("mcpResetProjectChoices.usage")),handler:async()=>{await X_a()}};qt();var Tmi={command:"mcp",describe:R.t("mcpCommand.description"),builder:t=>t.command(Emi).command(vmi).command(bmi).command(Cmi).command(Smi).command(wmi).demandCommand(1,R.t("mcpCommand.demandCommand")).version(!1),handler:()=>{}};Fsr();Usr();Tl();qt();import b0 from"fs/promises";import V5 from"path";import MEa from"os";var FEa=async(t,e=1,r=20)=>{try{if(!t)return{success:!1,message:R.t("workflowAdd.pleaseAuthenticate")};let o=await fetch("https://apis.iflow.cn/v1/workflows/list",{method:"POST",headers:{"User-Agent":"iFlow-Cli","Content-Type":"application/json"},body:JSON.stringify({page:e,size:r,usePage:!0})});if(!o.ok){let c=R.t("workflowAdd.unableToLoadWorkflows");return o.status===401?c=R.t("workflowAdd.authenticationFailed"):o.status===403?c=R.t("workflowAdd.accessDenied"):o.status===404?c=R.t("workflowAdd.serviceNotFound"):o.status>=500&&(c=R.t("workflowAdd.serverError")),{success:!1,message:c}}let s=await o.json();return s.success?{success:!0,workflows:Array.isArray(s.data.data)?s.data.data:[],total:s.data.total||0}:{success:!1,message:s.message||R.t("workflowAdd.failedToLoadFromServer")}}catch(n){let o=R.t("workflowAdd.connectionError");return n instanceof Error&&n.message.includes("Failed to fetch")&&(o=R.t("workflowAdd.networkError")),{success:!1,message:o}}},LEa=async(t,e)=>{try{let r=await fetch(`https://apis.iflow.cn/v1/workflows/get/${e}`,{headers:{Authorization:`Bearer ${t}`}});if(!r.ok)throw new Error(`HTTP ${r.status}: ${r.statusText}`);let n=await r.json();if(!n.success)throw new Error(n.message||R.t("workflowAdd.failedToFetchDetails"));return n.data||null}catch(r){return console.error(R.t("workflowAdd.failedToFetchDetails"),r),null}},UEa=async(t,e)=>{let r=await fetch(t);if(!r.ok)throw new Error(`Failed to download file: ${r.status} ${r.statusText}`);let n=await r.arrayBuffer();await b0.writeFile(e,Buffer.from(n))},QEa=t=>{let e=new URL(t).pathname;return V5.extname(e).toLowerCase()},jEa=async t=>{let{exec:e}=await import("child_process"),{promisify:r}=await import("util"),n=r(e);try{let o=process.platform==="win32"?`where ${t}`:`which ${t}`;return await n(o),!0}catch{return!1}},$Ea=async(t,e)=>{let{exec:r}=await import("child_process"),{promisify:n}=await import("util"),o=n(r),s=process.platform==="win32",a=[];s?a.push({name:"Windows tar",command:`tar -xf "${t}" -C "${e}"`,check:"tar"},{name:"PowerShell",command:`powershell -Command "Expand-Archive -Path '${t}' -DestinationPath '${e}' -Force"`,check:"powershell"},{name:"7-Zip",command:`7z x "${t}" -o"${e}" -y`,check:"7z"},{name:"WinRAR",command:`winrar x "${t}" "${e}\\"`,check:"winrar"}):a.push({name:"unzip",command:`unzip -q "${t}" -d "${e}"`,check:"unzip"},{name:"tar",command:`tar -xf "${t}" -C "${e}"`,check:"tar"});let c=null;for(let d of a)try{if(d.check&&!await jEa(d.check)){console.log(`\u23ED\uFE0F Skipping ${d.name} (not available)`);continue}console.log(`\u{1F527} Trying to extract with ${d.name}...`),await o(d.command),console.log(`\u2714 Successfully extracted using ${d.name}`);return}catch(f){console.log(`\u274C ${d.name} failed: ${f instanceof Error?f.message:String(f)}`),c=f instanceof Error?f:new Error(String(f))}let u=a.map(d=>d.name).join(", ");throw new Error(`Failed to extract ZIP file. Tried all available methods: ${u}. Last error: ${c?.message||"Unknown error"}. Please install one of: ${s?"7-Zip, WinRAR, or ensure PowerShell is available":"unzip or tar"}`)},GEa=async(t,e,r)=>{try{switch(r){case".zip":await $Ea(t,e);break;case".tgz":case".tar.gz":case".tar":case".tar.bz2":case".tbz2":case".tar.xz":case".txz":{let{exec:n}=await import("child_process"),{promisify:o}=await import("util"),s=o(n),a;switch(r){case".tgz":case".tar.gz":a=`tar -xzf "${t}" -C "${e}"`;break;case".tar":a=`tar -xf "${t}" -C "${e}"`;break;case".tar.bz2":case".tbz2":a=`tar -xjf "${t}" -C "${e}"`;break;case".tar.xz":case".txz":a=`tar -xJf "${t}" -C "${e}"`;break;default:throw new Error(`Unsupported tar format: ${r}`)}await s(a);break}default:throw new Error(`Unsupported archive format: ${r}`)}}catch(n){throw new Error(`Failed to extract ${r} file. Original error: ${n}`)}},qEa=async t=>{try{let e=await b0.readFile(t,{flag:"r"});if(e.length>=4){let r=e.readUInt32BE(0);return r===333319||r===333312}return!1}catch{return!1}},ngi=async t=>{try{let e=await b0.readdir(t,{withFileTypes:!0});for(let r of e){let n=V5.join(t,r.name);if(r.isDirectory())await ngi(n),r.name==="__MACOSX"&&await b0.rm(n,{recursive:!0,force:!0});else{let o=!1;(r.name===".DS_Store"||r.name.startsWith("._")&&await qEa(n))&&(o=!0),o&&await b0.rm(n,{force:!0})}}}catch(e){console.warn(`Warning: Failed to clean up macOS files in ${t}: ${e}`)}},HEa=async(t,e,r)=>{try{let n;try{n=JSON.parse(t.extInfo)}catch(u){return{success:!1,message:R.t("workflowAdd.invalidExtInfo",{error:u instanceof Error?u.message:String(u)})}}if(!n.url)return{success:!1,message:R.t("workflowAdd.noDownloadUrl")};let o=QEa(n.url),s=await b0.mkdtemp(V5.join(MEa.tmpdir(),"iflow-workflow-")),a=V5.join(s,`workflow${o}`),c=V5.join(s,"extracted");try{console.log(R.t("workflowAdd.downloading",{url:n.url})),await UEa(n.url,a),console.log(R.t("workflowAdd.extracting")),await b0.mkdir(c,{recursive:!0}),await GEa(a,c,o),await ngi(c);let u=await VEa(c);console.log(R.t("workflowAdd.copyingFiles"));let d=e||process.cwd(),f=await b0.readdir(c);for(let p of f){let h=V5.join(c,p),m=V5.join(d,p);(await b0.stat(h)).isDirectory()?(console.log(`Copying directory: ${h} -> ${m}`),await igi(h,m)):(console.log(`\u{1F4C4} Copying file: ${h} -> ${m}`),await b0.copyFile(h,m))}return u&&await WEa(d),await b0.rm(s,{recursive:!0,force:!0}),{success:!0,message:R.t("workflowAdd.installSuccess",{workflowName:r,targetDir:d})}}catch(u){try{await b0.rm(s,{recursive:!0,force:!0})}catch{}throw u}}catch(n){let o=n instanceof Error?n.message:String(n);return{success:!1,message:R.t("workflowAdd.installFailed",{workflowName:r,error:o})}}},igi=async(t,e)=>{await b0.mkdir(e,{recursive:!0});let r=await b0.readdir(t,{withFileTypes:!0});for(let n of r){let o=V5.join(t,n.name),s=V5.join(e,n.name);n.isDirectory()?await igi(o,s):await b0.copyFile(o,s)}},VEa=async t=>{let e=V5.join(t,"command_setup.sh");try{return await b0.access(e,b0.constants.F_OK),console.log("\u{1F50D} Detected command_setup.sh in workflow"),!0}catch{return!1}},WEa=async t=>{let e=V5.join(t,"command_setup.sh");try{console.log("\u{1F527} Executing command_setup.sh..."),await b0.chmod(e,493);let{exec:r}=await import("child_process"),{promisify:n}=await import("util"),o=n(r),{stdout:s,stderr:a}=await o("bash command_setup.sh",{cwd:t,timeout:3e5});s&&(console.log("\u{1F4CB} Setup script output:"),console.log(s)),a&&(console.warn("\u26A0\uFE0F Setup script warnings:"),console.warn(a)),console.log("\u2714 command_setup.sh executed successfully")}catch(r){console.error("\u274C Failed to execute command_setup.sh:"),console.error(r instanceof Error?r.message:String(r)),console.warn("\u26A0\uFE0F Workflow installation completed but setup script failed"),console.warn("\u{1F4A1} Please manually execute command_setup.sh if needed")}};async function zEa(t){let r=tl(process.cwd()).merged.apiKey;r||(console.error(R.t("workflowAdd.apiKeyNotFound")),console.error(R.t("workflowAdd.pleaseAuthenticate")),process.exit(1)),console.log(R.t("workflowAdd.searching",{nameOrId:t}));try{let n=null;if(/^\d+$/.test(t)){let u=parseInt(t,10);n=await LEa(r,u)}if(!n){let u=await FEa(r,1,500);u.success||(console.error(R.t("workflowAdd.error",{error:u.message})),process.exit(1)),n=u.workflows?.find(d=>d.workflowId?.toLowerCase()===t.toLowerCase())||u.workflows?.[0]||null}n||(console.error(R.t("workflowAdd.notFoundInRepo",{nameOrId:t})),process.exit(1));let o=n.name||"Unknown";try{if(n.name){let u=JSON.parse(n.name);u.en&&(o=u.en)}}catch{}console.log(R.t("workflowAdd.foundWorkflow",{name:o}));let s=n.description||"No description available";try{if(n.description){let u=JSON.parse(n.description);u.en&&(s=u.en)}}catch{}console.log(R.t("workflowAdd.workflowDescription",{description:s})),console.log(R.t("workflowAdd.installing"));let a=process.cwd(),c=await HEa(n,a,o);c.success?console.log(c.message):(console.error(c.message),process.exit(1))}catch(n){console.error(R.t("workflowAdd.errorAdding",{error:n})),process.exit(1)}}var ogi={command:"add <name-or-id>",describe:R.t("workflowAdd.description"),builder:t=>t.usage(R.t("workflowAdd.usage")).positional("name-or-id",{describe:R.t("workflowAdd.workflowIdOrNumericIdOption"),type:"string",demandOption:!0}),handler:async t=>{await zEa(t["name-or-id"])}};qt();var sgi={command:"workflow",describe:R.t("workflowCommand.description"),builder:t=>t.command(ogi).demandCommand(1,R.t("workflowCommand.demandCommand")).version(!1),handler:()=>{}};var $sr={debug:(...t)=>console.debug("[DEBUG]",...t),warn:(...t)=>console.warn("[WARN]",...t),error:(...t)=>console.error("[ERROR]",...t)};function KEa(t){let e=[],r=new Set(["-p","--prompt"]);for(let n=0;n<t.length;n++){let o=t[n];if(r.has(o)&&n+1<t.length){let s=t[n+1];if(s.startsWith("-")){e.push(`${o}=${s}`),n++;continue}}e.push(o)}return e}async function Rot(){let t=KEa(Jm.argv),e=Mfi(kor(t)).locale("en").scriptName("iflow").usage(`Usage: iflow [options] [command]
6234
6234
 
6235
6235
  iFlow CLI - Launch an interactive CLI, use -p/--prompt for non-interactive mode`).command("$0 [query]","Launch iFlow CLI",o=>o.positional("query",{type:"string",description:"Optional query to process (equivalent to -p for non-interactive or -i for interactive mode)"}).option("model",{alias:"m",type:"string",description:"Model",default:Jm.env.modelName||Jm.env.MODELNAME||Jm.env.MODEL_NAME||Jm.env.model_name||Jm.env.model||Jm.env.MODEL}).option("prompt",{alias:"p",type:"string",description:"Prompt. Appended to input on stdin (if any)."}).option("prompt-interactive",{alias:"i",type:"string",description:"Execute the provided prompt and continue in interactive mode"}).option("continue",{alias:"c",type:"boolean",description:"Start the application and load the most recent conversation from current directory",default:!1}).option("resume",{alias:"r",description:"Resume conversation from a specific session file. If no session ID is provided, shows interactive session selector.",coerce:s=>s===!0?!0:s}).option("sandbox",{alias:"s",type:"boolean",description:"Run in sandbox?"}).option("sandbox-image",{type:"string",description:"Sandbox image URI."}).option("debug",{alias:"d",type:"boolean",description:"Run in debug mode?",default:!1}).option("all-files",{alias:["a"],type:"boolean",description:"Include ALL files in context?",default:!1}).option("all_files",{type:"boolean",description:"Include ALL files in context?",default:!1}).deprecateOption("all_files","Use --all-files instead. We will be removing --all_files in the coming weeks.").option("show-memory-usage",{type:"boolean",description:"Show memory usage in status bar",default:!1}).option("show_memory_usage",{type:"boolean",description:"Show memory usage in status bar",default:!1}).deprecateOption("show_memory_usage","Use --show-memory-usage instead. We will be removing --show_memory_usage in the coming weeks.").option("yolo",{alias:"y",type:"boolean",description:"Automatically accept all actions (aka YOLO mode, see https://www.youtube.com/watch?v=xvFZjo5PgG0 for more details)?",default:!1}).option("default",{type:"boolean",description:"Use default mode (manual approval for actions)"}).option("plan",{type:"boolean",description:"Use plan mode (planning without execution)"}).option("thinking",{type:"boolean",description:"Enable thinking mode when supported by the selected model"}).option("autoEdit",{type:"boolean",description:"Use auto-edit mode"}).option("telemetry",{type:"boolean",description:"Enable telemetry? This flag specifically controls if telemetry is sent. Other --telemetry-* flags set specific values but do not enable telemetry on their own."}).option("telemetry-target",{type:"string",choices:["local","gcp"],description:"Set the telemetry target (local or gcp). Overrides settings files."}).option("telemetry-otlp-endpoint",{type:"string",description:"Set the OTLP endpoint for telemetry. Overrides environment variables and settings files."}).option("telemetry-log-prompts",{type:"boolean",description:"Enable or disable logging of user prompts for telemetry. Overrides settings files."}).option("telemetry-outfile",{type:"string",description:"Redirect all telemetry output to the specified file."}).option("checkpointing",{type:"boolean",description:"Enables checkpointing of file edits",default:!0}).option("experimental-acp",{type:"boolean",description:"Starts the agent in ACP mode"}).option("port",{type:"number",description:"Port number for ACP server (used with --experimental-acp)"}).option("allowed-mcp-server-names",{type:"array",string:!0,description:"Allowed MCP server names"}).option("include-directories",{alias:"add-dir",type:"array",string:!0,description:"Additional directories to include in the workspace (comma-separated or multiple --include-directories)",coerce:s=>s.flatMap(a=>a.split(",").map(c=>c.trim()))}).option("max-turns",{type:"number",description:"Maximum number of model calls (assistant rounds) before terminating"}).option("max_turns",{type:"number",description:"Maximum number of model calls (assistant rounds) before terminating"}).deprecateOption("max_turns","Use --max-turns instead. We will be removing --max_turns in the coming weeks.").option("max-tokens",{type:"number",description:"Maximum total token usage (input + output) before terminating"}).option("max_tokens",{type:"number",description:"Maximum total token usage (input + output) before terminating"}).deprecateOption("max_tokens","Use --max-tokens instead. We will be removing --max_tokens in the coming weeks.").option("timeout",{type:"number",description:"Maximum execution time in seconds before terminating"}).option("output-file",{alias:"o",type:"string",description:"Output file path to save execution information (non-interactive mode only)"}).option("output_file",{type:"string",description:"Output file path to save execution information (non-interactive mode only)"}).deprecateOption("output_file","Use --output-file instead. We will be removing --output_file in the coming weeks.").check(s=>{if(s.prompt&&s.promptInteractive)throw new Error("Cannot use both --prompt (-p) and --prompt-interactive (-i) together");if(s.maxTurns!==void 0&&s.maxTurns!==null&&typeof s.maxTurns=="number"&&s.maxTurns<=0)throw new Error("--max-turns must be a positive number");if(s.max_turns!==void 0&&s.max_turns!==null&&typeof s.max_turns=="number"&&s.max_turns<=0)throw new Error("--max_turns must be a positive number");if(s.maxTokens!==void 0&&s.maxTokens!==null&&typeof s.maxTokens=="number"&&s.maxTokens<=0)throw new Error("--max-tokens must be a positive number");if(s.max_tokens!==void 0&&s.max_tokens!==null&&typeof s.max_tokens=="number"&&s.max_tokens<=0)throw new Error("--max_tokens must be a positive number");if(s.timeout!==void 0&&s.timeout!==null&&typeof s.timeout=="number"&&s.timeout<=0)throw new Error("--timeout must be a positive number");return!0})).command(Tmi).command(Msr).command(Lsr).command(sgi).strict().version(await GF()).alias("v","version").help().alias("h","help").demandCommand(0,0);e.wrap(e.terminalWidth());let r=await e.parse(),n=r.query||(r._&&r._.length>0&&r._[0]!==void 0&&r._[0]!==null?String(r._[0]):void 0);return n&&!r.prompt&&(r.promptInteractive===""||!!r.promptInteractive?r.promptInteractive=n:r.prompt=n),r._.length>0&&r._[0]==="mcp"&&Jm.exit(0),r._.length>0&&r._[0]==="workflow"&&Jm.exit(0),r}async function Gsr(t,e,r,n,o=[],s="tree",a){let c=Qsr.realpathSync(jsr.resolve(t)),u=Qsr.realpathSync(jsr.resolve(YEa())),f=c===u?"":t;return e&&$sr.debug(`CLI: Delegating hierarchical memory load to server for CWD: ${t} (memoryImportFormat: ${s})`),NH(f,e,r,o,s,a,n.memoryDiscoveryMaxDirs)}async function kW(t,e,r,n,o=Jm.cwd()){let s=n.debug||[Jm.env.DEBUG,Jm.env.DEBUG_MODE].some(S=>S==="true"||S==="1")||!1,a=t.memoryImportFormat||"tree",c=gpi(e,n.extensions||[]),u=e.filter((S,w)=>c[w].isActive);t.contextFileName?boe(t.contextFileName):boe(Coe());let d=u.flatMap(S=>S.contextFiles),f=new SH(o),p={...Tse,...t.fileFiltering};G4t(t.errorLog);let{memoryContent:h,fileCount:m}=await Gsr(o,s,f,t,d,a,p),g=XEa(t,u),A=JEa(t,u),y=[];if(!n.allowedMcpServerNames){if(t.allowMCPServers){let S=new Set(t.allowMCPServers.filter(Boolean));S.size>0&&(g=Object.fromEntries(Object.entries(g).filter(([w])=>S.has(w))))}if(t.excludeMCPServers){let S=new Set(t.excludeMCPServers.filter(Boolean));S.size>0&&(g=Object.fromEntries(Object.entries(g).filter(([w])=>!S.has(w))))}}if(n.allowedMcpServerNames){let S=new Set(n.allowedMcpServerNames.filter(Boolean));S.size>0?g=Object.fromEntries(Object.entries(g).filter(([w,k])=>{let D=S.has(w);return D||y.push({name:w,extensionName:k.extensionName||""}),D})):(y.push(...Object.entries(g).map(([w,k])=>({name:w,extensionName:k.extensionName||""}))),g={})}let E=await _mi(t,n),v=new kp,b=!1;try{await v.initialize(),b=!0}catch(S){$sr.error("History manager initialization failed. History features will be disabled.",S)}return new _6e({cna:t.cna,language:t.language,sessionId:r,embeddingModel:uee,sandbox:E,targetDir:o||Jm.cwd(),includeDirectories:t.includeDirectories||n.includeDirectories,debugMode:s,question:n.promptInteractive||n.prompt||"",fullContext:n.allFiles||n.all_files||!1,coreTools:t.coreTools||void 0,excludeTools:A,toolDiscoveryCommand:t.toolDiscoveryCommand,toolCallCommand:t.toolCallCommand,mcpServerCommand:t.mcpServerCommand,mcpServers:g,userMemory:h,geminiMdFileCount:m,approvalMode:t.approvalMode||(n.default?yn.DEFAULT:n.autoEdit?yn.SMART:n.plan?yn.PLAN:n.yolo?yn.YOLO:n.prompt&&!n.promptInteractive&&!n.continue&&(!n.resume||typeof n.resume=="string")||n.experimentalAcp?yn.YOLO:yn.SMART),thinkingModeEnabled:n.thinking??t.thinkingModeEnabled??!1,showMemoryUsage:n.showMemoryUsage||n.show_memory_usage||t.showMemoryUsage||!1,accessibility:t.accessibility,telemetry:{enabled:n.telemetry??t.telemetry?.enabled,target:n.telemetryTarget??t.telemetry?.target,otlpEndpoint:n.telemetryOtlpEndpoint??Jm.env.OTEL_EXPORTER_OTLP_ENDPOINT??t.telemetry?.otlpEndpoint,logPrompts:n.telemetryLogPrompts??t.telemetry?.logPrompts,outfile:n.telemetryOutfile??t.telemetry?.outfile},usageStatisticsEnabled:t.usageStatisticsEnabled??!0,fileFiltering:{respectGitIgnore:t.fileFiltering?.respectGitIgnore,respectGeminiIgnore:t.fileFiltering?.respectGeminiIgnore,enableRecursiveFileSearch:t.fileFiltering?.enableRecursiveFileSearch},checkpointing:n.checkpointing!==void 0?n.checkpointing:t.checkpointing?.enabled??!0,maxCheckpoints:t.checkpointing?.maxCheckpoints??50,proxy:n.proxy||Jm.env.HTTPS_PROXY||Jm.env.https_proxy||Jm.env.HTTP_PROXY||Jm.env.http_proxy,cwd:o,fileDiscoveryService:f,bugCommand:t.bugCommand,model:n.model||t.modelName||hf,extensionContextFilePaths:d,maxSessionTurns:n.maxTurns||n.max_turns||(t.maxSessionTurns??-1),experimentalAcp:n.experimentalAcp||!1,acpPort:n.port,listExtensions:n.listExtensions||!1,extensions:c,blockedMcpServers:y,noBrowser:!!Jm.env.NO_BROWSER,summarizeToolOutput:t.toolSummarizationSettings,searchApiKey:t.searchApiKey,hookManager:t.hookManager??!0,compressionTokenThreshold:t.compressionTokenThreshold,useRipgrep:t.useRipgrep,maxTokens:n.maxTokens||n.max_tokens,timeout:n.timeout,tokensLimit:t.tokensLimit,skipNextSpeakerCheck:t.skipNextSpeakerCheck??!0,shellTimeout:t.shellTimeout,temperature:t.temperature,topP:t.topP,historyManager:b?v:void 0,lightWeightPlan:t.lightWeightPlan,isNonInteractive:!!n.prompt&&!n.promptInteractive&&!n.continue&&(!n.resume||typeof n.resume=="string")||n.experimentalAcp,usageMode:n.prompt&&!n.promptInteractive&&!n.continue&&(!n.resume||typeof n.resume=="string")||n.experimentalAcp?"non-interactive":"interactive",disableTelemetry:t.disableTelemetry??!1,enableBuildInTask:t.enableBuildInTask,outputStyle:t.outputStyle,shouldUseNodePtyShell:t.enableInteractiveShell??!1,hasIdeOnboardingBeenShown:t.hasIdeOnboardingBeenShown,useSmartEdit:t.useSmartEdit??!0,outputLimit:t.outputLimit})}function XEa(t,e){let r={...t.mcpServers||{}};for(let n of e)Object.entries(n.config.mcpServers||{}).forEach(([o,s])=>{if(r[o]){$sr.warn(`Skipping extension MCP config for server with key "${o}" as it already exists.`);return}r[o]={...s,extensionName:n.config.name}});return r}function JEa(t,e){let r=new Set(t.excludeTools||[]);for(let n of e)for(let o of n.config.excludeTools||[])r.add(o);return[...r]}qt();import{promises as ZEa}from"fs";import{join as e6a}from"path";var t6a=[];function b4e(t){t6a.push(t)}async function agi(){let t=s3(process.cwd()),e=e6a(t,"checkpoints");try{await ZEa.rm(e,{recursive:!0,force:!0})}catch{}}tk();qt();qsr();Hsr();ks();Vsr();function cgi(t,e,r,n=Oot){if(!t)return;let o=Not(r,e.merged.disableAutoUpdate??!1),s=t.message;if(o.updateMessage&&(s+=`
6236
- ${o.updateMessage}`),C0.emit("update-received",{message:s}),!o.updateCommand||e.merged.disableAutoUpdate)return;let a=t.update.latest.includes("nightly"),c=t.update.latest.includes("beta"),u=o.updateCommand.replace("@latest",a?"@nightly":c?"@beta":`@${t.update.latest}`),d=n(u,{stdio:"pipe",shell:!0}),f="";return d.stderr.on("data",p=>{f+=p.toString()}),d.on("close",p=>{p===0?C0.emit("update-success",{message:"Update successful! The new version will be used on your next run."}):C0.emit("update-failed",{message:`Automatic update failed. Please try updating manually. (command: ${u}, stderr: ${f.trim()})`})}),d.on("error",p=>{C0.emit("update-failed",{message:`Automatic update failed. Please try updating manually. (error: ${p.message})`})}),d}function Wsr(t,e){let r=!1,n=c=>{e(c);let u=c.message;setTimeout(()=>{r||t({type:"info",text:u},Date.now()),e(null)},6e4)},o=()=>{e(null),t({type:"error",text:R.t("autoUpdate.failed")},Date.now())},s=()=>{r=!0,e(null),t({type:"info",text:R.t("autoUpdate.ok")},Date.now())},a=c=>{t({type:"info",text:c.message},Date.now())};return C0.on("update-received",n),C0.on("update-failed",o),C0.on("update-success",s),C0.on("update-info",a),()=>{C0.off("update-received",n),C0.off("update-failed",o),C0.off("update-success",s),C0.off("update-info",a)}}import{promises as C4e}from"node:fs";import{join as zsr}from"node:path";import{homedir as Ysr}from"node:os";import{spawn as o6a}from"node:child_process";var s6a=["node","npm","python","python3","git","echo","pwd","date","bash"],a6a=[".js",".ts",".py",".sh",".bash",".zsh",".rb",".php",".pl",".lua"];function c6a(t){if(t.includes("../")||t.includes("..\\"))return!1;let e=[/[;&|`$(){}[\]]/,/\s*\|\s*/,/\s*&&\s*/,/\s*\|\|\s*/];for(let r of e)if(r.test(t))return!1;return!0}async function l6a(t){try{let e=t.toLowerCase().substring(t.lastIndexOf("."));if(!a6a.includes(e)||!(await C4e.stat(t)).isFile())return!1;try{await C4e.access(t,C4e.constants.R_OK)}catch{return!1}return!0}catch{return!1}}async function u6a(t){if(!t||t.trim()==="")return null;let e=[/[;&|`$(){}[\]]/,/\s*\|\s*/,/\s*&&\s*/,/\s*\|\|\s*/,/>\s*\/dev\/null/,/2>&1/];for(let f of e)if(f.test(t))return null;let r=[],n="",o=!1,s="",a=!1;for(let f=0;f<t.length;f++){let p=t[f];if(a){n+=p,a=!1;continue}if(p==="\\"){a=!0;continue}if((p==='"'||p==="'")&&!a){o?p===s?(o=!1,s=""):n+=p:(o=!0,s=p);continue}if(p===" "&&!o){n&&(r.push(n),n="");continue}n+=p}if(n&&r.push(n),r.length===0)return null;let[c,...u]=r;if(!s6a.includes(c)){if(!c6a(c))return console.warn(`Command path '${c}' contains potentially unsafe patterns`),null;let f=c;if(c.startsWith("~/")&&(f=zsr(Ysr(),c.substring(2))),!await l6a(f))return console.warn(`Command '${c}' is not in the allowed commands list and is not a valid script file`),null;let h=c.toLowerCase().substring(c.lastIndexOf(".")),m;switch(h){case".js":m="node";break;case".ts":m="node",u.unshift("-r","ts-node/register");break;case".py":m="python3";break;case".sh":case".bash":m="bash";break;case".zsh":m="zsh";break;case".rb":m="ruby";break;case".php":m="php";break;case".pl":m="perl";break;case".lua":m="lua";break;default:return console.warn(`Unsupported script extension '${h}'`),null}return{cmd:m,args:[f,...u]}}let d=u.map(f=>f.startsWith("~/")?zsr(Ysr(),f.substring(2)):f);return{cmd:c,args:d}}var Ksr=class{timeoutId=null;DEBOUNCE_MS=300;config=null;constructor(e){this.config=e}updateConfig(e){this.config=e}triggerUpdate(){this.timeoutId&&clearTimeout(this.timeoutId),this.timeoutId=setTimeout(async()=>{await this.executeUpdate(),this.timeoutId=null},this.DEBOUNCE_MS)}async executeUpdate(){try{await Ole(this.config)}catch(e){console.error("Error in debounced statusline update:",e instanceof Error?e.message:e)}}async forceUpdate(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),await this.executeUpdate()}destroy(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}},X8=null;function Bot(t){X8&&X8.destroy(),X8=new Ksr(t)}async function lgi(){X8&&(X8.triggerUpdate(),await new Promise(t=>setTimeout(t,400)))}async function ugi(){X8&&await X8.forceUpdate()}function Pot(){X8&&(X8.destroy(),X8=null)}async function Ole(t){try{let e=zsr(Ysr(),".iflow","settings.json");try{await C4e.access(e)}catch{return null}let r=await C4e.readFile(e,"utf-8"),n=JSON.parse(r);if(!n.statusLine)return null;let o=n.statusLine;if(o.type!=="command")return null;let s=t?.getModel()||"Claude",a=t?.getSessionId()||"",c={model:{display_name:s},workspace:{current_dir:process.cwd()},sessionId:a};return await d6a(o.command,c)}catch(e){return console.error("Error executing statusline:",e instanceof Error?e.message:e),null}}async function d6a(t,e){try{let r=await u6a(t);if(!r)throw new Error("Invalid command format or forbidden command");let{cmd:n,args:o}=r;return new Promise((s,a)=>{let c=o6a(n,o,{stdio:["pipe","pipe","pipe"],shell:!1}),u="",d="";c.stdout?.on("data",f=>{u+=f.toString()}),c.stderr?.on("data",f=>{d+=f.toString()}),c.on("close",f=>{if(f===0){let p=u.trim();s(p)}else a(new Error(`Command failed with code ${f}: ${d}`))}),c.on("error",f=>{a(f)}),c.stdin&&(c.stdin.write(JSON.stringify(e)),c.stdin.end())})}catch(r){return Promise.reject(r)}}Nn();var QA=we(tr(),1);await tn();Nn();var Fle=we(tr(),1);await tn();var Wgi=we(tr(),1);await tn();var W5=we(tr(),1);import Qot from"node:readline";import{PassThrough as x6a}from"node:stream";var Jsr="[99;5u";var Vgi=we(Pt(),1);var Ugi="\x1B[I",Qgi="\x1B[O",W4="\x1B",jgi=`${W4}[200~`,$gi=`${W4}[201~`,Ggi=(0,W5.createContext)(void 0);function qgi(){let t=(0,W5.useContext)(Ggi);if(!t)throw new Error("useKeypressContext must be used within a KeypressProvider");return t}function Hgi({children:t,kittyProtocolEnabled:e,config:r,debugKeystrokeLogging:n}){let{stdin:o,setRawMode:s}=wx(),a=(0,W5.useRef)(new Set).current,c=(0,W5.useCallback)(d=>{a.add(d)},[a]),u=(0,W5.useCallback)(d=>{a.delete(d)},[a]);return(0,W5.useEffect)(()=>{let d=o.isRaw;d===!1&&s(!0);let f=new x6a,p=!1;(parseInt(process.versions.node.split(".")[0],10)<20||process.env.PASTE_WORKAROUND==="1"||process.env.PASTE_WORKAROUND==="true")&&(p=!0);let m=!1,g=Buffer.alloc(0),A="",y=null,E=!1,v=0,b=null,S=null,w=null,k=G=>{let j=new RegExp(`^${W4}\\[Z`),Y=G.match(j);if(Y)return{key:{name:"tab",ctrl:!1,meta:!1,shift:!0,paste:!1,sequence:G.slice(0,Y[0].length),kittyProtocol:!0},length:Y[0].length};let V=new RegExp(`^${W4}\\[1;(\\d+)Z`);if(Y=G.match(V),Y){let z=parseInt(Y[1],10);z>=128&&(z-=128);let K=z-1,ae=(K&2)===2;return{key:{name:"tab",ctrl:(K&4)===4,meta:ae,shift:!0,paste:!1,sequence:G.slice(0,Y[0].length),kittyProtocol:!0},length:Y[0].length}}let L=new RegExp(`^${W4}\\[1;(\\d+)([ABCDHFPQSR])`);if(Y=G.match(L),Y){let z=parseInt(Y[1],10);z>=128&&(z-=128);let K=z-1,ae=(K&1)===1,be=(K&2)===2,le=(K&4)===4,Ce=Y[2],ie={A:"up",B:"down",C:"right",D:"left",H:"home",F:"end",P:"f1",Q:"f2",R:"f3",S:"f4"}[Ce]||"";return ie?{key:{name:ie,ctrl:le,meta:be,shift:ae,paste:!1,sequence:G.slice(0,Y[0].length),kittyProtocol:!0},length:Y[0].length}:null}let X=new RegExp(`^${W4}\\[(\\d+)(;(\\d+))?([u~])`);if(Y=G.match(X),Y){let z=parseInt(Y[1],10),K=Y[3]?parseInt(Y[3],10):1;K>=128&&(K-=128);let ae=K-1,be=(ae&1)===1,le=(ae&2)===2,Ce=(ae&4)===4;if(Y[4]==="~"){let ye=null;switch(z){case 1:ye="home";break;case 2:ye="insert";break;case 3:ye="delete";break;case 4:ye="end";break;case 5:ye="pageup";break;case 6:ye="pagedown";break;default:break}if(ye)return{key:{name:ye,ctrl:Ce,meta:le,shift:be,paste:!1,sequence:G.slice(0,Y[0].length),kittyProtocol:!0},length:Y[0].length}}let se={27:"escape",9:"tab",127:"backspace",13:"return",57414:"return"}[z];if(se)return{key:{name:se,ctrl:Ce,meta:le,shift:be,paste:!1,sequence:G.slice(0,Y[0].length),kittyProtocol:!0},length:Y[0].length};if(Ce&&z>=97&&z<=122)return{key:{name:String.fromCharCode(z),ctrl:!0,meta:le,shift:be,paste:!1,sequence:G.slice(0,Y[0].length),kittyProtocol:!0},length:Y[0].length}}let J=new RegExp(`^${W4}\\[([ABCDHF])`);if(Y=G.match(J),Y){let z=Y[1];return{key:{name:{A:"up",B:"down",C:"right",D:"left",H:"home",F:"end"}[z],ctrl:!1,meta:!1,shift:!1,paste:!1,sequence:G.slice(0,Y[0].length),kittyProtocol:!0},length:Y[0].length}}return null},D=G=>{for(let j of a)j(G)},P=(G,j)=>{if(j.name==="paste-start"){m=!0,w=performance.now();return}if(j.name==="paste-end"){m=!1;let V=g.toString(),L=performance.now(),X=w?L-w:0;D({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:V,...w&&{pasteDuration:X,pasteTextLength:V.length}}),g=Buffer.alloc(0),w=null;return}if(m){g=Buffer.concat([g,Buffer.from(j.sequence)]);return}b&&j.name!=="return"&&(S&&(clearTimeout(S),S=null),D({...b,shift:!0}),b=null);let Y=Date.now();if(j.name==="return"&&v>0&&!E)if(Y-v<30)j.shift=!0;else{b={...j,paste:m},S=setTimeout(()=>{b&&(D(b),b=null),S=null},30),v=Y;return}if(v=Y,["up","down","left","right"].includes(j.name)){D(j);return}if(j.ctrl&&j.name==="c"||j.sequence===`${W4}${Jsr}`){A&&n&&console.log("[DEBUG] Kitty buffer cleared on Ctrl+C:",A),A="",j.sequence===`${W4}${Jsr}`?D({name:"c",ctrl:!0,meta:!1,shift:!1,paste:!1,sequence:j.sequence,kittyProtocol:!0}):D(j);return}if(e&&(A||j.sequence.startsWith(`${W4}[`)&&!j.sequence.startsWith(jgi)&&!j.sequence.startsWith($gi)&&!j.sequence.startsWith(Ugi)&&!j.sequence.startsWith(Qgi))){A+=j.sequence,n&&console.log("[DEBUG] Kitty buffer accumulating:",A);let V=!1;for(;A;){let L=k(A);if(!L){let X=A.indexOf(`${W4}[`,1);if(X>0){n&&console.log("[DEBUG] Skipping incomplete/invalid CSI prefix:",A.slice(0,X)),A=A.slice(X);continue}break}if(n){let X=A.slice(0,L.length);A.length>L.length?console.log("[DEBUG] Kitty sequence parsed successfully (prefix):",X):console.log("[DEBUG] Kitty sequence parsed successfully:",X)}A=A.slice(L.length),D(L.key),V=!0}if(V)return;if(r?.getDebugMode()||n){let L=Array.from(A).map(X=>X.charCodeAt(0));console.warn("Kitty sequence buffer has char codes:",L)}if(A.length>32)n&&console.log("[DEBUG] Kitty buffer overflow, clearing:",A),A="";else return}j.name==="return"&&j.sequence===`${W4}\r`&&(j.meta=!0),D({...j,paste:m})},T=null,N=40,O=null,Q=(G,j)=>{if(!(j.sequence===Ugi||j.sequence===Qgi)&&j.sequence!=="\x1B[?"){if(T)clearTimeout(T),T=null,!m&&O&&(w=performance.now(),g=Buffer.concat([g,Buffer.from(O.sequence)]),m=!0),T=setTimeout(()=>{m&&(D({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:g.toString(),...w&&{pasteDuration:performance.now()-w,pasteTextLength:g.length}}),g=Buffer.alloc(0),w=null,m=!1,O=null,T=null)},N);else{if(m||j.ctrl||j.meta||j.name==="paste-start"||j.name==="paste-end"||j.name==="backspace"||j.name==="delete"||j.name==="left"||j.name==="right"||j.name==="up"||j.name==="down"){P(G,j);return}if(j.name==="return"&&E){y&&(clearTimeout(y),y=null),E=!1,D({...j,shift:!0,sequence:"\r"});return}if(j.sequence==="\\"&&!j.name){E=!0,y=setTimeout(()=>{E=!1,y=null,D(j)},5);return}E&&j.name!=="return"&&(y&&(clearTimeout(y),y=null),E=!1,D({name:"",sequence:"\\",ctrl:!1,meta:!1,shift:!1,paste:!1})),O=j,T=setTimeout(()=>{O&&(P(G,O),O=null),T=null},N);return}P(G,j)}},F=G=>{let j=Buffer.from(jgi),Y=Buffer.from($gi),V=0;for(;V<G.length;){let L=G.indexOf(j,V),X=G.indexOf(Y,V),J=L!==-1&&(X===-1||L<X),z=X!==-1&&(L===-1||X<L),K=-1,ae=0;if(J?K=L:z&&(K=X),ae=Y.length,K===-1){f.write(G.slice(V));return}let be=G.slice(V,K);be.length>0&&f.write(be);let le=Ce=>({name:Ce,ctrl:!1,meta:!1,shift:!1,paste:!1,sequence:""});J?P(void 0,le("paste-start")):z&&P(void 0,le("paste-end")),V=K+ae}},B;return p?(B=Qot.createInterface({input:f,escapeCodeTimeout:0}),Qot.emitKeypressEvents(f,B),f.on("keypress",Q),o.on("data",F)):(B=Qot.createInterface({input:o,escapeCodeTimeout:0}),Qot.emitKeypressEvents(o,B),o.on("keypress",Q)),()=>{p?(f.removeListener("keypress",Q),o.removeListener("data",F)):o.removeListener("keypress",Q),B.close(),d===!1&&s(!1),y&&(clearTimeout(y),y=null),S&&(clearTimeout(S),S=null),T&&(clearTimeout(T),T=null),m&&(D({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:g.toString()}),g=Buffer.alloc(0))}},[o,s,e,r,a,n]),(0,Vgi.jsx)(Ggi.Provider,{value:{subscribe:c,unsubscribe:u},children:t})}function _n(t,{isActive:e}){let{subscribe:r,unsubscribe:n}=qgi();(0,Wgi.useEffect)(()=>{if(e)return r(t),()=>{n(t)}},[e,t,r,n])}Nn();ui();var z4=we(Pt(),1);function w6a(t,e){switch(e.type){case"insert":{let r=e.payload,n=Array.from(t.value),o=Array.from(r);n.splice(t.cursorPosition,0,...o);let s=n.join(""),a=Array.from(r).length;return{value:s,cursorPosition:t.cursorPosition+a}}case"backspace":{if(t.cursorPosition>0){let r=Array.from(t.value);return r.splice(t.cursorPosition-1,1),{value:r.join(""),cursorPosition:t.cursorPosition-1}}return t}case"delete":{let r=Array.from(t.value).length;if(t.cursorPosition<r){let n=Array.from(t.value);return n.splice(t.cursorPosition,1),{value:n.join(""),cursorPosition:t.cursorPosition}}return t}case"move_cursor":{let r=Array.from(t.value).length,n=Math.max(0,Math.min(r,t.cursorPosition+e.payload));return{...t,cursorPosition:n}}case"set_cursor":{let r=Array.from(t.value).length,n=Math.max(0,Math.min(r,e.payload));return{...t,cursorPosition:n}}case"set_value":return{value:e.payload,cursorPosition:Array.from(e.payload).length};default:return t}}function N6({onSubmit:t,onCancel:e,placeholder:r,label:n,isFocused:o=!0,defaultValue:s="",allowEmpty:a=!1}){let{t:c}=fr(),u=r||c("textInput.defaultPlaceholder"),d=n||c("textInput.defaultLabel"),[f,p]=(0,Fle.useReducer)(w6a,{value:s,cursorPosition:s.length}),{value:h,cursorPosition:m}=f,[g,A]=(0,Fle.useState)(!0);(0,Fle.useEffect)(()=>{if(!o)return;let v=setInterval(()=>{A(b=>!b)},500);return()=>clearInterval(v)},[o]),_n(v=>{if(v.name==="return"||v.name==="enter"){(h.trim()||a)&&t(h.trim());return}if(v.name==="escape"){e?.();return}if(!(v.name==="up"||v.name==="down")){if(v.name==="left"){p({type:"move_cursor",payload:-1});return}if(v.name==="right"){p({type:"move_cursor",payload:1});return}if(v.name==="backspace"){p({type:"backspace"});return}if(v.name==="delete"){p({type:"delete"});return}if(v.paste&&v.sequence){let b=v.sequence.split("").filter(S=>{let w=S.charCodeAt(0);return w>=32&&w!==127}).join("");b&&p({type:"insert",payload:b});return}if(v.sequence&&!v.ctrl&&!v.meta){let b=v.sequence;b.split("").some(w=>{let k=w.charCodeAt(0);return k<32||k===127})||p({type:"insert",payload:b})}}},{isActive:o});let y=g&&o?"\u2502":"",E=h?(()=>{let v=Array.from(h);return v.splice(m,0,y),v.join("")})():y;return(0,z4.jsxs)(ue,{flexDirection:"column",children:[(0,z4.jsx)(ue,{children:(0,z4.jsxs)(te,{color:de.Gray,children:[d," "]})}),(0,z4.jsx)(ue,{marginTop:1,children:(0,z4.jsx)(ue,{borderStyle:"round",borderColor:o?de.AccentBlue:de.Gray,paddingX:1,width:"100%",children:h?(0,z4.jsx)(te,{children:E}):(0,z4.jsxs)(te,{children:[(0,z4.jsx)(te,{color:de.Gray,children:u}),y]})})}),(0,z4.jsx)(ue,{marginTop:1,children:(0,z4.jsx)(te,{color:de.Gray,dimColor:!0,children:c("textInput.instructions")})})]})}ui();var mr=we(Pt(),1);var zgi=(0,QA.memo)(({config:t,onExit:e,onStatusUpdate:r})=>{let{t:n}=fr(),[o,s]=(0,QA.useState)("location"),[a,c]=(0,QA.useState)(0),[u,d]=(0,QA.useState)({}),[f,p]=(0,QA.useState)(null),[h,m]=(0,QA.useState)(null),[g,A]=(0,QA.useState)(!1),[y,E]=(0,QA.useState)([]),[v,b]=(0,QA.useState)([]),[S,w]=(0,QA.useState)(""),[k,D]=(0,QA.useState)(null),[P,T]=(0,QA.useState)("");(0,QA.useEffect)(()=>{(async()=>{try{let ie=await t.getToolRegistry();if(ie){let oe=["task","exit_plan_mode","save_memory"],H=ie.getAllTools().filter(Z=>{let Ae="serverName"in Z&&Z.serverName!==void 0,Ee=oe.filter(he=>he===Z.name).length>0;return!Ae&&!Ee}).map(Z=>Z.name);E(H),d(Z=>({...Z,selectedTools:H}))}let se=t.getMcpServers()||{},ye=Object.keys(se);b(ye),d(oe=>({...oe,selectedMcps:ye}))}catch(ie){console.error("Failed to initialize data:",ie)}})()},[t]);let O={location:{name:"location",title:n("agentInstallDialog.locationTitle"),description:n("agentInstallDialog.locationDescription"),type:"select",options:[{id:"project",title:n("agentInstallDialog.projectAgent"),description:n("agentInstallDialog.projectAgentDesc"),available:!0},{id:"user",title:n("agentInstallDialog.userAgent"),description:n("agentInstallDialog.userAgentDesc"),available:!0}]},method:{name:"method",title:n("agentInstallDialog.methodTitle"),description:n("agentInstallDialog.methodDescription"),type:"select",options:[{id:"iFlow",title:n("agentInstallDialog.generateWithIFlow"),description:n("agentInstallDialog.generateWithIFlowDesc"),available:!0},{id:"template",title:n("agentInstallDialog.manualConfig"),description:n("agentInstallDialog.manualConfigDesc"),available:!0},{id:"online",title:n("agentInstallDialog.fromOnlineRepo"),description:n("agentInstallDialog.fromOnlineRepoDesc"),available:!0}]},agentGoal:{name:"agentGoal",title:n("agentInstallDialog.agentGoalTitle"),description:n("agentInstallDialog.agentGoalDescription"),type:"input",placeholder:n("agentInstallDialog.agentGoalPlaceholder")},agentType:{name:"agentType",title:n("agentInstallDialog.agentTypeTitle"),description:n("agentInstallDialog.agentTypeDescription"),type:"input",placeholder:n("agentInstallDialog.agentTypePlaceholder")},systemPrompt:{name:"systemPrompt",title:n("agentInstallDialog.systemPromptTitle"),description:n("agentInstallDialog.systemPromptDescription"),type:"input",placeholder:n("agentInstallDialog.systemPromptPlaceholder")},description:{name:"description",title:n("agentInstallDialog.descriptionTitle"),description:n("agentInstallDialog.descriptionDescription"),type:"input",placeholder:n("agentInstallDialog.descriptionPlaceholder")},tools:{name:"tools",title:n("agentInstallDialog.toolsTitle"),description:n("agentInstallDialog.toolsDescription"),type:"multiselect",options:y.map(ee=>({id:ee,title:ee,description:n("agentInstallDialog.allowAccessTo",{tool:ee}),available:!0}))},mcps:{name:"mcps",title:n("agentInstallDialog.mcpsTitle"),description:n("agentInstallDialog.mcpsDescription"),type:"multiselect",options:v.map(ee=>({id:ee,title:ee,description:n("agentInstallDialog.allowMcpAccess",{mcp:ee}),available:!0}))},color:{name:"color",title:n("agentInstallDialog.colorTitle"),description:n("agentInstallDialog.colorDescription"),type:"select",options:[{id:"automatic",title:n("agentInstallDialog.automaticColor"),description:n("agentInstallDialog.automaticColorDesc"),available:!0},{id:"red",title:n("agentInstallDialog.red"),description:"",available:!0},{id:"blue",title:n("agentInstallDialog.blue"),description:"",available:!0},{id:"green",title:n("agentInstallDialog.green"),description:"",available:!0},{id:"yellow",title:n("agentInstallDialog.yellow"),description:"",available:!0},{id:"purple",title:n("agentInstallDialog.purple"),description:"",available:!0},{id:"orange",title:n("agentInstallDialog.orange"),description:"",available:!0},{id:"pink",title:n("agentInstallDialog.pink"),description:"",available:!0},{id:"cyan",title:n("agentInstallDialog.cyan"),description:"",available:!0}]},"generated-preview":{name:"generated-preview",title:n("agentInstallDialog.generatedPreviewTitle"),description:n("agentInstallDialog.generatedPreviewDescription"),type:"edit",options:[{id:"agentType",title:n("agentInstallDialog.agentTypeLabel"),description:`${u.agentType||n("agentInstallDialog.notSet")}`,available:!0},{id:"description",title:n("agentInstallDialog.descriptionLabel"),description:`${u.description||n("agentInstallDialog.notSet")}`,available:!0},{id:"systemPrompt",title:n("agentInstallDialog.systemPromptLabel"),description:`${u.systemPrompt?u.systemPrompt.length>600?u.systemPrompt.substring(0,600)+"...":u.systemPrompt:n("agentInstallDialog.notSet")}`,available:!0}]},preview:{name:"preview",title:n("agentInstallDialog.previewTitle"),description:n("agentInstallDialog.previewDescription"),type:"preview"},generating:null,installing:null,success:null,error:null}[o],Q=O?.options?.filter(ee=>ee.available)||[];(0,QA.useEffect)(()=>{c(0),p(null),A(!1),D(null),T("")},[o]);let F=ee=>{let ie=["location","method","agentType","systemPrompt","description","tools","mcps","color","preview"],se=["location","method","agentGoal","generating","generated-preview","tools","mcps","color","preview"];if(ee==="method")return u.method==="template"?"agentType":u.method==="iFlow"?"agentGoal":null;let ye=u.method==="iFlow"?se:ie,oe=ye.indexOf(ee);return oe<ye.length-1?ye[oe+1]:null},B=ee=>{let ie=["location","method","agentType","systemPrompt","description","tools","mcps","color","preview"],se=["location","method","agentGoal","generating","generated-preview","tools","mcps","color","preview"],ye=u.method==="iFlow"?se:ie,oe=ye.indexOf(ee);return oe>0?ye[oe-1]:null},G=()=>{switch(o){case"agentGoal":return u.agentGoal||"";case"agentType":return u.agentType||"";case"systemPrompt":return u.systemPrompt||"";case"description":return u.description||"";default:return""}},j=ee=>{if(o==="agentGoal"){if(d(se=>({...se,agentGoal:ee})),u.method==="iFlow"){X(ee);return}}else o==="agentType"?d(se=>({...se,agentType:ee})):o==="systemPrompt"?d(se=>({...se,systemPrompt:ee})):o==="description"&&d(se=>({...se,description:ee}));A(!1);let ie=F(o);ie&&(s(ie),c(0))},Y=()=>{A(!1),D(null),T("")},V=ee=>{k==="agentType"?d(ie=>({...ie,agentType:ee})):k==="description"?d(ie=>({...ie,description:ee})):k==="systemPrompt"&&d(ie=>({...ie,systemPrompt:ee})),D(null),T("")},L=()=>{D(null),T("")},X=async ee=>{try{s("generating"),p(null),r?.(n("agentInstallDialog.generatingFromGoal"));let{generateAgentConfig:ie}=await Promise.resolve().then(()=>(qt(),U_)),se=await ie(t,{agentGoal:ee,onProgress:ye=>{w(ye),r?.(ye)}});d(ye=>({...ye,agentType:se.identifier,systemPrompt:se.systemPrompt,description:se.whenToUse})),s("generated-preview"),c(0),r?.(n("agentInstallDialog.generatedSuccessfully"))}catch(ie){s("error");let se=ie instanceof Error?ie.message:String(ie);p(n("agentInstallDialog.failedToGenerate",{error:se})),r?.(n("agentInstallDialog.failedGenerateStatus",{error:se}))}},J=async()=>{try{s("installing"),r?.(n("agentInstallDialog.creatingAgent",{agentType:u.agentType}));let{createAgent:ee}=await Promise.resolve().then(()=>(qt(),U_)),ie={agentType:u.agentType,name:u.agentType,description:u.description,whenToUse:u.description,allowedTools:u.selectedTools?.length?u.selectedTools:["*"],allowedMcps:u.selectedMcps?.length?u.selectedMcps:void 0,systemPrompt:u.systemPrompt,location:u.location==="user"?"global":"project",isInheritTools:!0,isInheritMcps:!0},se=await ee(ie);s("success"),m(n("agentInstallDialog.successfullyCreated",{agentType:u.agentType,filePath:se})),r?.(n("agentInstallDialog.agentCreatedSuccess",{agentType:u.agentType})),setTimeout(()=>{e()},3e3)}catch(ee){s("error");let ie=ee instanceof Error?ee.message:String(ee);p(n("agentInstallDialog.failedToCreate",{error:ie})),r?.(n("agentInstallDialog.failedCreateStatus",{error:ie}))}},z=()=>{let ee=O;if(!ee)return;if(ee.type==="select"){let se=Q[a];if(se)if(o==="location")d(ye=>({...ye,location:se.id}));else if(o==="method"){let ye=se.id;if(d(me=>({...me,method:ye})),ye==="online"){m(n("agentInstallDialog.redirectingToOnline")),r?.(n("agentInstallDialog.useAgentsOnline")),setTimeout(()=>{e()},2e3);return}let oe=null;ye==="template"?oe="agentType":ye==="iFlow"&&(oe="agentGoal"),oe&&(s(oe),c(0),A(!1),p(null));return}else o==="color"&&d(ye=>({...ye,color:se.id}))}else if(ee.type==="input"){if(!g){A(!0);return}}else if(ee.type==="multiselect")if(a===0){let se=F(o);se&&(s(se),c(0),A(!1),p(null));return}else{let se=Q[a-1];if(o==="tools"){let ye=u.selectedTools||[],oe=ye.includes(se.id);d(oe?me=>({...me,selectedTools:ye.filter(ge=>ge!==se.id)}):me=>({...me,selectedTools:[...ye,se.id]}))}else if(o==="mcps"){let ye=u.selectedMcps||[],oe=ye.includes(se.id);d(oe?me=>({...me,selectedMcps:ye.filter(ge=>ge!==se.id)}):me=>({...me,selectedMcps:[...ye,se.id]}))}return}else if(ee.type==="edit"){if(k)return;if(a===0){let se=F(o);se&&(s(se),c(0),A(!1),p(null))}else{let se=Q[a-1];D(se.id);let ye="";se.id==="agentType"?ye=u.agentType||"":se.id==="description"?ye=u.description||"":se.id==="systemPrompt"&&(ye=u.systemPrompt||""),T(ye)}return}else if(ee.type==="preview"){J();return}let ie=F(o);ie&&(s(ie),c(0),A(!1),p(null))},K=()=>{if(g){A(!1);return}if(k){D(null),T("");return}let ee=B(o);ee?(s(ee),c(0),p(null)):e()};_n(ee=>{if(g||k)return;if(ee.name==="escape"){K();return}if(ee.sequence==="q"){e();return}let ie=O;if(ie){if(ie.type==="select"||ie.type==="multiselect"||ie.type==="edit"){let se=ie.type==="multiselect"||ie.type==="edit"?Q.length:Q.length-1;ee.name==="up"||ee.sequence==="k"?c(ye=>Math.max(0,ye-1)):ee.name==="down"||ee.sequence==="j"?c(ye=>Math.min(se,ye+1)):ee.name==="return"&&z()}else if(ie.type==="input")ee.name==="return"&&z();else if(ie.type==="preview"){if(ee.name==="up"||ee.name==="down"||ee.sequence==="k"||ee.sequence==="j")return;ee.name==="return"&&z()}}},{isActive:!0});let ae=()=>{if(u.method==="online"){let oe=["location","method"],me=oe.indexOf(o);return(0,mr.jsxs)(ue,{marginBottom:1,children:[(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.stepOf",{current:me+1,total:oe.length})}),(0,mr.jsx)(ue,{marginLeft:2,children:(0,mr.jsx)(te,{color:de.Gray,children:oe.map((ge,H)=>H<me?"\u2713 ":H===me?"\u25CF ":"\u25CB ").join("")})})]})}let ee=["location","method","agentType","systemPrompt","description","tools","mcps","color","preview"],ie=["location","method","agentGoal","generating","generated-preview","tools","mcps","color","preview"],se=u.method==="iFlow"?ie:ee,ye=se.indexOf(o);return(0,mr.jsxs)(ue,{marginBottom:1,children:[(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.stepOf",{current:ye+1,total:se.length})}),(0,mr.jsx)(ue,{marginLeft:2,children:(0,mr.jsx)(te,{color:de.Gray,children:se.map((oe,me)=>me<ye?"\u2713 ":me===ye?"\u25CF ":"\u25CB ").join("")})})]})},be=()=>{if(k){let ee={agentType:n("agentInstallDialog.agentTypeLabel"),description:n("agentInstallDialog.descriptionLabel"),systemPrompt:n("agentInstallDialog.systemPromptLabel")};return(0,mr.jsxs)(ue,{flexDirection:"column",children:[(0,mr.jsx)(te,{bold:!0,color:de.AccentCyan,children:n("agentInstallDialog.editField",{field:ee[k]})}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.modifyField",{field:k})})}),(0,mr.jsx)(ue,{marginTop:2,children:(0,mr.jsx)(N6,{onSubmit:V,onCancel:L,placeholder:n("agentInstallDialog.enterField",{field:k}),label:ee[k],defaultValue:P,isFocused:!0})})]})}return(0,mr.jsxs)(ue,{flexDirection:"column",children:[(0,mr.jsx)(te,{bold:!0,color:de.AccentCyan,children:n("agentInstallDialog.generatedPreviewTitle")}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.generatedPreviewDescription")})}),(0,mr.jsxs)(ue,{marginTop:2,flexDirection:"column",children:[(0,mr.jsxs)(ue,{marginBottom:2,flexDirection:"column",children:[(0,mr.jsx)(ue,{flexDirection:"row",children:(0,mr.jsxs)(te,{color:a===0?de.AccentCyan:void 0,children:[a===0?"> ":" ",n("agentInstallDialog.continueToToolsSelection")]})}),(0,mr.jsx)(ue,{marginLeft:4,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.proceedToNextStep")})})]},"continue"),Q.map((ee,ie)=>{let ye=ie+1===a;return(0,mr.jsxs)(ue,{marginBottom:1,flexDirection:"column",children:[(0,mr.jsx)(ue,{flexDirection:"row",children:(0,mr.jsxs)(te,{color:ye?de.AccentCyan:void 0,children:[ye?"> ":" ",ee.title]})}),(0,mr.jsx)(ue,{marginLeft:4,children:(0,mr.jsx)(te,{color:de.Gray,children:ee.description})})]},ee.id)})]}),(0,mr.jsxs)(ue,{marginTop:2,flexDirection:"column",children:[(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.navigation")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.navigateOptions")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.enterToEditField")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.escToBack")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.qToExit")})]})]})},le=()=>(0,mr.jsxs)(ue,{flexDirection:"column",children:[(0,mr.jsx)(te,{bold:!0,color:de.AccentCyan,children:n("agentInstallDialog.previewTitle")}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.previewDescription")})}),(0,mr.jsxs)(ue,{marginTop:2,flexDirection:"column",children:[(0,mr.jsx)(te,{bold:!0,children:u.agentType}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.AccentBlue,children:u.description})}),(0,mr.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,mr.jsx)(te,{color:de.AccentCyan,children:n("agentInstallDialog.details")}),(0,mr.jsxs)(te,{children:[" ","\u2022"," ",n("agentInstallDialog.location",{location:u.location})]}),(0,mr.jsxs)(te,{children:[" ","\u2022 ",n("agentInstallDialog.model",{model:"Qwen3-Coder"})]}),(0,mr.jsxs)(te,{children:[" ","\u2022 ",n("agentInstallDialog.color",{color:u.color})]})]}),(0,mr.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,mr.jsx)(te,{color:de.AccentCyan,children:n("agentInstallDialog.tools")}),(0,mr.jsx)(ue,{marginLeft:2,children:(0,mr.jsx)(te,{children:u.selectedTools?.length?u.selectedTools.join(", "):n("agentInstallDialog.allToolsAvailable")})})]}),(0,mr.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,mr.jsx)(te,{color:de.AccentCyan,children:n("agentInstallDialog.mcpServers")}),(0,mr.jsx)(ue,{marginLeft:2,children:(0,mr.jsx)(te,{children:u.selectedMcps?.length?u.selectedMcps.join(", "):n("agentInstallDialog.allMcpServersAvailable")})})]}),u.systemPrompt&&(0,mr.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,mr.jsx)(te,{color:de.AccentCyan,children:n("agentInstallDialog.systemPrompt")}),(0,mr.jsx)(ue,{marginLeft:2,children:(0,mr.jsx)(te,{children:u.systemPrompt.length>200?`${u.systemPrompt.substring(0,200)}...`:u.systemPrompt})})]})]}),(0,mr.jsxs)(ue,{marginTop:2,flexDirection:"column",children:[(0,mr.jsx)(te,{color:de.AccentYellow,children:n("agentInstallDialog.actions")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.enterToCreate")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.escToBackEdit")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.qToExit")})]})]}),Ce=()=>O?o==="preview"?le():o==="generated-preview"?be():o==="generating"?(0,mr.jsxs)(ue,{flexDirection:"column",children:[(0,mr.jsx)(te,{bold:!0,color:de.AccentCyan,children:n("agentInstallDialog.generatingTitle")}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.generatingDescription")})}),(0,mr.jsx)(ue,{marginTop:2,children:(0,mr.jsx)(te,{color:de.AccentYellow,children:S||n("agentInstallDialog.startingGeneration")})}),(0,mr.jsx)(ue,{marginTop:2,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.pleaseWait")})})]}):g&&O.type==="input"?(0,mr.jsxs)(ue,{flexDirection:"column",children:[(0,mr.jsx)(te,{bold:!0,color:de.AccentCyan,children:O.title}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.Gray,children:O.description})}),(0,mr.jsx)(ue,{marginTop:2,children:(0,mr.jsx)(N6,{onSubmit:j,onCancel:Y,placeholder:O.placeholder,label:O.title,defaultValue:G(),isFocused:!0})})]}):(0,mr.jsxs)(ue,{flexDirection:"column",children:[(0,mr.jsx)(te,{bold:!0,color:de.AccentCyan,children:O.title}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.Gray,children:O.description})}),O.type==="input"&&!g&&(0,mr.jsxs)(ue,{marginTop:2,children:[(0,mr.jsx)(te,{color:de.AccentYellow,children:G()?n("agentInstallDialog.currentValue",{value:G()}):n("agentInstallDialog.currentValueNotSet")}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.pressEnterToEdit")})})]}),(O.type==="select"||O.type==="multiselect")&&(0,mr.jsxs)(ue,{marginTop:2,flexDirection:"column",children:[O.type==="multiselect"&&(0,mr.jsxs)(ue,{marginBottom:2,flexDirection:"column",children:[(0,mr.jsx)(ue,{flexDirection:"row",children:(0,mr.jsxs)(te,{color:a===0?de.AccentCyan:void 0,children:[a===0?"> ":" ",n("agentInstallDialog.continue")]})}),(0,mr.jsx)(ue,{marginLeft:4,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.proceedToNextStep")})})]},"continue"),Q.map((ee,ie)=>{let ye=(O.type==="multiselect"?ie+1:ie)===a,oe=O.type==="multiselect"?o==="tools"?(u.selectedTools||[]).includes(ee.id):(u.selectedMcps||[]).includes(ee.id):!1;return(0,mr.jsxs)(ue,{marginBottom:1,flexDirection:"column",children:[(0,mr.jsx)(ue,{flexDirection:"row",children:(0,mr.jsxs)(te,{color:ye?de.AccentCyan:void 0,children:[ye?"> ":" ",O.type==="multiselect"&&(0,mr.jsx)(te,{children:oe?"[\u2713] ":"[ ] "}),O.type==="select"&&ee.id==="red"&&(0,mr.jsx)(te,{color:de.AccentRed,children:"\u2588 "}),O.type==="select"&&ee.id==="blue"&&(0,mr.jsx)(te,{color:de.AccentBlue,children:"\u2588 "}),O.type==="select"&&ee.id==="green"&&(0,mr.jsx)(te,{color:de.AccentGreen,children:"\u2588 "}),O.type==="select"&&ee.id==="yellow"&&(0,mr.jsx)(te,{color:de.AccentYellow,children:"\u2588 "}),O.type==="select"&&ee.id==="purple"&&(0,mr.jsx)(te,{color:de.AccentPurple,children:"\u2588 "}),O.type==="select"&&ee.id==="orange"&&(0,mr.jsx)(te,{color:de.AccentYellow,children:"\u2588 "}),O.type==="select"&&ee.id==="pink"&&(0,mr.jsx)(te,{color:de.AccentPurple,children:"\u2588 "}),O.type==="select"&&ee.id==="cyan"&&(0,mr.jsx)(te,{color:de.AccentCyan,children:"\u2588 "}),ee.title]})}),ee.description&&(0,mr.jsx)(ue,{marginLeft:4,children:(0,mr.jsx)(te,{color:de.Gray,children:ee.description})})]},ee.id)})]}),(0,mr.jsxs)(ue,{marginTop:2,flexDirection:"column",children:[(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.navigation")}),O.type==="input"&&!g&&(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.enterToEdit")}),(O.type==="select"||O.type==="multiselect"||O.type==="edit")&&(0,mr.jsxs)(mr.Fragment,{children:[(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.navigateOptions")}),(0,mr.jsxs)(te,{color:de.Gray,children:[" ","\u2022"," ",O.type==="edit"?n("agentInstallDialog.enterToEditField"):n("agentInstallDialog.enterToSelect")]})]}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.escToBack")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.qToExit")})]})]}):(0,mr.jsx)(ue,{flexDirection:"column",children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.generatingTitle")})});return h?(0,mr.jsxs)(ue,{borderStyle:"round",borderColor:de.AccentGreen,flexDirection:"column",padding:1,width:"100%",children:[(0,mr.jsx)(te,{bold:!0,color:de.AccentGreen,children:n("agentInstallDialog.agentInstallation")}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsxs)(te,{color:de.AccentGreen,children:["\u2714 ",h]})})]}):(0,mr.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,mr.jsx)(te,{bold:!0,children:n("agentInstallDialog.title")}),ae(),Ce(),f&&(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsxs)(te,{color:de.AccentRed,children:["\u274C ",f]})})]})},(t,e)=>t.config===e.config);var Z8=we(tr(),1);await tn();Nn();ui();var Mn=we(Pt(),1);function Ygi({settings:t,config:e,onExit:r,onStatusUpdate:n}){let{t:o}=fr(),[s,a]=(0,Z8.useState)("loading"),[c,u]=(0,Z8.useState)([]),[d,f]=(0,Z8.useState)(0),[p,h]=(0,Z8.useState)(0),[m,g]=(0,Z8.useState)(null),[A,y]=(0,Z8.useState)(null),[E,v]=(0,Z8.useState)(null),b=10,S=Math.ceil(c.length/b);(0,Z8.useEffect)(()=>{let T=async()=>{try{if(!t.merged.apiKey)return{success:!1,message:o("agentsOnlineDialog.authRequired")};let Q=await fetch("https://apis.iflow.cn/v1/agents/list",{method:"POST",headers:{"User-Agent":"iFlow-Cli","Content-Type":"application/json"},body:JSON.stringify({page:1,size:1e3,usePage:!0,visibility:"public",publishStatus:"published"})});if(!Q.ok){let B=o("agentsOnlineDialog.loadFailed");return Q.status===401?B=o("agentsOnlineDialog.authFailed"):Q.status===403?B=o("agentsOnlineDialog.accessDenied"):Q.status===404?B=o("agentsOnlineDialog.serviceNotFound"):Q.status>=500&&(B=o("agentsOnlineDialog.serverError")),{success:!1,message:B}}let F=await Q.json();return F.success?{success:!0,data:F.data?.data||[]}:{success:!1,message:F.message||o("agentsOnlineDialog.serverLoadFailed")}}catch(O){let Q=o("agentsOnlineDialog.connectionError");return O instanceof Error&&O.message.includes("Failed to fetch")&&(Q=o("agentsOnlineDialog.networkError")),{success:!1,message:Q}}};(async()=>{let O=await T();O.success&&O.data?(u(O.data),a("list"),O.data.length===0&&y(o("agentsOnlineDialog.noAgentsFound"))):(y(O.message||o("agentsOnlineDialog.loadAgentsFailed")),a("list"))})()},[t.merged.apiKey,o]);let w=async(T,N)=>{try{let{AgentRegistry:O}=await Promise.resolve().then(()=>(qt(),U_)),Q=new O,F=[],B=!0,G=!0,j,Y=null;if(T.extInfo&&typeof T.extInfo=="string")try{Y=JSON.parse(T.extInfo)}catch{}if(Y){if(B=Y["is-inherit-tools"],G=Y["is-inherit-mcps"]!==void 0?Y["is-inherit-mcps"]:!0,Y["allowed-tools"]){let X=Y["allowed-tools"].split(",").map(J=>J.trim()).filter(J=>J);X.length>0?F=X:F=Y["is-inherit-tools"]?["*"]:[]}else F=Y["is-inherit-tools"]?["*"]:[];if(Y.mcps){let X=Y.mcps.split(",").map(J=>J.trim()).filter(J=>J);X.length>0?j=X:j=Y["is-inherit-mcps"]?void 0:[]}else j=Y["is-inherit-mcps"]?void 0:[]}else{try{let X=JSON.parse(T.tools||"[]");F=Array.isArray(X)?X:["*"]}catch{F=["*"]}if(T.mcps)try{let X=JSON.parse(T.mcps);Array.isArray(X)&&X.length>0&&(j=X)}catch{let X=T.mcps.split(",").map(J=>J.trim()).filter(J=>J.length>0);X.length>0&&(j=X)}}let V={agentType:T.name.toLowerCase().replace(/[^a-z0-9]/g,"-"),name:T.name,description:T.description,whenToUse:T.description,allowedTools:F,allowedMcps:j,systemPrompt:T.detailContext||T.description,location:N==="user"?"global":"project",model:T.modelName,isInheritTools:B,isInheritMcps:G};return await Q.createAgent(V)?{success:!0,message:o("agentsCommand.install.successfullyInstalled",{name:T.name,scope:N})}:{success:!1,message:o("agentsOnlineDialog.createAgentFailed",{name:T.name})}}catch(O){return{success:!1,message:o("agentsOnlineDialog.installFailedWithError",{name:T.name,error:O})}}},k=async(T,N)=>{try{n?.(o("agentsOnlineDialog.installing",{name:T.name}));let O=await w(T,N);O.success?(v(O.message),y(null),n?.(O.message)):(y(O.message),v(null),n?.(`\u274C ${O.message}`))}catch(O){let Q=O instanceof Error?O.message:o("agentsOnlineDialog.installationFailed");y(Q),v(null),n?.(`\u274C ${Q}`)}};_n(T=>{if(T.name==="escape"){s==="detail"?(a("list"),g(null),y(null),v(null)):r();return}if(s==="list")if(T.name==="up"||T.sequence==="k"){let N=Math.max(p-1,0);h(N);let O=Math.floor(N/b);f(O)}else if(T.name==="down"||T.sequence==="j"){let N=Math.min(p+1,c.length-1);h(N);let O=Math.floor(N/b);f(O)}else if(T.name==="left"||T.sequence==="h"){let N=Math.max(d-1,0);f(N),h(N*b)}else if(T.name==="right"||T.sequence==="l"){let N=Math.min(d+1,S-1);f(N),h(Math.min(N*b,c.length-1))}else T.name==="return"?c.length>0&&p>=0&&p<c.length&&(g(c[p]),a("detail"),y(null),v(null)):T.sequence==="q"&&r();else s==="detail"&&m&&(T.sequence==="1"?k(m,"project"):T.sequence==="2"?k(m,"user"):T.sequence==="b"?(a("list"),g(null),y(null),v(null)):T.sequence==="q"&&r())},{isActive:!0});let D=()=>{if(c.length===0)return(0,Mn.jsxs)(ue,{flexDirection:"column",children:[(0,Mn.jsx)(te,{bold:!0,children:o("agentsOnlineDialog.availableAgents")}),(0,Mn.jsx)(ue,{marginTop:1,children:(0,Mn.jsx)(te,{color:de.AccentRed,children:A||o("agentsOnlineDialog.noAgentsAvailable")})})]});let T=d*b,N=Math.min(T+b,c.length),O=c.slice(T,N);return(0,Mn.jsxs)(ue,{flexDirection:"column",children:[(0,Mn.jsx)(te,{bold:!0,children:o("agentsOnlineDialog.availableAgentsWithCount",{count:c.length})}),(0,Mn.jsx)(ue,{marginTop:1,flexDirection:"column",children:O.map((Q,F)=>{let G=T+F===p;return(0,Mn.jsxs)(ue,{marginBottom:1,flexDirection:"row",children:[(0,Mn.jsxs)(ue,{width:30,flexShrink:0,flexDirection:"column",children:[(0,Mn.jsxs)(te,{color:G?de.AccentCyan:void 0,children:[G?"> ":" ",F+1,". ",Q.name]}),(0,Mn.jsx)(ue,{marginLeft:4,flexDirection:"column",children:(0,Mn.jsx)(te,{color:de.Gray,children:o("agentsOnlineDialog.category",{category:Q.category})})})]}),(0,Mn.jsx)(ue,{marginLeft:3,flexGrow:1,children:(0,Mn.jsx)(te,{color:de.Gray,children:Q.description})})]},Q.id)})}),(0,Mn.jsx)(ue,{marginTop:1,children:(0,Mn.jsx)(te,{color:de.AccentBlue,children:o("agentsOnlineDialog.pageOf",{current:d+1,total:S})})}),(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.Gray,children:o("agentsOnlineDialog.navigation")}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.navigateUpDown")]}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.prevNextPage")]}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.viewDetails")]}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.exit")]})]})]})},P=()=>m?(0,Mn.jsxs)(ue,{flexDirection:"column",children:[(0,Mn.jsx)(te,{bold:!0,children:m.name}),(0,Mn.jsx)(ue,{marginTop:1,children:(0,Mn.jsx)(te,{color:de.AccentBlue,children:m.description})}),(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.AccentCyan,children:o("agentsOnlineDialog.details")}),(0,Mn.jsxs)(te,{children:[" ","\u2022"," ",o("agentsOnlineDialog.model",{model:m.modelName})]}),(0,Mn.jsxs)(te,{children:[" ","\u2022"," ",o("agentsOnlineDialog.categoryLabel",{category:m.category})]}),(0,Mn.jsxs)(te,{children:[" ","\u2022"," ",o("agentsOnlineDialog.version",{version:m.version})]})]}),(()=>{let T=null;if(m.extInfo&&typeof m.extInfo=="string")try{T=JSON.parse(m.extInfo)}catch{}return T?(0,Mn.jsxs)(Mn.Fragment,{children:[(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.AccentCyan,children:o("agentsOnlineDialog.tools")}),(0,Mn.jsx)(ue,{marginLeft:2,children:(0,Mn.jsx)(te,{children:(()=>{let N=T["allowed-tools"]?T["allowed-tools"].split(",").map(Q=>Q.trim()).filter(Q=>Q):[],O=T["is-inherit-tools"]?o("agentsOnlineDialog.inherit"):o("agentsOnlineDialog.noInherit");return N.length>0?N.join(", ")+O:T["is-inherit-tools"]?o("agentsOnlineDialog.allToolsAvailableInherit"):o("agentsOnlineDialog.noToolsAvailableNoInherit")})()})})]}),(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.AccentCyan,children:o("agentsOnlineDialog.mcpServers")}),(0,Mn.jsx)(ue,{marginLeft:2,children:(0,Mn.jsx)(te,{children:(()=>{let N=T.mcps?T.mcps.split(",").map(Q=>Q.trim()).filter(Q=>Q):[],O=T["is-inherit-mcps"]?o("agentsOnlineDialog.inherit"):o("agentsOnlineDialog.noInherit");return N.length>0?N.join(", ")+O:T["is-inherit-mcps"]?o("agentsOnlineDialog.allMcpServersAvailableInherit"):o("agentsOnlineDialog.noMcpServersAvailableNoInherit")})()})})]})]}):(0,Mn.jsxs)(Mn.Fragment,{children:[(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.AccentCyan,children:o("agentsOnlineDialog.tools")}),(0,Mn.jsx)(ue,{marginLeft:2,children:(0,Mn.jsx)(te,{children:(()=>{if(!m.tools)return o("agentsOnlineDialog.allToolsAvailableInherit");try{let N=JSON.parse(m.tools);return Array.isArray(N)?N.length>0?N.join(", ")+o("agentsOnlineDialog.inherit"):o("agentsOnlineDialog.allToolsAvailableInherit"):(m.tools||o("agentsOnlineDialog.allToolsAvailableInherit").replace(o("agentsOnlineDialog.inherit"),""))+o("agentsOnlineDialog.inherit")}catch{return(m.tools||o("agentsOnlineDialog.allToolsAvailableInherit").replace(o("agentsOnlineDialog.inherit"),""))+o("agentsOnlineDialog.inherit")}})()})})]}),(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.AccentCyan,children:o("agentsOnlineDialog.mcpServers")}),(0,Mn.jsx)(ue,{marginLeft:2,children:(0,Mn.jsx)(te,{children:(()=>{if(!m.mcps||m.mcps.trim()==="")return o("agentsOnlineDialog.allMcpServersAvailableInherit");try{let N=JSON.parse(m.mcps);return Array.isArray(N)?N.length>0?N.join(", ")+o("agentsOnlineDialog.inherit"):o("agentsOnlineDialog.allMcpServersAvailableInherit"):(m.mcps||o("agentsOnlineDialog.allMcpServersAvailableInherit").replace(o("agentsOnlineDialog.inherit"),""))+o("agentsOnlineDialog.inherit")}catch{return(m.mcps||o("agentsOnlineDialog.allMcpServersAvailableInherit").replace(o("agentsOnlineDialog.inherit"),""))+o("agentsOnlineDialog.inherit")}})()})})]})]})})(),m.detailContext&&(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.AccentCyan,children:o("agentsOnlineDialog.systemPrompt")}),(0,Mn.jsx)(ue,{marginLeft:2,children:(0,Mn.jsx)(te,{children:m.detailContext.length>800?`${m.detailContext.substring(0,800)}...`:m.detailContext})})]}),(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.AccentYellow,children:o("agentsOnlineDialog.actions")}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.installProject")]}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.installUser")]}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.backToList")]}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.exit")]})]}),E&&(0,Mn.jsx)(ue,{marginTop:1,children:(0,Mn.jsxs)(te,{color:de.AccentGreen,children:["\u2714 ",E]})}),A&&(0,Mn.jsx)(ue,{marginTop:1,children:(0,Mn.jsx)(te,{color:de.AccentRed,children:A})})]}):null;return s==="loading"?(0,Mn.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Mn.jsx)(te,{bold:!0,children:o("agentsOnlineDialog.loadingTitle")}),(0,Mn.jsx)(ue,{marginTop:1,children:(0,Mn.jsx)(te,{children:o("agentsOnlineDialog.loadingMessage")})})]}):(0,Mn.jsx)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:s==="list"?D():P()})}var HF=we(tr(),1),Jgi=we(Pt(),1);var Kgi=(0,HF.createContext)(null),Xgi=({children:t,initialOutput:e=null})=>{let[r,n]=(0,HF.useState)(e),o=(0,HF.useCallback)(a=>{n(a)},[]),s={output:r,updateOutput:o};return(0,Jgi.jsx)(Kgi.Provider,{value:s,children:t})},jot=()=>{let t=(0,HF.useContext)(Kgi);if(!t)throw new Error("useStatusline must be used within StatuslineProvider");return t};var z5=we(tr(),1);await tn();Nn();var rk=we(tr(),1);await tn();Nn();var O6=we(Pt(),1);function du({items:t,initialIndex:e=0,onSelect:r,onHighlight:n,isFocused:o,showScrollArrows:s=!1,maxItemsToShow:a=10,showNumbers:c=!0}){let[u,d]=(0,rk.useState)(e),[f,p]=(0,rk.useState)(0),[h,m]=(0,rk.useState)(""),g=(0,rk.useRef)(null);(0,rk.useEffect)(()=>{let y=Math.max(0,Math.min(u-a+1,t.length-a));u<f?p(u):u>=f+a&&p(y)},[u,t.length,f,a]),(0,rk.useEffect)(()=>()=>{g.current&&clearTimeout(g.current)},[]),_n(y=>{if(!o||t.length===0)return;let E=c&&/^[0-9]$/.test(y.sequence||"");if(!E&&g.current&&(clearTimeout(g.current),m("")),y.sequence==="k"||y.name==="up"){let v=u>0?u-1:t.length-1;d(v),n?.(t[v].value);return}if(y.sequence==="j"||y.name==="down"){let v=u<t.length-1?u+1:0;d(v),n?.(t[v].value);return}if(y.name==="return"){r(t[u].value);return}if(E){g.current&&clearTimeout(g.current);let v=h+y.sequence;m(v);let b=Number.parseInt(v,10)-1;if(v==="0"){g.current=setTimeout(()=>m(""),350);return}if(b>=0&&b<t.length){let S=t[b];d(b),n?.(S.value),Number.parseInt(v+"0",10)>t.length?(r(S.value),m("")):g.current=setTimeout(()=>{r(S.value),m("")},350)}else m("")}},{isActive:o??!0});let A=t.slice(f,f+a);return(0,O6.jsxs)(ue,{flexDirection:"column",children:[s&&(0,O6.jsx)(te,{color:f>0?de.Foreground:de.Gray,children:"\u25B2"}),A.map((y,E)=>{let v=f+E,b=u===v,S=de.Foreground,w=de.Foreground;b?(S=de.AccentGreen,w=de.AccentGreen):y.disabled&&(S=de.Gray,w=de.Gray),c||(w=de.Gray);let k=String(t.length).length,D=`${String(v+1).padStart(k)}.`;return(0,O6.jsxs)(ue,{alignItems:"center",children:[(0,O6.jsx)(ue,{minWidth:2,flexShrink:0,children:(0,O6.jsx)(te,{color:b?de.AccentGreen:de.Foreground,children:b?"\u25CF":" "})}),(0,O6.jsx)(ue,{marginRight:1,flexShrink:0,minWidth:D.length,children:(0,O6.jsx)(te,{color:w,children:D})}),y.themeNameDisplay&&y.themeTypeDisplay?(0,O6.jsxs)(te,{color:S,wrap:"truncate",children:[y.themeNameDisplay," ",(0,O6.jsx)(te,{color:de.Gray,children:y.themeTypeDisplay})]}):(0,O6.jsx)(te,{color:S,wrap:"truncate",children:y.label})]},y.label)}),s&&(0,O6.jsx)(te,{color:f+a<t.length?de.Foreground:de.Gray,children:"\u25BC"})]})}var Lle=we(tr(),1);await tn();Nn();var T6a=/^[a-zA-Z0-9!@#$%^&*()\-_=+\[\]{}|\\:;"'<>,.?/~]+$/;function $ot(t){return!t||t.trim().length===0?!1:T6a.test(t)}ui();var B6=we(Pt(),1);function Ule({onSubmit:t,onCancel:e,placeholder:r,label:n,isFocused:o=!0,validateApiKey:s=!1,validationError:a}){let{t:c}=fr(),u=r||c("passwordInput.defaultPlaceholder"),d=n||c("passwordInput.defaultLabel"),f=a||c("passwordInput.validationError"),[p,h]=(0,Lle.useState)(""),[m,g]=(0,Lle.useState)(!0),[A,y]=(0,Lle.useState)(null);(0,Lle.useEffect)(()=>{if(!o)return;let b=setInterval(()=>{g(S=>!S)},500);return()=>clearInterval(b)},[o]),_n(b=>{if(b.name==="return"||b.name==="enter"){if(p.trim()){let S=p.trim().replace(/^~+|~+$/g,"");if(s&&!$ot(S)){y(f);return}y(null),t(S)}return}if(b.name==="escape"){e?.();return}if(b.name==="backspace"||b.name==="delete"){h(S=>S.slice(0,-1));return}if(b.paste&&b.sequence){let S=b.sequence.split("").filter(w=>{let k=w.charCodeAt(0);return k>=32&&k!==127||s&&$ot(w)}).join("");S&&h(w=>w+S);return}if(b.sequence&&!b.ctrl&&!b.meta){if(b.sequence.length===1){let S=b.sequence;(S.charCodeAt(0)>=32&&S.charCodeAt(0)!==127||s&&$ot(S))&&h(w=>w+S)}else if(b.sequence.length>1){let S=b.sequence;/[\x00-\x1F\x7F]/.test(S)||h(w=>w+S)}}},{isActive:o});let E="\u2022".repeat(p.length),v=m&&o?"\u2502":"";return(0,B6.jsxs)(ue,{flexDirection:"column",children:[(0,B6.jsx)(ue,{children:(0,B6.jsxs)(te,{color:de.Gray,children:[d," "]})}),(0,B6.jsx)(ue,{marginTop:1,children:(0,B6.jsx)(ue,{borderStyle:"round",borderColor:A?de.AccentRed:o?de.AccentBlue:de.Gray,paddingX:1,width:"100%",children:(0,B6.jsxs)(te,{children:[E||(0,B6.jsx)(te,{color:de.Gray,children:u}),v]})})}),A&&(0,B6.jsx)(ue,{marginTop:1,children:(0,B6.jsx)(te,{color:de.AccentRed,children:A})}),(0,B6.jsx)(ue,{marginTop:1,children:(0,B6.jsx)(te,{color:de.Gray,dimColor:!0,children:c("passwordInput.instructions")})})]})}Tl();qt();ui();import{exec as I6a}from"child_process";import{promisify as D6a}from"util";var VF=class{id;display;desc;owner;supportType;multimodal;internal;defaultConfig;constructor(e){this.id=e.id,this.display=e.display,this.desc=e.desc,this.owner=e.owner,this.supportType=e.supportType,this.multimodal=e.multimodal,this.internal=e.internal,this.defaultConfig=e.defaultConfig}};var WF=class{default;type;constructor(e){this.default=e.default,this.type=e.type}};var Got=class t{label;value;constructor(e,r){this.label=e,this.value=r}static fromModelInfo(e){return new t(e.display,e.id)}};var qot=class{repoPath;securityLevel;constructor(e){this.repoPath=e.repoPath,this.securityLevel=e.securityLevel}isC3(){return this.securityLevel==="C3"}};var R6a=D6a(I6a);async function Hot(t){try{let e=await fetch("https://ducky.code.alibaba-inc.com/v1/models",{headers:{Authorization:`Bearer ${t}`}});if(!e.ok)throw new Error(`Failed to fetch models: ${e.status} ${e.statusText}`);return(await e.json()).map(n=>new VF({id:n.id,display:n.display,desc:n.desc,owner:n.owner,supportType:n.supportType,multimodal:n.multimodal,internal:n.internal,defaultConfig:new WF(n.defaultConfig)}))}catch(e){return console.error("Error fetching models:",e),k6a()}}function k6a(){return[new VF({id:"ide-whale/qwen3-coder",display:"Qwen3-Coder",desc:"Qwen3-Coder",owner:"",supportType:["chat","llm","agent","cli"],multimodal:!1,internal:!0,defaultConfig:new WF({default:!0})}),new VF({id:"ide-idealab/claude4-sonnet",display:"Claude-4-Sonnet",desc:"Claude-4-Sonnet",owner:"",supportType:["chat","llm","agent"],multimodal:!0,defaultConfig:new WF({})}),new VF({id:"ide-whale/deepseek-v3.2-exp",display:"DeepSeek-V3.2-Whale",desc:"DeepSeek-V3.2",owner:"",supportType:["agent","chat","llm","cli"],multimodal:!1,internal:!0,defaultConfig:new WF({})}),new VF({id:"ide-whale/kimi_k2",display:"Kimi-K2",desc:"Kimi-K2",owner:"",supportType:["chat","llm"],multimodal:!1,internal:!0,defaultConfig:new WF({})})]}function Vot(t){return t.map(e=>Got.fromModelInfo(e))}async function N6a(t){try{let e=t?{cwd:t}:{},{stdout:r,stderr:n}=await R6a("git remote get-url origin",e);return n&&console.error("Git command stderr:",n),r.trim()}catch(e){return console.error("Error getting git remote URL:",e),null}}function O6a(t){if(!t)return null;try{let e=t.trim();e.endsWith(".git")&&(e=e.slice(0,-4));let r=e.match(/^git@[^:]+:(.+)$/);if(r)return r[1];let n=e.match(/^https?:\/\/[^/]+\/(.+)$/);return n?n[1]:null}catch(e){return console.error("Error extracting repo path from git URL:",e),null}}async function B6a(t,e){try{let r=`https://code.alibaba-inc.com/api/v4/projects/settings/security_level?private_token=${e}&repos=${t}`,n=await fetch(r);if(!n.ok)return console.error(`Failed to fetch security level: ${n.status} ${n.statusText}`),null;let o=await n.json();return o.length===0?null:new qot({repoPath:o[0].repo_path,securityLevel:o[0].security_level})}catch(r){return console.error("Error fetching security level:",r),null}}function Wot(t){return t.filter(e=>{let r=e.supportType.includes("cli"),n=e.id.toLowerCase().includes("gpt-5")||e.display.toLowerCase().includes("gpt-5"),o=e.id.toLowerCase().includes("deepseek")||e.display.toLowerCase().includes("deepseek");return r&&!n&&!o})}function zot(t,e){return!e||!e.isC3()?t:t.filter(r=>r.internal===!0)}async function NW(t,e){let r=await N6a(e);if(!r)return console.error("Failed to get git remote URL"),null;let n=O6a(r);return n?B6a(n,t):(console.error("Failed to extract repo path from git URL:",r),null)}function Yot(t){return[...t].sort((e,r)=>{let n=e.id.toLowerCase().includes("qwen3-coder")||e.display.toLowerCase().includes("qwen3-coder"),o=r.id.toLowerCase().includes("qwen3-coder")||r.display.toLowerCase().includes("qwen3-coder");return n&&!o?-1:!n&&o?1:e.display.localeCompare(r.display)})}var x4e=we(tr(),1);await tn();OW();Nn();ui();var w4e=we(Pt(),1);function a0i({text:t}){let{t:e}=fr(),[r,n]=(0,x4e.useState)(!1),[o,s]=(0,x4e.useState)(!0),a=async()=>{try{await Qle(t),n(!0),setTimeout(()=>{n(!1)},2e3)}catch{}};return _n(c=>{if(!o)return;let u=c.name||c.sequence;(u==="c"||u==="C")&&(c.ctrl||c.meta)&&a()},{isActive:o}),(0,x4e.useEffect)(()=>(s(!0),()=>{s(!1)}),[]),(0,w4e.jsxs)(ue,{marginTop:1,flexDirection:"column",gap:1,paddingX:1,children:[(0,w4e.jsx)(te,{color:de.AccentBlue,children:t}),(0,w4e.jsx)(te,{color:"gray",children:r?e("copyableUrlBox.copied"):""})]})}var ti=we(Pt(),1);function c0i(t){return t&&Object.values(Jt).includes(t)?t:null}function l0i({onSelect:t,settings:e,initialErrorMessage:r}){let{t:n}=fr(),[o,s]=(0,z5.useState)("select"),[a,c]=(0,z5.useState)(null),[u,d]=(0,z5.useState)({baseUrl:"",apiKey:""}),[f,p]=(0,z5.useState)("baseUrl"),[h,m]=(0,z5.useState)(""),[g,A]=(0,z5.useState)(""),[y,E]=(0,z5.useState)(""),[v,b]=(0,z5.useState)([]),[S,w]=(0,z5.useState)(!1),[k,D]=(0,z5.useState)(()=>{if(r)return r;let J=c0i(process.env.GEMINI_DEFAULT_AUTH_TYPE);return null}),P="global",T=[P==="global"&&{label:n("authDialog.loginWithIFlowRecommend"),value:Jt.LOGIN_WITH_IFLOW},P==="global"&&{label:n("authDialog.loginWithIFlowApiKey"),value:Jt.IFLOW},P==="aone"&&{label:n("authDialog.loginWithAoneRecommend"),value:Jt.LOGIN_WITH_AONE},P==="aone"&&{label:n("authDialog.loginWithAoneApiKey"),value:Jt.AONE},{label:n("authDialog.openaiCompatibleApi"),value:Jt.OPENAI_COMPATIBLE}].filter(Boolean),N=Math.max(0,T.findIndex(J=>{if(e.merged.selectedAuthType)return J.value===e.merged.selectedAuthType;let z=c0i(process.env.GEMINI_DEFAULT_AUTH_TYPE);return z?J.value===z:P==="aone"?J.value===Jt.LOGIN_WITH_AONE:J.value===Jt.LOGIN_WITH_IFLOW})),O=J=>{if(J===Jt.LOGIN_WITH_IFLOW){let z=e.merged.isServerOAuth2==="true";if(!_N()||z){c(J);let K=Jwe();E(K),s("input-oauth-code"),D(null)}else{let K=OF(J);K?D(K):(D(null),t(J,"User"))}}else if(IE.includes(J))c(J),s("input-api-key"),D(null);else if(J===Jt.OPENAI_COMPATIBLE)c(J),s("input-openai-config"),p("baseUrl"),d({baseUrl:"",apiKey:""}),D(null);else{let z=OF(J);z?D(z):(D(null),t(J,"User"))}},Q=async J=>{if(a&&IE.includes(a)){if(A(J),a===Jt.AONE){w(!0);try{let z=Buffer.from(J,"utf8").toString("base64"),K=await Hot(z),ae=Wot(K),be=await NW(J);be?.isC3()&&(ae=zot(ae,be));let le=Yot(ae),Ce=Vot(le);b(Ce)}catch(z){console.error("Failed to load models:",z),b([{label:"Qwen3-Coder",value:"ide-whale/qwen3-coder"},{label:"Claude-4-Sonnet",value:"ide-idealab/claude4-sonnet"},{label:"DeepSeek-V3.2-Whale",value:"ide-whale/deepseek-v3.2-exp"},{label:"Kimi-K2",value:"ide-whale/kimi_k2"}])}finally{w(!1)}}else a===Jt.IFLOW&&b([{label:`GLM-4.6(${n("modelDialog.recommend")})`,value:"glm-4.6"},{label:"DeepSeek-V3.2",value:"deepseek-v3.2-chat"},{label:"Qwen3-Coder-Plus",value:"qwen3-coder-plus"},{label:"Kimi-K2-Thinking",value:"kimi-k2-thinking"},{label:"MiniMax-M2",value:"minimax-m2"},{label:"Kimi-K2-0905",value:"kimi-k2-0905"}]);s("input-model-name"),m("")}},F=J=>{if(f==="baseUrl")d(z=>({...z,baseUrl:J})),p("apiKey");else if(f==="apiKey")d(z=>({...z,apiKey:J})),p("modelName");else if(f==="modelName"){d(K=>({...K,modelName:J})),m(J);let z={...u,modelName:J};t(a,"User",z)}},B=()=>{s("select"),c(null),D(null)},G=()=>{f==="modelName"?p("apiKey"):f==="apiKey"?p("baseUrl"):(s("select"),c(null),d({baseUrl:"",apiKey:""}),p("baseUrl"),D(null))},j=J=>{if(a&&IE.includes(a))if(m(J),a===Jt.IFLOW){let z={baseUrl:"https://apis.iflow.cn/v1",apiKey:g,modelName:J,searchApiKey:g};t(a,"User",z)}else if(a===Jt.AONE){let z=Buffer.from(g,"utf8").toString("base64"),K={baseUrl:"https://ducky.code.alibaba-inc.com/v1/openai",apiKey:z,modelName:J,searchApiKey:z};t(a,"User",K)}else{let z={apiKey:g,modelName:J};t(a,"User",z)}},Y=J=>{if(a&&IE.includes(a))if(m(J),a===Jt.IFLOW){let z={baseUrl:"https://apis.iflow.cn/v1",apiKey:g,modelName:J,searchApiKey:g};t(a,"User",z)}else if(a===Jt.AONE){let z=Buffer.from(g,"utf8").toString("base64"),K={baseUrl:"https://ducky.code.alibaba-inc.com/v1/openai",apiKey:z,modelName:J,searchApiKey:z};t(a,"User",K)}else{let z={apiKey:g,modelName:J};t(a,"User",z)}},V=()=>{a&&IE.includes(a)?s("input-api-key"):(s("input-openai-config"),p("apiKey"))},L=async J=>{try{let z=await Zwe(J);if(z.apiKey){let K={baseUrl:"https://apis.iflow.cn/v1",apiKey:z.apiKey,modelName:"qwen3-coder-plus",searchApiKey:z.apiKey,isServerOAuth2:"true"};t(a,"User",K)}else D(n("authDialog.failedToGetApiKey"))}catch(z){D(z instanceof Error?z.message:n("authDialog.authFailed"))}},X=()=>{s("select"),c(null),E(""),D(null)};return _n(J=>{if(J.name==="escape"){if(k)return;if(e.merged.selectedAuthType===void 0){D(n("authDialog.mustSelectAuth"));return}t(void 0,"User")}},{isActive:!0}),o==="input-oauth-code"?(0,ti.jsxs)(ue,{flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.iflowOAuthLogin")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.oauthStep1")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(a0i,{text:y})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.oauthStep2")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.oauthStep3")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(N6,{onSubmit:L,onCancel:X,label:n("authDialog.authCodeLabel"),placeholder:n("authDialog.authCodePlaceholder"),isFocused:!0})}),k&&(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{color:de.AccentRed,children:k})})]}):o==="input-api-key"?a===Jt.IFLOW?(0,ti.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.iflowAuth")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.enterIFlowApiKey")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(Ule,{onSubmit:Q,onCancel:B,label:n("authDialog.apiKeyLabel"),placeholder:n("authDialog.apiKeyPlaceholder"),isFocused:!0,validateApiKey:!0})})]}):(0,ti.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.aoneAuth")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.enterAoneApiKey")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(Ule,{onSubmit:Q,onCancel:B,label:n("authDialog.apiKeyLabel"),placeholder:n("authDialog.privateTokenPlaceholder"),isFocused:!0,validateApiKey:!0})})]}):o==="input-model-name"?a===Jt.IFLOW||a===Jt.AONE?S?(0,ti.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.modelConfig")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{color:de.AccentBlue,children:n("modelDialog.loading")})})]}):(0,ti.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.modelConfig")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.selectModel")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{color:de.AccentBlue,children:n("authDialog.defaultSelection")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(du,{items:v,initialIndex:0,onSelect:Y,isFocused:!0})})]}):(0,ti.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.modelConfig")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.enterModelName")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(N6,{onSubmit:j,onCancel:V,label:n("authDialog.modelNameLabel"),placeholder:n("authDialog.modelNamePlaceholder"),isFocused:!0})})]}):o==="input-openai-config"?(0,ti.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.openaiConfig")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n(f==="baseUrl"?"authDialog.enterBaseUrl":f==="apiKey"?"authDialog.enterApiKey":"authDialog.enterOpenaiModelName")})}),(0,ti.jsx)(ue,{marginTop:1,children:f==="baseUrl"?(0,ti.jsx)(N6,{onSubmit:F,onCancel:G,label:n("authDialog.baseUrlLabel"),placeholder:n("authDialog.baseUrlPlaceholder"),isFocused:!0}):f==="apiKey"?(0,ti.jsx)(Ule,{onSubmit:F,onCancel:G,label:n("authDialog.apiKeyLabel"),placeholder:n("authDialog.openaiApiKeyPlaceholder"),isFocused:!0,validateApiKey:!0}):(0,ti.jsx)(N6,{onSubmit:F,onCancel:G,label:n("authDialog.modelNameLabel"),placeholder:n("authDialog.openaiModelPlaceholder"),isFocused:!0})}),f==="baseUrl"&&u.baseUrl&&(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{color:de.Gray,children:n("authDialog.current",{value:u.baseUrl})})})]}):(0,ti.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.getStarted")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.howToAuth")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(du,{items:T,initialIndex:N,onSelect:O,isFocused:!0})}),k&&(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{color:de.AccentRed,children:k})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{color:de.Gray,children:n("authDialog.useEnterToSelect")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.termsOfService")})})]})}await tn();var jle=we(tr(),1);await tn();var h0i=we(p0i(),1);function M6a({type:t="dots"}){let[e,r]=(0,jle.useState)(0),n=h0i.default[t];return(0,jle.useEffect)(()=>{let o=setInterval(()=>{r(s=>s===n.frames.length-1?0:s+1)},n.interval);return()=>{clearInterval(o)}},[n]),jle.default.createElement(te,null,n.frames[e])}var $le=M6a;var Jot=we(tr(),1);ui();Nn();var Q_=we(Pt(),1);function m0i({onTimeout:t,authUrl:e}){let{t:r}=fr(),[n,o]=(0,Jot.useState)(!1);return _n(s=>{s.name==="escape"&&t()},{isActive:!0}),(0,Jot.useEffect)(()=>{let s=setTimeout(()=>{o(!0),t()},18e4);return()=>clearTimeout(s)},[t]),(0,Q_.jsx)(ue,{flexDirection:"column",padding:1,width:"100%",children:n?(0,Q_.jsx)(te,{color:de.AccentRed,children:r("authInProgress.authTimeout")}):(0,Q_.jsxs)(Q_.Fragment,{children:[e&&(0,Q_.jsxs)(ue,{flexDirection:"column",children:[(0,Q_.jsx)(te,{color:de.Gray,children:r("authInProgress.copyUrlPrompt")}),(0,Q_.jsx)(ue,{marginTop:1,children:(0,Q_.jsx)(te,{color:de.AccentBlue,wrap:"wrap",children:e})})]}),(0,Q_.jsx)(ue,{marginTop:e?1:0,children:(0,Q_.jsxs)(te,{children:[(0,Q_.jsx)($le,{type:"dots"})," ",r("authInProgress.waitingForAuth")]})})]})})}await tn();Nn();qt();ui();var T4e=we(Pt(),1);var g0i=({approvalMode:t})=>{let{t:e}=fr(),r="",n="",o="";switch(t){case yn.SMART:r="blue",n=e("input.smartMode"),o=e("input.toggleHint");break;case yn.PLAN:r=de.AccentGreen,n=e("input.planMode"),o=e("input.toggleHint");break;case yn.YOLO:r=de.AccentRed,n=e("input.yoloMode"),o=e("input.toggleHint");break;case yn.DEFAULT:r=de.AccentGreen,n=e("input.defaultMode"),o=e("input.toggleHint");break;default:break}return(0,T4e.jsx)(ue,{children:(0,T4e.jsxs)(te,{color:r,children:[n,o&&(0,T4e.jsx)(te,{color:de.Gray,children:o})]})})};await tn();Nn();ui();var BW=we(Pt(),1);var A0i=({enabled:t,supported:e})=>{let{t:r}=fr();return e?(0,BW.jsx)(ue,{marginRight:1,children:(0,BW.jsxs)(te,{color:t?de.AccentGreen:de.Gray,children:[r("input.thinkingMode"),":",r(t?"input.thinkingOn":"input.thinkingOff"),(0,BW.jsx)(te,{color:de.Gray,children:r("input.thinkingToggleHint")})]})}):(0,BW.jsx)(ue,{marginRight:1,children:(0,BW.jsxs)(te,{color:de.Gray,children:[r("input.thinkingMode"),":",r("input.thinkingNotSupported")]})})};var Zot=we(tr(),1);await tn();ui();Nn();var pd=we(Pt(),1);import*as est from"fs/promises";function y0i({onConfirm:t,onCancel:e,config:r,projectRoot:n}){let{t:o}=fr(),[s,a]=(0,Zot.useState)({sessionCount:0,diskUsage:o("cleanupHistoryDialog.calculating"),projectPath:"",isLoading:!0});(0,Zot.useEffect)(()=>{(async()=>{if(!r){a({sessionCount:0,diskUsage:o("cleanupHistoryDialog.unknown"),projectPath:"",isLoading:!1});return}try{let{FileSystemUtil:f,ProjectNameGenerator:p}=await Promise.resolve().then(()=>(H5(),Xor)),h=p.fromPath(n),m=f.getProjectDir(h),g=0,A=0;try{let v=(await est.readdir(m)).filter(b=>b.endsWith(".jsonl"));g=v.length;for(let b of v){let S=`${m}/${b}`,w=await est.stat(S);A+=w.size}}catch(E){if(E&&typeof E=="object"&&"code"in E&&E.code!=="ENOENT")throw E}let y=(A/1024/1024).toFixed(2);a({sessionCount:g,diskUsage:`${y} MB`,projectPath:n,isLoading:!1})}catch{a({sessionCount:0,diskUsage:o("cleanupHistoryDialog.calculationFailed"),projectPath:n,isLoading:!1})}})()},[r,n,o]),_n(d=>{d.name==="escape"&&e()},{isActive:!0});let c=[{label:o("cleanupHistoryDialog.confirmOption"),value:"confirm"},{label:o("cleanupHistoryDialog.cancelOption"),value:"cancel"}],u=async d=>{d==="confirm"?await t():e()};return s.isLoading?(0,pd.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,pd.jsxs)(te,{bold:!0,children:["\u26A0\uFE0F ",o("cleanupHistoryDialog.title")]}),(0,pd.jsx)(ue,{marginTop:1,children:(0,pd.jsx)(te,{color:de.AccentBlue,children:o("cleanupHistoryDialog.loadingStats")})})]}):(0,pd.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,pd.jsxs)(te,{bold:!0,children:["\u26A0\uFE0F ",o("cleanupHistoryDialog.title")]}),(0,pd.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,pd.jsx)(te,{children:o("cleanupHistoryDialog.currentStatus")}),(0,pd.jsxs)(ue,{marginLeft:2,flexDirection:"column",children:[(0,pd.jsxs)(te,{children:["\u2022 ",o("cleanupHistoryDialog.projectPath"),(0,pd.jsx)(te,{color:de.AccentBlue,children:s.projectPath})]}),(0,pd.jsxs)(te,{children:["\u2022 ",o("cleanupHistoryDialog.sessions"),(0,pd.jsxs)(te,{color:de.AccentGreen,children:[s.sessionCount," ",o("cleanupHistoryDialog.sessionsUnit")]})]}),(0,pd.jsxs)(te,{children:["\u2022 ",o("cleanupHistoryDialog.diskUsage")," ",(0,pd.jsx)(te,{color:de.AccentGreen,children:s.diskUsage})]})]})]}),(0,pd.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,pd.jsx)(te,{color:de.AccentRed,children:o("cleanupHistoryDialog.warningTitle")}),(0,pd.jsxs)(ue,{marginLeft:2,flexDirection:"column",children:[(0,pd.jsxs)(te,{children:["\u2022 ",o("cleanupHistoryDialog.warningDeleteHistory")]}),(0,pd.jsxs)(te,{children:["\u2022 ",o("cleanupHistoryDialog.warningFreeSpace")]})]})]}),(0,pd.jsx)(ue,{marginTop:1,children:(0,pd.jsx)(du,{items:c,initialIndex:1,onSelect:u,isFocused:!0})}),(0,pd.jsx)(ue,{marginTop:1,children:(0,pd.jsx)(te,{color:de.Gray,children:o("cleanupHistoryDialog.instructions")})})]})}var tst=we(tr(),1);await tn();ui();Nn();qt();var ql=we(Pt(),1);import*as _0i from"path";function E0i({onConfirm:t,onCancel:e,gitService:r,config:n,projectRoot:o}){let{t:s}=fr(),[a,c]=(0,tst.useState)({checkpointCount:0,commitCount:0,diskUsage:s("cleanupCheckpointDialog.calculating"),isLoading:!0});(0,tst.useEffect)(()=>{(async()=>{if(!r||!n){c({checkpointCount:0,commitCount:0,diskUsage:s("cleanupCheckpointDialog.unknown"),isLoading:!1});return}try{let p=n.getProjectTempDir()?_0i.join(n.getProjectTempDir(),"checkpoints"):void 0;if(!p)throw new Error(s("cleanupCheckpointDialog.cannotGetCheckpointDir"));let m=await new NF(r,p).getCheckpointCount(),g=await r.getCommitCount(),A=r.getHistoryDir(),E=(await r.getDirectorySize(A)/1024/1024).toFixed(2);c({checkpointCount:m,commitCount:g,diskUsage:`${E} MB`,isLoading:!1})}catch{c({checkpointCount:0,commitCount:0,diskUsage:s("cleanupCheckpointDialog.calculationFailed"),isLoading:!1})}})()},[r,n,o,s]),_n(f=>{f.name==="escape"&&e()},{isActive:!0});let u=[{label:s("cleanupCheckpointDialog.confirmOption"),value:"confirm"},{label:s("cleanupCheckpointDialog.cancelOption"),value:"cancel"}],d=async f=>{f==="confirm"?await t():e()};return a.isLoading?(0,ql.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ql.jsxs)(te,{bold:!0,children:["\u26A0\uFE0F ",s("cleanupCheckpointDialog.title")]}),(0,ql.jsx)(ue,{marginTop:1,children:(0,ql.jsx)(te,{color:de.AccentBlue,children:s("cleanupCheckpointDialog.loadingStats")})})]}):(0,ql.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ql.jsxs)(te,{bold:!0,children:["\u26A0\uFE0F ",s("cleanupCheckpointDialog.title")]}),(0,ql.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,ql.jsx)(te,{children:s("cleanupCheckpointDialog.currentStatus")}),(0,ql.jsxs)(ue,{marginLeft:2,flexDirection:"column",children:[(0,ql.jsxs)(te,{children:["\u2022 ",s("cleanupCheckpointDialog.projectPath"),(0,ql.jsx)(te,{color:de.AccentBlue,children:o})]}),(0,ql.jsxs)(te,{children:["\u2022 ",s("cleanupCheckpointDialog.checkpoints"),(0,ql.jsxs)(te,{color:de.AccentGreen,children:[a.checkpointCount," ",s("cleanupCheckpointDialog.checkpointsUnit")]})," ",s("cleanupCheckpointDialog.jsonFiles")]}),(0,ql.jsxs)(te,{children:["\u2022 ",s("cleanupCheckpointDialog.gitHistory"),(0,ql.jsxs)(te,{color:de.AccentGreen,children:[a.commitCount," ",s("cleanupCheckpointDialog.commits")]})]}),(0,ql.jsxs)(te,{children:["\u2022 ",s("cleanupCheckpointDialog.diskUsage")," ",(0,ql.jsx)(te,{color:de.AccentGreen,children:a.diskUsage})]})]})]}),(0,ql.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,ql.jsx)(te,{color:de.AccentRed,children:s("cleanupCheckpointDialog.warningTitle")}),(0,ql.jsxs)(ue,{marginLeft:2,flexDirection:"column",children:[(0,ql.jsxs)(te,{children:["\u2022 ",s("cleanupCheckpointDialog.warningDeleteHistory")]}),(0,ql.jsxs)(te,{children:["\u2022 ",s("cleanupCheckpointDialog.warningFreeSpace")]}),(0,ql.jsxs)(te,{children:["\u2022 ",s("cleanupCheckpointDialog.warningNoRestore")]})]})]}),(0,ql.jsx)(ue,{marginTop:1,children:(0,ql.jsx)(du,{items:u,initialIndex:1,onSelect:d,isFocused:!0})}),(0,ql.jsx)(ue,{marginTop:1,children:(0,ql.jsx)(te,{color:de.Gray,children:s("cleanupCheckpointDialog.instructions")})})]})}var Y5=we(tr(),1);await tn();Nn();ui();import Zsr from"fs/promises";import ear from"path";import F6a from"os";var Gi=we(Pt(),1);function v0i({settings:t,config:e,onExit:r,onStatusUpdate:n}){let{t:o}=fr(),[s,a]=(0,Y5.useState)("loading"),[c,u]=(0,Y5.useState)([]),[d,f]=(0,Y5.useState)(1),[p,h]=(0,Y5.useState)(0),[m,g]=(0,Y5.useState)(null),[A,y]=(0,Y5.useState)(null),[E,v]=(0,Y5.useState)(null),[b,S]=(0,Y5.useState)(0),w=10,k=Math.ceil(b/w);(0,Y5.useEffect)(()=>{let F=async G=>{try{if(!t.merged.apiKey)throw new Error(o("commandsOnlineDialog.apiKeyNotFound"));let Y=new URL("https://apis.iflow.cn/v1/commands/list"),V=await fetch(Y.toString(),{method:"POST",headers:{"User-Agent":"iFlow-Cli","Content-Type":"application/json"},body:JSON.stringify({page:G,size:w,usePage:!0,visibility:"public",publishStatus:"published"})});if(!V.ok){let z=o("commandsOnlineDialog.unableToLoadCommands");throw V.status===401?z=o("commandsOnlineDialog.authenticationFailed"):V.status===403?z=o("commandsOnlineDialog.accessDenied"):V.status===404?z=o("commandsOnlineDialog.serviceNotFound"):V.status>=500&&(z=o("commandsOnlineDialog.serverError")),new Error(z)}let L=await V.json();if(!L.success)throw new Error(L.message||o("commandsOnlineDialog.failedToFetchCommands"));let X=Array.isArray(L.data?.data)?L.data.data:[],J=L.data?.total||X.length;return{commands:X,total:J}}catch(j){throw new Error(o("commandsOnlineDialog.failedToFetchCommandsWithError",{error:j}))}};(async()=>{try{let G=await F(d);u(G.commands),S(G.total),a("list"),h(0),G.commands.length===0&&y(o("commandsOnlineDialog.noCommandsFound"))}catch(G){y(G instanceof Error?G.message:o("commandsOnlineDialog.failedToLoadCommands")),a("list"),h(0)}})()},[d,t,o]);let D=F=>F.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),P=F=>F==="user"?ear.join(F6a.homedir(),".iflow","commands"):ear.join(process.cwd(),".iflow","commands"),T=async(F,B)=>{try{let G=P(B);await Zsr.mkdir(G,{recursive:!0});let j=`${D(F.name)}.toml`,Y=ear.join(G,j);try{return await Zsr.access(Y),{success:!1,message:o("commandsOnlineDialog.commandAlreadyInstalled",{name:F.name,scope:B})}}catch{}let V=`# Command: ${F.name}
6236
+ ${o.updateMessage}`),C0.emit("update-received",{message:s}),!o.updateCommand||e.merged.disableAutoUpdate)return;let a=t.update.latest.includes("nightly"),c=t.update.latest.includes("beta"),u=o.updateCommand.replace("@latest",a?"@nightly":c?"@beta":`@${t.update.latest}`),d=n(u,{stdio:"pipe",shell:!0}),f="";return d.stderr.on("data",p=>{f+=p.toString()}),d.on("close",p=>{p===0?C0.emit("update-success",{message:"Update successful! The new version will be used on your next run."}):C0.emit("update-failed",{message:`Automatic update failed. Please try updating manually. (command: ${u}, stderr: ${f.trim()})`})}),d.on("error",p=>{C0.emit("update-failed",{message:`Automatic update failed. Please try updating manually. (error: ${p.message})`})}),d}function Wsr(t,e){let r=!1,n=c=>{e(c);let u=c.message;setTimeout(()=>{r||t({type:"info",text:u},Date.now()),e(null)},6e4)},o=()=>{e(null),t({type:"error",text:R.t("autoUpdate.failed")},Date.now())},s=()=>{r=!0,e(null),t({type:"info",text:R.t("autoUpdate.ok")},Date.now())},a=c=>{t({type:"info",text:c.message},Date.now())};return C0.on("update-received",n),C0.on("update-failed",o),C0.on("update-success",s),C0.on("update-info",a),()=>{C0.off("update-received",n),C0.off("update-failed",o),C0.off("update-success",s),C0.off("update-info",a)}}import{promises as C4e}from"node:fs";import{join as zsr}from"node:path";import{homedir as Ysr}from"node:os";import{spawn as o6a}from"node:child_process";var s6a=["node","npm","python","python3","git","echo","pwd","date","bash"],a6a=[".js",".ts",".py",".sh",".bash",".zsh",".rb",".php",".pl",".lua"];function c6a(t){if(t.includes("../")||t.includes("..\\"))return!1;let e=[/[;&|`$(){}[\]]/,/\s*\|\s*/,/\s*&&\s*/,/\s*\|\|\s*/];for(let r of e)if(r.test(t))return!1;return!0}async function l6a(t){try{let e=t.toLowerCase().substring(t.lastIndexOf("."));if(!a6a.includes(e)||!(await C4e.stat(t)).isFile())return!1;try{await C4e.access(t,C4e.constants.R_OK)}catch{return!1}return!0}catch{return!1}}async function u6a(t){if(!t||t.trim()==="")return null;let e=[/[;&|`$(){}[\]]/,/\s*\|\s*/,/\s*&&\s*/,/\s*\|\|\s*/,/>\s*\/dev\/null/,/2>&1/];for(let f of e)if(f.test(t))return null;let r=[],n="",o=!1,s="",a=!1;for(let f=0;f<t.length;f++){let p=t[f];if(a){n+=p,a=!1;continue}if(p==="\\"){a=!0;continue}if((p==='"'||p==="'")&&!a){o?p===s?(o=!1,s=""):n+=p:(o=!0,s=p);continue}if(p===" "&&!o){n&&(r.push(n),n="");continue}n+=p}if(n&&r.push(n),r.length===0)return null;let[c,...u]=r;if(!s6a.includes(c)){if(!c6a(c))return console.warn(`Command path '${c}' contains potentially unsafe patterns`),null;let f=c;if(c.startsWith("~/")&&(f=zsr(Ysr(),c.substring(2))),!await l6a(f))return console.warn(`Command '${c}' is not in the allowed commands list and is not a valid script file`),null;let h=c.toLowerCase().substring(c.lastIndexOf(".")),m;switch(h){case".js":m="node";break;case".ts":m="node",u.unshift("-r","ts-node/register");break;case".py":m="python3";break;case".sh":case".bash":m="bash";break;case".zsh":m="zsh";break;case".rb":m="ruby";break;case".php":m="php";break;case".pl":m="perl";break;case".lua":m="lua";break;default:return console.warn(`Unsupported script extension '${h}'`),null}return{cmd:m,args:[f,...u]}}let d=u.map(f=>f.startsWith("~/")?zsr(Ysr(),f.substring(2)):f);return{cmd:c,args:d}}var Ksr=class{timeoutId=null;DEBOUNCE_MS=300;config=null;constructor(e){this.config=e}updateConfig(e){this.config=e}triggerUpdate(){this.timeoutId&&clearTimeout(this.timeoutId),this.timeoutId=setTimeout(async()=>{await this.executeUpdate(),this.timeoutId=null},this.DEBOUNCE_MS)}async executeUpdate(){try{await Ole(this.config)}catch(e){console.error("Error in debounced statusline update:",e instanceof Error?e.message:e)}}async forceUpdate(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),await this.executeUpdate()}destroy(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}},X8=null;function Bot(t){X8&&X8.destroy(),X8=new Ksr(t)}async function lgi(){X8&&(X8.triggerUpdate(),await new Promise(t=>setTimeout(t,400)))}async function ugi(){X8&&await X8.forceUpdate()}function Pot(){X8&&(X8.destroy(),X8=null)}async function Ole(t){try{let e=zsr(Ysr(),".iflow","settings.json");try{await C4e.access(e)}catch{return null}let r=await C4e.readFile(e,"utf-8"),n=JSON.parse(r);if(!n.statusLine)return null;let o=n.statusLine;if(o.type!=="command")return null;let s=t?.getModel()||"Claude",a=t?.getSessionId()||"",c={model:{display_name:s},workspace:{current_dir:process.cwd()},sessionId:a};return await d6a(o.command,c)}catch(e){return console.error("Error executing statusline:",e instanceof Error?e.message:e),null}}async function d6a(t,e){try{let r=await u6a(t);if(!r)throw new Error("Invalid command format or forbidden command");let{cmd:n,args:o}=r;return new Promise((s,a)=>{let c=o6a(n,o,{stdio:["pipe","pipe","pipe"],shell:!1}),u="",d="";c.stdout?.on("data",f=>{u+=f.toString()}),c.stderr?.on("data",f=>{d+=f.toString()}),c.on("close",f=>{if(f===0){let p=u.trim();s(p)}else a(new Error(`Command failed with code ${f}: ${d}`))}),c.on("error",f=>{a(f)}),c.stdin&&(c.stdin.write(JSON.stringify(e)),c.stdin.end())})}catch(r){return Promise.reject(r)}}Nn();var QA=we(tr(),1);await tn();Nn();var Fle=we(tr(),1);await tn();var Wgi=we(tr(),1);await tn();var W5=we(tr(),1);import Qot from"node:readline";import{PassThrough as x6a}from"node:stream";var Jsr="[99;5u";var Vgi=we(Pt(),1);var Ugi="\x1B[I",Qgi="\x1B[O",W4="\x1B",jgi=`${W4}[200~`,$gi=`${W4}[201~`,Ggi=(0,W5.createContext)(void 0);function qgi(){let t=(0,W5.useContext)(Ggi);if(!t)throw new Error("useKeypressContext must be used within a KeypressProvider");return t}function Hgi({children:t,kittyProtocolEnabled:e,config:r,debugKeystrokeLogging:n}){let{stdin:o,setRawMode:s}=wx(),a=(0,W5.useRef)(new Set).current,c=(0,W5.useCallback)(d=>{a.add(d)},[a]),u=(0,W5.useCallback)(d=>{a.delete(d)},[a]);return(0,W5.useEffect)(()=>{let d=o.isRaw;d===!1&&s(!0);let f=new x6a,p=!1;(parseInt(process.versions.node.split(".")[0],10)<20||process.env.PASTE_WORKAROUND==="1"||process.env.PASTE_WORKAROUND==="true")&&(p=!0);let m=!1,g=Buffer.alloc(0),A="",y=null,E=!1,v=0,b=null,S=null,w=null,k=G=>{let j=new RegExp(`^${W4}\\[Z`),Y=G.match(j);if(Y)return{key:{name:"tab",ctrl:!1,meta:!1,shift:!0,paste:!1,sequence:G.slice(0,Y[0].length),kittyProtocol:!0},length:Y[0].length};let V=new RegExp(`^${W4}\\[1;(\\d+)Z`);if(Y=G.match(V),Y){let z=parseInt(Y[1],10);z>=128&&(z-=128);let K=z-1,ae=(K&2)===2;return{key:{name:"tab",ctrl:(K&4)===4,meta:ae,shift:!0,paste:!1,sequence:G.slice(0,Y[0].length),kittyProtocol:!0},length:Y[0].length}}let L=new RegExp(`^${W4}\\[1;(\\d+)([ABCDHFPQSR])`);if(Y=G.match(L),Y){let z=parseInt(Y[1],10);z>=128&&(z-=128);let K=z-1,ae=(K&1)===1,be=(K&2)===2,le=(K&4)===4,Ce=Y[2],ie={A:"up",B:"down",C:"right",D:"left",H:"home",F:"end",P:"f1",Q:"f2",R:"f3",S:"f4"}[Ce]||"";return ie?{key:{name:ie,ctrl:le,meta:be,shift:ae,paste:!1,sequence:G.slice(0,Y[0].length),kittyProtocol:!0},length:Y[0].length}:null}let X=new RegExp(`^${W4}\\[(\\d+)(;(\\d+))?([u~])`);if(Y=G.match(X),Y){let z=parseInt(Y[1],10),K=Y[3]?parseInt(Y[3],10):1;K>=128&&(K-=128);let ae=K-1,be=(ae&1)===1,le=(ae&2)===2,Ce=(ae&4)===4;if(Y[4]==="~"){let ye=null;switch(z){case 1:ye="home";break;case 2:ye="insert";break;case 3:ye="delete";break;case 4:ye="end";break;case 5:ye="pageup";break;case 6:ye="pagedown";break;default:break}if(ye)return{key:{name:ye,ctrl:Ce,meta:le,shift:be,paste:!1,sequence:G.slice(0,Y[0].length),kittyProtocol:!0},length:Y[0].length}}let se={27:"escape",9:"tab",127:"backspace",13:"return",57414:"return"}[z];if(se)return{key:{name:se,ctrl:Ce,meta:le,shift:be,paste:!1,sequence:G.slice(0,Y[0].length),kittyProtocol:!0},length:Y[0].length};if(Ce&&z>=97&&z<=122)return{key:{name:String.fromCharCode(z),ctrl:!0,meta:le,shift:be,paste:!1,sequence:G.slice(0,Y[0].length),kittyProtocol:!0},length:Y[0].length}}let J=new RegExp(`^${W4}\\[([ABCDHF])`);if(Y=G.match(J),Y){let z=Y[1];return{key:{name:{A:"up",B:"down",C:"right",D:"left",H:"home",F:"end"}[z],ctrl:!1,meta:!1,shift:!1,paste:!1,sequence:G.slice(0,Y[0].length),kittyProtocol:!0},length:Y[0].length}}return null},D=G=>{for(let j of a)j(G)},P=(G,j)=>{if(j.name==="paste-start"){m=!0,w=performance.now();return}if(j.name==="paste-end"){m=!1;let V=g.toString(),L=performance.now(),X=w?L-w:0;D({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:V,...w&&{pasteDuration:X,pasteTextLength:V.length}}),g=Buffer.alloc(0),w=null;return}if(m){g=Buffer.concat([g,Buffer.from(j.sequence)]);return}b&&j.name!=="return"&&(S&&(clearTimeout(S),S=null),D({...b,shift:!0}),b=null);let Y=Date.now();if(j.name==="return"&&v>0&&!E)if(Y-v<30)j.shift=!0;else{b={...j,paste:m},S=setTimeout(()=>{b&&(D(b),b=null),S=null},30),v=Y;return}if(v=Y,["up","down","left","right"].includes(j.name)){D(j);return}if(j.ctrl&&j.name==="c"||j.sequence===`${W4}${Jsr}`){A&&n&&console.log("[DEBUG] Kitty buffer cleared on Ctrl+C:",A),A="",j.sequence===`${W4}${Jsr}`?D({name:"c",ctrl:!0,meta:!1,shift:!1,paste:!1,sequence:j.sequence,kittyProtocol:!0}):D(j);return}if(e&&(A||j.sequence.startsWith(`${W4}[`)&&!j.sequence.startsWith(jgi)&&!j.sequence.startsWith($gi)&&!j.sequence.startsWith(Ugi)&&!j.sequence.startsWith(Qgi))){A+=j.sequence,n&&console.log("[DEBUG] Kitty buffer accumulating:",A);let V=!1;for(;A;){let L=k(A);if(!L){let X=A.indexOf(`${W4}[`,1);if(X>0){n&&console.log("[DEBUG] Skipping incomplete/invalid CSI prefix:",A.slice(0,X)),A=A.slice(X);continue}break}if(n){let X=A.slice(0,L.length);A.length>L.length?console.log("[DEBUG] Kitty sequence parsed successfully (prefix):",X):console.log("[DEBUG] Kitty sequence parsed successfully:",X)}A=A.slice(L.length),D(L.key),V=!0}if(V)return;if(r?.getDebugMode()||n){let L=Array.from(A).map(X=>X.charCodeAt(0));console.warn("Kitty sequence buffer has char codes:",L)}if(A.length>32)n&&console.log("[DEBUG] Kitty buffer overflow, clearing:",A),A="";else return}j.name==="return"&&j.sequence===`${W4}\r`&&(j.meta=!0),D({...j,paste:m})},T=null,N=40,O=null,Q=(G,j)=>{if(!(j.sequence===Ugi||j.sequence===Qgi)&&j.sequence!=="\x1B[?"){if(T)clearTimeout(T),T=null,!m&&O&&(w=performance.now(),g=Buffer.concat([g,Buffer.from(O.sequence)]),m=!0),T=setTimeout(()=>{m&&(D({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:g.toString(),...w&&{pasteDuration:performance.now()-w,pasteTextLength:g.length}}),g=Buffer.alloc(0),w=null,m=!1,O=null,T=null)},N);else{if(m||j.ctrl||j.meta||j.name==="paste-start"||j.name==="paste-end"||j.name==="backspace"||j.name==="delete"||j.name==="left"||j.name==="right"||j.name==="up"||j.name==="down"){P(G,j);return}if(j.name==="return"&&E){y&&(clearTimeout(y),y=null),E=!1,D({...j,shift:!0,sequence:"\r"});return}if(j.sequence==="\\"&&!j.name){E=!0,y=setTimeout(()=>{E=!1,y=null,D(j)},5);return}E&&j.name!=="return"&&(y&&(clearTimeout(y),y=null),E=!1,D({name:"",sequence:"\\",ctrl:!1,meta:!1,shift:!1,paste:!1})),O=j,T=setTimeout(()=>{O&&(P(G,O),O=null),T=null},N);return}P(G,j)}},F=G=>{let j=Buffer.from(jgi),Y=Buffer.from($gi),V=0;for(;V<G.length;){let L=G.indexOf(j,V),X=G.indexOf(Y,V),J=L!==-1&&(X===-1||L<X),z=X!==-1&&(L===-1||X<L),K=-1,ae=0;if(J?K=L:z&&(K=X),ae=Y.length,K===-1){f.write(G.slice(V));return}let be=G.slice(V,K);be.length>0&&f.write(be);let le=Ce=>({name:Ce,ctrl:!1,meta:!1,shift:!1,paste:!1,sequence:""});J?P(void 0,le("paste-start")):z&&P(void 0,le("paste-end")),V=K+ae}},B;return p?(B=Qot.createInterface({input:f,escapeCodeTimeout:0}),Qot.emitKeypressEvents(f,B),f.on("keypress",Q),o.on("data",F)):(B=Qot.createInterface({input:o,escapeCodeTimeout:0}),Qot.emitKeypressEvents(o,B),o.on("keypress",Q)),()=>{p?(f.removeListener("keypress",Q),o.removeListener("data",F)):o.removeListener("keypress",Q),B.close(),d===!1&&s(!1),y&&(clearTimeout(y),y=null),S&&(clearTimeout(S),S=null),T&&(clearTimeout(T),T=null),m&&(D({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:g.toString()}),g=Buffer.alloc(0))}},[o,s,e,r,a,n]),(0,Vgi.jsx)(Ggi.Provider,{value:{subscribe:c,unsubscribe:u},children:t})}function _n(t,{isActive:e}){let{subscribe:r,unsubscribe:n}=qgi();(0,Wgi.useEffect)(()=>{if(e)return r(t),()=>{n(t)}},[e,t,r,n])}Nn();ui();var z4=we(Pt(),1);function w6a(t,e){switch(e.type){case"insert":{let r=e.payload,n=Array.from(t.value),o=Array.from(r);n.splice(t.cursorPosition,0,...o);let s=n.join(""),a=Array.from(r).length;return{value:s,cursorPosition:t.cursorPosition+a}}case"backspace":{if(t.cursorPosition>0){let r=Array.from(t.value);return r.splice(t.cursorPosition-1,1),{value:r.join(""),cursorPosition:t.cursorPosition-1}}return t}case"delete":{let r=Array.from(t.value).length;if(t.cursorPosition<r){let n=Array.from(t.value);return n.splice(t.cursorPosition,1),{value:n.join(""),cursorPosition:t.cursorPosition}}return t}case"move_cursor":{let r=Array.from(t.value).length,n=Math.max(0,Math.min(r,t.cursorPosition+e.payload));return{...t,cursorPosition:n}}case"set_cursor":{let r=Array.from(t.value).length,n=Math.max(0,Math.min(r,e.payload));return{...t,cursorPosition:n}}case"set_value":return{value:e.payload,cursorPosition:Array.from(e.payload).length};default:return t}}function N6({onSubmit:t,onCancel:e,placeholder:r,label:n,isFocused:o=!0,defaultValue:s="",allowEmpty:a=!1}){let{t:c}=fr(),u=r||c("textInput.defaultPlaceholder"),d=n||c("textInput.defaultLabel"),[f,p]=(0,Fle.useReducer)(w6a,{value:s,cursorPosition:s.length}),{value:h,cursorPosition:m}=f,[g,A]=(0,Fle.useState)(!0);(0,Fle.useEffect)(()=>{if(!o)return;let v=setInterval(()=>{A(b=>!b)},500);return()=>clearInterval(v)},[o]),_n(v=>{if(v.name==="return"||v.name==="enter"){(h.trim()||a)&&t(h.trim());return}if(v.name==="escape"){e?.();return}if(!(v.name==="up"||v.name==="down")){if(v.name==="left"){p({type:"move_cursor",payload:-1});return}if(v.name==="right"){p({type:"move_cursor",payload:1});return}if(v.name==="backspace"){p({type:"backspace"});return}if(v.name==="delete"){p({type:"delete"});return}if(v.paste&&v.sequence){let b=v.sequence.split("").filter(S=>{let w=S.charCodeAt(0);return w>=32&&w!==127}).join("");b&&p({type:"insert",payload:b});return}if(v.sequence&&!v.ctrl&&!v.meta){let b=v.sequence;b.split("").some(w=>{let k=w.charCodeAt(0);return k<32||k===127})||p({type:"insert",payload:b})}}},{isActive:o});let y=g&&o?"\u2502":"",E=h?(()=>{let v=Array.from(h);return v.splice(m,0,y),v.join("")})():y;return(0,z4.jsxs)(ue,{flexDirection:"column",children:[(0,z4.jsx)(ue,{children:(0,z4.jsxs)(te,{color:de.Gray,children:[d," "]})}),(0,z4.jsx)(ue,{marginTop:1,children:(0,z4.jsx)(ue,{borderStyle:"round",borderColor:o?de.AccentBlue:de.Gray,paddingX:1,width:"100%",children:h?(0,z4.jsx)(te,{children:E}):(0,z4.jsxs)(te,{children:[(0,z4.jsx)(te,{color:de.Gray,children:u}),y]})})}),(0,z4.jsx)(ue,{marginTop:1,children:(0,z4.jsx)(te,{color:de.Gray,dimColor:!0,children:c("textInput.instructions")})})]})}ui();var mr=we(Pt(),1);var zgi=(0,QA.memo)(({config:t,onExit:e,onStatusUpdate:r})=>{let{t:n}=fr(),[o,s]=(0,QA.useState)("location"),[a,c]=(0,QA.useState)(0),[u,d]=(0,QA.useState)({}),[f,p]=(0,QA.useState)(null),[h,m]=(0,QA.useState)(null),[g,A]=(0,QA.useState)(!1),[y,E]=(0,QA.useState)([]),[v,b]=(0,QA.useState)([]),[S,w]=(0,QA.useState)(""),[k,D]=(0,QA.useState)(null),[P,T]=(0,QA.useState)("");(0,QA.useEffect)(()=>{(async()=>{try{let ie=await t.getToolRegistry();if(ie){let oe=["task","exit_plan_mode","save_memory"],H=ie.getAllTools().filter(Z=>{let Ae="serverName"in Z&&Z.serverName!==void 0,Ee=oe.filter(he=>he===Z.name).length>0;return!Ae&&!Ee}).map(Z=>Z.name);E(H),d(Z=>({...Z,selectedTools:H}))}let se=t.getMcpServers()||{},ye=Object.keys(se);b(ye),d(oe=>({...oe,selectedMcps:ye}))}catch(ie){console.error("Failed to initialize data:",ie)}})()},[t]);let O={location:{name:"location",title:n("agentInstallDialog.locationTitle"),description:n("agentInstallDialog.locationDescription"),type:"select",options:[{id:"project",title:n("agentInstallDialog.projectAgent"),description:n("agentInstallDialog.projectAgentDesc"),available:!0},{id:"user",title:n("agentInstallDialog.userAgent"),description:n("agentInstallDialog.userAgentDesc"),available:!0}]},method:{name:"method",title:n("agentInstallDialog.methodTitle"),description:n("agentInstallDialog.methodDescription"),type:"select",options:[{id:"iFlow",title:n("agentInstallDialog.generateWithIFlow"),description:n("agentInstallDialog.generateWithIFlowDesc"),available:!0},{id:"template",title:n("agentInstallDialog.manualConfig"),description:n("agentInstallDialog.manualConfigDesc"),available:!0},{id:"online",title:n("agentInstallDialog.fromOnlineRepo"),description:n("agentInstallDialog.fromOnlineRepoDesc"),available:!0}]},agentGoal:{name:"agentGoal",title:n("agentInstallDialog.agentGoalTitle"),description:n("agentInstallDialog.agentGoalDescription"),type:"input",placeholder:n("agentInstallDialog.agentGoalPlaceholder")},agentType:{name:"agentType",title:n("agentInstallDialog.agentTypeTitle"),description:n("agentInstallDialog.agentTypeDescription"),type:"input",placeholder:n("agentInstallDialog.agentTypePlaceholder")},systemPrompt:{name:"systemPrompt",title:n("agentInstallDialog.systemPromptTitle"),description:n("agentInstallDialog.systemPromptDescription"),type:"input",placeholder:n("agentInstallDialog.systemPromptPlaceholder")},description:{name:"description",title:n("agentInstallDialog.descriptionTitle"),description:n("agentInstallDialog.descriptionDescription"),type:"input",placeholder:n("agentInstallDialog.descriptionPlaceholder")},tools:{name:"tools",title:n("agentInstallDialog.toolsTitle"),description:n("agentInstallDialog.toolsDescription"),type:"multiselect",options:y.map(ee=>({id:ee,title:ee,description:n("agentInstallDialog.allowAccessTo",{tool:ee}),available:!0}))},mcps:{name:"mcps",title:n("agentInstallDialog.mcpsTitle"),description:n("agentInstallDialog.mcpsDescription"),type:"multiselect",options:v.map(ee=>({id:ee,title:ee,description:n("agentInstallDialog.allowMcpAccess",{mcp:ee}),available:!0}))},color:{name:"color",title:n("agentInstallDialog.colorTitle"),description:n("agentInstallDialog.colorDescription"),type:"select",options:[{id:"automatic",title:n("agentInstallDialog.automaticColor"),description:n("agentInstallDialog.automaticColorDesc"),available:!0},{id:"red",title:n("agentInstallDialog.red"),description:"",available:!0},{id:"blue",title:n("agentInstallDialog.blue"),description:"",available:!0},{id:"green",title:n("agentInstallDialog.green"),description:"",available:!0},{id:"yellow",title:n("agentInstallDialog.yellow"),description:"",available:!0},{id:"purple",title:n("agentInstallDialog.purple"),description:"",available:!0},{id:"orange",title:n("agentInstallDialog.orange"),description:"",available:!0},{id:"pink",title:n("agentInstallDialog.pink"),description:"",available:!0},{id:"cyan",title:n("agentInstallDialog.cyan"),description:"",available:!0}]},"generated-preview":{name:"generated-preview",title:n("agentInstallDialog.generatedPreviewTitle"),description:n("agentInstallDialog.generatedPreviewDescription"),type:"edit",options:[{id:"agentType",title:n("agentInstallDialog.agentTypeLabel"),description:`${u.agentType||n("agentInstallDialog.notSet")}`,available:!0},{id:"description",title:n("agentInstallDialog.descriptionLabel"),description:`${u.description||n("agentInstallDialog.notSet")}`,available:!0},{id:"systemPrompt",title:n("agentInstallDialog.systemPromptLabel"),description:`${u.systemPrompt?u.systemPrompt.length>600?u.systemPrompt.substring(0,600)+"...":u.systemPrompt:n("agentInstallDialog.notSet")}`,available:!0}]},preview:{name:"preview",title:n("agentInstallDialog.previewTitle"),description:n("agentInstallDialog.previewDescription"),type:"preview"},generating:null,installing:null,success:null,error:null}[o],Q=O?.options?.filter(ee=>ee.available)||[];(0,QA.useEffect)(()=>{c(0),p(null),A(!1),D(null),T("")},[o]);let F=ee=>{let ie=["location","method","agentType","systemPrompt","description","tools","mcps","color","preview"],se=["location","method","agentGoal","generating","generated-preview","tools","mcps","color","preview"];if(ee==="method")return u.method==="template"?"agentType":u.method==="iFlow"?"agentGoal":null;let ye=u.method==="iFlow"?se:ie,oe=ye.indexOf(ee);return oe<ye.length-1?ye[oe+1]:null},B=ee=>{let ie=["location","method","agentType","systemPrompt","description","tools","mcps","color","preview"],se=["location","method","agentGoal","generating","generated-preview","tools","mcps","color","preview"],ye=u.method==="iFlow"?se:ie,oe=ye.indexOf(ee);return oe>0?ye[oe-1]:null},G=()=>{switch(o){case"agentGoal":return u.agentGoal||"";case"agentType":return u.agentType||"";case"systemPrompt":return u.systemPrompt||"";case"description":return u.description||"";default:return""}},j=ee=>{if(o==="agentGoal"){if(d(se=>({...se,agentGoal:ee})),u.method==="iFlow"){X(ee);return}}else o==="agentType"?d(se=>({...se,agentType:ee})):o==="systemPrompt"?d(se=>({...se,systemPrompt:ee})):o==="description"&&d(se=>({...se,description:ee}));A(!1);let ie=F(o);ie&&(s(ie),c(0))},Y=()=>{A(!1),D(null),T("")},V=ee=>{k==="agentType"?d(ie=>({...ie,agentType:ee})):k==="description"?d(ie=>({...ie,description:ee})):k==="systemPrompt"&&d(ie=>({...ie,systemPrompt:ee})),D(null),T("")},L=()=>{D(null),T("")},X=async ee=>{try{s("generating"),p(null),r?.(n("agentInstallDialog.generatingFromGoal"));let{generateAgentConfig:ie}=await Promise.resolve().then(()=>(qt(),U_)),se=await ie(t,{agentGoal:ee,onProgress:ye=>{w(ye),r?.(ye)}});d(ye=>({...ye,agentType:se.identifier,systemPrompt:se.systemPrompt,description:se.whenToUse})),s("generated-preview"),c(0),r?.(n("agentInstallDialog.generatedSuccessfully"))}catch(ie){s("error");let se=ie instanceof Error?ie.message:String(ie);p(n("agentInstallDialog.failedToGenerate",{error:se})),r?.(n("agentInstallDialog.failedGenerateStatus",{error:se}))}},J=async()=>{try{s("installing"),r?.(n("agentInstallDialog.creatingAgent",{agentType:u.agentType}));let{createAgent:ee}=await Promise.resolve().then(()=>(qt(),U_)),ie={agentType:u.agentType,name:u.agentType,description:u.description,whenToUse:u.description,allowedTools:u.selectedTools?.length?u.selectedTools:["*"],allowedMcps:u.selectedMcps?.length?u.selectedMcps:void 0,systemPrompt:u.systemPrompt,location:u.location==="user"?"global":"project",isInheritTools:!0,isInheritMcps:!0},se=await ee(ie);s("success"),m(n("agentInstallDialog.successfullyCreated",{agentType:u.agentType,filePath:se})),r?.(n("agentInstallDialog.agentCreatedSuccess",{agentType:u.agentType})),setTimeout(()=>{e()},3e3)}catch(ee){s("error");let ie=ee instanceof Error?ee.message:String(ee);p(n("agentInstallDialog.failedToCreate",{error:ie})),r?.(n("agentInstallDialog.failedCreateStatus",{error:ie}))}},z=()=>{let ee=O;if(!ee)return;if(ee.type==="select"){let se=Q[a];if(se)if(o==="location")d(ye=>({...ye,location:se.id}));else if(o==="method"){let ye=se.id;if(d(me=>({...me,method:ye})),ye==="online"){m(n("agentInstallDialog.redirectingToOnline")),r?.(n("agentInstallDialog.useAgentsOnline")),setTimeout(()=>{e()},2e3);return}let oe=null;ye==="template"?oe="agentType":ye==="iFlow"&&(oe="agentGoal"),oe&&(s(oe),c(0),A(!1),p(null));return}else o==="color"&&d(ye=>({...ye,color:se.id}))}else if(ee.type==="input"){if(!g){A(!0);return}}else if(ee.type==="multiselect")if(a===0){let se=F(o);se&&(s(se),c(0),A(!1),p(null));return}else{let se=Q[a-1];if(o==="tools"){let ye=u.selectedTools||[],oe=ye.includes(se.id);d(oe?me=>({...me,selectedTools:ye.filter(ge=>ge!==se.id)}):me=>({...me,selectedTools:[...ye,se.id]}))}else if(o==="mcps"){let ye=u.selectedMcps||[],oe=ye.includes(se.id);d(oe?me=>({...me,selectedMcps:ye.filter(ge=>ge!==se.id)}):me=>({...me,selectedMcps:[...ye,se.id]}))}return}else if(ee.type==="edit"){if(k)return;if(a===0){let se=F(o);se&&(s(se),c(0),A(!1),p(null))}else{let se=Q[a-1];D(se.id);let ye="";se.id==="agentType"?ye=u.agentType||"":se.id==="description"?ye=u.description||"":se.id==="systemPrompt"&&(ye=u.systemPrompt||""),T(ye)}return}else if(ee.type==="preview"){J();return}let ie=F(o);ie&&(s(ie),c(0),A(!1),p(null))},K=()=>{if(g){A(!1);return}if(k){D(null),T("");return}let ee=B(o);ee?(s(ee),c(0),p(null)):e()};_n(ee=>{if(g||k)return;if(ee.name==="escape"){K();return}if(ee.sequence==="q"){e();return}let ie=O;if(ie){if(ie.type==="select"||ie.type==="multiselect"||ie.type==="edit"){let se=ie.type==="multiselect"||ie.type==="edit"?Q.length:Q.length-1;ee.name==="up"||ee.sequence==="k"?c(ye=>Math.max(0,ye-1)):ee.name==="down"||ee.sequence==="j"?c(ye=>Math.min(se,ye+1)):ee.name==="return"&&z()}else if(ie.type==="input")ee.name==="return"&&z();else if(ie.type==="preview"){if(ee.name==="up"||ee.name==="down"||ee.sequence==="k"||ee.sequence==="j")return;ee.name==="return"&&z()}}},{isActive:!0});let ae=()=>{if(u.method==="online"){let oe=["location","method"],me=oe.indexOf(o);return(0,mr.jsxs)(ue,{marginBottom:1,children:[(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.stepOf",{current:me+1,total:oe.length})}),(0,mr.jsx)(ue,{marginLeft:2,children:(0,mr.jsx)(te,{color:de.Gray,children:oe.map((ge,H)=>H<me?"\u2713 ":H===me?"\u25CF ":"\u25CB ").join("")})})]})}let ee=["location","method","agentType","systemPrompt","description","tools","mcps","color","preview"],ie=["location","method","agentGoal","generating","generated-preview","tools","mcps","color","preview"],se=u.method==="iFlow"?ie:ee,ye=se.indexOf(o);return(0,mr.jsxs)(ue,{marginBottom:1,children:[(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.stepOf",{current:ye+1,total:se.length})}),(0,mr.jsx)(ue,{marginLeft:2,children:(0,mr.jsx)(te,{color:de.Gray,children:se.map((oe,me)=>me<ye?"\u2713 ":me===ye?"\u25CF ":"\u25CB ").join("")})})]})},be=()=>{if(k){let ee={agentType:n("agentInstallDialog.agentTypeLabel"),description:n("agentInstallDialog.descriptionLabel"),systemPrompt:n("agentInstallDialog.systemPromptLabel")};return(0,mr.jsxs)(ue,{flexDirection:"column",children:[(0,mr.jsx)(te,{bold:!0,color:de.AccentCyan,children:n("agentInstallDialog.editField",{field:ee[k]})}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.modifyField",{field:k})})}),(0,mr.jsx)(ue,{marginTop:2,children:(0,mr.jsx)(N6,{onSubmit:V,onCancel:L,placeholder:n("agentInstallDialog.enterField",{field:k}),label:ee[k],defaultValue:P,isFocused:!0})})]})}return(0,mr.jsxs)(ue,{flexDirection:"column",children:[(0,mr.jsx)(te,{bold:!0,color:de.AccentCyan,children:n("agentInstallDialog.generatedPreviewTitle")}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.generatedPreviewDescription")})}),(0,mr.jsxs)(ue,{marginTop:2,flexDirection:"column",children:[(0,mr.jsxs)(ue,{marginBottom:2,flexDirection:"column",children:[(0,mr.jsx)(ue,{flexDirection:"row",children:(0,mr.jsxs)(te,{color:a===0?de.AccentCyan:void 0,children:[a===0?"> ":" ",n("agentInstallDialog.continueToToolsSelection")]})}),(0,mr.jsx)(ue,{marginLeft:4,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.proceedToNextStep")})})]},"continue"),Q.map((ee,ie)=>{let ye=ie+1===a;return(0,mr.jsxs)(ue,{marginBottom:1,flexDirection:"column",children:[(0,mr.jsx)(ue,{flexDirection:"row",children:(0,mr.jsxs)(te,{color:ye?de.AccentCyan:void 0,children:[ye?"> ":" ",ee.title]})}),(0,mr.jsx)(ue,{marginLeft:4,children:(0,mr.jsx)(te,{color:de.Gray,children:ee.description})})]},ee.id)})]}),(0,mr.jsxs)(ue,{marginTop:2,flexDirection:"column",children:[(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.navigation")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.navigateOptions")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.enterToEditField")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.escToBack")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.qToExit")})]})]})},le=()=>(0,mr.jsxs)(ue,{flexDirection:"column",children:[(0,mr.jsx)(te,{bold:!0,color:de.AccentCyan,children:n("agentInstallDialog.previewTitle")}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.previewDescription")})}),(0,mr.jsxs)(ue,{marginTop:2,flexDirection:"column",children:[(0,mr.jsx)(te,{bold:!0,children:u.agentType}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.AccentBlue,children:u.description})}),(0,mr.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,mr.jsx)(te,{color:de.AccentCyan,children:n("agentInstallDialog.details")}),(0,mr.jsxs)(te,{children:[" ","\u2022"," ",n("agentInstallDialog.location",{location:u.location})]}),(0,mr.jsxs)(te,{children:[" ","\u2022 ",n("agentInstallDialog.model",{model:"Qwen3-Coder"})]}),(0,mr.jsxs)(te,{children:[" ","\u2022 ",n("agentInstallDialog.color",{color:u.color})]})]}),(0,mr.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,mr.jsx)(te,{color:de.AccentCyan,children:n("agentInstallDialog.tools")}),(0,mr.jsx)(ue,{marginLeft:2,children:(0,mr.jsx)(te,{children:u.selectedTools?.length?u.selectedTools.join(", "):n("agentInstallDialog.allToolsAvailable")})})]}),(0,mr.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,mr.jsx)(te,{color:de.AccentCyan,children:n("agentInstallDialog.mcpServers")}),(0,mr.jsx)(ue,{marginLeft:2,children:(0,mr.jsx)(te,{children:u.selectedMcps?.length?u.selectedMcps.join(", "):n("agentInstallDialog.allMcpServersAvailable")})})]}),u.systemPrompt&&(0,mr.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,mr.jsx)(te,{color:de.AccentCyan,children:n("agentInstallDialog.systemPrompt")}),(0,mr.jsx)(ue,{marginLeft:2,children:(0,mr.jsx)(te,{children:u.systemPrompt.length>200?`${u.systemPrompt.substring(0,200)}...`:u.systemPrompt})})]})]}),(0,mr.jsxs)(ue,{marginTop:2,flexDirection:"column",children:[(0,mr.jsx)(te,{color:de.AccentYellow,children:n("agentInstallDialog.actions")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.enterToCreate")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.escToBackEdit")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.qToExit")})]})]}),Ce=()=>O?o==="preview"?le():o==="generated-preview"?be():o==="generating"?(0,mr.jsxs)(ue,{flexDirection:"column",children:[(0,mr.jsx)(te,{bold:!0,color:de.AccentCyan,children:n("agentInstallDialog.generatingTitle")}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.generatingDescription")})}),(0,mr.jsx)(ue,{marginTop:2,children:(0,mr.jsx)(te,{color:de.AccentYellow,children:S||n("agentInstallDialog.startingGeneration")})}),(0,mr.jsx)(ue,{marginTop:2,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.pleaseWait")})})]}):g&&O.type==="input"?(0,mr.jsxs)(ue,{flexDirection:"column",children:[(0,mr.jsx)(te,{bold:!0,color:de.AccentCyan,children:O.title}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.Gray,children:O.description})}),(0,mr.jsx)(ue,{marginTop:2,children:(0,mr.jsx)(N6,{onSubmit:j,onCancel:Y,placeholder:O.placeholder,label:O.title,defaultValue:G(),isFocused:!0})})]}):(0,mr.jsxs)(ue,{flexDirection:"column",children:[(0,mr.jsx)(te,{bold:!0,color:de.AccentCyan,children:O.title}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.Gray,children:O.description})}),O.type==="input"&&!g&&(0,mr.jsxs)(ue,{marginTop:2,children:[(0,mr.jsx)(te,{color:de.AccentYellow,children:G()?n("agentInstallDialog.currentValue",{value:G()}):n("agentInstallDialog.currentValueNotSet")}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.pressEnterToEdit")})})]}),(O.type==="select"||O.type==="multiselect")&&(0,mr.jsxs)(ue,{marginTop:2,flexDirection:"column",children:[O.type==="multiselect"&&(0,mr.jsxs)(ue,{marginBottom:2,flexDirection:"column",children:[(0,mr.jsx)(ue,{flexDirection:"row",children:(0,mr.jsxs)(te,{color:a===0?de.AccentCyan:void 0,children:[a===0?"> ":" ",n("agentInstallDialog.continue")]})}),(0,mr.jsx)(ue,{marginLeft:4,children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.proceedToNextStep")})})]},"continue"),Q.map((ee,ie)=>{let ye=(O.type==="multiselect"?ie+1:ie)===a,oe=O.type==="multiselect"?o==="tools"?(u.selectedTools||[]).includes(ee.id):(u.selectedMcps||[]).includes(ee.id):!1;return(0,mr.jsxs)(ue,{marginBottom:1,flexDirection:"column",children:[(0,mr.jsx)(ue,{flexDirection:"row",children:(0,mr.jsxs)(te,{color:ye?de.AccentCyan:void 0,children:[ye?"> ":" ",O.type==="multiselect"&&(0,mr.jsx)(te,{children:oe?"[\u2713] ":"[ ] "}),O.type==="select"&&ee.id==="red"&&(0,mr.jsx)(te,{color:de.AccentRed,children:"\u2588 "}),O.type==="select"&&ee.id==="blue"&&(0,mr.jsx)(te,{color:de.AccentBlue,children:"\u2588 "}),O.type==="select"&&ee.id==="green"&&(0,mr.jsx)(te,{color:de.AccentGreen,children:"\u2588 "}),O.type==="select"&&ee.id==="yellow"&&(0,mr.jsx)(te,{color:de.AccentYellow,children:"\u2588 "}),O.type==="select"&&ee.id==="purple"&&(0,mr.jsx)(te,{color:de.AccentPurple,children:"\u2588 "}),O.type==="select"&&ee.id==="orange"&&(0,mr.jsx)(te,{color:de.AccentYellow,children:"\u2588 "}),O.type==="select"&&ee.id==="pink"&&(0,mr.jsx)(te,{color:de.AccentPurple,children:"\u2588 "}),O.type==="select"&&ee.id==="cyan"&&(0,mr.jsx)(te,{color:de.AccentCyan,children:"\u2588 "}),ee.title]})}),ee.description&&(0,mr.jsx)(ue,{marginLeft:4,children:(0,mr.jsx)(te,{color:de.Gray,children:ee.description})})]},ee.id)})]}),(0,mr.jsxs)(ue,{marginTop:2,flexDirection:"column",children:[(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.navigation")}),O.type==="input"&&!g&&(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.enterToEdit")}),(O.type==="select"||O.type==="multiselect"||O.type==="edit")&&(0,mr.jsxs)(mr.Fragment,{children:[(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.navigateOptions")}),(0,mr.jsxs)(te,{color:de.Gray,children:[" ","\u2022"," ",O.type==="edit"?n("agentInstallDialog.enterToEditField"):n("agentInstallDialog.enterToSelect")]})]}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.escToBack")}),(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.qToExit")})]})]}):(0,mr.jsx)(ue,{flexDirection:"column",children:(0,mr.jsx)(te,{color:de.Gray,children:n("agentInstallDialog.generatingTitle")})});return h?(0,mr.jsxs)(ue,{borderStyle:"round",borderColor:de.AccentGreen,flexDirection:"column",padding:1,width:"100%",children:[(0,mr.jsx)(te,{bold:!0,color:de.AccentGreen,children:n("agentInstallDialog.agentInstallation")}),(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsxs)(te,{color:de.AccentGreen,children:["\u2714 ",h]})})]}):(0,mr.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,mr.jsx)(te,{bold:!0,children:n("agentInstallDialog.title")}),ae(),Ce(),f&&(0,mr.jsx)(ue,{marginTop:1,children:(0,mr.jsxs)(te,{color:de.AccentRed,children:["\u274C ",f]})})]})},(t,e)=>t.config===e.config);var Z8=we(tr(),1);await tn();Nn();ui();var Mn=we(Pt(),1);function Ygi({settings:t,config:e,onExit:r,onStatusUpdate:n}){let{t:o}=fr(),[s,a]=(0,Z8.useState)("loading"),[c,u]=(0,Z8.useState)([]),[d,f]=(0,Z8.useState)(0),[p,h]=(0,Z8.useState)(0),[m,g]=(0,Z8.useState)(null),[A,y]=(0,Z8.useState)(null),[E,v]=(0,Z8.useState)(null),b=10,S=Math.ceil(c.length/b);(0,Z8.useEffect)(()=>{let T=async()=>{try{if(!t.merged.apiKey)return{success:!1,message:o("agentsOnlineDialog.authRequired")};let Q=await fetch("https://apis.iflow.cn/v1/agents/list",{method:"POST",headers:{"User-Agent":"iFlow-Cli","Content-Type":"application/json"},body:JSON.stringify({page:1,size:1e3,usePage:!0,visibility:"public",publishStatus:"published"})});if(!Q.ok){let B=o("agentsOnlineDialog.loadFailed");return Q.status===401?B=o("agentsOnlineDialog.authFailed"):Q.status===403?B=o("agentsOnlineDialog.accessDenied"):Q.status===404?B=o("agentsOnlineDialog.serviceNotFound"):Q.status>=500&&(B=o("agentsOnlineDialog.serverError")),{success:!1,message:B}}let F=await Q.json();return F.success?{success:!0,data:F.data?.data||[]}:{success:!1,message:F.message||o("agentsOnlineDialog.serverLoadFailed")}}catch(O){let Q=o("agentsOnlineDialog.connectionError");return O instanceof Error&&O.message.includes("Failed to fetch")&&(Q=o("agentsOnlineDialog.networkError")),{success:!1,message:Q}}};(async()=>{let O=await T();O.success&&O.data?(u(O.data),a("list"),O.data.length===0&&y(o("agentsOnlineDialog.noAgentsFound"))):(y(O.message||o("agentsOnlineDialog.loadAgentsFailed")),a("list"))})()},[t.merged.apiKey,o]);let w=async(T,N)=>{try{let{AgentRegistry:O}=await Promise.resolve().then(()=>(qt(),U_)),Q=new O,F=[],B=!0,G=!0,j,Y=null;if(T.extInfo&&typeof T.extInfo=="string")try{Y=JSON.parse(T.extInfo)}catch{}if(Y){if(B=Y["is-inherit-tools"],G=Y["is-inherit-mcps"]!==void 0?Y["is-inherit-mcps"]:!0,Y["allowed-tools"]){let X=Y["allowed-tools"].split(",").map(J=>J.trim()).filter(J=>J);X.length>0?F=X:F=Y["is-inherit-tools"]?["*"]:[]}else F=Y["is-inherit-tools"]?["*"]:[];if(Y.mcps){let X=Y.mcps.split(",").map(J=>J.trim()).filter(J=>J);X.length>0?j=X:j=Y["is-inherit-mcps"]?void 0:[]}else j=Y["is-inherit-mcps"]?void 0:[]}else{try{let X=JSON.parse(T.tools||"[]");F=Array.isArray(X)?X:["*"]}catch{F=["*"]}if(T.mcps)try{let X=JSON.parse(T.mcps);Array.isArray(X)&&X.length>0&&(j=X)}catch{let X=T.mcps.split(",").map(J=>J.trim()).filter(J=>J.length>0);X.length>0&&(j=X)}}let V={agentType:T.name.toLowerCase().replace(/[^a-z0-9]/g,"-"),name:T.name,description:T.description,whenToUse:T.description,allowedTools:F,allowedMcps:j,systemPrompt:T.detailContext||T.description,location:N==="user"?"global":"project",model:T.modelName,isInheritTools:B,isInheritMcps:G};return await Q.createAgent(V)?{success:!0,message:o("agentsCommand.install.successfullyInstalled",{name:T.name,scope:N})}:{success:!1,message:o("agentsOnlineDialog.createAgentFailed",{name:T.name})}}catch(O){return{success:!1,message:o("agentsOnlineDialog.installFailedWithError",{name:T.name,error:O})}}},k=async(T,N)=>{try{n?.(o("agentsOnlineDialog.installing",{name:T.name}));let O=await w(T,N);O.success?(v(O.message),y(null),n?.(O.message)):(y(O.message),v(null),n?.(`\u274C ${O.message}`))}catch(O){let Q=O instanceof Error?O.message:o("agentsOnlineDialog.installationFailed");y(Q),v(null),n?.(`\u274C ${Q}`)}};_n(T=>{if(T.name==="escape"){s==="detail"?(a("list"),g(null),y(null),v(null)):r();return}if(s==="list")if(T.name==="up"||T.sequence==="k"){let N=Math.max(p-1,0);h(N);let O=Math.floor(N/b);f(O)}else if(T.name==="down"||T.sequence==="j"){let N=Math.min(p+1,c.length-1);h(N);let O=Math.floor(N/b);f(O)}else if(T.name==="left"||T.sequence==="h"){let N=Math.max(d-1,0);f(N),h(N*b)}else if(T.name==="right"||T.sequence==="l"){let N=Math.min(d+1,S-1);f(N),h(Math.min(N*b,c.length-1))}else T.name==="return"?c.length>0&&p>=0&&p<c.length&&(g(c[p]),a("detail"),y(null),v(null)):T.sequence==="q"&&r();else s==="detail"&&m&&(T.sequence==="1"?k(m,"project"):T.sequence==="2"?k(m,"user"):T.sequence==="b"?(a("list"),g(null),y(null),v(null)):T.sequence==="q"&&r())},{isActive:!0});let D=()=>{if(c.length===0)return(0,Mn.jsxs)(ue,{flexDirection:"column",children:[(0,Mn.jsx)(te,{bold:!0,children:o("agentsOnlineDialog.availableAgents")}),(0,Mn.jsx)(ue,{marginTop:1,children:(0,Mn.jsx)(te,{color:de.AccentRed,children:A||o("agentsOnlineDialog.noAgentsAvailable")})})]});let T=d*b,N=Math.min(T+b,c.length),O=c.slice(T,N);return(0,Mn.jsxs)(ue,{flexDirection:"column",children:[(0,Mn.jsx)(te,{bold:!0,children:o("agentsOnlineDialog.availableAgentsWithCount",{count:c.length})}),(0,Mn.jsx)(ue,{marginTop:1,flexDirection:"column",children:O.map((Q,F)=>{let G=T+F===p;return(0,Mn.jsxs)(ue,{marginBottom:1,flexDirection:"row",children:[(0,Mn.jsxs)(ue,{width:30,flexShrink:0,flexDirection:"column",children:[(0,Mn.jsxs)(te,{color:G?de.AccentCyan:void 0,children:[G?"> ":" ",F+1,". ",Q.name]}),(0,Mn.jsx)(ue,{marginLeft:4,flexDirection:"column",children:(0,Mn.jsx)(te,{color:de.Gray,children:o("agentsOnlineDialog.category",{category:Q.category})})})]}),(0,Mn.jsx)(ue,{marginLeft:3,flexGrow:1,children:(0,Mn.jsx)(te,{color:de.Gray,children:Q.description})})]},Q.id)})}),(0,Mn.jsx)(ue,{marginTop:1,children:(0,Mn.jsx)(te,{color:de.AccentBlue,children:o("agentsOnlineDialog.pageOf",{current:d+1,total:S})})}),(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.Gray,children:o("agentsOnlineDialog.navigation")}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.navigateUpDown")]}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.prevNextPage")]}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.viewDetails")]}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.exit")]})]})]})},P=()=>m?(0,Mn.jsxs)(ue,{flexDirection:"column",children:[(0,Mn.jsx)(te,{bold:!0,children:m.name}),(0,Mn.jsx)(ue,{marginTop:1,children:(0,Mn.jsx)(te,{color:de.AccentBlue,children:m.description})}),(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.AccentCyan,children:o("agentsOnlineDialog.details")}),(0,Mn.jsxs)(te,{children:[" ","\u2022"," ",o("agentsOnlineDialog.model",{model:m.modelName})]}),(0,Mn.jsxs)(te,{children:[" ","\u2022"," ",o("agentsOnlineDialog.categoryLabel",{category:m.category})]}),(0,Mn.jsxs)(te,{children:[" ","\u2022"," ",o("agentsOnlineDialog.version",{version:m.version})]})]}),(()=>{let T=null;if(m.extInfo&&typeof m.extInfo=="string")try{T=JSON.parse(m.extInfo)}catch{}return T?(0,Mn.jsxs)(Mn.Fragment,{children:[(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.AccentCyan,children:o("agentsOnlineDialog.tools")}),(0,Mn.jsx)(ue,{marginLeft:2,children:(0,Mn.jsx)(te,{children:(()=>{let N=T["allowed-tools"]?T["allowed-tools"].split(",").map(Q=>Q.trim()).filter(Q=>Q):[],O=T["is-inherit-tools"]?o("agentsOnlineDialog.inherit"):o("agentsOnlineDialog.noInherit");return N.length>0?N.join(", ")+O:T["is-inherit-tools"]?o("agentsOnlineDialog.allToolsAvailableInherit"):o("agentsOnlineDialog.noToolsAvailableNoInherit")})()})})]}),(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.AccentCyan,children:o("agentsOnlineDialog.mcpServers")}),(0,Mn.jsx)(ue,{marginLeft:2,children:(0,Mn.jsx)(te,{children:(()=>{let N=T.mcps?T.mcps.split(",").map(Q=>Q.trim()).filter(Q=>Q):[],O=T["is-inherit-mcps"]?o("agentsOnlineDialog.inherit"):o("agentsOnlineDialog.noInherit");return N.length>0?N.join(", ")+O:T["is-inherit-mcps"]?o("agentsOnlineDialog.allMcpServersAvailableInherit"):o("agentsOnlineDialog.noMcpServersAvailableNoInherit")})()})})]})]}):(0,Mn.jsxs)(Mn.Fragment,{children:[(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.AccentCyan,children:o("agentsOnlineDialog.tools")}),(0,Mn.jsx)(ue,{marginLeft:2,children:(0,Mn.jsx)(te,{children:(()=>{if(!m.tools)return o("agentsOnlineDialog.allToolsAvailableInherit");try{let N=JSON.parse(m.tools);return Array.isArray(N)?N.length>0?N.join(", ")+o("agentsOnlineDialog.inherit"):o("agentsOnlineDialog.allToolsAvailableInherit"):(m.tools||o("agentsOnlineDialog.allToolsAvailableInherit").replace(o("agentsOnlineDialog.inherit"),""))+o("agentsOnlineDialog.inherit")}catch{return(m.tools||o("agentsOnlineDialog.allToolsAvailableInherit").replace(o("agentsOnlineDialog.inherit"),""))+o("agentsOnlineDialog.inherit")}})()})})]}),(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.AccentCyan,children:o("agentsOnlineDialog.mcpServers")}),(0,Mn.jsx)(ue,{marginLeft:2,children:(0,Mn.jsx)(te,{children:(()=>{if(!m.mcps||m.mcps.trim()==="")return o("agentsOnlineDialog.allMcpServersAvailableInherit");try{let N=JSON.parse(m.mcps);return Array.isArray(N)?N.length>0?N.join(", ")+o("agentsOnlineDialog.inherit"):o("agentsOnlineDialog.allMcpServersAvailableInherit"):(m.mcps||o("agentsOnlineDialog.allMcpServersAvailableInherit").replace(o("agentsOnlineDialog.inherit"),""))+o("agentsOnlineDialog.inherit")}catch{return(m.mcps||o("agentsOnlineDialog.allMcpServersAvailableInherit").replace(o("agentsOnlineDialog.inherit"),""))+o("agentsOnlineDialog.inherit")}})()})})]})]})})(),m.detailContext&&(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.AccentCyan,children:o("agentsOnlineDialog.systemPrompt")}),(0,Mn.jsx)(ue,{marginLeft:2,children:(0,Mn.jsx)(te,{children:m.detailContext.length>800?`${m.detailContext.substring(0,800)}...`:m.detailContext})})]}),(0,Mn.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Mn.jsx)(te,{color:de.AccentYellow,children:o("agentsOnlineDialog.actions")}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.installProject")]}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.installUser")]}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.backToList")]}),(0,Mn.jsxs)(te,{color:de.Gray,children:[" ",o("agentsOnlineDialog.exit")]})]}),E&&(0,Mn.jsx)(ue,{marginTop:1,children:(0,Mn.jsxs)(te,{color:de.AccentGreen,children:["\u2714 ",E]})}),A&&(0,Mn.jsx)(ue,{marginTop:1,children:(0,Mn.jsx)(te,{color:de.AccentRed,children:A})})]}):null;return s==="loading"?(0,Mn.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Mn.jsx)(te,{bold:!0,children:o("agentsOnlineDialog.loadingTitle")}),(0,Mn.jsx)(ue,{marginTop:1,children:(0,Mn.jsx)(te,{children:o("agentsOnlineDialog.loadingMessage")})})]}):(0,Mn.jsx)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:s==="list"?D():P()})}var HF=we(tr(),1),Jgi=we(Pt(),1);var Kgi=(0,HF.createContext)(null),Xgi=({children:t,initialOutput:e=null})=>{let[r,n]=(0,HF.useState)(e),o=(0,HF.useCallback)(a=>{n(a)},[]),s={output:r,updateOutput:o};return(0,Jgi.jsx)(Kgi.Provider,{value:s,children:t})},jot=()=>{let t=(0,HF.useContext)(Kgi);if(!t)throw new Error("useStatusline must be used within StatuslineProvider");return t};var z5=we(tr(),1);await tn();Nn();var rk=we(tr(),1);await tn();Nn();var O6=we(Pt(),1);function du({items:t,initialIndex:e=0,onSelect:r,onHighlight:n,isFocused:o,showScrollArrows:s=!1,maxItemsToShow:a=10,showNumbers:c=!0}){let[u,d]=(0,rk.useState)(e),[f,p]=(0,rk.useState)(0),[h,m]=(0,rk.useState)(""),g=(0,rk.useRef)(null);(0,rk.useEffect)(()=>{let y=Math.max(0,Math.min(u-a+1,t.length-a));u<f?p(u):u>=f+a&&p(y)},[u,t.length,f,a]),(0,rk.useEffect)(()=>()=>{g.current&&clearTimeout(g.current)},[]),_n(y=>{if(!o||t.length===0)return;let E=c&&/^[0-9]$/.test(y.sequence||"");if(!E&&g.current&&(clearTimeout(g.current),m("")),y.sequence==="k"||y.name==="up"){let v=u>0?u-1:t.length-1;d(v),n?.(t[v].value);return}if(y.sequence==="j"||y.name==="down"){let v=u<t.length-1?u+1:0;d(v),n?.(t[v].value);return}if(y.name==="return"){r(t[u].value);return}if(E){g.current&&clearTimeout(g.current);let v=h+y.sequence;m(v);let b=Number.parseInt(v,10)-1;if(v==="0"){g.current=setTimeout(()=>m(""),350);return}if(b>=0&&b<t.length){let S=t[b];d(b),n?.(S.value),Number.parseInt(v+"0",10)>t.length?(r(S.value),m("")):g.current=setTimeout(()=>{r(S.value),m("")},350)}else m("")}},{isActive:o??!0});let A=t.slice(f,f+a);return(0,O6.jsxs)(ue,{flexDirection:"column",children:[s&&(0,O6.jsx)(te,{color:f>0?de.Foreground:de.Gray,children:"\u25B2"}),A.map((y,E)=>{let v=f+E,b=u===v,S=de.Foreground,w=de.Foreground;b?(S=de.AccentGreen,w=de.AccentGreen):y.disabled&&(S=de.Gray,w=de.Gray),c||(w=de.Gray);let k=String(t.length).length,D=`${String(v+1).padStart(k)}.`;return(0,O6.jsxs)(ue,{alignItems:"center",children:[(0,O6.jsx)(ue,{minWidth:2,flexShrink:0,children:(0,O6.jsx)(te,{color:b?de.AccentGreen:de.Foreground,children:b?"\u25CF":" "})}),(0,O6.jsx)(ue,{marginRight:1,flexShrink:0,minWidth:D.length,children:(0,O6.jsx)(te,{color:w,children:D})}),y.themeNameDisplay&&y.themeTypeDisplay?(0,O6.jsxs)(te,{color:S,wrap:"truncate",children:[y.themeNameDisplay," ",(0,O6.jsx)(te,{color:de.Gray,children:y.themeTypeDisplay})]}):(0,O6.jsx)(te,{color:S,wrap:"truncate",children:y.label})]},y.label)}),s&&(0,O6.jsx)(te,{color:f+a<t.length?de.Foreground:de.Gray,children:"\u25BC"})]})}var Lle=we(tr(),1);await tn();Nn();var T6a=/^[a-zA-Z0-9!@#$%^&*()\-_=+\[\]{}|\\:;"'<>,.?/~]+$/;function $ot(t){return!t||t.trim().length===0?!1:T6a.test(t)}ui();var B6=we(Pt(),1);function Ule({onSubmit:t,onCancel:e,placeholder:r,label:n,isFocused:o=!0,validateApiKey:s=!1,validationError:a}){let{t:c}=fr(),u=r||c("passwordInput.defaultPlaceholder"),d=n||c("passwordInput.defaultLabel"),f=a||c("passwordInput.validationError"),[p,h]=(0,Lle.useState)(""),[m,g]=(0,Lle.useState)(!0),[A,y]=(0,Lle.useState)(null);(0,Lle.useEffect)(()=>{if(!o)return;let b=setInterval(()=>{g(S=>!S)},500);return()=>clearInterval(b)},[o]),_n(b=>{if(b.name==="return"||b.name==="enter"){if(p.trim()){let S=p.trim().replace(/^~+|~+$/g,"");if(s&&!$ot(S)){y(f);return}y(null),t(S)}return}if(b.name==="escape"){e?.();return}if(b.name==="backspace"||b.name==="delete"){h(S=>S.slice(0,-1));return}if(b.paste&&b.sequence){let S=b.sequence.split("").filter(w=>{let k=w.charCodeAt(0);return k>=32&&k!==127||s&&$ot(w)}).join("");S&&h(w=>w+S);return}if(b.sequence&&!b.ctrl&&!b.meta){if(b.sequence.length===1){let S=b.sequence;(S.charCodeAt(0)>=32&&S.charCodeAt(0)!==127||s&&$ot(S))&&h(w=>w+S)}else if(b.sequence.length>1){let S=b.sequence;/[\x00-\x1F\x7F]/.test(S)||h(w=>w+S)}}},{isActive:o});let E="\u2022".repeat(p.length),v=m&&o?"\u2502":"";return(0,B6.jsxs)(ue,{flexDirection:"column",children:[(0,B6.jsx)(ue,{children:(0,B6.jsxs)(te,{color:de.Gray,children:[d," "]})}),(0,B6.jsx)(ue,{marginTop:1,children:(0,B6.jsx)(ue,{borderStyle:"round",borderColor:A?de.AccentRed:o?de.AccentBlue:de.Gray,paddingX:1,width:"100%",children:(0,B6.jsxs)(te,{children:[E||(0,B6.jsx)(te,{color:de.Gray,children:u}),v]})})}),A&&(0,B6.jsx)(ue,{marginTop:1,children:(0,B6.jsx)(te,{color:de.AccentRed,children:A})}),(0,B6.jsx)(ue,{marginTop:1,children:(0,B6.jsx)(te,{color:de.Gray,dimColor:!0,children:c("passwordInput.instructions")})})]})}Tl();qt();ui();import{exec as I6a}from"child_process";import{promisify as D6a}from"util";var VF=class{id;display;desc;owner;supportType;multimodal;internal;defaultConfig;constructor(e){this.id=e.id,this.display=e.display,this.desc=e.desc,this.owner=e.owner,this.supportType=e.supportType,this.multimodal=e.multimodal,this.internal=e.internal,this.defaultConfig=e.defaultConfig}};var WF=class{default;type;constructor(e){this.default=e.default,this.type=e.type}};var Got=class t{label;value;constructor(e,r){this.label=e,this.value=r}static fromModelInfo(e){return new t(e.display,e.id)}};var qot=class{repoPath;securityLevel;constructor(e){this.repoPath=e.repoPath,this.securityLevel=e.securityLevel}isC3(){return this.securityLevel==="C3"}};var R6a=D6a(I6a);async function Hot(t){try{let e=await fetch("https://ducky.code.alibaba-inc.com/v1/models",{headers:{Authorization:`Bearer ${t}`}});if(!e.ok)throw new Error(`Failed to fetch models: ${e.status} ${e.statusText}`);return(await e.json()).map(n=>new VF({id:n.id,display:n.display,desc:n.desc,owner:n.owner,supportType:n.supportType,multimodal:n.multimodal,internal:n.internal,defaultConfig:new WF(n.defaultConfig)}))}catch(e){return console.error("Error fetching models:",e),k6a()}}function k6a(){return[new VF({id:"ide-whale/qwen3-coder",display:"Qwen3-Coder",desc:"Qwen3-Coder",owner:"",supportType:["chat","llm","agent","cli"],multimodal:!1,internal:!0,defaultConfig:new WF({default:!0})}),new VF({id:"ide-idealab/claude4-sonnet",display:"Claude-4-Sonnet",desc:"Claude-4-Sonnet",owner:"",supportType:["chat","llm","agent"],multimodal:!0,defaultConfig:new WF({})}),new VF({id:"ide-whale/deepseek-v3.2-exp",display:"DeepSeek-V3.2-Whale",desc:"DeepSeek-V3.2",owner:"",supportType:["agent","chat","llm","cli"],multimodal:!1,internal:!0,defaultConfig:new WF({})}),new VF({id:"ide-whale/kimi_k2",display:"Kimi-K2",desc:"Kimi-K2",owner:"",supportType:["chat","llm"],multimodal:!1,internal:!0,defaultConfig:new WF({})})]}function Vot(t){return t.map(e=>Got.fromModelInfo(e))}async function N6a(t){try{let e=t?{cwd:t}:{},{stdout:r,stderr:n}=await R6a("git remote get-url origin",e);return n&&console.error("Git command stderr:",n),r.trim()}catch(e){return console.error("Error getting git remote URL:",e),null}}function O6a(t){if(!t)return null;try{let e=t.trim();e.endsWith(".git")&&(e=e.slice(0,-4));let r=e.match(/^git@[^:]+:(.+)$/);if(r)return r[1];let n=e.match(/^https?:\/\/[^/]+\/(.+)$/);return n?n[1]:null}catch(e){return console.error("Error extracting repo path from git URL:",e),null}}async function B6a(t,e){try{let r=`https://code.alibaba-inc.com/api/v4/projects/settings/security_level?private_token=${e}&repos=${t}`,n=await fetch(r);if(!n.ok)return console.error(`Failed to fetch security level: ${n.status} ${n.statusText}`),null;let o=await n.json();return o.length===0?null:new qot({repoPath:o[0].repo_path,securityLevel:o[0].security_level})}catch(r){return console.error("Error fetching security level:",r),null}}function Wot(t){return t.filter(e=>{let r=e.supportType.includes("cli"),n=e.id.toLowerCase().includes("gpt-5")||e.display.toLowerCase().includes("gpt-5"),o=e.id.toLowerCase().includes("deepseek")||e.display.toLowerCase().includes("deepseek");return r&&!n&&!o})}function zot(t,e){return!e||!e.isC3()?t:t.filter(r=>r.internal===!0)}async function NW(t,e){let r=await N6a(e);if(!r)return console.error("Failed to get git remote URL"),null;let n=O6a(r);return n?B6a(n,t):(console.error("Failed to extract repo path from git URL:",r),null)}function Yot(t){return[...t].sort((e,r)=>{let n=e.id.toLowerCase().includes("qwen3-coder")||e.display.toLowerCase().includes("qwen3-coder"),o=r.id.toLowerCase().includes("qwen3-coder")||r.display.toLowerCase().includes("qwen3-coder");return n&&!o?-1:!n&&o?1:e.display.localeCompare(r.display)})}var x4e=we(tr(),1);await tn();OW();Nn();ui();var w4e=we(Pt(),1);function a0i({text:t}){let{t:e}=fr(),[r,n]=(0,x4e.useState)(!1),[o,s]=(0,x4e.useState)(!0),a=async()=>{try{await Qle(t),n(!0),setTimeout(()=>{n(!1)},2e3)}catch{}};return _n(c=>{if(!o)return;let u=c.name||c.sequence;(u==="c"||u==="C")&&(c.ctrl||c.meta)&&a()},{isActive:o}),(0,x4e.useEffect)(()=>(s(!0),()=>{s(!1)}),[]),(0,w4e.jsxs)(ue,{marginTop:1,flexDirection:"column",gap:1,paddingX:1,children:[(0,w4e.jsx)(te,{color:de.AccentBlue,children:t}),(0,w4e.jsx)(te,{color:"gray",children:r?e("copyableUrlBox.copied"):""})]})}var ti=we(Pt(),1);function c0i(t){return t&&Object.values(Jt).includes(t)?t:null}function l0i({onSelect:t,settings:e,initialErrorMessage:r}){let{t:n}=fr(),[o,s]=(0,z5.useState)("select"),[a,c]=(0,z5.useState)(null),[u,d]=(0,z5.useState)({baseUrl:"",apiKey:""}),[f,p]=(0,z5.useState)("baseUrl"),[h,m]=(0,z5.useState)(""),[g,A]=(0,z5.useState)(""),[y,E]=(0,z5.useState)(""),[v,b]=(0,z5.useState)([]),[S,w]=(0,z5.useState)(!1),[k,D]=(0,z5.useState)(()=>{if(r)return r;let J=c0i(process.env.GEMINI_DEFAULT_AUTH_TYPE);return null}),P="global",T=[P==="global"&&{label:n("authDialog.loginWithIFlowRecommend"),value:Jt.LOGIN_WITH_IFLOW},P==="global"&&{label:n("authDialog.loginWithIFlowApiKey"),value:Jt.IFLOW},P==="aone"&&{label:n("authDialog.loginWithAoneRecommend"),value:Jt.LOGIN_WITH_AONE},P==="aone"&&{label:n("authDialog.loginWithAoneApiKey"),value:Jt.AONE},{label:n("authDialog.openaiCompatibleApi"),value:Jt.OPENAI_COMPATIBLE}].filter(Boolean),N=Math.max(0,T.findIndex(J=>{if(e.merged.selectedAuthType)return J.value===e.merged.selectedAuthType;let z=c0i(process.env.GEMINI_DEFAULT_AUTH_TYPE);return z?J.value===z:P==="aone"?J.value===Jt.LOGIN_WITH_AONE:J.value===Jt.LOGIN_WITH_IFLOW})),O=J=>{if(J===Jt.LOGIN_WITH_IFLOW){let z=e.merged.isServerOAuth2==="true";if(!_N()||z){c(J);let K=Jwe();E(K),s("input-oauth-code"),D(null)}else{let K=OF(J);K?D(K):(D(null),t(J,"User"))}}else if(IE.includes(J))c(J),s("input-api-key"),D(null);else if(J===Jt.OPENAI_COMPATIBLE)c(J),s("input-openai-config"),p("baseUrl"),d({baseUrl:"",apiKey:""}),D(null);else{let z=OF(J);z?D(z):(D(null),t(J,"User"))}},Q=async J=>{if(a&&IE.includes(a)){if(A(J),a===Jt.AONE){w(!0);try{let z=Buffer.from(J,"utf8").toString("base64"),K=await Hot(z),ae=Wot(K),be=await NW(J);be?.isC3()&&(ae=zot(ae,be));let le=Yot(ae),Ce=Vot(le);b(Ce)}catch(z){console.error("Failed to load models:",z),b([{label:"Qwen3-Coder",value:"ide-whale/qwen3-coder"},{label:"Claude-4-Sonnet",value:"ide-idealab/claude4-sonnet"},{label:"DeepSeek-V3.2-Whale",value:"ide-whale/deepseek-v3.2-exp"},{label:"Kimi-K2",value:"ide-whale/kimi_k2"}])}finally{w(!1)}}else a===Jt.IFLOW&&b([{label:`GLM-4.7(${n("modelDialog.recommend")})`,value:"glm-4.7"},{label:"DeepSeek-V3.2",value:"deepseek-v3.2-chat"},{label:"Qwen3-Coder-Plus",value:"qwen3-coder-plus"},{label:"Kimi-K2-Thinking",value:"kimi-k2-thinking"},{label:"MiniMax-M2.1",value:"minimax-m2.1"},{label:"Kimi-K2-0905",value:"kimi-k2-0905"}]);s("input-model-name"),m("")}},F=J=>{if(f==="baseUrl")d(z=>({...z,baseUrl:J})),p("apiKey");else if(f==="apiKey")d(z=>({...z,apiKey:J})),p("modelName");else if(f==="modelName"){d(K=>({...K,modelName:J})),m(J);let z={...u,modelName:J};t(a,"User",z)}},B=()=>{s("select"),c(null),D(null)},G=()=>{f==="modelName"?p("apiKey"):f==="apiKey"?p("baseUrl"):(s("select"),c(null),d({baseUrl:"",apiKey:""}),p("baseUrl"),D(null))},j=J=>{if(a&&IE.includes(a))if(m(J),a===Jt.IFLOW){let z={baseUrl:"https://apis.iflow.cn/v1",apiKey:g,modelName:J,searchApiKey:g};t(a,"User",z)}else if(a===Jt.AONE){let z=Buffer.from(g,"utf8").toString("base64"),K={baseUrl:"https://ducky.code.alibaba-inc.com/v1/openai",apiKey:z,modelName:J,searchApiKey:z};t(a,"User",K)}else{let z={apiKey:g,modelName:J};t(a,"User",z)}},Y=J=>{if(a&&IE.includes(a))if(m(J),a===Jt.IFLOW){let z={baseUrl:"https://apis.iflow.cn/v1",apiKey:g,modelName:J,searchApiKey:g};t(a,"User",z)}else if(a===Jt.AONE){let z=Buffer.from(g,"utf8").toString("base64"),K={baseUrl:"https://ducky.code.alibaba-inc.com/v1/openai",apiKey:z,modelName:J,searchApiKey:z};t(a,"User",K)}else{let z={apiKey:g,modelName:J};t(a,"User",z)}},V=()=>{a&&IE.includes(a)?s("input-api-key"):(s("input-openai-config"),p("apiKey"))},L=async J=>{try{let z=await Zwe(J);if(z.apiKey){let K={baseUrl:"https://apis.iflow.cn/v1",apiKey:z.apiKey,modelName:"qwen3-coder-plus",searchApiKey:z.apiKey,isServerOAuth2:"true"};t(a,"User",K)}else D(n("authDialog.failedToGetApiKey"))}catch(z){D(z instanceof Error?z.message:n("authDialog.authFailed"))}},X=()=>{s("select"),c(null),E(""),D(null)};return _n(J=>{if(J.name==="escape"){if(k)return;if(e.merged.selectedAuthType===void 0){D(n("authDialog.mustSelectAuth"));return}t(void 0,"User")}},{isActive:!0}),o==="input-oauth-code"?(0,ti.jsxs)(ue,{flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.iflowOAuthLogin")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.oauthStep1")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(a0i,{text:y})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.oauthStep2")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.oauthStep3")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(N6,{onSubmit:L,onCancel:X,label:n("authDialog.authCodeLabel"),placeholder:n("authDialog.authCodePlaceholder"),isFocused:!0})}),k&&(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{color:de.AccentRed,children:k})})]}):o==="input-api-key"?a===Jt.IFLOW?(0,ti.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.iflowAuth")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.enterIFlowApiKey")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(Ule,{onSubmit:Q,onCancel:B,label:n("authDialog.apiKeyLabel"),placeholder:n("authDialog.apiKeyPlaceholder"),isFocused:!0,validateApiKey:!0})})]}):(0,ti.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.aoneAuth")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.enterAoneApiKey")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(Ule,{onSubmit:Q,onCancel:B,label:n("authDialog.apiKeyLabel"),placeholder:n("authDialog.privateTokenPlaceholder"),isFocused:!0,validateApiKey:!0})})]}):o==="input-model-name"?a===Jt.IFLOW||a===Jt.AONE?S?(0,ti.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.modelConfig")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{color:de.AccentBlue,children:n("modelDialog.loading")})})]}):(0,ti.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.modelConfig")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.selectModel")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{color:de.AccentBlue,children:n("authDialog.defaultSelection")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(du,{items:v,initialIndex:0,onSelect:Y,isFocused:!0})})]}):(0,ti.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.modelConfig")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.enterModelName")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(N6,{onSubmit:j,onCancel:V,label:n("authDialog.modelNameLabel"),placeholder:n("authDialog.modelNamePlaceholder"),isFocused:!0})})]}):o==="input-openai-config"?(0,ti.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.openaiConfig")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n(f==="baseUrl"?"authDialog.enterBaseUrl":f==="apiKey"?"authDialog.enterApiKey":"authDialog.enterOpenaiModelName")})}),(0,ti.jsx)(ue,{marginTop:1,children:f==="baseUrl"?(0,ti.jsx)(N6,{onSubmit:F,onCancel:G,label:n("authDialog.baseUrlLabel"),placeholder:n("authDialog.baseUrlPlaceholder"),isFocused:!0}):f==="apiKey"?(0,ti.jsx)(Ule,{onSubmit:F,onCancel:G,label:n("authDialog.apiKeyLabel"),placeholder:n("authDialog.openaiApiKeyPlaceholder"),isFocused:!0,validateApiKey:!0}):(0,ti.jsx)(N6,{onSubmit:F,onCancel:G,label:n("authDialog.modelNameLabel"),placeholder:n("authDialog.openaiModelPlaceholder"),isFocused:!0})}),f==="baseUrl"&&u.baseUrl&&(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{color:de.Gray,children:n("authDialog.current",{value:u.baseUrl})})})]}):(0,ti.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ti.jsx)(te,{bold:!0,children:n("authDialog.getStarted")}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.howToAuth")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(du,{items:T,initialIndex:N,onSelect:O,isFocused:!0})}),k&&(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{color:de.AccentRed,children:k})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{color:de.Gray,children:n("authDialog.useEnterToSelect")})}),(0,ti.jsx)(ue,{marginTop:1,children:(0,ti.jsx)(te,{children:n("authDialog.termsOfService")})})]})}await tn();var jle=we(tr(),1);await tn();var h0i=we(p0i(),1);function M6a({type:t="dots"}){let[e,r]=(0,jle.useState)(0),n=h0i.default[t];return(0,jle.useEffect)(()=>{let o=setInterval(()=>{r(s=>s===n.frames.length-1?0:s+1)},n.interval);return()=>{clearInterval(o)}},[n]),jle.default.createElement(te,null,n.frames[e])}var $le=M6a;var Jot=we(tr(),1);ui();Nn();var Q_=we(Pt(),1);function m0i({onTimeout:t,authUrl:e}){let{t:r}=fr(),[n,o]=(0,Jot.useState)(!1);return _n(s=>{s.name==="escape"&&t()},{isActive:!0}),(0,Jot.useEffect)(()=>{let s=setTimeout(()=>{o(!0),t()},18e4);return()=>clearTimeout(s)},[t]),(0,Q_.jsx)(ue,{flexDirection:"column",padding:1,width:"100%",children:n?(0,Q_.jsx)(te,{color:de.AccentRed,children:r("authInProgress.authTimeout")}):(0,Q_.jsxs)(Q_.Fragment,{children:[e&&(0,Q_.jsxs)(ue,{flexDirection:"column",children:[(0,Q_.jsx)(te,{color:de.Gray,children:r("authInProgress.copyUrlPrompt")}),(0,Q_.jsx)(ue,{marginTop:1,children:(0,Q_.jsx)(te,{color:de.AccentBlue,wrap:"wrap",children:e})})]}),(0,Q_.jsx)(ue,{marginTop:e?1:0,children:(0,Q_.jsxs)(te,{children:[(0,Q_.jsx)($le,{type:"dots"})," ",r("authInProgress.waitingForAuth")]})})]})})}await tn();Nn();qt();ui();var T4e=we(Pt(),1);var g0i=({approvalMode:t})=>{let{t:e}=fr(),r="",n="",o="";switch(t){case yn.SMART:r="blue",n=e("input.smartMode"),o=e("input.toggleHint");break;case yn.PLAN:r=de.AccentGreen,n=e("input.planMode"),o=e("input.toggleHint");break;case yn.YOLO:r=de.AccentRed,n=e("input.yoloMode"),o=e("input.toggleHint");break;case yn.DEFAULT:r=de.AccentGreen,n=e("input.defaultMode"),o=e("input.toggleHint");break;default:break}return(0,T4e.jsx)(ue,{children:(0,T4e.jsxs)(te,{color:r,children:[n,o&&(0,T4e.jsx)(te,{color:de.Gray,children:o})]})})};await tn();Nn();ui();var BW=we(Pt(),1);var A0i=({enabled:t,supported:e})=>{let{t:r}=fr();return e?(0,BW.jsx)(ue,{marginRight:1,children:(0,BW.jsxs)(te,{color:t?de.AccentGreen:de.Gray,children:[r("input.thinkingMode"),":",r(t?"input.thinkingOn":"input.thinkingOff"),(0,BW.jsx)(te,{color:de.Gray,children:r("input.thinkingToggleHint")})]})}):(0,BW.jsx)(ue,{marginRight:1,children:(0,BW.jsxs)(te,{color:de.Gray,children:[r("input.thinkingMode"),":",r("input.thinkingNotSupported")]})})};var Zot=we(tr(),1);await tn();ui();Nn();var pd=we(Pt(),1);import*as est from"fs/promises";function y0i({onConfirm:t,onCancel:e,config:r,projectRoot:n}){let{t:o}=fr(),[s,a]=(0,Zot.useState)({sessionCount:0,diskUsage:o("cleanupHistoryDialog.calculating"),projectPath:"",isLoading:!0});(0,Zot.useEffect)(()=>{(async()=>{if(!r){a({sessionCount:0,diskUsage:o("cleanupHistoryDialog.unknown"),projectPath:"",isLoading:!1});return}try{let{FileSystemUtil:f,ProjectNameGenerator:p}=await Promise.resolve().then(()=>(H5(),Xor)),h=p.fromPath(n),m=f.getProjectDir(h),g=0,A=0;try{let v=(await est.readdir(m)).filter(b=>b.endsWith(".jsonl"));g=v.length;for(let b of v){let S=`${m}/${b}`,w=await est.stat(S);A+=w.size}}catch(E){if(E&&typeof E=="object"&&"code"in E&&E.code!=="ENOENT")throw E}let y=(A/1024/1024).toFixed(2);a({sessionCount:g,diskUsage:`${y} MB`,projectPath:n,isLoading:!1})}catch{a({sessionCount:0,diskUsage:o("cleanupHistoryDialog.calculationFailed"),projectPath:n,isLoading:!1})}})()},[r,n,o]),_n(d=>{d.name==="escape"&&e()},{isActive:!0});let c=[{label:o("cleanupHistoryDialog.confirmOption"),value:"confirm"},{label:o("cleanupHistoryDialog.cancelOption"),value:"cancel"}],u=async d=>{d==="confirm"?await t():e()};return s.isLoading?(0,pd.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,pd.jsxs)(te,{bold:!0,children:["\u26A0\uFE0F ",o("cleanupHistoryDialog.title")]}),(0,pd.jsx)(ue,{marginTop:1,children:(0,pd.jsx)(te,{color:de.AccentBlue,children:o("cleanupHistoryDialog.loadingStats")})})]}):(0,pd.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,pd.jsxs)(te,{bold:!0,children:["\u26A0\uFE0F ",o("cleanupHistoryDialog.title")]}),(0,pd.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,pd.jsx)(te,{children:o("cleanupHistoryDialog.currentStatus")}),(0,pd.jsxs)(ue,{marginLeft:2,flexDirection:"column",children:[(0,pd.jsxs)(te,{children:["\u2022 ",o("cleanupHistoryDialog.projectPath"),(0,pd.jsx)(te,{color:de.AccentBlue,children:s.projectPath})]}),(0,pd.jsxs)(te,{children:["\u2022 ",o("cleanupHistoryDialog.sessions"),(0,pd.jsxs)(te,{color:de.AccentGreen,children:[s.sessionCount," ",o("cleanupHistoryDialog.sessionsUnit")]})]}),(0,pd.jsxs)(te,{children:["\u2022 ",o("cleanupHistoryDialog.diskUsage")," ",(0,pd.jsx)(te,{color:de.AccentGreen,children:s.diskUsage})]})]})]}),(0,pd.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,pd.jsx)(te,{color:de.AccentRed,children:o("cleanupHistoryDialog.warningTitle")}),(0,pd.jsxs)(ue,{marginLeft:2,flexDirection:"column",children:[(0,pd.jsxs)(te,{children:["\u2022 ",o("cleanupHistoryDialog.warningDeleteHistory")]}),(0,pd.jsxs)(te,{children:["\u2022 ",o("cleanupHistoryDialog.warningFreeSpace")]})]})]}),(0,pd.jsx)(ue,{marginTop:1,children:(0,pd.jsx)(du,{items:c,initialIndex:1,onSelect:u,isFocused:!0})}),(0,pd.jsx)(ue,{marginTop:1,children:(0,pd.jsx)(te,{color:de.Gray,children:o("cleanupHistoryDialog.instructions")})})]})}var tst=we(tr(),1);await tn();ui();Nn();qt();var ql=we(Pt(),1);import*as _0i from"path";function E0i({onConfirm:t,onCancel:e,gitService:r,config:n,projectRoot:o}){let{t:s}=fr(),[a,c]=(0,tst.useState)({checkpointCount:0,commitCount:0,diskUsage:s("cleanupCheckpointDialog.calculating"),isLoading:!0});(0,tst.useEffect)(()=>{(async()=>{if(!r||!n){c({checkpointCount:0,commitCount:0,diskUsage:s("cleanupCheckpointDialog.unknown"),isLoading:!1});return}try{let p=n.getProjectTempDir()?_0i.join(n.getProjectTempDir(),"checkpoints"):void 0;if(!p)throw new Error(s("cleanupCheckpointDialog.cannotGetCheckpointDir"));let m=await new NF(r,p).getCheckpointCount(),g=await r.getCommitCount(),A=r.getHistoryDir(),E=(await r.getDirectorySize(A)/1024/1024).toFixed(2);c({checkpointCount:m,commitCount:g,diskUsage:`${E} MB`,isLoading:!1})}catch{c({checkpointCount:0,commitCount:0,diskUsage:s("cleanupCheckpointDialog.calculationFailed"),isLoading:!1})}})()},[r,n,o,s]),_n(f=>{f.name==="escape"&&e()},{isActive:!0});let u=[{label:s("cleanupCheckpointDialog.confirmOption"),value:"confirm"},{label:s("cleanupCheckpointDialog.cancelOption"),value:"cancel"}],d=async f=>{f==="confirm"?await t():e()};return a.isLoading?(0,ql.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ql.jsxs)(te,{bold:!0,children:["\u26A0\uFE0F ",s("cleanupCheckpointDialog.title")]}),(0,ql.jsx)(ue,{marginTop:1,children:(0,ql.jsx)(te,{color:de.AccentBlue,children:s("cleanupCheckpointDialog.loadingStats")})})]}):(0,ql.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ql.jsxs)(te,{bold:!0,children:["\u26A0\uFE0F ",s("cleanupCheckpointDialog.title")]}),(0,ql.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,ql.jsx)(te,{children:s("cleanupCheckpointDialog.currentStatus")}),(0,ql.jsxs)(ue,{marginLeft:2,flexDirection:"column",children:[(0,ql.jsxs)(te,{children:["\u2022 ",s("cleanupCheckpointDialog.projectPath"),(0,ql.jsx)(te,{color:de.AccentBlue,children:o})]}),(0,ql.jsxs)(te,{children:["\u2022 ",s("cleanupCheckpointDialog.checkpoints"),(0,ql.jsxs)(te,{color:de.AccentGreen,children:[a.checkpointCount," ",s("cleanupCheckpointDialog.checkpointsUnit")]})," ",s("cleanupCheckpointDialog.jsonFiles")]}),(0,ql.jsxs)(te,{children:["\u2022 ",s("cleanupCheckpointDialog.gitHistory"),(0,ql.jsxs)(te,{color:de.AccentGreen,children:[a.commitCount," ",s("cleanupCheckpointDialog.commits")]})]}),(0,ql.jsxs)(te,{children:["\u2022 ",s("cleanupCheckpointDialog.diskUsage")," ",(0,ql.jsx)(te,{color:de.AccentGreen,children:a.diskUsage})]})]})]}),(0,ql.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,ql.jsx)(te,{color:de.AccentRed,children:s("cleanupCheckpointDialog.warningTitle")}),(0,ql.jsxs)(ue,{marginLeft:2,flexDirection:"column",children:[(0,ql.jsxs)(te,{children:["\u2022 ",s("cleanupCheckpointDialog.warningDeleteHistory")]}),(0,ql.jsxs)(te,{children:["\u2022 ",s("cleanupCheckpointDialog.warningFreeSpace")]}),(0,ql.jsxs)(te,{children:["\u2022 ",s("cleanupCheckpointDialog.warningNoRestore")]})]})]}),(0,ql.jsx)(ue,{marginTop:1,children:(0,ql.jsx)(du,{items:u,initialIndex:1,onSelect:d,isFocused:!0})}),(0,ql.jsx)(ue,{marginTop:1,children:(0,ql.jsx)(te,{color:de.Gray,children:s("cleanupCheckpointDialog.instructions")})})]})}var Y5=we(tr(),1);await tn();Nn();ui();import Zsr from"fs/promises";import ear from"path";import F6a from"os";var Gi=we(Pt(),1);function v0i({settings:t,config:e,onExit:r,onStatusUpdate:n}){let{t:o}=fr(),[s,a]=(0,Y5.useState)("loading"),[c,u]=(0,Y5.useState)([]),[d,f]=(0,Y5.useState)(1),[p,h]=(0,Y5.useState)(0),[m,g]=(0,Y5.useState)(null),[A,y]=(0,Y5.useState)(null),[E,v]=(0,Y5.useState)(null),[b,S]=(0,Y5.useState)(0),w=10,k=Math.ceil(b/w);(0,Y5.useEffect)(()=>{let F=async G=>{try{if(!t.merged.apiKey)throw new Error(o("commandsOnlineDialog.apiKeyNotFound"));let Y=new URL("https://apis.iflow.cn/v1/commands/list"),V=await fetch(Y.toString(),{method:"POST",headers:{"User-Agent":"iFlow-Cli","Content-Type":"application/json"},body:JSON.stringify({page:G,size:w,usePage:!0,visibility:"public",publishStatus:"published"})});if(!V.ok){let z=o("commandsOnlineDialog.unableToLoadCommands");throw V.status===401?z=o("commandsOnlineDialog.authenticationFailed"):V.status===403?z=o("commandsOnlineDialog.accessDenied"):V.status===404?z=o("commandsOnlineDialog.serviceNotFound"):V.status>=500&&(z=o("commandsOnlineDialog.serverError")),new Error(z)}let L=await V.json();if(!L.success)throw new Error(L.message||o("commandsOnlineDialog.failedToFetchCommands"));let X=Array.isArray(L.data?.data)?L.data.data:[],J=L.data?.total||X.length;return{commands:X,total:J}}catch(j){throw new Error(o("commandsOnlineDialog.failedToFetchCommandsWithError",{error:j}))}};(async()=>{try{let G=await F(d);u(G.commands),S(G.total),a("list"),h(0),G.commands.length===0&&y(o("commandsOnlineDialog.noCommandsFound"))}catch(G){y(G instanceof Error?G.message:o("commandsOnlineDialog.failedToLoadCommands")),a("list"),h(0)}})()},[d,t,o]);let D=F=>F.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),P=F=>F==="user"?ear.join(F6a.homedir(),".iflow","commands"):ear.join(process.cwd(),".iflow","commands"),T=async(F,B)=>{try{let G=P(B);await Zsr.mkdir(G,{recursive:!0});let j=`${D(F.name)}.toml`,Y=ear.join(G,j);try{return await Zsr.access(Y),{success:!1,message:o("commandsOnlineDialog.commandAlreadyInstalled",{name:F.name,scope:B})}}catch{}let V=`# Command: ${F.name}
6237
6237
  # Description: ${F.description}
6238
6238
  # Category: ${F.category}
6239
6239
  # Version: ${F.version}
@@ -6366,7 +6366,7 @@ Installation methods:
6366
6366
  - Windows: powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
6367
6367
  - Via package managers:
6368
6368
  * Homebrew (macOS): brew install uv
6369
- * Cargo (cross-platform): cargo install uv`};ae.mcpServers[be]={description:L.description,...ee},nCa(z,JSON.stringify(ae,null,2));let se="";try{n?.(o("mcpOnlineDialog.loadingServerAndTools",{name:L.name}));let{MCPServerConfig:ye}=await Promise.resolve().then(()=>(qt(),U_)),oe=new ye(le.command,le.args,le.env,le.cwd,le.url,le.httpUrl,le.headers,le.tcp,le.type,le.timeout,le.trust,L.description,le.includeTools,le.excludeTools,void 0,le.oauth,le.authProviderType);typeof e.addMcpServer=="function"?e.addMcpServer(be,oe):console.warn("Config.addMcpServer method not available, skipping dynamic loading");let me=await e.getToolRegistry();if(me){await me.discoverToolsForServer(be);let ge=e.getGeminiClient();ge&&await ge.setTools();let H=me.getToolsByServer(be);se=` - ${o("mcpOnlineDialog.toolsLoadedMessage",{count:H.length})}`,n?.(o("mcpOnlineDialog.serverLoadedSuccess",{name:L.name,count:H.length}))}}catch(ye){console.warn("Failed to auto-discover tools from newly installed server:",ye),n?.(o("mcpOnlineDialog.serverInstalledToolsFailed",{name:L.name,error:ye}))}return{success:!0,message:o("mcpOnlineDialog.installSuccess",{name:L.name,scope:X,path:z,toolsMessage:se})}}catch(z){return{success:!1,message:o("mcpOnlineDialog.installFailed",{name:L.name,error:z})}}},B=async(L,X)=>{let J=T(L.serverConfig),z=Object.keys(L.serverConfig),K=z.length>0?L.serverConfig[z[0]]:{};if(J&&Object.keys(J).length>0&&N(K))g(L),S(X),k(J),a("value-input");else try{n?.(o("mcpOnlineDialog.installing",{name:L.name}));let ae=await F(L,X);ae.success?(v(ae.message),y(null),n?.(ae.message)):(y(ae.message),v(null),n?.(`\u274C ${ae.message}`))}catch(ae){let be=ae instanceof Error?ae.message:o("mcpOnlineDialog.installationFailed");y(be),v(null),n?.(`\u274C ${be}`)}},G=async L=>{if(!(!m||!b))try{n?.(o("mcpOnlineDialog.installingWithConfig",{name:m.name}));let X=await F(m,b,L);X.success?(v(X.message),y(null),n?.(X.message),a("detail"),k(null),S(null)):(y(X.message),v(null),n?.(`\u274C ${X.message}`),a("detail"),k(null),S(null))}catch(X){let J=X instanceof Error?X.message:o("mcpOnlineDialog.installationFailed");y(J),v(null),n?.(`\u274C ${J}`),a("detail"),k(null),S(null)}},j=()=>{a("detail"),k(null),S(null)};_n(L=>{if(s!=="value-input"){if(L.name==="escape"){s==="detail"?(a("list"),g(null),y(null),v(null)):r();return}if(s==="list"){if(c.length===0){L.sequence==="q"&&r();return}if(L.name==="up"||L.sequence==="k"){let X=Math.max(p-1,0);h(X);let J=Math.floor(X/D);f(J)}else if(L.name==="down"||L.sequence==="j"){let X=Math.min(p+1,c.length-1);h(X);let J=Math.floor(X/D);f(J)}else if(L.name==="left"||L.sequence==="h"){if(P>1){let X=Math.max(d-1,0);f(X),h(Math.min(X*D,c.length-1))}}else if(L.name==="right"||L.sequence==="l"){if(P>1){let X=Math.min(d+1,P-1);f(X),h(Math.min(X*D,c.length-1))}}else L.name==="return"?p>=0&&p<c.length&&(g(c[p]),a("detail"),y(null),v(null)):L.sequence==="q"&&r()}else s==="detail"&&m&&(L.sequence==="1"?B(m,"project"):L.sequence==="2"?B(m,"user"):L.sequence==="b"?(a("list"),g(null),y(null),v(null)):L.sequence==="q"&&r())}},{isActive:!0});let Y=()=>{if(c.length===0)return(0,Yi.jsxs)(ue,{flexDirection:"column",children:[(0,Yi.jsx)(te,{bold:!0,children:o("mcpOnlineDialog.availableServers")}),(0,Yi.jsx)(ue,{marginTop:1,children:(0,Yi.jsx)(te,{color:de.AccentRed,children:A||o("mcpOnlineDialog.noServersAvailable")})})]});let L=Math.min(d*D,c.length),X=Math.min(L+D,c.length),J=c.slice(L,X);return(0,Yi.jsxs)(ue,{flexDirection:"column",children:[(0,Yi.jsx)(te,{bold:!0,children:o("mcpOnlineDialog.availableServersWithCount",{count:c.length})}),(0,Yi.jsx)(ue,{marginTop:1,flexDirection:"column",children:J.map((z,K)=>{let be=L+K===p;return(0,Yi.jsxs)(ue,{marginBottom:1,children:[(0,Yi.jsxs)(te,{color:be?de.AccentCyan:void 0,children:[be?"> ":" ",K+1,". ",z.name]}),(0,Yi.jsx)(ue,{marginLeft:4,children:(0,Yi.jsx)(te,{color:de.Gray,children:z.description})}),(0,Yi.jsx)(ue,{marginLeft:4,children:(0,Yi.jsx)(te,{color:de.Gray,children:o("mcpOnlineDialog.toolsAndVisits",{tools:z.tools?.length||0,visits:z.visitCount||0})})})]},z.id)})}),(0,Yi.jsx)(ue,{marginTop:1,children:(0,Yi.jsx)(te,{color:de.AccentBlue,children:o("mcpOnlineDialog.pageInfo",{current:d+1,total:P})})}),(0,Yi.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Yi.jsx)(te,{color:de.Gray,children:o("mcpOnlineDialog.navigation")}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" ","\u2022 ",o("mcpOnlineDialog.navigateUpDown")]}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" ","\u2022 ",o("mcpOnlineDialog.prevNextPage")]}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" \u2022 ",o("mcpOnlineDialog.viewDetails")]}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" \u2022 ",o("mcpOnlineDialog.exit")]})]})]})},V=()=>m?(0,Yi.jsxs)(ue,{flexDirection:"column",children:[(0,Yi.jsx)(te,{bold:!0,children:m.name}),(0,Yi.jsx)(ue,{marginTop:1,children:(0,Yi.jsx)(te,{color:de.AccentBlue,children:m.description})}),(0,Yi.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Yi.jsx)(te,{color:de.AccentCyan,children:o("mcpOnlineDialog.details")}),(0,Yi.jsxs)(te,{children:[" ","\u2022"," ",o("mcpOnlineDialog.version",{version:m.versionType})]}),(0,Yi.jsxs)(te,{children:[" ","\u2022"," ",o("mcpOnlineDialog.protocol",{protocol:m.protocolVersion})]}),(0,Yi.jsxs)(te,{children:[" ","\u2022"," ",o("mcpOnlineDialog.transports",{transports:m.transports?.join(", ")||"N/A"})]}),(0,Yi.jsxs)(te,{children:[" ","\u2022"," ",o("mcpOnlineDialog.authTypes",{types:m.authTypes?.join(", ")||"N/A"})]}),(0,Yi.jsxs)(te,{children:[" ","\u2022"," ",o("mcpOnlineDialog.visits",{count:m.visitCount||0})]})]}),m.tools&&m.tools.length>0&&(0,Yi.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Yi.jsx)(te,{color:de.AccentCyan,children:o("mcpOnlineDialog.availableTools",{count:m.tools.length})}),m.tools.map((L,X)=>(0,Yi.jsxs)(ue,{marginLeft:2,children:[(0,Yi.jsxs)(te,{children:[X+1,". ",L.name]}),(0,Yi.jsx)(ue,{marginLeft:2,children:(0,Yi.jsx)(te,{color:de.Gray,children:L.description})})]},X))]}),(0,Yi.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Yi.jsx)(te,{color:de.AccentYellow,children:o("mcpOnlineDialog.actions")}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" ","\u2022 ",o("mcpOnlineDialog.installForProject")]}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" ","\u2022 ",o("mcpOnlineDialog.installForUser")]}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" \u2022 ",o("mcpOnlineDialog.backToList")]}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" \u2022 ",o("mcpOnlineDialog.exit")]})]}),E&&(0,Yi.jsx)(ue,{marginTop:1,children:(0,Yi.jsxs)(te,{color:de.AccentGreen,children:["\u2714 ",E]})}),A&&(0,Yi.jsx)(ue,{marginTop:1,children:(0,Yi.jsx)(te,{color:de.AccentRed,children:A})})]}):null;return s==="loading"?(0,Yi.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Yi.jsx)(te,{bold:!0,children:o("mcpOnlineDialog.loadingTitle")}),(0,Yi.jsx)(ue,{marginTop:1,children:(0,Yi.jsx)(te,{children:o("mcpOnlineDialog.loadingMessage")})})]}):s==="value-input"&&m&&w?(0,Yi.jsx)(Yst,{serverName:m.name,values:w,onComplete:G,onCancel:j}):(0,Yi.jsx)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:s==="list"?Y():V()})}var cue=we(tr(),1);await tn();Nn();Tl();qt();ui();var hu=we(Pt(),1);function c3i({onSelect:t,onCancel:e,settings:r,initialErrorMessage:n}){let{t:o}=fr(),s=r.merged.selectedAuthType===Jt.IFLOW||r.merged.selectedAuthType===Jt.LOGIN_WITH_IFLOW||r.merged.selectedAuthType===Jt.AONE||r.merged.selectedAuthType===Jt.LOGIN_WITH_AONE?"model-select":"model-input",[a,c]=(0,cue.useState)(n||null),[u,d]=(0,cue.useState)([]),[f,p]=(0,cue.useState)(!0);(0,cue.useEffect)(()=>{(async()=>{if(s==="model-select"&&(r.merged.selectedAuthType===Jt.AONE||r.merged.selectedAuthType===Jt.LOGIN_WITH_AONE)){p(!0);try{let E=r.merged.apiKey||"";if(E){let v=await Hot(E),b=Wot(v),S=r.merged.selectedAuthType===Jt.LOGIN_WITH_AONE?await db():Buffer.from(E,"base64").toString("utf8");if(S){let D=await NW(S);D?.isC3()&&(b=zot(b,D))}let w=Yot(b),k=Vot(w);d(k)}else d(h())}catch(E){console.error("Failed to load models:",E),d(h())}finally{p(!1)}}else s==="model-select"&&(r.merged.selectedAuthType===Jt.IFLOW||r.merged.selectedAuthType===Jt.LOGIN_WITH_IFLOW)&&d([{label:`GLM-4.6(${o("modelDialog.recommend")})`,value:"glm-4.6"},{label:"DeepSeek-V3.2",value:"deepseek-v3.2-chat"},{label:"Qwen3-Coder-Plus",value:"qwen3-coder-plus"},{label:"Kimi-K2-Thinking",value:"kimi-k2-thinking"},{label:"MiniMax-M2",value:"minimax-m2"},{label:"Kimi-K2-0905",value:"kimi-k2-0905"}]),p(!1)})()},[s,r.merged.selectedAuthType,r.merged.apiKey,o]);let h=()=>[{label:"Qwen3-Coder",value:"ide-whale/qwen3-coder"},{label:"Claude-4-Sonnet",value:"ide-idealab/claude4-sonnet"},{label:"DeepSeek-V3.2-Whale",value:"ide-whale/deepseek-v3.2-exp"},{label:"Kimi-K2",value:"ide-whale/kimi_k2"}],m=y=>{t(y,"User")},g=y=>{if(!y.trim()){c(o("modelDialog.modelNameRequired"));return}t(y.trim(),"User")},A=()=>{e()};return _n(y=>{y.name==="escape"&&e()},{isActive:!0}),s==="model-select"?f?(0,hu.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,hu.jsx)(te,{bold:!0,children:o("modelDialog.modelSelection")}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{color:de.AccentBlue,children:o("modelDialog.loading")})})]}):(0,hu.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,hu.jsx)(te,{bold:!0,children:o("modelDialog.modelSelection")}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{children:o("modelDialog.selectModelPrompt")})}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{color:de.AccentBlue,children:o("modelDialog.defaultSelection")})}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(du,{items:u,initialIndex:0,onSelect:m,isFocused:!0})}),a&&(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{color:de.AccentRed,children:a})}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{color:de.Gray,children:o("modelDialog.selectInstructions")})})]}):(0,hu.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,hu.jsx)(te,{bold:!0,children:o("modelDialog.modelConfiguration")}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{children:o("modelDialog.enterModelPrompt")})}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(N6,{onSubmit:g,onCancel:A,label:o("modelDialog.modelNameLabel"),placeholder:o("modelDialog.modelNamePlaceholder"),isFocused:!0})}),a&&(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{color:de.AccentRed,children:a})}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{color:de.Gray,children:o("modelDialog.confirmInstructions")})})]})}var Kst=we(tr(),1);await tn();Nn();qt();ui();var il=we(Pt(),1);function l3i({onSelect:t,onCancel:e,requestedModel:r,reason:n,availableModels:o,suggestedModel:s,taskPrompt:a}){let{t:c}=fr(),[u,d]=(0,Kst.useState)(null),[f,p]=(0,Kst.useState)("model_selection"),[h,m]=(0,Kst.useState)(""),g=k=>{m(k),p("preference_selection")},A=k=>{t({selectedModel:h,preference:k})},y=()=>{e()},E=()=>{p("model_selection"),m("")};_n(k=>{k.name==="escape"&&(f==="preference_selection"?E():e())},{isActive:!0});let v=o.findIndex(k=>k.value===s),b=v>=0?v:0;if(f==="model_selection")return(0,il.jsxs)(ue,{borderStyle:"round",borderColor:de.AccentRed,flexDirection:"column",padding:1,width:"100%",children:[(0,il.jsx)(te,{bold:!0,color:de.AccentRed,children:c("modelValidationDialog.title")}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(te,{color:de.AccentRed,children:c("modelValidationDialog.modelNotSupported",{model:r})})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(te,{color:de.Gray,children:c("modelValidationDialog.reason",{reason:n})})}),a&&(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(te,{color:de.Gray,children:c("modelValidationDialog.task",{task:a.length>100?`${a.substring(0,100)}...`:a})})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(te,{children:c("modelValidationDialog.selectModel")})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(te,{color:de.AccentBlue,children:c("modelValidationDialog.suggested",{model:o.find(k=>k.value===s)?.label||s})})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(du,{items:o,initialIndex:b,onSelect:g,isFocused:!0})}),u&&(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(te,{color:de.AccentRed,children:u})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsxs)(te,{color:de.Gray,children:["(",c("modelValidationDialog.enterToSelect"),")"]})})]});let S=[{label:c("modelValidationDialog.askEachTime"),value:k3.OnceOnly},{label:c("modelValidationDialog.rememberSession"),value:k3.RememberSession},{label:c("modelValidationDialog.rememberAlways"),value:k3.RememberAlways}],w=o.find(k=>k.value===h)?.label||h;return(0,il.jsxs)(ue,{borderStyle:"round",borderColor:de.AccentBlue,flexDirection:"column",padding:1,width:"100%",children:[(0,il.jsx)(te,{bold:!0,color:de.AccentBlue,children:c("modelValidationDialog.preference")}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsxs)(te,{children:[c("modelValidationDialog.youSelected"),": ",(0,il.jsx)(te,{color:de.AccentGreen,children:w})]})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(te,{children:c("modelValidationDialog.futureChoice",{requestedModel:r,selectedModel:w})})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(du,{items:S,initialIndex:0,onSelect:A,isFocused:!0})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsxs)(te,{color:de.Gray,children:["(",c("modelValidationDialog.enterToSelectEscToGoBack"),")"]})})]})}var YW=we(tr(),1);await tn();Nn();qt();var ju=we(Pt(),1);function u3i({onSelect:t,settings:e,projectRoot:r,isGlobalScope:n=!1}){let[o,s]=(0,YW.useState)([]),[a,c]=(0,YW.useState)(0),[u,d]=(0,YW.useState)(!0),[f,p]=(0,YW.useState)(null);if((0,YW.useEffect)(()=>{(async()=>{try{d(!0);let g=new g8(r);await g.loadStyles();let A=e.merged.outputStyle||o0.DEFAULT;g.setCurrentStyle(A);let y=g.getStylesMetadata();s(y);let E=y.findIndex(v=>v.isSelected);c(E>=0?E:0),p(null)}catch(g){p(g instanceof Error?g.message:R.t("outputStyleDialog.failedToLoad"))}finally{d(!1)}})()},[r,e.merged.outputStyle]),_n(m=>{if(m.name==="escape"||m.sequence==="q"){t(void 0);return}if(m.name==="up"||m.sequence==="k"){let g=Math.max(a-1,0);c(g)}else if(m.name==="down"||m.sequence==="j"){let g=Math.min(a+1,o.length-1);c(g)}else{if(m.name==="left"||m.name==="right"||m.sequence==="h"||m.sequence==="l")return;m.name==="return"&&o.length>0&&a>=0&&a<o.length&&t(o[a].name)}},{isActive:!0}),u)return(0,ju.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ju.jsx)(te,{bold:!0,children:R.t("outputStyleDialog.loadingTitle")}),(0,ju.jsx)(ue,{marginTop:1,children:(0,ju.jsx)(te,{children:R.t("outputStyleDialog.loadingMessage")})})]});if(f)return(0,ju.jsxs)(ue,{borderStyle:"round",borderColor:de.AccentRed,flexDirection:"column",padding:1,width:"100%",children:[(0,ju.jsxs)(te,{color:de.AccentRed,children:[R.t("outputStyleDialog.errorPrefix"),f]}),(0,ju.jsx)(te,{color:de.Gray,children:R.t("outputStyleDialog.pressQToClose")})]});let h=()=>o.length===0?(0,ju.jsxs)(ue,{flexDirection:"column",children:[(0,ju.jsx)(te,{bold:!0,children:R.t(n?"outputStyleDialog.globalTitle":"outputStyleDialog.projectTitle")}),(0,ju.jsx)(ue,{marginTop:1,children:(0,ju.jsx)(te,{color:de.AccentRed,children:R.t("outputStyleDialog.noStylesAvailable")})})]}):(0,ju.jsxs)(ue,{flexDirection:"column",children:[(0,ju.jsx)(te,{bold:!0,children:R.t(n?"outputStyleDialog.globalTitle":"outputStyleDialog.projectTitle")}),(0,ju.jsx)(ue,{marginTop:1,flexDirection:"column",children:o.map((m,g)=>{let A=g===a,y=m.isSelected,v=`${E6e(m.name)}${y?R.t("outputStyleDialog.currentIndicator"):""}`;return(0,ju.jsxs)(ue,{marginBottom:1,flexDirection:"row",children:[(0,ju.jsx)(ue,{width:30,flexShrink:0,flexDirection:"column",children:(0,ju.jsxs)(te,{color:A?de.AccentCyan:void 0,children:[A?"\u25B6 ":" ",g+1,". ",v]})}),(0,ju.jsx)(ue,{marginLeft:3,flexGrow:1,children:(0,ju.jsx)(te,{color:de.Gray,children:m.description})})]},m.name)})}),(0,ju.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,ju.jsx)(te,{color:de.Gray,children:R.t("outputStyleDialog.navigationTitle")}),(0,ju.jsxs)(te,{color:de.Gray,children:[" ",R.t("outputStyleDialog.navigateUpDown")]}),(0,ju.jsxs)(te,{color:de.Gray,children:[" ",R.t("outputStyleDialog.confirmAction")]}),(0,ju.jsxs)(te,{color:de.Gray,children:[" ",R.t("outputStyleDialog.exitAction")]})]})]});return(0,ju.jsx)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:h()})}var d3i=we(tr(),1);await tn();Nn();ui();var Q6=we(Pt(),1);var f3i=({plan:t,onApprove:e,onKeepPlanning:r,onMarkdownPlanning:n,onExit:o,terminalWidth:s})=>{let{t:a}=fr(),[c,u]=(0,d3i.useState)(0),d=[{key:"1",label:a("planApprovalDialog.yesSmartMode"),action:()=>e("smart")},{key:"2",label:a("planApprovalDialog.yesManualApproval"),action:()=>e("default")},{key:"3",label:a("planApprovalDialog.noKeepPlanning"),action:r},{key:"4",label:a("planApprovalDialog.noMarkdownPlanning"),action:()=>n(t)}];return _n(f=>{if(f.name==="escape"&&o){o();return}if(f.name==="up")u(p=>p>0?p-1:d.length-1);else if(f.name==="down")u(p=>p<d.length-1?p+1:0);else if(f.name==="return")d[c].action();else if(f.sequence&&f.sequence>="1"&&f.sequence<="4"){let p=parseInt(f.sequence,10)-1;p>=0&&p<d.length&&d[p].action()}},{isActive:!0}),(0,Q6.jsxs)(ue,{flexDirection:"column",padding:1,borderStyle:"round",borderColor:de.AccentBlue,children:[(0,Q6.jsx)(ue,{marginBottom:1,children:(0,Q6.jsx)(te,{color:de.AccentBlue,bold:!0,children:a("planApprovalDialog.planReadyForReview")})}),(0,Q6.jsx)(ue,{marginBottom:2,flexDirection:"column",children:(0,Q6.jsx)(n9,{text:t,isPending:!1,terminalWidth:s})}),(0,Q6.jsx)(ue,{marginBottom:1,children:(0,Q6.jsx)(te,{color:de.AccentBlue,bold:!0,children:a("planApprovalDialog.wouldYouLikeToProceed")})}),d.map((f,p)=>(0,Q6.jsx)(ue,{marginBottom:p===d.length-1?1:0,children:(0,Q6.jsxs)(te,{color:c===p?de.AccentBlue:de.Foreground,children:[c===p?"> ":" ",f.key,". ",f.label]})},f.key)),(0,Q6.jsx)(ue,{marginTop:1,children:(0,Q6.jsx)(te,{color:de.Comment,dimColor:!0,children:a("planApprovalDialog.navigationInstructions")})})]})};var lue=we(tr(),1);await tn();Nn();ui();var dm=we(Pt(),1);import*as Xst from"fs";import*as p3i from"path";var h3i=({onConfirm:t,planContent:e,callId:r})=>{let{t:n}=fr(),[o,s]=(0,lue.useState)(e||""),[a,c]=(0,lue.useState)(null),[u,d]=(0,lue.useState)(0),f=p3i.join(process.cwd(),".iflow","plan.md");(0,lue.useEffect)(()=>{if(e){s(e);return}try{if(Xst.existsSync(f)){let m=Xst.readFileSync(f,"utf8");s(m)}else c("Plan file not found. It may have been deleted.")}catch(m){c(`Failed to read plan file: ${m instanceof Error?m.message:"Unknown error"}`)}},[f,e]);let p=[{key:"1",label:n("planReviewDialog.smartMode"),action:()=>h(!0,"smart")},{key:"2",label:n("planReviewDialog.defaultMode"),action:()=>h(!0,"default")},{key:"3",label:n("planReviewDialog.continuePlanning"),action:()=>h(!1,"continue")}];_n(m=>{if(m.name==="escape"){h(!1,"continue");return}if(m.name==="up")d(g=>g>0?g-1:p.length-1);else if(m.name==="down")d(g=>g<p.length-1?g+1:0);else if(m.name==="return")p[u].action();else if(m.sequence&&m.sequence>="1"&&m.sequence<="3"){let g=parseInt(m.sequence,10)-1;g>=0&&g<p.length&&p[g].action()}},{isActive:!0});let h=(m,g="default")=>{t(!!(m&&o),g)};return a?(0,dm.jsxs)(ue,{flexDirection:"column",padding:1,borderStyle:"round",borderColor:de.AccentRed,children:[(0,dm.jsx)(ue,{marginBottom:1,children:(0,dm.jsx)(te,{color:de.AccentRed,bold:!0,children:n("planReviewDialog.error")})}),(0,dm.jsx)(ue,{marginBottom:1,children:(0,dm.jsx)(te,{color:de.Foreground,children:a})}),(0,dm.jsx)(ue,{children:(0,dm.jsx)(te,{color:de.Comment,dimColor:!0,children:"Press any key to continue..."})})]}):(0,dm.jsxs)(ue,{flexDirection:"column",padding:1,borderStyle:"round",borderColor:de.AccentBlue,children:[(0,dm.jsx)(ue,{marginBottom:1,children:(0,dm.jsx)(te,{color:de.AccentBlue,bold:!0,children:n("planReviewDialog.reviewPlan")})}),(0,dm.jsx)(ue,{marginBottom:2,flexDirection:"column",children:(0,dm.jsx)(te,{color:de.Foreground,children:o||n("planReviewDialog.loading")})}),(0,dm.jsx)(ue,{marginBottom:1,children:(0,dm.jsx)(te,{color:de.AccentBlue,bold:!0,children:n("planReviewDialog.proceedWithPlan")})}),p.map((m,g)=>(0,dm.jsx)(ue,{marginBottom:g===p.length-1?1:0,children:(0,dm.jsxs)(te,{color:u===g?de.AccentBlue:de.Foreground,children:[u===g?"> ":" ",m.label]})},m.key)),(0,dm.jsx)(ue,{marginTop:1,children:(0,dm.jsx)(te,{color:de.Comment,dimColor:!0,children:n("planReviewDialog.navigationInstructions")})})]})};var N1=we(tr(),1);await tn();var uue=we(tr(),1);await tn();h7();function lCa({value:t,placeholder:e="",focus:r=!0,mask:n,highlightPastedText:o=!1,showCursor:s=!0,onChange:a,onSubmit:c}){let[u,d]=(0,uue.useState)({cursorOffset:(t||"").length,cursorWidth:0}),{cursorOffset:f,cursorWidth:p}=u;(0,uue.useEffect)(()=>{d(y=>{if(!r||!s)return y;let E=t||"";return y.cursorOffset>E.length-1?{cursorOffset:E.length,cursorWidth:0}:y})},[t,r,s]);let h=o?p:0,m=n?n.repeat(t.length):t,g=m,A=e?co.grey(e):void 0;if(s&&r){A=e.length>0?co.inverse(e[0])+co.grey(e.slice(1)):co.inverse(" "),g=m.length>0?"":co.inverse(" ");let y=0;for(let E of m)g+=y>=f-h&&y<=f?co.inverse(E):E,y++;m.length>0&&f===m.length&&(g+=co.inverse(" "))}return Nfe((y,E)=>{if(E.upArrow||E.downArrow||E.ctrl&&y==="c"||E.tab||E.shift&&E.tab)return;if(E.return){c&&c(t);return}let v=f,b=t,S=0;E.leftArrow?s&&v--:E.rightArrow?s&&v++:E.backspace||E.delete?f>0&&(b=t.slice(0,f-1)+t.slice(f,t.length),v--):(b=t.slice(0,f)+y+t.slice(f,t.length),v+=y.length,y.length>1&&(S=y.length)),f<0&&(v=0),f>t.length&&(v=t.length),d({cursorOffset:v,cursorWidth:S}),b!==t&&a(b)},{isActive:r}),uue.default.createElement(te,null,e?m.length>0?g:A:g)}var m3i=lCa;Nn();ui();var Ji=we(Pt(),1);var g3i=({questions:t,onSubmit:e,onCancel:r})=>{let{t:n}=fr(),[o,s]=(0,N1.useState)(0),[a,c]=(0,N1.useState)({}),[u,d]=(0,N1.useState)(0),[f,p]=(0,N1.useState)(""),[h,m]=(0,N1.useState)(!1),[g,A]=(0,N1.useState)(0),y=o===t.length,E=y?null:t[o],v=E?a[E.header]:null,b=(0,N1.useMemo)(()=>t.every(N=>{let O=a[N.header];return N.multiSelect?Array.isArray(O)&&O.length>0:typeof O=="string"&&O.trim()!==""}),[t,a]),S=(0,N1.useMemo)(()=>y?[]:[...E.options,{label:n("userQuestionDialog.typeOptionLabel"),description:n("userQuestionDialog.typeOptionDescription")}],[E,y,n]),w=(0,N1.useCallback)(N=>E?E.multiSelect?Array.isArray(v)&&v.includes(N):v===N:!1,[v,E]),k=(0,N1.useCallback)(N=>{if(!E)return;let O=E.header;if(N===n("userQuestionDialog.typeOptionLabel")){m(!0);return}E.multiSelect?c(Q=>{let F=Array.isArray(Q[O])?Q[O]:[],B=F.includes(N);return{...Q,[O]:B?F.filter(G=>G!==N):[...F,N]}}):(c(Q=>({...Q,[O]:N})),o<t.length-1?setTimeout(()=>{s(Q=>Q+1),d(0)},100):setTimeout(()=>{s(t.length),d(0)},100))},[E,o,t.length,n]),D=(0,N1.useCallback)(()=>{if(!f.trim()||!E){m(!1),d(0);return}let N=E.header;E.multiSelect?(c(O=>({...O,[N]:[...Array.isArray(O[N])?O[N]:[],f.trim()]})),p(""),m(!1),d(0)):(c(O=>({...O,[N]:f.trim()})),p(""),m(!1),o<t.length-1?(s(O=>O+1),d(0)):(s(t.length),d(0)))},[f,E,o,t.length]),P=(0,N1.useCallback)(()=>{o<t.length&&(s(N=>N+1),d(0),A(0),m(!1),p(""))},[o,t.length]),T=(0,N1.useCallback)(()=>{o>0&&(s(N=>N-1),d(0),A(0),m(!1),p(""))},[o]);return _n(N=>{if(h){N.name==="escape"&&(m(!1),p(""));return}if(N.name==="escape"){r();return}if(y){N.name==="up"?A(O=>O===0?1:0):N.name==="down"?A(O=>O===0?1:0):N.name==="return"?g===0?e(a):r():N.name==="left"&&T();return}if(N.name==="left")T();else if(N.name==="right")P();else if(N.name==="up")d(O=>O>0?O-1:S.length-1);else if(N.name==="down")d(O=>O<S.length-1?O+1:0);else if(N.name==="return"||N.name==="space"){let O=S[u];O&&O.label===n("userQuestionDialog.typeOptionLabel")?m(!0):k(S[u].label)}},{isActive:!0}),(0,Ji.jsxs)(ue,{flexDirection:"column",padding:1,borderStyle:"round",borderColor:de.AccentBlue,children:[(0,Ji.jsxs)(ue,{marginBottom:1,flexDirection:"row",children:[t.map((N,O)=>{let Q=o===O,F=!!a[N.header];return(0,Ji.jsx)(ue,{marginRight:2,children:(0,Ji.jsxs)(te,{color:Q?de.AccentBlue:F?de.AccentGreen:de.Comment,bold:Q,dimColor:!Q&&!F,children:[Q?"\u25B8 ":"",N.header,F?" \u2713":""]})},O)}),(0,Ji.jsx)(ue,{children:(0,Ji.jsxs)(te,{color:y?de.AccentBlue:de.Comment,bold:y,dimColor:!y,children:[y?"\u25B8 ":"",n("userQuestionDialog.submitTab")]})})]}),y?(0,Ji.jsxs)(Ji.Fragment,{children:[(0,Ji.jsx)(ue,{marginBottom:1,children:(0,Ji.jsx)(te,{color:de.AccentBlue,bold:!0,children:n("userQuestionDialog.reviewTitle")})}),(0,Ji.jsx)(ue,{flexDirection:"column",marginBottom:2,children:t.map((N,O)=>{let Q=a[N.header];return(0,Ji.jsxs)(ue,{flexDirection:"column",marginBottom:1,children:[(0,Ji.jsxs)(te,{color:de.AccentBlue,children:["\u25CF ",N.question]}),(0,Ji.jsx)(ue,{marginLeft:2,children:(0,Ji.jsxs)(te,{color:de.AccentGreen,children:["\u2192"," ",Q?Array.isArray(Q)?Q.join(", "):Q:n("userQuestionDialog.noAnswer")]})})]},O)})}),(0,Ji.jsx)(ue,{marginBottom:1,children:(0,Ji.jsx)(te,{children:n("userQuestionDialog.readyToSubmitPrompt")})}),(0,Ji.jsxs)(ue,{flexDirection:"column",marginBottom:1,children:[(0,Ji.jsx)(ue,{children:(0,Ji.jsxs)(te,{color:g===0?de.AccentGreen:de.Foreground,bold:g===0,children:[g===0?"> ":" ","1."," ",n("userQuestionDialog.submitAnswers")]})}),(0,Ji.jsx)(ue,{children:(0,Ji.jsxs)(te,{color:g===1?de.AccentBlue:de.Foreground,bold:g===1,children:[g===1?"> ":" ","2."," ",n("userQuestionDialog.cancel")]})})]}),(0,Ji.jsx)(ue,{marginTop:1,children:(0,Ji.jsx)(te,{color:de.Comment,dimColor:!0,children:n("userQuestionDialog.reviewInstructions")})})]}):(0,Ji.jsxs)(Ji.Fragment,{children:[t.length>1&&(0,Ji.jsx)(ue,{marginBottom:1,children:(0,Ji.jsx)(te,{color:de.Comment,dimColor:!0,children:n("userQuestionDialog.navigationHint")})}),(0,Ji.jsx)(ue,{marginBottom:1,flexDirection:"column",children:(0,Ji.jsx)(te,{children:E.question})}),(0,Ji.jsx)(ue,{flexDirection:"column",marginBottom:1,children:S.map((N,O)=>{let Q=w(N.label),F=u===O,B=N.label===n("userQuestionDialog.typeOptionLabel");return(0,Ji.jsxs)(ue,{flexDirection:"column",marginBottom:1,children:[(0,Ji.jsx)(ue,{children:B&&F&&h?(0,Ji.jsxs)(Ji.Fragment,{children:[(0,Ji.jsxs)(te,{color:de.AccentBlue,bold:!0,children:["> ",O+1,"."]}),(0,Ji.jsx)(m3i,{value:f,onChange:p,onSubmit:D,placeholder:n("userQuestionDialog.typeOptionLabel")})]}):(0,Ji.jsxs)(te,{color:F?de.AccentBlue:de.Foreground,bold:F,children:[F?"> ":" ",O+1,". ",N.label,!B&&(0,Ji.jsxs)(Ji.Fragment,{children:[E.multiSelect&&(0,Ji.jsxs)(te,{color:Q?de.AccentGreen:de.Comment,children:[" ","[",Q?"\u2713":" ","]"]}),!E.multiSelect&&Q&&(0,Ji.jsx)(te,{color:de.AccentGreen,children:" \u25CF"})]})]})}),!F&&(0,Ji.jsx)(ue,{marginLeft:4,children:(0,Ji.jsx)(te,{color:de.Comment,dimColor:!0,children:N.description})})]},O)})}),o===t.length-1&&b&&!h&&(0,Ji.jsx)(ue,{marginBottom:1,children:(0,Ji.jsx)(te,{color:de.AccentGreen,bold:!0,children:n("userQuestionDialog.submitHint")})}),!h&&(0,Ji.jsxs)(ue,{marginBottom:1,flexDirection:"column",children:[(0,Ji.jsxs)(te,{color:de.Comment,children:[n("userQuestionDialog.currentAnswer"),":"," "]}),(0,Ji.jsx)(te,{color:de.AccentGreen,children:v?Array.isArray(v)?v.join(", "):v:n("userQuestionDialog.noAnswer")})]}),!h&&(0,Ji.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Ji.jsx)(te,{color:de.Comment,dimColor:!0,children:n("userQuestionDialog.instructions")}),(0,Ji.jsx)(te,{color:de.Comment,dimColor:!0,children:E.multiSelect?n("userQuestionDialog.multiSelectHint"):n("userQuestionDialog.singleSelectHint")})]})]})]})};await tn();Nn();ui();var hd=we(Pt(),1);function Jst(){let t=new Date,e=t.getMonth(),r=t.getDate();return e===9&&r===24}function A3i({onContinue:t}){let{t:e}=fr();return _n(r=>{(r.name==="return"||r.sequence===" ")&&t()},{isActive:!0}),(0,hd.jsxs)(ue,{borderStyle:"round",borderColor:de.AccentBlue,flexDirection:"column",padding:1,width:"100%",children:[(0,hd.jsx)(te,{bold:!0,color:de.AccentBlue,children:e("programmersDayDisplay.title")}),(0,hd.jsx)(ue,{marginTop:1,children:(0,hd.jsx)(te,{children:e("programmersDayDisplay.welcome")})}),(0,hd.jsx)(ue,{marginTop:1,children:(0,hd.jsx)(te,{bold:!0,color:de.AccentPurple,children:e("programmersDayDisplay.whyLabel")})}),(0,hd.jsx)(ue,{marginTop:1,marginLeft:2,children:(0,hd.jsx)(te,{children:e("programmersDayDisplay.whyContent.first")})}),(0,hd.jsx)(ue,{marginLeft:2,children:(0,hd.jsx)(te,{children:e("programmersDayDisplay.whyContent.second")})}),(0,hd.jsx)(ue,{marginTop:1,children:(0,hd.jsx)(te,{bold:!0,color:de.AccentPurple,children:e("programmersDayDisplay.culturesLabel")})}),(0,hd.jsx)(ue,{marginTop:1,marginLeft:2,children:(0,hd.jsx)(te,{children:e("programmersDayDisplay.cultures.binary")})}),(0,hd.jsx)(ue,{marginLeft:2,children:(0,hd.jsx)(te,{children:e("programmersDayDisplay.cultures.helloWorld")})}),(0,hd.jsx)(ue,{marginLeft:2,children:(0,hd.jsx)(te,{children:e("programmersDayDisplay.cultures.bugs")})}),(0,hd.jsx)(ue,{marginLeft:2,children:(0,hd.jsx)(te,{children:e("programmersDayDisplay.cultures.poetry")})}),(0,hd.jsx)(ue,{marginTop:1,children:(0,hd.jsx)(te,{bold:!0,color:de.AccentGreen,children:e("programmersDayDisplay.wishes")})}),(0,hd.jsx)(ue,{marginTop:2,children:(0,hd.jsx)(te,{bold:!0,color:de.AccentGreen,children:e("programmersDayDisplay.continueInstructions")})})]})}var Zst=we(tr(),1);await tn();Nn();tk();var ocr=class{queue=[];messageIdCounter=0;enqueueMessage(e){let r={id:`msg_${++this.messageIdCounter}_${Date.now()}`,content:e,timestamp:Date.now()};return this.queue.push(r),Fo.emit("message-queued",{message:r,queueLength:this.queue.length}),r}dequeueMessage(){let e=this.queue.shift()||null;return e&&Fo.emit("message-dequeued",{message:e,queueLength:this.queue.length}),this.queue.length===0&&Fo.emit("queue-empty"),e}getQueuedMessages(){return[...this.queue]}clearQueue(){let e=this.queue.length;this.queue=[],e>0&&Fo.emit("queue-empty")}isEmpty(){return this.queue.length===0}getQueueLength(){return this.queue.length}peekNext(){return this.queue[0]||null}},rL=new ocr;tk();ui();var _3i=we(Pt(),1);var y3i=()=>{let{t}=fr(),[e,r]=(0,Zst.useState)(rL.getQueueLength());return(0,Zst.useEffect)(()=>{let n=()=>{r(rL.getQueueLength())},o=()=>n(),s=()=>n(),a=()=>n();return Fo.on("message-queued",o),Fo.on("message-dequeued",s),Fo.on("queue-empty",a),()=>{Fo.off("message-queued",o),Fo.off("message-dequeued",s),Fo.off("queue-empty",a)}},[]),e===0?null:(0,_3i.jsxs)(te,{color:de.AccentYellow,children:["\u{1F4CB} ",t("queueStatusDisplay.messagesPending",{count:e})]})};var ng=we(tr(),1);await tn();Nn();var eat=we(tr(),1);var E3i=8;function tat(){let[t,e]=(0,eat.useState)({columns:(process.stdout.columns||60)-E3i,rows:process.stdout.rows||20});return(0,eat.useEffect)(()=>{function r(){e({columns:(process.stdout.columns||60)-E3i,rows:process.stdout.rows||20})}return process.stdout.on("resize",r),()=>{process.stdout.off("resize",r)}},[]),t}qt();ui();var fm=we(Pt(),1);var v3i=({sessions:t,onSelect:e})=>{let{t:r}=fr(),{rows:n}=tat(),[o,s]=(0,ng.useState)(0),[a,c]=(0,ng.useState)(!1),[u,d]=(0,ng.useState)(!1),f=(0,ng.useRef)(!1),p=(0,ng.useRef)(0),h=(0,ng.useRef)(!1),m=(0,ng.useRef)(!1),g=(0,ng.useMemo)(()=>{let O=Math.max(n-8-2,5),Q=Math.floor(O/5);return Math.max(1,Math.min(Q,12))},[n]),[A,y]=(0,ng.useState)(0),[E]=(0,ng.useState)(()=>process.stdin.isTTY&&process.stdout.isTTY),v=(0,ng.useCallback)(P=>{let T=Date.now();T-p.current<300||a||(p.current=T,c(!0),e(P))},[e,a]),b=Math.ceil(t.length/g),S=A*g,w=Math.min(S+g,t.length),k=t.slice(S,w),D=t.map((P,T)=>({id:P.sessionId,label:uCa(P,T+1)}));return(0,ng.useEffect)(()=>(m.current||(f.current=!0,m.current=!0),()=>{f.current=!1}),[]),(0,ng.useEffect)(()=>{!E&&!a&&!u&&t.length>0&&f.current&&m.current&&!h.current&&(d(!0),setTimeout(()=>{f.current&&v(t[0]?.sessionId||null)},1e3))},[t,E,a,u,v,d]),(0,ng.useEffect)(()=>{if(t.length>0){let P=Math.ceil(t.length/g),T=Math.floor(o/g);T!==A&&y(Math.min(T,P-1))}},[g,o,t.length,A]),_n(P=>{if(!(!E||a)){if(P.name==="up"){if(o>0){let T=o-1,N=Math.floor(T/g);s(T),N!==A&&y(N)}}else if(P.name==="down"){if(o<t.length-1){let T=o+1,N=Math.floor(T/g);s(T),N!==A&&y(N)}}else if(P.name==="return")v(D[o].id);else if(P.name==="escape")v(null);else if(P.sequence&&P.sequence>="1"&&P.sequence<="9"){let T=parseInt(P.sequence,10);if(T>0&&T<=t.length){let N=T-1,O=Math.floor(N/g);s(N),y(O),v(t[N].sessionId)}}}},{isActive:!0}),t.length===0?(0,fm.jsxs)(ue,{flexDirection:"column",children:[(0,fm.jsxs)(te,{color:"yellow",children:["\u{1F50D} ",r("sessionSelectorComponent.noSessionsFound")]}),(0,fm.jsxs)(te,{color:"cyan",children:["\u{1F4A1} ",r("sessionSelectorComponent.startingNew")]})]}):E?(0,fm.jsxs)(ue,{flexDirection:"column",children:[(0,fm.jsxs)(te,{color:"cyan",bold:!0,children:["\u{1F4CB} ",r("sessionSelectorComponent.availableSessions")]}),(0,fm.jsx)(te,{color:"gray",children:"\u2500".repeat(80)}),b>1&&(0,fm.jsx)(ue,{children:(0,fm.jsx)(te,{color:"gray",children:r("sessionSelectorComponent.pageInfo",{current:A+1,total:b,start:S+1,end:w,totalSessions:t.length})})}),k.map((P,T)=>{let N=S+T,O=N+1,Q=o===N,F=(B,G=76)=>{let j=B.trimEnd();if(j.length>=G)return j.substring(0,G);let Y=G-j.length;return j+" ".repeat(Y)};return(0,fm.jsxs)(ue,{flexDirection:"column",children:[(0,fm.jsx)(te,{color:Q?de.AccentCyan:"white",bold:Q,children:F(`${O}. ${dCa(P.summary,70)}`)}),(0,fm.jsx)(te,{color:Q?de.AccentCyan:"gray",bold:Q,children:F(` \u{1F4C5} ${r("sessionSelectorComponent.created")}: ${scr(P.createdAt)}`)}),(0,fm.jsx)(te,{color:Q?de.AccentCyan:"gray",bold:Q,children:F(` \u23F0 ${r("sessionSelectorComponent.modified")}: ${scr(P.lastActivity)}`)}),(0,fm.jsx)(te,{color:Q?de.AccentCyan:"gray",bold:Q,children:F(` \u{1F4AC} ${r("sessionSelectorComponent.messages")}: ${P.messageCount}`)}),(0,fm.jsx)(te,{color:Q?de.AccentCyan:"gray",bold:Q,children:F(` \u{1F33F} ${r("sessionSelectorComponent.gitBranch")}: ${P.gitBranch||"-"}`)})]},P.sessionId)}),(0,fm.jsx)(te,{color:"gray",children:"\u2500".repeat(80)}),(0,fm.jsx)(te,{color:"yellow",children:r("sessionSelectorComponent.navigationInstructions",{autoScroll:b>1?` (${r("sessionSelectorComponent.autoScroll")})`:""})}),b>1&&(0,fm.jsxs)(te,{color:"gray",children:["\u{1F4A1} ",r("sessionSelectorComponent.scrollHint",{total:t.length,pages:b})]})]}):(0,fm.jsx)(ue,{})};function uCa(t,e){let r=t.sessionId.substring(0,8),n=scr(t.lastActivity);return`${e}. [${r}] ${n}`}function scr(t){let e=new Date,r=new Date(t),n=e.getTime()-r.getTime(),o=Math.floor(n/(1e3*60)),s=Math.floor(n/(1e3*60*60)),a=Math.floor(n/(1e3*60*60*24));return o<1?R.t("sessionSelectorComponent.time.justNow"):o<60?R.t("sessionSelectorComponent.time.minutesAgo",{count:o}):s<24?R.t("sessionSelectorComponent.time.hoursAgo",{count:s}):a<7?R.t("sessionSelectorComponent.time.daysAgo",{count:a}):a<30?R.t("sessionSelectorComponent.time.weeksAgo",{count:Math.floor(a/7)}):r.toLocaleDateString()}function dCa(t,e){return t.length<=e?t:t.substring(0,e-3)+"..."}qt();await tn();Nn();ui();var rx=we(Pt(),1);var b3i=({request:t})=>{let{t:e}=fr(),{commands:r,onConfirm:n}=t;_n(a=>{a.name==="escape"&&n(on.Cancel)},{isActive:!0});let o=a=>{a===on.Cancel?n(a):n(a,r)},s=[{label:e("shellConfirmationDialog.allowOnce"),value:on.ProceedOnce},{label:e("shellConfirmationDialog.allowAlwaysSession"),value:on.ProceedAlways},{label:e("shellConfirmationDialog.noEsc"),value:on.Cancel}];return(0,rx.jsxs)(ue,{flexDirection:"column",borderStyle:"round",borderColor:de.AccentYellow,padding:1,width:"100%",marginLeft:1,children:[(0,rx.jsxs)(ue,{flexDirection:"column",marginBottom:1,children:[(0,rx.jsx)(te,{bold:!0,children:e("shellConfirmationDialog.title")}),(0,rx.jsx)(te,{children:e("shellConfirmationDialog.description")}),(0,rx.jsx)(ue,{flexDirection:"column",borderStyle:"round",borderColor:de.Gray,paddingX:1,marginTop:1,children:r.map(a=>(0,rx.jsx)(te,{color:de.AccentCyan,children:a},a))})]}),(0,rx.jsx)(ue,{marginBottom:1,children:(0,rx.jsx)(te,{children:e("shellConfirmationDialog.proceed")})}),(0,rx.jsx)(du,{items:s,onSelect:o,isFocused:!0})]})};await tn();Nn();ui();var V4e=we(Pt(),1);var C3i=()=>{let{t}=fr();return(0,V4e.jsx)(ue,{children:(0,V4e.jsxs)(te,{color:de.AccentYellow,children:[t("input.shellModeEnabled"),(0,V4e.jsx)(te,{color:de.Gray,children:t("input.shellModeDisableHint")})]})})};await tn();ks();Nn();ui();var acr=we(Pt(),1);var rat=({constrainHeight:t})=>{let{t:e}=fr(),r=w0i(),n=XF();return r===void 0||r.overflowingIds.size===0||!t||!(n==="idle"||n==="waiting_for_confirmation")?null:(0,acr.jsx)(ue,{children:(0,acr.jsx)(te,{color:de.Gray,wrap:"truncate",children:e("showMoreLines.pressCtrlS")})})};var ok=we(tr(),1);await tn();Nn();qF();Tl();ui();var w0=we(Pt(),1);function S3i({onSelect:t,onHighlight:e,settings:r,availableTerminalHeight:n,terminalWidth:o}){let{t:s}=fr(),[a,c]=(0,ok.useState)("User"),[u,d]=(0,ok.useState)(r.merged.theme||J8.name),f=a==="User"?r.user.settings.customThemes||{}:r.merged.customThemes||{},p=ta.getAvailableThemes().filter(oe=>oe.type!=="custom"),h=Object.keys(f),m=oe=>oe.charAt(0).toUpperCase()+oe.slice(1),g=[...p.map(oe=>({label:oe.name,value:oe.name,themeNameDisplay:oe.name,themeTypeDisplay:m(oe.type)})),...h.map(oe=>({label:oe,value:oe,themeNameDisplay:oe,themeTypeDisplay:s("themeDialog.custom")}))],[A,y]=(0,ok.useState)(Date.now()),E=r.merged.theme||J8.name,v=g.findIndex(oe=>oe.value===E),b=v>=0?v:0,S=[{label:s("themeDialog.userSettings"),value:"User"},{label:s("themeDialog.workspaceSettings"),value:"Workspace"},{label:s("themeDialog.systemSettings"),value:"System"}],w=(0,ok.useCallback)(oe=>{t(oe,a)},[t,a]),k=oe=>{d(oe),e(oe)},D=(0,ok.useCallback)(oe=>{c(oe),y(Date.now())},[]),P=(0,ok.useCallback)(oe=>{D(oe),N("theme")},[D]),[T,N]=(0,ok.useState)("theme");_n(oe=>{oe.name==="tab"&&N(me=>me==="theme"?"scope":"theme"),oe.name==="escape"&&t(void 0,a)},{isActive:!0});let Q=Object.values(y0).filter(oe=>oe!==a).filter(oe=>r.forScope(oe).settings.theme!==void 0),F="";if(Q.length>0){let oe=Q.join(", ");F=r.forScope(a).settings.theme!==void 0?`(Also modified in ${oe})`:`(Modified in ${oe})`}let Y=Math.max(Math.floor((o-4)*.55*.9),1),V=2,L=g.length+1,X=4,J=1,z=2;n=n??Number.MAX_SAFE_INTEGER,n-=2,n-=z;let K=V+L+X+J,ae=!0,be=!0;K>n&&(be=!1,K-=V),K>n&&(K-=X,ae=!1);let le=ae?T:"theme",Ce=8;n=Math.max(n,K);let ee=n-Ce-(be?2:0)*2,ie=Math.max(0,ee-1),se=Math.ceil(ie*.6),ye=Math.floor(ie*.4);return(0,w0.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",paddingTop:be?1:0,paddingBottom:be?1:0,paddingLeft:1,paddingRight:1,width:"100%",children:[(0,w0.jsxs)(ue,{flexDirection:"row",children:[(0,w0.jsxs)(ue,{flexDirection:"column",width:"45%",paddingRight:2,children:[(0,w0.jsxs)(te,{bold:le==="theme",wrap:"truncate",children:[le==="theme"?"> ":" ",s("themeDialog.selectTheme")," ",(0,w0.jsx)(te,{color:de.Gray,children:F})]}),(0,w0.jsx)(du,{items:g,initialIndex:b,onSelect:w,onHighlight:k,isFocused:le==="theme",maxItemsToShow:8,showScrollArrows:!0,showNumbers:le==="theme"},A),ae&&(0,w0.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,w0.jsxs)(te,{bold:le==="scope",wrap:"truncate",children:[le==="scope"?"> ":" ",s("themeDialog.applyTo")]}),(0,w0.jsx)(du,{items:S,initialIndex:0,onSelect:P,onHighlight:D,isFocused:le==="scope",showNumbers:le==="scope"})]})]}),(0,w0.jsxs)(ue,{flexDirection:"column",width:"55%",paddingLeft:2,children:[(0,w0.jsx)(te,{bold:!0,children:s("themeDialog.preview")}),(()=>{let oe=ta.getTheme(u||J8.name)||J8;return(0,w0.jsxs)(ue,{borderStyle:"single",borderColor:de.Gray,paddingTop:be?1:0,paddingBottom:be?1:0,paddingLeft:1,paddingRight:1,flexDirection:"column",children:[r9(`# function
6369
+ * Cargo (cross-platform): cargo install uv`};ae.mcpServers[be]={description:L.description,...ee},nCa(z,JSON.stringify(ae,null,2));let se="";try{n?.(o("mcpOnlineDialog.loadingServerAndTools",{name:L.name}));let{MCPServerConfig:ye}=await Promise.resolve().then(()=>(qt(),U_)),oe=new ye(le.command,le.args,le.env,le.cwd,le.url,le.httpUrl,le.headers,le.tcp,le.type,le.timeout,le.trust,L.description,le.includeTools,le.excludeTools,void 0,le.oauth,le.authProviderType);typeof e.addMcpServer=="function"?e.addMcpServer(be,oe):console.warn("Config.addMcpServer method not available, skipping dynamic loading");let me=await e.getToolRegistry();if(me){await me.discoverToolsForServer(be);let ge=e.getGeminiClient();ge&&await ge.setTools();let H=me.getToolsByServer(be);se=` - ${o("mcpOnlineDialog.toolsLoadedMessage",{count:H.length})}`,n?.(o("mcpOnlineDialog.serverLoadedSuccess",{name:L.name,count:H.length}))}}catch(ye){console.warn("Failed to auto-discover tools from newly installed server:",ye),n?.(o("mcpOnlineDialog.serverInstalledToolsFailed",{name:L.name,error:ye}))}return{success:!0,message:o("mcpOnlineDialog.installSuccess",{name:L.name,scope:X,path:z,toolsMessage:se})}}catch(z){return{success:!1,message:o("mcpOnlineDialog.installFailed",{name:L.name,error:z})}}},B=async(L,X)=>{let J=T(L.serverConfig),z=Object.keys(L.serverConfig),K=z.length>0?L.serverConfig[z[0]]:{};if(J&&Object.keys(J).length>0&&N(K))g(L),S(X),k(J),a("value-input");else try{n?.(o("mcpOnlineDialog.installing",{name:L.name}));let ae=await F(L,X);ae.success?(v(ae.message),y(null),n?.(ae.message)):(y(ae.message),v(null),n?.(`\u274C ${ae.message}`))}catch(ae){let be=ae instanceof Error?ae.message:o("mcpOnlineDialog.installationFailed");y(be),v(null),n?.(`\u274C ${be}`)}},G=async L=>{if(!(!m||!b))try{n?.(o("mcpOnlineDialog.installingWithConfig",{name:m.name}));let X=await F(m,b,L);X.success?(v(X.message),y(null),n?.(X.message),a("detail"),k(null),S(null)):(y(X.message),v(null),n?.(`\u274C ${X.message}`),a("detail"),k(null),S(null))}catch(X){let J=X instanceof Error?X.message:o("mcpOnlineDialog.installationFailed");y(J),v(null),n?.(`\u274C ${J}`),a("detail"),k(null),S(null)}},j=()=>{a("detail"),k(null),S(null)};_n(L=>{if(s!=="value-input"){if(L.name==="escape"){s==="detail"?(a("list"),g(null),y(null),v(null)):r();return}if(s==="list"){if(c.length===0){L.sequence==="q"&&r();return}if(L.name==="up"||L.sequence==="k"){let X=Math.max(p-1,0);h(X);let J=Math.floor(X/D);f(J)}else if(L.name==="down"||L.sequence==="j"){let X=Math.min(p+1,c.length-1);h(X);let J=Math.floor(X/D);f(J)}else if(L.name==="left"||L.sequence==="h"){if(P>1){let X=Math.max(d-1,0);f(X),h(Math.min(X*D,c.length-1))}}else if(L.name==="right"||L.sequence==="l"){if(P>1){let X=Math.min(d+1,P-1);f(X),h(Math.min(X*D,c.length-1))}}else L.name==="return"?p>=0&&p<c.length&&(g(c[p]),a("detail"),y(null),v(null)):L.sequence==="q"&&r()}else s==="detail"&&m&&(L.sequence==="1"?B(m,"project"):L.sequence==="2"?B(m,"user"):L.sequence==="b"?(a("list"),g(null),y(null),v(null)):L.sequence==="q"&&r())}},{isActive:!0});let Y=()=>{if(c.length===0)return(0,Yi.jsxs)(ue,{flexDirection:"column",children:[(0,Yi.jsx)(te,{bold:!0,children:o("mcpOnlineDialog.availableServers")}),(0,Yi.jsx)(ue,{marginTop:1,children:(0,Yi.jsx)(te,{color:de.AccentRed,children:A||o("mcpOnlineDialog.noServersAvailable")})})]});let L=Math.min(d*D,c.length),X=Math.min(L+D,c.length),J=c.slice(L,X);return(0,Yi.jsxs)(ue,{flexDirection:"column",children:[(0,Yi.jsx)(te,{bold:!0,children:o("mcpOnlineDialog.availableServersWithCount",{count:c.length})}),(0,Yi.jsx)(ue,{marginTop:1,flexDirection:"column",children:J.map((z,K)=>{let be=L+K===p;return(0,Yi.jsxs)(ue,{marginBottom:1,children:[(0,Yi.jsxs)(te,{color:be?de.AccentCyan:void 0,children:[be?"> ":" ",K+1,". ",z.name]}),(0,Yi.jsx)(ue,{marginLeft:4,children:(0,Yi.jsx)(te,{color:de.Gray,children:z.description})}),(0,Yi.jsx)(ue,{marginLeft:4,children:(0,Yi.jsx)(te,{color:de.Gray,children:o("mcpOnlineDialog.toolsAndVisits",{tools:z.tools?.length||0,visits:z.visitCount||0})})})]},z.id)})}),(0,Yi.jsx)(ue,{marginTop:1,children:(0,Yi.jsx)(te,{color:de.AccentBlue,children:o("mcpOnlineDialog.pageInfo",{current:d+1,total:P})})}),(0,Yi.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Yi.jsx)(te,{color:de.Gray,children:o("mcpOnlineDialog.navigation")}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" ","\u2022 ",o("mcpOnlineDialog.navigateUpDown")]}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" ","\u2022 ",o("mcpOnlineDialog.prevNextPage")]}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" \u2022 ",o("mcpOnlineDialog.viewDetails")]}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" \u2022 ",o("mcpOnlineDialog.exit")]})]})]})},V=()=>m?(0,Yi.jsxs)(ue,{flexDirection:"column",children:[(0,Yi.jsx)(te,{bold:!0,children:m.name}),(0,Yi.jsx)(ue,{marginTop:1,children:(0,Yi.jsx)(te,{color:de.AccentBlue,children:m.description})}),(0,Yi.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Yi.jsx)(te,{color:de.AccentCyan,children:o("mcpOnlineDialog.details")}),(0,Yi.jsxs)(te,{children:[" ","\u2022"," ",o("mcpOnlineDialog.version",{version:m.versionType})]}),(0,Yi.jsxs)(te,{children:[" ","\u2022"," ",o("mcpOnlineDialog.protocol",{protocol:m.protocolVersion})]}),(0,Yi.jsxs)(te,{children:[" ","\u2022"," ",o("mcpOnlineDialog.transports",{transports:m.transports?.join(", ")||"N/A"})]}),(0,Yi.jsxs)(te,{children:[" ","\u2022"," ",o("mcpOnlineDialog.authTypes",{types:m.authTypes?.join(", ")||"N/A"})]}),(0,Yi.jsxs)(te,{children:[" ","\u2022"," ",o("mcpOnlineDialog.visits",{count:m.visitCount||0})]})]}),m.tools&&m.tools.length>0&&(0,Yi.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Yi.jsx)(te,{color:de.AccentCyan,children:o("mcpOnlineDialog.availableTools",{count:m.tools.length})}),m.tools.map((L,X)=>(0,Yi.jsxs)(ue,{marginLeft:2,children:[(0,Yi.jsxs)(te,{children:[X+1,". ",L.name]}),(0,Yi.jsx)(ue,{marginLeft:2,children:(0,Yi.jsx)(te,{color:de.Gray,children:L.description})})]},X))]}),(0,Yi.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Yi.jsx)(te,{color:de.AccentYellow,children:o("mcpOnlineDialog.actions")}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" ","\u2022 ",o("mcpOnlineDialog.installForProject")]}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" ","\u2022 ",o("mcpOnlineDialog.installForUser")]}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" \u2022 ",o("mcpOnlineDialog.backToList")]}),(0,Yi.jsxs)(te,{color:de.Gray,children:[" \u2022 ",o("mcpOnlineDialog.exit")]})]}),E&&(0,Yi.jsx)(ue,{marginTop:1,children:(0,Yi.jsxs)(te,{color:de.AccentGreen,children:["\u2714 ",E]})}),A&&(0,Yi.jsx)(ue,{marginTop:1,children:(0,Yi.jsx)(te,{color:de.AccentRed,children:A})})]}):null;return s==="loading"?(0,Yi.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,Yi.jsx)(te,{bold:!0,children:o("mcpOnlineDialog.loadingTitle")}),(0,Yi.jsx)(ue,{marginTop:1,children:(0,Yi.jsx)(te,{children:o("mcpOnlineDialog.loadingMessage")})})]}):s==="value-input"&&m&&w?(0,Yi.jsx)(Yst,{serverName:m.name,values:w,onComplete:G,onCancel:j}):(0,Yi.jsx)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:s==="list"?Y():V()})}var cue=we(tr(),1);await tn();Nn();Tl();qt();ui();var hu=we(Pt(),1);function c3i({onSelect:t,onCancel:e,settings:r,initialErrorMessage:n}){let{t:o}=fr(),s=r.merged.selectedAuthType===Jt.IFLOW||r.merged.selectedAuthType===Jt.LOGIN_WITH_IFLOW||r.merged.selectedAuthType===Jt.AONE||r.merged.selectedAuthType===Jt.LOGIN_WITH_AONE?"model-select":"model-input",[a,c]=(0,cue.useState)(n||null),[u,d]=(0,cue.useState)([]),[f,p]=(0,cue.useState)(!0);(0,cue.useEffect)(()=>{(async()=>{if(s==="model-select"&&(r.merged.selectedAuthType===Jt.AONE||r.merged.selectedAuthType===Jt.LOGIN_WITH_AONE)){p(!0);try{let E=r.merged.apiKey||"";if(E){let v=await Hot(E),b=Wot(v),S=r.merged.selectedAuthType===Jt.LOGIN_WITH_AONE?await db():Buffer.from(E,"base64").toString("utf8");if(S){let D=await NW(S);D?.isC3()&&(b=zot(b,D))}let w=Yot(b),k=Vot(w);d(k)}else d(h())}catch(E){console.error("Failed to load models:",E),d(h())}finally{p(!1)}}else s==="model-select"&&(r.merged.selectedAuthType===Jt.IFLOW||r.merged.selectedAuthType===Jt.LOGIN_WITH_IFLOW)&&d([{label:`GLM-4.7(${o("modelDialog.recommend")})`,value:"glm-4.7"},{label:"DeepSeek-V3.2",value:"deepseek-v3.2-chat"},{label:"Qwen3-Coder-Plus",value:"qwen3-coder-plus"},{label:"Kimi-K2-Thinking",value:"kimi-k2-thinking"},{label:"MiniMax-M2.1",value:"minimax-m2.1"},{label:"Kimi-K2-0905",value:"kimi-k2-0905"}]),p(!1)})()},[s,r.merged.selectedAuthType,r.merged.apiKey,o]);let h=()=>[{label:"Qwen3-Coder",value:"ide-whale/qwen3-coder"},{label:"Claude-4-Sonnet",value:"ide-idealab/claude4-sonnet"},{label:"DeepSeek-V3.2-Whale",value:"ide-whale/deepseek-v3.2-exp"},{label:"Kimi-K2",value:"ide-whale/kimi_k2"}],m=y=>{t(y,"User")},g=y=>{if(!y.trim()){c(o("modelDialog.modelNameRequired"));return}t(y.trim(),"User")},A=()=>{e()};return _n(y=>{y.name==="escape"&&e()},{isActive:!0}),s==="model-select"?f?(0,hu.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,hu.jsx)(te,{bold:!0,children:o("modelDialog.modelSelection")}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{color:de.AccentBlue,children:o("modelDialog.loading")})})]}):(0,hu.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,hu.jsx)(te,{bold:!0,children:o("modelDialog.modelSelection")}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{children:o("modelDialog.selectModelPrompt")})}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{color:de.AccentBlue,children:o("modelDialog.defaultSelection")})}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(du,{items:u,initialIndex:0,onSelect:m,isFocused:!0})}),a&&(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{color:de.AccentRed,children:a})}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{color:de.Gray,children:o("modelDialog.selectInstructions")})})]}):(0,hu.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,hu.jsx)(te,{bold:!0,children:o("modelDialog.modelConfiguration")}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{children:o("modelDialog.enterModelPrompt")})}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(N6,{onSubmit:g,onCancel:A,label:o("modelDialog.modelNameLabel"),placeholder:o("modelDialog.modelNamePlaceholder"),isFocused:!0})}),a&&(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{color:de.AccentRed,children:a})}),(0,hu.jsx)(ue,{marginTop:1,children:(0,hu.jsx)(te,{color:de.Gray,children:o("modelDialog.confirmInstructions")})})]})}var Kst=we(tr(),1);await tn();Nn();qt();ui();var il=we(Pt(),1);function l3i({onSelect:t,onCancel:e,requestedModel:r,reason:n,availableModels:o,suggestedModel:s,taskPrompt:a}){let{t:c}=fr(),[u,d]=(0,Kst.useState)(null),[f,p]=(0,Kst.useState)("model_selection"),[h,m]=(0,Kst.useState)(""),g=k=>{m(k),p("preference_selection")},A=k=>{t({selectedModel:h,preference:k})},y=()=>{e()},E=()=>{p("model_selection"),m("")};_n(k=>{k.name==="escape"&&(f==="preference_selection"?E():e())},{isActive:!0});let v=o.findIndex(k=>k.value===s),b=v>=0?v:0;if(f==="model_selection")return(0,il.jsxs)(ue,{borderStyle:"round",borderColor:de.AccentRed,flexDirection:"column",padding:1,width:"100%",children:[(0,il.jsx)(te,{bold:!0,color:de.AccentRed,children:c("modelValidationDialog.title")}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(te,{color:de.AccentRed,children:c("modelValidationDialog.modelNotSupported",{model:r})})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(te,{color:de.Gray,children:c("modelValidationDialog.reason",{reason:n})})}),a&&(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(te,{color:de.Gray,children:c("modelValidationDialog.task",{task:a.length>100?`${a.substring(0,100)}...`:a})})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(te,{children:c("modelValidationDialog.selectModel")})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(te,{color:de.AccentBlue,children:c("modelValidationDialog.suggested",{model:o.find(k=>k.value===s)?.label||s})})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(du,{items:o,initialIndex:b,onSelect:g,isFocused:!0})}),u&&(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(te,{color:de.AccentRed,children:u})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsxs)(te,{color:de.Gray,children:["(",c("modelValidationDialog.enterToSelect"),")"]})})]});let S=[{label:c("modelValidationDialog.askEachTime"),value:k3.OnceOnly},{label:c("modelValidationDialog.rememberSession"),value:k3.RememberSession},{label:c("modelValidationDialog.rememberAlways"),value:k3.RememberAlways}],w=o.find(k=>k.value===h)?.label||h;return(0,il.jsxs)(ue,{borderStyle:"round",borderColor:de.AccentBlue,flexDirection:"column",padding:1,width:"100%",children:[(0,il.jsx)(te,{bold:!0,color:de.AccentBlue,children:c("modelValidationDialog.preference")}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsxs)(te,{children:[c("modelValidationDialog.youSelected"),": ",(0,il.jsx)(te,{color:de.AccentGreen,children:w})]})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(te,{children:c("modelValidationDialog.futureChoice",{requestedModel:r,selectedModel:w})})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsx)(du,{items:S,initialIndex:0,onSelect:A,isFocused:!0})}),(0,il.jsx)(ue,{marginTop:1,children:(0,il.jsxs)(te,{color:de.Gray,children:["(",c("modelValidationDialog.enterToSelectEscToGoBack"),")"]})})]})}var YW=we(tr(),1);await tn();Nn();qt();var ju=we(Pt(),1);function u3i({onSelect:t,settings:e,projectRoot:r,isGlobalScope:n=!1}){let[o,s]=(0,YW.useState)([]),[a,c]=(0,YW.useState)(0),[u,d]=(0,YW.useState)(!0),[f,p]=(0,YW.useState)(null);if((0,YW.useEffect)(()=>{(async()=>{try{d(!0);let g=new g8(r);await g.loadStyles();let A=e.merged.outputStyle||o0.DEFAULT;g.setCurrentStyle(A);let y=g.getStylesMetadata();s(y);let E=y.findIndex(v=>v.isSelected);c(E>=0?E:0),p(null)}catch(g){p(g instanceof Error?g.message:R.t("outputStyleDialog.failedToLoad"))}finally{d(!1)}})()},[r,e.merged.outputStyle]),_n(m=>{if(m.name==="escape"||m.sequence==="q"){t(void 0);return}if(m.name==="up"||m.sequence==="k"){let g=Math.max(a-1,0);c(g)}else if(m.name==="down"||m.sequence==="j"){let g=Math.min(a+1,o.length-1);c(g)}else{if(m.name==="left"||m.name==="right"||m.sequence==="h"||m.sequence==="l")return;m.name==="return"&&o.length>0&&a>=0&&a<o.length&&t(o[a].name)}},{isActive:!0}),u)return(0,ju.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:[(0,ju.jsx)(te,{bold:!0,children:R.t("outputStyleDialog.loadingTitle")}),(0,ju.jsx)(ue,{marginTop:1,children:(0,ju.jsx)(te,{children:R.t("outputStyleDialog.loadingMessage")})})]});if(f)return(0,ju.jsxs)(ue,{borderStyle:"round",borderColor:de.AccentRed,flexDirection:"column",padding:1,width:"100%",children:[(0,ju.jsxs)(te,{color:de.AccentRed,children:[R.t("outputStyleDialog.errorPrefix"),f]}),(0,ju.jsx)(te,{color:de.Gray,children:R.t("outputStyleDialog.pressQToClose")})]});let h=()=>o.length===0?(0,ju.jsxs)(ue,{flexDirection:"column",children:[(0,ju.jsx)(te,{bold:!0,children:R.t(n?"outputStyleDialog.globalTitle":"outputStyleDialog.projectTitle")}),(0,ju.jsx)(ue,{marginTop:1,children:(0,ju.jsx)(te,{color:de.AccentRed,children:R.t("outputStyleDialog.noStylesAvailable")})})]}):(0,ju.jsxs)(ue,{flexDirection:"column",children:[(0,ju.jsx)(te,{bold:!0,children:R.t(n?"outputStyleDialog.globalTitle":"outputStyleDialog.projectTitle")}),(0,ju.jsx)(ue,{marginTop:1,flexDirection:"column",children:o.map((m,g)=>{let A=g===a,y=m.isSelected,v=`${E6e(m.name)}${y?R.t("outputStyleDialog.currentIndicator"):""}`;return(0,ju.jsxs)(ue,{marginBottom:1,flexDirection:"row",children:[(0,ju.jsx)(ue,{width:30,flexShrink:0,flexDirection:"column",children:(0,ju.jsxs)(te,{color:A?de.AccentCyan:void 0,children:[A?"\u25B6 ":" ",g+1,". ",v]})}),(0,ju.jsx)(ue,{marginLeft:3,flexGrow:1,children:(0,ju.jsx)(te,{color:de.Gray,children:m.description})})]},m.name)})}),(0,ju.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,ju.jsx)(te,{color:de.Gray,children:R.t("outputStyleDialog.navigationTitle")}),(0,ju.jsxs)(te,{color:de.Gray,children:[" ",R.t("outputStyleDialog.navigateUpDown")]}),(0,ju.jsxs)(te,{color:de.Gray,children:[" ",R.t("outputStyleDialog.confirmAction")]}),(0,ju.jsxs)(te,{color:de.Gray,children:[" ",R.t("outputStyleDialog.exitAction")]})]})]});return(0,ju.jsx)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",padding:1,width:"100%",children:h()})}var d3i=we(tr(),1);await tn();Nn();ui();var Q6=we(Pt(),1);var f3i=({plan:t,onApprove:e,onKeepPlanning:r,onMarkdownPlanning:n,onExit:o,terminalWidth:s})=>{let{t:a}=fr(),[c,u]=(0,d3i.useState)(0),d=[{key:"1",label:a("planApprovalDialog.yesSmartMode"),action:()=>e("smart")},{key:"2",label:a("planApprovalDialog.yesManualApproval"),action:()=>e("default")},{key:"3",label:a("planApprovalDialog.noKeepPlanning"),action:r},{key:"4",label:a("planApprovalDialog.noMarkdownPlanning"),action:()=>n(t)}];return _n(f=>{if(f.name==="escape"&&o){o();return}if(f.name==="up")u(p=>p>0?p-1:d.length-1);else if(f.name==="down")u(p=>p<d.length-1?p+1:0);else if(f.name==="return")d[c].action();else if(f.sequence&&f.sequence>="1"&&f.sequence<="4"){let p=parseInt(f.sequence,10)-1;p>=0&&p<d.length&&d[p].action()}},{isActive:!0}),(0,Q6.jsxs)(ue,{flexDirection:"column",padding:1,borderStyle:"round",borderColor:de.AccentBlue,children:[(0,Q6.jsx)(ue,{marginBottom:1,children:(0,Q6.jsx)(te,{color:de.AccentBlue,bold:!0,children:a("planApprovalDialog.planReadyForReview")})}),(0,Q6.jsx)(ue,{marginBottom:2,flexDirection:"column",children:(0,Q6.jsx)(n9,{text:t,isPending:!1,terminalWidth:s})}),(0,Q6.jsx)(ue,{marginBottom:1,children:(0,Q6.jsx)(te,{color:de.AccentBlue,bold:!0,children:a("planApprovalDialog.wouldYouLikeToProceed")})}),d.map((f,p)=>(0,Q6.jsx)(ue,{marginBottom:p===d.length-1?1:0,children:(0,Q6.jsxs)(te,{color:c===p?de.AccentBlue:de.Foreground,children:[c===p?"> ":" ",f.key,". ",f.label]})},f.key)),(0,Q6.jsx)(ue,{marginTop:1,children:(0,Q6.jsx)(te,{color:de.Comment,dimColor:!0,children:a("planApprovalDialog.navigationInstructions")})})]})};var lue=we(tr(),1);await tn();Nn();ui();var dm=we(Pt(),1);import*as Xst from"fs";import*as p3i from"path";var h3i=({onConfirm:t,planContent:e,callId:r})=>{let{t:n}=fr(),[o,s]=(0,lue.useState)(e||""),[a,c]=(0,lue.useState)(null),[u,d]=(0,lue.useState)(0),f=p3i.join(process.cwd(),".iflow","plan.md");(0,lue.useEffect)(()=>{if(e){s(e);return}try{if(Xst.existsSync(f)){let m=Xst.readFileSync(f,"utf8");s(m)}else c("Plan file not found. It may have been deleted.")}catch(m){c(`Failed to read plan file: ${m instanceof Error?m.message:"Unknown error"}`)}},[f,e]);let p=[{key:"1",label:n("planReviewDialog.smartMode"),action:()=>h(!0,"smart")},{key:"2",label:n("planReviewDialog.defaultMode"),action:()=>h(!0,"default")},{key:"3",label:n("planReviewDialog.continuePlanning"),action:()=>h(!1,"continue")}];_n(m=>{if(m.name==="escape"){h(!1,"continue");return}if(m.name==="up")d(g=>g>0?g-1:p.length-1);else if(m.name==="down")d(g=>g<p.length-1?g+1:0);else if(m.name==="return")p[u].action();else if(m.sequence&&m.sequence>="1"&&m.sequence<="3"){let g=parseInt(m.sequence,10)-1;g>=0&&g<p.length&&p[g].action()}},{isActive:!0});let h=(m,g="default")=>{t(!!(m&&o),g)};return a?(0,dm.jsxs)(ue,{flexDirection:"column",padding:1,borderStyle:"round",borderColor:de.AccentRed,children:[(0,dm.jsx)(ue,{marginBottom:1,children:(0,dm.jsx)(te,{color:de.AccentRed,bold:!0,children:n("planReviewDialog.error")})}),(0,dm.jsx)(ue,{marginBottom:1,children:(0,dm.jsx)(te,{color:de.Foreground,children:a})}),(0,dm.jsx)(ue,{children:(0,dm.jsx)(te,{color:de.Comment,dimColor:!0,children:"Press any key to continue..."})})]}):(0,dm.jsxs)(ue,{flexDirection:"column",padding:1,borderStyle:"round",borderColor:de.AccentBlue,children:[(0,dm.jsx)(ue,{marginBottom:1,children:(0,dm.jsx)(te,{color:de.AccentBlue,bold:!0,children:n("planReviewDialog.reviewPlan")})}),(0,dm.jsx)(ue,{marginBottom:2,flexDirection:"column",children:(0,dm.jsx)(te,{color:de.Foreground,children:o||n("planReviewDialog.loading")})}),(0,dm.jsx)(ue,{marginBottom:1,children:(0,dm.jsx)(te,{color:de.AccentBlue,bold:!0,children:n("planReviewDialog.proceedWithPlan")})}),p.map((m,g)=>(0,dm.jsx)(ue,{marginBottom:g===p.length-1?1:0,children:(0,dm.jsxs)(te,{color:u===g?de.AccentBlue:de.Foreground,children:[u===g?"> ":" ",m.label]})},m.key)),(0,dm.jsx)(ue,{marginTop:1,children:(0,dm.jsx)(te,{color:de.Comment,dimColor:!0,children:n("planReviewDialog.navigationInstructions")})})]})};var N1=we(tr(),1);await tn();var uue=we(tr(),1);await tn();h7();function lCa({value:t,placeholder:e="",focus:r=!0,mask:n,highlightPastedText:o=!1,showCursor:s=!0,onChange:a,onSubmit:c}){let[u,d]=(0,uue.useState)({cursorOffset:(t||"").length,cursorWidth:0}),{cursorOffset:f,cursorWidth:p}=u;(0,uue.useEffect)(()=>{d(y=>{if(!r||!s)return y;let E=t||"";return y.cursorOffset>E.length-1?{cursorOffset:E.length,cursorWidth:0}:y})},[t,r,s]);let h=o?p:0,m=n?n.repeat(t.length):t,g=m,A=e?co.grey(e):void 0;if(s&&r){A=e.length>0?co.inverse(e[0])+co.grey(e.slice(1)):co.inverse(" "),g=m.length>0?"":co.inverse(" ");let y=0;for(let E of m)g+=y>=f-h&&y<=f?co.inverse(E):E,y++;m.length>0&&f===m.length&&(g+=co.inverse(" "))}return Nfe((y,E)=>{if(E.upArrow||E.downArrow||E.ctrl&&y==="c"||E.tab||E.shift&&E.tab)return;if(E.return){c&&c(t);return}let v=f,b=t,S=0;E.leftArrow?s&&v--:E.rightArrow?s&&v++:E.backspace||E.delete?f>0&&(b=t.slice(0,f-1)+t.slice(f,t.length),v--):(b=t.slice(0,f)+y+t.slice(f,t.length),v+=y.length,y.length>1&&(S=y.length)),f<0&&(v=0),f>t.length&&(v=t.length),d({cursorOffset:v,cursorWidth:S}),b!==t&&a(b)},{isActive:r}),uue.default.createElement(te,null,e?m.length>0?g:A:g)}var m3i=lCa;Nn();ui();var Ji=we(Pt(),1);var g3i=({questions:t,onSubmit:e,onCancel:r})=>{let{t:n}=fr(),[o,s]=(0,N1.useState)(0),[a,c]=(0,N1.useState)({}),[u,d]=(0,N1.useState)(0),[f,p]=(0,N1.useState)(""),[h,m]=(0,N1.useState)(!1),[g,A]=(0,N1.useState)(0),y=o===t.length,E=y?null:t[o],v=E?a[E.header]:null,b=(0,N1.useMemo)(()=>t.every(N=>{let O=a[N.header];return N.multiSelect?Array.isArray(O)&&O.length>0:typeof O=="string"&&O.trim()!==""}),[t,a]),S=(0,N1.useMemo)(()=>y?[]:[...E.options,{label:n("userQuestionDialog.typeOptionLabel"),description:n("userQuestionDialog.typeOptionDescription")}],[E,y,n]),w=(0,N1.useCallback)(N=>E?E.multiSelect?Array.isArray(v)&&v.includes(N):v===N:!1,[v,E]),k=(0,N1.useCallback)(N=>{if(!E)return;let O=E.header;if(N===n("userQuestionDialog.typeOptionLabel")){m(!0);return}E.multiSelect?c(Q=>{let F=Array.isArray(Q[O])?Q[O]:[],B=F.includes(N);return{...Q,[O]:B?F.filter(G=>G!==N):[...F,N]}}):(c(Q=>({...Q,[O]:N})),o<t.length-1?setTimeout(()=>{s(Q=>Q+1),d(0)},100):setTimeout(()=>{s(t.length),d(0)},100))},[E,o,t.length,n]),D=(0,N1.useCallback)(()=>{if(!f.trim()||!E){m(!1),d(0);return}let N=E.header;E.multiSelect?(c(O=>({...O,[N]:[...Array.isArray(O[N])?O[N]:[],f.trim()]})),p(""),m(!1),d(0)):(c(O=>({...O,[N]:f.trim()})),p(""),m(!1),o<t.length-1?(s(O=>O+1),d(0)):(s(t.length),d(0)))},[f,E,o,t.length]),P=(0,N1.useCallback)(()=>{o<t.length&&(s(N=>N+1),d(0),A(0),m(!1),p(""))},[o,t.length]),T=(0,N1.useCallback)(()=>{o>0&&(s(N=>N-1),d(0),A(0),m(!1),p(""))},[o]);return _n(N=>{if(h){N.name==="escape"&&(m(!1),p(""));return}if(N.name==="escape"){r();return}if(y){N.name==="up"?A(O=>O===0?1:0):N.name==="down"?A(O=>O===0?1:0):N.name==="return"?g===0?e(a):r():N.name==="left"&&T();return}if(N.name==="left")T();else if(N.name==="right")P();else if(N.name==="up")d(O=>O>0?O-1:S.length-1);else if(N.name==="down")d(O=>O<S.length-1?O+1:0);else if(N.name==="return"||N.name==="space"){let O=S[u];O&&O.label===n("userQuestionDialog.typeOptionLabel")?m(!0):k(S[u].label)}},{isActive:!0}),(0,Ji.jsxs)(ue,{flexDirection:"column",padding:1,borderStyle:"round",borderColor:de.AccentBlue,children:[(0,Ji.jsxs)(ue,{marginBottom:1,flexDirection:"row",children:[t.map((N,O)=>{let Q=o===O,F=!!a[N.header];return(0,Ji.jsx)(ue,{marginRight:2,children:(0,Ji.jsxs)(te,{color:Q?de.AccentBlue:F?de.AccentGreen:de.Comment,bold:Q,dimColor:!Q&&!F,children:[Q?"\u25B8 ":"",N.header,F?" \u2713":""]})},O)}),(0,Ji.jsx)(ue,{children:(0,Ji.jsxs)(te,{color:y?de.AccentBlue:de.Comment,bold:y,dimColor:!y,children:[y?"\u25B8 ":"",n("userQuestionDialog.submitTab")]})})]}),y?(0,Ji.jsxs)(Ji.Fragment,{children:[(0,Ji.jsx)(ue,{marginBottom:1,children:(0,Ji.jsx)(te,{color:de.AccentBlue,bold:!0,children:n("userQuestionDialog.reviewTitle")})}),(0,Ji.jsx)(ue,{flexDirection:"column",marginBottom:2,children:t.map((N,O)=>{let Q=a[N.header];return(0,Ji.jsxs)(ue,{flexDirection:"column",marginBottom:1,children:[(0,Ji.jsxs)(te,{color:de.AccentBlue,children:["\u25CF ",N.question]}),(0,Ji.jsx)(ue,{marginLeft:2,children:(0,Ji.jsxs)(te,{color:de.AccentGreen,children:["\u2192"," ",Q?Array.isArray(Q)?Q.join(", "):Q:n("userQuestionDialog.noAnswer")]})})]},O)})}),(0,Ji.jsx)(ue,{marginBottom:1,children:(0,Ji.jsx)(te,{children:n("userQuestionDialog.readyToSubmitPrompt")})}),(0,Ji.jsxs)(ue,{flexDirection:"column",marginBottom:1,children:[(0,Ji.jsx)(ue,{children:(0,Ji.jsxs)(te,{color:g===0?de.AccentGreen:de.Foreground,bold:g===0,children:[g===0?"> ":" ","1."," ",n("userQuestionDialog.submitAnswers")]})}),(0,Ji.jsx)(ue,{children:(0,Ji.jsxs)(te,{color:g===1?de.AccentBlue:de.Foreground,bold:g===1,children:[g===1?"> ":" ","2."," ",n("userQuestionDialog.cancel")]})})]}),(0,Ji.jsx)(ue,{marginTop:1,children:(0,Ji.jsx)(te,{color:de.Comment,dimColor:!0,children:n("userQuestionDialog.reviewInstructions")})})]}):(0,Ji.jsxs)(Ji.Fragment,{children:[t.length>1&&(0,Ji.jsx)(ue,{marginBottom:1,children:(0,Ji.jsx)(te,{color:de.Comment,dimColor:!0,children:n("userQuestionDialog.navigationHint")})}),(0,Ji.jsx)(ue,{marginBottom:1,flexDirection:"column",children:(0,Ji.jsx)(te,{children:E.question})}),(0,Ji.jsx)(ue,{flexDirection:"column",marginBottom:1,children:S.map((N,O)=>{let Q=w(N.label),F=u===O,B=N.label===n("userQuestionDialog.typeOptionLabel");return(0,Ji.jsxs)(ue,{flexDirection:"column",marginBottom:1,children:[(0,Ji.jsx)(ue,{children:B&&F&&h?(0,Ji.jsxs)(Ji.Fragment,{children:[(0,Ji.jsxs)(te,{color:de.AccentBlue,bold:!0,children:["> ",O+1,"."]}),(0,Ji.jsx)(m3i,{value:f,onChange:p,onSubmit:D,placeholder:n("userQuestionDialog.typeOptionLabel")})]}):(0,Ji.jsxs)(te,{color:F?de.AccentBlue:de.Foreground,bold:F,children:[F?"> ":" ",O+1,". ",N.label,!B&&(0,Ji.jsxs)(Ji.Fragment,{children:[E.multiSelect&&(0,Ji.jsxs)(te,{color:Q?de.AccentGreen:de.Comment,children:[" ","[",Q?"\u2713":" ","]"]}),!E.multiSelect&&Q&&(0,Ji.jsx)(te,{color:de.AccentGreen,children:" \u25CF"})]})]})}),!F&&(0,Ji.jsx)(ue,{marginLeft:4,children:(0,Ji.jsx)(te,{color:de.Comment,dimColor:!0,children:N.description})})]},O)})}),o===t.length-1&&b&&!h&&(0,Ji.jsx)(ue,{marginBottom:1,children:(0,Ji.jsx)(te,{color:de.AccentGreen,bold:!0,children:n("userQuestionDialog.submitHint")})}),!h&&(0,Ji.jsxs)(ue,{marginBottom:1,flexDirection:"column",children:[(0,Ji.jsxs)(te,{color:de.Comment,children:[n("userQuestionDialog.currentAnswer"),":"," "]}),(0,Ji.jsx)(te,{color:de.AccentGreen,children:v?Array.isArray(v)?v.join(", "):v:n("userQuestionDialog.noAnswer")})]}),!h&&(0,Ji.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,Ji.jsx)(te,{color:de.Comment,dimColor:!0,children:n("userQuestionDialog.instructions")}),(0,Ji.jsx)(te,{color:de.Comment,dimColor:!0,children:E.multiSelect?n("userQuestionDialog.multiSelectHint"):n("userQuestionDialog.singleSelectHint")})]})]})]})};await tn();Nn();ui();var hd=we(Pt(),1);function Jst(){let t=new Date,e=t.getMonth(),r=t.getDate();return e===9&&r===24}function A3i({onContinue:t}){let{t:e}=fr();return _n(r=>{(r.name==="return"||r.sequence===" ")&&t()},{isActive:!0}),(0,hd.jsxs)(ue,{borderStyle:"round",borderColor:de.AccentBlue,flexDirection:"column",padding:1,width:"100%",children:[(0,hd.jsx)(te,{bold:!0,color:de.AccentBlue,children:e("programmersDayDisplay.title")}),(0,hd.jsx)(ue,{marginTop:1,children:(0,hd.jsx)(te,{children:e("programmersDayDisplay.welcome")})}),(0,hd.jsx)(ue,{marginTop:1,children:(0,hd.jsx)(te,{bold:!0,color:de.AccentPurple,children:e("programmersDayDisplay.whyLabel")})}),(0,hd.jsx)(ue,{marginTop:1,marginLeft:2,children:(0,hd.jsx)(te,{children:e("programmersDayDisplay.whyContent.first")})}),(0,hd.jsx)(ue,{marginLeft:2,children:(0,hd.jsx)(te,{children:e("programmersDayDisplay.whyContent.second")})}),(0,hd.jsx)(ue,{marginTop:1,children:(0,hd.jsx)(te,{bold:!0,color:de.AccentPurple,children:e("programmersDayDisplay.culturesLabel")})}),(0,hd.jsx)(ue,{marginTop:1,marginLeft:2,children:(0,hd.jsx)(te,{children:e("programmersDayDisplay.cultures.binary")})}),(0,hd.jsx)(ue,{marginLeft:2,children:(0,hd.jsx)(te,{children:e("programmersDayDisplay.cultures.helloWorld")})}),(0,hd.jsx)(ue,{marginLeft:2,children:(0,hd.jsx)(te,{children:e("programmersDayDisplay.cultures.bugs")})}),(0,hd.jsx)(ue,{marginLeft:2,children:(0,hd.jsx)(te,{children:e("programmersDayDisplay.cultures.poetry")})}),(0,hd.jsx)(ue,{marginTop:1,children:(0,hd.jsx)(te,{bold:!0,color:de.AccentGreen,children:e("programmersDayDisplay.wishes")})}),(0,hd.jsx)(ue,{marginTop:2,children:(0,hd.jsx)(te,{bold:!0,color:de.AccentGreen,children:e("programmersDayDisplay.continueInstructions")})})]})}var Zst=we(tr(),1);await tn();Nn();tk();var ocr=class{queue=[];messageIdCounter=0;enqueueMessage(e){let r={id:`msg_${++this.messageIdCounter}_${Date.now()}`,content:e,timestamp:Date.now()};return this.queue.push(r),Fo.emit("message-queued",{message:r,queueLength:this.queue.length}),r}dequeueMessage(){let e=this.queue.shift()||null;return e&&Fo.emit("message-dequeued",{message:e,queueLength:this.queue.length}),this.queue.length===0&&Fo.emit("queue-empty"),e}getQueuedMessages(){return[...this.queue]}clearQueue(){let e=this.queue.length;this.queue=[],e>0&&Fo.emit("queue-empty")}isEmpty(){return this.queue.length===0}getQueueLength(){return this.queue.length}peekNext(){return this.queue[0]||null}},rL=new ocr;tk();ui();var _3i=we(Pt(),1);var y3i=()=>{let{t}=fr(),[e,r]=(0,Zst.useState)(rL.getQueueLength());return(0,Zst.useEffect)(()=>{let n=()=>{r(rL.getQueueLength())},o=()=>n(),s=()=>n(),a=()=>n();return Fo.on("message-queued",o),Fo.on("message-dequeued",s),Fo.on("queue-empty",a),()=>{Fo.off("message-queued",o),Fo.off("message-dequeued",s),Fo.off("queue-empty",a)}},[]),e===0?null:(0,_3i.jsxs)(te,{color:de.AccentYellow,children:["\u{1F4CB} ",t("queueStatusDisplay.messagesPending",{count:e})]})};var ng=we(tr(),1);await tn();Nn();var eat=we(tr(),1);var E3i=8;function tat(){let[t,e]=(0,eat.useState)({columns:(process.stdout.columns||60)-E3i,rows:process.stdout.rows||20});return(0,eat.useEffect)(()=>{function r(){e({columns:(process.stdout.columns||60)-E3i,rows:process.stdout.rows||20})}return process.stdout.on("resize",r),()=>{process.stdout.off("resize",r)}},[]),t}qt();ui();var fm=we(Pt(),1);var v3i=({sessions:t,onSelect:e})=>{let{t:r}=fr(),{rows:n}=tat(),[o,s]=(0,ng.useState)(0),[a,c]=(0,ng.useState)(!1),[u,d]=(0,ng.useState)(!1),f=(0,ng.useRef)(!1),p=(0,ng.useRef)(0),h=(0,ng.useRef)(!1),m=(0,ng.useRef)(!1),g=(0,ng.useMemo)(()=>{let O=Math.max(n-8-2,5),Q=Math.floor(O/5);return Math.max(1,Math.min(Q,12))},[n]),[A,y]=(0,ng.useState)(0),[E]=(0,ng.useState)(()=>process.stdin.isTTY&&process.stdout.isTTY),v=(0,ng.useCallback)(P=>{let T=Date.now();T-p.current<300||a||(p.current=T,c(!0),e(P))},[e,a]),b=Math.ceil(t.length/g),S=A*g,w=Math.min(S+g,t.length),k=t.slice(S,w),D=t.map((P,T)=>({id:P.sessionId,label:uCa(P,T+1)}));return(0,ng.useEffect)(()=>(m.current||(f.current=!0,m.current=!0),()=>{f.current=!1}),[]),(0,ng.useEffect)(()=>{!E&&!a&&!u&&t.length>0&&f.current&&m.current&&!h.current&&(d(!0),setTimeout(()=>{f.current&&v(t[0]?.sessionId||null)},1e3))},[t,E,a,u,v,d]),(0,ng.useEffect)(()=>{if(t.length>0){let P=Math.ceil(t.length/g),T=Math.floor(o/g);T!==A&&y(Math.min(T,P-1))}},[g,o,t.length,A]),_n(P=>{if(!(!E||a)){if(P.name==="up"){if(o>0){let T=o-1,N=Math.floor(T/g);s(T),N!==A&&y(N)}}else if(P.name==="down"){if(o<t.length-1){let T=o+1,N=Math.floor(T/g);s(T),N!==A&&y(N)}}else if(P.name==="return")v(D[o].id);else if(P.name==="escape")v(null);else if(P.sequence&&P.sequence>="1"&&P.sequence<="9"){let T=parseInt(P.sequence,10);if(T>0&&T<=t.length){let N=T-1,O=Math.floor(N/g);s(N),y(O),v(t[N].sessionId)}}}},{isActive:!0}),t.length===0?(0,fm.jsxs)(ue,{flexDirection:"column",children:[(0,fm.jsxs)(te,{color:"yellow",children:["\u{1F50D} ",r("sessionSelectorComponent.noSessionsFound")]}),(0,fm.jsxs)(te,{color:"cyan",children:["\u{1F4A1} ",r("sessionSelectorComponent.startingNew")]})]}):E?(0,fm.jsxs)(ue,{flexDirection:"column",children:[(0,fm.jsxs)(te,{color:"cyan",bold:!0,children:["\u{1F4CB} ",r("sessionSelectorComponent.availableSessions")]}),(0,fm.jsx)(te,{color:"gray",children:"\u2500".repeat(80)}),b>1&&(0,fm.jsx)(ue,{children:(0,fm.jsx)(te,{color:"gray",children:r("sessionSelectorComponent.pageInfo",{current:A+1,total:b,start:S+1,end:w,totalSessions:t.length})})}),k.map((P,T)=>{let N=S+T,O=N+1,Q=o===N,F=(B,G=76)=>{let j=B.trimEnd();if(j.length>=G)return j.substring(0,G);let Y=G-j.length;return j+" ".repeat(Y)};return(0,fm.jsxs)(ue,{flexDirection:"column",children:[(0,fm.jsx)(te,{color:Q?de.AccentCyan:"white",bold:Q,children:F(`${O}. ${dCa(P.summary,70)}`)}),(0,fm.jsx)(te,{color:Q?de.AccentCyan:"gray",bold:Q,children:F(` \u{1F4C5} ${r("sessionSelectorComponent.created")}: ${scr(P.createdAt)}`)}),(0,fm.jsx)(te,{color:Q?de.AccentCyan:"gray",bold:Q,children:F(` \u23F0 ${r("sessionSelectorComponent.modified")}: ${scr(P.lastActivity)}`)}),(0,fm.jsx)(te,{color:Q?de.AccentCyan:"gray",bold:Q,children:F(` \u{1F4AC} ${r("sessionSelectorComponent.messages")}: ${P.messageCount}`)}),(0,fm.jsx)(te,{color:Q?de.AccentCyan:"gray",bold:Q,children:F(` \u{1F33F} ${r("sessionSelectorComponent.gitBranch")}: ${P.gitBranch||"-"}`)})]},P.sessionId)}),(0,fm.jsx)(te,{color:"gray",children:"\u2500".repeat(80)}),(0,fm.jsx)(te,{color:"yellow",children:r("sessionSelectorComponent.navigationInstructions",{autoScroll:b>1?` (${r("sessionSelectorComponent.autoScroll")})`:""})}),b>1&&(0,fm.jsxs)(te,{color:"gray",children:["\u{1F4A1} ",r("sessionSelectorComponent.scrollHint",{total:t.length,pages:b})]})]}):(0,fm.jsx)(ue,{})};function uCa(t,e){let r=t.sessionId.substring(0,8),n=scr(t.lastActivity);return`${e}. [${r}] ${n}`}function scr(t){let e=new Date,r=new Date(t),n=e.getTime()-r.getTime(),o=Math.floor(n/(1e3*60)),s=Math.floor(n/(1e3*60*60)),a=Math.floor(n/(1e3*60*60*24));return o<1?R.t("sessionSelectorComponent.time.justNow"):o<60?R.t("sessionSelectorComponent.time.minutesAgo",{count:o}):s<24?R.t("sessionSelectorComponent.time.hoursAgo",{count:s}):a<7?R.t("sessionSelectorComponent.time.daysAgo",{count:a}):a<30?R.t("sessionSelectorComponent.time.weeksAgo",{count:Math.floor(a/7)}):r.toLocaleDateString()}function dCa(t,e){return t.length<=e?t:t.substring(0,e-3)+"..."}qt();await tn();Nn();ui();var rx=we(Pt(),1);var b3i=({request:t})=>{let{t:e}=fr(),{commands:r,onConfirm:n}=t;_n(a=>{a.name==="escape"&&n(on.Cancel)},{isActive:!0});let o=a=>{a===on.Cancel?n(a):n(a,r)},s=[{label:e("shellConfirmationDialog.allowOnce"),value:on.ProceedOnce},{label:e("shellConfirmationDialog.allowAlwaysSession"),value:on.ProceedAlways},{label:e("shellConfirmationDialog.noEsc"),value:on.Cancel}];return(0,rx.jsxs)(ue,{flexDirection:"column",borderStyle:"round",borderColor:de.AccentYellow,padding:1,width:"100%",marginLeft:1,children:[(0,rx.jsxs)(ue,{flexDirection:"column",marginBottom:1,children:[(0,rx.jsx)(te,{bold:!0,children:e("shellConfirmationDialog.title")}),(0,rx.jsx)(te,{children:e("shellConfirmationDialog.description")}),(0,rx.jsx)(ue,{flexDirection:"column",borderStyle:"round",borderColor:de.Gray,paddingX:1,marginTop:1,children:r.map(a=>(0,rx.jsx)(te,{color:de.AccentCyan,children:a},a))})]}),(0,rx.jsx)(ue,{marginBottom:1,children:(0,rx.jsx)(te,{children:e("shellConfirmationDialog.proceed")})}),(0,rx.jsx)(du,{items:s,onSelect:o,isFocused:!0})]})};await tn();Nn();ui();var V4e=we(Pt(),1);var C3i=()=>{let{t}=fr();return(0,V4e.jsx)(ue,{children:(0,V4e.jsxs)(te,{color:de.AccentYellow,children:[t("input.shellModeEnabled"),(0,V4e.jsx)(te,{color:de.Gray,children:t("input.shellModeDisableHint")})]})})};await tn();ks();Nn();ui();var acr=we(Pt(),1);var rat=({constrainHeight:t})=>{let{t:e}=fr(),r=w0i(),n=XF();return r===void 0||r.overflowingIds.size===0||!t||!(n==="idle"||n==="waiting_for_confirmation")?null:(0,acr.jsx)(ue,{children:(0,acr.jsx)(te,{color:de.Gray,wrap:"truncate",children:e("showMoreLines.pressCtrlS")})})};var ok=we(tr(),1);await tn();Nn();qF();Tl();ui();var w0=we(Pt(),1);function S3i({onSelect:t,onHighlight:e,settings:r,availableTerminalHeight:n,terminalWidth:o}){let{t:s}=fr(),[a,c]=(0,ok.useState)("User"),[u,d]=(0,ok.useState)(r.merged.theme||J8.name),f=a==="User"?r.user.settings.customThemes||{}:r.merged.customThemes||{},p=ta.getAvailableThemes().filter(oe=>oe.type!=="custom"),h=Object.keys(f),m=oe=>oe.charAt(0).toUpperCase()+oe.slice(1),g=[...p.map(oe=>({label:oe.name,value:oe.name,themeNameDisplay:oe.name,themeTypeDisplay:m(oe.type)})),...h.map(oe=>({label:oe,value:oe,themeNameDisplay:oe,themeTypeDisplay:s("themeDialog.custom")}))],[A,y]=(0,ok.useState)(Date.now()),E=r.merged.theme||J8.name,v=g.findIndex(oe=>oe.value===E),b=v>=0?v:0,S=[{label:s("themeDialog.userSettings"),value:"User"},{label:s("themeDialog.workspaceSettings"),value:"Workspace"},{label:s("themeDialog.systemSettings"),value:"System"}],w=(0,ok.useCallback)(oe=>{t(oe,a)},[t,a]),k=oe=>{d(oe),e(oe)},D=(0,ok.useCallback)(oe=>{c(oe),y(Date.now())},[]),P=(0,ok.useCallback)(oe=>{D(oe),N("theme")},[D]),[T,N]=(0,ok.useState)("theme");_n(oe=>{oe.name==="tab"&&N(me=>me==="theme"?"scope":"theme"),oe.name==="escape"&&t(void 0,a)},{isActive:!0});let Q=Object.values(y0).filter(oe=>oe!==a).filter(oe=>r.forScope(oe).settings.theme!==void 0),F="";if(Q.length>0){let oe=Q.join(", ");F=r.forScope(a).settings.theme!==void 0?`(Also modified in ${oe})`:`(Modified in ${oe})`}let Y=Math.max(Math.floor((o-4)*.55*.9),1),V=2,L=g.length+1,X=4,J=1,z=2;n=n??Number.MAX_SAFE_INTEGER,n-=2,n-=z;let K=V+L+X+J,ae=!0,be=!0;K>n&&(be=!1,K-=V),K>n&&(K-=X,ae=!1);let le=ae?T:"theme",Ce=8;n=Math.max(n,K);let ee=n-Ce-(be?2:0)*2,ie=Math.max(0,ee-1),se=Math.ceil(ie*.6),ye=Math.floor(ie*.4);return(0,w0.jsxs)(ue,{borderStyle:"round",borderColor:de.Gray,flexDirection:"column",paddingTop:be?1:0,paddingBottom:be?1:0,paddingLeft:1,paddingRight:1,width:"100%",children:[(0,w0.jsxs)(ue,{flexDirection:"row",children:[(0,w0.jsxs)(ue,{flexDirection:"column",width:"45%",paddingRight:2,children:[(0,w0.jsxs)(te,{bold:le==="theme",wrap:"truncate",children:[le==="theme"?"> ":" ",s("themeDialog.selectTheme")," ",(0,w0.jsx)(te,{color:de.Gray,children:F})]}),(0,w0.jsx)(du,{items:g,initialIndex:b,onSelect:w,onHighlight:k,isFocused:le==="theme",maxItemsToShow:8,showScrollArrows:!0,showNumbers:le==="theme"},A),ae&&(0,w0.jsxs)(ue,{marginTop:1,flexDirection:"column",children:[(0,w0.jsxs)(te,{bold:le==="scope",wrap:"truncate",children:[le==="scope"?"> ":" ",s("themeDialog.applyTo")]}),(0,w0.jsx)(du,{items:S,initialIndex:0,onSelect:P,onHighlight:D,isFocused:le==="scope",showNumbers:le==="scope"})]})]}),(0,w0.jsxs)(ue,{flexDirection:"column",width:"55%",paddingLeft:2,children:[(0,w0.jsx)(te,{bold:!0,children:s("themeDialog.preview")}),(()=>{let oe=ta.getTheme(u||J8.name)||J8;return(0,w0.jsxs)(ue,{borderStyle:"single",borderColor:de.Gray,paddingTop:be?1:0,paddingBottom:be?1:0,paddingLeft:1,paddingRight:1,flexDirection:"column",children:[r9(`# function
6370
6370
  def fibonacci(n):
6371
6371
  a, b = 0, 1
6372
6372
  for _ in range(n):
@@ -6609,7 +6609,7 @@ ${R.t("gemini.errors.criticalUnhandledRejection")}
6609
6609
  =========================================
6610
6610
  ${R.t("gemini.errors.reason",{reason:e})}${e instanceof Error&&e.stack?`
6611
6611
  ${R.t("gemini.errors.stackTrace")}
6612
- ${e.stack}`:""}`;Fo.emit("log-error",n),t||(t=!0,Fo.emit("open-debug-console"))})}function vIa(){console.log(R.t("gemini.crashDiagnosticsEnabled")),process.setUncaughtExceptionCaptureCallback(t=>{let e={timestamp:new Date().toISOString(),error:{name:t.name,message:t.message,stack:t.stack},memory:process.memoryUsage(),pid:process.pid,cwd:process.cwd(),nodeVersion:process.version,platform:process.platform,arch:process.arch,uptime:process.uptime(),env:{NODE_ENV:"production",SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.4.9"}},r=`crash-${Date.now()}-${process.pid}.json`,n=fIa.join(process.cwd(),r);try{gIa.writeFileSync(n,JSON.stringify(e,null,2)),console.error(R.t("gemini.crashDetected",{crashFilePath:n})),console.error(R.t("gemini.coreDumpWillBeGenerated"))}catch(o){console.error(R.t("gemini.failedToWriteCrashFile"),o)}process.abort()}),process.on("warning",t=>{console.warn(R.t("gemini.debug.nodejsWarning"),{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error(R.t("gemini.debug.unhandledPromiseRejectionDetected"),{reason:t,promise:e.toString()})})}async function Dxi(){if(EIa(),Ixi.platform()==="win32")try{let{execSync:A}=await import("node:child_process");A("chcp 65001",{stdio:"ignore"})}catch{}let t=process.cwd(),e=tl(t);if(!e.user.settings.cna){let A=await yPe();A&&e.setValue("User","cna",A)}if(await agi(),e.errors.length>0){for(let A of e.errors){let y=R.t("gemini.errorInFile",{path:A.path,message:A.message});process.env.NO_COLOR||(y=`\x1B[31m${y}\x1B[0m`),console.error(y),console.error(R.t("gemini.pleaseFixFileAndTryAgain",{path:A.path}))}process.exit(1)}let r=await Rot(),n=typeof r.resume=="string";(!!r.prompt&&!r.promptInteractive&&!r.continue&&(!r.resume||n)||r.experimentalAcp)&&(process.env.IFLOW_NON_INTERACTIVE="true");let s=LF(t),a=n&&typeof r.resume=="string"?r.resume:v0.generateSessionId(),c=await kW(e.merged,s,a,r),u=await Ole(c);if(u&&(global.statuslineOutput=u),R.changeLanguage(c.getLanguage()),c.getDebugMode()&&vIa(),hIa.setDefaultResultOrder(AIa(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error(R.t("gemini.errors.promptInteractiveFlagNotSupported")),process.exit(1)),c.getListExtensions()){console.debug(R.t("gemini.installedExtensions"));for(let A of s)console.debug(`- ${A.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:A}=await Promise.resolve().then(()=>(Usr(),rgi)),y=(await Promise.resolve().then(()=>(hdr(),pdr))).default;await y().scriptName("iflow").command(A).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:A}=await Promise.resolve().then(()=>(Fsr(),$mi)),y=(await Promise.resolve().then(()=>(hdr(),pdr))).default;await y().scriptName("iflow").command(A).help().version(!1).parse(),process.exit(0)}if(e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",Jt.CLOUD_SHELL),T0i(c.getDebugMode()),await c.initialize(),c.getExperimentalAcp()?c.setUsageMode("sdk"):c.setUsageMode("interactive"),ta.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(ta.setActiveTheme(e.merged.theme)||console.warn(R.t("gemini.themeNotFound",{theme:e.merged.theme}))),!process.env.SANDBOX){let A=e.merged.autoConfigureMaxOldSpaceSize?yIa(c):[],y=c.getSandbox();if(y){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let E=OF(e.merged.selectedAuthType);if(E)throw new Error(E);await c.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(E){E instanceof Error&&E.message.includes("SERVER_OAUTH2_REQUIRED")?(console.error(R.t("gemini.serverOAuth2Required")||"\u68C0\u6D4B\u5230\u670D\u52A1\u5668\u73AF\u5883\uFF0C\u9700\u8981\u624B\u52A8\u8FDB\u884COAuth2\u8BA4\u8BC1\u3002\u8BF7\u5728\u975E\u6C99\u7BB1\u6A21\u5F0F\u4E0B\u8FD0\u884CCLI\u8FDB\u884C\u8BA4\u8BC1\u3002"),console.error("\u8BF7\u5C1D\u8BD5\u4E0D\u4F7F\u7528\u6C99\u7BB1\u6A21\u5F0F\u542F\u52A8\uFF0C\u6216\u8005\u5148\u5728\u672C\u5730\u73AF\u5883\u4E0B\u5B8C\u6210\u8BA4\u8BC1\u3002")):console.error(R.t("gemini.errorAuthenticating"),E),process.exit(1)}await d5i(y,A,c),process.exit(0)}else A.length>0&&(await _Ia(A),process.exit(0))}if(e.merged.selectedAuthType===Jt.LOGIN_WITH_IFLOW&&c.isBrowserLaunchSuppressed())try{await LU(e.merged.selectedAuthType,c)}catch(A){if(!(A instanceof Error&&A.message.includes("SERVER_OAUTH2_REQUIRED")))throw A}if(c.getExperimentalAcp())return c.getAcpPort()?await U5i(c,e,s,r,c.getAcpPort()):N5i(c,e,s,r);let d=c.getQuestion(),f=[...await f5i(),...await h5i(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume&&!n||process.stdin.isTTY&&d?.length===0){console.clear();let A=await GF();Txi(wxi(t),e);try{await Y1i()}catch(k){c.getDebugMode()&&console.warn("Failed to detect/enable Kitty protocol:",k)}if(ih())try{await c.setIdeModeAndSyncConnection(!0)}catch(k){console.error(R.t("gemini.failedToConnectToIdeServer"),k)}let E,v=async()=>{try{if(console.clear(),Txi(wxi(t),e),E)try{E.unmount(),await new Promise(P=>process.nextTick(P))}catch(P){console.error(R.t("gemini.errorDuringUnmount"),P)}let{executeSessionStartHooks:k}=await Promise.resolve().then(()=>(ak(),oL)),D=await k(c,"resume");E=fxe((0,LCe.jsx)(mdr.default.StrictMode,{children:(0,LCe.jsx)(bur,{instance:()=>E,config:c,settings:e,startupWarnings:f,version:A,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0,sessionStartContext:D})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:ycr(),maxFps:20})}catch(k){console.error(R.t("gemini.errorDuringResume"),k)}};process.on("SIGCONT",v),b4e(()=>{process.off("SIGCONT",v)});let b="startup";(r.continue||r.resume)&&(b="resume");let{executeSessionStartHooks:S}=await Promise.resolve().then(()=>(ak(),oL)),w=await S(c,b);E=fxe((0,LCe.jsx)(mdr.default.StrictMode,{children:(0,LCe.jsx)(bur,{instance:()=>E,config:c,settings:e,startupWarnings:f,version:A,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,sessionStartContext:w})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:ycr()}),e.merged.disableAutoUpdate||rct().then(k=>{cgi(k,e,c.getProjectRoot())}).catch(k=>{c.getDebugMode()&&console.error(R.t("gemini.updateCheckFailed"),k)}),b4e(()=>E.unmount());return}!process.stdin.isTTY&&!d&&(d+=await a5i()),d||(console.error(R.t("gemini.noInputProvidedViaStdin")),process.exit(1));let h=Math.random().toString(16).slice(2);see(c,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:d,prompt_id:h,auth_type:c.getContentGeneratorConfig()?.authType,prompt_length:d.length});let m=await bIa(c,s,e,r),g=r.outputFile||r.output_file;await y5i(m,d,h,g),process.exit(0)}function Txi(t,e){if(!e.merged.hideWindowTitle){let r=(process.env.CLI_TITLE||`iFlow - ${t}`).replace(/[\x00-\x1F\x7F]/g,"");process.stdout.write(`\x1B]2;${r}\x07`),process.on("exit",()=>{process.stdout.write("\x1B]2;\x07")})}}async function bIa(t,e,r,n){let o=t;if(t.getApprovalMode()!==yn.YOLO){let s=r.merged.excludeTools||[],a=[vc.Name,Qf.Name,$d.Name],c=[...new Set([...s,...a])],u={...r.merged,excludeTools:c},d={...n};o=await kW(u,e,t.getSessionId(),d),await o.initialize()}return await CIa(r.merged.selectedAuthType,o,r)}async function CIa(t,e,r){!t&&!process.env.IFLOW_API_KEY&&!UPe()&&(console.error(R.t("gemini.pleaseSetAuthMethod",{userSettingsPath:hW})),process.exit(1)),t||(UPe()?t=Jt.IFLOW:t=Jt.IFLOW);let n=OF(t);return n!=null&&(console.error(n),process.exit(1)),await e.refreshAuth(t,{apiKey:r.merged.apiKey,baseUrl:r.merged.baseUrl,modelName:e.getModel()}),e}Dxi().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
6612
+ ${e.stack}`:""}`;Fo.emit("log-error",n),t||(t=!0,Fo.emit("open-debug-console"))})}function vIa(){console.log(R.t("gemini.crashDiagnosticsEnabled")),process.setUncaughtExceptionCaptureCallback(t=>{let e={timestamp:new Date().toISOString(),error:{name:t.name,message:t.message,stack:t.stack},memory:process.memoryUsage(),pid:process.pid,cwd:process.cwd(),nodeVersion:process.version,platform:process.platform,arch:process.arch,uptime:process.uptime(),env:{NODE_ENV:"production",SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.4.10"}},r=`crash-${Date.now()}-${process.pid}.json`,n=fIa.join(process.cwd(),r);try{gIa.writeFileSync(n,JSON.stringify(e,null,2)),console.error(R.t("gemini.crashDetected",{crashFilePath:n})),console.error(R.t("gemini.coreDumpWillBeGenerated"))}catch(o){console.error(R.t("gemini.failedToWriteCrashFile"),o)}process.abort()}),process.on("warning",t=>{console.warn(R.t("gemini.debug.nodejsWarning"),{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error(R.t("gemini.debug.unhandledPromiseRejectionDetected"),{reason:t,promise:e.toString()})})}async function Dxi(){if(EIa(),Ixi.platform()==="win32")try{let{execSync:A}=await import("node:child_process");A("chcp 65001",{stdio:"ignore"})}catch{}let t=process.cwd(),e=tl(t);if(!e.user.settings.cna){let A=await yPe();A&&e.setValue("User","cna",A)}if(await agi(),e.errors.length>0){for(let A of e.errors){let y=R.t("gemini.errorInFile",{path:A.path,message:A.message});process.env.NO_COLOR||(y=`\x1B[31m${y}\x1B[0m`),console.error(y),console.error(R.t("gemini.pleaseFixFileAndTryAgain",{path:A.path}))}process.exit(1)}let r=await Rot(),n=typeof r.resume=="string";(!!r.prompt&&!r.promptInteractive&&!r.continue&&(!r.resume||n)||r.experimentalAcp)&&(process.env.IFLOW_NON_INTERACTIVE="true");let s=LF(t),a=n&&typeof r.resume=="string"?r.resume:v0.generateSessionId(),c=await kW(e.merged,s,a,r),u=await Ole(c);if(u&&(global.statuslineOutput=u),R.changeLanguage(c.getLanguage()),c.getDebugMode()&&vIa(),hIa.setDefaultResultOrder(AIa(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error(R.t("gemini.errors.promptInteractiveFlagNotSupported")),process.exit(1)),c.getListExtensions()){console.debug(R.t("gemini.installedExtensions"));for(let A of s)console.debug(`- ${A.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:A}=await Promise.resolve().then(()=>(Usr(),rgi)),y=(await Promise.resolve().then(()=>(hdr(),pdr))).default;await y().scriptName("iflow").command(A).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:A}=await Promise.resolve().then(()=>(Fsr(),$mi)),y=(await Promise.resolve().then(()=>(hdr(),pdr))).default;await y().scriptName("iflow").command(A).help().version(!1).parse(),process.exit(0)}if(e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",Jt.CLOUD_SHELL),T0i(c.getDebugMode()),await c.initialize(),c.getExperimentalAcp()?c.setUsageMode("sdk"):c.setUsageMode("interactive"),ta.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(ta.setActiveTheme(e.merged.theme)||console.warn(R.t("gemini.themeNotFound",{theme:e.merged.theme}))),!process.env.SANDBOX){let A=e.merged.autoConfigureMaxOldSpaceSize?yIa(c):[],y=c.getSandbox();if(y){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let E=OF(e.merged.selectedAuthType);if(E)throw new Error(E);await c.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(E){E instanceof Error&&E.message.includes("SERVER_OAUTH2_REQUIRED")?(console.error(R.t("gemini.serverOAuth2Required")||"\u68C0\u6D4B\u5230\u670D\u52A1\u5668\u73AF\u5883\uFF0C\u9700\u8981\u624B\u52A8\u8FDB\u884COAuth2\u8BA4\u8BC1\u3002\u8BF7\u5728\u975E\u6C99\u7BB1\u6A21\u5F0F\u4E0B\u8FD0\u884CCLI\u8FDB\u884C\u8BA4\u8BC1\u3002"),console.error("\u8BF7\u5C1D\u8BD5\u4E0D\u4F7F\u7528\u6C99\u7BB1\u6A21\u5F0F\u542F\u52A8\uFF0C\u6216\u8005\u5148\u5728\u672C\u5730\u73AF\u5883\u4E0B\u5B8C\u6210\u8BA4\u8BC1\u3002")):console.error(R.t("gemini.errorAuthenticating"),E),process.exit(1)}await d5i(y,A,c),process.exit(0)}else A.length>0&&(await _Ia(A),process.exit(0))}if(e.merged.selectedAuthType===Jt.LOGIN_WITH_IFLOW&&c.isBrowserLaunchSuppressed())try{await LU(e.merged.selectedAuthType,c)}catch(A){if(!(A instanceof Error&&A.message.includes("SERVER_OAUTH2_REQUIRED")))throw A}if(c.getExperimentalAcp())return c.getAcpPort()?await U5i(c,e,s,r,c.getAcpPort()):N5i(c,e,s,r);let d=c.getQuestion(),f=[...await f5i(),...await h5i(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume&&!n||process.stdin.isTTY&&d?.length===0){console.clear();let A=await GF();Txi(wxi(t),e);try{await Y1i()}catch(k){c.getDebugMode()&&console.warn("Failed to detect/enable Kitty protocol:",k)}if(ih())try{await c.setIdeModeAndSyncConnection(!0)}catch(k){console.error(R.t("gemini.failedToConnectToIdeServer"),k)}let E,v=async()=>{try{if(console.clear(),Txi(wxi(t),e),E)try{E.unmount(),await new Promise(P=>process.nextTick(P))}catch(P){console.error(R.t("gemini.errorDuringUnmount"),P)}let{executeSessionStartHooks:k}=await Promise.resolve().then(()=>(ak(),oL)),D=await k(c,"resume");E=fxe((0,LCe.jsx)(mdr.default.StrictMode,{children:(0,LCe.jsx)(bur,{instance:()=>E,config:c,settings:e,startupWarnings:f,version:A,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0,sessionStartContext:D})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:ycr(),maxFps:20})}catch(k){console.error(R.t("gemini.errorDuringResume"),k)}};process.on("SIGCONT",v),b4e(()=>{process.off("SIGCONT",v)});let b="startup";(r.continue||r.resume)&&(b="resume");let{executeSessionStartHooks:S}=await Promise.resolve().then(()=>(ak(),oL)),w=await S(c,b);E=fxe((0,LCe.jsx)(mdr.default.StrictMode,{children:(0,LCe.jsx)(bur,{instance:()=>E,config:c,settings:e,startupWarnings:f,version:A,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,sessionStartContext:w})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:ycr()}),e.merged.disableAutoUpdate||rct().then(k=>{cgi(k,e,c.getProjectRoot())}).catch(k=>{c.getDebugMode()&&console.error(R.t("gemini.updateCheckFailed"),k)}),b4e(()=>E.unmount());return}!process.stdin.isTTY&&!d&&(d+=await a5i()),d||(console.error(R.t("gemini.noInputProvidedViaStdin")),process.exit(1));let h=Math.random().toString(16).slice(2);see(c,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:d,prompt_id:h,auth_type:c.getContentGeneratorConfig()?.authType,prompt_length:d.length});let m=await bIa(c,s,e,r),g=r.outputFile||r.output_file;await y5i(m,d,h,g),process.exit(0)}function Txi(t,e){if(!e.merged.hideWindowTitle){let r=(process.env.CLI_TITLE||`iFlow - ${t}`).replace(/[\x00-\x1F\x7F]/g,"");process.stdout.write(`\x1B]2;${r}\x07`),process.on("exit",()=>{process.stdout.write("\x1B]2;\x07")})}}async function bIa(t,e,r,n){let o=t;if(t.getApprovalMode()!==yn.YOLO){let s=r.merged.excludeTools||[],a=[vc.Name,Qf.Name,$d.Name],c=[...new Set([...s,...a])],u={...r.merged,excludeTools:c},d={...n};o=await kW(u,e,t.getSessionId(),d),await o.initialize()}return await CIa(r.merged.selectedAuthType,o,r)}async function CIa(t,e,r){!t&&!process.env.IFLOW_API_KEY&&!UPe()&&(console.error(R.t("gemini.pleaseSetAuthMethod",{userSettingsPath:hW})),process.exit(1)),t||(UPe()?t=Jt.IFLOW:t=Jt.IFLOW);let n=OF(t);return n!=null&&(console.error(n),process.exit(1)),await e.refreshAuth(t,{apiKey:r.merged.apiKey,baseUrl:r.merged.baseUrl,modelName:e.getModel()}),e}Dxi().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
6613
6613
  /**
6614
6614
  * @license
6615
6615
  * Copyright 2025 Google LLC