From ce2f96280a788e7a703bedc69ccbb0fba7dc02b2 Mon Sep 17 00:00:00 2001 From: wgqqqqq Date: Tue, 3 Nov 2026 09:39:20 +0800 Subject: [PATCH 01/23] feat: integrate generative UI and Harmony surface --- .gitignore | 23 + Cargo.lock | 273 +- .../agent-runtime-services-design.md | 2 +- .../architecture/appearance-package-system.md | 5 +- .../generative-ui-architecture.md | 197 + .../generative-ui-openui-interaction-plan.md | 311 + docs/architecture/product-architecture.md | 11 +- docs/architecture/theme-token-optimization.md | 2 +- docs/interactive-capabilities/README.md | 16 +- .../capabilities.json | 979 +- .../capabilities/feature.canvas.md | 69 - .../capabilities/feature.generative-ui.md | 59 + .../capabilities/setting.tools.execution.md | 3 + .../technical/product-control-open-audit.json | 88 +- .../technical/tauri-command-map.json | 120 +- docs/plans/miniapp-agent-control-plan.md | 420 + package.json | 4 +- .../flow-chat-presentation/src/registry.ts | 4 - pnpm-lock.yaml | 299 +- research_intelligent_ui/findings_web.md | 14 + research_intelligent_ui/research_plan.md | 10 + scripts/audit-appearance-contracts.mjs | 9 +- .../cargo-dependency-boundaries.mjs | 3 - .../explicit-test-topology.mjs | 1 - .../core-boundaries/rules/feature-rules.mjs | 37 +- .../rules/source/forbidden-rules.mjs | 8 - .../rules/source/required-rules.mjs | 11 - scripts/core-boundaries/self-test.mjs | 8 - scripts/generate-canvas-sdk-contract.mjs | 93 - scripts/generate-genui-contract.mjs | 8 + .../generate-startup-appearance-bootstrap.mjs | 11 - scripts/interactive-capabilities.test.mjs | 2 +- scripts/test-genui-browser.mjs | 213 + scripts/theme-color-governance-baseline.json | 14 +- scripts/theme-css-var-contract.mjs | 17 - src/apps/desktop/Cargo.toml | 2 +- src/apps/desktop/src/api/canvas_api.rs | 341 - src/apps/desktop/src/api/generative_ui_api.rs | 598 + src/apps/desktop/src/api/mod.rs | 2 +- src/apps/desktop/src/lib.rs | 7 +- .../desktop/src/openbitfun_control_host.rs | 42 +- src/apps/mobile/harmonyos/AppScope/app.json5 | 2 +- .../resources/resfile/THIRD_PARTY_NOTICES.md | 80 + .../main/resources/resfile/ohos-build.json | 6 + .../resources/ext-host/extension-host.js | 21127 +++++++++++++++ .../resfile/resources/worker_host.js | 203 + .../src/providers/openai/codex_chatgpt.rs | 46 + src/crates/assembly/core/Cargo.toml | 11 +- .../builtin_skills/agent-eval-canvas/SKILL.md | 218 - .../create-agent/references/tool-catalog.md | 6 +- .../scripts/cinematic_recipe.py | 17 - .../references/appearance-registry.json | 3 +- .../references/renderer-contracts.md | 6 - .../scripts/openbitfun_appearance.py | 19 - .../core/builtin_skills/docs-canvas/SKILL.md | 54 - .../builtin_skills/openbitfun-canvas/SKILL.md | 108 - .../openbitfun-canvas/sdk/appearance.d.ts | 61 - .../sdk/callout-tone-icons.d.ts | 11 - .../openbitfun-canvas/sdk/canvas-tokens.d.ts | 96 - .../sdk/chart-primitives.d.ts | 272 - .../sdk/collapsible-section.d.ts | 67 - .../openbitfun-canvas/sdk/dag-layout.d.ts | 102 - .../openbitfun-canvas/sdk/diff-view.d.ts | 130 - .../sdk/form-primitives.d.ts | 195 - .../openbitfun-canvas/sdk/hooks.d.ts | 172 - .../openbitfun-canvas/sdk/index.d.ts | 61 - .../sdk/runtime-components.d.ts | 157 - .../sdk/sdk-contract.generated.json | 672 - .../openbitfun-canvas/sdk/swatch.d.ts | 40 - .../openbitfun-canvas/sdk/todo-list.d.ts | 49 - .../openbitfun-canvas/sdk/ui-primitives.d.ts | 526 - .../sdk/ui-primitives.test.d.ts | 2 - .../openbitfun-canvas/sdk/usage-bar.d.ts | 56 - .../builtin_skills/pr-review-canvas/SKILL.md | 106 - .../assembly/core/src/agentic/agents/mod.rs | 10 - .../src/agentic/coordination/coordinator.rs | 2 + .../src/agentic/deep_review/capabilities.rs | 1 + .../core/src/agentic/execution/AGENTS.md | 13 + .../execution/edit_constraint_guard/tests.rs | 1 + .../src/agentic/execution/execution_engine.rs | 51 +- .../agentic/execution/generative_ui_review.rs | 349 + .../core/src/agentic/execution/mod.rs | 2 + .../src/agentic/execution/round_executor.rs | 1 + .../src/agentic/tools/agent-tool-exposure.md | 6 +- .../src/agentic/tools/generative_ui_host.rs | 21 + .../implementations/agent_control_tool.rs | 1 + .../tools/implementations/agent_list_tool.rs | 1 + .../implementations/ask_user_question_tool.rs | 1 + .../tools/implementations/canvas_tools.rs | 1265 - .../tools/implementations/code_review_tool.rs | 1 + .../tools/implementations/control_hub_tool.rs | 1 + .../tools/implementations/cron_tool.rs | 2 + .../tools/implementations/delete_file_tool.rs | 1 + .../implementations/desktop_card_tool.rs | 1 + .../implementations/exec_command/command.rs | 3 + .../tools/implementations/file_read_tool.rs | 1 + .../tools/implementations/file_write_tool.rs | 1 + .../frontend_workbench_tool.rs | 1 + .../appearance_prompt_snapshots.json | 160 - .../implementations/generative_ui_tool.rs | 795 +- .../tools/implementations/get_time_tool.rs | 1 + .../tools/implementations/glob_tool.rs | 1 + .../tools/implementations/grep_tool.rs | 3 + .../implementations/list_workspaces_tool.rs | 1 + .../agentic/tools/implementations/ls_tool.rs | 1 + .../src/agentic/tools/implementations/mod.rs | 4 - .../openbitfun_control_tool.rs | 1 + .../tools/implementations/page_deploy_tool.rs | 1 + .../implementations/page_publish_tool.rs | 1 + .../implementations/session_control_tool.rs | 1 + .../implementations/session_message_tool.rs | 1 + .../tools/implementations/skill_tool.rs | 4 + .../tools/implementations/skills/builtin.rs | 19 - .../tools/implementations/skills/catalog.rs | 1 - .../tools/implementations/skills/policy.rs | 7 - .../tools/implementations/skills/resolver.rs | 22 - .../tools/implementations/task/execution.rs | 1 + .../tools/implementations/task/tests.rs | 4 + .../agentic/tools/implementations/web/mod.rs | 1 + .../src/agentic/tools/manifest_resolver.rs | 1 + .../agentic/tools/miniapp_context_runtime.rs | 1 + .../assembly/core/src/agentic/tools/mod.rs | 1 + .../agentic/tools/pipeline/state_manager.rs | 1 + .../agentic/tools/pipeline/tool_pipeline.rs | 1 + .../core/src/agentic/tools/pipeline/types.rs | 3 + .../core/src/agentic/tools/product_runtime.rs | 3 - .../agentic/tools/product_runtime/catalog.rs | 39 +- .../product_runtime/get_tool_spec_tool.rs | 1 + .../tools/product_runtime/materialization.rs | 12 - .../core/src/agentic/tools/registry.rs | 6 - .../tools/review_read_receipt_runtime.rs | 1 + .../src/agentic/tools/tool_context_runtime.rs | 59 +- .../src/agentic/tools/tool_result_storage.rs | 1 + .../assembly/core/src/external_tools.rs | 1 + .../assembly/core/src/service/canvas/mod.rs | 10 - .../config/mode_config_canonicalizer.rs | 19 - src/crates/assembly/core/src/service/mod.rs | 4 - .../core/src/service/snapshot/manager.rs | 1 + .../service/snapshot/workspace_io_tests.rs | 1 + .../assembly/product-capabilities/src/lib.rs | 21 - .../product_capabilities.rs | 8 - .../runtime_boundary.rs | 4 +- .../contracts/config-contracts/src/types.rs | 29 + src/crates/contracts/events/src/agentic.rs | 50 + .../contracts/product-domains/AGENTS.md | 7 + .../product-domains/src/canvas/mod.rs | 28 - .../product-domains/src/canvas/policy.rs | 265 - .../product-domains/src/canvas/ports.rs | 110 - .../product-domains/src/canvas/reference.rs | 97 - .../product-domains/src/canvas/runtime.rs | 34 - .../src/canvas/sdk_contract.generated.rs | 449 - .../product-domains/src/canvas/types.rs | 301 - .../generated/product-control-catalog.json | 1133 +- .../generated/remote-surface-registry.json | 88 +- .../product-domains/src/generative_ui.rs | 693 + .../src/generative_ui_protocol.rs | 103 + .../contracts/product-domains/src/lib.rs | 3 +- .../src/product_control_owner_registry.rs | 13 + .../src/remote_surface/capabilities.rs | 6 + .../src/remote_surface/table.rs | 7 +- .../tests/product_domain_contracts.rs | 2 - .../canvas_contracts.rs | 237 - .../src/session_event_journal.rs | 3 + .../agent-runtime/src/skills/catalog.rs | 18 - .../agent-runtime/src/skills/policy.rs | 46 +- .../skill_contracts.rs | 26 - src/crates/execution/agent-stream/src/lib.rs | 95 + .../agent-stream/src/tool_call_accumulator.rs | 418 +- .../execution/tool-provider-groups/Cargo.toml | 3 +- .../execution/tool-provider-groups/src/lib.rs | 25 - .../interfaces/acp/src/runtime/events.rs | 3 + .../services/services-integrations/AGENTS.md | 12 + .../services/services-integrations/Cargo.toml | 11 +- .../src/canvas/compiler/analysis.rs | 691 - .../src/canvas/compiler/diagnostics.rs | 46 - .../src/canvas/compiler/html.rs | 55 - .../src/canvas/compiler/mod.rs | 114 - .../src/canvas/compiler/oxc.rs | 113 - .../src/canvas/compiler/runtime_bootstrap.js | 1314 - .../src/canvas/compiler/runtime_style.css | 42 - .../src/canvas/compiler/sdk_contract.rs | 234 - .../src/canvas/compiler/tests.rs | 776 - .../services-integrations/src/canvas/mod.rs | 997 - .../src/generative_ui.rs | 525 + .../services/services-integrations/src/lib.rs | 6 +- .../src/remote_connect/session_records.rs | 3 +- src/shared/canvas/sdk-contract.json | 78 - src/shared/generative-ui/catalog.json | 22603 ++++++++++++++++ .../generative-ui/contract-fixtures.json | 101 + src/shared/generative-ui/examples.json | 89 + .../gallery/composition-programs.ts | 79 + src/shared/generative-ui/gallery/demo-data.ts | 208 + src/shared/generative-ui/gallery/index.ts | 81 + src/shared/generative-ui/gallery/programs.ts | 256 + .../generative-ui/gallery/prompt-options.ts | 100 + .../generative-ui/gallery/tool-programs.ts | 559 + src/shared/generative-ui/library.json | 8433 ++++++ src/shared/generative-ui/library.mjs | 202 + src/shared/generative-ui/openui-spec.json | 4063 +++ .../generative-ui/openui-system-prompt.txt | 282 + .../interactive-capabilities/catalog.json | 330 +- src/web-ui/package.json | 4 + .../public/fonts/hm-symbol/HMSymbolVF.ttf | Bin 0 -> 3183928 bytes src/web-ui/public/fonts/hm-symbol/LICENSE.txt | 34 + .../components/panels/base/FlexiblePanel.tsx | 194 +- .../src/app/components/panels/base/utils.ts | 8 - .../generated/interactive-capabilities.json | 979 +- .../openBitFunControlBridge.test.ts | 3 +- .../global-search/openBitFunControlBridge.ts | 7 +- src/web-ui/src/app/layout/AppLayout.tsx | 4 + .../agents/components/toolGroups.test.ts | 15 +- .../scenes/agents/components/toolGroups.ts | 6 +- .../pages/ai/ExecutionSettingsPage.tsx | 2 + .../ai/GenUILibrarySection.appearance.ts | 5 + .../pages/ai/GenUILibrarySection.scss | 322 + .../pages/ai/GenUILibrarySection.test.tsx | 88 + .../settings/pages/ai/GenUILibrarySection.tsx | 119 + .../app/scenes/settings/settingsRegistry.ts | 3 +- .../startupPerformanceContract.test.ts | 3 +- .../app/workbench/workbenchContent.test.ts | 42 +- .../components/FlowToolCard.test.tsx | 36 + .../src/flow_chat/components/FlowToolCard.tsx | 16 +- .../GenerativeWidgetInline.appearance.ts | 13 + .../components/GenerativeWidgetInline.scss | 10 + .../GenerativeWidgetInline.test.tsx | 124 + .../components/GenerativeWidgetInline.tsx | 73 + .../modern/ModelRoundItem.appearance.ts | 1 - .../components/modern/ModelRoundItem.tsx | 28 +- .../components/modern/VirtualItemRenderer.tsx | 1 - .../components/modern/flowChatFocusTarget.ts | 2 +- .../components/modern/flowChatRhythm.ts | 2 +- .../components/modern/modelRoundItemMemo.ts | 6 +- .../modern/virtualItemHeightEstimators.ts | 3 +- .../src/flow_chat/grouping/groupProjection.ts | 4 +- .../src/flow_chat/grouping/roundGroups.ts | 3 +- .../hooks/useGenerativeWidgetProjection.ts | 47 + .../services/AgenticEventListener.test.ts | 6 +- .../services/AgenticEventListener.ts | 2 +- .../src/flow_chat/services/EventBatcher.ts | 17 +- .../services/FlowChatManager.test.ts | 1 + .../src/flow_chat/services/FlowChatManager.ts | 4 +- .../PersistenceModule.test.ts | 16 + .../flow-chat-manager/PersistenceModule.ts | 41 +- .../flow-chat-manager/ToolEventModule.test.ts | 93 + .../flow-chat-manager/ToolEventModule.ts | 113 + .../services/flow-chat-manager/index.ts | 1 + .../store/modernFlowChatStore.test.ts | 36 +- .../flow_chat/store/modernFlowChatStore.ts | 12 - src/web-ui/src/flow_chat/timeline/document.ts | 10 +- .../tool-cards/CanvasToolCard.appearance.ts | 15 - .../flow_chat/tool-cards/CanvasToolCard.scss | 59 - .../tool-cards/CanvasToolCard.test.tsx | 177 - .../flow_chat/tool-cards/CanvasToolCard.tsx | 305 - .../GenerativeWidgetToolCard.appearance.ts | 13 - .../tool-cards/GenerativeWidgetToolCard.scss | 84 - .../GenerativeWidgetToolCard.test.tsx | 182 - .../tool-cards/GenerativeWidgetToolCard.tsx | 411 - .../src/flow_chat/tool-cards/index.test.ts | 19 +- src/web-ui/src/flow_chat/tool-cards/index.ts | 21 +- .../tool-cards/toolCapsuleModel.test.ts | 2 +- .../flow_chat/tool-cards/toolCardMetadata.ts | 45 - .../flow_chat/types/flow-chat-projection.ts | 3 +- src/web-ui/src/flow_chat/types/flow-chat.ts | 21 + .../utils/canvasArtifactPresentation.ts | 55 - .../utils/generativeWidgetProjection.test.ts | 257 + .../utils/generativeWidgetProjection.ts | 295 + .../api/adapters/peer-device-adapter.test.ts | 32 + .../api/adapters/peer-device-adapter.ts | 18 + .../api/generated/productControl.ts | 10 +- .../api/generated/remoteSurface.ts | 4 +- .../api/service-api/CanvasAPI.ts | 113 - .../api/service-api/MCPAPI.test.ts | 9 + .../infrastructure/api/service-api/MCPAPI.ts | 6 +- .../adapters/CanvasAppearanceAdapter.ts | 51 - .../builtins/appearancePromptSnapshots.ts | 62 - .../builtins/buildBuiltinAppearance.ts | 17 - .../builtins/composeAppearancePackage.test.ts | 1 - .../builtins/composeAppearancePackage.ts | 4 - .../startupAppearanceBootstrap.test.ts | 25 - .../src/infrastructure/appearance/index.ts | 2 - .../registry/defaultAppearanceRegistry.ts | 15 +- .../appearance/runtime/AppearanceRuntime.ts | 2 - .../infrastructure/appearance/types/index.ts | 19 +- .../src/infrastructure/config/types/index.ts | 1 + .../CodeChangeColorIntegration.test.ts | 3 - .../markdown/MarkdownRenderer.test.tsx | 54 - .../markdown/MarkdownRenderer.tsx | 48 +- .../markdown/ThinkingMarkdown.tsx | 2 +- .../src/infrastructure/markdown/appearance.ts | 2 +- .../peer-device/PeerConnectionManager.ts | 10 + src/web-ui/src/locales/en-US/flow-chat.json | 55 +- .../src/locales/en-US/settings/runtime.json | 58 +- src/web-ui/src/locales/zh-CN/flow-chat.json | 55 +- .../src/locales/zh-CN/settings/runtime.json | 58 +- src/web-ui/src/locales/zh-TW/flow-chat.json | 55 +- .../src/locales/zh-TW/settings/runtime.json | 58 +- src/web-ui/src/main.tsx | 5 +- .../services/ide-control/PanelController.ts | 14 +- .../services/workbenchContentService.ts | 26 +- src/web-ui/src/shared/types/panelContent.ts | 9 +- .../utils/canvasArtifactReference.test.ts | 20 - .../shared/utils/canvasArtifactReference.ts | 29 - src/web-ui/src/shared/utils/tabUtils.ts | 62 +- .../utils/sanitizeDetailsSummaryHtml.test.ts | 2 +- .../utils/sanitizeDetailsSummaryHtml.ts | 2 +- src/web-ui/src/tools/generative-ui/AGENTS.md | 101 + .../tools/generative-ui/GenUIApplication.scss | 17 + .../tools/generative-ui/GenUIApplication.tsx | 169 + .../src/tools/generative-ui/GenUIGallery.scss | 202 + .../src/tools/generative-ui/GenUIGallery.tsx | 84 + .../tools/generative-ui/GenUIHostSurface.tsx | 25 + .../generative-ui/GenUIHtmlDocument.test.tsx | 86 + .../tools/generative-ui/GenUIHtmlDocument.tsx | 510 + .../generative-ui/GenUISourceDocument.tsx | 90 + .../generative-ui/GenUIVerificationPanel.tsx | 34 + .../src/tools/generative-ui/adapters/index.ts | 75 + .../src/tools/generative-ui/appearance.ts | 22 + .../generative-ui/components/base-path.ts | 11 + .../components/bitfunComponents.tsx | 268 + .../generative-ui/components/components.scss | 95 + .../src/tools/generative-ui/components/dom.ts | 4 + .../components/harmonyComponents.tsx | 113 + .../components/harmonyStyleContract.test.ts | 29 + .../generative-ui/components/map/MapView.tsx | 459 + .../generative-ui/components/map/basemap.ts | 95 + .../components/map/mapUtils.test.ts | 20 + .../generative-ui/components/map/mapUtils.ts | 93 + .../generative-ui/components/oiComponents.tsx | 404 + .../components/openui/actions.ts | 40 + .../generative-ui/components/openui/chart.tsx | 318 + .../components/openui/components.css | 385 + .../components/openui/controls.tsx | 508 + .../generative-ui/components/openui/extra.tsx | 269 + .../functions/__tests__/dates-data.test.ts | 175 + .../openui/functions/__tests__/lists.test.ts | 153 + .../functions/__tests__/numbers-text.test.ts | 178 + .../functions/__tests__/patterns.test.ts | 60 + .../openui/functions/__tests__/run.ts | 54 + .../components/openui/functions/colors.ts | 26 + .../components/openui/functions/data.ts | 236 + .../components/openui/functions/dates.ts | 142 + .../components/openui/functions/index.ts | 14 + .../components/openui/functions/lists.ts | 212 + .../components/openui/functions/numbers.ts | 128 + .../components/openui/functions/shared.ts | 82 + .../components/openui/functions/text.ts | 165 + .../generative-ui/components/openui/glyph.tsx | 32 + .../components/openui/html-view.tsx | 84 + .../components/openui/layout.tsx | 169 + .../components/openui/lucide-dynamic.d.ts | 6 + .../components/openui/map/basemap.ts | 53 + .../components/openui/map/map-utils.ts | 65 + .../components/openui/map/map.css | 46 + .../components/openui/map/map.tsx | 298 + .../components/openui/map/use-dialog.ts | 28 + .../components/openui/map/use-street-route.ts | 40 + .../components/openui/markdown.tsx | 171 + .../generative-ui/components/openui/media.tsx | 180 + .../components/openui/runtime.ts | 9 + .../generative-ui/components/openui/scheme.ts | 20 + .../generative-ui/components/openui/style.ts | 129 + .../generative-ui/components/openui/svg.tsx | 151 + .../generative-ui/components/openui/table.tsx | 55 + .../generative-ui/components/openui/text.tsx | 188 + .../generative-ui/components/openui/theme.css | 128 + .../components/openuiLibrary.tsx | 54 + .../components/vendor/HARMONY-LICENSE.txt | 21 + .../components/vendor/OPENUI-LICENSE.txt | 21 + .../generative-ui/components/vendor/README.md | 40 + .../components/vendor/harmonyPlot.ts | 540 + .../components/vendor/harmonyStyles.ts | 732 + .../components/vendor/hm-icons.ts | 257 + .../generative-ui/disableOpenUIDevtools.ts | 7 + .../generative-ui/galleryRuntime.test.tsx | 66 + .../src/tools/generative-ui/galleryRuntime.ts | 38 + .../src/tools/generative-ui/genUIActions.ts | 47 + .../genUIAsyncCapabilities.test.ts | 147 + .../generative-ui/genUIAsyncCapabilities.ts | 362 + .../generative-ui/genUIAsyncSource.test.ts | 14 + .../tools/generative-ui/genUIAsyncSource.ts | 19 + .../genUIComponentCatalog.test.tsx | 71 + .../tools/generative-ui/genUIContract.test.ts | 77 + .../src/tools/generative-ui/genUIContract.ts | 234 + .../generative-ui/genUIDelivery.test.tsx | 64 + .../src/tools/generative-ui/genUIDelivery.tsx | 170 + .../generative-ui/genUIDeliveryBridge.ts | 24 + .../tools/generative-ui/genUIFormatting.ts | 4 + .../generative-ui/genUIIncident.test.tsx | 115 + .../genUIInteractionState.test.ts | 31 + .../generative-ui/genUIInteractionState.ts | 77 + .../tools/generative-ui/genUILayout.test.ts | 44 + .../src/tools/generative-ui/genUILayout.ts | 87 + .../src/tools/generative-ui/genUILibrary.ts | 86 + .../generative-ui/genUILibraryPreview.ts | 42 + .../genUILibraryRegistry.test.ts | 36 + .../generative-ui/genUILibraryRegistry.ts | 39 + .../generative-ui/genUIMcpProvider.test.ts | 89 + .../tools/generative-ui/genUIMcpProvider.ts | 145 + .../generative-ui/genUINativeProvider.test.ts | 50 + .../generative-ui/genUINativeProvider.ts | 65 + .../tools/generative-ui/genUIOpenUI.test.tsx | 505 + .../src/tools/generative-ui/genUIOpenUI.tsx | 423 + .../src/tools/generative-ui/genUIOwner.ts | 14 + .../tools/generative-ui/genUIPrimitives.ts | 37 + .../src/tools/generative-ui/genUIProduct.ts | 29 + .../tools/generative-ui/genUIProtocol.test.ts | 48 + .../src/tools/generative-ui/genUIProtocol.ts | 44 + .../tools/generative-ui/genUIRepair.test.ts | 37 + .../src/tools/generative-ui/genUIRepair.ts | 24 + .../src/tools/generative-ui/genUIState.ts | 42 + .../src/tools/generative-ui/genUIStream.ts | 29 + .../src/tools/generative-ui/genUITypes.ts | 58 + .../tools/generative-ui/genUIVerification.ts | 13 + .../generative-ui/useGenUIOwner.test.tsx | 68 + .../src/tools/generative-ui/useGenUIOwner.ts | 54 + .../GenerativeWidgetFrame.scss | 28 - .../GenerativeWidgetFrame.test.tsx | 104 - .../GenerativeWidgetFrame.tsx | 1065 - .../GenerativeWidgetPanel.scss | 139 +- .../GenerativeWidgetPanel.test.tsx | 61 + .../GenerativeWidgetPanel.tsx | 305 +- .../GenerativeWidgetStaticRenderer.tsx | 104 - .../src/tools/generative-widget/appearance.ts | 17 +- .../useGenerativeWidgetPromptMenu.ts | 112 - .../widgetHtmlExport.test.ts | 95 - .../generative-widget/widgetHtmlExport.ts | 74 - .../generative-widget/widgetInteraction.ts | 188 - .../openbitfun-canvas/CanvasPreflight.tsx | 164 - .../OpenBitFunCanvasPanel.scss | 196 - .../OpenBitFunCanvasPanel.test.tsx | 234 - .../OpenBitFunCanvasPanel.tsx | 1085 - .../src/tools/openbitfun-canvas/appearance.ts | 57 - .../canvasHtmlExportService.test.ts | 11 - .../canvasHtmlExportService.ts | 77 - .../openbitfun-canvas/reactRuntime.test.ts | 350 - .../tools/openbitfun-canvas/reactRuntime.ts | 155 - .../runtime/CanvasRuntimeApp.test.tsx | 107 - .../runtime/CanvasRuntimeApp.tsx | 160 - .../runtime/CanvasRuntimeComponents.tsx | 85 - .../runtime/canvasRuntimeInstaller.test.ts | 86 - .../runtime/canvasRuntimeInstaller.ts | 596 - .../tools/openbitfun-canvas/runtime/entry.tsx | 31 - .../runtime/sdk/adapters.test.ts | 85 - .../runtime/sdk/adapters.test.tsx | 63 - .../runtime/sdk/adapters.tsx | 244 - .../runtime/sdk/charts.test.tsx | 45 - .../openbitfun-canvas/runtime/sdk/charts.tsx | 320 - .../runtime/sdk/contract.generated.ts | 677 - .../runtime/sdk/contract.test.ts | 9 - .../runtime/sdk/controls.test.tsx | 62 - .../runtime/sdk/controls.tsx | 211 - .../runtime/sdk/data-display.test.tsx | 177 - .../runtime/sdk/data-display.tsx | 904 - .../runtime/sdk/diagramLayout.ts | 208 - .../runtime/sdk/diagrams.test.tsx | 157 - .../runtime/sdk/diagrams.tsx | 252 - .../runtime/sdk/diffLines.ts | 22 - .../runtime/sdk/hooks.test.ts | 40 - .../openbitfun-canvas/runtime/sdk/hooks.ts | 46 - .../openbitfun-canvas/runtime/sdk/index.ts | 156 - .../openbitfun-canvas/runtime/sdk/layout.tsx | 158 - .../runtime/sdk/runtimeValidation.ts | 23 - .../openbitfun-canvas/runtime/sdk/style.ts | 162 - .../openbitfun-canvas/runtime/sdk/types.ts | 557 - .../runtime/sdk/typography.tsx | 166 - .../runtime/styles/canvas-runtime.scss | 387 - src/web-ui/src/vite-env.d.ts | 9 - src/web-ui/tests/e2e/generative-ui.html | 5 + src/web-ui/tests/e2e/generative-ui.tsx | 89 + src/web-ui/tests/e2e/genuiStreaming.tsx | 57 + .../vite.config.canvas-runtime-plugin.ts | 117 - src/web-ui/vite.config.ts | 2 - 472 files changed, 80888 insertions(+), 27770 deletions(-) create mode 100644 docs/architecture/generative-ui-architecture.md create mode 100644 docs/architecture/generative-ui-openui-interaction-plan.md delete mode 100644 docs/interactive-capabilities/capabilities/feature.canvas.md create mode 100644 docs/interactive-capabilities/capabilities/feature.generative-ui.md create mode 100644 docs/plans/miniapp-agent-control-plan.md create mode 100644 research_intelligent_ui/findings_web.md create mode 100644 research_intelligent_ui/research_plan.md delete mode 100644 scripts/generate-canvas-sdk-contract.mjs create mode 100644 scripts/generate-genui-contract.mjs create mode 100644 scripts/test-genui-browser.mjs delete mode 100644 src/apps/desktop/src/api/canvas_api.rs create mode 100644 src/apps/desktop/src/api/generative_ui_api.rs create mode 100644 src/apps/ohos/entry/src/main/resources/resfile/THIRD_PARTY_NOTICES.md create mode 100644 src/apps/ohos/entry/src/main/resources/resfile/ohos-build.json create mode 100644 src/apps/ohos/entry/src/main/resources/resfile/resources/ext-host/extension-host.js create mode 100644 src/apps/ohos/entry/src/main/resources/resfile/resources/worker_host.js delete mode 100644 src/crates/assembly/core/builtin_skills/agent-eval-canvas/SKILL.md delete mode 100644 src/crates/assembly/core/builtin_skills/docs-canvas/SKILL.md delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/SKILL.md delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/appearance.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/callout-tone-icons.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/canvas-tokens.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/chart-primitives.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/collapsible-section.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/dag-layout.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/diff-view.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/form-primitives.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/hooks.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/index.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/runtime-components.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/sdk-contract.generated.json delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/swatch.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/todo-list.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/ui-primitives.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/ui-primitives.test.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/usage-bar.d.ts delete mode 100644 src/crates/assembly/core/builtin_skills/pr-review-canvas/SKILL.md create mode 100644 src/crates/assembly/core/src/agentic/execution/generative_ui_review.rs create mode 100644 src/crates/assembly/core/src/agentic/tools/generative_ui_host.rs delete mode 100644 src/crates/assembly/core/src/agentic/tools/implementations/canvas_tools.rs delete mode 100644 src/crates/assembly/core/src/agentic/tools/implementations/generated/appearance_prompt_snapshots.json delete mode 100644 src/crates/assembly/core/src/service/canvas/mod.rs delete mode 100644 src/crates/contracts/product-domains/src/canvas/mod.rs delete mode 100644 src/crates/contracts/product-domains/src/canvas/policy.rs delete mode 100644 src/crates/contracts/product-domains/src/canvas/ports.rs delete mode 100644 src/crates/contracts/product-domains/src/canvas/reference.rs delete mode 100644 src/crates/contracts/product-domains/src/canvas/runtime.rs delete mode 100644 src/crates/contracts/product-domains/src/canvas/sdk_contract.generated.rs delete mode 100644 src/crates/contracts/product-domains/src/canvas/types.rs create mode 100644 src/crates/contracts/product-domains/src/generative_ui.rs create mode 100644 src/crates/contracts/product-domains/src/generative_ui_protocol.rs delete mode 100644 src/crates/contracts/product-domains/tests/product_domain_contracts/canvas_contracts.rs delete mode 100644 src/crates/services/services-integrations/src/canvas/compiler/analysis.rs delete mode 100644 src/crates/services/services-integrations/src/canvas/compiler/diagnostics.rs delete mode 100644 src/crates/services/services-integrations/src/canvas/compiler/html.rs delete mode 100644 src/crates/services/services-integrations/src/canvas/compiler/mod.rs delete mode 100644 src/crates/services/services-integrations/src/canvas/compiler/oxc.rs delete mode 100644 src/crates/services/services-integrations/src/canvas/compiler/runtime_bootstrap.js delete mode 100644 src/crates/services/services-integrations/src/canvas/compiler/runtime_style.css delete mode 100644 src/crates/services/services-integrations/src/canvas/compiler/sdk_contract.rs delete mode 100644 src/crates/services/services-integrations/src/canvas/compiler/tests.rs delete mode 100644 src/crates/services/services-integrations/src/canvas/mod.rs create mode 100644 src/crates/services/services-integrations/src/generative_ui.rs delete mode 100644 src/shared/canvas/sdk-contract.json create mode 100644 src/shared/generative-ui/catalog.json create mode 100644 src/shared/generative-ui/contract-fixtures.json create mode 100644 src/shared/generative-ui/examples.json create mode 100644 src/shared/generative-ui/gallery/composition-programs.ts create mode 100644 src/shared/generative-ui/gallery/demo-data.ts create mode 100644 src/shared/generative-ui/gallery/index.ts create mode 100644 src/shared/generative-ui/gallery/programs.ts create mode 100644 src/shared/generative-ui/gallery/prompt-options.ts create mode 100644 src/shared/generative-ui/gallery/tool-programs.ts create mode 100644 src/shared/generative-ui/library.json create mode 100644 src/shared/generative-ui/library.mjs create mode 100644 src/shared/generative-ui/openui-spec.json create mode 100644 src/shared/generative-ui/openui-system-prompt.txt create mode 100644 src/web-ui/public/fonts/hm-symbol/HMSymbolVF.ttf create mode 100644 src/web-ui/public/fonts/hm-symbol/LICENSE.txt create mode 100644 src/web-ui/src/app/scenes/settings/pages/ai/GenUILibrarySection.appearance.ts create mode 100644 src/web-ui/src/app/scenes/settings/pages/ai/GenUILibrarySection.scss create mode 100644 src/web-ui/src/app/scenes/settings/pages/ai/GenUILibrarySection.test.tsx create mode 100644 src/web-ui/src/app/scenes/settings/pages/ai/GenUILibrarySection.tsx create mode 100644 src/web-ui/src/flow_chat/components/GenerativeWidgetInline.appearance.ts create mode 100644 src/web-ui/src/flow_chat/components/GenerativeWidgetInline.scss create mode 100644 src/web-ui/src/flow_chat/components/GenerativeWidgetInline.test.tsx create mode 100644 src/web-ui/src/flow_chat/components/GenerativeWidgetInline.tsx create mode 100644 src/web-ui/src/flow_chat/hooks/useGenerativeWidgetProjection.ts delete mode 100644 src/web-ui/src/flow_chat/tool-cards/CanvasToolCard.appearance.ts delete mode 100644 src/web-ui/src/flow_chat/tool-cards/CanvasToolCard.scss delete mode 100644 src/web-ui/src/flow_chat/tool-cards/CanvasToolCard.test.tsx delete mode 100644 src/web-ui/src/flow_chat/tool-cards/CanvasToolCard.tsx delete mode 100644 src/web-ui/src/flow_chat/tool-cards/GenerativeWidgetToolCard.appearance.ts delete mode 100644 src/web-ui/src/flow_chat/tool-cards/GenerativeWidgetToolCard.scss delete mode 100644 src/web-ui/src/flow_chat/tool-cards/GenerativeWidgetToolCard.test.tsx delete mode 100644 src/web-ui/src/flow_chat/tool-cards/GenerativeWidgetToolCard.tsx delete mode 100644 src/web-ui/src/flow_chat/utils/canvasArtifactPresentation.ts create mode 100644 src/web-ui/src/flow_chat/utils/generativeWidgetProjection.test.ts create mode 100644 src/web-ui/src/flow_chat/utils/generativeWidgetProjection.ts delete mode 100644 src/web-ui/src/infrastructure/api/service-api/CanvasAPI.ts delete mode 100644 src/web-ui/src/infrastructure/appearance/adapters/CanvasAppearanceAdapter.ts delete mode 100644 src/web-ui/src/infrastructure/appearance/builtins/appearancePromptSnapshots.ts delete mode 100644 src/web-ui/src/shared/utils/canvasArtifactReference.test.ts delete mode 100644 src/web-ui/src/shared/utils/canvasArtifactReference.ts create mode 100644 src/web-ui/src/tools/generative-ui/AGENTS.md create mode 100644 src/web-ui/src/tools/generative-ui/GenUIApplication.scss create mode 100644 src/web-ui/src/tools/generative-ui/GenUIApplication.tsx create mode 100644 src/web-ui/src/tools/generative-ui/GenUIGallery.scss create mode 100644 src/web-ui/src/tools/generative-ui/GenUIGallery.tsx create mode 100644 src/web-ui/src/tools/generative-ui/GenUIHostSurface.tsx create mode 100644 src/web-ui/src/tools/generative-ui/GenUIHtmlDocument.test.tsx create mode 100644 src/web-ui/src/tools/generative-ui/GenUIHtmlDocument.tsx create mode 100644 src/web-ui/src/tools/generative-ui/GenUISourceDocument.tsx create mode 100644 src/web-ui/src/tools/generative-ui/GenUIVerificationPanel.tsx create mode 100644 src/web-ui/src/tools/generative-ui/adapters/index.ts create mode 100644 src/web-ui/src/tools/generative-ui/appearance.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/base-path.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/bitfunComponents.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/components.scss create mode 100644 src/web-ui/src/tools/generative-ui/components/dom.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/harmonyComponents.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/harmonyStyleContract.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/map/MapView.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/map/basemap.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/map/mapUtils.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/map/mapUtils.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/oiComponents.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/actions.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/chart.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/components.css create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/controls.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/extra.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/functions/__tests__/dates-data.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/functions/__tests__/lists.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/functions/__tests__/numbers-text.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/functions/__tests__/patterns.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/functions/__tests__/run.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/functions/colors.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/functions/data.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/functions/dates.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/functions/index.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/functions/lists.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/functions/numbers.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/functions/shared.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/functions/text.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/glyph.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/html-view.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/layout.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/lucide-dynamic.d.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/map/basemap.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/map/map-utils.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/map/map.css create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/map/map.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/map/use-dialog.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/map/use-street-route.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/markdown.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/media.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/runtime.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/scheme.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/style.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/svg.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/table.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/text.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/openui/theme.css create mode 100644 src/web-ui/src/tools/generative-ui/components/openuiLibrary.tsx create mode 100644 src/web-ui/src/tools/generative-ui/components/vendor/HARMONY-LICENSE.txt create mode 100644 src/web-ui/src/tools/generative-ui/components/vendor/OPENUI-LICENSE.txt create mode 100644 src/web-ui/src/tools/generative-ui/components/vendor/README.md create mode 100644 src/web-ui/src/tools/generative-ui/components/vendor/harmonyPlot.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/vendor/harmonyStyles.ts create mode 100644 src/web-ui/src/tools/generative-ui/components/vendor/hm-icons.ts create mode 100644 src/web-ui/src/tools/generative-ui/disableOpenUIDevtools.ts create mode 100644 src/web-ui/src/tools/generative-ui/galleryRuntime.test.tsx create mode 100644 src/web-ui/src/tools/generative-ui/galleryRuntime.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIActions.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIAsyncCapabilities.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIAsyncCapabilities.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIAsyncSource.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIAsyncSource.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIComponentCatalog.test.tsx create mode 100644 src/web-ui/src/tools/generative-ui/genUIContract.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIContract.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIDelivery.test.tsx create mode 100644 src/web-ui/src/tools/generative-ui/genUIDelivery.tsx create mode 100644 src/web-ui/src/tools/generative-ui/genUIDeliveryBridge.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIFormatting.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIIncident.test.tsx create mode 100644 src/web-ui/src/tools/generative-ui/genUIInteractionState.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIInteractionState.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUILayout.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUILayout.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUILibrary.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUILibraryPreview.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUILibraryRegistry.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUILibraryRegistry.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIMcpProvider.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIMcpProvider.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUINativeProvider.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUINativeProvider.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIOpenUI.test.tsx create mode 100644 src/web-ui/src/tools/generative-ui/genUIOpenUI.tsx create mode 100644 src/web-ui/src/tools/generative-ui/genUIOwner.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIPrimitives.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIProduct.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIProtocol.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIProtocol.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIRepair.test.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIRepair.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIState.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIStream.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUITypes.ts create mode 100644 src/web-ui/src/tools/generative-ui/genUIVerification.ts create mode 100644 src/web-ui/src/tools/generative-ui/useGenUIOwner.test.tsx create mode 100644 src/web-ui/src/tools/generative-ui/useGenUIOwner.ts delete mode 100644 src/web-ui/src/tools/generative-widget/GenerativeWidgetFrame.scss delete mode 100644 src/web-ui/src/tools/generative-widget/GenerativeWidgetFrame.test.tsx delete mode 100644 src/web-ui/src/tools/generative-widget/GenerativeWidgetFrame.tsx create mode 100644 src/web-ui/src/tools/generative-widget/GenerativeWidgetPanel.test.tsx delete mode 100644 src/web-ui/src/tools/generative-widget/GenerativeWidgetStaticRenderer.tsx delete mode 100644 src/web-ui/src/tools/generative-widget/useGenerativeWidgetPromptMenu.ts delete mode 100644 src/web-ui/src/tools/generative-widget/widgetHtmlExport.test.ts delete mode 100644 src/web-ui/src/tools/generative-widget/widgetHtmlExport.ts delete mode 100644 src/web-ui/src/tools/generative-widget/widgetInteraction.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/CanvasPreflight.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/OpenBitFunCanvasPanel.scss delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/OpenBitFunCanvasPanel.test.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/OpenBitFunCanvasPanel.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/appearance.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/canvasHtmlExportService.test.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/canvasHtmlExportService.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/reactRuntime.test.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/reactRuntime.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/CanvasRuntimeApp.test.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/CanvasRuntimeApp.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/CanvasRuntimeComponents.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/canvasRuntimeInstaller.test.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/canvasRuntimeInstaller.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/entry.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/adapters.test.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/adapters.test.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/adapters.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/charts.test.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/charts.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/contract.generated.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/contract.test.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/controls.test.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/controls.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/data-display.test.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/data-display.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/diagramLayout.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/diagrams.test.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/diagrams.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/diffLines.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/hooks.test.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/hooks.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/index.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/layout.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/runtimeValidation.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/style.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/types.ts delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/typography.tsx delete mode 100644 src/web-ui/src/tools/openbitfun-canvas/runtime/styles/canvas-runtime.scss create mode 100644 src/web-ui/tests/e2e/generative-ui.html create mode 100644 src/web-ui/tests/e2e/generative-ui.tsx create mode 100644 src/web-ui/tests/e2e/genuiStreaming.tsx delete mode 100644 src/web-ui/vite.config.canvas-runtime-plugin.ts diff --git a/.gitignore b/.gitignore index 498293339a..573d3ef1c2 100644 --- a/.gitignore +++ b/.gitignore @@ -130,6 +130,29 @@ src/apps/mobile/android/.kotlin/ /resources/flashgrep/flashgrep-* /resources/flashgrep/*.download-* +# Local HarmonyOS PC scaffold build output and signing material under +# src/apps/ohos. Written per-directory for the same reason as the Gradle block +# above: a bare `.hvigor/` or `build/` would hide checked-in files elsewhere. +# The hvigor-generated frontend copy under entry/src/main/resources/resfile +# already matches the repo-wide `**/dist` rule. +/src/apps/ohos/.hvigor/ +/src/apps/ohos/**/.hvigor/ +/src/apps/ohos/oh_modules/ +/src/apps/ohos/**/oh_modules/ +/src/apps/ohos/*/build/ +/src/apps/ohos/**/build/ +/src/apps/ohos/*/libs/ +# hvigor writes a BuildProfile.ets next to each module during the build. +/src/apps/ohos/*/BuildProfile.ets +# Same policy as src/apps/mobile/harmonyos/.gitignore: signing credentials and +# installable artifacts never leave the machine. +/src/apps/ohos/signing.local.json* +/src/apps/ohos/*.cer +/src/apps/ohos/*.p12 +/src/apps/ohos/*.p7b +/src/apps/ohos/*.hap +/src/apps/ohos/*.app + # Local generated workspace output. /output/ diff --git a/Cargo.lock b/Cargo.lock index dbcaed04a5..a71dc8b581 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -622,16 +622,6 @@ version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" -[[package]] -name = "base64-simd" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339abbe78e73178762e23bea9dfd08e697eb3f3301cd4be981c0f78ba5859195" -dependencies = [ - "outref", - "vsimd", -] - [[package]] name = "base64ct" version = "1.8.3" @@ -1160,15 +1150,6 @@ dependencies = [ "error-code", ] -[[package]] -name = "cobs" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" -dependencies = [ - "thiserror 2.0.19", -] - [[package]] name = "color_quant" version = "1.1.0" @@ -2269,18 +2250,6 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" -[[package]] -name = "embedded-io" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" - -[[package]] -name = "embedded-io" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" - [[package]] name = "encoding_rs" version = "0.8.35" @@ -2511,7 +2480,7 @@ dependencies = [ "bit_field", "half", "lebe", - "miniz_oxide 0.8.9", + "miniz_oxide", "num-complex", "pulp", "rayon-core", @@ -2638,7 +2607,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" dependencies = [ "crc32fast", - "miniz_oxide 0.8.9", + "miniz_oxide", "zlib-rs", ] @@ -3509,12 +3478,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "hmac-sha1-compact" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0b3ba31f6dc772cc8221ce81dbbbd64fa1e668255a6737d95eeace59b5a8823" - [[package]] name = "home" version = "0.5.12" @@ -4120,15 +4083,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.18" @@ -4315,12 +4269,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "json-escape-simd" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22a2041e3874a055a4eb03ea2395aaccdefa84ce75b31d542d72a741c3c6ad3" - [[package]] name = "json-patch" version = "3.0.1" @@ -4984,15 +4932,6 @@ dependencies = [ "simd-adler32", ] -[[package]] -name = "miniz_oxide" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" -dependencies = [ - "adler2", -] - [[package]] name = "mio" version = "1.2.2" @@ -6781,7 +6720,6 @@ dependencies = [ "openbitfun-product-domains", "openbitfun-runtime-ports", "openbitfun-services-core", - "oxc", "pulldown-cmark", "qrcode", "rand 0.8.7", @@ -6990,12 +6928,6 @@ dependencies = [ "thiserror 2.0.19", ] -[[package]] -name = "outref" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e" - [[package]] name = "owo-colors" version = "4.3.0" @@ -7011,27 +6943,10 @@ dependencies = [ "oxc_allocator", "oxc_ast", "oxc_ast_visit", - "oxc_codegen", "oxc_diagnostics", "oxc_parser", - "oxc_semantic", "oxc_span", "oxc_syntax", - "oxc_transformer", - "oxc_transformer_plugins", -] - -[[package]] -name = "oxc-browserslist" -version = "3.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6967692b4c51de292573c3f5eed236b6df29ac47d122379ad3a9d209776a9cf3" -dependencies = [ - "miniz_oxide 0.9.1", - "postcard", - "rustc-hash 2.1.3", - "serde", - "thiserror 2.0.19", ] [[package]] @@ -7115,49 +7030,11 @@ dependencies = [ "oxc_syntax", ] -[[package]] -name = "oxc_codegen" -version = "0.138.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9feb869721e14ab8484c697372c468a3df3cb96ca8c02bfe34981fc8d614e9" -dependencies = [ - "bitflags 2.11.1", - "cow-utils", - "dragonbox_ecma", - "itoa", - "oxc_allocator", - "oxc_ast", - "oxc_data_structures", - "oxc_index", - "oxc_semantic", - "oxc_sourcemap", - "oxc_span", - "oxc_str", - "oxc_syntax", - "rustc-hash 2.1.3", -] - -[[package]] -name = "oxc_compat" -version = "0.138.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad6fd43a0b19ee2f8c190c4ff4918b1f22e2af605cd3a032eea9099ba5ec6f3f" -dependencies = [ - "cow-utils", - "oxc-browserslist", - "oxc_syntax", - "rustc-hash 2.1.3", - "serde", -] - [[package]] name = "oxc_data_structures" version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30c920b812d5c7cd2c6b914dbeda4a7e6720e1de7869119b6de833ae39bedac9" -dependencies = [ - "ropey", -] [[package]] name = "oxc_diagnostics" @@ -7243,42 +7120,6 @@ dependencies = [ "unicode-id-start", ] -[[package]] -name = "oxc_semantic" -version = "0.138.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7074088f38672fbafd4aa79f516835661ff539175858323f287775e2d9c89449" -dependencies = [ - "itertools 0.15.0", - "memchr", - "oxc_allocator", - "oxc_ast", - "oxc_ast_visit", - "oxc_data_structures", - "oxc_diagnostics", - "oxc_ecmascript", - "oxc_index", - "oxc_span", - "oxc_str", - "oxc_syntax", - "rustc-hash 2.1.3", - "self_cell 1.3.0", - "smallvec", -] - -[[package]] -name = "oxc_sourcemap" -version = "8.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b415102a94b483bbd76d13e850fe87961197e5795c79a8523ebec5d82025f94f" -dependencies = [ - "base64-simd", - "json-escape-simd", - "rustc-hash 2.1.3", - "serde", - "serde_json", -] - [[package]] name = "oxc_span" version = "0.138.0" @@ -7325,78 +7166,6 @@ dependencies = [ "unicode-id-start", ] -[[package]] -name = "oxc_transformer" -version = "0.138.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87a71b406724d9e1b3bdf8c700207524268a232af7e13302aeea53f98168e05d" -dependencies = [ - "base64 0.22.1", - "compact_str 0.9.1", - "hmac-sha1-compact", - "indexmap 2.14.0", - "itoa", - "memchr", - "oxc_allocator", - "oxc_ast", - "oxc_ast_visit", - "oxc_compat", - "oxc_data_structures", - "oxc_diagnostics", - "oxc_ecmascript", - "oxc_regular_expression", - "oxc_semantic", - "oxc_span", - "oxc_str", - "oxc_syntax", - "oxc_traverse", - "rustc-hash 2.1.3", - "serde", - "serde_json", -] - -[[package]] -name = "oxc_transformer_plugins" -version = "0.138.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c56f5cec2db3cdfc8268cb29a267a0c7927e065f431575caf63457609e26fcd" -dependencies = [ - "cow-utils", - "itoa", - "oxc_allocator", - "oxc_ast", - "oxc_ast_visit", - "oxc_diagnostics", - "oxc_ecmascript", - "oxc_parser", - "oxc_semantic", - "oxc_span", - "oxc_str", - "oxc_syntax", - "oxc_transformer", - "oxc_traverse", - "rustc-hash 2.1.3", -] - -[[package]] -name = "oxc_traverse" -version = "0.138.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c380b884f59c1f974f7ab966d758c31f3a765278d0348e6ec012c07fefd9da07" -dependencies = [ - "itoa", - "oxc_allocator", - "oxc_ast", - "oxc_ast_visit", - "oxc_data_structures", - "oxc_ecmascript", - "oxc_semantic", - "oxc_span", - "oxc_str", - "oxc_syntax", - "rustc-hash 2.1.3", -] - [[package]] name = "p256" version = "0.13.2" @@ -7808,7 +7577,7 @@ dependencies = [ "crc32fast", "fdeflate", "flate2", - "miniz_oxide 0.8.9", + "miniz_oxide", ] [[package]] @@ -7821,7 +7590,7 @@ dependencies = [ "crc32fast", "fdeflate", "flate2", - "miniz_oxide 0.8.9", + "miniz_oxide", ] [[package]] @@ -7927,18 +7696,6 @@ dependencies = [ "winreg 0.10.1", ] -[[package]] -name = "postcard" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" -dependencies = [ - "cobs", - "embedded-io 0.4.0", - "embedded-io 0.6.1", - "serde", -] - [[package]] name = "potential_utf" version = "0.1.5" @@ -8566,16 +8323,6 @@ dependencies = [ "syn 2.0.119", ] -[[package]] -name = "ropey" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93411e420bcd1a75ddd1dc3caf18c23155eda2c090631a85af21ba19e97093b5" -dependencies = [ - "smallvec", - "str_indices", -] - [[package]] name = "roxmltree" version = "0.21.1" @@ -10045,12 +9792,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "str_indices" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d08889ec5408683408db66ad89e0e1f93dff55c73a4ccc71c427d5b277ee47e6" - [[package]] name = "strict-num" version = "0.1.1" @@ -11825,12 +11566,6 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" -[[package]] -name = "vsimd" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" - [[package]] name = "vswhom" version = "0.1.0" diff --git a/docs/architecture/agent-runtime-services-design.md b/docs/architecture/agent-runtime-services-design.md index f27549b55e..1f624aacf7 100644 --- a/docs/architecture/agent-runtime-services-design.md +++ b/docs/architecture/agent-runtime-services-design.md @@ -698,7 +698,7 @@ agent-workflows - 当前没有第二个可执行 provider,因此不建立通用 workflow trait、registry、descriptor 或 step engine。 - 工作流策略保持无 I/O;需要编排 Runtime / Tool 时,只增加当前生产调用链所需的窄接口。 - 产品命令只映射到工作流能力,不把命令展示逻辑下沉。 -- MiniApp、Canvas 是产品产物与呈现能力,不进入该 crate。 +- MiniApp、GenUI 是产品产物与呈现能力,不进入该 crate。 - DeepReview 仍有兼容逻辑位于 `agent-runtime` 与 `assembly/core`;只有真实调用方切换、行为等价测试通过且旧写入方删除后,才算迁移完成。 ## 4. 产品组装与扩展 diff --git a/docs/architecture/appearance-package-system.md b/docs/architecture/appearance-package-system.md index 56904ddd2f..b70d22edbe 100644 --- a/docs/architecture/appearance-package-system.md +++ b/docs/architecture/appearance-package-system.md @@ -349,7 +349,7 @@ Portal 必须挂载到统一 `AppearanceOverlayHost`,Portal 内组件仍使用 ## 独立渲染器 -Monaco、xterm、canvas、mermaid、生成式 widget 等不依赖普通 DOM CSS 的渲染器通过 +Monaco、xterm、mermaid、生成式 widget 等不依赖普通 DOM CSS 的渲染器通过 `AppearanceRendererAdapter` 注册: ```ts @@ -357,8 +357,7 @@ interface AppearanceRendererSettingsMap { monaco: MonacoAppearanceSettings; xterm: XtermAppearanceSettings; mermaid: MermaidAppearanceSettings; - canvas: CanvasAppearanceSettings; - widget: WidgetAppearanceSettings; + 'generative-widget': WidgetAppearanceSettings; } interface AppearanceRendererAdapter { diff --git a/docs/architecture/generative-ui-architecture.md b/docs/architecture/generative-ui-architecture.md new file mode 100644 index 0000000000..649136961b --- /dev/null +++ b/docs/architecture/generative-ui-architecture.md @@ -0,0 +1,197 @@ +# GenUI 双路径应用架构 + +本文定义 GenUI 的目标产品和运行时边界。迁移未完成前,已接线代码仍是生产事实;本文中的目标能力不得据此描述为已交付。产品架构索引链接到本文件,本文件是 GenUI 架构的唯一专题设计文档。 + +## 产品决定 + +GenUI 提供两种源码表达,共用应用身份、版本、状态、宿主能力、持久化、候选验收和远程归属: + +| 路径 | 模型生成的源码 | 适用范围 | +| --- | --- | --- | +| 组件应用 | OpenUI Lang 描述 | 表单、列表、看板、数据应用及可信组件可表达的交互 | +| 自由文档 | HTML、CSS、SVG,可选受控 JavaScript | 特殊排版、可视化、动画和组件库难以表达的交互 | + +创建应用时,用户选择组件库及其绑定的 UI 规范配置。规范配置同时适用于两种源码类型,不是只供模型参考的风格 prompt。它定义可用组件库、样式资源、设计规则、支持的源码类型、目标视口、宿主绘制的外壳区域和必需验收项。自由文档必须在该视口中真实渲染、检查并根据可测诊断修正;不能从提示词或静态源码扫描推断其符合规范。 + +默认 `openui` profile 复现 Open Intelligent UI 的即时回答路径:模型流式输出 OpenUI Lang,Renderer 直接在 FlowChat 内联渲染,本地状态和声明动作立即生效,也不自动打开右侧工作台。只有显式选择 `harmony` profile 时,才进入 profile → design spec → viewport/shell → checker 的交付分层并提供侧栏展开;这套交付分层吸收 `harmony-genui` 的做法,把组件库选择绑定到可持久化、可执行验收的生成目标。OpenBitFun 将 Harmony 交付模式收敛到自己的应用 owner、权限和远程执行边界内。 + +组件路径直接采用 OpenUI `lang-core` 和 `react-lang` 的语言运行时。产品可以注册和扩展可信组件库;模板提供可选的起始结构和生成提示,不能限制模型自由组合现有组件。组件能力不足时,或用户明确要求自由设计时,使用自由文档路径。生成失败本身不是切换路径的理由;描述错误应携带诊断修复,只有组件表达能力不足才改用自由文档。旧的语义消息图已经退役;`source` 缺省的记录不可执行,必须由用户显式重新生成 OpenUI/HTML source。新组件生成只写入 `source.kind = openui-lang`。 + +模型不得生成 TSX、React 源码或其他需按应用编译的代码。不得恢复 Canvas TSX 编译链。可信组件的实现可以由产品开发者用 React/TSX 编写并随应用构建发布;这不属于模型生成执行路径。 + +MiniApp 保持自己的源码、打包、安装、权限及运行生命周期。GenUI 使用已有宿主和 Runtime 能力时通过其稳定接口,不把 MiniApp 改造成另一种 GenUI 源码格式。 + +## 系统边界 + +```mermaid +flowchart TD + L[可信产品组件库与可选模板] --> O[OpenUI Lang 源码] + O --> OR[OpenUI 解析、绑定、状态与组件渲染] + D[HTML / CSS / SVG / 受控 JS 源码] --> DR[隔离文档渲染器] + OR --> A[共同 GenUI 应用 owner] + DR --> A + A --> H[有权限的宿主能力适配器] + A --> V[候选检查与证据] + V --> C[按 owner revision 原子接受] + A --> S[源码、用户状态和修订持久化] + H --> R[现有 Agent Runtime / 平台能力] +``` + +语言解析和渲染留在各自运行时;产品数据与交付生命周期只由一个应用 owner 管理。禁止把 OpenUI 源码翻译到旧节点图或流程解释器后再执行,也禁止把两种源码都转换成任意 HTML/JS 后失去各自的类型和信任边界。 + +| 所有者 | 职责 | 禁止事项 | +| --- | --- | --- | +| Agent 工具与 Assembly | 选择生成类型、固定组件库与 UI 规范 ID/修订、生成提示和候选身份 | 实现组件、文件 IO、浏览器沙箱或持久化 | +| OpenUI 产品库 | 组件契约、组合、提示、renderer、纯函数和受信任动作声明 | 访问会话 store、平台 API 或直接写用户数据 | +| 自由文档运行时 | 静态文档渲染、隔离脚本执行、桥接消息协议 | 暴露 Tauri、Node、宿主凭据或任意未经授权的接口 | +| GenUI 应用 owner | 源码/状态修订、候选、CAS、保存重开、证据和来源归属 | 解析或重新实现 OpenUI Lang 语义 | +| 平台与 Runtime adapter | 对文件、工具、Agent、网络和其他宿主能力做授权执行 | 使用控制端本地上下文代替目标 owner 的归属 | +| 候选 checker | 在隔离实例中检查源码、实际渲染和声明交互 | 触碰正式用户状态或产生真实外部副作用 | + +## OpenUI 组件路径 + +### Library Registry 与组件库适配器 + +OpenUI 提供共同的 Lang/parser/state/Renderer 运行时,同时注册三套可独立选择的 profile:`openui` 使用上游 `openui.v1` native library,`openbitfun` 使用 `openbitfun.composable.v1`,`harmony` 使用 `openbitfun.harmony.v1`。每套 profile 都绑定自己的 adapter、prompt、CSS/style resources、design spec 和 revision;只读契约是同一 adapter 的明确权限变体,不能改变其来源身份。 + +`openbitfun` adapter 用 `@openbitfun/ui` 承载 Button、IconButton、Input、Textarea、Select、SegmentedControl、Checkbox、Radio 和 Card 等基础控件,再用 `oiComponents` 保留 Chart、Map、Svg、HtmlView、Table 和媒体等 GenUI 专用 renderer;所有实现都先绑定 BitFun 的 contract 和 positional signature,再经过 adapter 自己的 DOM inspector、action/query bridge、CSS/token scope 和 revision 校验。`openui` profile 则直接使用 vendored `open-intelligent-ui/src/lib/library.ts`、其 `components/*` 和 CSS;它不经过 `oiComponents`。任何 profile 都不会携带第二套 parser、state 或旧 graph runtime。 + +应用保存 `libraryId` 与 `libraryRevision`,并在 owner readback、candidate evidence、远程请求和重开时逐字段校验。设置页只改变下一次生成使用的 registry entry;已接受应用由保存的 identity 解析 schema、prompt、designSpec、renderer 和 bridge,不能通过 template 或全局配置重新推断组件库。未知或缺少 identity 的记录保留原始内容并显示不可运行状态,禁止换成 OpenUI、BitFun 或 graph fallback。 + +HOS7 暂不属于受支持的 GenUI 目标,不进入当前 library registry、生成 schema 或交付路径。后续如重新支持,必须以独立 adapter、明确许可、目标端能力协商和单独验收契约重新接入。Harmony-genui 只提取 design-system、token 和 Plot 能力,不嵌入旧 graph/schema/action runtime。 + +### 组件库与模板 + +以 OpenUI 的 `defineComponent`、`createLibrary` 和 `library.extend` 作为组件描述、schema、说明、renderer、函数、动作与组合规则的定义机制。产品注册可信实现;模型只能引用当前构建和产品配置实际提供的组件。添加、替换和移除组件必须同步影响生成提示及运行时校验,不能另外手写一份模型专用组件目录。 + +模型上下文必须同时包含 OpenUI Lang 的最小语法和当前 profile 的可执行提示。`openui` 使用上游生成的 system prompt 和上游 library spec;`openbitfun`、`harmony` 则从各自 catalog library 派生位置参数签名和 worked examples。Rust 工具 schema 只暴露当前 profile 的 template、library、revision 和 design spec,系统提示也只注入当前 profile 的 library。组件路径中的 `createRecord`、`patchRecord` 等旧兼容图动作不应被提示为 OpenUI `@` 动作。 + +同一产品可以提供多个有明确版本的组件库或扩展。组件库 ID 和修订在候选创建时固定,设置变化只作用于新候选。已有应用按它保存的库契约解析;未知库、运行时或组件版本应保留原始数据并显示不可用状态,不静默换库。 + +模板是可选的初始示例和任务约束。没有适合模板时仍可从所选库的合法根组件开始自由组合。组件库、模板、生成提示和检查器共享一份构建期产品定义;Rust 边界只验证通用 envelope、源码格式标识和 owner 约束,不复制 OpenUI parser 或运行语义。 + +组件作者提供实际 renderer、限于组件拥有 DOM 的 `inspect`,以及声明事件的隔离 `exercise`。探针只生成隔离状态,不得调用正式保存、权限接口或外部工具。任何外部副作用均通过 OpenBitFun 注册的宿主能力,遵守现有权限、取消、deadline、重试及远程 mailbox 语义。需要原子性的多步操作由一个 owner mutation 完成;OpenUI 顺序动作不自动等于事务。 + +### UI 规范配置与目标身份 + +产品配置以同一个版本化清单声明组件库 profile 与 `designSpec` 的绑定。规范至少包含 `componentLibraries`、`styleResources`、`rules`、`sourceKinds`、`viewport`、`shell` 和 `acceptance.checks`;构建校验确保 profile 的每个模板只使用规范允许的组件库。模型上下文收到选中规范的完整约束和资源 ID,模型不能自行选择或覆盖该身份。Rust owner 从受信任 profile/既有 owner 解析它,并在候选 app 中写入 `{ id, revision }`。 + +`designSpec` 是应用目标身份的一部分,与源码修订和状态分开持久化,但在候选 CAS、保存、重开和远程执行期间固定。修改既有 app(相同 app ID)继承 owner 已接受的规范,即使当前全局设置已改变;设置只决定新 app。显式更换规范必须是可检查的新 app 修订,检查组件库兼容性与用户数据迁移,不能在打开应用时跟随设置漂移。旧记录缺少该字段时显示不可运行,不再按模板推断或改写身份;未知/已移除规范保留原值并显示不可运行。 + +Owner 的读取和状态保存请求必须回显 `libraryId`、`libraryRevision`、`designSpec` 与 `sourceKind`;目标 owner 会把它们与已接受修订逐字段比较,缺失或不一致都返回 unsupported/error,不允许另一套 adapter 或源码类型的响应冒充当前应用。 + +规范的 `shell` 区分宿主绘制与生成内容。Harmony 手机规范固定 360 x 764 CSS px 视口,36 px 状态栏和设备外壳由宿主绘制,内容左右 inset 为 16 px,目标内容宽度 328 px。模型只能生成屏幕内容。OpenUI 组件路径使用规范绑定的 Harmony OpenUI library;HTML/CSS/SVG 路径收到同一身份、资源与规则,在相同宿主 shell 和固定视口验收。实际 DOM/几何检查至少验证视口尺寸、宿主 shell 部件、内容边界和横向溢出,并将精确诊断返回候选修正。若自由文档仍违规,修正后必须重跑同一规范检查;提示词本身不是通过证据。 + +### 流式和交互 + +从 Agent 工具参数事件中增量提取 OpenUI Lang 文本,使用 OpenUI 流式 parser 投影逐步完成的语句。传输 adapter 只负责解包、解转义、识别重置和追加,不解析语言、不重新实现语句缓存。组件预览使用固定的库修订;首屏允许本地状态交互,但会产生外部副作用的 action 仍须经过 owner、权限和交付层。候选结束后,完整原文必须经同一 OpenUI library 终态解析,且不得有未完成语法、未解析引用或阻断性 schema 错误。 + +React 组件身份和列表 key 必须经过真实插入、删除、重排测试。OpenUI statement ID 不等于所有数组渲染都具有稳定项身份;不能仅凭 parser 缓存断言焦点、输入状态或局部组件状态不会错位。确有上游缺口时优先以可追踪补丁修复或向上游提交,不复制 parser。 + +持久化的 OpenUI 用户状态使用版本化 JSON 数据,恢复后交给 `Renderer.initialState`,更新交给 `onStateUpdate` 与应用 owner。前端编辑态可以立即更新,只有 owner 确认写入后才能报告保存成功。外部查询和 mutation 必须进入宿主能力;状态更新不能绕过 owner CAS。 + +## HTML / SVG 自由生成路径 + +自由文档将 HTML、CSS 和 SVG 作为文档源码保存;交互脚本是独立、可选的源码字段。页面源码可以组织自己的 DOM、图形和动画,不能内嵌 TSX 构建器、远程脚本包或隐式模块加载器。模型不能通过脚本直接调用文件系统、Shell、内部 API、用户凭据或正式持久化。 + +隔离文档使用独立的 sandboxed iframe 和不透明 origin。允许执行脚本时使用 `sandbox="allow-scripts"`,不授予 `allow-same-origin`、表单提交、弹窗或顶层导航权限。宿主不通过 `contentDocument.write` 执行候选;以受控 `srcdoc`/文档更新通道交付源码,并在目标平台确认嵌入 API 不会把 Tauri 能力注入子文档。 + +内容策略默认拒绝网络、子框架、对象、表单目标、外部字体和外部脚本。候选检查和流式预览阶段不执行脚本;只在源码封存后的隔离检查实例启动脚本。HTML 预处理必须使用支持 SVG 的结构化 parser/sanitizer,删除脚本元素、内联事件属性、危险 URL 和不支持的嵌入资源;最终受控脚本从独立字段装载。拒绝 `eval`/`new Function`、动态 import 和远程模块。确有资源需要时,通过目标 owner 上明确定义并经授权的资源能力提供,不直接放开通用网络访问。 + +当前实现已经接通 `source.kind = openui-lang` 和静态自由文档 `source.kind = html-document`:前者交给 `@openuidev/react-lang` 的 OpenUI parser/renderer,并由产品 catalog 适配可信组件;后者把 HTML/CSS/SVG 以源码字段持久化,经过当前 HTML sanitizer 后放入不透明 origin 的全限制 sandbox iframe。脚本策略由宿主显式控制;检查模式使用一次性 nonce CSP,并在检查时禁用候选脚本。两者共用 designSpec、宿主外壳、布局检查、候选 CAS 和保存重开流程。自由文档 iframe 接收 designSpec/style-resource 元数据,并在宿主可提供 token 时复制受控的 OpenBitFun CSS token 基线,使 Harmony 的实际屏幕背景、文字和 SVG 默认使用同一套宿主资源;生成文档仍可显式覆盖自己的内容样式,规范检查继续以实际几何和宿主边界为准。OpenUI 的表单状态回调已经接入 owner 保存,组件声明的 action 通过 `Renderer.onAction` 传给 owner,`Query`/`Mutation` 通过 `GenUIAsyncRuntimeController` 适配成 OpenUI 的 `toolProvider`;它保留 OpenUI 的 cache/loading/error/retry 语义,并额外携带 AbortSignal、request identity、permission、target 和 targetId。已授权的 `ChatMcpCatalog` 通过 `createGenUIMcpProvider` 映射为同一 provider:只允许 catalog 中的 server/tool,JSON-RPC `result`/`error`、structured content 和 text content 在边界层解包,Mutation 必须由宿主显式列入声明。`Image`/`SearchImage` 的图片搜索、显式 URL 失败后的候选回退、`Map` 的异步 marker 查询和可选路线查询也使用同一 capability registry;宿主内置 provider 通过 `gen_ui_provider_call` 统一承接 360 图搜、百度图搜、Wikipedia/Commons、Nominatim、OSRM 和 Valhalla,组件不直接访问外部 `/api`。已授权的 MCP 同名 capability 优先,内置 provider 填充缺口;当宿主命令或目标端确实不可用时才保持显式 unsupported。source 替换、组件查询变化和卸载都会取消请求,迟到结果不能回写旧文档。自由文档的 `script` 默认仍不执行;只有宿主显式传入命名 `htmlBridge` 时才使用 `sandbox="allow-scripts"`,脚本通过 `window.openbitfunWidget.request` 发消息,父层校验 frame 来源、capability 名称并带 app/source/designSpec 身份调用 handler,再把结果返回。脚本入口会阻断 `eval`、`new Function` 和动态 `import`,CSP、opaque origin、无 same-origin/网络/表单/导航权限继续有效。产品仍需为每个宿主能力注册参数 schema、权限、取消和远程归属;iframe 不能被当作 CPU/内存级沙箱。生成脚本可以随自由文档源码保存,但在尚未协商出受控桥接能力的 host 上保持禁用。 + +自由文档的实际交付检查还会由宿主向 opaque iframe 注入一次性的只读 inspection probe。probe 不执行候选脚本,也不读取宿主凭据;它只报告可验证的视口、可见元素数量、内容边界和滚动尺寸,父层据此检查空白文档、固定屏幕宽度、横向溢出和目标内容边界。报告缺失、几何为零或内容越界都使候选失败,不能把 iframe `load` 或模型自报成功当作渲染通过。这个 probe 是 checker 的实现细节,产品宿主仍需在无法证明消息来源和 iframe 隔离时禁用自由文档脚本。 + +由于自由文档 iframe 使用不透明 origin,父页面的通用 DOM 截图工具可能只捕获宿主外壳而遗漏 iframe 像素。当前交付证据因此只把自由文档的真实加载、固定视口和宿主布局作为确定性检查,并将视觉截图标为 `unverified`;只有目标 host 提供可信的 iframe 截图适配器后,才可把图像交给视觉复核。 + +隔离页面仅通过按应用和实例绑定的宿主桥接请求允许的能力。宿主依据调用来源、应用 ID、源码修订和当前 owner 校验请求,消息按大小、频率、类型和参数 schema 限制;页面提供的 session、workspace、路径或设备标识一律不能决定执行目标。读文件、Agent 消息、外部工具和状态保存分别使用既有 owner 与权限流程。用户操作需要远程回答时必须走现有权限 mailbox。 + +iframe 和 CSP 是纵深防护,不是通用恶意代码 VM。浏览器可能无法在同一 WebView 内强制终止同步死循环或限定内存;不能宣称已获得进程级 CPU/内存隔离。启用模型生成 JavaScript 前,必须在 Desktop 的 WebView2、WKWebView、Linux WebKitGTK 及实际受支持 host 上验证 host API 不可见、网络/导航受限、消息可取消且 renderer 可恢复。某个 host 无法证明这些约束时,必须明确禁用该 host 的脚本执行并仍允许静态 HTML/CSS/SVG,不得静默用宿主权限执行。 + +## 共同应用与持久化契约 + +应用身份绑定目标设备/runtime、workspace、session 和应用 ID。每个接受版本保存源码及状态的独立修订;解析树、DOM 和截图是可丢弃的派生数据,不是权威存储。逻辑记录至少包含: + +| 字段 | 语义 | +| --- | --- | +| `appId` | 跨修订稳定的应用身份 | +| `source.kind` | `openui-lang` 或 `html-document` | +| `source.formatVersion` | 源码语法或文档策略版本 | +| `libraryId` / `libraryRevision` | 两种源码路径都保存创建时绑定的 library contract;HTML 路径的样式和脚本能力仍由 designSpec 与 host runtime 共同约束 | +| `designSpec.id` / `designSpec.revision` | 两种源码类型共用、由 owner 固定的设计目标配置 | +| `htmlRuntime` | HTML 应用由 owner 写入的 runtime、sanitizer、inspector 和 bridge revision;组件路径不需要该字段 | +| `source.revision` / `source.content` | 源码修订与原始内容 | +| `state.revision` / `state.value` | 独立的用户数据修订 | +| `ownerRevision` | owner 并发控制版本 | +| `verification` | 精确绑定源码、状态、运行时、checker 和能力版本的证据 | + +实际 wire/存储命名可以遵循现有领域契约,但须保留这些语义。Rust `Value` envelope 不解释源码;owner 不需要在 `app` 和 `widget_code` 间维护两份权威源码。每次编辑从已接受版本创建候选,源码和状态分别记修订,候选按 `baseOwnerRevision` 原子接受。过期、丢失确认的幂等重试、并发修改和未知字段由 owner 处理。 + +候选检查使用已接受状态的隔离副本,绝不覆写正式用户数据。检查可测试候选如何处理用户操作,但只有接受后用户界面才切换到它。保存失败时保留本地输入并显示失败状态;关闭重开从目标 owner 读取已接受源码和状态。格式或库切换是新修订;状态转换必须显式迁移并检查,失败时保留此前应用与数据。 + +## 统一实现约束与完成门槛 + +按可验证的纵向能力迁移,避免两条新路径各自建立一套应用 owner: + +1. **固定源码边界并退役 TSX 执行链。** 新生成请求只接受 `openui-lang` 或 `html-document`。删除旧 Canvas 的模型 TSX 输入、逐应用编译和执行入口;旧记录保留为不可执行数据,可由用户显式导出或导入为待检查候选。 +2. **建立共同 owner 与规范身份契约。** 引入版本化组件库/profile 和 `designSpec` 清单,将 `{id, revision}` 写入 app;引入带 `source.kind` 的源码修订、独立状态修订、owner revision 和候选接受语义。覆盖并发冲突、同 app ID 在设置改变后的规范继承和 source payload 往返,再让新路径以此作为唯一权威存储;旧 graph payload 不进入新 owner。 +3. **完成 OpenUI 组件纵向切片。** 现在已用绑定规范的产品组件库打通 `source.kind = openui-lang` 的解析、渲染、流式输入、状态回调、action/query owner bridge 和 owner 保存/重开;async capability 层已补齐 Query/Mutation、图片、地图、取消、权限、远程 target 与 target event。宿主仍需为实际外部能力注册参数 schema、deadline、重试和远程 mailbox。没有合适模板时验证自由组合;库或语法诊断必须留在 OpenUI 语言语义内修复,不能转译到旧 JSON 图。 +4. **完成自由文档静态纵向切片并收敛脚本门槛。** 已完成不执行脚本的 HTML/CSS/SVG 渲染、当前 sanitizer、style-resource token 基线和共同 owner 保存重开;每个规范在实际目标视口运行 DOM/几何验收,违规诊断交回修正并重验。当前证据带有 HTML runtime 的 revision;白名单式 sanitizer、参数化 bridge registry 以及各原生 WebView 的隔离证明仍是后续交付门槛。受控 JavaScript 仍按 host 单独开放;每个 host 先证明桥接权限、导航/网络限制、取消和恢复,再启用生成脚本。 +5. **迁移候选验收与远程执行。** 组件和自由文档都由 owner 所在 runtime 按持久化的组件库及规范版本检查和接受。逐一验证 Remote Workspace、Remote Control、Peer Device 和 Detached Dispatch;能力缺失时明确 unsupported,不用本地渲染或 checker 代替目标端证据。 + +完成以行为证据为准,不以模块已创建或代码已编译为准。旧 graph 存储不进入新 owner,只有带 source 的候选才可接受;未验证的 host 或远程场景必须保持显式禁用或 unsupported。 + +## 候选验收与证据 + +组件和自由文档共用一条 owner 级交付门: + +1. 固定 owner、应用 ID、源码类型和源版本;创建不覆盖已接受数据的候选。 +2. 对原始完整源码做格式、语言/文档策略、组件库与 UI 规范版本校验,记录内容 hash。 +3. 在目标执行端按规范的 viewport 和 host shell 启动隔离实例,检查实际挂载、运行异常、关键可见内容、布局、规范验收项和候选声明的交互。失败诊断绑定到该规范修订并用于修正;提示文本、schema 通过或截图单独均不构成规范通过。 +4. 通过同一 owner 保存隔离检查状态,重读精确修订,再启动并断言恢复结果。 +5. 将用户原始需求与实际 DOM/交互/保存证据一起做独立需求复核;有视觉模型时检查实际宿主截图。截图是临时检查输入,不保留为应用源码。 +6. 只有全部必需阶段通过,且候选仍匹配基础 owner revision,才原子接受;否则保留旧版本并把具体诊断交还生成模型修复。 + +接受证据本身也必须带回候选的 `designSpec {id, revision}`;自由文档和 +OpenUI 文档还必须带回相同的 `sourceKind`。owner 会逐字段比较这些身份, +所以远程 checker、过期的前端或另一套规范产生的证据不能被写入当前应用。 + +页面代码自报成功、Rust 结构校验通过或 React 已挂载都不能单独构成交付成功。模型审查不能代替运行器证据;无图像能力的检查器应把视觉项记录为 `unverified`,不伪称通过。检查设施不可用、超时或 owner 冲突与源码缺陷分开报告;可重试的检查阶段应重试同一候选,不要求模型无端改写源码。 + +组件作者提供的检查探针覆盖组件事件和 mounted inspect;应用级检查场景验证用户需求。自由文档检查器观察真实隔离实例并驱动受控测试事件,不能只采信页面向父级发送的“测试通过”消息。两种路径都保存精确源版本、状态版本、renderer/checker 版本和结果引用;HTML 路径还要记录 runtime、sanitizer、inspector 和 bridge revision。 + +## 远程与多入口 + +保存、检查、脚本宿主桥接和候选接受始终属于应用 owner 所在 runtime。控制端只呈现状态和发送命令,不代理文件系统、渲染权限或用户状态。运行和检查依赖的能力必须在目标端通告并协商;缺失时在准入或交付阶段明确返回 unsupported,不能静默在控制端本地执行。 + +| 场景 | 必须成立的行为 | +| --- | --- | +| Remote Workspace | workspace 路径与文件访问由远程 runtime 解释;不能把控制端路径转给目标端 | +| Remote Control | 断开后 owner 保留候选和可恢复阶段;远程权限请求可经现有 mailbox 回答 | +| Peer Device | 目标 peer 提供对应语言库、renderer、隔离脚本与 checker 能力;按 peer owner 修订 CAS | +| Detached Dispatch | 目标端可在无人值守条件下完成验证;缺 renderer/checker/脚本隔离能力时明确不接受候选 | +| CLI / Headless | 无交互 renderer 时允许明确报告 unsupported,不能伪造渲染/视觉证据 | + +组件检查和自由文档检查使用同一远程生命周期,不要求每个客户端都安装或运行 renderer。Desktop 当前事件驱动的前端 checker 是一种 adapter,不是架构 owner;目标执行端需要能力,而不是持续连接的 controller window。 + +## 升级、历史数据与退役边界 + +存储新增字段必须可选并容忍旧记录。未知字段、未知 source format、损坏源码和未知组件库都原样保留;旧 graph 记录直接显示为不可运行,不进入 renderer、checker 或 acceptance,也不自动迁移。旧 HTML Widget 可以作为显式导入的 HTML 文档候选,导入后先应用新隔离策略和检查;TSX/Canvas 编译产物不得被自动执行或冒充 OpenUI。 + +当前实现中,OpenUI Lang 是组件路径唯一的生成语言和 parser;OpenBitFun 私有 graph 消息、表达式解释器、兼容 renderer 和组件专用 workflow 已从生成与交付链删除。自由文档是明确的 HTML/CSS/SVG 加可选受控 JS 类型,不是组件运行时的 fallback。旧 Canvas TSX compiler 与模型生成 TSX 执行链退役。产品边界不应保留 widget 和组件应用各自独立的身份、状态、验收或远程归属。 + +架构验证须覆盖两种表达不同的组件应用、无模板自由组合、真实工具参数流的渐进渲染、规范随 owner 保存重开与设置切换后的身份继承、Harmony 固定手机视口和 host shell、违反规则时实际诊断/修正/复验、自由文档 JS 隔离、状态修订、候选失败时旧版本保留、版本冲突,以及上述四类远程场景。Mock/DOM 测试不能证明原生 WebView 沙箱、远程执行或 Detached Dispatch;对应报告必须明确实际覆盖的 host 和场景。 + +当前本地交付证据(浏览器 fixture 使用真实 Chrome,owner/CAS 使用 Rust +持久化测试)包括:`pnpm --dir src/web-ui exec tsc --noEmit`、source-only GenUI +Vitest、`openbitfun-product-domains` GenUI 合同测试、 +`openbitfun-services-integrations` GenUI owner 测试、Core GenUI/tool +测试,以及 `scripts/test-genui-browser.mjs`。浏览器 fixture 已实际检查 +OpenUI action、`$name` 状态回传、Harmony `360x764` 外壳/状态栏/内容边界、 +自由 HTML/SVG iframe、空白文档拒绝、受控 `htmlBridge`、设置切换、临时预览 +状态和原生/deferred 流式 DOM 增长;Harmony owner 的保存/重开由 Rust 测试 +单独覆盖。Remote Workspace、Remote Control、 +Peer Device 的 live host 与 Detached Dispatch 的目标端 checker 尚未在这套 +fixture 中冒充通过:Peer 缺少 `gen_ui_owner_v1`/`gen_ui_libraries_v1` 时会 +结构化返回 unsupported,Detached Dispatch 的 GenUI 状态保存/重开也保持 +明确 unsupported,直到目标端具备对应 owner 和 checker 证据。 diff --git a/docs/architecture/generative-ui-openui-interaction-plan.md b/docs/architecture/generative-ui-openui-interaction-plan.md new file mode 100644 index 0000000000..0f2ec01062 --- /dev/null +++ b/docs/architecture/generative-ui-openui-interaction-plan.md @@ -0,0 +1,311 @@ +# GenUI 对齐 Open Intelligent UI 的交互改造规划 + +状态:核心切片已实施,持续收敛中 + +当前实现进度:FlowChat 内联、显式 Harmony 交付展开、原生 `GenUIStream`、OpenUI 增量渲染、首屏生命周期状态、严格的 `messageId + seq` 重排、P0 布局/标题原语和默认内容组件已落地。默认 `openui` 路径采用 Open Intelligent UI 的即时交互语义,不进入右侧工作台;`harmony` 才进入交付 checker/owner/CAS。固定 benchmark 仍不作为门槛。 + +本文把 BitFun GenUI 的首屏体验、流式协议和交付边界对齐到 Open Intelligent UI,并记录当前实现边界。现有的 owner、CAS、远程归属、候选验收和安全边界继续有效;本规划调整的是这些能力进入用户体验的时机和承载方式。 + +## 已确认的产品决定 + +以下决定作为本次改造的约束: + +1. GenUI 直接内联渲染在 FlowChat 中,不再先显示一个工具卡片再打开应用。 +2. 默认 OpenUI 不打开右侧工作台;只有显式 Harmony 交付才提供“展开查看”目标,且不能成为首屏 UI 的唯一入口。 +3. 模型直接流式输出 OpenUI Lang,传输层不把整段源码包在一个必须完整闭合的 JSON 字符串中。 +4. 默认 `openui` 首次渲染不进入交付验收:先显示可用 UI,后校验不属于默认生成路径。 +5. 默认库采用 Open Intelligent UI-compatible 的 OpenUI 组件集合,至少包含 `Markdown`、`Image`、`Chart`、`Map`、`SVG`、`List`、`Table`、`Slider`、`DatePicker`、`HtmlView`。 +6. owner、CAS、远程归属和安全检查只在显式 `harmony` 交付模式保留,不阻塞默认 OpenUI 首屏生成。 +7. 8~16 个固定 benchmark 暂不纳入本期交付,先用纵向场景和手工验收验证核心链路。 + +## 目标体验 + +用户在 FlowChat 中提出一个需要结构化结果的问题后,体验应当是: + +```text +用户问题 + → 模型开始输出 OpenUI Lang + → FlowChat 出现首个可见组件 + → UI 随模型输出持续增长 + → 图片、地图和查询结果异步填充 + → 用户在当前消息内直接操作控件 + → (仅 Harmony 交付)需要更大空间时再展开到侧栏 + → 默认停留在当前答案;只有显式 Harmony 交付才后台保存、验收和生成交付证据 +``` + +首屏的产品语义是“正在形成的答案”,不是“正在生成的应用”。用户不打开侧栏也应能完成主要任务;侧栏只是同一份 UI 状态的更大视图。 + +## 目标架构 + +```mermaid +flowchart LR + M[模型] --> S[GenUI Stream Adapter] + T[Agent 工具 / 数据源] --> D[异步数据通道] + S --> P[OpenUI Lang 增量 Parser] + P --> A[FlowChat Inline Renderer] + D --> A + A --> V[共享 UI 状态 Store] + V --> E[侧栏展开视图] + V -.显式 harmony.-> R[持久化 / Checker / Visual Review] + R --> O[Owner + CAS + 远程交付] +``` + +首屏渲染、数据填充和交付验收是三条相互协作但不互相阻塞的路径: + +- **内容路径**:模型输出 OpenUI Lang,解析为可渲染的增量 AST。 +- **数据路径**:工具结果通过明确的数据事件填充图片、地图、图表等组件。 +- **交付路径**:后台对最终源码和状态执行 checker、visual review、persistence 和 owner CAS。 + +默认 `openui` 路径只走内容和数据路径;显式 `harmony` 才开启交付路径。三条路径共享 `appId`、`sessionId`、`turnId` 和 source revision,但默认 OpenUI 不等待交付完成。 + +## 流式传输协议 + +传输层只负责事件边界、顺序、取消和错误,不解释 OpenUI Lang 语义。当前 runtime 的 `ToolEventData::GenUIStream` 使用如下 envelope: + +```ts +type GenUIStream = { + event_type: 'GenUIStream'; + tool_id: string; + tool_name: 'GenerativeUI'; + message_id: string; + seq: number; + format: 'openui-lang'; + text: string; + reset: boolean; + app_id?: string; + title?: string; + template?: string; + library_id?: string; + library_revision?: number; +}; +``` + +实现要求: + +- `text` 直接承载 OpenUI Lang 片段,不再嵌入一个必须完整闭合的 JSON 字符串。 +- 前端维护可恢复的增量缓冲区,每次收到 delta 都尝试解析当前可完成的语句。 +- parser 产生 AST 增量或局部更新,renderer 只更新受影响的子树。 +- 不完整的语句可以暂时不显示,但不能阻塞已经完整的语句。 +- 异步数据请求在 UI 已经出现后独立更新;数据失败只影响对应组件。 +- `Completed`、`Failed` 或 `Cancelled` 表示模型流结束,不表示 persistence、checker 或 visual review 已完成。 +- 取消、断线和重试必须绑定 `messageId` 与 `seq`,避免旧流覆盖新流。 + +显式 `harmony` 交付时,最终源码仍需使用同一 OpenUI library 做终态解析和校验;默认 `openui` 不运行 checker、visual review 或 owner acceptance。 + +当前落地由 provider stream 直接发出 `GenUIStream` 事件:事件携带已经从工具调用 framing 中解出的 OpenUI Lang 文本增量、`message_id`、`seq`、`format` 和 `reset`。GenUI 不再从 `ParamsPartial` 反推源码,也不维护旧的双协议兼容层;OpenUI 语义仍由 OpenUI parser 负责。`Completed`、`Failed` 和 `Cancelled` 事件承担终态,不把 persistence、checker 或 visual review 塞回首屏事件。 + +## FlowChat 承载方式 + +### 内联消息 + +新增 `GenerativeWidgetInline` 作为 FlowChat 消息内容的一部分,接收: + +- 当前的 OpenUI Lang 增量 AST; +- 共享的变量和 action 状态; +- 异步数据 request 状态; +- 当前消息的 `messageId`、`turnId` 和 source identity。 + +`GenerativeWidgetToolCard` 已从当前工具卡注册和实现中清理。GenUI 由 `FlowToolCard` 直接路由到 `GenerativeWidgetInline`,不再通过工具卡片 DOM 承载真实生成内容。 + +### 侧栏展开 + +Harmony 侧栏 renderer 和内联 renderer 复用同一个 projection、owner 和应用状态;默认 OpenUI 没有侧栏展开入口: + +- 展开不会重新生成源码; +- 展开不会复制一份独立状态; +- 内联和侧栏的控件操作看到同一份变量状态; +- 侧栏关闭后,内联视图继续保留当前状态; +- 只有明确进入 Harmony 交付并需要更大空间或长期使用时才打开侧栏。 + +### 流式状态 + +FlowChat 至少需要表达以下状态: + +| 状态 | 用户看到的内容 | +| --- | --- | +| `starting` | 轻量 skeleton 或生成提示 | +| `streaming` | 已完成语句立即渲染,未完成部分继续等待 | +| `data-pending` | 组件可见,图片/地图/查询区域显示局部 loading | +| `interactive` | 已有控件可以直接操作 | +| `complete` | 模型流结束,后台验收仍可继续 | +| `delivery-pending` | UI 可用,保存/验收在后台进行 | +| `degraded` | 保留可用 UI,并显示局部错误或不可持久化提示 | +| `failed` | 无法生成任何可用 UI 时回退到普通文本错误 | + +## 默认组件库补齐顺序 + +### P0:首屏和局部交互 + +- 布局:`Col`、`Row`、`Box`、`Card`、`Grid` +- 文本:`Title`、`Text`、`Markdown`、`List` +- 控件:`Button`、`Input`、`Select`、`Slider`、`Checkbox` +- 数据展示:`Table`、基础 `Chart` + +### P1:Open Intelligent UI 的核心场景 + +- `Image` +- `Map`、`MapMarker` +- `DatePicker` +- `RadioGroup`、`SegmentedControl` +- `Carousel`、`Popover` + +### P2:高级表达和受控自由内容 + +- `SVG` +- `HtmlView` +- `Code`、`Quote`、`Timer` +- 需要隔离和能力白名单的自定义 HTML 交互 + +每个组件必须同时提供: + +- OpenUI Lang 的位置参数签名; +- 生成提示和最小示例; +- React renderer; +- 状态绑定方式; +- 可测试的 action 或 query bridge; +- 主题 token 和响应式规则; +- 不依赖 FlowChat store 的纯组件实现。 + +## 状态、动作和工具数据 + +GenUI 交互状态分为三层: + +1. **本地交互状态**:slider 值、筛选条件、选中项、展开状态。 +2. **答案计算状态**:图表数据、排序结果、汇总数字和派生列表。 +3. **助手会话状态**:只有需要模型理解、外部工具或追问时才更新。 + +原则如下: + +- `@Set`、`@Reset`、`@CopyToClipboard` 等本地动作不重新调用模型。 +- `@ToAssistant` 只用于需要继续推理或调用工具的操作。 +- 图片、地图、搜索和外部查询先渲染占位,再通过 `data` 事件局部更新。 +- 工具失败显示局部 error,不清空已经生成的其他组件。 +- 任何外部副作用仍然经过现有 capability、权限、取消、deadline 和远程 mailbox。 + +## 交付和恢复层 + +owner、CAS、远程归属、安全检查和 visual review 保留,但执行时机调整为: + +```text +首屏可用 UI + → 后台保存候选源码和局部状态 + → checker 在隔离实例中运行 + → visual review 生成证据 + → owner 按 CAS 接受 + → 生成可重开、可远程恢复的交付版本 +``` + +约束: + +- 首屏 renderer 不得直接写正式 owner 状态。 +- 后台 persistence 失败时,保留本地临时状态并明确标记 `delivery-pending` 或 `degraded`。 +- checker 失败不能撤销已经展示的临时 UI,只能阻止交付或保存为正式版本。 +- 远程端能力不足时返回明确 `unsupported`,不得偷偷在控制端本地执行。 +- 恢复时仍按 `appId`、`source.revision`、`state.revision`、`ownerRevision`、`libraryId/revision` 和 `designSpec` 校验身份。 + +## 实施阶段 + +### M0:基线和开关 + +- 固定 OpenUI inline 模式作为当前 FlowChat 路径。 +- 清理已经失去调用方的 deferred/panel 工具卡实现;owner、CAS、远程归属和安全检查继续保留在交付层。 +- 将当前大规模迁移清理与本次交互改造分开提交。 +- 固定 `messageId`、source identity、session/turn 关联方式。 +- 确定首批纵向场景:文本+Markdown、表单、表格+图表、图片、地图。 + +### M1:FlowChat 内联首屏 + +- 实现 `GenerativeWidgetInline`。 +- 让 `GenerativeWidgetPanel` 只负责共享应用渲染、状态与展开入口。 +- 加入 skeleton、局部 loading、局部 error 和取消恢复。 +- 建立内联与侧栏共享 `GenUIStateStore`。 + +当前代码已经提供 `starting`、`streaming`、`data-pending`、`interactive`、`complete`、`delivery-pending`、`degraded` 和 `failed` 的用户可见状态;没有首屏源码时使用轻量 skeleton,交付失败保留已渲染内容。 + +交付条件:不打开侧栏也能看到并操作第一批 UI。 + +### M2:OpenUI Lang 增量链路 + +- 实现 runtime `ToolEventData::GenUIStream` envelope。 +- 移除完整闭合 JSON 字符串作为首屏前置条件。 +- 接入增量 parser 和 AST 局部更新。 +- 处理乱序、重复、取消、断线和重试。 +- 将 `Completed`/`Failed`/`Cancelled` 与 delivery lifecycle 分离。 + +当前前端还会缓存未来序号、忽略重复序号、要求新 `messageId` 显式 `reset`,并在终态后拒绝迟到事件;provider snapshot 回退仍由 runtime 负责解包和 reset,OpenUI 语义仍只由 parser 负责。 + +交付条件:完整语句可以在流结束前显示,局部解析失败不会清空已显示内容。 + +### M3:核心组件和局部交互 + +- 先完成 P0 组件,再完成 P1 组件。 +- 为每个组件补齐 library spec、prompt、renderer、state/action contract。 +- 将本地控件状态与模型会话解耦。 +- 接入图片、地图、查询和图表的异步数据填充。 + +默认库目前包含 `Col`、`Row`、`Box`、`Grid`、`Title`、`Text` 以及 Markdown、Image、Chart、Map、SVG、List、Table、Slider、DatePicker、HtmlView。图片搜索和地图查询现在也经过统一的 async capability provider;它们先显示占位/局部 loading,再独立填充数据,不在组件内部直接访问 `/api`。 + +### Query/Mutation 与异步数据通道(已落地) + +OpenUI `Renderer` 仍负责 Query/Mutation 的 cache、loading、error、retry 和 invalidate。BitFun 在 `GenUIAsyncRuntimeController` 外包一层宿主边界,给每次调用补上 `appId`、`sourceKey`、`requestId`、operation、AbortSignal、permission、target 和 targetId。provider 只实现 `call(name, args, context)`,组件不接触权限和远程归属。 + +- `query`、`mutation`、`image-search`、`map-query` 共用同一 capability registry;未注册、未授权、目标不匹配或 peer 缺少 target id 时直接返回结构化拒绝。 +- 语义 source 替换和卸载会 abort 当前 generation;同一 OpenUI source 的 token 增量不会改变 runtime identity。组件自己的 query 变化还会 abort 本地请求,旧结果即使底层 promise 忽略 signal 也不会回写当前 UI。 +- 流式策略与 Open Intelligent UI 对齐:parser 保留已经完成的 statement,组件按 `statementId` 原地 reconcile;图片查询使用 500ms debounce,路线查询使用 700ms debounce,均允许在 stream 中启动并在 query/key 变化时取消。MapLibre 只创建一次,stream 中只更新已完成 marker,camera fit 和路线动画等重操作等 stream 结束;`HtmlView` 在 stream 中只显示准备态,结束后才创建 sandbox iframe,避免每个 token 重载页面。 +- `Image`/`SearchImage` 使用 `image.search`(也接受显式 `SearchImage` capability)填充 URL;默认由宿主 provider 先走 360 图搜,再尝试百度图搜,国内源没有结果时再复用 Wikipedia/Commons,MCP catalog 中已授权的同名能力优先。没有结果时显示 OI 风格的图像空态,显式 URL 加载失败后按 Open Intelligent UI 的顺序切换到 provider 候选。`Map` 使用 `map.lookup`(也接受 `Map` capability)填充 marker;默认宿主 provider 使用 Nominatim,路线先走 OSRM、再回退到 Valhalla,已授权的 MCP `map.lookup`/`map.route` 优先,没有路线结果时保留 marker 直连的 overview,静态 markers 仍可立即渲染。 +- 地图 marker 选择通过 `GenUITargetEvent` 回传 owner,并带目标端身份;provider 可同时把事件投递到远端 mailbox。事件不会把 Query 结果混进普通 conversational action。 +- Chat MCP catalog 通过 `createGenUIMcpProvider` 接入 Query/Mutation:catalog 是唯一准入清单,默认工具按 Query 处理,写操作需宿主显式声明;MCP JSON-RPC 结果、结构化内容、错误和 AbortSignal 均在 provider 边界处理。 + +这与 Open Intelligent UI 的差异主要在宿主层,而不是重新实现 OpenUI 语义:OpenUI 本身仍管理 Query/Mutation 生命周期,BitFun 只增加 capability admission、取消、远程 target 和 owner event delivery。Open Intelligent UI 的 `SearchImage` 默认直接访问 `/api/wiki` 与 `/api/image-search`;BitFun 保持宿主安全边界,通过已授权 catalog 映射的显式 `image.search` provider,并兼容直接数组、`photos`/`images`、结果列表以及 wiki/image-search 分桶返回。地图已经使用 MapLibre、OpenStreetMap 派生 vector style、raster fallback、地图控件和可展开探索;路线由显式 `map.route` provider 提供 OSRM/GeoJSON 等街道几何,provider 暂不可用时保留可用的 marker 直连 overview。Open Intelligent UI 还提供 `CopyToClipboard` 等本地 custom action,BitFun 已注册同名 action,优先使用 Clipboard API,失败时走 WebView 可用的 `execCommand` fallback,同时把结构化 action event 交给 owner。OpenUI runtime 当前不会把 AbortSignal 传给 `ToolProvider`,所以 BitFun 的 controller 负责补齐这一层,并在 source 生命周期结束时强制终止旧请求。 + +交付条件:核心场景可以在当前 FlowChat 消息内完成主要操作。 + +### M4:显式 Harmony 交付、恢复和安全边界 + +- 只有显式选择 Harmony GenUI 时才运行 persistence、checker、visual review。 +- 将候选和正式 owner 状态分开。 +- 验证 CAS 冲突、保存失败、断线恢复、远程 unsupported。 +- 确保 HtmlView、SVG 和其他自由内容仍受隔离、能力白名单和 host 限制。 + +交付条件:首屏不被交付失败阻塞,正式版本仍满足现有安全和归属约束。 + +### M5:灰度和后续评估 + +- 默认使用 inline 模式;当前代码不保留已经没有调用方的旧工具卡 fallback。 +- 记录首个有效组件、首个可交互组件、完成时间、局部失败和交付结果。 +- 8~16 个固定 benchmark 暂缓,待 M1~M4 稳定后再决定是否纳入质量门槛。 + +## 代码落点 + +首批改造重点文件: + +- `src/web-ui/src/flow_chat/components/GenerativeWidgetInline.tsx` +- `src/web-ui/src/flow_chat/components/GenerativeWidgetInline.appearance.ts` +- `src/web-ui/src/flow_chat/components/GenerativeWidgetInline.test.tsx` +- `src/web-ui/src/flow_chat/utils/generativeWidgetProjection.ts` +- `src/web-ui/src/tools/generative-ui/GenUIApplication.tsx` +- `src/shared/generative-ui/catalog.json` +- `src/crates/assembly/core/src/agentic/tools/implementations/generative_ui_tool.rs` + +建议新增的边界模块: + +- `src/crates/contracts/events/src/agentic.rs` (`ToolEventData::GenUIStream`) +- `src/crates/execution/agent-stream/src/tool_call_accumulator.rs` +- `src/web-ui/src/tools/generative-widget/GenerativeWidgetPanel.tsx` +- `src/web-ui/src/tools/generative-ui/useGenUIOwner.tsx` + +## 本期完成标准 + +本期不以“生成了一个可持久化应用”作为首屏成功标准,而以以下行为作为完成标准: + +- GenUI 直接出现在 FlowChat 内联消息中。 +- 侧栏是可选展开,不是必经入口。 +- OpenUI Lang 片段可以增量传输和渐进渲染。 +- 首个可用组件不等待完整源码、persistence、checker 或 visual review。 +- 控件可以在消息内部完成本地状态交互。 +- 图片、地图、图表和查询结果可以异步局部更新。 +- persistence、checker、visual review 失败时不清空已经展示的 UI。 +- owner、CAS、远程归属和安全检查仍然覆盖正式交付和恢复。 +- 旧工具卡和 iframe renderer 已清理;需要恢复时仍通过 owner/CAS、源版本和安全检查恢复正式交付版本。 + +固定 benchmark、完整跨设备矩阵和更多高级组件属于后续质量建设,不作为本期阻塞条件。 diff --git a/docs/architecture/product-architecture.md b/docs/architecture/product-architecture.md index 4917d2be9a..d00d7b5081 100644 --- a/docs/architecture/product-architecture.md +++ b/docs/architecture/product-architecture.md @@ -8,6 +8,7 @@ | 扩展体系 | [Plugin Runtime](extensions/plugin-runtime-design.md)、[能力集成](extensions/capability-runtime-integration-design.md)、[外部来源](extensions/external-ai-work-sources-design.md)、[OpenCode 兼容](extensions/opencode-extension-compatibility.md) | | 产品交付 | [产品定制](product-customization-blueprint.md)、[CLI 产品线](cli-product-line-design.md)、[Agent SDK](agent-sdk-product-architecture.md)、[平台可移植性](platform-portability-design.md) | | 产品控制面 | [Product Control](product-control-plane.md) | +| 生成式 UI | [双路径应用与宿主生命周期](generative-ui-architecture.md) | | 模型与订阅 | [订阅多账号与额度路由集成设计](subscription-account-routing-design.md)(提案) | | 架构演进 | [Core 拆分](../plans/core-decomposition-plan.md)、[演进计划](../plans/product-architecture-evolution-plan.md)、[Rust 依赖边界](rust-build-dependency-boundaries.md) | @@ -115,7 +116,7 @@ block-beta Application → Extension Dimension 表示产品入口消费受控扩展;Extension Dimension → Cross-platform 表示扩展的发现与执行受平台能力约束。两项依赖均不改变 Agent Core → Tools & Execution → Cross-platform 的主分层关系。 -Application 表达产品领域对象;Conversation 与 Task 分别区别于运行时的 Session 与 Scheduling。Code Agent、Deep Review、Deep Research 属于由多个逻辑职责组合而成的场景;Mini Apps 与 Canvas 是 Artifact 的呈现机制;Desktop、CLI、Web、Mobile 是产品交付形态。`Agent Runtime`、contract、port、adapter 和外部系统不构成 Level 0 逻辑模块。DFX 在本视图中表示诊断、Tracing、指标、审计和运行质量反馈,不包含测试工程或开发流程。 +Application 表达产品领域对象;Conversation 与 Task 分别区别于运行时的 Session 与 Scheduling。Code Agent、Deep Review、Deep Research 属于由多个逻辑职责组合而成的场景;Mini Apps 与 GenUI 是 Artifact 的呈现机制;Desktop、CLI、Web、Mobile 是产品交付形态。`Agent Runtime`、contract、port、adapter 和外部系统不构成 Level 0 逻辑模块。DFX 在本视图中表示诊断、Tracing、指标、审计和运行质量反馈,不包含测试工程或开发流程。 当前生产代码与验证证据支持以下成熟度判定: @@ -236,14 +237,14 @@ Computer Use 的控制会话、系统共享提示、后台输入边界与 macOS 以下内容不属于 Agent Runtime: - Deep Review、Deep Research 等按名称定义的产品工作流、提示词和报告策略; -- MiniApp、Canvas 等产物产品及其发布、市场或界面生命周期; +- MiniApp、GenUI 等产物产品及其发布、市场或界面生命周期; - CLI、ACP、SDK Host、Tauri、HTTP/WebSocket 等入口和协议; - 文件系统、Git、终端、网络、MCP、远端与 AI 提供方的具体实现; - Delivery Profile 和某个产品应该装载哪些 Agent / Tool 的选择。 命名工作流的无 I/O 决策归 `agent-workflows`;具体 I/O 归 Services;`product-capabilities` 只选择工作流能力、Agent ID 和原子工具组。依赖方向固定为 `Assembly → agent-workflows → agent-runtime / contracts`,`agent-runtime` 禁止反向依赖 `agent-workflows`。当前 `agent-workflows` 的 DeepResearch 报告后处理不需要 Runtime 类型,因此直接依赖基础库;这不改变上述长期方向。 -原子逻辑模块应满足三个条件:一个明确 owner、一个可独立测试的输入输出契约、一个变化原因。`core.basic`、`core.agent`、`core.session`、`core.git`、`core.web`、`core.mcp`、`core.computer-use`、`core.review`、`core.miniapp`、`core.creation`、`core.canvas` 分别表达实际工具职责;其中 `core.creation` 只承载创造模式的产品创作入口,不吸收 MiniApp runtime/market owner。不得重新合成 `core.integration` 这类同时包含网络、Git、MCP、产品工具和平台能力的大组。 +原子逻辑模块应满足三个条件:一个明确 owner、一个可独立测试的输入输出契约、一个变化原因。`core.basic`、`core.agent`、`core.session`、`core.git`、`core.web`、`core.mcp`、`core.computer-use`、`core.review`、`core.miniapp`、`core.creation` 分别表达实际工具职责;其中 `core.creation` 只承载创造模式的产品创作入口,不吸收 MiniApp runtime/market owner。不得重新合成 `core.integration` 这类同时包含网络、Git、MCP、产品工具和平台能力的大组。 当前生产循环仍由 `assembly/core` 的 `ConversationCoordinator → Scheduler → ExecutionEngine → RoundExecutor → ToolPipeline` 持有;`agent-runtime` 已拥有可移植决策与 Rust preview facade,但尚未独立拥有完整循环。`assembly/core` 因此仍是过渡期兼容组装与实际 owner,不能被描述成只有 wiring。后续迁移必须逐条切换真实调用方、保留行为等价测试并删除旧写入方;移动 DTO、增加 feature 或 re-export 均不算 owner 迁移。当前仍位于 Runtime/Core 的 DeepReview 兼容逻辑只允许迁出和修复,不继续承接新的产品行为。 @@ -849,9 +850,9 @@ flowchart LR | 当前入口 | 已有能力 | 明确边界 | |---|---|---| | Desktop | 使用 `product-full`,包含 Creative Agent 与 `core.creation`;Settings 从现有来源目录和 integration policy 生成简短应用概览,具体审批与冲突仍进入 Tool、Agent、MCP 或 Hook owner | 可执行能力在事实所在 Host 运行;Safe Mode 只阻止新调用,不改来源、不取消正在运行的调用 | -| CLI / TUI | 使用 `DeliveryProfile::Cli` 和显式 Core owner closure;Runtime 只注册 Code Agent 清单及 `basic / agent / session / git / web / mcp / computer-use` 七个原子工具组,外部来源、插件和 Remote/SSH 仍由各自 owner 按入口需要装配 | 不注册 DeepReview、DeepResearch、MiniApp、Creation 或 Canvas Agent / Tool;非交互不等待权限输入,远程能力未接入时不回退本机 | +| CLI / TUI | 使用 `DeliveryProfile::Cli` 和显式 Core owner closure;Runtime 只注册 Code Agent 清单及 `basic / agent / session / git / web / mcp / computer-use` 七个原子工具组,外部来源、插件和 Remote/SSH 仍由各自 owner 按入口需要装配 | 不注册 DeepReview、DeepResearch、MiniApp、Creation 或 GenUI Agent / Tool;非交互不等待权限输入,远程能力未接入时不回退本机 | | ACP | 使用 `DeliveryProfile::Acp`、Runtime Parts、Code Agent 清单与同一组七个原子工具组,不选择 CLI 的 plugin runtime 和 Remote Connect owner | load 成功后才发布活动状态;完整历史和兼容配置仍由 Core/ACP 管理;未选择的产品工作流不得借 Cargo feature union 偶然注册 | -| SDK Host(preview) | 使用 `DeliveryProfile::Sdk`、Runtime Parts、Code Agent 清单和七个原子工具组;TLS provider 由 Host 进程入口安装 | 不注册 DeepReview、DeepResearch、MiniApp、Creation 或 Canvas;当前协议也不暴露远程 workspace/SSH,未来远程 SDK 必须复用 Server/Remote 的认证和执行域 | +| SDK Host(preview) | 使用 `DeliveryProfile::Sdk`、Runtime Parts、Code Agent 清单和七个原子工具组;TLS provider 由 Host 进程入口安装 | 不注册 DeepReview、DeepResearch、MiniApp、Creation 或 GenUI;当前协议也不暴露远程 workspace/SSH,未来远程 SDK 必须复用 Server/Remote 的认证和执行域 | | Peer / Server | Peer Host 执行真实工作区操作;通用 HTTP Server 未绑定可信 workspace owner 时明确返回不支持 | 控制端不替远端发现或执行;loopback 单用户边界不扩展到远程/多用户;SSH Remote 未接入时返回不支持 | | Web / Mobile Web | 依赖现有后端入口 | 不持有插件执行单元,也不能据空 profile 宣称独立能力 | | HarmonyOS 手机 Remote | phone-only ArkTS 远程入口 | 不等于 HarmonyOS PC 本地 Runtime、CLI/TUI 或 GUI | diff --git a/docs/architecture/theme-token-optimization.md b/docs/architecture/theme-token-optimization.md index f3a20f0180..d8a6555afc 100644 --- a/docs/architecture/theme-token-optimization.md +++ b/docs/architecture/theme-token-optimization.md @@ -58,7 +58,7 @@ Desktop bootstrap 和产品前端也不能反向定义公共主题值。 组件差异;必须在 `appearanceTokenContract.ts` 中登记。 3. **Product domain**:`--openbitfun-domain-*`。用于 Git lane、语言身份、syntax、inspector、工具类别等明确的 专用语义;不得当作普通 UI 的备用色板。 -4. **Renderer payload**:Monaco、xterm、Mermaid、OpenBitFun Canvas 等第三方或专用渲染器的显式配置。 +4. **Renderer payload**:Monaco、xterm、Mermaid、GenUI 等第三方或专用渲染器的显式配置。 它们有各自格式,不进入普通组件 CSS。 Primitive/reference 色值只存在于主题 authoring、明确的主题 preset 或专用 renderer owner 中。普通组件 diff --git a/docs/interactive-capabilities/README.md b/docs/interactive-capabilities/README.md index 2d7cc72c60..fb23b00928 100644 --- a/docs/interactive-capabilities/README.md +++ b/docs/interactive-capabilities/README.md @@ -1,9 +1,9 @@ # OpenBitFun 功能与设置目录 / OpenBitFun Features & Settings -OpenBitFun Playbook 当前包含 **22 个功能**和 **22 个设置页**,共 **44 个**用户可理解的条目、**339 项**有源码证据的子能力。每个条目有独立 Markdown,并直接服务于说明书网站、OpenBitFun 全局搜索和 `OpenBitFunControl` 智能体工具。 +OpenBitFun Playbook 当前包含 **22 个功能**和 **22 个设置页**,共 **44 个**用户可理解的条目、**333 项**有源码证据的子能力。每个条目有独立 Markdown,并直接服务于说明书网站、OpenBitFun 全局搜索和 `OpenBitFunControl` 智能体工具。 -OpenBitFun Playbook currently contains **22 features**, **22 settings pages**, and **339** source-backed sub-capabilities across **44** user-facing entries. Every entry has its own Markdown page and directly powers the website, in-app global search, and the `OpenBitFunControl` agent tool. +OpenBitFun Playbook currently contains **22 features**, **22 settings pages**, and **333** source-backed sub-capabilities across **44** user-facing entries. Every entry has its own Markdown page and directly powers the website, in-app global search, and the `OpenBitFunControl` agent tool. ## 唯一事实源 / Single source of truth @@ -27,20 +27,20 @@ OpenBitFun Playbook currently contains **22 features**, **22 settings pages**, a - Generated per-item interaction audit: `docs/interactive-capabilities/technical/product-control-open-audit.json` - Generated low-level audit map: `docs/interactive-capabilities/technical/tauri-command-map.json` -说明书、网站、搜索和智能体只看“功能 + 设置 + 子能力”。每项子能力都必须引用已注册 Tauri Command 或可解析的源码标记;这些证据不会进入公开目录。当前 **709** 个 Tauri 命令只用于实现覆盖审计。产品 UI 交互源码会在生成和检查时扫描并校验,但不会保存成随普通 UI 改动频繁变化的版本化快照。 +说明书、网站、搜索和智能体只看“功能 + 设置 + 子能力”。每项子能力都必须引用已注册 Tauri Command 或可解析的源码标记;这些证据不会进入公开目录。当前 **706** 个 Tauri 命令只用于实现覆盖审计。产品 UI 交互源码会在生成和检查时扫描并校验,但不会保存成随普通 UI 改动频繁变化的版本化快照。 -Docs, website, search, and agents see only features, settings, and documented sub-capabilities. Every sub-capability must reference a registered Tauri command or a resolvable source marker; evidence is stripped from public projections. The **709** Tauri commands remain implementation-audit evidence only. Product UI interaction sources are scanned and validated during generation and checks, but are not stored as a versioned snapshot that churns with ordinary UI changes. +Docs, website, search, and agents see only features, settings, and documented sub-capabilities. Every sub-capability must reference a registered Tauri command or a resolvable source marker; evidence is stripped from public projections. The **706** Tauri commands remain implementation-audit evidence only. Product UI interaction sources are scanned and validated during generation and checks, but are not stored as a versioned snapshot that churns with ordinary UI changes. ## 控制边界 / Control boundary -- 每个子能力都明确标记为直接控制、委托给专用智能体工具、需交互打开或不支持;“打开页面”不会再被统计成“智能体已控制”。当前覆盖:直接 **62**、委托 **72**、需交互 **205**、不支持 **0**。 +- 每个子能力都明确标记为直接控制、委托给专用智能体工具、需交互打开或不支持;“打开页面”不会再被统计成“智能体已控制”。当前覆盖:直接 **63**、委托 **70**、需交互 **200**、不支持 **0**。 - 稳定行为声明为带 JSON 输入契约的 `operations` 或 `options`,并绑定原生产品控制 Provider;智能体不接触原始 Tauri Command。 -- `OpenBitFunControl list` 和 `search` 都返回带 `nextCursor` 的精简分页结果;目录可持续增长,不靠固定总量上限。完整目录和 339 项子能力都不会写入 system prompt。 +- `OpenBitFunControl list` 和 `search` 都返回带 `nextCursor` 的精简分页结果;目录可持续增长,不靠固定总量上限。完整目录和 333 项子能力都不会写入 system prompt。 - 目录发现与契约读取不依赖 React 或可见窗口。普通配置型 option 统一由 Product Assembly 的共享 ConfigService 执行器读、写并回读,因此 Desktop、CLI 与 Headless 表面走同一份实现;只有宿主原生 operation/provider option 和界面导航按表面注册适配器,缺失时必须明确返回不可用,禁止静默回退本机。只读智能体只能发现和读取目录。 -- Every documented item is classified as direct control, delegated Agent control, interactive opening, or unsupported; opening a page is never counted as direct control. Current coverage is **62 direct**, **72 delegated**, **205 interactive**, and **0 unsupported**. +- Every documented item is classified as direct control, delegated Agent control, interactive opening, or unsupported; opening a page is never counted as direct control. Current coverage is **63 direct**, **70 delegated**, **200 interactive**, and **0 unsupported**. - Stable behavior becomes a typed `operation` or `option` with a JSON input contract and a native product-control provider. Agents never receive raw Tauri commands. -- `OpenBitFunControl list` and `search` return compact pages with a `nextCursor`; the catalog can grow without a fixed total-size ceiling. Neither the full catalog nor its 339 documented items enters the system prompt. +- `OpenBitFunControl list` and `search` return compact pages with a `nextCursor`; the catalog can grow without a fixed total-size ceiling. Neither the full catalog nor its 333 documented items enters the system prompt. - Discovery and contract lookup do not depend on React or a visible window. Ordinary config-backed options are read, written, and read back by one Product Assembly ConfigService executor shared by Desktop, CLI, and headless surfaces. Only host-native operations/provider options and presentation routes install surface adapters; missing adapters return explicit unavailability without local fallback. Read-only agents may only discover and inspect entries. ## 防腐化门禁 / Anti-drift gates diff --git a/docs/interactive-capabilities/capabilities.json b/docs/interactive-capabilities/capabilities.json index 3c7bfee1b3..0a108788e1 100644 --- a/docs/interactive-capabilities/capabilities.json +++ b/docs/interactive-capabilities/capabilities.json @@ -4,8 +4,8 @@ "title": "OpenBitFun Playbook", "origin": "https://playbook.openbitfun.com", "source": "src/shared/interactive-capabilities/catalog.json", - "digest": "6ae2eeaa19e6342f9dcf7ff33b7c0fa94547ee1c02fc1835f6f4471caab6fbb3", - "ownerDigest": "3cc6d7d869b2c90c2161494a854b5ff7eb72ea69a1a28e40ccd42065fb3382e2", + "digest": "d9509b2230b87eb48363b5d79dae72009f1e84d3007de98ee20e717ae609b0b8", + "ownerDigest": "d3fe9126806fe064f8a7ad70e6e9c72dad48eef1f45f314f537a9e48d3771908", "searchAcceptance": [ { "id": "native-image-generation", @@ -175,11 +175,11 @@ "features": 22, "settings": 22, "userFacing": 44, - "documentedItems": 339, + "documentedItems": 333, "controlCoverage": { - "direct": 62, - "delegated": 72, - "interactive": 205, + "direct": 63, + "delegated": 70, + "interactive": 200, "unsupported": 0 } }, @@ -6924,426 +6924,6 @@ "actionId": "surface.miniapps.open" } }, - { - "id": "feature.canvas:query", - "capabilityId": "feature.canvas", - "itemIds": [ - "artifact-open", - "html-react", - "inline-generative-ui", - "state", - "source-inspection", - "element-context", - "runtime-errors", - "export-html" - ], - "kind": "query", - "risk": "read", - "executionHost": "productHost", - "availability": { - "desktop": { - "available": true - }, - "cli": { - "available": true - }, - "peer": { - "available": true, - "requiredCapabilities": [ - "product_control_v1" - ] - }, - "remoteControl": { - "available": true - }, - "detachedDispatch": { - "available": true - } - }, - "inputSchema": { - "type": "object", - "additionalProperties": false - }, - "outputSchema": { - "type": "object", - "additionalProperties": true - }, - "valueSource": { - "kind": "static" - }, - "presentationTarget": { - "kind": "scene", - "sceneId": "session" - } - }, - { - "id": "feature.canvas:open:artifact-open", - "capabilityId": "feature.canvas", - "itemIds": [ - "artifact-open" - ], - "kind": "open", - "risk": "ui", - "executionHost": "presentationSurface", - "availability": { - "desktop": { - "available": true - }, - "cli": { - "available": false, - "reason": "This delivery profile has no live presentation surface" - }, - "peer": { - "available": true, - "requiredCapabilities": [ - "product_control_v1", - "product_control_presentation_v1" - ] - }, - "remoteControl": { - "available": true - }, - "detachedDispatch": { - "available": false, - "reason": "This delivery profile has no live presentation surface" - } - }, - "inputSchema": { - "type": "object", - "additionalProperties": false - }, - "outputSchema": { - "type": "object", - "additionalProperties": true - }, - "openReason": "unstructuredInteraction", - "presentationTarget": { - "kind": "scene", - "sceneId": "session" - } - }, - { - "id": "feature.canvas:delegate:html-react", - "capabilityId": "feature.canvas", - "itemIds": [ - "html-react" - ], - "kind": "delegate", - "risk": "execute", - "executionHost": "workspaceHost", - "availability": { - "desktop": { - "available": true - }, - "cli": { - "available": true - }, - "peer": { - "available": true, - "requiredCapabilities": [ - "product_control_v1" - ] - }, - "remoteControl": { - "available": true - }, - "detachedDispatch": { - "available": true - } - }, - "inputSchema": { - "type": "object", - "additionalProperties": true - }, - "outputSchema": { - "type": "object", - "additionalProperties": true - }, - "delegateTools": [ - "CreateCanvas", - "ReadCanvas", - "PatchCanvas", - "UpdateCanvas" - ], - "presentationTarget": { - "kind": "scene", - "sceneId": "session" - } - }, - { - "id": "feature.canvas:delegate:inline-generative-ui", - "capabilityId": "feature.canvas", - "itemIds": [ - "inline-generative-ui" - ], - "kind": "delegate", - "risk": "execute", - "executionHost": "workspaceHost", - "availability": { - "desktop": { - "available": true - }, - "cli": { - "available": true - }, - "peer": { - "available": true, - "requiredCapabilities": [ - "product_control_v1" - ] - }, - "remoteControl": { - "available": true - }, - "detachedDispatch": { - "available": true - } - }, - "inputSchema": { - "type": "object", - "additionalProperties": true - }, - "outputSchema": { - "type": "object", - "additionalProperties": true - }, - "delegateTools": [ - "GenerativeUI" - ], - "presentationTarget": { - "kind": "scene", - "sceneId": "session" - } - }, - { - "id": "feature.canvas:open:state", - "capabilityId": "feature.canvas", - "itemIds": [ - "state" - ], - "kind": "open", - "risk": "ui", - "executionHost": "presentationSurface", - "availability": { - "desktop": { - "available": true - }, - "cli": { - "available": false, - "reason": "This delivery profile has no live presentation surface" - }, - "peer": { - "available": true, - "requiredCapabilities": [ - "product_control_v1", - "product_control_presentation_v1" - ] - }, - "remoteControl": { - "available": true - }, - "detachedDispatch": { - "available": false, - "reason": "This delivery profile has no live presentation surface" - } - }, - "inputSchema": { - "type": "object", - "additionalProperties": false - }, - "outputSchema": { - "type": "object", - "additionalProperties": true - }, - "openReason": "unstructuredInteraction", - "presentationTarget": { - "kind": "scene", - "sceneId": "session" - } - }, - { - "id": "feature.canvas:delegate:source-inspection", - "capabilityId": "feature.canvas", - "itemIds": [ - "source-inspection" - ], - "kind": "delegate", - "risk": "execute", - "executionHost": "workspaceHost", - "availability": { - "desktop": { - "available": true - }, - "cli": { - "available": true - }, - "peer": { - "available": true, - "requiredCapabilities": [ - "product_control_v1" - ] - }, - "remoteControl": { - "available": true - }, - "detachedDispatch": { - "available": true - } - }, - "inputSchema": { - "type": "object", - "additionalProperties": true - }, - "outputSchema": { - "type": "object", - "additionalProperties": true - }, - "delegateTools": [ - "ReadCanvas" - ], - "presentationTarget": { - "kind": "scene", - "sceneId": "session" - } - }, - { - "id": "feature.canvas:open:element-context", - "capabilityId": "feature.canvas", - "itemIds": [ - "element-context" - ], - "kind": "open", - "risk": "ui", - "executionHost": "presentationSurface", - "availability": { - "desktop": { - "available": true - }, - "cli": { - "available": false, - "reason": "This delivery profile has no live presentation surface" - }, - "peer": { - "available": true, - "requiredCapabilities": [ - "product_control_v1", - "product_control_presentation_v1" - ] - }, - "remoteControl": { - "available": true - }, - "detachedDispatch": { - "available": false, - "reason": "This delivery profile has no live presentation surface" - } - }, - "inputSchema": { - "type": "object", - "additionalProperties": false - }, - "outputSchema": { - "type": "object", - "additionalProperties": true - }, - "openReason": "unstructuredInteraction", - "presentationTarget": { - "kind": "scene", - "sceneId": "session" - } - }, - { - "id": "feature.canvas:open:runtime-errors", - "capabilityId": "feature.canvas", - "itemIds": [ - "runtime-errors" - ], - "kind": "open", - "risk": "ui", - "executionHost": "presentationSurface", - "availability": { - "desktop": { - "available": true - }, - "cli": { - "available": false, - "reason": "This delivery profile has no live presentation surface" - }, - "peer": { - "available": true, - "requiredCapabilities": [ - "product_control_v1", - "product_control_presentation_v1" - ] - }, - "remoteControl": { - "available": true - }, - "detachedDispatch": { - "available": false, - "reason": "This delivery profile has no live presentation surface" - } - }, - "inputSchema": { - "type": "object", - "additionalProperties": false - }, - "outputSchema": { - "type": "object", - "additionalProperties": true - }, - "openReason": "unstructuredInteraction", - "presentationTarget": { - "kind": "scene", - "sceneId": "session" - } - }, - { - "id": "feature.canvas:open:export-html", - "capabilityId": "feature.canvas", - "itemIds": [ - "export-html" - ], - "kind": "open", - "risk": "ui", - "executionHost": "presentationSurface", - "availability": { - "desktop": { - "available": true - }, - "cli": { - "available": false, - "reason": "This delivery profile has no live presentation surface" - }, - "peer": { - "available": true, - "requiredCapabilities": [ - "product_control_v1", - "product_control_presentation_v1" - ] - }, - "remoteControl": { - "available": true - }, - "detachedDispatch": { - "available": false, - "reason": "This delivery profile has no live presentation surface" - } - }, - "inputSchema": { - "type": "object", - "additionalProperties": false - }, - "outputSchema": { - "type": "object", - "additionalProperties": true - }, - "openReason": "unstructuredInteraction", - "presentationTarget": { - "kind": "scene", - "sceneId": "session" - } - }, { "id": "feature.tasks-automation:query", "capabilityId": "feature.tasks-automation", @@ -16809,7 +16389,8 @@ "computer-use-permissions", "browser-auto-connect", "browser-setup", - "json-repair" + "json-repair", + "genui-library" ], "kind": "query", "risk": "read", @@ -17264,10 +16845,54 @@ } }, { - "id": "setting.tools.execution:option:tool-json-repair", + "id": "setting.tools.execution:option:tool-json-repair", + "capabilityId": "setting.tools.execution", + "itemIds": [ + "json-repair" + ], + "kind": "option", + "risk": "write", + "executionHost": "productHost", + "availability": { + "desktop": { + "available": true + }, + "cli": { + "available": true + }, + "peer": { + "available": true, + "requiredCapabilities": [ + "product_control_v1" + ] + }, + "remoteControl": { + "available": true + }, + "detachedDispatch": { + "available": true + } + }, + "inputSchema": { + "type": "boolean" + }, + "outputSchema": { + "type": "object", + "additionalProperties": true + }, + "valueSource": { + "kind": "static" + }, + "presentationTarget": { + "kind": "settings", + "pageId": "tools.execution" + } + }, + { + "id": "setting.tools.execution:option:genui-library", "capabilityId": "setting.tools.execution", "itemIds": [ - "json-repair" + "genui-library" ], "kind": "option", "risk": "write", @@ -17293,7 +16918,12 @@ } }, "inputSchema": { - "type": "boolean" + "type": "string", + "enum": [ + "harmony", + "openbitfun", + "openui" + ] }, "outputSchema": { "type": "object", @@ -20749,6 +20379,96 @@ "kind": "settings", "pageId": "data.diagnostics" } + }, + { + "id": "feature.generative-ui:query", + "capabilityId": "feature.generative-ui", + "itemIds": [ + "app-generation" + ], + "kind": "query", + "risk": "read", + "executionHost": "productHost", + "availability": { + "desktop": { + "available": true + }, + "cli": { + "available": true + }, + "peer": { + "available": true, + "requiredCapabilities": [ + "product_control_v1" + ] + }, + "remoteControl": { + "available": true + }, + "detachedDispatch": { + "available": true + } + }, + "inputSchema": { + "type": "object", + "additionalProperties": false + }, + "outputSchema": { + "type": "object", + "additionalProperties": true + }, + "valueSource": { + "kind": "static" + }, + "presentationTarget": { + "kind": "scene", + "sceneId": "session" + } + }, + { + "id": "feature.generative-ui:delegate:app-generation", + "capabilityId": "feature.generative-ui", + "itemIds": [ + "app-generation" + ], + "kind": "delegate", + "risk": "execute", + "executionHost": "workspaceHost", + "availability": { + "desktop": { + "available": true + }, + "cli": { + "available": true + }, + "peer": { + "available": true, + "requiredCapabilities": [ + "product_control_v1" + ] + }, + "remoteControl": { + "available": true + }, + "detachedDispatch": { + "available": true + } + }, + "inputSchema": { + "type": "object", + "additionalProperties": true + }, + "outputSchema": { + "type": "object", + "additionalProperties": true + }, + "delegateTools": [ + "GenerativeUI" + ], + "presentationTarget": { + "kind": "scene", + "sceneId": "session" + } } ], "capabilities": [ @@ -24423,237 +24143,6 @@ ], "docsUrl": "https://playbook.openbitfun.com/capabilities/feature.miniapps/" }, - { - "id": "feature.canvas", - "kind": "feature", - "categoryId": "automation", - "titleZh": "Canvas 与交互产物", - "titleEn": "Canvas & interactive artifacts", - "summaryZh": "在会话旁展示和保存智能体生成的可视化、交互页面与结构化产物。", - "summaryEn": "Display and save visualizations, interactive pages, and structured artifacts generated beside a session.", - "keywordsZh": [ - "Canvas", - "画布", - "可视化", - "交互产物", - "Artifact" - ], - "keywordsEn": [ - "canvas", - "visualization", - "interactive artifact", - "artifact", - "preview" - ], - "highlightsZh": [ - "在会话中打开交互内容", - "保留画布状态", - "在面板中查看运行错误" - ], - "highlightsEn": [ - "Open interactive content from a session", - "Persist canvas state", - "Inspect runtime errors in the panel" - ], - "items": [ - { - "id": "artifact-open", - "titleZh": "从会话工具结果加载并打开持久化 Canvas 产物", - "titleEn": "Load and open persistent Canvas artifacts from session tool results", - "control": { - "kind": "open", - "reasonCode": "unstructuredInteraction", - "reasonZh": "“从会话工具结果加载并打开持久化 Canvas 产物”由多个实时状态相关步骤组成,目前没有一个能确定完成整个流程的单一结构化 Command;智能体会打开精确入口,并把后续交互保留在用户可见界面。", - "reasonEn": "“Load and open persistent Canvas artifacts from session tool results” spans multiple live-state-dependent steps and currently has no single structured Command that can deterministically complete the whole workflow; the Agent opens the exact entry and keeps the remaining interaction visible to the user." - } - }, - { - "id": "html-react", - "titleZh": "渲染并持续编辑 HTML 或 React 交互界面、图表和可视化", - "titleEn": "Render and iteratively edit HTML or React interfaces, charts, and interactive visualizations", - "control": { - "kind": "delegate", - "tools": [ - "CreateCanvas", - "ReadCanvas", - "PatchCanvas", - "UpdateCanvas" - ], - "workflowZh": [ - "用 CreateCanvas 提交单文件 TSX,并仅从 openbitfun/canvas 导入允许的运行时组件", - "保留返回的 openbitfun-canvas 引用,先 ReadCanvas 获取当前版本,再用 PatchCanvas 做局部改动或 UpdateCanvas 完整更新" - ], - "workflowEn": [ - "Use CreateCanvas with a single TSX file and import runtime components only from openbitfun/canvas", - "Keep the returned openbitfun-canvas reference, inspect it with ReadCanvas, then use PatchCanvas for focused changes or UpdateCanvas for a full update" - ] - } - }, - { - "id": "inline-generative-ui", - "titleZh": "在会话中生成紧凑的 HTML/SVG 图表、说明器或交互组件", - "titleEn": "Generate compact HTML/SVG charts, explainers, or interactive widgets inline in a session", - "control": { - "kind": "delegate", - "tools": [ - "GenerativeUI" - ], - "workflowZh": [ - "仅在可视化或交互能明显帮助理解时使用 GenerativeUI,并输出紧凑、自包含且适配明暗外观的组件", - "需要持久编辑或独立产物时改用 Canvas;纯文本足够时不创建组件" - ], - "workflowEn": [ - "Use GenerativeUI only when visualization or interaction materially improves understanding, producing a compact self-contained widget that supports light and dark appearances", - "Use Canvas for persistent editable artifacts, and skip widget generation when text is sufficient" - ] - } - }, - { - "id": "state", - "titleZh": "在重新打开或刷新 Canvas 时加载和保存交互状态", - "titleEn": "Load and save interactive state when a Canvas is reopened or refreshed", - "control": { - "kind": "open", - "reasonCode": "unstructuredInteraction", - "reasonZh": "“在重新打开或刷新 Canvas 时加载和保存交互状态”由多个实时状态相关步骤组成,目前没有一个能确定完成整个流程的单一结构化 Command;智能体会打开精确入口,并把后续交互保留在用户可见界面。", - "reasonEn": "“Load and save interactive state when a Canvas is reopened or refreshed” spans multiple live-state-dependent steps and currently has no single structured Command that can deterministically complete the whole workflow; the Agent opens the exact entry and keeps the remaining interaction visible to the user." - } - }, - { - "id": "source-inspection", - "titleZh": "查看 Canvas 源码、编译版本和最后可用版本", - "titleEn": "Inspect Canvas source, compiled revisions, and the last known good revision", - "control": { - "kind": "delegate", - "tools": [ - "ReadCanvas" - ], - "workflowZh": [ - "用 ReadCanvas 按 artifact_reference 或 canvas_id 读取源码、状态、诊断与编译信息" - ], - "workflowEn": [ - "Use ReadCanvas with artifact_reference or canvas_id to inspect source, status, diagnostics, and compiled information" - ] - } - }, - { - "id": "element-context", - "titleZh": "选择 Canvas 内的元素并把元素引用加入会话上下文", - "titleEn": "Select an element inside Canvas and add its reference to session context", - "control": { - "kind": "open", - "reasonCode": "unstructuredInteraction", - "reasonZh": "“选择 Canvas 内的元素并把元素引用加入会话上下文”由多个实时状态相关步骤组成,目前没有一个能确定完成整个流程的单一结构化 Command;智能体会打开精确入口,并把后续交互保留在用户可见界面。", - "reasonEn": "“Select an element inside Canvas and add its reference to session context” spans multiple live-state-dependent steps and currently has no single structured Command that can deterministically complete the whole workflow; the Agent opens the exact entry and keeps the remaining interaction visible to the user." - } - }, - { - "id": "runtime-errors", - "titleZh": "捕获运行错误、上报诊断并请求智能体自动修复", - "titleEn": "Capture runtime errors, report diagnostics, and ask the agent to repair them", - "control": { - "kind": "open", - "reasonCode": "unstructuredInteraction", - "reasonZh": "“捕获运行错误、上报诊断并请求智能体自动修复”由多个实时状态相关步骤组成,目前没有一个能确定完成整个流程的单一结构化 Command;智能体会打开精确入口,并把后续交互保留在用户可见界面。", - "reasonEn": "“Capture runtime errors, report diagnostics, and ask the agent to repair them” spans multiple live-state-dependent steps and currently has no single structured Command that can deterministically complete the whole workflow; the Agent opens the exact entry and keeps the remaining interaction visible to the user." - } - }, - { - "id": "export-html", - "titleZh": "把当前 Canvas 导出为可独立打开的 HTML 文件", - "titleEn": "Export the current Canvas as a standalone HTML file", - "control": { - "kind": "open", - "reasonCode": "unstructuredInteraction", - "reasonZh": "“把当前 Canvas 导出为可独立打开的 HTML 文件”由多个实时状态相关步骤组成,目前没有一个能确定完成整个流程的单一结构化 Command;智能体会打开精确入口,并把后续交互保留在用户可见界面。", - "reasonEn": "“Export the current Canvas as a standalone HTML file” spans multiple live-state-dependent steps and currently has no single structured Command that can deterministically complete the whole workflow; the Agent opens the exact entry and keeps the remaining interaction visible to the user." - } - } - ], - "stepsZh": [ - "打开一个 AI 会话", - "让智能体创建可视化或交互工具", - "从工具结果打开 Canvas" - ], - "stepsEn": [ - "Open an AI session", - "Ask the agent for a visualization or interactive tool", - "Open the Canvas from the tool result" - ], - "agentExamplesZh": [ - "打开 AI 助手,我想做一个交互可视化", - "创建一个可交互的 Canvas" - ], - "agentExamplesEn": [ - "Open the AI assistant; I want an interactive visualization", - "Create an interactive Canvas" - ], - "destination": { - "kind": "scene", - "sceneId": "session" - }, - "operations": [], - "options": [], - "searchTerms": [ - "feature.canvas", - "Canvas 与交互产物", - "Canvas & interactive artifacts", - "扩展与自动化", - "Extensions & automation", - "Canvas", - "画布", - "可视化", - "交互产物", - "Artifact", - "canvas", - "visualization", - "interactive artifact", - "artifact", - "preview", - "在会话中打开交互内容", - "保留画布状态", - "在面板中查看运行错误", - "Open interactive content from a session", - "Persist canvas state", - "Inspect runtime errors in the panel", - "从会话工具结果加载并打开持久化 Canvas 产物", - "Load and open persistent Canvas artifacts from session tool results", - "渲染并持续编辑 HTML 或 React 交互界面、图表和可视化", - "Render and iteratively edit HTML or React interfaces, charts, and interactive visualizations", - "在会话中生成紧凑的 HTML/SVG 图表、说明器或交互组件", - "Generate compact HTML/SVG charts, explainers, or interactive widgets inline in a session", - "在重新打开或刷新 Canvas 时加载和保存交互状态", - "Load and save interactive state when a Canvas is reopened or refreshed", - "查看 Canvas 源码、编译版本和最后可用版本", - "Inspect Canvas source, compiled revisions, and the last known good revision", - "选择 Canvas 内的元素并把元素引用加入会话上下文", - "Select an element inside Canvas and add its reference to session context", - "捕获运行错误、上报诊断并请求智能体自动修复", - "Capture runtime errors, report diagnostics, and ask the agent to repair them", - "把当前 Canvas 导出为可独立打开的 HTML 文件", - "Export the current Canvas as a standalone HTML file", - "打开 AI 助手,我想做一个交互可视化", - "创建一个可交互的 Canvas", - "Open the AI assistant; I want an interactive visualization", - "Create an interactive Canvas", - "CreateCanvas", - "ReadCanvas", - "PatchCanvas", - "UpdateCanvas", - "用 CreateCanvas 提交单文件 TSX,并仅从 openbitfun/canvas 导入允许的运行时组件", - "保留返回的 openbitfun-canvas 引用,先 ReadCanvas 获取当前版本,再用 PatchCanvas 做局部改动或 UpdateCanvas 完整更新", - "Use CreateCanvas with a single TSX file and import runtime components only from openbitfun/canvas", - "Keep the returned openbitfun-canvas reference, inspect it with ReadCanvas, then use PatchCanvas for focused changes or UpdateCanvas for a full update", - "GenerativeUI", - "仅在可视化或交互能明显帮助理解时使用 GenerativeUI,并输出紧凑、自包含且适配明暗外观的组件", - "需要持久编辑或独立产物时改用 Canvas;纯文本足够时不创建组件", - "Use GenerativeUI only when visualization or interaction materially improves understanding, producing a compact self-contained widget that supports light and dark appearances", - "Use Canvas for persistent editable artifacts, and skip widget generation when text is sufficient", - "用 ReadCanvas 按 artifact_reference 或 canvas_id 读取源码、状态、诊断与编译信息", - "Use ReadCanvas with artifact_reference or canvas_id to inspect source, status, diagnostics, and compiled information" - ], - "docsUrl": "https://playbook.openbitfun.com/capabilities/feature.canvas/" - }, { "id": "feature.tasks-automation", "kind": "feature", @@ -30375,6 +29864,25 @@ } ] } + }, + { + "id": "genui-library", + "titleZh": "选择生成式 UI 组件库及关联 UI 规范并操作预览", + "titleEn": "Select a GenUI component library, its UI specification and preview", + "destination": { + "kind": "settings", + "pageId": "tools.execution", + "viewId": "advanced" + }, + "control": { + "kind": "direct", + "operations": [], + "options": [ + { + "id": "genui-library" + } + ] + } } ], "stepsZh": [ @@ -30519,6 +30027,21 @@ "valueSchema": { "type": "boolean" } + }, + { + "id": "genui-library", + "titleZh": "生成式 UI 组件库及 UI 规范", + "titleEn": "GenUI component library and UI specification", + "descriptionZh": "选择后续生成使用的组件库及其关联的设计规则、资源、视口、宿主外壳和验收检查;已有应用保留自己的目标身份。", + "descriptionEn": "Choose the component library and its bound design rules, resources, viewport, host shell and acceptance checks. Existing apps retain their target identity.", + "valueSchema": { + "type": "string", + "enum": [ + "harmony", + "openbitfun", + "openui" + ] + } } ], "searchTerms": [ @@ -30583,6 +30106,8 @@ "Discover and choose a browser, configure default CDP, or restart it when needed", "控制是否在安全边界内修复模型生成的非法工具参数 JSON", "Choose whether malformed model-generated tool-argument JSON may be repaired within safety boundaries", + "选择生成式 UI 组件库及关联 UI 规范并操作预览", + "Select a GenUI component library, its UI specification and preview", "启用 Computer Use", "把子智能体最大并发改为 8", "打开权限设置", @@ -32607,6 +32132,138 @@ "Take me to export a diagnostic bundle" ], "docsUrl": "https://playbook.openbitfun.com/capabilities/setting.data.diagnostics/" + }, + { + "id": "feature.generative-ui", + "kind": "feature", + "categoryId": "automation", + "titleZh": "Generative UI 生成式界面", + "titleEn": "Generative UI", + "summaryZh": "由智能体按组件库及关联 UI 规范生成 OpenUI 组件应用或 HTML/CSS/SVG 自由文档,经目标视口实际渲染、宿主验收与需求复核后接受并保存。", + "summaryEn": "Generate OpenUI component apps or free HTML/CSS/SVG documents under a bound UI specification; accept and persist only after target-viewport rendering, host checks and requirement review.", + "keywordsZh": [ + "Generative UI", + "生成式界面", + "交互应用", + "宿主组件", + "应用状态" + ], + "keywordsEn": [ + "generative UI", + "interactive app", + "component contracts", + "application state", + "structured widget" + ], + "highlightsZh": [ + "按组件库及其 UI 规范的设计规则、资源、视口和宿主外壳约束生成结果", + "组件路径使用 OpenUI 描述和可信 renderer;自由路径保留 HTML/CSS/SVG", + "支持生成、交互、保存和重开", + "实际挂载、交互、保存重开与需求审查通过后接受候选", + "可注册自定义宿主组件" + ], + "highlightsEn": [ + "Constrain generated results with the selected library's UI rules, resources, viewport and host shell", + "Use OpenUI descriptions and trusted renderers for components; retain HTML/CSS/SVG for free documents", + "Support generation, interaction, save and reopen", + "Accept candidates after mounted interaction, durable reopen and requirement checks", + "Register custom host components" + ], + "items": [ + { + "id": "app-generation", + "titleZh": "生成可交互的 GenUI 应用并由宿主渲染", + "titleEn": "Generate interactive GenUI applications rendered by the host", + "control": { + "kind": "delegate", + "tools": [ + "GenerativeUI" + ], + "workflowZh": [ + "按所选 UI 规范选择 OpenUI 组件描述或 HTML/CSS/SVG 自由文档;规范身份随候选固定。", + "宿主在目标视口实际渲染并执行布局、外壳、保存重开和需求检查;失败诊断返回原生成流程。", + "候选与已接受版本分离,状态由会话所属宿主持久化,使用版本校验避免并发覆盖。" + ], + "workflowEn": [ + "Use OpenUI descriptions or free HTML/CSS/SVG under the selected UI specification; pin that identity to the candidate.", + "Render in the target viewport and run shell, layout, save/reopen and requirement checks on every candidate; return diagnostics to generation on failure.", + "Separate candidates from accepted revisions and persist state on the session owner using version checks to prevent concurrent overwrite." + ] + } + } + ], + "stepsZh": [ + "打开 AI 会话", + "让智能体生成一个 GenUI 应用", + "在宿主中完成交互并保存,随后重开应用" + ], + "stepsEn": [ + "Open an AI session", + "Ask the agent to generate a GenUI application", + "Interact and save it in the host, then reopen the application" + ], + "agentExamplesZh": [ + "生成一个可保存的记账应用", + "生成一个带预算设置和支出汇总的 dashboard 应用", + "生成一个阅读目录并支持收藏", + "生成一个带完成状态的日计划" + ], + "agentExamplesEn": [ + "Generate a saveable accounting app", + "Generate a dashboard with budget settings and an expense summary", + "Generate a reading catalog with favorites", + "Generate a daily plan with completion state" + ], + "destination": { + "kind": "scene", + "sceneId": "session" + }, + "operations": [], + "options": [], + "searchTerms": [ + "feature.generative-ui", + "Generative UI 生成式界面", + "Generative UI", + "扩展与自动化", + "Extensions & automation", + "生成式界面", + "交互应用", + "宿主组件", + "应用状态", + "generative UI", + "interactive app", + "component contracts", + "application state", + "structured widget", + "按组件库及其 UI 规范的设计规则、资源、视口和宿主外壳约束生成结果", + "组件路径使用 OpenUI 描述和可信 renderer;自由路径保留 HTML/CSS/SVG", + "支持生成、交互、保存和重开", + "实际挂载、交互、保存重开与需求审查通过后接受候选", + "可注册自定义宿主组件", + "Constrain generated results with the selected library's UI rules, resources, viewport and host shell", + "Use OpenUI descriptions and trusted renderers for components; retain HTML/CSS/SVG for free documents", + "Support generation, interaction, save and reopen", + "Accept candidates after mounted interaction, durable reopen and requirement checks", + "Register custom host components", + "生成可交互的 GenUI 应用并由宿主渲染", + "Generate interactive GenUI applications rendered by the host", + "生成一个可保存的记账应用", + "生成一个带预算设置和支出汇总的 dashboard 应用", + "生成一个阅读目录并支持收藏", + "生成一个带完成状态的日计划", + "Generate a saveable accounting app", + "Generate a dashboard with budget settings and an expense summary", + "Generate a reading catalog with favorites", + "Generate a daily plan with completion state", + "GenerativeUI", + "按所选 UI 规范选择 OpenUI 组件描述或 HTML/CSS/SVG 自由文档;规范身份随候选固定。", + "宿主在目标视口实际渲染并执行布局、外壳、保存重开和需求检查;失败诊断返回原生成流程。", + "候选与已接受版本分离,状态由会话所属宿主持久化,使用版本校验避免并发覆盖。", + "Use OpenUI descriptions or free HTML/CSS/SVG under the selected UI specification; pin that identity to the candidate.", + "Render in the target viewport and run shell, layout, save/reopen and requirement checks on every candidate; return diagnostics to generation on failure.", + "Separate candidates from accepted revisions and persist state on the session owner using version checks to prevent concurrent overwrite." + ], + "docsUrl": "https://playbook.openbitfun.com/capabilities/feature.generative-ui/" } ] } diff --git a/docs/interactive-capabilities/capabilities/feature.canvas.md b/docs/interactive-capabilities/capabilities/feature.canvas.md deleted file mode 100644 index 83628ad7c8..0000000000 --- a/docs/interactive-capabilities/capabilities/feature.canvas.md +++ /dev/null @@ -1,69 +0,0 @@ - ---- -id: feature.canvas -kind: feature -category: automation -title_zh: "Canvas 与交互产物" -title_en: "Canvas & interactive artifacts" ---- - -# Canvas 与交互产物 / Canvas & interactive artifacts - -> 功能 / Feature - -在会话旁展示和保存智能体生成的可视化、交互页面与结构化产物。 - -Display and save visualizations, interactive pages, and structured artifacts generated beside a session. - -## 完整功能清单 / Everything included - -- **智能体可定位入口,需交互完成 / Agent opens; interaction required** · 从会话工具结果加载并打开持久化 Canvas 产物 - - Load and open persistent Canvas artifacts from session tool results -- **由专用智能体工具控制 / Delegated Agent tool** · `CreateCanvas` / `ReadCanvas` / `PatchCanvas` / `UpdateCanvas` · 渲染并持续编辑 HTML 或 React 交互界面、图表和可视化 - - Render and iteratively edit HTML or React interfaces, charts, and interactive visualizations -- **由专用智能体工具控制 / Delegated Agent tool** · `GenerativeUI` · 在会话中生成紧凑的 HTML/SVG 图表、说明器或交互组件 - - Generate compact HTML/SVG charts, explainers, or interactive widgets inline in a session -- **智能体可定位入口,需交互完成 / Agent opens; interaction required** · 在重新打开或刷新 Canvas 时加载和保存交互状态 - - Load and save interactive state when a Canvas is reopened or refreshed -- **由专用智能体工具控制 / Delegated Agent tool** · `ReadCanvas` · 查看 Canvas 源码、编译版本和最后可用版本 - - Inspect Canvas source, compiled revisions, and the last known good revision -- **智能体可定位入口,需交互完成 / Agent opens; interaction required** · 选择 Canvas 内的元素并把元素引用加入会话上下文 - - Select an element inside Canvas and add its reference to session context -- **智能体可定位入口,需交互完成 / Agent opens; interaction required** · 捕获运行错误、上报诊断并请求智能体自动修复 - - Capture runtime errors, report diagnostics, and ask the agent to repair them -- **智能体可定位入口,需交互完成 / Agent opens; interaction required** · 把当前 Canvas 导出为可独立打开的 HTML 文件 - - Export the current Canvas as a standalone HTML file - -## 怎么用 / How to use it - -1. 打开一个 AI 会话 - Open an AI session -2. 让智能体创建可视化或交互工具 - Ask the agent for a visualization or interactive tool -3. 从工具结果打开 Canvas - Open the Canvas from the tool result - -入口 / Entry: OpenBitFun 对应场景 - -## 智能体可替你做什么 / What an agent can do for you - -| 操作 / Action | 中文说明 | English description | -| --- | --- | --- | -| 打开对应界面 / Open the UI | 进入 OpenBitFun 中对应的功能界面。 | Open the matching feature in OpenBitFun. | - -## 可配置选项 / Configurable options - -| 选项 / Option | 可用值 / Values | 中文说明 | English description | -| --- | --- | --- | --- | -| 在界面中配置 / Configure in the UI | — | 此页面的设置在对应界面中完成。 | Configure this page in its matching UI. | - -## 可以直接对智能体说 / Try saying - -- “打开 AI 助手,我想做一个交互可视化” - - “Open the AI assistant; I want an interactive visualization” -- “创建一个可交互的 Canvas” - - “Create an interactive Canvas” - -智能体会先查找相关功能或设置,确认目标后再替你打开、执行或修改。完整能力目录不会预先塞进对话上下文。 - -The agent first finds the relevant feature or setting, confirms the target, and then opens, runs, or changes it for you. The full catalog is never embedded in the conversation context. diff --git a/docs/interactive-capabilities/capabilities/feature.generative-ui.md b/docs/interactive-capabilities/capabilities/feature.generative-ui.md new file mode 100644 index 0000000000..ea90305bee --- /dev/null +++ b/docs/interactive-capabilities/capabilities/feature.generative-ui.md @@ -0,0 +1,59 @@ + +--- +id: feature.generative-ui +kind: feature +category: automation +title_zh: "Generative UI 生成式界面" +title_en: "Generative UI" +--- + +# Generative UI 生成式界面 / Generative UI + +> 功能 / Feature + +由智能体按组件库及关联 UI 规范生成 OpenUI 组件应用或 HTML/CSS/SVG 自由文档,经目标视口实际渲染、宿主验收与需求复核后接受并保存。 + +Generate OpenUI component apps or free HTML/CSS/SVG documents under a bound UI specification; accept and persist only after target-viewport rendering, host checks and requirement review. + +## 完整功能清单 / Everything included + +- **由专用智能体工具控制 / Delegated Agent tool** · `GenerativeUI` · 生成可交互的 GenUI 应用并由宿主渲染 + - Generate interactive GenUI applications rendered by the host + +## 怎么用 / How to use it + +1. 打开 AI 会话 + Open an AI session +2. 让智能体生成一个 GenUI 应用 + Ask the agent to generate a GenUI application +3. 在宿主中完成交互并保存,随后重开应用 + Interact and save it in the host, then reopen the application + +入口 / Entry: OpenBitFun 对应场景 + +## 智能体可替你做什么 / What an agent can do for you + +| 操作 / Action | 中文说明 | English description | +| --- | --- | --- | +| 打开对应界面 / Open the UI | 进入 OpenBitFun 中对应的功能界面。 | Open the matching feature in OpenBitFun. | + +## 可配置选项 / Configurable options + +| 选项 / Option | 可用值 / Values | 中文说明 | English description | +| --- | --- | --- | --- | +| 在界面中配置 / Configure in the UI | — | 此页面的设置在对应界面中完成。 | Configure this page in its matching UI. | + +## 可以直接对智能体说 / Try saying + +- “生成一个可保存的记账应用” + - “Generate a saveable accounting app” +- “生成一个带预算设置和支出汇总的 dashboard 应用” + - “Generate a dashboard with budget settings and an expense summary” +- “生成一个阅读目录并支持收藏” + - “Generate a reading catalog with favorites” +- “生成一个带完成状态的日计划” + - “Generate a daily plan with completion state” + +智能体会先查找相关功能或设置,确认目标后再替你打开、执行或修改。完整能力目录不会预先塞进对话上下文。 + +The agent first finds the relevant feature or setting, confirms the target, and then opens, runs, or changes it for you. The full catalog is never embedded in the conversation context. diff --git a/docs/interactive-capabilities/capabilities/setting.tools.execution.md b/docs/interactive-capabilities/capabilities/setting.tools.execution.md index b83f1db61c..d26fc8a295 100644 --- a/docs/interactive-capabilities/capabilities/setting.tools.execution.md +++ b/docs/interactive-capabilities/capabilities/setting.tools.execution.md @@ -45,6 +45,8 @@ Manage agent tool permissions, presentation mode, concurrency, timeouts, deferre - Discover and choose a browser, configure default CDP, or restart it when needed - **智能体可直接控制 / Direct Agent control** · 控制是否在安全边界内修复模型生成的非法工具参数 JSON - Choose whether malformed model-generated tool-argument JSON may be repaired within safety boundaries +- **智能体可直接控制 / Direct Agent control** · 选择生成式 UI 组件库及关联 UI 规范并操作预览 + - Select a GenUI component library, its UI specification and preview ## 怎么用 / How to use it @@ -77,6 +79,7 @@ Manage agent tool permissions, presentation mode, concurrency, timeouts, deferre | Computer Use 桌面控制 / Computer Use | `boolean` | 允许智能体使用已授权的桌面控制能力。 | Allow agents to use authorized desktop-control capabilities. | | 启动时连接浏览器 / Connect browser on startup | `boolean` | OpenBitFun 启动后自动尝试连接浏览器控制。 | Automatically try to connect browser control after OpenBitFun starts. | | 工具参数 JSON 修复 / Tool-argument JSON repair | `boolean` | 允许在安全边界内修复模型生成的轻微 JSON 格式错误。 | Allow minor model-generated JSON formatting errors to be repaired within the safety boundary. | +| 生成式 UI 组件库及 UI 规范 / GenUI component library and UI specification | `harmony` / `openbitfun` / `openui` | 选择后续生成使用的组件库及其关联的设计规则、资源、视口、宿主外壳和验收检查;已有应用保留自己的目标身份。 | Choose the component library and its bound design rules, resources, viewport, host shell and acceptance checks. Existing apps retain their target identity. | ## 可以直接对智能体说 / Try saying diff --git a/docs/interactive-capabilities/technical/product-control-open-audit.json b/docs/interactive-capabilities/technical/product-control-open-audit.json index cd61df7f2a..3d4bddb72a 100644 --- a/docs/interactive-capabilities/technical/product-control-open-audit.json +++ b/docs/interactive-capabilities/technical/product-control-open-audit.json @@ -1,12 +1,12 @@ { "schemaVersion": 1, "generatedFrom": "src/shared/interactive-capabilities/catalog.json", - "catalogDigest": "6ae2eeaa19e6342f9dcf7ff33b7c0fa94547ee1c02fc1835f6f4471caab6fbb3", - "count": 205, + "catalogDigest": "d9509b2230b87eb48363b5d79dae72009f1e84d3007de98ee20e717ae609b0b8", + "count": 200, "reasonCounts": { "externalAuth": 4, "secretEntry": 5, - "unstructuredInteraction": 170, + "unstructuredInteraction": 165, "visualSelection": 26 }, "entries": [ @@ -1374,88 +1374,6 @@ "command:miniapp_render_slide_page" ] }, - { - "capabilityId": "feature.canvas", - "itemId": "artifact-open", - "titleZh": "从会话工具结果加载并打开持久化 Canvas 产物", - "titleEn": "Load and open persistent Canvas artifacts from session tool results", - "reasonCode": "unstructuredInteraction", - "reasonZh": "“从会话工具结果加载并打开持久化 Canvas 产物”由多个实时状态相关步骤组成,目前没有一个能确定完成整个流程的单一结构化 Command;智能体会打开精确入口,并把后续交互保留在用户可见界面。", - "reasonEn": "“Load and open persistent Canvas artifacts from session tool results” spans multiple live-state-dependent steps and currently has no single structured Command that can deterministically complete the whole workflow; the Agent opens the exact entry and keeps the remaining interaction visible to the user.", - "presentationTarget": { - "kind": "scene", - "sceneId": "session" - }, - "evidence": [ - "command:load_canvas_artifact" - ] - }, - { - "capabilityId": "feature.canvas", - "itemId": "state", - "titleZh": "在重新打开或刷新 Canvas 时加载和保存交互状态", - "titleEn": "Load and save interactive state when a Canvas is reopened or refreshed", - "reasonCode": "unstructuredInteraction", - "reasonZh": "“在重新打开或刷新 Canvas 时加载和保存交互状态”由多个实时状态相关步骤组成,目前没有一个能确定完成整个流程的单一结构化 Command;智能体会打开精确入口,并把后续交互保留在用户可见界面。", - "reasonEn": "“Load and save interactive state when a Canvas is reopened or refreshed” spans multiple live-state-dependent steps and currently has no single structured Command that can deterministically complete the whole workflow; the Agent opens the exact entry and keeps the remaining interaction visible to the user.", - "presentationTarget": { - "kind": "scene", - "sceneId": "session" - }, - "evidence": [ - "command:load_canvas_state", - "command:save_canvas_state" - ] - }, - { - "capabilityId": "feature.canvas", - "itemId": "element-context", - "titleZh": "选择 Canvas 内的元素并把元素引用加入会话上下文", - "titleEn": "Select an element inside Canvas and add its reference to session context", - "reasonCode": "unstructuredInteraction", - "reasonZh": "“选择 Canvas 内的元素并把元素引用加入会话上下文”由多个实时状态相关步骤组成,目前没有一个能确定完成整个流程的单一结构化 Command;智能体会打开精确入口,并把后续交互保留在用户可见界面。", - "reasonEn": "“Select an element inside Canvas and add its reference to session context” spans multiple live-state-dependent steps and currently has no single structured Command that can deterministically complete the whole workflow; the Agent opens the exact entry and keeps the remaining interaction visible to the user.", - "presentationTarget": { - "kind": "scene", - "sceneId": "session" - }, - "evidence": [ - "source:src/web-ui/src/tools/openbitfun-canvas/OpenBitFunCanvasPanel.tsx#createCanvasElementContext" - ] - }, - { - "capabilityId": "feature.canvas", - "itemId": "runtime-errors", - "titleZh": "捕获运行错误、上报诊断并请求智能体自动修复", - "titleEn": "Capture runtime errors, report diagnostics, and ask the agent to repair them", - "reasonCode": "unstructuredInteraction", - "reasonZh": "“捕获运行错误、上报诊断并请求智能体自动修复”由多个实时状态相关步骤组成,目前没有一个能确定完成整个流程的单一结构化 Command;智能体会打开精确入口,并把后续交互保留在用户可见界面。", - "reasonEn": "“Capture runtime errors, report diagnostics, and ask the agent to repair them” spans multiple live-state-dependent steps and currently has no single structured Command that can deterministically complete the whole workflow; the Agent opens the exact entry and keeps the remaining interaction visible to the user.", - "presentationTarget": { - "kind": "scene", - "sceneId": "session" - }, - "evidence": [ - "command:report_canvas_runtime_error", - "source:src/web-ui/src/tools/openbitfun-canvas/OpenBitFunCanvasPanel.tsx#canvas-runtime-auto-repair" - ] - }, - { - "capabilityId": "feature.canvas", - "itemId": "export-html", - "titleZh": "把当前 Canvas 导出为可独立打开的 HTML 文件", - "titleEn": "Export the current Canvas as a standalone HTML file", - "reasonCode": "unstructuredInteraction", - "reasonZh": "“把当前 Canvas 导出为可独立打开的 HTML 文件”由多个实时状态相关步骤组成,目前没有一个能确定完成整个流程的单一结构化 Command;智能体会打开精确入口,并把后续交互保留在用户可见界面。", - "reasonEn": "“Export the current Canvas as a standalone HTML file” spans multiple live-state-dependent steps and currently has no single structured Command that can deterministically complete the whole workflow; the Agent opens the exact entry and keeps the remaining interaction visible to the user.", - "presentationTarget": { - "kind": "scene", - "sceneId": "session" - }, - "evidence": [ - "source:src/web-ui/src/tools/openbitfun-canvas/canvasHtmlExportService.ts#export async function exportCanvasHtml" - ] - }, { "capabilityId": "feature.tasks-automation", "itemId": "board-views", diff --git a/docs/interactive-capabilities/technical/tauri-command-map.json b/docs/interactive-capabilities/technical/tauri-command-map.json index b12f13a00d..493a59a916 100644 --- a/docs/interactive-capabilities/technical/tauri-command-map.json +++ b/docs/interactive-capabilities/technical/tauri-command-map.json @@ -1,13 +1,13 @@ { "schemaVersion": 2, "generatedFrom": "src/shared/interactive-capabilities/catalog.json", - "catalogDigest": "6ae2eeaa19e6342f9dcf7ff33b7c0fa94547ee1c02fc1835f6f4471caab6fbb3", - "commandCount": 709, + "catalogDigest": "d9509b2230b87eb48363b5d79dae72009f1e84d3007de98ee20e717ae609b0b8", + "commandCount": 706, "coverage": { - "commandCount": 709, - "documentedCommandCount": 649, - "implementationCommandCount": 60, - "implementationDigest": "5047b674e890f899e65baf9235e9df4bd912fa28f44eb10a656e079a1b89974d" + "commandCount": 706, + "documentedCommandCount": 644, + "implementationCommandCount": 62, + "implementationDigest": "35499f219e8b80a5aa464bf1b3f6c8c9f978888bd423aab5c487fba23ceb0276" }, "commands": [ { @@ -2839,6 +2839,34 @@ "signature": "fn frontend_update_candidate_ready( state: tauri::State<'_, Arc>, webview: tauri::Webview, request: FrontendUpdateDecisionRequest, ) -> Result", "remoteWorkspacePolicy": "LocalOnly" }, + { + "id": "gen_ui_app", + "moduleId": "generative_ui", + "capabilityId": "feature.generative-ui", + "capabilityIds": [ + "feature.generative-ui" + ], + "documentedItemIds": [], + "visibility": "implementation", + "rustPath": "api::generative_ui_api::gen_ui_app", + "sourceFile": "src/apps/desktop/src/api/generative_ui_api.rs", + "signature": "fn gen_ui_app(request: GenUIAppRequest) -> Result, String>", + "remoteWorkspacePolicy": "RemoteRouted" + }, + { + "id": "gen_ui_provider_call", + "moduleId": "generative_ui", + "capabilityId": "feature.generative-ui", + "capabilityIds": [ + "feature.generative-ui" + ], + "documentedItemIds": [], + "visibility": "implementation", + "rustPath": "api::generative_ui_api::gen_ui_provider_call", + "sourceFile": "src/apps/desktop/src/api/generative_ui_api.rs", + "signature": "fn gen_ui_provider_call(request: GenUIProviderRequest) -> Result", + "remoteWorkspacePolicy": "WorkspaceAgnostic" + }, { "id": "generate_commit_message", "moduleId": "git_agent", @@ -5722,38 +5750,6 @@ "signature": "fn load_agent_companion_pet_spritesheet( state: State<'_, AppState>, request: LoadAgentCompanionPetSpritesheetRequest, ) -> Result", "remoteWorkspacePolicy": "LocalOnly" }, - { - "id": "load_canvas_artifact", - "moduleId": "canvas", - "capabilityId": "feature.canvas", - "capabilityIds": [ - "feature.canvas" - ], - "documentedItemIds": [ - "feature.canvas:artifact-open" - ], - "visibility": "documented", - "rustPath": "api::canvas_api::load_canvas_artifact", - "sourceFile": "src/apps/desktop/src/api/canvas_api.rs", - "signature": "fn load_canvas_artifact( state: State<'_, AppState>, request: CanvasStateRequest, ) -> Result", - "remoteWorkspacePolicy": "WorkspaceAgnostic" - }, - { - "id": "load_canvas_state", - "moduleId": "canvas", - "capabilityId": "feature.canvas", - "capabilityIds": [ - "feature.canvas" - ], - "documentedItemIds": [ - "feature.canvas:state" - ], - "visibility": "documented", - "rustPath": "api::canvas_api::load_canvas_state", - "sourceFile": "src/apps/desktop/src/api/canvas_api.rs", - "signature": "fn load_canvas_state( state: State<'_, AppState>, request: CanvasStateRequest, ) -> Result", - "remoteWorkspacePolicy": "WorkspaceAgnostic" - }, { "id": "load_git_repo_history", "moduleId": "git", @@ -8039,38 +8035,6 @@ "signature": "fn replace_mode_skill_selection( state: State<'_, AppState>, request: ReplaceModeSkillSelectionRequest, ) -> Result", "remoteWorkspacePolicy": "LegacyUnaudited" }, - { - "id": "report_canvas_runtime_error", - "moduleId": "canvas", - "capabilityId": "feature.canvas", - "capabilityIds": [ - "feature.canvas" - ], - "documentedItemIds": [ - "feature.canvas:runtime-errors" - ], - "visibility": "documented", - "rustPath": "api::canvas_api::report_canvas_runtime_error", - "sourceFile": "src/apps/desktop/src/api/canvas_api.rs", - "signature": "fn report_canvas_runtime_error( state: State<'_, AppState>, request: ReportCanvasRuntimeErrorRequest, ) -> Result", - "remoteWorkspacePolicy": "WorkspaceAgnostic" - }, - { - "id": "report_canvas_runtime_ready", - "moduleId": "canvas", - "capabilityId": "feature.canvas", - "capabilityIds": [ - "feature.canvas" - ], - "documentedItemIds": [ - "feature.canvas:html-react" - ], - "visibility": "documented", - "rustPath": "api::canvas_api::report_canvas_runtime_ready", - "sourceFile": "src/apps/desktop/src/api/canvas_api.rs", - "signature": "fn report_canvas_runtime_ready( state: State<'_, AppState>, request: ReportCanvasRuntimeReadyRequest, ) -> Result", - "remoteWorkspacePolicy": "WorkspaceAgnostic" - }, { "id": "report_ide_control_result", "moduleId": "commands", @@ -8738,22 +8702,6 @@ "signature": "fn save_acp_json_config( state: State<'_, AppState>, json_config: String, ) -> Result<(), String>", "remoteWorkspacePolicy": "LegacyUnaudited" }, - { - "id": "save_canvas_state", - "moduleId": "canvas", - "capabilityId": "feature.canvas", - "capabilityIds": [ - "feature.canvas" - ], - "documentedItemIds": [ - "feature.canvas:state" - ], - "visibility": "documented", - "rustPath": "api::canvas_api::save_canvas_state", - "sourceFile": "src/apps/desktop/src/api/canvas_api.rs", - "signature": "fn save_canvas_state( state: State<'_, AppState>, request: SaveCanvasStateRequest, ) -> Result", - "remoteWorkspacePolicy": "WorkspaceAgnostic" - }, { "id": "save_cloud_speech_config", "moduleId": "config", diff --git a/docs/plans/miniapp-agent-control-plan.md b/docs/plans/miniapp-agent-control-plan.md new file mode 100644 index 0000000000..0555e4dce5 --- /dev/null +++ b/docs/plans/miniapp-agent-control-plan.md @@ -0,0 +1,420 @@ +# MiniApp 通用 Web Agent 操作方案 + +## 目标 + +让主 Agent 能像操作一个 Web 页面一样操作任意 MiniApp,重点是: + +```text +打开 MiniApp +→ 读取当前页面/组件状态 +→ 定位元素 +→ 点击、输入、按键、滚动 +→ 等待页面更新 +→ 再次读取状态 +``` + +本方案**不负责修改 MiniApp 源码**,也不建设 MiniApp 编辑器、草稿系统、版本控制、发布系统或复杂的远程 Job 平台。现有 MiniApp 的源码、编译、存储和运行逻辑保持不变。 + +## 核心判断 + +MiniApp 本质上是 Web 页面,因此优先复用 BrowserUse 的 Web 操作语义,而不是让 Agent 通过本地文件或 Tauri 专用命令操作: + +- 对普通 DOM/UI MiniApp:读取 DOM、文本、属性和可访问性信息,执行 click/type/key/scroll 等操作。 +- 对 iframe:由宿主创建一个绑定到指定 MiniApp 的 Web 操作会话,将操作转发到 iframe。 +- 对 Canvas 或自定义渲染 MiniApp:通用 Web 层只能发送键盘/鼠标事件,无法凭空知道 Canvas 内部状态;需要 MiniApp 可选地注册一个只读状态与动作 bridge。 +- 不把截图和视觉识别作为主协议;截图最多作为未来调试或降级能力,不作为 Agent 操作闭环的必要条件。 + +因此,“任意 MiniApp 都能操作”的正确含义是: + +1. 所有 MiniApp 都获得一套通用 Web 操作能力,不需要逐个实现专用工具。 +2. 需要读取内部状态的 Canvas/游戏类 MiniApp,可以额外实现同一个可选 bridge;没有 bridge 时仍可接收通用输入,但不能声称宿主能读取其内部变量。 + +## 推荐架构 + +```text +主 Agent + ↓ +BrowserUse 风格的 MiniApp Web Tool + ↓ +MiniApp Web Surface Adapter + ↓ +MiniApp iframe / WebView + ↓ +DOM、可访问性树,或可选 Agent Bridge +``` + +### 1. MiniApp Web Tool + +新增一个面向 Agent 的轻量工具,名称可以是 `MiniAppBrowser` 或 `MiniAppWeb`。它不是 CRUD 工具,不暴露源码和宿主路径,只提供当前 MiniApp Web surface 的操作。 + +推荐操作: + +```text +open +close +inspect +find +read +click +type +key +scroll +wait +observe_bridge +act_bridge +``` + +主 Agent 的典型使用方式: + +```text +open(appId) +inspect() +find(role/text/testId) +click(target) +read(target) +type(target, text) +wait() +inspect() +``` + +### 2. Web Surface Adapter + +Desktop 宿主负责把 MiniApp iframe 当作一个受控 Web surface: + +- 根据 `appId` 打开或定位 MiniApp iframe; +- 创建 `sessionId`,将会话绑定到一个 `appId` 和一个具体 iframe; +- 将 BrowserUse 风格的定位、读取和输入操作转发到 iframe; +- 返回结构化 DOM/可访问性结果,而不是宿主绝对路径; +- 会话结束后释放 iframe 引用和输入状态。 + +Adapter 可以复用现有 MiniApp iframe/runtime 宿主实现,但不能把 `PathManager`、源码目录或 `draftRoot` 作为操作接口的一部分。 + +### 3. 可选 Agent Bridge + +普通 DOM MiniApp 不需要修改代码即可使用通用操作。对于 Canvas、WebGL、游戏或状态主要存在 JavaScript 内存中的 MiniApp,提供一个统一的可选 bridge: + +```text +observe -> 读取经过筛选的 JSON 状态 +act -> 执行 MiniApp 注册的语义动作 +``` + +bridge 通过 `postMessage` 或 `MessageChannel` 通信,不能依赖宿主猜测 iframe 内部变量名,也不能让 Agent 直接执行任意 JavaScript。 + +## 通用操作契约 + +### 会话 + +```json +{ + "action": "open", + "appId": "demo-app" +} +``` + +```json +{ + "sessionId": "miniapp-session-123", + "appId": "demo-app", + "surface": { + "kind": "iframe", + "width": 800, + "height": 600 + }, + "capabilities": [ + "dom", + "accessibility", + "input" + ] +} +``` + +`sessionId` 必须绑定一个 MiniApp。后续操作只能作用于该 session,不能用一个应用的句柄操作另一个应用。 + +### 读取页面结构 + +```json +{ + "action": "inspect", + "sessionId": "miniapp-session-123" +} +``` + +返回结构化页面信息: + +```json +{ + "url": "miniapp://demo-app", + "title": "Demo", + "tree": { + "role": "main", + "children": [ + { + "role": "button", + "name": "开始", + "testId": "start-button", + "enabled": true + } + ] + } +} +``` + +默认返回可供 Agent 定位的摘要,不直接返回完整 HTML、脚本、宿主路径或内部对象。需要详细内容时,通过明确的 `find/read` 请求读取目标节点。 + +### 定位元素 + +优先级建议: + +```text +稳定 testId +→ accessibility role/name +→ label/name +→ 文本 +→ CSS selector(仅作为兼容 fallback) +``` + +例如: + +```json +{ + "action": "find", + "sessionId": "miniapp-session-123", + "locator": { + "testId": "start-button" + } +} +``` + +返回一个短生命周期的 `targetId`,后续点击或读取使用 `targetId`,而不是让 Agent 自己拼接宿主选择器。 + +### 输入与读取 + +第一版支持: + +```text +click + type + keyDown + keyUp + pointerDown + pointerUp + pointerMove + scroll + readText + readValue + getAttribute + wait +``` + +示例: + +```json +{ + "action": "click", + "sessionId": "miniapp-session-123", + "targetId": "target-1" +} +``` + +```json +{ + "action": "type", + "sessionId": "miniapp-session-123", + "targetId": "target-2", + "text": "北京" +} +``` + +```json +{ + "action": "keyDown", + "sessionId": "miniapp-session-123", + "key": "ArrowLeft" +} +``` + +```json +{ + "action": "wait", + "sessionId": "miniapp-session-123", + "durationMs": 200 +} +``` + +`wait` 不是为了做持久化 Job,只是给页面动画、网络请求和游戏循环一个稳定的观察间隔。 + +## 可选 Bridge 契约 + +### 能力声明 + +MiniApp 如果需要让 Agent 读取内部状态或使用语义动作,可以在 iframe 内发送: + +```javascript +window.parent.postMessage({ + type: "openbitfun:miniapp-agent-ready", + appId: "demo-app", + schemaVersion: "agent.v1", + capabilities: ["observe", "act", "restart"] +}, expectedOrigin); +``` + +### 读取状态 + +```json +{ + "method": "observe" +} +``` + +返回任意符合约束的 JSON 状态,例如: + +```json +{ + "phase": "playing", + "score": 1200, + "selectedItem": "item-3", + "player": { + "x": 380, + "y": 520 + } +} +``` + +状态必须是: + +- JSON 可序列化; +- 有大小上限; +- 不包含函数、Window、DOM 节点、文件句柄、宿主路径和凭据; +- 由 MiniApp 自己决定哪些状态对 Agent 可见。 + +### 语义动作 + +```json +{ + "method": "act", + "action": { + "type": "restart" + } +} +``` + +或: + +```json +{ + "method": "act", + "action": { + "type": "move", + "direction": "left", + "durationMs": 200 + } +} +``` + +不同 MiniApp 可以声明不同的动作,但协议外壳保持一致: + +```text +capabilities +observe +act +requestId +response +error +``` + +这样雷霆战机可以声明 `move/fire/restart`,音乐播放器可以声明 `play/pause/next`,表格可以声明 `selectRow/addRow`,而 Agent 使用的工具不需要变化。 + +## 不采用的方式 + +### 不把源码编辑作为主控制面 + +不通过: + +```text +InitMiniApp +Read/Write/Edit +FinalizeMiniApp +``` + +来完成日常操作。它们继续作为开发/兼容工具,但不能成为 Agent 使用 MiniApp 的必要步骤。 + +### 不让宿主猜测 iframe 内部变量 + +不依赖: + +```javascript +iframe.contentWindow.gameState +iframe.contentWindow.somePrivateVariable +``` + +这类做法受打包、压缩和实现细节影响,无法成为通用 MiniApp 协议。 + +### 不开放任意 JavaScript evaluate + +不提供: + +```json +{ + "action": "evaluate", + "code": "..." +} +``` + +否则 Agent 可以绕过页面行为直接修改内部状态、读取凭据或访问宿主能力。调试阶段可以保留开发者专用通道,但不能进入主 Agent 工具契约。 + +### 不把视觉作为必要依赖 + +截图可以作为未来的调试或降级能力,但通用主路径使用: + +```text +DOM / Accessibility / Bridge State +``` + +对于纯 Canvas MiniApp,如果没有可选 bridge,系统必须明确返回“只能发送通用输入,无法读取内部状态”,而不是伪装成已经理解了游戏。 + +## 代码落点 + +- **Agent 工具**:在 `src/crates/assembly/core/src/agentic/tools/implementations` 增加 MiniApp Web 操作工具,并在 `product_runtime/materialization.rs` 注册;工具契约只包含 Web surface 操作。 +- **共享契约**:在 `src/crates/contracts/product-domains/src/miniapp` 增加 session、locator、DOM/accessibility 摘要、输入事件和 bridge 消息 DTO;不把 Tauri 类型下沉。 +- **Desktop Adapter**:在 `src/apps/desktop` 的 MiniApp iframe/runtime 宿主中实现 Web surface 绑定、iframe 消息转发和输入事件分发。 +- **BrowserUse 集成**:复用 BrowserUse 的 locator、inspect、input、wait 语义;如果现有 BrowserUse 只支持外部浏览器,则增加 `miniapp` target adapter,不要求把 MiniApp 伪装成公网 URL。 +- **现有反向 bridge**:`src/crates/contracts/product-domains/src/miniapp/agent_bridge.rs` 处理的是 MiniApp 调 Agent,不能直接当作主 Agent 调 MiniApp 的协议;可以借鉴其 session/request/event 组织方式,但保持权限域独立。 +- **现有 Tauri API**:复用 `src/apps/desktop/src/api/miniapp_api.rs` 的 runtime/iframe 基础能力;不要新建一套与 iframe runtime 平行的业务 owner。 + +## MVP 顺序 + +### MVP-1:通用 DOM/Web 操作 + +1. 建立 `open/close/inspect/find/read/click/type/key/scroll/wait` 工具。 +2. 为每个 MiniApp 创建绑定 `appId` 的 Web surface session。 +3. 返回 DOM/accessibility 摘要和短生命周期 targetId,不返回宿主路径。 +4. 复用现有 BrowserUse 的 locator/input 语义。 + +验收:不修改 MiniApp 源码,Agent 可以打开任意 DOM 型 MiniApp,定位按钮/输入框/文本,完成点击、输入、键盘和滚动操作。 + +### MVP-2:通用 iframe Bridge + +1. 增加 `agent-ready/request/response` 的 `postMessage` 或 `MessageChannel` 协议。 +2. 增加可选 `observe` 和 `act` bridge 能力声明。 +3. 将 bridge 返回的 JSON 状态和语义动作接入同一个 MiniApp Web session。 +4. 对没有 bridge 的 MiniApp 返回能力缺失,不静默猜测内部状态。 + +验收:同一个 Agent 工具可以操作 DOM MiniApp、Canvas MiniApp 和游戏 MiniApp;DOM MiniApp 不需要额外适配,Canvas/游戏通过可选 bridge 读取内部状态。 + +### MVP-3:稳定性和安全收敛 + +1. 增加 target stale、iframe reload、页面导航、操作超时和 bridge 断开错误。 +2. 增加 selector/role/testId 的定位优先级和大小限制。 +3. 限制 bridge origin、session、capability 和消息大小。 +4. 保留开发者调试接口,但主 Agent 不开放任意 JavaScript evaluate。 + +## 验证清单 + +- DOM:按钮、输入框、列表、表单、滚动区域、键盘快捷键和异步页面更新均可操作。 +- iframe:session 只能操作绑定的 appId;iframe reload 后能返回明确的 stale/reconnect 状态。 +- bridge:observe/act requestId 配对、能力声明、消息来源校验、超时和错误返回稳定。 +- 通用性:普通 DOM MiniApp 不需要修改;Canvas/游戏 MiniApp 只需实现统一可选 bridge,不增加专用 Agent 工具。 +- 安全:不能通过 selector、targetId 或 bridge 访问宿主路径、凭据、其他 MiniApp 或任意 JavaScript。 +- 视觉独立:主 Agent 的成功验收不依赖截图、OCR 或视觉模型;纯 Canvas 且无 bridge 时明确报告能力不足。 +- 兼容:现有 `agent_bridge.rs` 的 MiniApp -> Agent 能力、runtime、worker 和 UI 操作继续工作,不与新的主 Agent -> MiniApp Web 操作混淆。 +- E2E:`open -> inspect -> find -> read/click/type/key -> wait -> inspect`,以及 `open -> bridge observe -> bridge act -> bridge observe`。 diff --git a/package.json b/package.json index 642fde295d..ed61cc2430 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,6 @@ "generate-startup-appearance-bootstrap": "node scripts/generate-startup-appearance-bootstrap.mjs", "miniapp:appearance:generate": "node scripts/generate-miniapp-appearance-contract.mjs", "miniapp:appearance:check": "node scripts/generate-miniapp-appearance-contract.mjs --check", - "canvas:sdk:generate": "node scripts/generate-canvas-sdk-contract.mjs", - "canvas:sdk:check": "node scripts/generate-canvas-sdk-contract.mjs --check", "generate-all": "pnpm run generate-version && pnpm run generate-startup-appearance-bootstrap", "postinstall": "pnpm run copy-assets", "dev": "node scripts/dev.cjs web", @@ -32,7 +30,7 @@ "preview:mobile-web": "pnpm --dir src/mobile-web preview", "lint:web": "pnpm --dir src/web-ui run lint", "lint:web:fix": "pnpm --dir src/web-ui run lint:fix", - "check:web": "pnpm run canvas:sdk:check && pnpm run check:web:appearance && pnpm run type-check:web", + "check:web": "pnpm run check:web:appearance && pnpm run type-check:web", "check:web:appearance": "pnpm run typography:audit:test && pnpm run typography:audit && pnpm run appearance:contract-audit && pnpm run theme:color-audit:test && pnpm run theme:color-audit:all && pnpm run theme:visual-contract", "type-check:mobile-web": "pnpm --dir src/mobile-web run type-check", "i18n:generate": "node scripts/generate-i18n-contract.mjs", diff --git a/packages/flow-chat-presentation/src/registry.ts b/packages/flow-chat-presentation/src/registry.ts index 0749f664f2..d9ce1905d3 100644 --- a/packages/flow-chat-presentation/src/registry.ts +++ b/packages/flow-chat-presentation/src/registry.ts @@ -64,10 +64,6 @@ export const toolPresentationRegistry = { GenerativeUI: { owner: 'product', component: null }, ComputerUse: { owner: 'product', component: null }, OpenBitFunControl: { owner: 'product', component: null }, - CreateCanvas: { owner: 'product', component: null }, - ReadCanvas: { owner: 'product', component: null }, - UpdateCanvas: { owner: 'product', component: null }, - PatchCanvas: { owner: 'product', component: null }, } as const satisfies Record; export type RegisteredToolName = keyof typeof toolPresentationRegistry; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index db6f8399a1..e06086811a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -445,6 +445,12 @@ importers: '@openbitfun/ui': specifier: workspace:^ version: link:../../design-system/packages/ui + '@openuidev/lang-core': + specifier: 1.0.2 + version: 1.0.2(zod@4.6.7) + '@openuidev/react-lang': + specifier: 1.0.2 + version: 1.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(zod@4.6.7) '@tanstack/react-virtual': specifier: ^3.13.23 version: 3.13.23(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -538,6 +544,9 @@ importers: lucide-react: specifier: ^0.560.0 version: 0.560.0(react@18.3.1) + maplibre-gl: + specifier: ^6.16.0 + version: 6.16.0 markstream-react: specifier: 2.0.13 version: 2.0.13(katex@0.16.28)(mermaid@11.12.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -631,6 +640,9 @@ importers: yaml: specifier: ^2.8.2 version: 2.8.2 + zod: + specifier: ^4.6.7 + version: 4.6.7 zustand: specifier: ^5.0.10 version: 5.0.11(@types/react@18.3.27)(immer@11.1.4)(react@18.3.1)(use-sync-external-store@1.6.0(react@18.3.1)) @@ -1245,105 +1257,89 @@ packages: resolution: {integrity: sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==} cpu: [arm64] os: [linux] - libc: [glibc] '@img/sharp-libvips-linux-arm@1.2.4': resolution: {integrity: sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==} cpu: [arm] os: [linux] - libc: [glibc] '@img/sharp-libvips-linux-ppc64@1.2.4': resolution: {integrity: sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==} cpu: [ppc64] os: [linux] - libc: [glibc] '@img/sharp-libvips-linux-riscv64@1.2.4': resolution: {integrity: sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==} cpu: [riscv64] os: [linux] - libc: [glibc] '@img/sharp-libvips-linux-s390x@1.2.4': resolution: {integrity: sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==} cpu: [s390x] os: [linux] - libc: [glibc] '@img/sharp-libvips-linux-x64@1.2.4': resolution: {integrity: sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==} cpu: [x64] os: [linux] - libc: [glibc] '@img/sharp-libvips-linuxmusl-arm64@1.2.4': resolution: {integrity: sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==} cpu: [arm64] os: [linux] - libc: [musl] '@img/sharp-libvips-linuxmusl-x64@1.2.4': resolution: {integrity: sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==} cpu: [x64] os: [linux] - libc: [musl] '@img/sharp-linux-arm64@0.34.5': resolution: {integrity: sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} cpu: [arm64] os: [linux] - libc: [glibc] '@img/sharp-linux-arm@0.34.5': resolution: {integrity: sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} cpu: [arm] os: [linux] - libc: [glibc] '@img/sharp-linux-ppc64@0.34.5': resolution: {integrity: sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} cpu: [ppc64] os: [linux] - libc: [glibc] '@img/sharp-linux-riscv64@0.34.5': resolution: {integrity: sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} cpu: [riscv64] os: [linux] - libc: [glibc] '@img/sharp-linux-s390x@0.34.5': resolution: {integrity: sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} cpu: [s390x] os: [linux] - libc: [glibc] '@img/sharp-linux-x64@0.34.5': resolution: {integrity: sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} cpu: [x64] os: [linux] - libc: [glibc] '@img/sharp-linuxmusl-arm64@0.34.5': resolution: {integrity: sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} cpu: [arm64] os: [linux] - libc: [musl] '@img/sharp-linuxmusl-x64@0.34.5': resolution: {integrity: sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} cpu: [x64] os: [linux] - libc: [musl] '@img/sharp-wasm32@0.34.5': resolution: {integrity: sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==} @@ -1577,6 +1573,35 @@ packages: resolution: {integrity: sha512-9I2Zn6+NJLfaGoz9jN3lpwDgAYvfGeNYdbAIjJOqzs4Tpc+VU3Jqq4IofSUBKajiDS8k9fZIg18/z13mpk1bsA==} engines: {node: '>=8'} + '@mapbox/jsonlint-lines-primitives@2.0.3': + resolution: {integrity: sha512-0SElaV0uMxEnxzBhhX9WTuPyUeMsAN/SS0i16tjuba4/mio63MG9khjC1a0JAiPGXAwvwm4UfHJURCN7nyudQg==} + engines: {node: '>= 22'} + + '@mapbox/point-geometry@1.1.0': + resolution: {integrity: sha512-YGcBz1cg4ATXDCM/71L9xveh4dynfGmcLDqufR+nQQy3fKwsAZsWd/x4621/6uJaeB9mwOHE6hPeDgXz9uViUQ==} + + '@mapbox/tiny-sdf@2.3.0': + resolution: {integrity: sha512-gBvcNDBBB66bgQYvnaJ6Jk+VCaMmVq5+IZR2kWPisT88Z8s0kBQt6hfVi8QgRW8Vpg0UWZzBA4ZSyzHHC+VeRA==} + + '@mapbox/unitbezier@1.0.0': + resolution: {integrity: sha512-fqd515fjBmANKGGsQ286E2Wvj/XvDFpGzwJxq4CI6jMQue6Oy04uCKp+JWKF00xRTmk6cEu1jPJ9p3xqH8YWqQ==} + + '@mapbox/vector-tile@3.0.0': + resolution: {integrity: sha512-Qf10S1uIHMk20ri/IVBnpS+esUEkVaR5Hftmz88jTInrpmWgPGJfPe3LVjjlE77trLx8tH6qjTG7uWH9hIq/0Q==} + + '@maplibre/geojson-vt@6.3.0': + resolution: {integrity: sha512-3Zw2jsU9pIJG3G2CQFbLjWj2MlAHodhD7cSY+15iywUuLmmkgzcKRnueVRZ4AcC/5wOtfhidcJAAzBpoBNs3Xg==} + + '@maplibre/maplibre-gl-style-spec@26.5.0': + resolution: {integrity: sha512-Tli0Mi9rF3117uVFkqsysXu9TPLx3AODPmWklUjbDhR4jJ849vGT5/EqWM3dBjIQgU6xxj5SZQ9ONjibqjEP+Q==} + hasBin: true + + '@maplibre/mlt@1.3.0': + resolution: {integrity: sha512-7M2O7ABM80Oi8XPkfkrjKB8mOBIxGoVgkA52Mu4RMWoBvvMdagQ522+WxVYujZsMpqIr3BpzrTbXrm4k8lCzCQ==} + + '@maplibre/vt-pbf@4.3.3': + resolution: {integrity: sha512-dEe5XUd64RQbxNxy2OzIkJnwNDWjVmSXjCd0A7zLirm7QJ/WWbmtDFIkfsiM4yt1cplqzG6oSivRYeWx1SM1yg==} + '@marijn/find-cluster-break@1.0.2': resolution: {integrity: sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==} @@ -1622,35 +1647,30 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [glibc] '@napi-rs/canvas-linux-arm64-musl@0.1.100': resolution: {integrity: sha512-K3mDW66N+xT2/V439u1alFANiBUjdEx2gLiNYnCmUsva5jZMxWTjafBYwTzYK+EMFMHrUoabuU+T1BIP5CgbYQ==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [musl] '@napi-rs/canvas-linux-riscv64-gnu@0.1.100': resolution: {integrity: sha512-mooqUBTIsccZpnoQC4NgrC1v6C1vof39etLNMnBwCY+p0gajWJvAHLGQ6g/gGyS5YrpDW+GefSN4+Cvcr08UWw==} engines: {node: '>= 10'} cpu: [riscv64] os: [linux] - libc: [glibc] '@napi-rs/canvas-linux-x64-gnu@0.1.100': resolution: {integrity: sha512-1eCvkDCazm7FFhsT7DfGOdSaHgZVK3bt/dSBl5EWHOWmnz+I7j8tPseJqqD81NF+MH21jKUK4wQSDjN0mdhnTg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [glibc] '@napi-rs/canvas-linux-x64-musl@0.1.100': resolution: {integrity: sha512-20arT6lnI19S68qNlii73TSEDbECNgzMz2EpldC1V3mZFuRkeujXkcebRk0LRJe9SEUAooYiLokfMViY8IX7yA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [musl] '@napi-rs/canvas-win32-arm64-msvc@0.1.100': resolution: {integrity: sha512-DZFFT1wIAg37LJw37yhMRFfjATd3vTQzjZ1Yki8u2vhO6Hi5VE6BVaGQ1aaDu7xb4iMErz+9EOwjpS7xcxFeBw==} @@ -1680,6 +1700,45 @@ packages: resolution: {integrity: sha512-XlOlEbQcE9fmuXxrVTXCTlG2nlRXa9Rj3rr5Ue/+tX+nmkgbX720YHh0VR3hBF9xDvwnb8D2shVGOwNx+ulArw==} engines: {node: '>= 20.19.0'} + '@openuidev/devtools@0.3.1': + resolution: {integrity: sha512-kOCCsRGwY0w6xL1rVL1zOa9CO97ZrG6YGasRZyCv7FXaDAzbFkEgFy+FhYx6EP7sPKhkgr/jBqunADzhevpBDw==} + peerDependencies: + '@openuidev/observability': '>=0.0.4 <0.1.0' + '@openuidev/react-lang': '>=1.0.0 <2.0.0' + react: ^18.3.1 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + peerDependenciesMeta: + '@openuidev/react-lang': + optional: true + + '@openuidev/lang-core@1.0.2': + resolution: {integrity: sha512-mxrWXgSmGx9N8ZHFiRgvqCmCH8j3x0PTHJVRvtRPlucxDAihthgMR4W6RXJN5KnCl/5fk1SzcT9JHrvGTKcBFw==} + peerDependencies: + '@modelcontextprotocol/sdk': '>=1.0.0' + zod: ^3.25.0 || ^4.0.0 + peerDependenciesMeta: + '@modelcontextprotocol/sdk': + optional: true + + '@openuidev/observability@0.0.4': + resolution: {integrity: sha512-4fjIrWu3TqTlfDE/m7cG10CH1vV7wQk5GPwMOmXeF9vJtkg92dg4Bdk3AjKgud7H7Xypwwjgt52VcLGZCE2CJQ==} + + '@openuidev/react-lang@1.0.2': + resolution: {integrity: sha512-nCNALKj71GmKo5x0dR10hr3LKf88MHxlkVgnsbYQdJTxBd3TbD9wqlgJkBcAZNFD4kPHINJ0iTdUAbR871XWBw==} + peerDependencies: + '@modelcontextprotocol/sdk': '>=1.0.0' + react: '*' + react-dom: '*' + react-native: '*' + zod: ^3.25.0 || ^4.0.0 + peerDependenciesMeta: + '@modelcontextprotocol/sdk': + optional: true + react-dom: + optional: true + react-native: + optional: true + '@parcel/watcher-android-arm64@2.5.6': resolution: {integrity: sha512-YQxSS34tPF/6ZG7r/Ih9xy+kP/WwediEUsqmtf0cuCV5TPPKw/PQHRhueUo6JdeFJaqV3pyjm0GdYjZotbRt/A==} engines: {node: '>= 10.0.0'} @@ -1709,42 +1768,36 @@ packages: engines: {node: '>= 10.0.0'} cpu: [arm] os: [linux] - libc: [glibc] '@parcel/watcher-linux-arm-musl@2.5.6': resolution: {integrity: sha512-Ve3gUCG57nuUUSyjBq/MAM0CzArtuIOxsBdQ+ftz6ho8n7s1i9E1Nmk/xmP323r2YL0SONs1EuwqBp2u1k5fxg==} engines: {node: '>= 10.0.0'} cpu: [arm] os: [linux] - libc: [musl] '@parcel/watcher-linux-arm64-glibc@2.5.6': resolution: {integrity: sha512-f2g/DT3NhGPdBmMWYoxixqYr3v/UXcmLOYy16Bx0TM20Tchduwr4EaCbmxh1321TABqPGDpS8D/ggOTaljijOA==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] '@parcel/watcher-linux-arm64-musl@2.5.6': resolution: {integrity: sha512-qb6naMDGlbCwdhLj6hgoVKJl2odL34z2sqkC7Z6kzir8b5W65WYDpLB6R06KabvZdgoHI/zxke4b3zR0wAbDTA==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] - libc: [musl] '@parcel/watcher-linux-x64-glibc@2.5.6': resolution: {integrity: sha512-kbT5wvNQlx7NaGjzPFu8nVIW1rWqV780O7ZtkjuWaPUgpv2NMFpjYERVi0UYj1msZNyCzGlaCWEtzc+exjMGbQ==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] - libc: [glibc] '@parcel/watcher-linux-x64-musl@2.5.6': resolution: {integrity: sha512-1JRFeC+h7RdXwldHzTsmdtYR/Ku8SylLgTU/reMuqdVD7CtLwf0VR1FqeprZ0eHQkO0vqsbvFLXUmYm/uNKJBg==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] - libc: [musl] '@parcel/watcher-win32-arm64@2.5.6': resolution: {integrity: sha512-3ukyebjc6eGlw9yRt678DxVF7rjXatWiHvTXqphZLvo7aC5NdEgFufVwjFfY51ijYEWpXbqF5jtrK275z52D4Q==} @@ -1841,79 +1894,66 @@ packages: resolution: {integrity: sha512-F8sWbhZ7tyuEfsmOxwc2giKDQzN3+kuBLPwwZGyVkLlKGdV1nvnNwYD0fKQ8+XS6hp9nY7B+ZeK01EBUE7aHaw==} cpu: [arm] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.57.1': resolution: {integrity: sha512-rGfNUfn0GIeXtBP1wL5MnzSj98+PZe/AXaGBCRmT0ts80lU5CATYGxXukeTX39XBKsxzFpEeK+Mrp9faXOlmrw==} cpu: [arm] os: [linux] - libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.57.1': resolution: {integrity: sha512-MMtej3YHWeg/0klK2Qodf3yrNzz6CGjo2UntLvk2RSPlhzgLvYEB3frRvbEF2wRKh1Z2fDIg9KRPe1fawv7C+g==} cpu: [arm64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.57.1': resolution: {integrity: sha512-1a/qhaaOXhqXGpMFMET9VqwZakkljWHLmZOX48R0I/YLbhdxr1m4gtG1Hq7++VhVUmf+L3sTAf9op4JlhQ5u1Q==} cpu: [arm64] os: [linux] - libc: [musl] '@rollup/rollup-linux-loong64-gnu@4.57.1': resolution: {integrity: sha512-QWO6RQTZ/cqYtJMtxhkRkidoNGXc7ERPbZN7dVW5SdURuLeVU7lwKMpo18XdcmpWYd0qsP1bwKPf7DNSUinhvA==} cpu: [loong64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-loong64-musl@4.57.1': resolution: {integrity: sha512-xpObYIf+8gprgWaPP32xiN5RVTi/s5FCR+XMXSKmhfoJjrpRAjCuuqQXyxUa/eJTdAE6eJ+KDKaoEqjZQxh3Gw==} cpu: [loong64] os: [linux] - libc: [musl] '@rollup/rollup-linux-ppc64-gnu@4.57.1': resolution: {integrity: sha512-4BrCgrpZo4hvzMDKRqEaW1zeecScDCR+2nZ86ATLhAoJ5FQ+lbHVD3ttKe74/c7tNT9c6F2viwB3ufwp01Oh2w==} cpu: [ppc64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-ppc64-musl@4.57.1': resolution: {integrity: sha512-NOlUuzesGauESAyEYFSe3QTUguL+lvrN1HtwEEsU2rOwdUDeTMJdO5dUYl/2hKf9jWydJrO9OL/XSSf65R5+Xw==} cpu: [ppc64] os: [linux] - libc: [musl] '@rollup/rollup-linux-riscv64-gnu@4.57.1': resolution: {integrity: sha512-ptA88htVp0AwUUqhVghwDIKlvJMD/fmL/wrQj99PRHFRAG6Z5nbWoWG4o81Nt9FT+IuqUQi+L31ZKAFeJ5Is+A==} cpu: [riscv64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-riscv64-musl@4.57.1': resolution: {integrity: sha512-S51t7aMMTNdmAMPpBg7OOsTdn4tySRQvklmL3RpDRyknk87+Sp3xaumlatU+ppQ+5raY7sSTcC2beGgvhENfuw==} cpu: [riscv64] os: [linux] - libc: [musl] '@rollup/rollup-linux-s390x-gnu@4.57.1': resolution: {integrity: sha512-Bl00OFnVFkL82FHbEqy3k5CUCKH6OEJL54KCyx2oqsmZnFTR8IoNqBF+mjQVcRCT5sB6yOvK8A37LNm/kPJiZg==} cpu: [s390x] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.57.1': resolution: {integrity: sha512-ABca4ceT4N+Tv/GtotnWAeXZUZuM/9AQyCyKYyKnpk4yoA7QIAuBt6Hkgpw8kActYlew2mvckXkvx0FfoInnLg==} cpu: [x64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-musl@4.57.1': resolution: {integrity: sha512-HFps0JeGtuOR2convgRRkHCekD7j+gdAuXM+/i6kGzQtFhlCtQkpwtNzkNj6QhCDp7DRJ7+qC/1Vg2jt5iSOFw==} cpu: [x64] os: [linux] - libc: [musl] '@rollup/rollup-openbsd-x64@4.57.1': resolution: {integrity: sha512-H+hXEv9gdVQuDTgnqD+SQffoWoc0Of59AStSzTEj/feWTBAnSfSD3+Dql1ZruJQxmykT/JVY0dE8Ka7z0DH1hw==} @@ -1999,35 +2039,30 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [glibc] '@tauri-apps/cli-linux-arm64-musl@2.11.4': resolution: {integrity: sha512-v277UnT/fB64xAfSroL5N3Km3tLmvATWqJJw/wRI+g6o+HkeD0slyE7gOhNs1MbjE41R7bQOTxMVoL3aomUJmw==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [musl] '@tauri-apps/cli-linux-riscv64-gnu@2.11.4': resolution: {integrity: sha512-qqgNkQ2u1yZHxjhxsZaxUtRDW8dIqIYm33rx/mzwQv0SfY9x1B+iraj8vWeFiXjjSVVhEMepXSOts1TqPzvXNQ==} engines: {node: '>= 10'} cpu: [riscv64] os: [linux] - libc: [glibc] '@tauri-apps/cli-linux-x64-gnu@2.11.4': resolution: {integrity: sha512-2VRNWl84FOH0m2giiDkO2h0QXlcMJeX+zJDpI5kDIQAx6s+geF3v48F4DXfJez4GS/FdoDGnPnw1C2iYGbQ7bQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [glibc] '@tauri-apps/cli-linux-x64-musl@2.11.4': resolution: {integrity: sha512-o9GyhYor/nc7xarmwDE3ka2szuW3uuZzXjHWh64Q8YX5AtSgxdQkFWzrY4O8KiGtVNvFBI14H3Q49Qj5TOIP/A==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [musl] '@tauri-apps/cli-win32-arm64-msvc@2.11.4': resolution: {integrity: sha512-ld5Ehb598m0VkYyylRPNeCFsBe/km0jxis6KgMpl3IGY6I/i1RwQXO05I1AsXUXO2WC6AvB/Lw4qTf/asiuEiQ==} @@ -2902,6 +2937,9 @@ packages: bidi-js@1.0.3: resolution: {integrity: sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==} + bidi-js@1.1.0: + resolution: {integrity: sha512-fX1Onk0tdVPC7obPWB5EbJ1z7NVhLq4m2xZLq2YXBkxzMXIGRpNMU88n0EPgWseKl12J7zXs7qrDxPK4sRs2fg==} + big-integer@1.6.52: resolution: {integrity: sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==} engines: {node: '>=0.6'} @@ -3483,6 +3521,9 @@ packages: duplexify@4.1.3: resolution: {integrity: sha512-M3BmBhwJRZsSx38lZyhE53Csddgzl5R7xGJNk7CVddZD6CcmwMCH8J+7AprIrQKH7TonKxaCjcv27Qmf+sQ+oA==} + earcut@3.2.4: + resolution: {integrity: sha512-FHc6yNpnTORB0tM5kmZ03iD2mDuNakDE2lvf4Hw1XkfxtEHIGVi01B/GqUSwx+NcC1WGjidAfpTXzeALtPtfpg==} + eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} @@ -3862,6 +3903,9 @@ packages: resolution: {integrity: sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==} engines: {node: '>= 14'} + gl-matrix@3.4.4: + resolution: {integrity: sha512-latSnyDNt/8zYUB6VIJ6PCh2jBjJX6gnDsoCZ7LyW7GkqrD51EWwa9qCoGixj8YqBtETQK/xY7OmpTF8xz1DdQ==} + glob-parent@5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} @@ -3881,12 +3925,12 @@ packages: glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} - deprecated: Glob versions prior to v9 are no longer supported + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me glob@8.1.0: resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} engines: {node: '>=12'} - deprecated: Glob versions prior to v9 are no longer supported + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me globals@14.0.0: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} @@ -4279,6 +4323,9 @@ packages: json-stable-stringify-without-jsonify@1.0.1: resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} + json-stringify-pretty-compact@4.0.0: + resolution: {integrity: sha512-3CNZ2DnrpByG9Nqj6Xo8vqbjT4F6N+tb4Gb28ESAZjYZ5yqvmc56J+/kuIwkaAMOyblTQhUW7PxMkUb8Q36N3Q==} + json5@2.2.3: resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} engines: {node: '>=6'} @@ -4291,6 +4338,9 @@ packages: resolution: {integrity: sha512-YHzO7721WbmAL6Ov1uzN/l5mY5WWWhJBSW+jq4tkfZfsxmo1hu6frS0EOswvjBUnWE6NtjEs48SFn5CQESRLZg==} hasBin: true + kdbush@4.1.0: + resolution: {integrity: sha512-e9vurzrXJQrFX6ckpHP3bvj5l+9CnYzkxDNnNQ1h2QTqdWsUAJgXiKdGNcOa1EY85dU8KbQ+z/FdQdB7P+9yfQ==} + keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} @@ -4427,12 +4477,21 @@ packages: peerDependencies: react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0 + lucide-react@0.575.0: + resolution: {integrity: sha512-VuXgKZrk0uiDlWjGGXmKV6MSk9Yy4l10qgVvzGn2AWBx1Ylt0iBexKOAoA6I7JO3m+M9oeovJd3yYENfkUbOeg==} + peerDependencies: + react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0 + magic-string@0.30.21: resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} make-error@1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + maplibre-gl@6.16.0: + resolution: {integrity: sha512-gApO66EMtoDZuio680RUBvskR7ahFd/NNhLN4tBAs+Y7FeT4gQV8zVFgYVMRmFxQznOEzecW19w6xOd9XjZjiA==} + engines: {node: '>=16.14.0', npm: '>=8.1.0'} + markdown-it-container@4.0.0: resolution: {integrity: sha512-HaNccxUH0l7BNGYbFbjmGpf5aLHAMTinqRZQAEQbMr2cdD3z91Q6kIo1oUn1CQndkT03jat6ckrdRYuwwqLlQw==} @@ -4718,6 +4777,9 @@ packages: ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + murmurhash-js@1.0.0: + resolution: {integrity: sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw==} + mute-stream@2.0.0: resolution: {integrity: sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==} engines: {node: ^18.17.0 || >=20.5.0} @@ -4910,6 +4972,10 @@ packages: pathe@2.0.3: resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + pbf@5.1.2: + resolution: {integrity: sha512-mnvGdvOrIvJOBGUEdGkrVXjN8E/VkIJCkf2eS1DH2yv82ORUlLttmDt0rWY38yYZmVwciZwBUvHM20qxBZf40w==} + hasBin: true + pdf-lib@1.17.1: resolution: {integrity: sha512-V/mpyJAoTsN4cnP31vc0wfNA1+p20evqqnap0KLoRUN0Yk/p3wN52DOEsL4oBFcLdb76hlpKPtzJIgo67j/XLw==} @@ -4965,6 +5031,9 @@ packages: resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==} engines: {node: ^10 || ^12 || >=14} + potpack@2.1.0: + resolution: {integrity: sha512-pcaShQc1Shq0y+E7GqJqvZj8DTthWV1KeHGdi0Z6IAin2Oi3JnLCOfwnCo84qc+HAp52wT9nK9H7FAJp5a44GQ==} + pptxgenjs@4.0.1: resolution: {integrity: sha512-TeJISr8wouAuXw4C1F/mC33xbZs/FuEG6nH9FG1Zj+nuPcGMP5YRHl6X+j3HSUnS1f3at6k75ZZXPMZlA5Lj9A==} @@ -5072,6 +5141,9 @@ packages: prosemirror-view@1.41.7: resolution: {integrity: sha512-jUwKNCEIGiqdvhlS91/2QAg21e4dfU5bH2iwmSDQeosXJgKF7smG0YSplOWK0cjSNgIqXe7VXqo7EIfUFJdt3w==} + protocol-buffers-schema@3.6.1: + resolution: {integrity: sha512-VG2K63Igkiv9p76tk1lilczEK1cT+kCjKtkdhw1dQZV3k3IXJbd3o6Ho8b9zJZaHSnT2hKe4I+ObmX9w6m5SmQ==} + proxy-agent@6.3.1: resolution: {integrity: sha512-Rb5RVBy1iyqOtNl15Cw/llpeLH8bsb37gM1FUfKQ+Wck6xHlbAhWGUFiTRHtkjqGTA5pSHz6+0hrPW/oECihPQ==} engines: {node: '>= 14'} @@ -5112,6 +5184,9 @@ packages: quick-format-unescaped@4.0.4: resolution: {integrity: sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==} + quickselect@3.0.0: + resolution: {integrity: sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g==} + randombytes@2.1.0: resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} @@ -5247,6 +5322,9 @@ packages: resolve-pkg-maps@1.0.0: resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + resolve-protobuf-schema@2.1.0: + resolution: {integrity: sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==} + resq@1.11.0: resolution: {integrity: sha512-G10EBz+zAAy3zUd/CDoBbXRL6ia9kOo3xRHrMDsHljI0GDkhYlyjwoCx5+3eCC4swi1uCoZQhskuJkj7Gp57Bw==} @@ -5590,6 +5668,9 @@ packages: resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==} engines: {node: '>=12.0.0'} + tinyqueue@3.0.0: + resolution: {integrity: sha512-gRa9gwYU3ECmQYv3lslts5hxuIa90veaEcxDYuu3QGOIAEM2mOZkVHp48ANJuu1CURtRdHKUBY5Lm1tHV+sD4g==} + tinyrainbow@1.2.0: resolution: {integrity: sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==} engines: {node: '>=14.0.0'} @@ -5795,6 +5876,7 @@ packages: uuid@10.0.0: resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==} + deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028). hasBin: true uuid@11.1.0: @@ -6145,6 +6227,9 @@ packages: resolution: {integrity: sha512-zK7YHHz4ZXpW89AHXUPbQVGKI7uvkd3hzusTdotCg1UxyaVtg0zFJSTfW/Dq5f7OBBVnq6cZIaC8Ti4hb6dtCA==} engines: {node: '>= 14'} + zod@4.6.7: + resolution: {integrity: sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==} + zustand@5.0.11: resolution: {integrity: sha512-fdZY+dk7zn/vbWNCYmzZULHRrss0jx5pPFiOuMZ/5HJN6Yv3u+1Wswy/4MpZEkEGhtNH+pwxZB8OKgUBPzYAGg==} engines: {node: '>=12.20.0'} @@ -6967,6 +7052,43 @@ snapshots: '@lukeed/ms@2.0.2': {} + '@mapbox/jsonlint-lines-primitives@2.0.3': {} + + '@mapbox/point-geometry@1.1.0': {} + + '@mapbox/tiny-sdf@2.3.0': {} + + '@mapbox/unitbezier@1.0.0': {} + + '@mapbox/vector-tile@3.0.0': + dependencies: + '@mapbox/point-geometry': 1.1.0 + '@types/geojson': 7946.0.16 + pbf: 5.1.2 + + '@maplibre/geojson-vt@6.3.0': + dependencies: + kdbush: 4.1.0 + + '@maplibre/maplibre-gl-style-spec@26.5.0': + dependencies: + '@mapbox/jsonlint-lines-primitives': 2.0.3 + '@mapbox/unitbezier': 1.0.0 + json-stringify-pretty-compact: 4.0.0 + minimist: 1.2.8 + quickselect: 3.0.0 + tinyqueue: 3.0.0 + + '@maplibre/mlt@1.3.0': + dependencies: + '@mapbox/point-geometry': 1.1.0 + + '@maplibre/vt-pbf@4.3.3': + dependencies: + '@mapbox/point-geometry': 1.1.0 + '@types/geojson': 7946.0.16 + pbf: 5.1.2 + '@marijn/find-cluster-break@1.0.2': {} '@mermaid-js/parser@0.6.3': @@ -7040,6 +7162,32 @@ snapshots: '@noble/hashes@2.0.1': {} + '@openuidev/devtools@0.3.1(@openuidev/observability@0.0.4)(@openuidev/react-lang@1.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(zod@4.6.7))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + dependencies: + '@openuidev/observability': 0.0.4 + lucide-react: 0.575.0(react@18.3.1) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + optionalDependencies: + '@openuidev/react-lang': 1.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(zod@4.6.7) + + '@openuidev/lang-core@1.0.2(zod@4.6.7)': + dependencies: + ci-info: 4.4.0 + zod: 4.6.7 + + '@openuidev/observability@0.0.4': {} + + '@openuidev/react-lang@1.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(zod@4.6.7)': + dependencies: + '@openuidev/devtools': 0.3.1(@openuidev/observability@0.0.4)(@openuidev/react-lang@1.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(zod@4.6.7))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@openuidev/lang-core': 1.0.2(zod@4.6.7) + '@openuidev/observability': 0.0.4 + react: 18.3.1 + zod: 4.6.7 + optionalDependencies: + react-dom: 18.3.1(react@18.3.1) + '@parcel/watcher-android-arm64@2.5.6': optional: true @@ -8458,6 +8606,10 @@ snapshots: dependencies: require-from-string: 2.0.2 + bidi-js@1.1.0: + dependencies: + require-from-string: 2.0.2 + big-integer@1.6.52: {} binary-extensions@2.3.0: {} @@ -9097,6 +9249,8 @@ snapshots: readable-stream: 3.6.2 stream-shift: 1.0.3 + earcut@3.2.4: {} + eastasianwidth@0.2.0: {} easy-table@1.2.0: @@ -9572,6 +9726,8 @@ snapshots: transitivePeerDependencies: - supports-color + gl-matrix@3.4.4: {} + glob-parent@5.1.2: dependencies: is-glob: 4.0.3 @@ -10054,6 +10210,8 @@ snapshots: json-stable-stringify-without-jsonify@1.0.1: {} + json-stringify-pretty-compact@4.0.0: {} + json5@2.2.3: {} jszip@3.10.1: @@ -10067,6 +10225,8 @@ snapshots: dependencies: commander: 8.3.0 + kdbush@4.1.0: {} + keyv@4.5.4: dependencies: json-buffer: 3.0.1 @@ -10207,12 +10367,37 @@ snapshots: dependencies: react: 18.3.1 + lucide-react@0.575.0(react@18.3.1): + dependencies: + react: 18.3.1 + magic-string@0.30.21: dependencies: '@jridgewell/sourcemap-codec': 1.5.5 make-error@1.3.6: {} + maplibre-gl@6.16.0: + dependencies: + '@mapbox/point-geometry': 1.1.0 + '@mapbox/tiny-sdf': 2.3.0 + '@mapbox/unitbezier': 1.0.0 + '@mapbox/vector-tile': 3.0.0 + '@maplibre/geojson-vt': 6.3.0 + '@maplibre/maplibre-gl-style-spec': 26.5.0 + '@maplibre/mlt': 1.3.0 + '@maplibre/vt-pbf': 4.3.3 + '@types/geojson': 7946.0.16 + bidi-js: 1.1.0 + earcut: 3.2.4 + gl-matrix: 3.4.4 + kdbush: 4.1.0 + murmurhash-js: 1.0.0 + pbf: 5.1.2 + potpack: 2.1.0 + quickselect: 3.0.0 + tinyqueue: 3.0.0 + markdown-it-container@4.0.0: {} markdown-it-footnote@4.0.0: {} @@ -10739,6 +10924,8 @@ snapshots: ms@2.1.3: {} + murmurhash-js@1.0.0: {} + mute-stream@2.0.0: {} nanoid@3.3.11: {} @@ -10936,6 +11123,10 @@ snapshots: pathe@2.0.3: {} + pbf@5.1.2: + dependencies: + resolve-protobuf-schema: 2.1.0 + pdf-lib@1.17.1: dependencies: '@pdf-lib/standard-fonts': 1.0.0 @@ -11001,6 +11192,8 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.1 + potpack@2.1.0: {} + pptxgenjs@4.0.1: dependencies: '@types/node': 22.19.7 @@ -11145,6 +11338,8 @@ snapshots: prosemirror-state: 1.4.4 prosemirror-transform: 1.11.0 + protocol-buffers-schema@3.6.1: {} + proxy-agent@6.3.1: dependencies: agent-base: 7.1.4 @@ -11211,6 +11406,8 @@ snapshots: quick-format-unescaped@4.0.4: {} + quickselect@3.0.0: {} + randombytes@2.1.0: dependencies: safe-buffer: 5.1.2 @@ -11411,6 +11608,10 @@ snapshots: resolve-pkg-maps@1.0.0: {} + resolve-protobuf-schema@2.1.0: + dependencies: + protocol-buffers-schema: 3.6.1 + resq@1.11.0: dependencies: fast-deep-equal: 2.0.1 @@ -11823,6 +12024,8 @@ snapshots: fdir: 6.5.0(picomatch@4.0.3) picomatch: 4.0.3 + tinyqueue@3.0.0: {} + tinyrainbow@1.2.0: {} tinyrainbow@3.0.3: {} @@ -12390,6 +12593,8 @@ snapshots: compress-commons: 6.0.2 readable-stream: 4.7.0 + zod@4.6.7: {} + zustand@5.0.11(@types/react@18.3.27)(immer@11.1.4)(react@18.3.1)(use-sync-external-store@1.6.0(react@18.3.1)): optionalDependencies: '@types/react': 18.3.27 diff --git a/research_intelligent_ui/findings_web.md b/research_intelligent_ui/findings_web.md new file mode 100644 index 0000000000..ad3a9eba6d --- /dev/null +++ b/research_intelligent_ui/findings_web.md @@ -0,0 +1,14 @@ +# Findings + +- OpenAI Help Center defines Intelligent UI as ChatGPT combining text, visuals and interactive elements; GPT-6 composes graphics, buttons, forms, charts and interactive experiences. The page describes the feature but does not announce source code or a license: https://help.openai.com/en/articles/20001598-intelligent-ui-in-chatgpt +- OpenAI says Apps SDK is open source, built on MCP; it lets developers define app logic/UI and run apps inside ChatGPT: https://help.openai.com/en/articles/12515353-building-with-the-apps-sdk +- OpenAI's developer quickstart says ChatGPT implements the open MCP Apps UI standard, where an optional web component is rendered in an iframe; recommends standard MCP Apps bridge and optional window.openai extensions: https://developers.openai.com/plugins/build/app-quickstart +- OpenAI's apps announcement says Apps SDK is an open standard built on MCP and open source; apps define interface/chat logic with own code. https://openai.com/index/introducing-apps-in-chatgpt/ +- Official OpenAI apps-sdk-ui package is public and MIT licensed; description is a design system for building apps for ChatGPT with Apps SDK: https://github.com/openai/apps-sdk-ui/blob/main/package.json +- Official examples repo is MIT and includes Pizzaz, solar-system, kitchen-sink and authenticated widgets: https://github.com/openai/openai-apps-sdk-examples +- thesysdev/open-intelligent-ui is a public MIT repo explicitly described as an independent open-source implementation of the Intelligent UI experience, built on OpenUI. It streams OpenUI Lang and renders maps/photos/charts/drawings/tools; disclaimer says unaffiliated with OpenAI: https://github.com/thesysdev/open-intelligent-ui +- thesysdev/openui is MIT, a full-stack framework-agnostic generative UI framework with OpenUI Lang, streaming renderers for React/Vue/Svelte/Angular, component libraries and chat surfaces: https://github.com/thesysdev/openui +- MCP-UI is Apache-2.0; creates UI resources over MCP and renders them in sandboxed iframes; supports MCP Apps hosts including Claude, VS Code, Goose, LibreChat, etc. Its roadmap still lists generative UI as future work, so it is better for server-defined tool UIs than open-ended automatic composition: https://github.com/MCP-UI-Org/mcp-ui +- CopilotKit generative-ui repo describes three patterns (controlled AG-UI, declarative A2UI/Open-JSON-UI, open-ended MCP Apps) and OpenGenerativeUI, where an agent emits HTML/SVG/Canvas into a sandboxed iframe; OpenGenerativeUI repo says MIT: https://github.com/CopilotKit/generative-ui and https://github.com/CopilotKit/OpenGenerativeUI +- Google A2UI is an open-source Apache 2 project for declarative, cross-platform agent-generated UI from trusted component catalogs, with native renderers and streaming updates: https://developers.googleblog.com/introducing-a2ui-an-open-project-for-agent-driven-interfaces/ and https://github.com/a2ui-project/a2ui +- Vercel AI SDK is an open-source provider-agnostic TypeScript toolkit; its UI module has hooks for chatbots and generative UIs: https://github.com/vercel/ai diff --git a/research_intelligent_ui/research_plan.md b/research_intelligent_ui/research_plan.md new file mode 100644 index 0000000000..0a768515c7 --- /dev/null +++ b/research_intelligent_ui/research_plan.md @@ -0,0 +1,10 @@ +# Research plan + +主问题:ChatGPT 的 “Intelligent UI” 是否开源?如果没有,当前有哪些可用的开源实现或相近方案? + +子问题: +1. “Intelligent UI” 的官方含义与 OpenAI 发布/开源状态(确认术语,查官方公告、文档、仓库)。 +2. 相关协议和能力(Apps/Connectors、MCP、生成式 UI、UI 组件/交互)是否开放,以及限制。 +3. 可自建的开源替代方案:按能力相似度、成熟度、许可证和部署形态比较。 + +综合方法:优先引用官方文档/仓库,再引用项目官方仓库与文档;区分“ChatGPT 产品代码开源”与“协议/SDK 开放”“第三方仿制实现”。 diff --git a/scripts/audit-appearance-contracts.mjs b/scripts/audit-appearance-contracts.mjs index 4ad000e7b5..03f143e386 100644 --- a/scripts/audit-appearance-contracts.mjs +++ b/scripts/audit-appearance-contracts.mjs @@ -21,8 +21,6 @@ const crossBoundaryRoots = [ path.join(repoRoot, 'tests', 'e2e', 'specs'), path.join(repoRoot, 'tests', 'e2e', 'helpers'), path.join(repoRoot, 'src', 'crates', 'contracts', 'product-domains', 'src', 'miniapp'), - path.join(repoRoot, 'src', 'crates', 'services', 'services-integrations', 'src', 'canvas'), - path.join(repoRoot, 'src', 'crates', 'assembly', 'core', 'builtin_skills', 'openbitfun-canvas'), path.join(repoRoot, 'src', 'crates', 'assembly', 'core', 'builtin_skills', 'miniapp-dev'), ]; const failures = []; @@ -686,10 +684,7 @@ for (const sceneFile of walk(sceneRoot).filter(file => file.endsWith('Scene.tsx' } } -const visualEntryPoints = new Set([ - 'main.tsx', - 'tools/openbitfun-canvas/runtime/entry.tsx', -]); +const visualEntryPoints = new Set(['main.tsx']); const styledProductionTsx = productionCodeSources.filter(([file, source]) => { if (!file.endsWith('.tsx')) return false; const sourceRelative = path.relative(sourceRoot, file).replaceAll(path.sep, '/'); @@ -853,8 +848,6 @@ for (const [file, source] of productionSources) { const crossBoundaryForbiddenContracts = [ ['hostTheme', /\bhostTheme\b/], - ['CanvasHostTheme', /\bCanvasHostTheme\b/], - ['openbitfun-canvas-theme', /openbitfun-canvas-theme/], ['onThemeChange', /\bonThemeChange\b/], ['data-theme-type', /data-theme-type/], ['openbitfun/request-theme', /openbitfun\/request-theme/], diff --git a/scripts/core-boundaries/cargo-dependency-boundaries.mjs b/scripts/core-boundaries/cargo-dependency-boundaries.mjs index b0faaf0a38..8f45cd2e80 100644 --- a/scripts/core-boundaries/cargo-dependency-boundaries.mjs +++ b/scripts/core-boundaries/cargo-dependency-boundaries.mjs @@ -149,7 +149,6 @@ const SERVICES_INTEGRATIONS_TOKIO_FEATURES = new Map([ ['models-dev', ['fs', 'rt', 'sync', 'time']], // Browser profile files and process probes use spawn_blocking off async IO workers. ['browser-control', ['rt', 'time']], - ['canvas-runtime', ['fs']], ['deep-research', []], ['git', ['fs', 'io-util', 'macros', 'rt', 'time']], ['file-watch', ['rt', 'sync']], @@ -1495,7 +1494,6 @@ export function findProductEntrypointCoreFeatureViolations( 'agent-runtime', 'ai-adapter-runtime', 'browser-control', - 'canvas-runtime', 'deep-research', 'document-read', 'external-sources', @@ -1518,7 +1516,6 @@ export function findProductEntrypointCoreFeatureViolations( 'tools-agent-control', 'tools-basic', 'tools-browser-web', - 'tools-canvas', 'tools-computer-use', 'tools-creation', 'tools-git', diff --git a/scripts/core-boundaries/explicit-test-topology.mjs b/scripts/core-boundaries/explicit-test-topology.mjs index 2cf1f4f7f9..8f8749983a 100644 --- a/scripts/core-boundaries/explicit-test-topology.mjs +++ b/scripts/core-boundaries/explicit-test-topology.mjs @@ -180,7 +180,6 @@ export const productDomainsIntegrationTestTargets = [ name: 'product_domain_contracts', path: 'tests/product_domain_contracts.rs', leaves: [ - 'tests/product_domain_contracts/canvas_contracts.rs', 'tests/product_domain_contracts/tool_permission_contracts.rs', ], forbidRequiredFeatures: true, diff --git a/scripts/core-boundaries/rules/feature-rules.mjs b/scripts/core-boundaries/rules/feature-rules.mjs index 052e0d6b11..fc13e5f281 100644 --- a/scripts/core-boundaries/rules/feature-rules.mjs +++ b/scripts/core-boundaries/rules/feature-rules.mjs @@ -189,7 +189,6 @@ export const optionalDependencyFeatureOwnerRules = [ depName: 'openbitfun-product-domains', ownerFeatures: [ 'agent-runtime', - 'canvas-runtime', 'function-agents', 'plugin-source', 'product-search', @@ -201,7 +200,6 @@ export const optionalDependencyFeatureOwnerRules = [ { depName: 'openbitfun-services-integrations', ownerFeatures: [ - 'canvas-runtime', 'browser-control', 'deep-research', 'external-sources', @@ -230,7 +228,6 @@ export const optionalDependencyFeatureOwnerRules = [ 'tools-agent-control', 'tools-basic', 'tools-browser-web', - 'tools-canvas', 'tools-computer-use', 'tools-creation', 'tools-git', @@ -293,7 +290,7 @@ export const optionalDependencyFeatureOwnerRules = [ depName: 'openbitfun-core-types', ownerFeatures: ['deep-research', 'ptc-runtime', 'remote-connect', 'remote-ssh-concrete', 'speech'], }, - { depName: 'openbitfun-product-domains', ownerFeatures: ['account-identity', 'canvas-runtime', 'function-agents', 'hook-import', 'miniapp-market', 'miniapp-runtime', 'miniapp-storage', 'plugin-source', 'remote-connect'] }, + { depName: 'openbitfun-product-domains', ownerFeatures: ['account-identity', 'function-agents', 'hook-import', 'miniapp-market', 'miniapp-runtime', 'miniapp-storage', 'plugin-source', 'remote-connect'] }, { depName: 'openbitfun-runtime-ports', ownerFeatures: ['deep-research', 'git', 'ptc-runtime', 'remote-connect', 'remote-ssh', 'remote-ssh-concrete', 'script-tool-runtime', 'web-tools'] }, { depName: 'openbitfun-services-core', @@ -335,7 +332,6 @@ export const optionalDependencyFeatureOwnerRules = [ { depName: 'mac_address', ownerFeatures: ['remote-connect'] }, { depName: 'md5', ownerFeatures: ['remote-connect'] }, { depName: 'notify', ownerFeatures: ['file-watch'] }, - { depName: 'oxc', ownerFeatures: ['canvas-runtime'] }, { depName: 'qrcode', ownerFeatures: ['remote-connect'] }, { depName: 'rand', ownerFeatures: ['mcp', 'remote-connect', 'remote-persistence', 'remote-ssh-concrete'] }, // remote-ssh-concrete: one-click relay deploy fetches the signed release @@ -349,7 +345,7 @@ export const optionalDependencyFeatureOwnerRules = [ { depName: 'rustls', ownerFeatures: ['remote-connect'] }, { depName: 'rustls-native-certs', ownerFeatures: ['remote-connect'] }, { depName: 'schannel', ownerFeatures: ['remote-connect'] }, - { depName: 'sha2', ownerFeatures: ['canvas-runtime', 'hook-import', 'mcp', 'miniapp-market', 'models-dev', 'plugin-source', 'remote-connect', 'remote-persistence', 'remote-ssh', 'review-platform', 'speech'] }, + { depName: 'sha2', ownerFeatures: ['hook-import', 'mcp', 'miniapp-market', 'models-dev', 'plugin-source', 'remote-connect', 'remote-persistence', 'remote-ssh', 'review-platform', 'speech'] }, { depName: 'sherpa-onnx', ownerFeatures: ['speech'] }, { depName: 'shellexpand', ownerFeatures: ['remote-ssh-concrete'] }, { depName: 'sse-stream', ownerFeatures: ['mcp'] }, @@ -358,8 +354,8 @@ export const optionalDependencyFeatureOwnerRules = [ { depName: 'thiserror', ownerFeatures: ['account-identity', 'browser-control', 'git', 'hook-import', 'miniapp-market', 'plugin-source', 'remote-connect', 'remote-ssh', 'remote-ssh-concrete', 'review-platform', 'speech', 'web-tools', 'workspace-search'] }, { depName: 'tokio-tungstenite', ownerFeatures: ['remote-connect', 'speech-realtime'] }, { depName: 'tokio-util', ownerFeatures: ['remote-ssh', 'speech'] }, - { depName: 'urlencoding', ownerFeatures: ['canvas-runtime', 'miniapp-market', 'remote-connect', 'review-platform'] }, - { depName: 'uuid', ownerFeatures: ['canvas-runtime', 'hook-import', 'miniapp-runtime', 'miniapp-storage', 'plugin-source', 'remote-connect', 'remote-ssh-concrete', 'speech'] }, + { depName: 'urlencoding', ownerFeatures: ['miniapp-market', 'remote-connect', 'review-platform'] }, + { depName: 'uuid', ownerFeatures: ['hook-import', 'miniapp-runtime', 'miniapp-storage', 'plugin-source', 'remote-connect', 'remote-ssh-concrete', 'speech'] }, { depName: 'which', ownerFeatures: ['miniapp-runtime', 'ptc-runtime', 'remote-connect', 'script-tool-runtime', 'workspace-search'] }, { depName: 'windows', ownerFeatures: ['models-dev', 'plugin-source', 'remote-connect', 'remote-persistence', 'remote-ssh-concrete', 'review-platform'] }, { depName: 'x25519-dalek', ownerFeatures: ['remote-connect'] }, @@ -746,7 +742,6 @@ export const coreProductFullFeatureAssemblyRule = { 'tools-agent-control', 'tools-basic', 'tools-browser-web', - 'tools-canvas', 'tools-computer-use', 'tools-creation', 'tools-git', @@ -757,7 +752,6 @@ export const coreProductFullFeatureAssemblyRule = { 'tools-pages', 'web-tools', 'workspace-search', - 'canvas-runtime', 'dispatch-store', 'file-watch', 'filesystem', @@ -1434,16 +1428,6 @@ export const coreClosedFeatureProfileRules = [ exact: true, reason: 'tools-creation must own only Creative product-authoring tools', }, - { - manifestPath: 'src/crates/assembly/core/Cargo.toml', - featureName: 'tools-canvas', - requiredFeatureRefs: [ - 'openbitfun-tool-packs/canvas', - 'canvas-runtime', - ], - exact: true, - reason: 'tools-canvas must compose only Canvas tools and runtime IO', - }, { manifestPath: 'src/crates/assembly/core/Cargo.toml', featureName: 'tools-agent-control', @@ -1468,17 +1452,6 @@ export const coreClosedFeatureProfileRules = [ reason: 'openbitfun-core function-agents must own only function-agent contracts and concrete Git/AI adapters', }, - { - manifestPath: 'src/crates/assembly/core/Cargo.toml', - featureName: 'canvas-runtime', - requiredFeatureRefs: [ - 'dep:openbitfun-product-domains', - 'openbitfun-services-integrations/canvas-runtime', - ], - exact: true, - reason: - 'openbitfun-core canvas-runtime must extend only the product domain surface with Canvas runtime IO', - }, { manifestPath: 'src/crates/services/services-core/Cargo.toml', featureName: 'default', @@ -1863,7 +1836,6 @@ export const ownerCrateFeatureAssemblyRules = [ 'miniapp', 'pages', 'creation', - 'canvas', 'agent-control', ], }, @@ -1880,7 +1852,6 @@ export const ownerCrateFeatureAssemblyRules = [ ], requiredProductFullFeatures: [ 'browser-control', - 'canvas-runtime', 'deep-research', 'file-watch', 'function-agents', diff --git a/scripts/core-boundaries/rules/source/forbidden-rules.mjs b/scripts/core-boundaries/rules/source/forbidden-rules.mjs index f0690aa8fc..f81f7b9cef 100644 --- a/scripts/core-boundaries/rules/source/forbidden-rules.mjs +++ b/scripts/core-boundaries/rules/source/forbidden-rules.mjs @@ -4006,14 +4006,6 @@ export const rustWebUiSourceBoundaryRule = { path: 'src/crates/execution/agent-runtime/src/deep_review/manifest.rs', text: '"src/web-ui/src/locales/en-US/flow-chat.json"', }, - { - path: 'src/crates/services/services-integrations/src/canvas/compiler/tests.rs', - text: "nodes: [{ id: 'web-ui' }, { id: 'core' }],", - }, - { - path: 'src/crates/services/services-integrations/src/canvas/compiler/tests.rs', - text: "edges: [{ from: 'web-ui', to: 'core' }],", - }, ], message: 'non-comment Rust source must not spell the web-ui path token outside reviewed fixture lines', diff --git a/scripts/core-boundaries/rules/source/required-rules.mjs b/scripts/core-boundaries/rules/source/required-rules.mjs index c575b66548..954760870c 100644 --- a/scripts/core-boundaries/rules/source/required-rules.mjs +++ b/scripts/core-boundaries/rules/source/required-rules.mjs @@ -3742,17 +3742,6 @@ export const requiredContentRules = [ regex: /tools-miniapp = \[[^\]]*"openbitfun-product-domains\/miniapp"[^\]]*\]/, message: 'core MiniApp tool owner must select its product-domain slice explicitly', }, - { - regex: /canvas-runtime = \[[^\]]*"openbitfun-services-integrations\/canvas-runtime"[^\]]*\]/, - message: - 'core canvas-runtime facade must enable the Canvas service owner feature it imports', - }, - { - regex: - /canvas-runtime = \[[\s\S]*"dep:openbitfun-product-domains"[\s\S]*"openbitfun-services-integrations\/canvas-runtime"[\s\S]*\]/, - message: - 'core canvas-runtime feature must explicitly aggregate the domain contract and canvas service owner', - }, { regex: /openbitfun-product-domains = \{ path = "\.\.\/\.\.\/contracts\/product-domains", optional = true \}/, diff --git a/scripts/core-boundaries/self-test.mjs b/scripts/core-boundaries/self-test.mjs index 93804e6636..3ce1d510a1 100644 --- a/scripts/core-boundaries/self-test.mjs +++ b/scripts/core-boundaries/self-test.mjs @@ -372,7 +372,6 @@ export function runManifestParserSelfTest({ 'agent-runtime', 'diagnostics', 'diff', - 'canvas-runtime', 'dispatch-store', 'file-watch', 'filesystem', @@ -557,11 +556,6 @@ export function runManifestParserSelfTest({ 'openbitfun-services-integrations/remote-ssh', ], ], - [ - coreManifest, - 'canvas-runtime', - ['dep:openbitfun-product-domains', 'openbitfun-services-integrations/canvas-runtime'], - ], [coreManifest, 'file-watch', ['openbitfun-services-integrations/file-watch']], [coreManifest, 'git', ['openbitfun-services-integrations/git']], [coreManifest, 'review-platform', ['openbitfun-services-integrations/review-platform']], @@ -4493,8 +4487,6 @@ export function runManifestParserSelfTest({ 'openbitfun-product-domains = \\{ path = "\\.\\.\\/\\.\\.\\/contracts\\/product-domains", optional = true \\}', 'dep:openbitfun-ai-adapters', 'ai-adapter-runtime', - 'canvas-runtime', - 'openbitfun-services-integrations\\/canvas-runtime', 'openbitfun-services-integrations\\/function-agents', 'openbitfun-services-integrations\\/miniapp-runtime', 'dep:openbitfun-product-capabilities', diff --git a/scripts/generate-canvas-sdk-contract.mjs b/scripts/generate-canvas-sdk-contract.mjs deleted file mode 100644 index 05855e6c3a..0000000000 --- a/scripts/generate-canvas-sdk-contract.mjs +++ /dev/null @@ -1,93 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import process from 'node:process'; -import { spawnSync } from 'node:child_process'; -import { fileURLToPath } from 'node:url'; - -const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); -const sourcePath = path.join(root, 'src/shared/canvas/sdk-contract.json'); -const check = process.argv.includes('--check'); -const contract = JSON.parse(fs.readFileSync(sourcePath, 'utf8')); - -const componentNames = Object.keys(contract.components); -const runtimeExports = [...componentNames, ...contract.nonComponentExports]; - -function rustString(value) { - return JSON.stringify(value); -} - -function rustSlice(values) { - return `&[${values.map(rustString).join(', ')}]`; -} - -function generateRust() { - const componentArms = componentNames - .map(name => ` ${rustString(name)} => Some(${rustSlice(contract.components[name].props)}),`) - .join('\n'); - const backingArms = componentNames - .map(name => ` ${rustString(name)} => Some(${rustString(contract.components[name].backing)}),`) - .join('\n'); - const appearanceArms = Object.entries(contract.appearanceTokenGroups) - .map(([group, values]) => ` ${rustString(group)} => (${rustSlice(values)}).contains(&token),`) - .join('\n'); - return `// Generated by scripts/generate-canvas-sdk-contract.mjs. Do not edit.\n\n` + - `pub const OPENBITFUN_CANVAS_SDK_VERSION: &str = ${rustString(contract.sdkVersion)};\n` + - `pub const OPENBITFUN_CANVAS_RUNTIME_VERSION: &str = ${rustString(contract.runtimeVersion)};\n` + - `pub const CANVAS_SDK_RUNTIME_EXPORTS: &[&str] = ${rustSlice(runtimeExports)};\n` + - `pub const CANVAS_SDK_COMMON_PROPS: &[&str] = ${rustSlice(contract.commonProps)};\n\n` + - `pub fn canvas_sdk_component_props(component: &str) -> Option<&'static [&'static str]> {\n match component {\n${componentArms}\n _ => None,\n }\n}\n\n` + - `pub fn canvas_sdk_component_backing(component: &str) -> Option<&'static str> {\n match component {\n${backingArms}\n _ => None,\n }\n}\n\n` + - `pub fn canvas_appearance_token_group_allows(group: &str, token: &str) -> bool {\n match group {\n${appearanceArms}\n _ => false,\n }\n}\n`; -} - -function formatRust(source) { - const result = spawnSync('rustfmt', ['--emit', 'stdout', '--edition', '2021'], { - encoding: 'utf8', - input: source, - }); - if (result.status !== 0) { - throw new Error(`rustfmt failed while generating the Canvas SDK contract: ${result.stderr || result.stdout}`); - } - return result.stdout; -} - -function generateTypeScript() { - return `// Generated by scripts/generate-canvas-sdk-contract.mjs. Do not edit.\n` + - `export const canvasSdkContract = ${JSON.stringify({ ...contract, runtimeExports }, null, 2)} as const;\n\n` + - `export const CANVAS_SDK_VERSION = canvasSdkContract.sdkVersion;\n` + - `export const CANVAS_RUNTIME_VERSION = canvasSdkContract.runtimeVersion;\n` + - `export const CANVAS_SDK_RUNTIME_EXPORTS = canvasSdkContract.runtimeExports;\n`; -} - -const outputs = [ - { - path: 'src/crates/contracts/product-domains/src/canvas/sdk_contract.generated.rs', - content: formatRust(generateRust()), - }, - { - path: 'src/web-ui/src/tools/openbitfun-canvas/runtime/sdk/contract.generated.ts', - content: generateTypeScript(), - }, - { - path: 'src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/sdk-contract.generated.json', - content: `${JSON.stringify({ ...contract, runtimeExports }, null, 2)}\n`, - }, -]; - -let stale = false; -for (const output of outputs) { - const absolutePath = path.join(root, output.path); - const current = fs.existsSync(absolutePath) ? fs.readFileSync(absolutePath, 'utf8').replaceAll('\r\n', '\n') : ''; - const expected = output.content.replaceAll('\r\n', '\n'); - if (current === expected) continue; - if (check) { - console.error(`[canvas-sdk:check] stale generated file: ${output.path}`); - stale = true; - continue; - } - fs.mkdirSync(path.dirname(absolutePath), { recursive: true }); - fs.writeFileSync(absolutePath, expected); - console.log(`[canvas-sdk:generate] wrote ${output.path}`); -} - -if (stale) process.exitCode = 1; diff --git a/scripts/generate-genui-contract.mjs b/scripts/generate-genui-contract.mjs new file mode 100644 index 0000000000..bc6139e355 --- /dev/null +++ b/scripts/generate-genui-contract.mjs @@ -0,0 +1,8 @@ +import { readFileSync, writeFileSync } from 'node:fs'; +import { compileCatalog } from '../src/shared/generative-ui/library.mjs'; +const path = new URL('../src/shared/generative-ui/', import.meta.url); +const output = JSON.stringify(compileCatalog(JSON.parse(readFileSync(new URL('library.json', path), 'utf8'))), null, 2) + '\n'; +const target = new URL('catalog.json', path); +if (process.argv.includes('--check')) { + if (readFileSync(target, 'utf8') !== output) throw new Error('GenUI catalog is stale; run node scripts/generate-genui-contract.mjs'); +} else writeFileSync(target, output); diff --git a/scripts/generate-startup-appearance-bootstrap.mjs b/scripts/generate-startup-appearance-bootstrap.mjs index e43a764070..29d864e70d 100644 --- a/scripts/generate-startup-appearance-bootstrap.mjs +++ b/scripts/generate-startup-appearance-bootstrap.mjs @@ -13,10 +13,6 @@ const outputPath = path.join( repoRoot, 'src/apps/desktop/src/generated/startup_appearance_bootstrap.json', ); -const appearancePromptSnapshotOutputPath = path.join( - repoRoot, - 'src/crates/assembly/core/src/agentic/tools/implementations/generated/appearance_prompt_snapshots.json', -); const desktopBootstrapThemeOutputPath = path.join( repoRoot, 'src/apps/desktop/src/generated/bootstrap_theme.css', @@ -59,12 +55,10 @@ try { const [ { builtinAppearancePalettes }, { createStartupAppearanceBootstrapManifest }, - { createAppearancePromptSnapshotManifest }, { themes, themeCssVariables }, ] = await Promise.all([ server.ssrLoadModule('/src/infrastructure/appearance/builtins/palettes.ts'), server.ssrLoadModule('/src/infrastructure/appearance/builtins/startupAppearanceBootstrap.ts'), - server.ssrLoadModule('/src/infrastructure/appearance/builtins/appearancePromptSnapshots.ts'), import(pathToFileURL(themePackageEntryPath).href), ]); @@ -74,11 +68,6 @@ try { outputPath, content: `${JSON.stringify(createStartupAppearanceBootstrapManifest(builtinAppearancePalettes), null, 2)}\n`, }, - { - label: 'Appearance prompt snapshot manifest', - outputPath: appearancePromptSnapshotOutputPath, - content: `${JSON.stringify(createAppearancePromptSnapshotManifest(builtinAppearancePalettes), null, 2)}\n`, - }, { label: 'Desktop bootstrap theme projection', outputPath: desktopBootstrapThemeOutputPath, diff --git a/scripts/interactive-capabilities.test.mjs b/scripts/interactive-capabilities.test.mjs index 1921aadc85..331d32cbb0 100644 --- a/scripts/interactive-capabilities.test.mjs +++ b/scripts/interactive-capabilities.test.mjs @@ -443,7 +443,7 @@ test('Desktop and Web UI share the OpenBitFunControl transport contract', async assert.match(source, /agentic:\/\/openbitfun-control-request/u); } assert.match(host, /#\[serde\(rename_all = "camelCase"\)\]/u); - assert.match(bridge, /api\.invoke\('mark_openbitfun_control_surface_ready',\s*\{\s*request:\s*\{\s*creationApiVersion:\s*1\s*\}\s*\}\)/u); + assert.match(bridge, /api\.invoke\('mark_openbitfun_control_surface_ready',\s*\{\s*request:\s*\{\s*creationApiVersion:\s*1,\s*genUiApiVersion:\s*1\s*\}\s*\}\)/u); assert.match(bridge, /api\.invoke\('report_openbitfun_control_result'/u); assert.match(desktopRegistration, /openbitfun_control_host::mark_openbitfun_control_surface_ready/u); assert.match(desktopRegistration, /openbitfun_control_host::report_openbitfun_control_result/u); diff --git a/scripts/test-genui-browser.mjs b/scripts/test-genui-browser.mjs new file mode 100644 index 0000000000..c5d2205811 --- /dev/null +++ b/scripts/test-genui-browser.mjs @@ -0,0 +1,213 @@ +// Real browser rendering/events; storage and locale use explicit fixture ports. +// Native owner durability is verified separately by the Rust service tests. +import assert from 'node:assert/strict'; +import { createRequire } from 'node:module'; +import { writeFile, mkdir } from 'node:fs/promises'; +import { join } from 'node:path'; + +const requireE2e = createRequire(new URL('../tests/e2e/package.json', import.meta.url)); +const requireWdio = createRequire(requireE2e.resolve('@wdio/cli')); +const puppeteer = requireWdio('puppeteer-core'); +const url = process.env.OPENBITFUN_GENUI_TEST_URL; +if (!url) throw new Error('Set OPENBITFUN_GENUI_TEST_URL to this checkout Vite /tests/e2e/generative-ui.html'); +const browser = await puppeteer.launch({ + ...(process.env.CHROME_PATH ? { executablePath: process.env.CHROME_PATH } : { channel: 'chrome' }), + headless: 'new', +}); +try { + const page = await browser.newPage(); + await page.setViewport({ width: 1280, height: 900 }); + const errors = []; + page.on('pageerror', error => errors.push(String(error))); + page.on('console', message => { if (message.type() === 'error') errors.push(message.text()); }); + const setInputValue = async (selector, value) => page.evaluate((target, next) => { + const element = [...document.querySelectorAll(target)].find(candidate => { + const rect = candidate.getBoundingClientRect(); + return rect.width > 0 && rect.height > 0 && !candidate.closest('[inert]'); + }); + if (!element) throw new Error('Visible input not found: ' + target); + const input = element; + const prototype = input instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype; + const setter = Object.getOwnPropertyDescriptor(prototype, 'value')?.set; + if (!setter) throw new Error('Input has no writable value setter'); + setter.call(input, next); + input.dispatchEvent(new Event('input', { bubbles: true })); + input.dispatchEvent(new Event('change', { bubbles: true })); + }, selector, value); + const waitForReactiveText = value => page.waitForFunction(expected => [...document.querySelectorAll('.gen-ui-oi-text,.iui-text')].some(element => element.textContent === expected && !element.closest('[inert]')), {}, value); + const verify = async () => { + await page.waitForSelector('html[data-genui-result]', { timeout: 60000 }); + await page.waitForSelector('[data-testid="genui-evidence"]', { timeout: 60000 }); + const reports = await page.$eval('[data-testid="genui-evidence"]', element => JSON.parse(element.textContent)); + assert.equal(await page.$eval('html', element => element.dataset.genuiResult), 'passed', JSON.stringify(reports)); + for (const name of ['openui', 'harmony', 'openui-source', 'free']) { + for (const stage of ['preflight', 'checks', 'render', 'reopen', 'probeReopen', 'layout']) assert.equal(reports[name][stage], 'passed', name + '.' + stage); + assert.deepEqual(reports[name].layoutWidths, ['harmony', 'free', 'openui-source'].includes(name) ? [360] : [360, 960]); + if (name === 'harmony' || name === 'free' || name === 'openui-source') { + assert.deepEqual(reports[name].designSpec, { id: 'harmony.phone.v1', revision: 1 }); + assert.equal(reports[name].viewport, '360x764'); + assert.equal(reports[name].hostShell, 'passed'); + } + if (name === 'free') assert.equal(reports[name].screenshotBytes, undefined); + else assert(reports[name].screenshotBytes > 100); + } + }; + await page.goto(url); + await verify(); + const harmonyProbe = await page.$eval('[data-testid="harmony-style-probe"]', element => { + const app = element.querySelector('[data-gen-ui-app="harmony-style-probe"]'); + const card = app?.querySelector('.gen-ui-oi-card'); + const button = app?.querySelector('button.gen-ui-oi-button'); + const input = app?.querySelector('.gen-ui-oi-field input'); + const slider = app?.querySelector('.gen-ui-oi-slider input[type="range"]'); + const icon = app?.querySelector('.hm-icon'); + const frame = element.querySelector('.gen-ui-phone-device'); + return { + theme: app?.getAttribute('data-hm-theme'), + font: app?.getAttribute('data-hm-font'), + scheme: app?.getAttribute('data-hm-scheme'), + frameTheme: frame?.getAttribute('data-hm-theme'), + cardRadius: card ? getComputedStyle(card).borderRadius : '', + buttonRadius: button ? getComputedStyle(button).borderRadius : '', + inputRadius: input ? getComputedStyle(input).borderRadius : '', + track: slider ? getComputedStyle(slider).getPropertyValue('--hm-track').trim() : '', + iconName: icon?.getAttribute('data-icon'), + iconFont: icon ? getComputedStyle(icon).fontFamily : '', + }; + }); + assert.deepEqual(harmonyProbe, { + theme: 'green', font: 'sans', scheme: 'light', frameTheme: 'green', + cardRadius: '24px', buttonRadius: '999px', inputRadius: '20px', track: '4px', + iconName: 'house', iconFont: '"HM Symbol"', + }); + const harmonyHtmlFrameElement = await page.$('[data-testid="harmony-html-style-probe"] iframe[data-gen-ui-html-frame]'); + assert(harmonyHtmlFrameElement, 'Harmony HTML style probe iframe did not mount'); + const harmonyHtmlFrame = await harmonyHtmlFrameElement.contentFrame(); + assert(harmonyHtmlFrame, 'Harmony HTML style probe did not expose a browser frame'); + await harmonyHtmlFrame.waitForSelector('.hero-ring, .list-item, .progress'); + const harmonyHtmlProbe = await harmonyHtmlFrame.evaluate(() => { + const root = document.documentElement; + const card = document.querySelector('.card'); + const ring = document.querySelector('.hero-ring'); + const progress = document.querySelector('.progress'); + const toggle = document.querySelector('.switch'); + const chip = document.querySelector('.chip.active'); + return { + theme: root.getAttribute('data-hm-theme'), + font: root.getAttribute('data-hm-font'), + cardRadius: card ? getComputedStyle(card).borderRadius : '', + ringSize: ring ? getComputedStyle(ring).width : '', + progressHeight: progress ? getComputedStyle(progress).height : '', + switchWidth: toggle ? getComputedStyle(toggle).width : '', + switchColor: toggle ? getComputedStyle(toggle).backgroundColor : '', + chipRadius: chip ? getComputedStyle(chip).borderRadius : '', + }; + }); + assert.deepEqual(harmonyHtmlProbe, { + theme: 'green', font: 'sans', cardRadius: '24px', ringSize: '176px', + progressHeight: '4px', switchWidth: '36px', switchColor: 'rgb(58, 131, 87)', chipRadius: '14px', + }); + const harmonyDarkProbe = await page.$eval('[data-testid="harmony-dark-style-probe"]', element => { + const app = element.querySelector('[data-gen-ui-app="harmony-dark-style-probe"]'); + const card = app?.querySelector('.gen-ui-oi-card'); + const frame = element.querySelector('.gen-ui-phone-device'); + return { + theme: app?.getAttribute('data-hm-theme'), + font: app?.getAttribute('data-hm-font'), + scheme: app?.getAttribute('data-hm-scheme'), + frameScheme: frame?.getAttribute('data-hm-scheme'), + cardBackground: card ? getComputedStyle(card).backgroundColor : '', + frameBackground: frame ? getComputedStyle(frame).backgroundColor : '', + }; + }); + assert.deepEqual(harmonyDarkProbe, { + theme: 'purple', font: 'handwritten', scheme: 'dark', frameScheme: 'dark', + cardBackground: 'rgba(255, 255, 255, 0.1)', frameBackground: 'rgb(50, 46, 54)', + }); + const freeFrameElement = await page.$('[data-testid="free-live-document"] iframe[data-gen-ui-html-frame]'); + assert(freeFrameElement, 'Free document iframe did not mount in the live host'); + const freeFrame = await freeFrameElement.contentFrame(); + assert(freeFrame, 'Free document iframe did not expose a browser frame'); + await freeFrame.waitForSelector('svg[aria-label="Decorative chart"]'); + assert.match(await freeFrame.$eval('body', element => element.textContent ?? ''), /Free SVG/); + assert.equal(await freeFrame.$eval('meta[name="openbitfun-design-spec"]', element => element.content), 'Harmony phone@1'); + assert.equal(await freeFrame.$eval('meta[name="openbitfun-style-resources"]', element => element.content), 'openbitfun-theme-tokens,openbitfun-harmony-components'); + const scriptFrameElement = await page.$('[data-testid="script-live-document"] iframe[data-gen-ui-html-frame]'); + assert(scriptFrameElement, 'Controlled script iframe did not mount'); + const scriptFrame = await scriptFrameElement.contentFrame(); + assert(scriptFrame, 'Controlled script iframe did not expose a browser frame'); + await scriptFrame.waitForFunction(() => document.querySelector('[data-bridge-result]')?.textContent === 'bridge-ok'); + const scriptContext = await page.evaluate(() => JSON.parse(sessionStorage.getItem('genui-script-context'))); + assert.deepEqual(scriptContext.payload, { value: 'bridge-ok' }); + assert.equal(scriptContext.context.appId, 'script-phone'); + assert.equal(scriptContext.context.designSpec.id, 'harmony.phone.v1'); + assert.equal(scriptContext.context.designSpec.revision, 1); + assert.equal(typeof scriptContext.context.sourceKey, 'string'); + const noteSelector = '[aria-label="Shared note"]'; + await setInputValue(noteSelector, 'Updated browser note'); + await waitForReactiveText('Updated browser note'); + assert.notEqual(await page.$eval('[data-gen-ui-save]', element => element.getAttribute('data-gen-ui-save')), 'saved'); + assert.equal(await page.evaluate(() => sessionStorage.getItem('genui-browser-state')), null); + await page.reload(); + await verify(); + await page.waitForFunction(() => ![...document.querySelectorAll('.gen-ui-oi-text')].some(element => element.textContent === 'Updated browser note')); + assert.deepEqual(errors, []); + if (process.env.OPENBITFUN_GENUI_SCREENSHOT_DIR) { + await mkdir(process.env.OPENBITFUN_GENUI_SCREENSHOT_DIR, { recursive: true }); + for (const name of ['openui', 'harmony', 'openui-source', 'free']) { + const image = await page.$('[data-testid="genui-screenshot-' + name + '"]'); + if (!image) continue; + const src = await image.evaluate(element => element.src); + if (src) await writeFile(join(process.env.OPENBITFUN_GENUI_SCREENSHOT_DIR, name + '.png'), Buffer.from(src.split(',')[1], 'base64')); + } + } + const settingsUrl = new URL(url); settingsUrl.searchParams.set('settings', ''); + await page.goto(settingsUrl.href); await verify(); + await page.waitForSelector('.gen-ui-library-preview'); + await page.click('[role="combobox"]'); + await page.waitForSelector('[role="option"]'); + assert.deepEqual(await page.$$eval('[role="option"]', elements => elements.map(element => element.textContent)), ['Open Intelligent UI', 'OpenBitFun', 'Harmony']); + for (const option of await page.$$('[role="option"]')) { + if (await option.evaluate(element => element.textContent?.includes('Harmony') ?? false)) { await option.click(); break; } + } + await page.waitForSelector('[data-gen-ui-app="library-preview-harmony"]'); + assert.equal(await page.evaluate(() => sessionStorage.getItem('genui-browser-library')), 'harmony'); + await setInputValue('[aria-label="Shared note"]', 'Temporary demo'); + await waitForReactiveText('Temporary demo'); + assert.equal(await page.evaluate(() => sessionStorage.getItem('genui-browser-state')), null); + if (process.env.OPENBITFUN_GENUI_SCREENSHOT_DIR) { + await page.$eval('[data-testid="genui-evidence"]', element => { element.hidden = true; }); + await page.screenshot({ path: join(process.env.OPENBITFUN_GENUI_SCREENSHOT_DIR, 'settings-harmony.png'), fullPage: true }); + } + await page.reload(); await verify(); + await page.waitForSelector('[data-gen-ui-app="library-preview-harmony"]'); + assert.notEqual(await page.$eval('[aria-label="Shared note"]', element => element.value), 'Temporary demo'); + assert.equal(await page.$eval('select', element => element.value), 'harmony'); + assert.deepEqual(errors, []); + for (const deferred of [false, true]) { + const streamUrl = new URL(url); streamUrl.searchParams.set('streaming', ''); + if (deferred) streamUrl.searchParams.set('deferred', ''); + await page.goto(streamUrl.href); await verify(); + const next = async stage => { + await page.click('[data-testid="stream-advance"]'); + await page.waitForSelector('[data-testid="genui-stream"][data-stage="' + stage + '"]'); + }; + await next(1); + await page.waitForSelector('[data-gen-ui-app]'); + await next(2); + assert(await page.$('[data-gen-ui-app]')); + assert(await page.$eval('[data-testid="genui-stream"]', element => Number(element.dataset.sent) < Number(element.dataset.total))); + await next(3); + await page.waitForSelector('[data-gen-ui-app]'); + assert.match(await page.$eval('[data-gen-ui-app]', element => element.textContent ?? ''), /Streaming source/); + await next(4); + await page.waitForSelector('[data-gen-ui-postcheck="passed"]'); + assert.equal(await page.$$eval('[role="alert"]', elements => elements.length), 0); + } + assert.deepEqual(errors, []); + console.log('PASS GenUI mounted checks, layout, transient interaction, settings and native/deferred incremental streaming with stable DOM'); +} finally { + const child = browser.process(); + try { await browser.close(); } + finally { child?.stdin?.destroy(); child?.stdout?.destroy(); child?.stderr?.destroy(); } +} diff --git a/scripts/theme-color-governance-baseline.json b/scripts/theme-color-governance-baseline.json index 853604baa9..fde438b47d 100644 --- a/scripts/theme-color-governance-baseline.json +++ b/scripts/theme-color-governance-baseline.json @@ -87,7 +87,7 @@ "max": 0 }, "colorDomainContracts.registeredUnique": { - "max": 15 + "max": 14 }, "colorDomainContracts.missingRegisteredUnique": { "max": 0 @@ -197,12 +197,6 @@ "colorDomainNearPairs.generatedWidget.nearTotal": { "max": 0 }, - "colorDomainNearPairs.openbitfunCanvas.indistinguishableTotal": { - "max": 0 - }, - "colorDomainNearPairs.openbitfunCanvas.nearTotal": { - "max": 0 - }, "colorDomainNearPairs.mermaid.indistinguishableTotal": { "max": 0 }, @@ -278,12 +272,6 @@ "colorDomainScopes.generatedWidget.uniqueColors": { "max": 0 }, - "colorDomainScopes.openbitfunCanvas.occurrences": { - "max": 0 - }, - "colorDomainScopes.openbitfunCanvas.uniqueColors": { - "max": 0 - }, "colorDomainScopes.editor.occurrences": { "max": 0 }, diff --git a/scripts/theme-css-var-contract.mjs b/scripts/theme-css-var-contract.mjs index 28140c2927..63b8a79ffa 100644 --- a/scripts/theme-css-var-contract.mjs +++ b/scripts/theme-css-var-contract.mjs @@ -115,7 +115,6 @@ export const CONTRACT_VAR_DEFINITION_PATH_PARTS = [ 'design-system/packages/theme-openbitfun/src', 'infrastructure/appearance', 'src/mobile-web/src/styles/global.scss', - 'tools/openbitfun-canvas/runtime/styles', 'tools/generative-widget/appearancePayload.ts', ]; @@ -170,11 +169,6 @@ export const COLOR_DOMAIN_RULES = [ label: 'Generated widget', pathParts: ['tools/generative-widget'], }, - { - key: 'openbitfunCanvas', - label: 'OpenBitFun Canvas', - pathParts: ['tools/openbitfun-canvas'], - }, { key: 'mermaid', label: 'Mermaid', @@ -267,12 +261,6 @@ export const COLOR_DOMAIN_CONTRACTS = [ reason: 'Generated widgets run in an isolated iframe boundary and need an explicit payload instead of scraping host CSS variables.', mergePolicy: 'Derive fallback values from a builtin Appearance package and keep iframe payload keys canonical.', }, - { - key: 'openbitfunCanvas', - owner: 'src/web-ui/src/tools/openbitfun-canvas', - reason: 'OpenBitFun Canvas renders generated TSX inside a dedicated iframe runtime with an SDK palette that must stay isolated from app chrome tokens.', - mergePolicy: 'Keep Canvas iframe and SDK colors in the Canvas Appearance contract; promote only reusable host chrome roles to shared app tokens.', - }, { key: 'mermaid', owner: 'src/web-ui/src/tools/mermaid-editor', @@ -337,11 +325,6 @@ export const DYNAMIC_VAR_FAMILY_CONTRACTS = [ owner: 'src/web-ui/src/infrastructure/appearance/compiler/AppearanceCompiler.ts; src/web-ui/src/infrastructure/appearance/runtime/AppearanceRuntime.ts', reason: 'Appearance package image ids are validated by the package schema, then projected to host-created blob URL variables for registered component parts.', }, - { - prefix: '--openbitfun-canvas-', - owner: 'src/web-ui/src/tools/openbitfun-canvas/runtime/canvasRuntimeInstaller.ts; src/web-ui/src/tools/openbitfun-canvas/runtime/styles/canvas-runtime.scss', - reason: 'OpenBitFun Canvas iframe runtime receives host Appearance values through a scoped CSS variable family that must stay isolated from app root tokens.', - }, { prefix: '--openbitfun-font-size-', owner: 'src/web-ui/src/infrastructure/font-preference/core/FontPreferenceService.ts', diff --git a/src/apps/desktop/Cargo.toml b/src/apps/desktop/Cargo.toml index 499cdca5be..3246eabb04 100644 --- a/src/apps/desktop/Cargo.toml +++ b/src/apps/desktop/Cargo.toml @@ -27,7 +27,7 @@ openbitfun-relay-service = { path = "../../crates/services/relay-service" } openbitfun-agent-runtime = { path = "../../crates/execution/agent-runtime", features = ["agent-runtime"] } openbitfun-runtime-ports = { path = "../../crates/contracts/runtime-ports", features = ["agent-api", "permission", "workspace-ports"] } openbitfun-product-domains = { path = "../../crates/contracts/product-domains", features = ["appearance-market"] } -openbitfun-services-integrations = { path = "../../crates/services/services-integrations", features = ["canvas-runtime", "miniapp-market", "skillhub", "remote-ssh-concrete", "speech-realtime"] } +openbitfun-services-integrations = { path = "../../crates/services/services-integrations", features = ["generative-ui", "miniapp-market", "skillhub", "remote-ssh-concrete", "speech-realtime"] } openbitfun-core-types = { path = "../../crates/contracts/core-types" } openbitfun-agent-tools = { path = "../../crates/execution/tool-contracts", features = ["element-token", "computer-use-contract"] } openbitfun-transport = { path = "../../crates/adapters/transport", features = ["tauri-adapter"] } diff --git a/src/apps/desktop/src/api/canvas_api.rs b/src/apps/desktop/src/api/canvas_api.rs deleted file mode 100644 index 2d4743ac81..0000000000 --- a/src/apps/desktop/src/api/canvas_api.rs +++ /dev/null @@ -1,341 +0,0 @@ -//! Canvas artifact Tauri commands. - -use crate::api::app_state::AppState; -use openbitfun_product_domains::canvas::{ - parse_canvas_artifact_ref, CanvasDiagnostic, CanvasDiagnosticCategory, - CanvasDiagnosticSeverity, CanvasRevision, CanvasSnapshot, CanvasState, CanvasStoragePort, -}; -use openbitfun_runtime_ports::SessionStorePort; -use openbitfun_services_integrations::canvas::CanvasService; -use serde::{Deserialize, Serialize}; -use serde_json::Value; -use std::collections::BTreeMap; -use tauri::State; - -#[derive(Debug, Clone, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct CanvasStateRequest { - pub artifact_reference: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub remote_connection_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub remote_ssh_host: Option, -} - -#[derive(Debug, Clone, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SaveCanvasStateRequest { - pub artifact_reference: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub source_revision_seen: Option, - #[serde(default)] - pub values: BTreeMap, - #[serde(default)] - pub value_versions: BTreeMap, - pub updated_at: i64, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub remote_connection_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub remote_ssh_host: Option, -} - -#[derive(Debug, Clone, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct ReportCanvasRuntimeErrorRequest { - pub artifact_reference: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub source_revision_seen: Option, - pub message: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub stack: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub filename: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub line: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub column: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub component_stack: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub remote_connection_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub remote_ssh_host: Option, -} - -#[derive(Debug, Clone, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct ReportCanvasRuntimeReadyRequest { - pub artifact_reference: String, - pub source_revision_seen: String, - pub runtime_version: String, - pub sdk_version: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub remote_connection_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub remote_ssh_host: Option, -} - -#[derive(Debug, Clone, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct CanvasStateResponse { - pub state: Option, -} - -#[derive(Debug, Clone, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct CanvasArtifactResponse { - pub canvas: CanvasSnapshot, - pub artifact_reference: String, -} - -#[tauri::command] -pub async fn load_canvas_artifact( - state: State<'_, AppState>, - request: CanvasStateRequest, -) -> Result { - let reference = parse_canvas_artifact_ref(&request.artifact_reference) - .map_err(|error| format!("Invalid Canvas artifact reference: {:?}", error))?; - let service = canvas_service_for_request(&state, request_workspace(&request), &request).await?; - let snapshot = service - .load_snapshot(reference.session_id, reference.canvas_id) - .await - .map_err(|error| error.message)?; - Ok(CanvasArtifactResponse { - canvas: snapshot, - artifact_reference: request.artifact_reference, - }) -} - -#[tauri::command] -pub async fn load_canvas_state( - state: State<'_, AppState>, - request: CanvasStateRequest, -) -> Result { - let reference = parse_canvas_artifact_ref(&request.artifact_reference) - .map_err(|error| format!("Invalid Canvas artifact reference: {:?}", error))?; - let service = canvas_service_for_request(&state, request_workspace(&request), &request).await?; - let state = service - .load_state(reference.session_id, reference.canvas_id) - .await - .map_err(|error| error.message)?; - Ok(CanvasStateResponse { state }) -} - -#[tauri::command] -pub async fn save_canvas_state( - state: State<'_, AppState>, - request: SaveCanvasStateRequest, -) -> Result { - let reference = parse_canvas_artifact_ref(&request.artifact_reference) - .map_err(|error| format!("Invalid Canvas artifact reference: {:?}", error))?; - let service = canvas_service_for_save_request(&state, &request).await?; - let canvas_state = CanvasState { - canvas_id: reference.canvas_id, - source_revision_seen: request.source_revision_seen.map(CanvasRevision::new), - values: request.values, - value_versions: request.value_versions, - updated_at: request.updated_at, - schema_version: openbitfun_product_domains::canvas::CANVAS_CURRENT_STATE_SCHEMA_VERSION, - }; - let saved = service - .save_state(reference.session_id, canvas_state) - .await - .map_err(|error| error.message)?; - Ok(CanvasStateResponse { state: Some(saved) }) -} - -#[tauri::command] -pub async fn report_canvas_runtime_error( - state: State<'_, AppState>, - request: ReportCanvasRuntimeErrorRequest, -) -> Result { - let reference = parse_canvas_artifact_ref(&request.artifact_reference) - .map_err(|error| format!("Invalid Canvas artifact reference: {:?}", error))?; - let service = canvas_service_for_runtime_error_request(&state, &request).await?; - let message = if let Some(name) = request.name.as_deref().filter(|value| !value.is_empty()) { - format!("{}: {}", name, request.message) - } else { - request.message.clone() - }; - let mut diagnostic = CanvasDiagnostic { - severity: CanvasDiagnosticSeverity::Error, - category: CanvasDiagnosticCategory::Runtime, - message, - code: Some("canvas.runtime.error".to_string()), - line: request.line, - column: request.column, - suggested_fix: Some( - "Open the Canvas source and fix the runtime exception, then update the Canvas." - .to_string(), - ), - }; - if let Some(source_revision) = request.source_revision_seen.as_deref() { - diagnostic - .message - .push_str(&format!(" (source revision: {})", source_revision)); - } - if let Some(stack) = request.stack.as_deref().filter(|value| !value.is_empty()) { - diagnostic.message.push('\n'); - diagnostic.message.push_str(stack); - } - if let Some(component_stack) = request - .component_stack - .as_deref() - .filter(|value| !value.is_empty()) - { - diagnostic.message.push_str("\nReact component stack:"); - diagnostic.message.push_str(component_stack); - } - if let Some(filename) = request - .filename - .as_deref() - .filter(|value| !value.is_empty()) - { - diagnostic.message.push_str("\nRuntime source: "); - diagnostic.message.push_str(filename); - } - let snapshot = service - .report_runtime_diagnostic( - reference.session_id, - reference.canvas_id, - request.source_revision_seen.map(CanvasRevision::new), - diagnostic, - ) - .await - .map_err(|error| error.message)?; - Ok(CanvasArtifactResponse { - canvas: snapshot, - artifact_reference: request.artifact_reference, - }) -} - -#[tauri::command] -pub async fn report_canvas_runtime_ready( - state: State<'_, AppState>, - request: ReportCanvasRuntimeReadyRequest, -) -> Result { - let reference = parse_canvas_artifact_ref(&request.artifact_reference) - .map_err(|error| format!("Invalid Canvas artifact reference: {:?}", error))?; - let service = canvas_service_for_workspace( - &state, - request.workspace_id.as_deref(), - request.workspace_path.as_deref(), - request.remote_connection_id.as_deref(), - request.remote_ssh_host.as_deref(), - ) - .await?; - let snapshot = service - .mark_runtime_ready( - reference.session_id, - reference.canvas_id, - CanvasRevision::new(request.source_revision_seen), - request.runtime_version, - request.sdk_version, - ) - .await - .map_err(|error| error.message)?; - Ok(CanvasArtifactResponse { - canvas: snapshot, - artifact_reference: request.artifact_reference, - }) -} - -fn request_workspace(request: &CanvasStateRequest) -> Option<&str> { - request.workspace_path.as_deref() -} - -async fn canvas_service_for_runtime_error_request( - state: &AppState, - request: &ReportCanvasRuntimeErrorRequest, -) -> Result { - canvas_service_for_workspace( - state, - request.workspace_id.as_deref(), - request.workspace_path.as_deref(), - request.remote_connection_id.as_deref(), - request.remote_ssh_host.as_deref(), - ) - .await -} - -async fn canvas_service_for_save_request( - state: &AppState, - request: &SaveCanvasStateRequest, -) -> Result { - canvas_service_for_workspace( - state, - request.workspace_id.as_deref(), - request.workspace_path.as_deref(), - request.remote_connection_id.as_deref(), - request.remote_ssh_host.as_deref(), - ) - .await -} - -async fn canvas_service_for_request( - state: &AppState, - workspace_path: Option<&str>, - request: &CanvasStateRequest, -) -> Result { - canvas_service_for_workspace( - state, - request.workspace_id.as_deref(), - workspace_path, - request.remote_connection_id.as_deref(), - request.remote_ssh_host.as_deref(), - ) - .await -} - -async fn canvas_service_for_workspace( - state: &AppState, - workspace_id: Option<&str>, - legacy_workspace_path: Option<&str>, - remote_connection_id: Option<&str>, - remote_ssh_host: Option<&str>, -) -> Result { - let workspace = if let Some(id) = workspace_id { - state - .workspace_service - .require_workspace(id) - .await - .map_err(|e| e.to_string())? - } else if let Some(path) = legacy_workspace_path.filter(|path| !path.is_empty()) { - state - .workspace_service - .resolve_legacy_workspace_reference(None, path, remote_connection_id, remote_ssh_host) - .await - .map_err(|e| e.to_string())? - .ok_or("Legacy Canvas workspace cannot be resolved")? - } else { - // Canvas state is keyed by the owning workspace. Falling through to the - // active workspace would silently store a session's Canvas under the - // wrong workspace, so reject requests that carry neither an ID nor a - // legacy path. - return Err("Canvas requests must identify the owning workspace".to_string()); - }; - let sessions_dir = openbitfun_core::agentic::session::CoreSessionStorePort::default() - .resolve_workspace_storage(&workspace.id) - .await - .map_err(|e| e.to_string())? - .effective_storage_path; - Ok(CanvasService::persistent(sessions_dir)) -} diff --git a/src/apps/desktop/src/api/generative_ui_api.rs b/src/apps/desktop/src/api/generative_ui_api.rs new file mode 100644 index 0000000000..c7249054ff --- /dev/null +++ b/src/apps/desktop/src/api/generative_ui_api.rs @@ -0,0 +1,598 @@ +//! Source-bound application state; never accept controller filesystem paths. +use openbitfun_core::agentic::WorkspaceBinding; +use openbitfun_services_integrations::generative_ui::{GenUIStore, Revision}; +use serde::Deserialize; +use serde_json::Value; + +const WIKIPEDIA_SUMMARY: &str = "https://en.wikipedia.org/api/rest_v1/page/summary/"; +const WIKIMEDIA_API: &str = "https://commons.wikimedia.org/w/api.php"; +const SO_IMAGE_API: &str = "https://image.so.com/j"; +const BAIDU_IMAGE_API: &str = "https://image.baidu.com/search/acjson"; +const NOMINATIM_API: &str = "https://nominatim.openstreetmap.org/search"; +const OSRM_API: &str = "https://router.project-osrm.org/route/v1/driving/"; +const VALHALLA_API: &str = "https://valhalla1.openstreetmap.de/route"; +const GENUI_NETWORK_TIMEOUT_SECS: u64 = 12; +const DOMESTIC_IMAGE_TIMEOUT_SECS: u64 = 6; +const OPEN_IMAGE_TIMEOUT_SECS: u64 = 8; + +#[derive(Debug, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct GenUIProviderRequest { + capability: String, + #[serde(default)] + args: Value, +} + +fn provider_client() -> Result { + provider_client_with_timeout(GENUI_NETWORK_TIMEOUT_SECS) +} + +fn provider_client_with_timeout(timeout_secs: u64) -> Result { + reqwest::Client::builder() + .user_agent("OpenBitFun/1.0 (GenUI host provider)") + .timeout(std::time::Duration::from_secs(timeout_secs)) + .build() + .map_err(|error| format!("GenUI provider HTTP client unavailable: {error}")) +} + +fn query_arg(args: &Value) -> Result { + let query = args + .get("query") + .and_then(Value::as_str) + .unwrap_or_default() + .trim(); + if !(2..=200).contains(&query.chars().count()) { + return Err("GenUI provider query must contain 2 to 200 characters".into()); + } + Ok(query.to_string()) +} + +fn push_image_url(images: &mut Vec, value: Option<&Value>) { + let Some(url) = value.and_then(Value::as_str).map(str::trim) else { + return; + }; + if !(url.starts_with("https://") || url.starts_with("http://")) + || url.to_ascii_lowercase().contains(".svg") + || url.to_ascii_lowercase().contains("logo") + || url.to_ascii_lowercase().contains("icon") + || images.iter().any(|item| item == url) + { + return; + } + images.push(url.to_string()); +} + +fn collect_image_urls(value: &Value, images: &mut Vec) { + match value { + Value::Array(items) => items + .iter() + .for_each(|item| collect_image_urls(item, images)), + Value::Object(record) => { + for key in [ + "src", + "url", + "thumb", + "img", + "link", + "thumbURL", + "middleURL", + "objURL", + "hoverURL", + ] { + push_image_url(images, record.get(key)); + } + for value in record.values() { + if images.len() >= 8 { + break; + } + if value.is_array() || value.is_object() { + collect_image_urls(value, images); + } + } + } + _ => {} + } +} + +async fn so_image_search(query: &str) -> Vec { + let Ok(client) = provider_client_with_timeout(DOMESTIC_IMAGE_TIMEOUT_SECS) else { + return Vec::new(); + }; + let Ok(response) = client + .get(SO_IMAGE_API) + .query(&[ + ("q", query), + ("pn", "0"), + ("sn", "0"), + ("pd", "1"), + ("correct", query), + ]) + .send() + .await + else { + return Vec::new(); + }; + if !response.status().is_success() { + return Vec::new(); + } + let Ok(value) = response.json::().await else { + return Vec::new(); + }; + let mut images = Vec::new(); + collect_image_urls(&value, &mut images); + images.truncate(4); + images +} + +async fn baidu_image_search(query: &str) -> Vec { + let Ok(client) = provider_client_with_timeout(DOMESTIC_IMAGE_TIMEOUT_SECS) else { + return Vec::new(); + }; + let Ok(response) = client + .get(BAIDU_IMAGE_API) + .query(&[ + ("tn", "resultjson_com"), + ("word", query), + ("ie", "utf-8"), + ("pn", "0"), + ("rn", "10"), + ]) + .send() + .await + else { + return Vec::new(); + }; + if !response.status().is_success() { + return Vec::new(); + } + let Ok(value) = response.json::().await else { + return Vec::new(); + }; + let mut images = Vec::new(); + collect_image_urls(&value, &mut images); + images.truncate(4); + images +} + +async fn open_image_search(query: &str) -> Vec { + let Ok(client) = provider_client_with_timeout(OPEN_IMAGE_TIMEOUT_SECS) else { + return Vec::new(); + }; + let mut images = Vec::new(); + + // OI uses Wikipedia + Commons because they return stable, openly licensed + // image URLs. Keep the same ordering and run both requests concurrently. + let wiki_url = format!("{}{}", WIKIPEDIA_SUMMARY, urlencoding::encode(query)); + let wiki = client.get(wiki_url).send(); + let commons = client + .get(WIKIMEDIA_API) + .query(&[ + ("action", "query"), + ("format", "json"), + ("formatversion", "2"), + ("generator", "search"), + ("gsrsearch", query), + ("gsrnamespace", "6"), + ("gsrlimit", "8"), + ("prop", "imageinfo"), + ("iiprop", "url|mime"), + ("iiurlwidth", "960"), + ]) + .send(); + let (wiki, commons) = tokio::join!(wiki, commons); + if let Ok(response) = wiki { + if response.status().is_success() { + if let Ok(value) = response.json::().await { + push_image_url(&mut images, value.pointer("/thumbnail/source")); + } + } + } + if let Ok(response) = commons { + if response.status().is_success() { + if let Ok(value) = response.json::().await { + collect_image_urls(&value, &mut images); + } + } + } + images.truncate(4); + images +} + +async fn native_image_search(query: &str) -> Result { + // Prefer the domestic endpoint so a mainland host does not wait for an + // unreachable overseas request. 360 and Baidu are best-effort search + // sources; the OpenUI-compatible Wikimedia sources remain a second choice + // for queries that domestic providers cannot answer. + let mut images = so_image_search(query).await; + if images.is_empty() { + images = baidu_image_search(query).await; + } + if images.is_empty() { + images = open_image_search(query).await; + } + Ok(serde_json::json!({ "images": images })) +} + +async fn native_map_lookup(query: &str) -> Result { + let client = provider_client()?; + let response = client + .get(NOMINATIM_API) + .query(&[("q", query), ("format", "jsonv2"), ("limit", "8")]) + .header("accept-language", "zh-CN,zh;q=0.9,en;q=0.7") + .send() + .await + .map_err(|error| format!("Map lookup failed: {error}"))?; + if !response.status().is_success() { + return Err(format!("Map lookup returned HTTP {}", response.status())); + } + let results = response + .json::>() + .await + .map_err(|error| format!("Map lookup response was invalid: {error}"))?; + let markers = results + .into_iter() + .filter_map(|item| { + let lat = item.get("lat")?.as_str()?.parse::().ok()?; + let lng = item.get("lon")?.as_str()?.parse::().ok()?; + Some(serde_json::json!({ + "label": item.get("display_name").and_then(Value::as_str).unwrap_or("Place"), + "lat": lat, + "lng": lng, + "category": item.get("type").and_then(Value::as_str), + })) + }) + .collect::>(); + Ok(serde_json::json!({ "markers": markers })) +} + +async fn native_map_route(args: &Value) -> Result { + let markers = args + .get("markers") + .and_then(Value::as_array) + .ok_or("Map route requires a markers array")?; + if markers.len() < 2 || markers.len() > 100 { + return Err("Map route requires between 2 and 100 markers".into()); + } + let mut coordinates = Vec::with_capacity(markers.len()); + for marker in markers { + let lat = marker + .get("lat") + .and_then(Value::as_f64) + .ok_or("Map marker latitude is invalid")?; + let lng = marker + .get("lng") + .and_then(Value::as_f64) + .ok_or("Map marker longitude is invalid")?; + if !lat.is_finite() + || !lng.is_finite() + || !(-90.0..=90.0).contains(&lat) + || !(-180.0..=180.0).contains(&lng) + { + return Err("Map marker coordinates are out of range".into()); + } + coordinates.push(format!("{lng},{lat}")); + } + let client = provider_client_with_timeout(8)?; + let osrm = client + .get(format!("{}{}", OSRM_API, coordinates.join(";"))) + .query(&[("overview", "full"), ("geometries", "geojson")]) + .send() + .await; + if let Ok(response) = osrm { + if response.status().is_success() { + if let Ok(value) = response.json::().await { + if value + .pointer("/routes/0/geometry/coordinates") + .and_then(Value::as_array) + .is_some_and(|points| points.len() > 1) + { + return Ok(value); + } + } + } + } + + // The public OSRM endpoint is frequently unreachable from mainland + // networks. Valhalla's OpenStreetMap deployment is a compatible fallback; + // normalize its encoded polyline into the same GeoJSON shape consumed by + // the OpenUI map renderer. + let locations = markers + .iter() + .map(|marker| { + serde_json::json!({ + "lat": marker.get("lat").and_then(Value::as_f64), + "lon": marker.get("lng").and_then(Value::as_f64), + }) + }) + .collect::>(); + let response = client + .post(VALHALLA_API) + .json(&serde_json::json!({ + "locations": locations, + "costing": "auto", + "units": "kilometers", + })) + .send() + .await + .map_err(|error| format!("Street route failed: {error}"))?; + if !response.status().is_success() { + return Err(format!("Street route returned HTTP {}", response.status())); + } + let value = response + .json::() + .await + .map_err(|error| format!("Street route response was invalid: {error}"))?; + let mut coordinates = Vec::::new(); + if let Some(legs) = value.pointer("/trip/legs").and_then(Value::as_array) { + for shape in legs + .iter() + .filter_map(|leg| leg.get("shape").and_then(Value::as_str)) + { + coordinates.extend(decode_valhalla_polyline(shape)?); + } + } + if coordinates.len() < 2 { + return Err("Street route provider returned no usable geometry".into()); + } + Ok(serde_json::json!({ + "routes": [{ "geometry": { "type": "LineString", "coordinates": coordinates } }] + })) +} + +fn decode_valhalla_polyline(encoded: &str) -> Result, String> { + let bytes = encoded.as_bytes(); + let mut index = 0; + let mut latitude = 0_i64; + let mut longitude = 0_i64; + let mut points = Vec::new(); + while index < bytes.len() { + let delta_latitude = decode_polyline_value(bytes, &mut index)?; + let delta_longitude = decode_polyline_value(bytes, &mut index)?; + latitude += delta_latitude; + longitude += delta_longitude; + points.push(serde_json::json!([ + longitude as f64 / 1_000_000.0, + latitude as f64 / 1_000_000.0, + ])); + } + Ok(points) +} + +fn decode_polyline_value(bytes: &[u8], index: &mut usize) -> Result { + let mut result = 0_i64; + let mut shift = 0_u32; + loop { + let byte = *bytes + .get(*index) + .ok_or("Street route geometry was truncated")?; + *index += 1; + let value = i64::from(byte.saturating_sub(63)); + result |= (value & 0x1f) << shift; + if value < 0x20 { + break; + } + shift += 5; + if shift > 60 { + return Err("Street route geometry was invalid".into()); + } + } + Ok(if result & 1 != 0 { + !(result >> 1) + } else { + result >> 1 + }) +} + +#[tauri::command] +pub async fn gen_ui_provider_call(request: GenUIProviderRequest) -> Result { + match request.capability.trim() { + "image.search" | "SearchImage" => native_image_search(&query_arg(&request.args)?).await, + "map.lookup" | "Map" => native_map_lookup(&query_arg(&request.args)?).await, + "map.route" => native_map_route(&request.args).await, + capability => Err(format!( + "GenUI capability {capability} is unavailable on this host" + )), + } +} +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct GenUIAppRequest { + workspace_id: String, + session_id: String, + app_id: String, + #[serde(default)] + revision: Option, + #[serde(default)] + state: Option, + /// Optional identity echo from the active renderer. Older callers may omit + /// this field; when present the owner rejects a response from another + /// design specification instead of silently hydrating it. + #[serde(default)] + design_spec: Option, + #[serde(default)] + source_kind: Option, + #[serde(default)] + library_id: Option, + #[serde(default)] + library_revision: Option, +} + +fn validate_owner_identity( + accepted: &Revision, + expected_library_id: Option<&str>, + expected_library_revision: Option, + expected_design_spec: Option<&Value>, + expected_source_kind: Option<&str>, +) -> Result<(), String> { + if let Some(expected) = accepted.app["libraryId"].as_str() { + if expected_library_id != Some(expected) + || expected_library_revision != accepted.app["libraryRevision"].as_i64() + { + return Err("GenUI owner returned a different component library identity".into()); + } + } + if let Some(expected) = expected_design_spec { + if accepted.app.get("designSpec") != Some(expected) { + return Err("GenUI owner returned a different UI specification identity".into()); + } + } + if let Some(expected) = expected_source_kind { + if accepted.app["source"]["kind"].as_str() != Some(expected) { + return Err("GenUI owner returned a different source kind".into()); + } + } + Ok(()) +} +#[tauri::command] +pub async fn gen_ui_app(request: GenUIAppRequest) -> Result, String> { + openbitfun_core_types::validate_session_id(&request.session_id)?; + let workspace = WorkspaceBinding::resolve(&request.workspace_id) + .await + .map_err(|e| e.to_string())?; + let coordinator = openbitfun_core::agentic::coordination::get_global_coordinator() + .ok_or("GenUI session owner is unavailable")?; + let metadata = coordinator + .get_session_manager() + .load_session_metadata(&workspace.session_storage_dir(), &request.session_id) + .await + .map_err(|e| e.to_string())? + .ok_or("GenUI owning session does not exist in the requested workspace")?; + if metadata + .workspace_id + .as_ref() + .is_some_and(|id| id != &request.workspace_id) + { + return Err("GenUI session belongs to a different workspace".into()); + } + let store = GenUIStore::new( + workspace + .session_storage_dir() + .join(&request.session_id) + .join("artifacts") + .join("genui"), + ); + match (request.state, request.revision) { + (None, None) => { + let accepted = store.accepted(&request.app_id).await?; + if let Some(accepted) = accepted.as_ref() { + validate_owner_identity( + accepted, + request.library_id.as_deref(), + request.library_revision, + request.design_spec.as_ref(), + request.source_kind.as_deref(), + )?; + } + Ok(accepted) + } + (Some(state), Some(revision)) => { + let accepted = store + .accepted(&request.app_id) + .await? + .ok_or("No accepted GenUI revision exists on the owner")?; + validate_owner_identity( + &accepted, + request.library_id.as_deref(), + request.library_revision, + request.design_spec.as_ref(), + request.source_kind.as_deref(), + )?; + store + .save(&request.app_id, &revision, state) + .await + .map(Some) + } + _ => Err("Saving GenUI state requires state and its acknowledged owner revision".into()), + } +} + +#[cfg(test)] +mod tests { + use super::*; + use serde_json::json; + + fn revision() -> Revision { + serde_json::from_value(json!({ + "revision": "r1", + "app": { + "id": "app", + "template": "openbitfun.app", + "libraryId": "openbitfun.composable.v1", + "libraryRevision": 2, + "designSpec": {"id": "harmony.phone.v1", "revision": 1}, + "source": {"kind": "html-document"} + }, + "state": {}, + "evidence": null + })) + .unwrap() + } + + #[test] + fn owner_identity_echo_is_required_for_pinned_library_callers() { + assert!(validate_owner_identity(&revision(), None, None, None, None).is_err()); + assert!(validate_owner_identity( + &revision(), + Some("openbitfun.composable.v1"), + Some(2), + None, + None + ) + .is_ok()); + } + + #[test] + fn owner_identity_echo_rejects_cross_target_reads_and_saves() { + let accepted = revision(); + assert!(validate_owner_identity( + &accepted, + Some("openbitfun.composable.v1"), + Some(2), + Some(&json!({"id":"openbitfun.desktop.v1","revision":1})), + Some("html-document"), + ) + .is_err()); + assert!(validate_owner_identity( + &accepted, + Some("openbitfun.composable.v1"), + Some(2), + Some(&json!({"id":"harmony.phone.v1","revision":1})), + Some("openui-lang"), + ) + .is_err()); + assert!(validate_owner_identity( + &accepted, + Some("openbitfun.composable.v1"), + Some(2), + Some(&json!({"id":"harmony.phone.v1","revision":1})), + Some("html-document"), + ) + .is_ok()); + } + + #[test] + fn normalizes_domestic_image_search_payloads() { + let payload = json!({ + "list": [ + {"thumb": "https://images.example/photo.jpg"}, + {"img": "http://images.example/logo-icon.jpg"}, + {"link": "https://images.example/photo.jpg"} + ] + }); + let mut images = Vec::new(); + collect_image_urls(&payload, &mut images); + assert_eq!(images, vec!["https://images.example/photo.jpg"]); + } + + #[test] + fn decodes_valhalla_polyline6_to_geojson_coordinates() { + let points = decode_valhalla_polyline( + "c{cqz@eidufFsByEuFgMyCyGkKuVy\\}v@uK}XqJuWoGyPsDcJ{Pmb@aHyQgGmQ}E{MaEyLcFyPy@aGsF{_@{Fw\\eBmIs@iEqAwLe@wESaJZkKrAmYzH}o@`EcNlFcBbPoCj^gEzt@kIzLaBtA|JPnAhGnUxE`NbDpKvHdZrHlXzDlM`IzOlG|KhCxDtCzDzRvO`PzKpG`EnDvGbGtRxBhH|Nte@lStp@pGvSbYn~@nBnGhQsF`^}KvUoHpP_G~a@uMdH{BhMkBnm@kFzFa@", + ) + .unwrap(); + assert!(points.len() > 2); + let first = points.first().unwrap().as_array().unwrap(); + assert!((first[0].as_f64().unwrap() - 121.4737).abs() < 0.001); + assert!((first[1].as_f64().unwrap() - 31.2304).abs() < 0.001); + } +} diff --git a/src/apps/desktop/src/api/mod.rs b/src/apps/desktop/src/api/mod.rs index dbb4e3584b..7b8fc15cf6 100644 --- a/src/apps/desktop/src/api/mod.rs +++ b/src/apps/desktop/src/api/mod.rs @@ -9,7 +9,6 @@ pub mod browser_api; pub mod browser_control_api; pub mod browser_file_drop_api; pub mod btw_api; -pub mod canvas_api; pub mod clipboard_file_api; pub mod commands; pub mod computer_use_api; @@ -28,6 +27,7 @@ pub mod external_hooks_api; pub mod external_session_import_api; pub mod external_sources_api; pub mod file_drop_preview_api; +pub mod generative_ui_api; pub mod git_agent_api; pub mod git_api; pub mod html_preview_api; diff --git a/src/apps/desktop/src/lib.rs b/src/apps/desktop/src/lib.rs index 22193341cb..23bb4cab7f 100644 --- a/src/apps/desktop/src/lib.rs +++ b/src/apps/desktop/src/lib.rs @@ -1498,6 +1498,8 @@ pub async fn run() { openbitfun_control_host::mark_openbitfun_control_surface_ready, openbitfun_control_host::mark_openbitfun_control_surface_unready, openbitfun_control_host::product_control_invoke, + api::generative_ui_api::gen_ui_app, + api::generative_ui_api::gen_ui_provider_call, openbitfun_control_host::report_openbitfun_control_result, miniapp_web_host::mark_miniapp_web_surface_ready, miniapp_web_host::report_miniapp_web_result, @@ -1943,11 +1945,6 @@ pub async fn run() { api::miniapp_api::miniapp_runtime_status, api::miniapp_api::miniapp_worker_call, api::miniapp_api::miniapp_host_call, - api::canvas_api::load_canvas_artifact, - api::canvas_api::load_canvas_state, - api::canvas_api::report_canvas_runtime_error, - api::canvas_api::report_canvas_runtime_ready, - api::canvas_api::save_canvas_state, api::miniapp_api::miniapp_worker_stop, api::miniapp_api::miniapp_worker_list_running, api::miniapp_api::miniapp_install_deps, diff --git a/src/apps/desktop/src/openbitfun_control_host.rs b/src/apps/desktop/src/openbitfun_control_host.rs index 4d2279494b..5077f4ef98 100644 --- a/src/apps/desktop/src/openbitfun_control_host.rs +++ b/src/apps/desktop/src/openbitfun_control_host.rs @@ -51,6 +51,7 @@ static NEXT_REQUEST_ID: AtomicU64 = AtomicU64::new(1); static NEXT_STATE_REVISION: AtomicU64 = AtomicU64::new(1); static SURFACE_READY: AtomicBool = AtomicBool::new(false); static CREATION_API_VERSION: AtomicU64 = AtomicU64::new(0); +static GENUI_API_VERSION: AtomicU64 = AtomicU64::new(0); static PENDING_RESPONSES: OnceLock>> = OnceLock::new(); static PRODUCT_CONTROL_TRANSACTION: OnceLock> = OnceLock::new(); @@ -97,6 +98,14 @@ async fn dispatch_surface_event( ); let (sender, receiver) = oneshot::channel(); lock_pending_responses().insert(request_id.clone(), sender); + // Cancellation drops the pending sender as well as the receiver. + struct PendingGuard(String); + impl Drop for PendingGuard { + fn drop(&mut self) { + lock_pending_responses().remove(&self.0); + } + } + let _pending = PendingGuard(request_id.clone()); let Some(payload) = payload.as_object_mut() else { lock_pending_responses().remove(&request_id); @@ -1201,6 +1210,22 @@ impl ProductControlPort for DesktopProductControlPort { } pub(crate) fn install(app: AppHandle) { + openbitfun_core::agentic::tools::generative_ui_host::set_generative_ui_checker(Arc::new( + |request| { + Box::pin(async move { + if GENUI_API_VERSION.load(Ordering::Acquire) != 1 { + return Err("The active host does not advertise GenUI checker v1".into()); + } + dispatch_surface_event( + "agentic://genui-check-request", + request, + OPENBITFUN_CONTROL_RESPONSE_TIMEOUT, + "verify the GenUI candidate", + ) + .await + }) + }, + )); set_openbitfun_control_port(Arc::new(DesktopProductControlPort { app })); } @@ -1210,12 +1235,20 @@ pub(crate) fn install(app: AppHandle) { #[serde(default, rename_all = "camelCase")] pub(crate) struct ProductControlSurfaceReadyRequest { creation_api_version: Option, + gen_ui_api_version: Option, } #[tauri::command] pub(crate) fn mark_openbitfun_control_surface_ready( request: Option, ) { + GENUI_API_VERSION.store( + request + .as_ref() + .and_then(|request| request.gen_ui_api_version) + .unwrap_or(0), + Ordering::Release, + ); CREATION_API_VERSION.store( request .and_then(|request| request.creation_api_version) @@ -1229,6 +1262,7 @@ pub(crate) fn mark_openbitfun_control_surface_ready( pub(crate) fn mark_openbitfun_control_surface_unready() { SURFACE_READY.store(false, Ordering::Release); CREATION_API_VERSION.store(0, Ordering::Release); + GENUI_API_VERSION.store(0, Ordering::Release); let pending = std::mem::take(&mut *lock_pending_responses()); for (_, sender) in pending { let _ = sender.send(Err( @@ -1287,9 +1321,13 @@ mod tests { let legacy: super::ProductControlSurfaceReadyRequest = serde_json::from_value(serde_json::json!({})).unwrap(); assert_eq!(legacy.creation_api_version, None); - let current: super::ProductControlSurfaceReadyRequest = - serde_json::from_value(serde_json::json!({"creationApiVersion": 1})).unwrap(); + assert_eq!(legacy.gen_ui_api_version, None); + let current: super::ProductControlSurfaceReadyRequest = serde_json::from_value( + serde_json::json!({"creationApiVersion": 1, "genUiApiVersion": 1}), + ) + .unwrap(); assert_eq!(current.creation_api_version, Some(1)); + assert_eq!(current.gen_ui_api_version, Some(1)); } use super::*; diff --git a/src/apps/mobile/harmonyos/AppScope/app.json5 b/src/apps/mobile/harmonyos/AppScope/app.json5 index 8697ed1307..75bf7f95e1 100644 --- a/src/apps/mobile/harmonyos/AppScope/app.json5 +++ b/src/apps/mobile/harmonyos/AppScope/app.json5 @@ -4,7 +4,7 @@ // upgrades retain encrypted sessions, preferences, and watch handoff data. "bundleName": "com.bitfun.app", "vendor": "OpenBitFun", - "versionCode": 8, + "versionCode": 9, "versionName": "1.0.0", // x-release-please-version "buildVersion": "1", "icon": "$media:openbitfun_app_icon", diff --git a/src/apps/ohos/entry/src/main/resources/resfile/THIRD_PARTY_NOTICES.md b/src/apps/ohos/entry/src/main/resources/resfile/THIRD_PARTY_NOTICES.md new file mode 100644 index 0000000000..0f67332956 --- /dev/null +++ b/src/apps/ohos/entry/src/main/resources/resfile/THIRD_PARTY_NOTICES.md @@ -0,0 +1,80 @@ +# Third-Party Notices + +OpenBitFun redistributes selected material and links libraries from the following +third-party projects. These notices are included with OpenBitFun's Desktop and CLI +release packages. + +## HarmonyOS Sans Fonts + +- Project: HarmonyOS Sans Fonts +- Provider: Huawei Device Co., Ltd. +- License: HarmonyOS Sans Fonts License Agreement +- Copyright: Copyright 2021 Huawei Device Co., Ltd. + +Non-Apple OpenBitFun GUI distributions bundle unmodified copies of the Base and +Simplified Chinese variable fonts (Version 2.040), exposing the design system's +Regular (400), Medium (500), Semibold (600), and Bold (700) weights. They do not bundle the +Traditional Chinese font family. Apple GUI distributions and Traditional +Chinese UI text use platform system fonts instead. + +The complete license agreement and a font-specific notice are included only in +the non-Apple frontend artifact under `third-party/fonts/harmonyos-sans/`. + +## models.dev catalog data + +- Project: models.dev +- Source: https://github.com/anomalyco/models.dev +- Catalog API: https://models.dev/api.json +- License: MIT +- Copyright: Copyright (c) 2025 models.dev + +OpenBitFun includes a curated, reasoning-only fallback derived from the models.dev +catalog. It is used when a newer cached catalog is unavailable. The precise +source revision, retrieval metadata, transformation, and content hashes are +recorded in `models-dev.provenance.json`, which is shipped as +`third-party/models.dev/provenance.json` in binary release packages. The +complete upstream license text is preserved in `models-dev.LICENSE.txt`, which +is shipped as `third-party/models.dev/LICENSE.txt`. Source distributions keep +the canonical copies of both files beside the bundled snapshot under +`src/crates/services/services-integrations/assets/`. + +## Font Awesome Free + +- Project: Font Awesome Free +- Source: https://github.com/FortAwesome/Font-Awesome +- License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) +- Copyright: Copyright (c) Fonticons, Inc. + +The device list uses the Font Awesome Linux brand icon as the mark for a device +that runs Linux, redrawn at row icon size by narrowing its view box. + +## anydoc + +- Project: anydoc +- Source: https://github.com/firecrawl/anydoc +- Version: 0.1.6 +- License: MIT +- Copyright: Copyright (c) 2026 Sideguide Technologies Inc. + +OpenBitFun links anydoc to convert supported office documents, OpenDocument files, +RTF, EPUB, CSV, and PDFs into Markdown for the Agent Read tool. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/apps/ohos/entry/src/main/resources/resfile/ohos-build.json b/src/apps/ohos/entry/src/main/resources/resfile/ohos-build.json new file mode 100644 index 0000000000..04755926ec --- /dev/null +++ b/src/apps/ohos/entry/src/main/resources/resfile/ohos-build.json @@ -0,0 +1,6 @@ +{ + "baseRevision": "2e40311bd00f3d71e98b9e124d7ccc7a0db693fa", + "nativeSha256": "b37b050ba65200a71e096d6d59d0e8cc33e28b9e0aec0ffa23ca32cd70819f2e", + "experimental": true, + "deviceValidated": false +} diff --git a/src/apps/ohos/entry/src/main/resources/resfile/resources/ext-host/extension-host.js b/src/apps/ohos/entry/src/main/resources/resfile/resources/ext-host/extension-host.js new file mode 100644 index 0000000000..231b0538e5 --- /dev/null +++ b/src/apps/ohos/entry/src/main/resources/resfile/resources/ext-host/extension-host.js @@ -0,0 +1,21127 @@ +// @bun +var __create = Object.create; +var __getProtoOf = Object.getPrototypeOf; +var __defProp = Object.defineProperty; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +function __accessProp(key) { + return this[key]; +} +var __toESMCache_node; +var __toESMCache_esm; +var __toESM = (mod, isNodeMode, target) => { + var canCache = mod != null && typeof mod === "object"; + if (canCache) { + var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap; + var cached = cache.get(mod); + if (cached) + return cached; + } + target = mod != null ? __create(__getProtoOf(mod)) : {}; + const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target; + for (let key of __getOwnPropNames(mod)) + if (!__hasOwnProp.call(to, key)) + __defProp(to, key, { + get: __accessProp.bind(mod, key), + enumerable: true + }); + if (canCache) + cache.set(mod, to); + return to; +}; +var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports); +var __returnValue = (v) => v; +function __exportSetter(name, newValue) { + this[name] = __returnValue.bind(null, newValue); +} +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { + get: all[name], + enumerable: true, + configurable: true, + set: __exportSetter.bind(all, name) + }); +}; +var __require = import.meta.require; + +// node_modules/isexe/windows.js +var require_windows = __commonJS((exports, module) => { + module.exports = isexe; + isexe.sync = sync; + var fs = __require("fs"); + function checkPathExt(path, options) { + var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT; + if (!pathext) { + return true; + } + pathext = pathext.split(";"); + if (pathext.indexOf("") !== -1) { + return true; + } + for (var i = 0;i < pathext.length; i++) { + var p = pathext[i].toLowerCase(); + if (p && path.substr(-p.length).toLowerCase() === p) { + return true; + } + } + return false; + } + function checkStat(stat, path, options) { + if (!stat.isSymbolicLink() && !stat.isFile()) { + return false; + } + return checkPathExt(path, options); + } + function isexe(path, options, cb) { + fs.stat(path, function(er, stat) { + cb(er, er ? false : checkStat(stat, path, options)); + }); + } + function sync(path, options) { + return checkStat(fs.statSync(path), path, options); + } +}); + +// node_modules/isexe/mode.js +var require_mode = __commonJS((exports, module) => { + module.exports = isexe; + isexe.sync = sync; + var fs = __require("fs"); + function isexe(path, options, cb) { + fs.stat(path, function(er, stat) { + cb(er, er ? false : checkStat(stat, options)); + }); + } + function sync(path, options) { + return checkStat(fs.statSync(path), options); + } + function checkStat(stat, options) { + return stat.isFile() && checkMode(stat, options); + } + function checkMode(stat, options) { + var mod = stat.mode; + var uid = stat.uid; + var gid = stat.gid; + var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid(); + var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid(); + var u = parseInt("100", 8); + var g = parseInt("010", 8); + var o = parseInt("001", 8); + var ug = u | g; + var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0; + return ret; + } +}); + +// node_modules/isexe/index.js +var require_isexe = __commonJS((exports, module) => { + var fs = __require("fs"); + var core; + if (process.platform === "win32" || global.TESTING_WINDOWS) { + core = require_windows(); + } else { + core = require_mode(); + } + module.exports = isexe; + isexe.sync = sync; + function isexe(path, options, cb) { + if (typeof options === "function") { + cb = options; + options = {}; + } + if (!cb) { + if (typeof Promise !== "function") { + throw new TypeError("callback not provided"); + } + return new Promise(function(resolve, reject) { + isexe(path, options || {}, function(er, is) { + if (er) { + reject(er); + } else { + resolve(is); + } + }); + }); + } + core(path, options || {}, function(er, is) { + if (er) { + if (er.code === "EACCES" || options && options.ignoreErrors) { + er = null; + is = false; + } + } + cb(er, is); + }); + } + function sync(path, options) { + try { + return core.sync(path, options || {}); + } catch (er) { + if (options && options.ignoreErrors || er.code === "EACCES") { + return false; + } else { + throw er; + } + } + } +}); + +// node_modules/which/which.js +var require_which = __commonJS((exports, module) => { + var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys"; + var path = __require("path"); + var COLON = isWindows ? ";" : ":"; + var isexe = require_isexe(); + var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" }); + var getPathInfo = (cmd, opt) => { + const colon = opt.colon || COLON; + const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [ + ...isWindows ? [process.cwd()] : [], + ...(opt.path || process.env.PATH || "").split(colon) + ]; + const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : ""; + const pathExt = isWindows ? pathExtExe.split(colon) : [""]; + if (isWindows) { + if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") + pathExt.unshift(""); + } + return { + pathEnv, + pathExt, + pathExtExe + }; + }; + var which = (cmd, opt, cb) => { + if (typeof opt === "function") { + cb = opt; + opt = {}; + } + if (!opt) + opt = {}; + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt); + const found = []; + const step = (i) => new Promise((resolve, reject) => { + if (i === pathEnv.length) + return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd)); + const ppRaw = pathEnv[i]; + const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw; + const pCmd = path.join(pathPart, cmd); + const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd; + resolve(subStep(p, i, 0)); + }); + const subStep = (p, i, ii) => new Promise((resolve, reject) => { + if (ii === pathExt.length) + return resolve(step(i + 1)); + const ext = pathExt[ii]; + isexe(p + ext, { pathExt: pathExtExe }, (er, is) => { + if (!er && is) { + if (opt.all) + found.push(p + ext); + else + return resolve(p + ext); + } + return resolve(subStep(p, i, ii + 1)); + }); + }); + return cb ? step(0).then((res) => cb(null, res), cb) : step(0); + }; + var whichSync = (cmd, opt) => { + opt = opt || {}; + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt); + const found = []; + for (let i = 0;i < pathEnv.length; i++) { + const ppRaw = pathEnv[i]; + const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw; + const pCmd = path.join(pathPart, cmd); + const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd; + for (let j = 0;j < pathExt.length; j++) { + const cur = p + pathExt[j]; + try { + const is = isexe.sync(cur, { pathExt: pathExtExe }); + if (is) { + if (opt.all) + found.push(cur); + else + return cur; + } + } catch (ex) {} + } + } + if (opt.all && found.length) + return found; + if (opt.nothrow) + return null; + throw getNotFoundError(cmd); + }; + module.exports = which; + which.sync = whichSync; +}); + +// node_modules/path-key/index.js +var require_path_key = __commonJS((exports, module) => { + var pathKey = (options = {}) => { + const environment = options.env || process.env; + const platform = options.platform || process.platform; + if (platform !== "win32") { + return "PATH"; + } + return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path"; + }; + module.exports = pathKey; + module.exports.default = pathKey; +}); + +// node_modules/cross-spawn/lib/util/resolveCommand.js +var require_resolveCommand = __commonJS((exports, module) => { + var path = __require("path"); + var which = require_which(); + var getPathKey = require_path_key(); + function resolveCommandAttempt(parsed, withoutPathExt) { + const env = parsed.options.env || process.env; + const cwd = process.cwd(); + const hasCustomCwd = parsed.options.cwd != null; + const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled; + if (shouldSwitchCwd) { + try { + process.chdir(parsed.options.cwd); + } catch (err) {} + } + let resolved; + try { + resolved = which.sync(parsed.command, { + path: env[getPathKey({ env })], + pathExt: withoutPathExt ? path.delimiter : undefined + }); + } catch (e) {} finally { + if (shouldSwitchCwd) { + process.chdir(cwd); + } + } + if (resolved) { + resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved); + } + return resolved; + } + function resolveCommand(parsed) { + return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true); + } + module.exports = resolveCommand; +}); + +// node_modules/cross-spawn/lib/util/escape.js +var require_escape = __commonJS((exports, module) => { + var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g; + function escapeCommand(arg) { + arg = arg.replace(metaCharsRegExp, "^$1"); + return arg; + } + function escapeArgument(arg, doubleEscapeMetaChars) { + arg = `${arg}`; + arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\""); + arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1"); + arg = `"${arg}"`; + arg = arg.replace(metaCharsRegExp, "^$1"); + if (doubleEscapeMetaChars) { + arg = arg.replace(metaCharsRegExp, "^$1"); + } + return arg; + } + exports.command = escapeCommand; + exports.argument = escapeArgument; +}); + +// node_modules/shebang-regex/index.js +var require_shebang_regex = __commonJS((exports, module) => { + module.exports = /^#!(.*)/; +}); + +// node_modules/shebang-command/index.js +var require_shebang_command = __commonJS((exports, module) => { + var shebangRegex = require_shebang_regex(); + module.exports = (string = "") => { + const match = string.match(shebangRegex); + if (!match) { + return null; + } + const [path, argument] = match[0].replace(/#! ?/, "").split(" "); + const binary = path.split("/").pop(); + if (binary === "env") { + return argument; + } + return argument ? `${binary} ${argument}` : binary; + }; +}); + +// node_modules/cross-spawn/lib/util/readShebang.js +var require_readShebang = __commonJS((exports, module) => { + var fs = __require("fs"); + var shebangCommand = require_shebang_command(); + function readShebang(command) { + const size = 150; + const buffer = Buffer.alloc(size); + let fd; + try { + fd = fs.openSync(command, "r"); + fs.readSync(fd, buffer, 0, size, 0); + fs.closeSync(fd); + } catch (e) {} + return shebangCommand(buffer.toString()); + } + module.exports = readShebang; +}); + +// node_modules/cross-spawn/lib/parse.js +var require_parse = __commonJS((exports, module) => { + var path = __require("path"); + var resolveCommand = require_resolveCommand(); + var escape = require_escape(); + var readShebang = require_readShebang(); + var isWin = process.platform === "win32"; + var isExecutableRegExp = /\.(?:com|exe)$/i; + var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; + function detectShebang(parsed) { + parsed.file = resolveCommand(parsed); + const shebang = parsed.file && readShebang(parsed.file); + if (shebang) { + parsed.args.unshift(parsed.file); + parsed.command = shebang; + return resolveCommand(parsed); + } + return parsed.file; + } + function parseNonShell(parsed) { + if (!isWin) { + return parsed; + } + const commandFile = detectShebang(parsed); + const needsShell = !isExecutableRegExp.test(commandFile); + if (parsed.options.forceShell || needsShell) { + const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile); + parsed.command = path.normalize(parsed.command); + parsed.command = escape.command(parsed.command); + parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars)); + const shellCommand = [parsed.command].concat(parsed.args).join(" "); + parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`]; + parsed.command = process.env.comspec || "cmd.exe"; + parsed.options.windowsVerbatimArguments = true; + } + return parsed; + } + function parse(command, args, options) { + if (args && !Array.isArray(args)) { + options = args; + args = null; + } + args = args ? args.slice(0) : []; + options = Object.assign({}, options); + const parsed = { + command, + args, + options, + file: undefined, + original: { + command, + args + } + }; + return options.shell ? parsed : parseNonShell(parsed); + } + module.exports = parse; +}); + +// node_modules/cross-spawn/lib/enoent.js +var require_enoent = __commonJS((exports, module) => { + var isWin = process.platform === "win32"; + function notFoundError(original, syscall) { + return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), { + code: "ENOENT", + errno: "ENOENT", + syscall: `${syscall} ${original.command}`, + path: original.command, + spawnargs: original.args + }); + } + function hookChildProcess(cp, parsed) { + if (!isWin) { + return; + } + const originalEmit = cp.emit; + cp.emit = function(name, arg1) { + if (name === "exit") { + const err = verifyENOENT(arg1, parsed); + if (err) { + return originalEmit.call(cp, "error", err); + } + } + return originalEmit.apply(cp, arguments); + }; + } + function verifyENOENT(status, parsed) { + if (isWin && status === 1 && !parsed.file) { + return notFoundError(parsed.original, "spawn"); + } + return null; + } + function verifyENOENTSync(status, parsed) { + if (isWin && status === 1 && !parsed.file) { + return notFoundError(parsed.original, "spawnSync"); + } + return null; + } + module.exports = { + hookChildProcess, + verifyENOENT, + verifyENOENTSync, + notFoundError + }; +}); + +// node_modules/cross-spawn/index.js +var require_cross_spawn = __commonJS((exports, module) => { + var cp = __require("child_process"); + var parse = require_parse(); + var enoent = require_enoent(); + function spawn(command, args, options) { + const parsed = parse(command, args, options); + const spawned = cp.spawn(parsed.command, parsed.args, parsed.options); + enoent.hookChildProcess(spawned, parsed); + return spawned; + } + function spawnSync(command, args, options) { + const parsed = parse(command, args, options); + const result = cp.spawnSync(parsed.command, parsed.args, parsed.options); + result.error = result.error || enoent.verifyENOENTSync(result.status, parsed); + return result; + } + module.exports = spawn; + module.exports.spawn = spawn; + module.exports.sync = spawnSync; + module.exports._parse = parse; + module.exports._enoent = enoent; +}); + +// node_modules/lru-cache/dist/commonjs/node/index.min.js +var require_index_min = __commonJS((exports) => { + var j = (u, t) => () => (t || u((t = { exports: {} }).exports, t), t.exports); + var I = j((O) => { + Object.defineProperty(O, "__esModule", { value: true }); + O.tracing = O.metrics = undefined; + var U = __require("diagnostics_channel"); + O.metrics = (0, U.channel)("lru-cache:metrics"); + O.tracing = (0, U.tracingChannel)("lru-cache"); + }); + var P = j((R) => { + Object.defineProperty(R, "__esModule", { value: true }); + R.defaultPerf = undefined; + R.defaultPerf = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date; + }); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.LRUCache = undefined; + var g = I(); + var N = P(); + var C = () => g.metrics.hasSubscribers || g.tracing.hasSubscribers; + var k = new Set; + var G = typeof process == "object" && process ? process : {}; + var V = (u, t, e, i) => { + typeof G.emitWarning == "function" ? G.emitWarning(u, t, e, i) : console.error(`[${e}] ${t}: ${u}`); + }; + var q = (u) => !k.has(u); + var T = (u) => !!u && u === Math.floor(u) && u > 0 && isFinite(u); + var H = (u) => T(u) ? u <= Math.pow(2, 8) ? Uint8Array : u <= Math.pow(2, 16) ? Uint16Array : u <= Math.pow(2, 32) ? Uint32Array : u <= Number.MAX_SAFE_INTEGER ? W : null : null; + var W = class extends Array { + constructor(t) { + super(t), this.fill(0); + } + }; + var L = class u { + heap; + length; + static #o = false; + static create(t) { + let e = H(t); + if (!e) + return []; + u.#o = true; + let i = new u(t, e); + return u.#o = false, i; + } + constructor(t, e) { + if (!u.#o) + throw new TypeError("instantiate Stack using Stack.create(n)"); + this.heap = new e(t), this.length = 0; + } + push(t) { + this.heap[this.length++] = t; + } + pop() { + return this.heap[--this.length]; + } + }; + var M = class u { + #o; + #c; + #m; + #W; + #S; + #x; + #j; + #w; + get perf() { + return this.#w; + } + ttl; + ttlResolution; + ttlAutopurge; + updateAgeOnGet; + updateAgeOnHas; + allowStale; + noDisposeOnSet; + noUpdateTTL; + maxEntrySize; + sizeCalculation; + noDeleteOnFetchRejection; + noDeleteOnStaleGet; + allowStaleOnFetchAbort; + allowStaleOnFetchRejection; + ignoreFetchAbort; + backgroundFetchSize; + #n; + #b; + #s; + #i; + #t; + #l; + #u; + #a; + #h; + #_; + #r; + #y; + #F; + #d; + #g; + #T; + #U; + #f; + #R; + static unsafeExposeInternals(t) { + return { starts: t.#F, ttls: t.#d, autopurgeTimers: t.#g, sizes: t.#y, keyMap: t.#s, keyList: t.#i, valList: t.#t, next: t.#l, prev: t.#u, get head() { + return t.#a; + }, get tail() { + return t.#h; + }, free: t.#_, isBackgroundFetch: (e) => t.#e(e), backgroundFetch: (e, i, s, n) => t.#G(e, i, s, n), moveToTail: (e) => t.#M(e), indexes: (e) => t.#A(e), rindexes: (e) => t.#z(e), isStale: (e) => t.#p(e) }; + } + get max() { + return this.#o; + } + get maxSize() { + return this.#c; + } + get calculatedSize() { + return this.#b; + } + get size() { + return this.#n; + } + get fetchMethod() { + return this.#x; + } + get memoMethod() { + return this.#j; + } + get dispose() { + return this.#m; + } + get onInsert() { + return this.#W; + } + get disposeAfter() { + return this.#S; + } + constructor(t) { + let { max: e = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge: n, updateAgeOnGet: o, updateAgeOnHas: l, allowStale: h, dispose: r, onInsert: c, disposeAfter: w, noDisposeOnSet: y, noUpdateTTL: d, maxSize: p = 0, maxEntrySize: f = 0, sizeCalculation: _, fetchMethod: a, memoMethod: S, noDeleteOnFetchRejection: F, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: m, allowStaleOnFetchAbort: A, ignoreFetchAbort: z, backgroundFetchSize: x = 1, perf: v } = t; + if (this.backgroundFetchSize = x, v !== undefined && typeof v?.now != "function") + throw new TypeError("perf option must have a now() method if specified"); + if (this.#w = v ?? N.defaultPerf, e !== 0 && !T(e)) + throw new TypeError("max option must be a nonnegative integer"); + let E = e ? H(e) : Array; + if (!E) + throw new Error("invalid max value: " + e); + if (this.#o = e, this.#c = p, this.maxEntrySize = f || this.#c, this.sizeCalculation = _, this.sizeCalculation) { + if (!this.#c && !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 (S !== undefined && typeof S != "function") + throw new TypeError("memoMethod must be a function if defined"); + if (this.#j = S, a !== undefined && typeof a != "function") + throw new TypeError("fetchMethod must be a function if specified"); + if (this.#x = a, this.#U = !!a, this.#s = new Map, this.#i = Array.from({ length: e }).fill(undefined), this.#t = Array.from({ length: e }).fill(undefined), this.#l = new E(e), this.#u = new E(e), this.#a = 0, this.#h = 0, this.#_ = L.create(e), this.#n = 0, this.#b = 0, typeof r == "function" && (this.#m = r), typeof c == "function" && (this.#W = c), typeof w == "function" ? (this.#S = w, this.#r = []) : (this.#S = undefined, this.#r = undefined), this.#T = !!this.#m, this.#R = !!this.#W, this.#f = !!this.#S, this.noDisposeOnSet = !!y, this.noUpdateTTL = !!d, this.noDeleteOnFetchRejection = !!F, this.allowStaleOnFetchRejection = !!m, this.allowStaleOnFetchAbort = !!A, this.ignoreFetchAbort = !!z, this.maxEntrySize !== 0) { + if (this.#c !== 0 && !T(this.#c)) + throw new TypeError("maxSize must be a positive integer if specified"); + if (!T(this.maxEntrySize)) + throw new TypeError("maxEntrySize must be a positive integer if specified"); + this.#X(); + } + if (this.allowStale = !!h, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!l, this.ttlResolution = T(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n, this.ttl = i || 0, this.ttl) { + if (!T(this.ttl)) + throw new TypeError("ttl must be a positive integer if specified"); + this.#k(); + } + if (this.#o === 0 && this.ttl === 0 && this.#c === 0) + throw new TypeError("At least one of max, maxSize, or ttl is required"); + if (!this.ttlAutopurge && !this.#o && !this.#c) { + let D = "LRU_CACHE_UNBOUNDED"; + q(D) && (k.add(D), V("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", D, u)); + } + } + getRemainingTTL(t) { + return this.#s.has(t) ? 1 / 0 : 0; + } + #k() { + let t = new W(this.#o), e = new W(this.#o); + this.#d = t, this.#F = e; + let i = this.ttlAutopurge ? Array.from({ length: this.#o }) : undefined; + this.#g = i, this.#H = (h, r, c = this.#w.now()) => { + e[h] = r !== 0 ? c : 0, t[h] = r, s(h, r); + }, this.#D = (h) => { + e[h] = t[h] !== 0 ? this.#w.now() : 0, s(h, t[h]); + }; + let s = this.ttlAutopurge ? (h, r) => { + if (i?.[h] && (clearTimeout(i[h]), i[h] = undefined), r && r !== 0 && i) { + let c = setTimeout(() => { + this.#p(h) ? (this.#v(this.#i[h], "expire"), i[h] = undefined) : s(h, l(h)); + }, r + 1); + c.unref && c.unref(), i[h] = c; + } + } : () => {}; + this.#E = (h, r) => { + if (t[r]) { + let c = t[r], w = e[r]; + if (!c || !w) + return; + h.ttl = c, h.start = w, h.now = n || o(); + let y = h.now - w; + h.remainingTTL = c - y; + } + }; + let n = 0, o = () => { + let h = this.#w.now(); + if (this.ttlResolution > 0) { + n = h; + let r = setTimeout(() => n = 0, this.ttlResolution); + r.unref && r.unref(); + } + return h; + }; + this.getRemainingTTL = (h) => { + let r = this.#s.get(h); + return r === undefined ? 0 : l(r); + }; + let l = (h) => { + let r = t[h], c = e[h]; + if (!r || !c) + return 1 / 0; + let w = (n || o()) - c; + return r - w; + }; + this.#p = (h) => { + let r = e[h], c = t[h]; + return !!c && !!r && (n || o()) - r > c; + }; + } + #D = () => {}; + #E = () => {}; + #H = () => {}; + #p = () => false; + #X() { + let t = new W(this.#o); + this.#b = 0, this.#y = t, this.#C = (e) => { + this.#b -= t[e], t[e] = 0; + }, this.#N = (e, i, s, n) => { + if (!T(s)) { + if (this.#e(i)) + return this.backgroundFetchSize; + if (n) { + if (typeof n != "function") + throw new TypeError("sizeCalculation must be a function"); + if (s = n(i, e), !T(s)) + 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 s; + }, this.#I = (e, i, s) => { + if (t[e] = i, this.#c) { + let n = this.#c - t[e]; + for (;this.#b > n; ) + this.#P(true); + } + this.#b += t[e], s && (s.entrySize = i, s.totalCalculatedSize = this.#b); + }; + } + #C = (t) => {}; + #I = (t, e, i) => {}; + #N = (t, e, i, s) => { + if (i || s) + throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache"); + return 0; + }; + *#A({ allowStale: t = this.allowStale } = {}) { + if (this.#n) + for (let e = this.#h;this.#V(e) && ((t || !this.#p(e)) && (yield e), e !== this.#a); ) + e = this.#u[e]; + } + *#z({ allowStale: t = this.allowStale } = {}) { + if (this.#n) + for (let e = this.#a;this.#V(e) && ((t || !this.#p(e)) && (yield e), e !== this.#h); ) + e = this.#l[e]; + } + #V(t) { + return t !== undefined && this.#s.get(this.#i[t]) === t; + } + *entries() { + for (let t of this.#A()) + this.#t[t] !== undefined && this.#i[t] !== undefined && !this.#e(this.#t[t]) && (yield [this.#i[t], this.#t[t]]); + } + *rentries() { + for (let t of this.#z()) + this.#t[t] !== undefined && this.#i[t] !== undefined && !this.#e(this.#t[t]) && (yield [this.#i[t], this.#t[t]]); + } + *keys() { + for (let t of this.#A()) { + let e = this.#i[t]; + e !== undefined && !this.#e(this.#t[t]) && (yield e); + } + } + *rkeys() { + for (let t of this.#z()) { + let e = this.#i[t]; + e !== undefined && !this.#e(this.#t[t]) && (yield e); + } + } + *values() { + for (let t of this.#A()) + this.#t[t] !== undefined && !this.#e(this.#t[t]) && (yield this.#t[t]); + } + *rvalues() { + for (let t of this.#z()) + this.#t[t] !== undefined && !this.#e(this.#t[t]) && (yield this.#t[t]); + } + [Symbol.iterator]() { + return this.entries(); + } + [Symbol.toStringTag] = "LRUCache"; + find(t, e = {}) { + for (let i of this.#A()) { + let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s; + if (n !== undefined && t(n, this.#i[i], this)) + return this.#L(this.#i[i], e); + } + } + forEach(t, e = this) { + for (let i of this.#A()) { + let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s; + n !== undefined && t.call(e, n, this.#i[i], this); + } + } + rforEach(t, e = this) { + for (let i of this.#z()) { + let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s; + n !== undefined && t.call(e, n, this.#i[i], this); + } + } + purgeStale() { + let t = false; + for (let e of this.#z({ allowStale: true })) + this.#p(e) && (this.#v(this.#i[e], "expire"), t = true); + return t; + } + info(t) { + let e = this.#s.get(t); + if (e === undefined) + return; + let i = this.#t[e], s = this.#e(i) ? i.__staleWhileFetching : i; + if (s === undefined) + return; + let n = { value: s }; + if (this.#d && this.#F) { + let o = this.#d[e], l = this.#F[e]; + if (o && l) { + let h = o - (this.#w.now() - l); + n.ttl = h, n.start = Date.now(); + } + } + return this.#y && (n.size = this.#y[e]), n; + } + dump() { + let t = []; + for (let e of this.#A({ allowStale: true })) { + let i = this.#i[e], s = this.#t[e], n = this.#e(s) ? s.__staleWhileFetching : s; + if (n === undefined || i === undefined) + continue; + let o = { value: n }; + if (this.#d && this.#F) { + o.ttl = this.#d[e]; + let l = this.#w.now() - this.#F[e]; + o.start = Math.floor(Date.now() - l); + } + this.#y && (o.size = this.#y[e]), t.unshift([i, o]); + } + return t; + } + load(t) { + this.clear(); + for (let [e, i] of t) { + if (i.start) { + let s = Date.now() - i.start; + i.start = this.#w.now() - s; + } + this.#O(e, i.value, i); + } + } + set(t, e, i = {}) { + let { status: s = g.metrics.hasSubscribers ? {} : undefined } = i; + i.status = s, s && (s.op = "set", s.key = t, e !== undefined && (s.value = e), s.cache = this); + let n = this.#O(t, e, i); + return s && g.metrics.hasSubscribers && g.metrics.publish(s), n; + } + #O(t, e, i, s) { + let { ttl: n = this.ttl, start: o, noDisposeOnSet: l = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: r } = i, c = this.#e(e); + if (e === undefined) + return r && (r.set = "deleted"), this.delete(t), this; + let { noUpdateTTL: w = this.noUpdateTTL } = i; + r && !c && (r.value = e); + let y = this.#N(t, e, i.size || 0, h, r); + if (this.maxEntrySize && y > this.maxEntrySize) + return this.#v(t, "set"), r && (r.set = "miss", r.maxEntrySizeExceeded = true), this; + let d = this.#n === 0 ? undefined : this.#s.get(t); + if (d === undefined) + d = this.#n === 0 ? this.#h : this.#_.length !== 0 ? this.#_.pop() : this.#n === this.#o ? this.#P(false) : this.#n, this.#i[d] = t, this.#t[d] = e, this.#s.set(t, d), this.#l[this.#h] = d, this.#u[d] = this.#h, this.#h = d, this.#n++, this.#I(d, y, r), r && (r.set = "add"), w = false, this.#R && !c && this.#W?.(e, t, "add"); + else { + this.#M(d); + let p = this.#t[d]; + if (e !== p) { + if (!l) + if (this.#e(p)) { + p !== s && p.__abortController.abort(new Error("replaced")); + let { __staleWhileFetching: f } = p; + f !== undefined && f !== e && (this.#T && this.#m?.(f, t, "set"), this.#f && this.#r?.push([f, t, "set"])); + } else + this.#T && this.#m?.(p, t, "set"), this.#f && this.#r?.push([p, t, "set"]); + if (this.#C(d), this.#I(d, y, r), this.#t[d] = e, !c) { + let f = p && this.#e(p) ? p.__staleWhileFetching : p, _ = f === undefined ? "add" : e !== f ? "replace" : "update"; + r && (r.set = _, f !== undefined && (r.oldValue = f)), this.#R && this.onInsert?.(e, t, _); + } + } else + c || (r && (r.set = "update"), this.#R && this.onInsert?.(e, t, "update")); + } + if (n !== 0 && !this.#d && this.#k(), this.#d && (w || this.#H(d, n, o), r && this.#E(r, d)), !l && this.#f && this.#r) { + let p = this.#r, f; + for (;f = p?.shift(); ) + this.#S?.(...f); + } + return this; + } + pop() { + try { + for (;this.#n; ) { + let t = this.#t[this.#a]; + if (this.#P(true), this.#e(t)) { + if (t.__staleWhileFetching) + return t.__staleWhileFetching; + } else if (t !== undefined) + return t; + } + } finally { + if (this.#f && this.#r) { + let t = this.#r, e; + for (;e = t?.shift(); ) + this.#S?.(...e); + } + } + } + #P(t) { + let e = this.#a, i = this.#i[e], s = this.#t[e], n = this.#e(s); + n && s.__abortController.abort(new Error("evicted")); + let o = n ? s.__staleWhileFetching : s; + return (this.#T || this.#f) && o !== undefined && (this.#T && this.#m?.(o, i, "evict"), this.#f && this.#r?.push([o, i, "evict"])), this.#C(e), this.#g?.[e] && (clearTimeout(this.#g[e]), this.#g[e] = undefined), t && (this.#i[e] = undefined, this.#t[e] = undefined, this.#_.push(e)), this.#n === 1 ? (this.#a = this.#h = 0, this.#_.length = 0) : this.#a = this.#l[e], this.#s.delete(i), this.#n--, e; + } + has(t, e = {}) { + let { status: i = g.metrics.hasSubscribers ? {} : undefined } = e; + e.status = i, i && (i.op = "has", i.key = t, i.cache = this); + let s = this.#Y(t, e); + return g.metrics.hasSubscribers && g.metrics.publish(i), s; + } + #Y(t, e = {}) { + let { updateAgeOnHas: i = this.updateAgeOnHas, status: s } = e, n = this.#s.get(t); + if (n !== undefined) { + let o = this.#t[n]; + if (this.#e(o) && o.__staleWhileFetching === undefined) + return false; + if (this.#p(n)) + s && (s.has = "stale", this.#E(s, n)); + else + return i && this.#D(n), s && (s.has = "hit", this.#E(s, n)), true; + } else + s && (s.has = "miss"); + return false; + } + peek(t, e = {}) { + let { status: i = C() ? {} : undefined } = e; + i && (i.op = "peek", i.key = t, i.cache = this), e.status = i; + let s = this.#J(t, e); + return g.metrics.hasSubscribers && g.metrics.publish(i), s; + } + #J(t, e) { + let { status: i, allowStale: s = this.allowStale } = e, n = this.#s.get(t); + if (n === undefined || !s && this.#p(n)) { + i && (i.peek = n === undefined ? "miss" : "stale"); + return; + } + let o = this.#t[n], l = this.#e(o) ? o.__staleWhileFetching : o; + return i && (l !== undefined ? (i.peek = "hit", i.value = l) : i.peek = "miss"), l; + } + #G(t, e, i, s) { + let n = e === undefined ? undefined : this.#t[e]; + if (this.#e(n)) + return n; + let o = new AbortController, { signal: l } = i; + l?.addEventListener("abort", () => o.abort(l.reason), { signal: o.signal }); + let h = { signal: o.signal, options: i, context: s }, r = (f, _ = false) => { + let { aborted: a } = o.signal, S = i.ignoreFetchAbort && f !== undefined, F = i.ignoreFetchAbort || !!(i.allowStaleOnFetchAbort && f !== undefined); + if (i.status && (a && !_ ? (i.status.fetchAborted = true, i.status.fetchError = o.signal.reason, S && (i.status.fetchAbortIgnored = true)) : i.status.fetchResolved = true), a && !S && !_) + return w(o.signal.reason, F); + let b = d, m = this.#t[e]; + return (m === d || m === undefined && S && _) && (f === undefined ? b.__staleWhileFetching !== undefined ? this.#t[e] = b.__staleWhileFetching : this.#v(t, "fetch") : (i.status && (i.status.fetchUpdated = true), this.#O(t, f, h.options, b))), f; + }, c = (f) => (i.status && (i.status.fetchRejected = true, i.status.fetchError = f), w(f, false)), w = (f, _) => { + let { aborted: a } = o.signal, S = a && i.allowStaleOnFetchAbort, F = S || i.allowStaleOnFetchRejection, b = F || i.noDeleteOnFetchRejection, m = d; + if (this.#t[e] === d && (!b || !_ && m.__staleWhileFetching === undefined ? this.#v(t, "fetch") : S || (this.#t[e] = m.__staleWhileFetching)), F) + return i.status && m.__staleWhileFetching !== undefined && (i.status.returnedStale = true), m.__staleWhileFetching; + if (m.__returned === m) + throw f; + }, y = (f, _) => { + let a = this.#x?.(t, n, h); + o.signal.addEventListener("abort", () => { + (!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (f(undefined), i.allowStaleOnFetchAbort && (f = (S) => r(S, true))); + }), a && a instanceof Promise ? a.then((S) => f(S === undefined ? undefined : S), _) : a !== undefined && f(a); + }; + i.status && (i.status.fetchDispatched = true); + let d = new Promise(y).then(r, c), p = Object.assign(d, { __abortController: o, __staleWhileFetching: n, __returned: undefined }); + return e === undefined ? (this.#O(t, p, { ...h.options, status: undefined }), e = this.#s.get(t)) : this.#t[e] = p, p; + } + #e(t) { + if (!this.#U) + return false; + let e = t; + return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof AbortController; + } + fetch(t, e = {}) { + let i = g.tracing.hasSubscribers, { status: s = C() ? {} : undefined } = e; + e.status = s, s && e.context && (s.context = e.context); + let n = this.#q(t, e); + return s && i && (s.trace = true, g.tracing.tracePromise(() => n, s).catch(() => {})), n; + } + async#q(t, e = {}) { + let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: l = this.noDisposeOnSet, size: h = 0, sizeCalculation: r = this.sizeCalculation, noUpdateTTL: c = this.noUpdateTTL, noDeleteOnFetchRejection: w = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: y = this.allowStaleOnFetchRejection, ignoreFetchAbort: d = this.ignoreFetchAbort, allowStaleOnFetchAbort: p = this.allowStaleOnFetchAbort, context: f, forceRefresh: _ = false, status: a, signal: S } = e; + if (a && (a.op = "fetch", a.key = t, _ && (a.forceRefresh = true), a.cache = this), !this.#U) + return a && (a.fetch = "get"), this.#L(t, { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, status: a }); + let F = { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, ttl: o, noDisposeOnSet: l, size: h, sizeCalculation: r, noUpdateTTL: c, noDeleteOnFetchRejection: w, allowStaleOnFetchRejection: y, allowStaleOnFetchAbort: p, ignoreFetchAbort: d, status: a, signal: S }, b = this.#s.get(t); + if (b === undefined) { + a && (a.fetch = "miss"); + let m = this.#G(t, b, F, f); + return m.__returned = m; + } else { + let m = this.#t[b]; + if (this.#e(m)) { + let E = i && m.__staleWhileFetching !== undefined; + return a && (a.fetch = "inflight", E && (a.returnedStale = true)), E ? m.__staleWhileFetching : m.__returned = m; + } + let A = this.#p(b); + if (!_ && !A) + return a && (a.fetch = "hit"), this.#M(b), s && this.#D(b), a && this.#E(a, b), m; + let z = this.#G(t, b, F, f), v = z.__staleWhileFetching !== undefined && i; + return a && (a.fetch = A ? "stale" : "refresh", v && A && (a.returnedStale = true)), v ? z.__staleWhileFetching : z.__returned = z; + } + } + forceFetch(t, e = {}) { + let i = g.tracing.hasSubscribers, { status: s = C() ? {} : undefined } = e; + e.status = s, s && e.context && (s.context = e.context); + let n = this.#K(t, e); + return s && i && (s.trace = true, g.tracing.tracePromise(() => n, s).catch(() => {})), n; + } + async#K(t, e = {}) { + let i = await this.#q(t, e); + if (i === undefined) + throw new Error("fetch() returned undefined"); + return i; + } + memo(t, e = {}) { + let { status: i = g.metrics.hasSubscribers ? {} : undefined } = e; + e.status = i, i && (i.op = "memo", i.key = t, e.context && (i.context = e.context), i.cache = this); + let s = this.#Q(t, e); + return i && (i.value = s), g.metrics.hasSubscribers && g.metrics.publish(i), s; + } + #Q(t, e = {}) { + let i = this.#j; + if (!i) + throw new Error("no memoMethod provided to constructor"); + let { context: s, status: n, forceRefresh: o, ...l } = e; + n && o && (n.forceRefresh = true); + let h = this.#L(t, l), r = o || h === undefined; + if (n && (n.memo = r ? "miss" : "hit", r || (n.value = h)), !r) + return h; + let c = i(t, h, { options: l, context: s }); + return n && (n.value = c), this.#O(t, c, l), c; + } + get(t, e = {}) { + let { status: i = g.metrics.hasSubscribers ? {} : undefined } = e; + e.status = i, i && (i.op = "get", i.key = t, i.cache = this); + let s = this.#L(t, e); + return i && (s !== undefined && (i.value = s), g.metrics.hasSubscribers && g.metrics.publish(i)), s; + } + #L(t, e = {}) { + let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: o } = e, l = this.#s.get(t); + if (l === undefined) { + o && (o.get = "miss"); + return; + } + let h = this.#t[l], r = this.#e(h); + return o && this.#E(o, l), this.#p(l) ? r ? (o && (o.get = "stale-fetching"), i && h.__staleWhileFetching !== undefined ? (o && (o.returnedStale = true), h.__staleWhileFetching) : undefined) : (n || this.#v(t, "expire"), o && (o.get = "stale"), i ? (o && (o.returnedStale = true), h) : undefined) : (o && (o.get = r ? "fetching" : "hit"), this.#M(l), s && this.#D(l), r ? h.__staleWhileFetching : h); + } + #B(t, e) { + this.#u[e] = t, this.#l[t] = e; + } + #M(t) { + t !== this.#h && (t === this.#a ? this.#a = this.#l[t] : this.#B(this.#u[t], this.#l[t]), this.#B(this.#h, t), this.#h = t); + } + delete(t) { + return this.#v(t, "delete"); + } + #v(t, e) { + g.metrics.hasSubscribers && g.metrics.publish({ op: "delete", delete: e, key: t, cache: this }); + let i = false; + if (this.#n !== 0) { + let s = this.#s.get(t); + if (s !== undefined) + if (this.#g?.[s] && (clearTimeout(this.#g[s]), this.#g[s] = undefined), i = true, this.#n === 1) + this.#$(e); + else { + this.#C(s); + let n = this.#t[s]; + if (this.#e(n) ? n.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#m?.(n, t, e), this.#f && this.#r?.push([n, t, e])), this.#s.delete(t), this.#i[s] = undefined, this.#t[s] = undefined, s === this.#h) + this.#h = this.#u[s]; + else if (s === this.#a) + this.#a = this.#l[s]; + else { + let o = this.#u[s]; + this.#l[o] = this.#l[s]; + let l = this.#l[s]; + this.#u[l] = this.#u[s]; + } + this.#n--, this.#_.push(s); + } + } + if (this.#f && this.#r?.length) { + let s = this.#r, n; + for (;n = s?.shift(); ) + this.#S?.(...n); + } + return i; + } + clear() { + return this.#$("delete"); + } + #$(t) { + for (let e of this.#z({ allowStale: true })) { + let i = this.#t[e]; + if (this.#e(i)) + i.__abortController.abort(new Error("deleted")); + else { + let s = this.#i[e]; + this.#T && this.#m?.(i, s, t), this.#f && this.#r?.push([i, s, t]); + } + } + if (this.#s.clear(), this.#t.fill(undefined), this.#i.fill(undefined), this.#d && this.#F) { + this.#d.fill(0), this.#F.fill(0); + for (let e of this.#g ?? []) + e !== undefined && clearTimeout(e); + this.#g?.fill(undefined); + } + if (this.#y && this.#y.fill(0), this.#a = 0, this.#h = 0, this.#_.length = 0, this.#b = 0, this.#n = 0, this.#f && this.#r) { + let e = this.#r, i; + for (;i = e?.shift(); ) + this.#S?.(...i); + } + } + }; + exports.LRUCache = M; +}); + +// node_modules/hosted-git-info/lib/hosts.js +var require_hosts = __commonJS((exports, module) => { + var maybeJoin = (...args) => args.every((arg) => arg) ? args.join("") : ""; + var maybeEncode = (arg) => arg ? encodeURIComponent(arg) : ""; + var formatHashFragment = (f) => f.toLowerCase().replace(/^\W+/g, "").replace(/(? `git@${domain}:${user}/${project}.git${maybeJoin("#", committish)}`, + sshurltemplate: ({ domain, user, project, committish }) => `git+ssh://git@${domain}/${user}/${project}.git${maybeJoin("#", committish)}`, + edittemplate: ({ domain, user, project, committish, editpath, path }) => `https://${domain}/${user}/${project}${maybeJoin("/", editpath, "/", maybeEncode(committish || "HEAD"), "/", path)}`, + browsetemplate: ({ domain, user, project, committish, treepath }) => `https://${domain}/${user}/${project}${maybeJoin("/", treepath, "/", maybeEncode(committish))}`, + browsetreetemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || "HEAD")}/${path}${maybeJoin("#", hashformat(fragment || ""))}`, + browseblobtemplate: ({ domain, user, project, committish, blobpath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${blobpath}/${maybeEncode(committish || "HEAD")}/${path}${maybeJoin("#", hashformat(fragment || ""))}`, + docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin("/", treepath, "/", maybeEncode(committish))}#readme`, + httpstemplate: ({ auth, domain, user, project, committish }) => `git+https://${maybeJoin(auth, "@")}${domain}/${user}/${project}.git${maybeJoin("#", committish)}`, + filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/raw/${maybeEncode(committish || "HEAD")}/${path}`, + shortcuttemplate: ({ type, user, project, committish }) => `${type}:${user}/${project}${maybeJoin("#", committish)}`, + pathtemplate: ({ user, project, committish }) => `${user}/${project}${maybeJoin("#", committish)}`, + bugstemplate: ({ domain, user, project }) => `https://${domain}/${user}/${project}/issues`, + hashformat: formatHashFragment + }; + var hosts = {}; + hosts.github = { + protocols: ["git:", "http:", "git+ssh:", "git+https:", "ssh:", "https:"], + domain: "github.com", + treepath: "tree", + blobpath: "blob", + editpath: "edit", + filetemplate: ({ auth, user, project, committish, path }) => `https://${maybeJoin(auth, "@")}raw.githubusercontent.com/${user}/${project}/${maybeEncode(committish || "HEAD")}/${path}`, + gittemplate: ({ auth, domain, user, project, committish }) => `git://${maybeJoin(auth, "@")}${domain}/${user}/${project}.git${maybeJoin("#", committish)}`, + tarballtemplate: ({ domain, user, project, committish }) => `https://codeload.${domain}/${user}/${project}/tar.gz/${maybeEncode(committish || "HEAD")}`, + extract: (url) => { + let [, user, project, type, committish] = url.pathname.split("/", 5); + if (type && type !== "tree") { + return; + } + if (!type) { + committish = url.hash.slice(1); + } + if (project && project.endsWith(".git")) { + project = project.slice(0, -4); + } + if (!user || !project) { + return; + } + return { user, project, committish }; + } + }; + hosts.bitbucket = { + protocols: ["git+ssh:", "git+https:", "ssh:", "https:"], + domain: "bitbucket.org", + treepath: "src", + blobpath: "src", + editpath: "?mode=edit", + edittemplate: ({ domain, user, project, committish, treepath, path, editpath }) => `https://${domain}/${user}/${project}${maybeJoin("/", treepath, "/", maybeEncode(committish || "HEAD"), "/", path, editpath)}`, + tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/get/${maybeEncode(committish || "HEAD")}.tar.gz`, + extract: (url) => { + let [, user, project, aux] = url.pathname.split("/", 4); + if (["get"].includes(aux)) { + return; + } + if (project && project.endsWith(".git")) { + project = project.slice(0, -4); + } + if (!user || !project) { + return; + } + return { user, project, committish: url.hash.slice(1) }; + } + }; + hosts.gitlab = { + protocols: ["git+ssh:", "git+https:", "ssh:", "https:"], + domain: "gitlab.com", + treepath: "tree", + blobpath: "tree", + editpath: "-/edit", + tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/api/v4/projects/${maybeEncode(user + "/" + project)}/repository/archive.tar.gz?sha=${maybeEncode(committish || "HEAD")}`, + extract: (url) => { + const path = url.pathname.slice(1); + if (path.includes("/-/") || path.includes("/archive.tar.gz")) { + return; + } + const segments = path.split("/"); + let project = segments.pop(); + if (project.endsWith(".git")) { + project = project.slice(0, -4); + } + const user = segments.join("/"); + if (!user || !project) { + return; + } + return { user, project, committish: url.hash.slice(1) }; + } + }; + hosts.gist = { + protocols: ["git:", "git+ssh:", "git+https:", "ssh:", "https:"], + domain: "gist.github.com", + editpath: "edit", + sshtemplate: ({ domain, project, committish }) => `git@${domain}:${project}.git${maybeJoin("#", committish)}`, + sshurltemplate: ({ domain, project, committish }) => `git+ssh://git@${domain}/${project}.git${maybeJoin("#", committish)}`, + edittemplate: ({ domain, user, project, committish, editpath }) => `https://${domain}/${user}/${project}${maybeJoin("/", maybeEncode(committish))}/${editpath}`, + browsetemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}`, + browsetreetemplate: ({ domain, project, committish, path, hashformat }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}${maybeJoin("#", hashformat(path))}`, + browseblobtemplate: ({ domain, project, committish, path, hashformat }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}${maybeJoin("#", hashformat(path))}`, + docstemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}`, + httpstemplate: ({ domain, project, committish }) => `git+https://${domain}/${project}.git${maybeJoin("#", committish)}`, + filetemplate: ({ user, project, committish, path }) => `https://gist.githubusercontent.com/${user}/${project}/raw${maybeJoin("/", maybeEncode(committish))}/${path}`, + shortcuttemplate: ({ type, project, committish }) => `${type}:${project}${maybeJoin("#", committish)}`, + pathtemplate: ({ project, committish }) => `${project}${maybeJoin("#", committish)}`, + bugstemplate: ({ domain, project }) => `https://${domain}/${project}`, + gittemplate: ({ domain, project, committish }) => `git://${domain}/${project}.git${maybeJoin("#", committish)}`, + tarballtemplate: ({ project, committish }) => `https://codeload.github.com/gist/${project}/tar.gz/${maybeEncode(committish || "HEAD")}`, + extract: (url) => { + let [, user, project, aux] = url.pathname.split("/", 4); + if (aux === "raw") { + return; + } + if (!project) { + if (!user) { + return; + } + project = user; + user = null; + } + if (project.endsWith(".git")) { + project = project.slice(0, -4); + } + return { user, project, committish: url.hash.slice(1) }; + }, + hashformat: function(fragment) { + return fragment && "file-" + formatHashFragment(fragment); + } + }; + hosts.sourcehut = { + protocols: ["git+ssh:", "https:"], + domain: "git.sr.ht", + treepath: "tree", + blobpath: "tree", + filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || "HEAD"}/${path}`, + httpstemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}${maybeJoin("#", committish)}`, + tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || "HEAD"}.tar.gz`, + bugstemplate: () => null, + extract: (url) => { + let [, user, project, aux] = url.pathname.split("/", 4); + if (["archive"].includes(aux)) { + return; + } + if (project && project.endsWith(".git")) { + project = project.slice(0, -4); + } + if (!user || !project) { + return; + } + return { user, project, committish: url.hash.slice(1) }; + } + }; + for (const [name, host] of Object.entries(hosts)) { + hosts[name] = Object.assign({}, defaults, host); + } + module.exports = hosts; +}); + +// node_modules/hosted-git-info/lib/parse-url.js +var require_parse_url = __commonJS((exports, module) => { + var url = __require("url"); + var lastIndexOfBefore = (str, char, beforeChar) => { + const startPosition = str.indexOf(beforeChar); + return str.lastIndexOf(char, startPosition > -1 ? startPosition : Infinity); + }; + var safeUrl = (u) => { + try { + return new url.URL(u); + } catch {} + }; + var correctProtocol = (arg, protocols) => { + const firstColon = arg.indexOf(":"); + const proto = arg.slice(0, firstColon + 1); + if (Object.prototype.hasOwnProperty.call(protocols, proto)) { + return arg; + } + if (arg.substr(firstColon, 3) === "://") { + return arg; + } + const firstAt = arg.indexOf("@"); + if (firstAt > -1) { + if (firstAt > firstColon) { + return `git+ssh://${arg}`; + } else { + return arg; + } + } + return `${arg.slice(0, firstColon + 1)}//${arg.slice(firstColon + 1)}`; + }; + var correctUrl = (giturl) => { + const firstAt = lastIndexOfBefore(giturl, "@", "#"); + const lastColonBeforeHash = lastIndexOfBefore(giturl, ":", "#"); + if (lastColonBeforeHash > firstAt) { + giturl = giturl.slice(0, lastColonBeforeHash) + "/" + giturl.slice(lastColonBeforeHash + 1); + } + if (lastIndexOfBefore(giturl, ":", "#") === -1 && giturl.indexOf("//") === -1) { + giturl = `git+ssh://${giturl}`; + } + return giturl; + }; + module.exports = (giturl, protocols) => { + const withProtocol = protocols ? correctProtocol(giturl, protocols) : giturl; + return safeUrl(withProtocol) || safeUrl(correctUrl(withProtocol)); + }; +}); + +// node_modules/hosted-git-info/lib/from-url.js +var require_from_url = __commonJS((exports, module) => { + var parseUrl = require_parse_url(); + var isGitHubShorthand = (arg) => { + const firstHash = arg.indexOf("#"); + const firstSlash = arg.indexOf("/"); + const secondSlash = arg.indexOf("/", firstSlash + 1); + const firstColon = arg.indexOf(":"); + const firstSpace = /\s/.exec(arg); + const firstAt = arg.indexOf("@"); + const spaceOnlyAfterHash = !firstSpace || firstHash > -1 && firstSpace.index > firstHash; + const atOnlyAfterHash = firstAt === -1 || firstHash > -1 && firstAt > firstHash; + const colonOnlyAfterHash = firstColon === -1 || firstHash > -1 && firstColon > firstHash; + const secondSlashOnlyAfterHash = secondSlash === -1 || firstHash > -1 && secondSlash > firstHash; + const hasSlash = firstSlash > 0; + const doesNotEndWithSlash = firstHash > -1 ? arg[firstHash - 1] !== "/" : !arg.endsWith("/"); + const doesNotStartWithDot = !arg.startsWith("."); + return spaceOnlyAfterHash && hasSlash && doesNotEndWithSlash && doesNotStartWithDot && atOnlyAfterHash && colonOnlyAfterHash && secondSlashOnlyAfterHash; + }; + module.exports = (giturl, opts, { gitHosts, protocols }) => { + if (!giturl) { + return; + } + const correctedUrl = isGitHubShorthand(giturl) ? `github:${giturl}` : giturl; + const parsed = parseUrl(correctedUrl, protocols); + if (!parsed) { + return; + } + const gitHostShortcut = gitHosts.byShortcut[parsed.protocol]; + const gitHostDomain = gitHosts.byDomain[parsed.hostname.startsWith("www.") ? parsed.hostname.slice(4) : parsed.hostname]; + const gitHostName = gitHostShortcut || gitHostDomain; + if (!gitHostName) { + return; + } + const gitHostInfo = gitHosts[gitHostShortcut || gitHostDomain]; + let auth = null; + if (protocols[parsed.protocol]?.auth && (parsed.username || parsed.password)) { + auth = `${parsed.username}${parsed.password ? ":" + parsed.password : ""}`; + } + let committish = null; + let user = null; + let project = null; + let defaultRepresentation = null; + try { + if (gitHostShortcut) { + let pathname = parsed.pathname.startsWith("/") ? parsed.pathname.slice(1) : parsed.pathname; + const firstAt = pathname.indexOf("@"); + if (firstAt > -1) { + pathname = pathname.slice(firstAt + 1); + } + const lastSlash = pathname.lastIndexOf("/"); + if (lastSlash > -1) { + user = decodeURIComponent(pathname.slice(0, lastSlash)); + if (!user) { + user = null; + } + project = decodeURIComponent(pathname.slice(lastSlash + 1)); + } else { + project = decodeURIComponent(pathname); + } + if (project.endsWith(".git")) { + project = project.slice(0, -4); + } + if (parsed.hash) { + committish = decodeURIComponent(parsed.hash.slice(1)); + } + defaultRepresentation = "shortcut"; + } else { + if (!gitHostInfo.protocols.includes(parsed.protocol)) { + return; + } + const segments = gitHostInfo.extract(parsed); + if (!segments) { + return; + } + user = segments.user && decodeURIComponent(segments.user); + project = decodeURIComponent(segments.project); + committish = decodeURIComponent(segments.committish); + defaultRepresentation = protocols[parsed.protocol]?.name || parsed.protocol.slice(0, -1); + } + } catch (err) { + if (err instanceof URIError) { + return; + } else { + throw err; + } + } + return [gitHostName, user, auth, project, committish, defaultRepresentation, opts]; + }; +}); + +// node_modules/hosted-git-info/lib/index.js +var require_lib = __commonJS((exports, module) => { + var { LRUCache } = require_index_min(); + var hosts = require_hosts(); + var fromUrl = require_from_url(); + var parseUrl = require_parse_url(); + var cache = new LRUCache({ max: 1000 }); + function unknownHostedUrl(url) { + try { + const { + protocol, + hostname, + pathname + } = new URL(url); + if (!hostname) { + return null; + } + const proto = /(?:git\+)http:$/.test(protocol) ? "http:" : "https:"; + const path = pathname.replace(/\.git$/, ""); + return `${proto}//${hostname}${path}`; + } catch { + return null; + } + } + + class GitHost { + constructor(type, user, auth, project, committish, defaultRepresentation, opts = {}) { + Object.assign(this, GitHost.#gitHosts[type], { + type, + user, + auth, + project, + committish, + default: defaultRepresentation, + opts + }); + } + static #gitHosts = { byShortcut: {}, byDomain: {} }; + static #protocols = { + "git+ssh:": { name: "sshurl" }, + "ssh:": { name: "sshurl" }, + "git+https:": { name: "https", auth: true }, + "git:": { auth: true }, + "http:": { auth: true }, + "https:": { auth: true }, + "git+http:": { auth: true } + }; + static addHost(name, host) { + GitHost.#gitHosts[name] = host; + GitHost.#gitHosts.byDomain[host.domain] = name; + GitHost.#gitHosts.byShortcut[`${name}:`] = name; + GitHost.#protocols[`${name}:`] = { name }; + } + static fromUrl(giturl, opts) { + if (typeof giturl !== "string") { + return; + } + const key = giturl + JSON.stringify(opts || {}); + if (!cache.has(key)) { + const hostArgs = fromUrl(giturl, opts, { + gitHosts: GitHost.#gitHosts, + protocols: GitHost.#protocols + }); + cache.set(key, hostArgs ? new GitHost(...hostArgs) : undefined); + } + return cache.get(key); + } + static fromManifest(manifest, opts = {}) { + if (!manifest || typeof manifest !== "object") { + return; + } + const r = manifest.repository; + const rurl = r && (typeof r === "string" ? r : typeof r === "object" && typeof r.url === "string" ? r.url : null); + if (!rurl) { + throw new Error("no repository"); + } + const info = rurl && GitHost.fromUrl(rurl.replace(/^git\+/, ""), opts) || null; + if (info) { + return info; + } + const unk = unknownHostedUrl(rurl); + return GitHost.fromUrl(unk, opts) || unk; + } + static parseUrl(url) { + return parseUrl(url); + } + #fill(template, opts) { + if (typeof template !== "function") { + return null; + } + const options = { ...this, ...this.opts, ...opts }; + if (!options.path) { + options.path = ""; + } + if (options.path.startsWith("/")) { + options.path = options.path.slice(1); + } + if (options.noCommittish) { + options.committish = null; + } + const result = template(options); + return options.noGitPlus && result.startsWith("git+") ? result.slice(4) : result; + } + hash() { + return this.committish ? `#${this.committish}` : ""; + } + ssh(opts) { + return this.#fill(this.sshtemplate, opts); + } + sshurl(opts) { + return this.#fill(this.sshurltemplate, opts); + } + browse(path, ...args) { + if (typeof path !== "string") { + return this.#fill(this.browsetemplate, path); + } + if (typeof args[0] !== "string") { + return this.#fill(this.browsetreetemplate, { ...args[0], path }); + } + return this.#fill(this.browsetreetemplate, { ...args[1], fragment: args[0], path }); + } + browseFile(path, ...args) { + if (typeof args[0] !== "string") { + return this.#fill(this.browseblobtemplate, { ...args[0], path }); + } + return this.#fill(this.browseblobtemplate, { ...args[1], fragment: args[0], path }); + } + docs(opts) { + return this.#fill(this.docstemplate, opts); + } + bugs(opts) { + return this.#fill(this.bugstemplate, opts); + } + https(opts) { + return this.#fill(this.httpstemplate, opts); + } + git(opts) { + return this.#fill(this.gittemplate, opts); + } + shortcut(opts) { + return this.#fill(this.shortcuttemplate, opts); + } + path(opts) { + return this.#fill(this.pathtemplate, opts); + } + tarball(opts) { + return this.#fill(this.tarballtemplate, { ...opts, noCommittish: false }); + } + file(path, opts) { + return this.#fill(this.filetemplate, { ...opts, path }); + } + edit(path, opts) { + return this.#fill(this.edittemplate, { ...opts, path }); + } + getDefaultRepresentation() { + return this.default; + } + toString(opts) { + if (this.default && typeof this[this.default] === "function") { + return this[this.default](opts); + } + return this.sshurl(opts); + } + } + for (const [name, host] of Object.entries(hosts)) { + GitHost.addHost(name, host); + } + module.exports = GitHost; +}); + +// node_modules/semver/internal/constants.js +var require_constants = __commonJS((exports, module) => { + var SEMVER_SPEC_VERSION = "2.0.0"; + var MAX_LENGTH = 256; + var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; + var MAX_SAFE_COMPONENT_LENGTH = 16; + var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6; + var RELEASE_TYPES = [ + "major", + "premajor", + "minor", + "preminor", + "patch", + "prepatch", + "prerelease" + ]; + module.exports = { + MAX_LENGTH, + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_SAFE_INTEGER, + RELEASE_TYPES, + SEMVER_SPEC_VERSION, + FLAG_INCLUDE_PRERELEASE: 1, + FLAG_LOOSE: 2 + }; +}); + +// node_modules/semver/internal/debug.js +var require_debug = __commonJS((exports, module) => { + var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {}; + module.exports = debug; +}); + +// node_modules/semver/internal/re.js +var require_re = __commonJS((exports, module) => { + var { + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_LENGTH + } = require_constants(); + var debug = require_debug(); + exports = module.exports = {}; + var re = exports.re = []; + var safeRe = exports.safeRe = []; + var src = exports.src = []; + var safeSrc = exports.safeSrc = []; + var t = exports.t = {}; + var R = 0; + var LETTERDASHNUMBER = "[a-zA-Z0-9-]"; + var safeRegexReplacements = [ + ["\\s", 1], + ["\\d", MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH] + ]; + var makeSafeRegex = (value) => { + for (const [token, max] of safeRegexReplacements) { + value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`); + } + return value; + }; + var createToken = (name, value, isGlobal) => { + const safe = makeSafeRegex(value); + const index = R++; + debug(name, index, value); + t[name] = index; + src[index] = value; + safeSrc[index] = safe; + re[index] = new RegExp(value, isGlobal ? "g" : undefined); + safeRe[index] = new RegExp(safe, isGlobal ? "g" : undefined); + }; + createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*"); + createToken("NUMERICIDENTIFIERLOOSE", "\\d+"); + createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`); + createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`); + createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`); + createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`); + createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`); + createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`); + createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`); + createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`); + createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`); + createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`); + createToken("FULL", `^${src[t.FULLPLAIN]}$`); + createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`); + createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`); + createToken("GTLT", "((?:<|>)?=?)"); + createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`); + createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`); + createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?` + `)?)?`); + createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?` + `)?)?`); + createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`); + createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`); + createToken("COERCEPLAIN", `${"(^|[^\\d])" + "(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`); + createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`); + createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?` + `(?:${src[t.BUILD]})?` + `(?:$|[^\\d])`); + createToken("COERCERTL", src[t.COERCE], true); + createToken("COERCERTLFULL", src[t.COERCEFULL], true); + createToken("LONETILDE", "(?:~>?)"); + createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true); + exports.tildeTrimReplace = "$1~"; + createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`); + createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`); + createToken("LONECARET", "(?:\\^)"); + createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true); + exports.caretTrimReplace = "$1^"; + createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`); + createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`); + createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`); + createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`); + createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true); + exports.comparatorTrimReplace = "$1$2$3"; + createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\s*$`); + createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\s*$`); + createToken("STAR", "(<|>)?=?\\s*\\*"); + createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"); + createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$"); +}); + +// node_modules/semver/internal/parse-options.js +var require_parse_options = __commonJS((exports, module) => { + var looseOption = Object.freeze({ loose: true }); + var emptyOpts = Object.freeze({}); + var parseOptions = (options) => { + if (!options) { + return emptyOpts; + } + if (typeof options !== "object") { + return looseOption; + } + return options; + }; + module.exports = parseOptions; +}); + +// node_modules/semver/internal/identifiers.js +var require_identifiers = __commonJS((exports, module) => { + var numeric = /^[0-9]+$/; + var compareIdentifiers = (a, b) => { + if (typeof a === "number" && typeof b === "number") { + return a === b ? 0 : a < b ? -1 : 1; + } + const anum = numeric.test(a); + const bnum = numeric.test(b); + if (anum && bnum) { + a = +a; + b = +b; + } + return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1; + }; + var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a); + module.exports = { + compareIdentifiers, + rcompareIdentifiers + }; +}); + +// node_modules/semver/classes/semver.js +var require_semver = __commonJS((exports, module) => { + var debug = require_debug(); + var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants(); + var { safeRe: re, t } = require_re(); + var parseOptions = require_parse_options(); + var { compareIdentifiers } = require_identifiers(); + + class SemVer { + constructor(version, options) { + options = parseOptions(options); + if (version instanceof SemVer) { + if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) { + return version; + } else { + version = version.version; + } + } else if (typeof version !== "string") { + throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`); + } + if (version.length > MAX_LENGTH) { + throw new TypeError(`version is longer than ${MAX_LENGTH} characters`); + } + debug("SemVer", version, options); + this.options = options; + this.loose = !!options.loose; + this.includePrerelease = !!options.includePrerelease; + const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]); + if (!m) { + throw new TypeError(`Invalid Version: ${version}`); + } + this.raw = version; + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError("Invalid major version"); + } + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError("Invalid minor version"); + } + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError("Invalid patch version"); + } + if (!m[4]) { + this.prerelease = []; + } else { + this.prerelease = m[4].split(".").map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id; + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num; + } + } + return id; + }); + } + this.build = m[5] ? m[5].split(".") : []; + this.format(); + } + format() { + this.version = `${this.major}.${this.minor}.${this.patch}`; + if (this.prerelease.length) { + this.version += `-${this.prerelease.join(".")}`; + } + return this.version; + } + toString() { + return this.version; + } + compare(other) { + debug("SemVer.compare", this.version, this.options, other); + if (!(other instanceof SemVer)) { + if (typeof other === "string" && other === this.version) { + return 0; + } + other = new SemVer(other, this.options); + } + if (other.version === this.version) { + return 0; + } + return this.compareMain(other) || this.comparePre(other); + } + compareMain(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + if (this.major < other.major) { + return -1; + } + if (this.major > other.major) { + return 1; + } + if (this.minor < other.minor) { + return -1; + } + if (this.minor > other.minor) { + return 1; + } + if (this.patch < other.patch) { + return -1; + } + if (this.patch > other.patch) { + return 1; + } + return 0; + } + comparePre(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + if (this.prerelease.length && !other.prerelease.length) { + return -1; + } else if (!this.prerelease.length && other.prerelease.length) { + return 1; + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0; + } + let i = 0; + do { + const a = this.prerelease[i]; + const b = other.prerelease[i]; + debug("prerelease compare", i, a, b); + if (a === undefined && b === undefined) { + return 0; + } else if (b === undefined) { + return 1; + } else if (a === undefined) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers(a, b); + } + } while (++i); + } + compareBuild(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + let i = 0; + do { + const a = this.build[i]; + const b = other.build[i]; + debug("build compare", i, a, b); + if (a === undefined && b === undefined) { + return 0; + } else if (b === undefined) { + return 1; + } else if (a === undefined) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers(a, b); + } + } while (++i); + } + inc(release, identifier, identifierBase) { + if (release.startsWith("pre")) { + if (!identifier && identifierBase === false) { + throw new Error("invalid increment argument: identifier is empty"); + } + if (identifier) { + const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]); + if (!match || match[1] !== identifier) { + throw new Error(`invalid identifier: ${identifier}`); + } + } + } + switch (release) { + case "premajor": + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc("pre", identifier, identifierBase); + break; + case "preminor": + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc("pre", identifier, identifierBase); + break; + case "prepatch": + this.prerelease.length = 0; + this.inc("patch", identifier, identifierBase); + this.inc("pre", identifier, identifierBase); + break; + case "prerelease": + if (this.prerelease.length === 0) { + this.inc("patch", identifier, identifierBase); + } + this.inc("pre", identifier, identifierBase); + 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": + if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { + this.major++; + } + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break; + case "minor": + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++; + } + this.patch = 0; + this.prerelease = []; + break; + case "patch": + if (this.prerelease.length === 0) { + this.patch++; + } + this.prerelease = []; + break; + case "pre": { + const base = Number(identifierBase) ? 1 : 0; + if (this.prerelease.length === 0) { + this.prerelease = [base]; + } else { + let i = this.prerelease.length; + while (--i >= 0) { + if (typeof this.prerelease[i] === "number") { + this.prerelease[i]++; + i = -2; + } + } + if (i === -1) { + if (identifier === this.prerelease.join(".") && identifierBase === false) { + throw new Error("invalid increment argument: identifier already exists"); + } + this.prerelease.push(base); + } + } + if (identifier) { + let prerelease = [identifier, base]; + if (identifierBase === false) { + prerelease = [identifier]; + } + if (compareIdentifiers(this.prerelease[0], identifier) === 0) { + if (isNaN(this.prerelease[1])) { + this.prerelease = prerelease; + } + } else { + this.prerelease = prerelease; + } + } + break; + } + default: + throw new Error(`invalid increment argument: ${release}`); + } + this.raw = this.format(); + if (this.build.length) { + this.raw += `+${this.build.join(".")}`; + } + return this; + } + } + module.exports = SemVer; +}); + +// node_modules/semver/functions/parse.js +var require_parse2 = __commonJS((exports, module) => { + var SemVer = require_semver(); + var parse = (version, options, throwErrors = false) => { + if (version instanceof SemVer) { + return version; + } + try { + return new SemVer(version, options); + } catch (er) { + if (!throwErrors) { + return null; + } + throw er; + } + }; + module.exports = parse; +}); + +// node_modules/semver/functions/valid.js +var require_valid = __commonJS((exports, module) => { + var parse = require_parse2(); + var valid = (version, options) => { + const v = parse(version, options); + return v ? v.version : null; + }; + module.exports = valid; +}); + +// node_modules/semver/functions/clean.js +var require_clean = __commonJS((exports, module) => { + var parse = require_parse2(); + var clean = (version, options) => { + const s = parse(version.trim().replace(/^[=v]+/, ""), options); + return s ? s.version : null; + }; + module.exports = clean; +}); + +// node_modules/semver/functions/inc.js +var require_inc = __commonJS((exports, module) => { + var SemVer = require_semver(); + var inc = (version, release, options, identifier, identifierBase) => { + if (typeof options === "string") { + identifierBase = identifier; + identifier = options; + options = undefined; + } + try { + return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version; + } catch (er) { + return null; + } + }; + module.exports = inc; +}); + +// node_modules/semver/functions/diff.js +var require_diff = __commonJS((exports, module) => { + var parse = require_parse2(); + var diff = (version1, version2) => { + const v1 = parse(version1, null, true); + const v2 = parse(version2, null, true); + const comparison = v1.compare(v2); + if (comparison === 0) { + return null; + } + const v1Higher = comparison > 0; + const highVersion = v1Higher ? v1 : v2; + const lowVersion = v1Higher ? v2 : v1; + const highHasPre = !!highVersion.prerelease.length; + const lowHasPre = !!lowVersion.prerelease.length; + if (lowHasPre && !highHasPre) { + if (!lowVersion.patch && !lowVersion.minor) { + return "major"; + } + if (lowVersion.compareMain(highVersion) === 0) { + if (lowVersion.minor && !lowVersion.patch) { + return "minor"; + } + return "patch"; + } + } + const prefix = highHasPre ? "pre" : ""; + if (v1.major !== v2.major) { + return prefix + "major"; + } + if (v1.minor !== v2.minor) { + return prefix + "minor"; + } + if (v1.patch !== v2.patch) { + return prefix + "patch"; + } + return "prerelease"; + }; + module.exports = diff; +}); + +// node_modules/semver/functions/major.js +var require_major = __commonJS((exports, module) => { + var SemVer = require_semver(); + var major = (a, loose) => new SemVer(a, loose).major; + module.exports = major; +}); + +// node_modules/semver/functions/minor.js +var require_minor = __commonJS((exports, module) => { + var SemVer = require_semver(); + var minor = (a, loose) => new SemVer(a, loose).minor; + module.exports = minor; +}); + +// node_modules/semver/functions/patch.js +var require_patch = __commonJS((exports, module) => { + var SemVer = require_semver(); + var patch = (a, loose) => new SemVer(a, loose).patch; + module.exports = patch; +}); + +// node_modules/semver/functions/prerelease.js +var require_prerelease = __commonJS((exports, module) => { + var parse = require_parse2(); + var prerelease = (version, options) => { + const parsed = parse(version, options); + return parsed && parsed.prerelease.length ? parsed.prerelease : null; + }; + module.exports = prerelease; +}); + +// node_modules/semver/functions/compare.js +var require_compare = __commonJS((exports, module) => { + var SemVer = require_semver(); + var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose)); + module.exports = compare; +}); + +// node_modules/semver/functions/rcompare.js +var require_rcompare = __commonJS((exports, module) => { + var compare = require_compare(); + var rcompare = (a, b, loose) => compare(b, a, loose); + module.exports = rcompare; +}); + +// node_modules/semver/functions/compare-loose.js +var require_compare_loose = __commonJS((exports, module) => { + var compare = require_compare(); + var compareLoose = (a, b) => compare(a, b, true); + module.exports = compareLoose; +}); + +// node_modules/semver/functions/compare-build.js +var require_compare_build = __commonJS((exports, module) => { + var SemVer = require_semver(); + var compareBuild = (a, b, loose) => { + const versionA = new SemVer(a, loose); + const versionB = new SemVer(b, loose); + return versionA.compare(versionB) || versionA.compareBuild(versionB); + }; + module.exports = compareBuild; +}); + +// node_modules/semver/functions/sort.js +var require_sort = __commonJS((exports, module) => { + var compareBuild = require_compare_build(); + var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)); + module.exports = sort; +}); + +// node_modules/semver/functions/rsort.js +var require_rsort = __commonJS((exports, module) => { + var compareBuild = require_compare_build(); + var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)); + module.exports = rsort; +}); + +// node_modules/semver/functions/gt.js +var require_gt = __commonJS((exports, module) => { + var compare = require_compare(); + var gt = (a, b, loose) => compare(a, b, loose) > 0; + module.exports = gt; +}); + +// node_modules/semver/functions/lt.js +var require_lt = __commonJS((exports, module) => { + var compare = require_compare(); + var lt = (a, b, loose) => compare(a, b, loose) < 0; + module.exports = lt; +}); + +// node_modules/semver/functions/eq.js +var require_eq = __commonJS((exports, module) => { + var compare = require_compare(); + var eq = (a, b, loose) => compare(a, b, loose) === 0; + module.exports = eq; +}); + +// node_modules/semver/functions/neq.js +var require_neq = __commonJS((exports, module) => { + var compare = require_compare(); + var neq = (a, b, loose) => compare(a, b, loose) !== 0; + module.exports = neq; +}); + +// node_modules/semver/functions/gte.js +var require_gte = __commonJS((exports, module) => { + var compare = require_compare(); + var gte = (a, b, loose) => compare(a, b, loose) >= 0; + module.exports = gte; +}); + +// node_modules/semver/functions/lte.js +var require_lte = __commonJS((exports, module) => { + var compare = require_compare(); + var lte = (a, b, loose) => compare(a, b, loose) <= 0; + module.exports = lte; +}); + +// node_modules/semver/functions/cmp.js +var require_cmp = __commonJS((exports, module) => { + var eq = require_eq(); + var neq = require_neq(); + var gt = require_gt(); + var gte = require_gte(); + var lt = require_lt(); + var lte = require_lte(); + var cmp = (a, op, b, loose) => { + switch (op) { + case "===": + if (typeof a === "object") { + a = a.version; + } + if (typeof b === "object") { + b = b.version; + } + return a === b; + case "!==": + if (typeof a === "object") { + a = a.version; + } + if (typeof b === "object") { + b = b.version; + } + return a !== b; + case "": + case "=": + case "==": + return eq(a, b, loose); + case "!=": + return neq(a, b, loose); + case ">": + return gt(a, b, loose); + case ">=": + return gte(a, b, loose); + case "<": + return lt(a, b, loose); + case "<=": + return lte(a, b, loose); + default: + throw new TypeError(`Invalid operator: ${op}`); + } + }; + module.exports = cmp; +}); + +// node_modules/semver/functions/coerce.js +var require_coerce = __commonJS((exports, module) => { + var SemVer = require_semver(); + var parse = require_parse2(); + var { safeRe: re, t } = require_re(); + var coerce = (version, options) => { + if (version instanceof SemVer) { + return version; + } + if (typeof version === "number") { + version = String(version); + } + if (typeof version !== "string") { + return null; + } + options = options || {}; + let match = null; + if (!options.rtl) { + match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]); + } else { + const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]; + let next; + while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) { + if (!match || next.index + next[0].length !== match.index + match[0].length) { + match = next; + } + coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length; + } + coerceRtlRegex.lastIndex = -1; + } + if (match === null) { + return null; + } + const major = match[2]; + const minor = match[3] || "0"; + const patch = match[4] || "0"; + const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ""; + const build = options.includePrerelease && match[6] ? `+${match[6]}` : ""; + return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options); + }; + module.exports = coerce; +}); + +// node_modules/semver/internal/lrucache.js +var require_lrucache = __commonJS((exports, module) => { + class LRUCache { + constructor() { + this.max = 1000; + this.map = new Map; + } + get(key) { + const value = this.map.get(key); + if (value === undefined) { + return; + } else { + this.map.delete(key); + this.map.set(key, value); + return value; + } + } + delete(key) { + return this.map.delete(key); + } + set(key, value) { + const deleted = this.delete(key); + if (!deleted && value !== undefined) { + if (this.map.size >= this.max) { + const firstKey = this.map.keys().next().value; + this.delete(firstKey); + } + this.map.set(key, value); + } + return this; + } + } + module.exports = LRUCache; +}); + +// node_modules/semver/classes/range.js +var require_range = __commonJS((exports, module) => { + var SPACE_CHARACTERS = /\s+/g; + + class Range { + constructor(range, options) { + options = parseOptions(options); + if (range instanceof Range) { + if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) { + return range; + } else { + return new Range(range.raw, options); + } + } + if (range instanceof Comparator) { + this.raw = range.value; + this.set = [[range]]; + this.formatted = undefined; + return this; + } + this.options = options; + this.loose = !!options.loose; + this.includePrerelease = !!options.includePrerelease; + this.raw = range.trim().replace(SPACE_CHARACTERS, " "); + this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length); + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${this.raw}`); + } + if (this.set.length > 1) { + const first = this.set[0]; + this.set = this.set.filter((c) => !isNullSet(c[0])); + if (this.set.length === 0) { + this.set = [first]; + } else if (this.set.length > 1) { + for (const c of this.set) { + if (c.length === 1 && isAny(c[0])) { + this.set = [c]; + break; + } + } + } + } + this.formatted = undefined; + } + get range() { + if (this.formatted === undefined) { + this.formatted = ""; + for (let i = 0;i < this.set.length; i++) { + if (i > 0) { + this.formatted += "||"; + } + const comps = this.set[i]; + for (let k = 0;k < comps.length; k++) { + if (k > 0) { + this.formatted += " "; + } + this.formatted += comps[k].toString().trim(); + } + } + } + return this.formatted; + } + format() { + return this.range; + } + toString() { + return this.range; + } + parseRange(range) { + const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE); + const memoKey = memoOpts + ":" + range; + const cached = cache.get(memoKey); + if (cached) { + return cached; + } + const loose = this.options.loose; + const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]; + range = range.replace(hr, hyphenReplace(this.options.includePrerelease)); + debug("hyphen replace", range); + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace); + debug("comparator trim", range); + range = range.replace(re[t.TILDETRIM], tildeTrimReplace); + debug("tilde trim", range); + range = range.replace(re[t.CARETTRIM], caretTrimReplace); + debug("caret trim", range); + let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options)); + if (loose) { + rangeList = rangeList.filter((comp) => { + debug("loose invalid filter", comp, this.options); + return !!comp.match(re[t.COMPARATORLOOSE]); + }); + } + debug("range list", rangeList); + const rangeMap = new Map; + const comparators = rangeList.map((comp) => new Comparator(comp, this.options)); + for (const comp of comparators) { + if (isNullSet(comp)) { + return [comp]; + } + rangeMap.set(comp.value, comp); + } + if (rangeMap.size > 1 && rangeMap.has("")) { + rangeMap.delete(""); + } + const result = [...rangeMap.values()]; + cache.set(memoKey, result); + return result; + } + intersects(range, options) { + if (!(range instanceof Range)) { + throw new TypeError("a Range is required"); + } + return this.set.some((thisComparators) => { + return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => { + return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options); + }); + }); + }); + }); + } + test(version) { + if (!version) { + return false; + } + if (typeof version === "string") { + try { + version = new SemVer(version, this.options); + } catch (er) { + return false; + } + } + for (let i = 0;i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true; + } + } + return false; + } + } + module.exports = Range; + var LRU = require_lrucache(); + var cache = new LRU; + var parseOptions = require_parse_options(); + var Comparator = require_comparator(); + var debug = require_debug(); + var SemVer = require_semver(); + var { + safeRe: re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace + } = require_re(); + var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants(); + var isNullSet = (c) => c.value === "<0.0.0-0"; + var isAny = (c) => c.value === ""; + var isSatisfiable = (comparators, options) => { + let result = true; + const remainingComparators = comparators.slice(); + let testComparator = remainingComparators.pop(); + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options); + }); + testComparator = remainingComparators.pop(); + } + return result; + }; + var parseComparator = (comp, options) => { + comp = comp.replace(re[t.BUILD], ""); + debug("comp", comp, options); + comp = replaceCarets(comp, options); + debug("caret", comp); + comp = replaceTildes(comp, options); + debug("tildes", comp); + comp = replaceXRanges(comp, options); + debug("xrange", comp); + comp = replaceStars(comp, options); + debug("stars", comp); + return comp; + }; + var isX = (id) => !id || id.toLowerCase() === "x" || id === "*"; + var replaceTildes = (comp, options) => { + return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" "); + }; + var replaceTilde = (comp, options) => { + const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]; + return comp.replace(r, (_, M, m, p, pr) => { + debug("tilde", comp, _, M, m, p, pr); + let ret; + if (isX(M)) { + ret = ""; + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0-0`; + } else if (isX(p)) { + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`; + } else if (pr) { + debug("replaceTilde pr", pr); + ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`; + } else { + ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`; + } + debug("tilde return", ret); + return ret; + }); + }; + var replaceCarets = (comp, options) => { + return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" "); + }; + var replaceCaret = (comp, options) => { + debug("caret", comp, options); + const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]; + const z = options.includePrerelease ? "-0" : ""; + return comp.replace(r, (_, M, m, p, pr) => { + debug("caret", comp, _, M, m, p, pr); + let ret; + if (isX(M)) { + ret = ""; + } else if (isX(m)) { + ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`; + } else if (isX(p)) { + if (M === "0") { + ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`; + } else { + ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`; + } + } else if (pr) { + debug("replaceCaret pr", pr); + if (M === "0") { + if (m === "0") { + ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`; + } else { + ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`; + } + } else { + ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`; + } + } else { + debug("no pr"); + if (M === "0") { + if (m === "0") { + ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`; + } else { + ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`; + } + } else { + ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`; + } + } + debug("caret return", ret); + return ret; + }); + }; + var replaceXRanges = (comp, options) => { + debug("replaceXRanges", comp, options); + return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" "); + }; + var replaceXRange = (comp, options) => { + comp = comp.trim(); + const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]; + return comp.replace(r, (ret, gtlt, M, m, p, pr) => { + debug("xRange", comp, ret, gtlt, M, m, p, pr); + const xM = isX(M); + const xm = xM || isX(m); + const xp = xm || isX(p); + const anyX = xp; + if (gtlt === "=" && anyX) { + gtlt = ""; + } + pr = options.includePrerelease ? "-0" : ""; + if (xM) { + if (gtlt === ">" || gtlt === "<") { + ret = "<0.0.0-0"; + } else { + ret = "*"; + } + } else if (gtlt && anyX) { + if (xm) { + m = 0; + } + p = 0; + if (gtlt === ">") { + gtlt = ">="; + if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else { + m = +m + 1; + p = 0; + } + } else if (gtlt === "<=") { + gtlt = "<"; + if (xm) { + M = +M + 1; + } else { + m = +m + 1; + } + } + if (gtlt === "<") { + pr = "-0"; + } + ret = `${gtlt + M}.${m}.${p}${pr}`; + } else if (xm) { + ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`; + } else if (xp) { + ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`; + } + debug("xRange return", ret); + return ret; + }); + }; + var replaceStars = (comp, options) => { + debug("replaceStars", comp, options); + return comp.trim().replace(re[t.STAR], ""); + }; + var replaceGTE0 = (comp, options) => { + debug("replaceGTE0", comp, options); + return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], ""); + }; + var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => { + if (isX(fM)) { + from = ""; + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? "-0" : ""}`; + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`; + } else if (fpr) { + from = `>=${from}`; + } else { + from = `>=${from}${incPr ? "-0" : ""}`; + } + if (isX(tM)) { + to = ""; + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0`; + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0`; + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}`; + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0`; + } else { + to = `<=${to}`; + } + return `${from} ${to}`.trim(); + }; + var testSet = (set, version, options) => { + for (let i = 0;i < set.length; i++) { + if (!set[i].test(version)) { + return false; + } + } + if (version.prerelease.length && !options.includePrerelease) { + for (let i = 0;i < set.length; i++) { + debug(set[i].semver); + if (set[i].semver === Comparator.ANY) { + continue; + } + if (set[i].semver.prerelease.length > 0) { + const allowed = set[i].semver; + if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) { + return true; + } + } + } + return false; + } + return true; + }; +}); + +// node_modules/semver/classes/comparator.js +var require_comparator = __commonJS((exports, module) => { + var ANY = Symbol("SemVer ANY"); + + class Comparator { + static get ANY() { + return ANY; + } + constructor(comp, options) { + options = parseOptions(options); + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp; + } else { + comp = comp.value; + } + } + comp = comp.trim().split(/\s+/).join(" "); + debug("comparator", comp, options); + this.options = options; + this.loose = !!options.loose; + this.parse(comp); + if (this.semver === ANY) { + this.value = ""; + } else { + this.value = this.operator + this.semver.version; + } + debug("comp", this); + } + parse(comp) { + const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]; + const m = comp.match(r); + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`); + } + this.operator = m[1] !== undefined ? m[1] : ""; + if (this.operator === "=") { + this.operator = ""; + } + if (!m[2]) { + this.semver = ANY; + } else { + this.semver = new SemVer(m[2], this.options.loose); + } + } + toString() { + return this.value; + } + test(version) { + debug("Comparator.test", version, this.options.loose); + if (this.semver === ANY || version === ANY) { + return true; + } + if (typeof version === "string") { + try { + version = new SemVer(version, this.options); + } catch (er) { + return false; + } + } + return cmp(version, this.operator, this.semver, this.options); + } + intersects(comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError("a Comparator is required"); + } + if (this.operator === "") { + if (this.value === "") { + return true; + } + return new Range(comp.value, options).test(this.value); + } else if (comp.operator === "") { + if (comp.value === "") { + return true; + } + return new Range(this.value, options).test(comp.semver); + } + options = parseOptions(options); + if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) { + return false; + } + if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) { + return false; + } + if (this.operator.startsWith(">") && comp.operator.startsWith(">")) { + return true; + } + if (this.operator.startsWith("<") && comp.operator.startsWith("<")) { + return true; + } + if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) { + return true; + } + if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) { + return true; + } + if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) { + return true; + } + return false; + } + } + module.exports = Comparator; + var parseOptions = require_parse_options(); + var { safeRe: re, t } = require_re(); + var cmp = require_cmp(); + var debug = require_debug(); + var SemVer = require_semver(); + var Range = require_range(); +}); + +// node_modules/semver/functions/satisfies.js +var require_satisfies = __commonJS((exports, module) => { + var Range = require_range(); + var satisfies = (version, range, options) => { + try { + range = new Range(range, options); + } catch (er) { + return false; + } + return range.test(version); + }; + module.exports = satisfies; +}); + +// node_modules/semver/ranges/to-comparators.js +var require_to_comparators = __commonJS((exports, module) => { + var Range = require_range(); + var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" ")); + module.exports = toComparators; +}); + +// node_modules/semver/ranges/max-satisfying.js +var require_max_satisfying = __commonJS((exports, module) => { + var SemVer = require_semver(); + var Range = require_range(); + var maxSatisfying = (versions, range, options) => { + let max = null; + let maxSV = null; + let rangeObj = null; + try { + rangeObj = new Range(range, options); + } catch (er) { + return null; + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + if (!max || maxSV.compare(v) === -1) { + max = v; + maxSV = new SemVer(max, options); + } + } + }); + return max; + }; + module.exports = maxSatisfying; +}); + +// node_modules/semver/ranges/min-satisfying.js +var require_min_satisfying = __commonJS((exports, module) => { + var SemVer = require_semver(); + var Range = require_range(); + var minSatisfying = (versions, range, options) => { + let min = null; + let minSV = null; + let rangeObj = null; + try { + rangeObj = new Range(range, options); + } catch (er) { + return null; + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + if (!min || minSV.compare(v) === 1) { + min = v; + minSV = new SemVer(min, options); + } + } + }); + return min; + }; + module.exports = minSatisfying; +}); + +// node_modules/semver/ranges/min-version.js +var require_min_version = __commonJS((exports, module) => { + var SemVer = require_semver(); + var Range = require_range(); + var gt = require_gt(); + var minVersion = (range, loose) => { + range = new Range(range, loose); + let minver = new SemVer("0.0.0"); + if (range.test(minver)) { + return minver; + } + minver = new SemVer("0.0.0-0"); + if (range.test(minver)) { + return minver; + } + minver = null; + for (let i = 0;i < range.set.length; ++i) { + const comparators = range.set[i]; + let setMin = null; + comparators.forEach((comparator) => { + const compver = new SemVer(comparator.semver.version); + switch (comparator.operator) { + case ">": + if (compver.prerelease.length === 0) { + compver.patch++; + } else { + compver.prerelease.push(0); + } + compver.raw = compver.format(); + case "": + case ">=": + if (!setMin || gt(compver, setMin)) { + setMin = compver; + } + break; + case "<": + case "<=": + break; + default: + throw new Error(`Unexpected operation: ${comparator.operator}`); + } + }); + if (setMin && (!minver || gt(minver, setMin))) { + minver = setMin; + } + } + if (minver && range.test(minver)) { + return minver; + } + return null; + }; + module.exports = minVersion; +}); + +// node_modules/semver/ranges/valid.js +var require_valid2 = __commonJS((exports, module) => { + var Range = require_range(); + var validRange = (range, options) => { + try { + return new Range(range, options).range || "*"; + } catch (er) { + return null; + } + }; + module.exports = validRange; +}); + +// node_modules/semver/ranges/outside.js +var require_outside = __commonJS((exports, module) => { + var SemVer = require_semver(); + var Comparator = require_comparator(); + var { ANY } = Comparator; + var Range = require_range(); + var satisfies = require_satisfies(); + var gt = require_gt(); + var lt = require_lt(); + var lte = require_lte(); + var gte = require_gte(); + var outside = (version, range, hilo, options) => { + version = new SemVer(version, options); + range = new Range(range, options); + let gtfn, ltefn, ltfn, comp, ecomp; + switch (hilo) { + case ">": + gtfn = gt; + ltefn = lte; + ltfn = lt; + comp = ">"; + ecomp = ">="; + break; + case "<": + gtfn = lt; + ltefn = gte; + ltfn = gt; + comp = "<"; + ecomp = "<="; + break; + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); + } + if (satisfies(version, range, options)) { + return false; + } + for (let i = 0;i < range.set.length; ++i) { + const comparators = range.set[i]; + let high = null; + let low = null; + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator(">=0.0.0"); + } + high = high || comparator; + low = low || comparator; + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator; + } + }); + if (high.operator === comp || high.operator === ecomp) { + return false; + } + if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) { + return false; + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false; + } + } + return true; + }; + module.exports = outside; +}); + +// node_modules/semver/ranges/gtr.js +var require_gtr = __commonJS((exports, module) => { + var outside = require_outside(); + var gtr = (version, range, options) => outside(version, range, ">", options); + module.exports = gtr; +}); + +// node_modules/semver/ranges/ltr.js +var require_ltr = __commonJS((exports, module) => { + var outside = require_outside(); + var ltr = (version, range, options) => outside(version, range, "<", options); + module.exports = ltr; +}); + +// node_modules/semver/ranges/intersects.js +var require_intersects = __commonJS((exports, module) => { + var Range = require_range(); + var intersects = (r1, r2, options) => { + r1 = new Range(r1, options); + r2 = new Range(r2, options); + return r1.intersects(r2, options); + }; + module.exports = intersects; +}); + +// node_modules/semver/ranges/simplify.js +var require_simplify = __commonJS((exports, module) => { + var satisfies = require_satisfies(); + var compare = require_compare(); + module.exports = (versions, range, options) => { + const set = []; + let first = null; + let prev = null; + const v = versions.sort((a, b) => compare(a, b, options)); + for (const version of v) { + const included = satisfies(version, range, options); + if (included) { + prev = version; + if (!first) { + first = version; + } + } else { + if (prev) { + set.push([first, prev]); + } + prev = null; + first = null; + } + } + if (first) { + set.push([first, null]); + } + const ranges = []; + for (const [min, max] of set) { + if (min === max) { + ranges.push(min); + } else if (!max && min === v[0]) { + ranges.push("*"); + } else if (!max) { + ranges.push(`>=${min}`); + } else if (min === v[0]) { + ranges.push(`<=${max}`); + } else { + ranges.push(`${min} - ${max}`); + } + } + const simplified = ranges.join(" || "); + const original = typeof range.raw === "string" ? range.raw : String(range); + return simplified.length < original.length ? simplified : range; + }; +}); + +// node_modules/semver/ranges/subset.js +var require_subset = __commonJS((exports, module) => { + var Range = require_range(); + var Comparator = require_comparator(); + var { ANY } = Comparator; + var satisfies = require_satisfies(); + var compare = require_compare(); + var subset = (sub, dom, options = {}) => { + if (sub === dom) { + return true; + } + sub = new Range(sub, options); + dom = new Range(dom, options); + let sawNonNull = false; + OUTER: + for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options); + sawNonNull = sawNonNull || isSub !== null; + if (isSub) { + continue OUTER; + } + } + if (sawNonNull) { + return false; + } + } + return true; + }; + var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")]; + var minimumVersion = [new Comparator(">=0.0.0")]; + var simpleSubset = (sub, dom, options) => { + if (sub === dom) { + return true; + } + if (sub.length === 1 && sub[0].semver === ANY) { + if (dom.length === 1 && dom[0].semver === ANY) { + return true; + } else if (options.includePrerelease) { + sub = minimumVersionWithPreRelease; + } else { + sub = minimumVersion; + } + } + if (dom.length === 1 && dom[0].semver === ANY) { + if (options.includePrerelease) { + return true; + } else { + dom = minimumVersion; + } + } + const eqSet = new Set; + let gt, lt; + for (const c of sub) { + if (c.operator === ">" || c.operator === ">=") { + gt = higherGT(gt, c, options); + } else if (c.operator === "<" || c.operator === "<=") { + lt = lowerLT(lt, c, options); + } else { + eqSet.add(c.semver); + } + } + if (eqSet.size > 1) { + return null; + } + let gtltComp; + if (gt && lt) { + gtltComp = compare(gt.semver, lt.semver, options); + if (gtltComp > 0) { + return null; + } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) { + return null; + } + } + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options)) { + return null; + } + if (lt && !satisfies(eq, String(lt), options)) { + return null; + } + for (const c of dom) { + if (!satisfies(eq, String(c), options)) { + return false; + } + } + return true; + } + let higher, lower; + let hasDomLT, hasDomGT; + let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false; + let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false; + if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) { + needDomLTPre = false; + } + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">="; + hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<="; + if (gt) { + if (needDomGTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) { + needDomGTPre = false; + } + } + if (c.operator === ">" || c.operator === ">=") { + higher = higherGT(gt, c, options); + if (higher === c && higher !== gt) { + return false; + } + } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) { + return false; + } + } + if (lt) { + if (needDomLTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) { + needDomLTPre = false; + } + } + if (c.operator === "<" || c.operator === "<=") { + lower = lowerLT(lt, c, options); + if (lower === c && lower !== lt) { + return false; + } + } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) { + return false; + } + } + if (!c.operator && (lt || gt) && gtltComp !== 0) { + return false; + } + } + if (gt && hasDomLT && !lt && gtltComp !== 0) { + return false; + } + if (lt && hasDomGT && !gt && gtltComp !== 0) { + return false; + } + if (needDomGTPre || needDomLTPre) { + return false; + } + return true; + }; + var higherGT = (a, b, options) => { + if (!a) { + return b; + } + const comp = compare(a.semver, b.semver, options); + return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a; + }; + var lowerLT = (a, b, options) => { + if (!a) { + return b; + } + const comp = compare(a.semver, b.semver, options); + return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a; + }; + module.exports = subset; +}); + +// node_modules/semver/index.js +var require_semver2 = __commonJS((exports, module) => { + var internalRe = require_re(); + var constants = require_constants(); + var SemVer = require_semver(); + var identifiers = require_identifiers(); + var parse = require_parse2(); + var valid = require_valid(); + var clean = require_clean(); + var inc = require_inc(); + var diff = require_diff(); + var major = require_major(); + var minor = require_minor(); + var patch = require_patch(); + var prerelease = require_prerelease(); + var compare = require_compare(); + var rcompare = require_rcompare(); + var compareLoose = require_compare_loose(); + var compareBuild = require_compare_build(); + var sort = require_sort(); + var rsort = require_rsort(); + var gt = require_gt(); + var lt = require_lt(); + var eq = require_eq(); + var neq = require_neq(); + var gte = require_gte(); + var lte = require_lte(); + var cmp = require_cmp(); + var coerce = require_coerce(); + var Comparator = require_comparator(); + var Range = require_range(); + var satisfies = require_satisfies(); + var toComparators = require_to_comparators(); + var maxSatisfying = require_max_satisfying(); + var minSatisfying = require_min_satisfying(); + var minVersion = require_min_version(); + var validRange = require_valid2(); + var outside = require_outside(); + var gtr = require_gtr(); + var ltr = require_ltr(); + var intersects = require_intersects(); + var simplifyRange = require_simplify(); + var subset = require_subset(); + module.exports = { + parse, + valid, + clean, + inc, + diff, + major, + minor, + patch, + prerelease, + compare, + rcompare, + compareLoose, + compareBuild, + sort, + rsort, + gt, + lt, + eq, + neq, + gte, + lte, + cmp, + coerce, + Comparator, + Range, + satisfies, + toComparators, + maxSatisfying, + minSatisfying, + minVersion, + validRange, + outside, + gtr, + ltr, + intersects, + simplifyRange, + subset, + SemVer, + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION, + RELEASE_TYPES: constants.RELEASE_TYPES, + compareIdentifiers: identifiers.compareIdentifiers, + rcompareIdentifiers: identifiers.rcompareIdentifiers + }; +}); + +// node_modules/validate-npm-package-name/lib/builtin-modules.json +var require_builtin_modules = __commonJS((exports, module) => { + module.exports = ["_http_agent", "_http_client", "_http_common", "_http_incoming", "_http_outgoing", "_http_server", "_stream_duplex", "_stream_passthrough", "_stream_readable", "_stream_transform", "_stream_wrap", "_stream_writable", "_tls_common", "_tls_wrap", "assert", "assert/strict", "async_hooks", "buffer", "child_process", "cluster", "console", "constants", "crypto", "dgram", "diagnostics_channel", "dns", "dns/promises", "domain", "events", "fs", "fs/promises", "http", "http2", "https", "inspector", "inspector/promises", "module", "net", "os", "path", "path/posix", "path/win32", "perf_hooks", "process", "punycode", "querystring", "readline", "readline/promises", "repl", "stream", "stream/consumers", "stream/promises", "stream/web", "string_decoder", "sys", "timers", "timers/promises", "tls", "trace_events", "tty", "url", "util", "util/types", "v8", "vm", "wasi", "worker_threads", "zlib", "node:sea", "node:sqlite", "node:test", "node:test/reporters"]; +}); + +// node_modules/validate-npm-package-name/lib/index.js +var require_lib2 = __commonJS((exports, module) => { + var builtins = require_builtin_modules(); + var scopedPackagePattern = new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$"); + var exclusionList = [ + "node_modules", + "favicon.ico" + ]; + function validate(name) { + var warnings = []; + var errors = []; + if (name === null) { + errors.push("name cannot be null"); + return done(warnings, errors); + } + if (name === undefined) { + errors.push("name cannot be undefined"); + return done(warnings, errors); + } + if (typeof name !== "string") { + errors.push("name must be a string"); + return done(warnings, errors); + } + if (!name.length) { + errors.push("name length must be greater than zero"); + } + if (name.startsWith(".")) { + errors.push("name cannot start with a period"); + } + if (name.startsWith("-")) { + errors.push("name cannot start with a hyphen"); + } + if (name.match(/^_/)) { + errors.push("name cannot start with an underscore"); + } + if (name.trim() !== name) { + errors.push("name cannot contain leading or trailing spaces"); + } + exclusionList.forEach(function(excludedName) { + if (name.toLowerCase() === excludedName) { + errors.push(excludedName + " is not a valid package name"); + } + }); + if (builtins.includes(name.toLowerCase())) { + warnings.push(name + " is a core module name"); + } + if (name.length > 214) { + warnings.push("name can no longer contain more than 214 characters"); + } + if (name.toLowerCase() !== name) { + warnings.push("name can no longer contain capital letters"); + } + if (/[~'!()*]/.test(name.split("/").slice(-1)[0])) { + warnings.push(`name can no longer contain special characters ("~'!()*")`); + } + if (encodeURIComponent(name) !== name) { + var nameMatch = name.match(scopedPackagePattern); + if (nameMatch) { + var user = nameMatch[1]; + var pkg = nameMatch[2]; + if (pkg.startsWith(".")) { + errors.push("name cannot start with a period"); + } + if (encodeURIComponent(user) === user && encodeURIComponent(pkg) === pkg) { + return done(warnings, errors); + } + } + errors.push("name can only contain URL-friendly characters"); + } + return done(warnings, errors); + } + var done = function(warnings, errors) { + var result = { + validForNewPackages: errors.length === 0 && warnings.length === 0, + validForOldPackages: errors.length === 0, + warnings, + errors + }; + if (!result.warnings.length) { + delete result.warnings; + } + if (!result.errors.length) { + delete result.errors; + } + return result; + }; + module.exports = validate; +}); + +// node_modules/proc-log/lib/index.js +var require_lib3 = __commonJS((exports, module) => { + var META = Symbol("proc-log.meta"); + module.exports = { + META, + output: { + LEVELS: [ + "standard", + "error", + "buffer", + "flush" + ], + KEYS: { + standard: "standard", + error: "error", + buffer: "buffer", + flush: "flush" + }, + standard: function(...args) { + return process.emit("output", "standard", ...args); + }, + error: function(...args) { + return process.emit("output", "error", ...args); + }, + buffer: function(...args) { + return process.emit("output", "buffer", ...args); + }, + flush: function(...args) { + return process.emit("output", "flush", ...args); + } + }, + log: { + LEVELS: [ + "notice", + "error", + "warn", + "info", + "verbose", + "http", + "silly", + "timing", + "pause", + "resume" + ], + KEYS: { + notice: "notice", + error: "error", + warn: "warn", + info: "info", + verbose: "verbose", + http: "http", + silly: "silly", + timing: "timing", + pause: "pause", + resume: "resume" + }, + error: function(...args) { + return process.emit("log", "error", ...args); + }, + notice: function(...args) { + return process.emit("log", "notice", ...args); + }, + warn: function(...args) { + return process.emit("log", "warn", ...args); + }, + info: function(...args) { + return process.emit("log", "info", ...args); + }, + verbose: function(...args) { + return process.emit("log", "verbose", ...args); + }, + http: function(...args) { + return process.emit("log", "http", ...args); + }, + silly: function(...args) { + return process.emit("log", "silly", ...args); + }, + timing: function(...args) { + return process.emit("log", "timing", ...args); + }, + pause: function() { + return process.emit("log", "pause"); + }, + resume: function() { + return process.emit("log", "resume"); + } + }, + time: { + LEVELS: [ + "start", + "end" + ], + KEYS: { + start: "start", + end: "end" + }, + start: function(name, fn) { + process.emit("time", "start", name); + function end() { + return process.emit("time", "end", name); + } + if (typeof fn === "function") { + const res = fn(); + if (res && res.finally) { + return res.finally(end); + } + end(); + return res; + } + return end; + }, + end: function(name) { + return process.emit("time", "end", name); + } + }, + input: { + LEVELS: [ + "start", + "end", + "read" + ], + KEYS: { + start: "start", + end: "end", + read: "read" + }, + start: function(...args) { + let fn; + if (typeof args[0] === "function") { + fn = args.shift(); + } + process.emit("input", "start", ...args); + function end() { + return process.emit("input", "end", ...args); + } + if (typeof fn === "function") { + const res = fn(); + if (res && res.finally) { + return res.finally(end); + } + end(); + return res; + } + return end; + }, + end: function(...args) { + return process.emit("input", "end", ...args); + }, + read: function(...args) { + let resolve, reject; + const promise = new Promise((_resolve, _reject) => { + resolve = _resolve; + reject = _reject; + }); + process.emit("input", "read", resolve, reject, ...args); + return promise; + } + } + }; +}); + +// node_modules/npm-package-arg/lib/npa.js +var require_npa = __commonJS((exports, module) => { + var isWindows = process.platform === "win32"; + var { URL: URL2 } = __require("url"); + var path = isWindows ? __require("path/win32") : __require("path"); + var { homedir } = __require("os"); + var HostedGit = require_lib(); + var semver = require_semver2(); + var validatePackageName = require_lib2(); + var { log } = require_lib3(); + var hasSlashes = isWindows ? /\\|[/]/ : /[/]/; + var isURL = /^(?:git[+])?[a-z]+:/i; + var isGit = /^[^@]+@[^:.]+\.[^:]+:.+$/i; + var isFileType = /[.](?:tgz|tar\.gz|tar)$/i; + var isPortNumber = /:[0-9]+(\/|$)/i; + var isWindowsFile = /^(?:[.]|~[/]|[/\\]|[a-zA-Z]:)/; + var isPosixFile = /^(?:[.]|~[/]|[/]|[a-zA-Z]:)/; + var defaultRegistry = "https://registry.npmjs.org"; + function npa(arg, where) { + let name; + let spec; + if (typeof arg === "object") { + if (arg instanceof Result && (!where || where === arg.where)) { + return arg; + } else if (arg.name && arg.rawSpec) { + return npa.resolve(arg.name, arg.rawSpec, where || arg.where); + } else { + return npa(arg.raw, where || arg.where); + } + } + const nameEndsAt = arg.indexOf("@", 1); + const namePart = nameEndsAt > 0 ? arg.slice(0, nameEndsAt) : arg; + if (isURL.test(arg)) { + spec = arg; + } else if (isGit.test(arg)) { + spec = `git+ssh://${arg}`; + } else if (!namePart.startsWith("@") && (hasSlashes.test(namePart) || isFileType.test(namePart))) { + spec = arg; + } else if (nameEndsAt > 0) { + name = namePart; + spec = arg.slice(nameEndsAt + 1) || "*"; + } else { + const valid = validatePackageName(arg); + if (valid.validForOldPackages) { + name = arg; + spec = "*"; + } else { + spec = arg; + } + } + return resolve(name, spec, where, arg); + } + function isFileSpec(spec) { + if (!spec) { + return false; + } + if (spec.toLowerCase().startsWith("file:")) { + return true; + } + if (isWindows) { + return isWindowsFile.test(spec); + } + return isPosixFile.test(spec); + } + function isAliasSpec(spec) { + if (!spec) { + return false; + } + return spec.toLowerCase().startsWith("npm:"); + } + function resolve(name, spec, where, arg) { + const res = new Result({ + raw: arg, + name, + rawSpec: spec, + fromArgument: arg != null + }); + if (name) { + res.name = name; + } + if (!where) { + where = process.cwd(); + } + if (isFileSpec(spec)) { + return fromFile(res, where); + } else if (isAliasSpec(spec)) { + return fromAlias(res, where); + } + const hosted = HostedGit.fromUrl(spec, { + noGitPlus: true, + noCommittish: true + }); + if (hosted) { + return fromHostedGit(res, hosted); + } else if (spec && isURL.test(spec)) { + return fromURL(res); + } else if (spec && (hasSlashes.test(spec) || isFileType.test(spec))) { + return fromFile(res, where); + } else { + return fromRegistry(res); + } + } + function toPurl(arg, reg = defaultRegistry) { + const res = npa(arg); + if (res.type !== "version") { + throw invalidPurlType(res.type, res.raw); + } + let purl = "pkg:npm/" + res.name.replace(/^@/, "%40") + "@" + res.rawSpec; + if (reg !== defaultRegistry) { + purl += "?repository_url=" + reg; + } + return purl; + } + function invalidPackageName(name, valid, raw) { + const err = new Error(`Invalid package name "${name}" of package "${raw}": ${valid.errors.join("; ")}.`); + err.code = "EINVALIDPACKAGENAME"; + return err; + } + function invalidTagName(name, raw) { + const err = new Error(`Invalid tag name "${name}" of package "${raw}": Tags may not have any characters that encodeURIComponent encodes.`); + err.code = "EINVALIDTAGNAME"; + return err; + } + function invalidPurlType(type, raw) { + const err = new Error(`Invalid type "${type}" of package "${raw}": Purl can only be generated for "version" types.`); + err.code = "EINVALIDPURLTYPE"; + return err; + } + + class Result { + constructor(opts) { + this.type = opts.type; + this.registry = opts.registry; + this.where = opts.where; + if (opts.raw == null) { + this.raw = opts.name ? `${opts.name}@${opts.rawSpec}` : opts.rawSpec; + } else { + this.raw = opts.raw; + } + this.name = undefined; + this.escapedName = undefined; + this.scope = undefined; + this.rawSpec = opts.rawSpec || ""; + this.saveSpec = opts.saveSpec; + this.fetchSpec = opts.fetchSpec; + if (opts.name) { + this.setName(opts.name); + } + this.gitRange = opts.gitRange; + this.gitCommittish = opts.gitCommittish; + this.gitSubdir = opts.gitSubdir; + this.hosted = opts.hosted; + } + setName(name) { + const valid = validatePackageName(name); + if (!valid.validForOldPackages) { + throw invalidPackageName(name, valid, this.raw); + } + this.name = name; + this.scope = name[0] === "@" ? name.slice(0, name.indexOf("/")) : undefined; + this.escapedName = name.replace("/", "%2f"); + return this; + } + toString() { + const full = []; + if (this.name != null && this.name !== "") { + full.push(this.name); + } + const spec = this.saveSpec || this.fetchSpec || this.rawSpec; + if (spec != null && spec !== "") { + full.push(spec); + } + return full.length ? full.join("@") : this.raw; + } + toJSON() { + const result = Object.assign({}, this); + delete result.hosted; + return result; + } + } + function setGitAttrs(res, committish) { + if (!committish) { + res.gitCommittish = null; + return; + } + for (const part of committish.split("::")) { + if (!part.includes(":")) { + if (res.gitRange) { + throw new Error("cannot override existing semver range with a committish"); + } + if (res.gitCommittish) { + throw new Error("cannot override existing committish with a second committish"); + } + res.gitCommittish = part; + continue; + } + const [name, value] = part.split(":"); + if (name === "semver") { + if (res.gitCommittish) { + throw new Error("cannot override existing committish with a semver range"); + } + if (res.gitRange) { + throw new Error("cannot override existing semver range with a second semver range"); + } + res.gitRange = decodeURIComponent(value); + continue; + } + if (name === "path") { + if (res.gitSubdir) { + throw new Error("cannot override existing path with a second path"); + } + res.gitSubdir = `/${value}`; + continue; + } + log.warn("npm-package-arg", `ignoring unknown key "${name}"`); + } + } + var encodedPathChars = new Map([ + ["\x00", "%00"], + ["\t", "%09"], + [` +`, "%0A"], + ["\r", "%0D"], + [" ", "%20"], + ['"', "%22"], + ["#", "%23"], + ["%", "%25"], + ["?", "%3F"], + ["[", "%5B"], + ["\\", isWindows ? "/" : "%5C"], + ["]", "%5D"], + ["^", "%5E"], + ["|", "%7C"], + ["~", "%7E"] + ]); + function pathToFileURL(str) { + let result = ""; + for (let i = 0;i < str.length; i++) { + result = `${result}${encodedPathChars.get(str[i]) ?? str[i]}`; + } + if (result.startsWith("file:")) { + return result; + } + return `file:${result}`; + } + function fromFile(res, where) { + res.type = isFileType.test(res.rawSpec) ? "file" : "directory"; + res.where = where; + let rawSpec = pathToFileURL(res.rawSpec); + if (rawSpec.startsWith("file:/")) { + if (/^file:\/\/[^/]/.test(rawSpec)) { + rawSpec = `file:/${rawSpec.slice(5)}`; + } + if (/^\/{1,3}\.\.?(\/|$)/.test(rawSpec.slice(5))) { + rawSpec = rawSpec.replace(/^file:\/{1,3}/, "file:"); + } + } + let resolvedUrl; + let specUrl; + try { + resolvedUrl = new URL2(rawSpec, `${pathToFileURL(path.resolve(where))}/`); + specUrl = new URL2(rawSpec); + } catch (originalError) { + const er = new Error("Invalid file: URL, must comply with RFC 8089"); + throw Object.assign(er, { + raw: res.rawSpec, + spec: res, + where, + originalError + }); + } + let specPath = decodeURIComponent(specUrl.pathname); + let resolvedPath = decodeURIComponent(resolvedUrl.pathname); + if (isWindows) { + specPath = specPath.replace(/^\/+([a-z]:\/)/i, "$1"); + resolvedPath = resolvedPath.replace(/^\/+([a-z]:\/)/i, "$1"); + } + if (/^\/~(\/|$)/.test(specPath)) { + res.saveSpec = `file:${specPath.substr(1)}`; + resolvedPath = path.resolve(homedir(), specPath.substr(3)); + } else if (!path.isAbsolute(rawSpec.slice(5))) { + res.saveSpec = `file:${path.relative(where, resolvedPath)}`; + } else { + res.saveSpec = `file:${path.resolve(resolvedPath)}`; + } + res.fetchSpec = path.resolve(where, resolvedPath); + res.saveSpec = res.saveSpec.split("\\").join("/"); + if (res.saveSpec.startsWith("file://")) { + res.saveSpec = `file:/${res.saveSpec.slice(7)}`; + } + return res; + } + function fromHostedGit(res, hosted) { + res.type = "git"; + res.hosted = hosted; + res.saveSpec = hosted.toString({ noGitPlus: false, noCommittish: false }); + res.fetchSpec = hosted.getDefaultRepresentation() === "shortcut" ? null : hosted.toString(); + setGitAttrs(res, hosted.committish); + return res; + } + function unsupportedURLType(protocol, spec) { + const err = new Error(`Unsupported URL Type "${protocol}": ${spec}`); + err.code = "EUNSUPPORTEDPROTOCOL"; + return err; + } + function fromURL(res) { + let rawSpec = res.rawSpec; + res.saveSpec = rawSpec; + if (rawSpec.startsWith("git+ssh:")) { + const matched = rawSpec.match(/^git\+ssh:\/\/([^:#]+:[^#]+(?:\.git)?)(?:#(.*))?$/i); + if (matched && !matched[1].match(isPortNumber)) { + res.type = "git"; + setGitAttrs(res, matched[2]); + res.fetchSpec = matched[1]; + return res; + } + } else if (rawSpec.startsWith("git+file://")) { + rawSpec = rawSpec.replace(/\\/g, "/"); + } + const parsedUrl = new URL2(rawSpec); + switch (parsedUrl.protocol) { + case "git:": + case "git+http:": + case "git+https:": + case "git+rsync:": + case "git+ftp:": + case "git+file:": + case "git+ssh:": + res.type = "git"; + setGitAttrs(res, parsedUrl.hash.slice(1)); + if (parsedUrl.protocol === "git+file:" && /^git\+file:\/\/[a-z]:/i.test(rawSpec)) { + res.fetchSpec = `git+file://${parsedUrl.host.toLowerCase()}:${parsedUrl.pathname}`; + } else { + parsedUrl.hash = ""; + res.fetchSpec = parsedUrl.toString(); + } + if (res.fetchSpec.startsWith("git+")) { + res.fetchSpec = res.fetchSpec.slice(4); + } + break; + case "http:": + case "https:": + res.type = "remote"; + res.fetchSpec = res.saveSpec; + break; + default: + throw unsupportedURLType(parsedUrl.protocol, rawSpec); + } + return res; + } + function fromAlias(res, where) { + const subSpec = npa(res.rawSpec.substr(4), where); + if (subSpec.type === "alias") { + throw new Error("nested aliases not supported"); + } + if (!subSpec.registry) { + throw new Error("aliases only work for registry deps"); + } + if (!subSpec.name) { + throw new Error("aliases must have a name"); + } + res.subSpec = subSpec; + res.registry = true; + res.type = "alias"; + res.saveSpec = null; + res.fetchSpec = null; + return res; + } + function fromRegistry(res) { + res.registry = true; + const spec = res.rawSpec.trim(); + res.saveSpec = null; + res.fetchSpec = spec; + const version = semver.valid(spec, true); + const range = semver.validRange(spec, true); + if (version) { + res.type = "version"; + } else if (range) { + res.type = "range"; + } else { + if (encodeURIComponent(spec) !== spec) { + throw invalidTagName(spec, res.raw); + } + res.type = "tag"; + } + return res; + } + module.exports = npa; + module.exports.resolve = resolve; + module.exports.toPurl = toPurl; + module.exports.Result = Result; +}); + +// src/main.ts +import path4 from "path"; + +// src/errors.ts +class ExtensionHostError extends Error { + code; + data; + constructor(code, message, data) { + super(message); + this.name = "ExtensionHostError"; + this.code = code; + this.data = data; + } +} +function errorData(error) { + if (!(error instanceof Error)) + return { message: String(error) }; + return { + name: error.name, + message: error.message, + stack: error.stack, + ...error.cause === undefined ? {} : { cause: error.cause instanceof Error ? errorData(error.cause) : String(error.cause) } + }; +} + +// src/host.ts +import path2 from "path"; +import { realpath as realpath2 } from "fs/promises"; +import { createHash as createHash2 } from "crypto"; +// node_modules/@opencode-ai/sdk/dist/gen/core/serverSentEvents.gen.js +var createSseClient = ({ onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) => { + let lastEventId; + const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))); + const createStream = async function* () { + let retryDelay = sseDefaultRetryDelay ?? 3000; + let attempt = 0; + const signal = options.signal ?? new AbortController().signal; + while (true) { + if (signal.aborted) + break; + attempt++; + const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers); + if (lastEventId !== undefined) { + headers.set("Last-Event-ID", lastEventId); + } + try { + const response = await fetch(url, { ...options, headers, signal }); + if (!response.ok) + throw new Error(`SSE failed: ${response.status} ${response.statusText}`); + if (!response.body) + throw new Error("No body in SSE response"); + const reader = response.body.pipeThrough(new TextDecoderStream).getReader(); + let buffer = ""; + const abortHandler = () => { + try { + reader.cancel(); + } catch {} + }; + signal.addEventListener("abort", abortHandler); + try { + while (true) { + const { done, value } = await reader.read(); + if (done) + break; + buffer += value; + const chunks = buffer.split(` + +`); + buffer = chunks.pop() ?? ""; + for (const chunk of chunks) { + const lines = chunk.split(` +`); + const dataLines = []; + let eventName; + for (const line of lines) { + if (line.startsWith("data:")) { + dataLines.push(line.replace(/^data:\s*/, "")); + } else if (line.startsWith("event:")) { + eventName = line.replace(/^event:\s*/, ""); + } else if (line.startsWith("id:")) { + lastEventId = line.replace(/^id:\s*/, ""); + } else if (line.startsWith("retry:")) { + const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10); + if (!Number.isNaN(parsed)) { + retryDelay = parsed; + } + } + } + let data; + let parsedJson = false; + if (dataLines.length) { + const rawData = dataLines.join(` +`); + try { + data = JSON.parse(rawData); + parsedJson = true; + } catch { + data = rawData; + } + } + if (parsedJson) { + if (responseValidator) { + await responseValidator(data); + } + if (responseTransformer) { + data = await responseTransformer(data); + } + } + onSseEvent?.({ + data, + event: eventName, + id: lastEventId, + retry: retryDelay + }); + if (dataLines.length) { + yield data; + } + } + } + } finally { + signal.removeEventListener("abort", abortHandler); + reader.releaseLock(); + } + break; + } catch (error) { + onSseError?.(error); + if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) { + break; + } + const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000); + await sleep(backoff); + } + } + }; + const stream = createStream(); + return { stream }; +}; + +// node_modules/@opencode-ai/sdk/dist/gen/core/auth.gen.js +var getAuthToken = async (auth, callback) => { + const token = typeof callback === "function" ? await callback(auth) : callback; + if (!token) { + return; + } + if (auth.scheme === "bearer") { + return `Bearer ${token}`; + } + if (auth.scheme === "basic") { + return `Basic ${btoa(token)}`; + } + return token; +}; + +// node_modules/@opencode-ai/sdk/dist/gen/core/bodySerializer.gen.js +var jsonBodySerializer = { + bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) +}; + +// node_modules/@opencode-ai/sdk/dist/gen/core/pathSerializer.gen.js +var separatorArrayExplode = (style) => { + switch (style) { + case "label": + return "."; + case "matrix": + return ";"; + case "simple": + return ","; + default: + return "&"; + } +}; +var separatorArrayNoExplode = (style) => { + switch (style) { + case "form": + return ","; + case "pipeDelimited": + return "|"; + case "spaceDelimited": + return "%20"; + default: + return ","; + } +}; +var separatorObjectExplode = (style) => { + switch (style) { + case "label": + return "."; + case "matrix": + return ";"; + case "simple": + return ","; + default: + return "&"; + } +}; +var serializeArrayParam = ({ allowReserved, explode, name, style, value }) => { + if (!explode) { + const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style)); + switch (style) { + case "label": + return `.${joinedValues2}`; + case "matrix": + return `;${name}=${joinedValues2}`; + case "simple": + return joinedValues2; + default: + return `${name}=${joinedValues2}`; + } + } + const separator = separatorArrayExplode(style); + const joinedValues = value.map((v) => { + if (style === "label" || style === "simple") { + return allowReserved ? v : encodeURIComponent(v); + } + return serializePrimitiveParam({ + allowReserved, + name, + value: v + }); + }).join(separator); + return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues; +}; +var serializePrimitiveParam = ({ allowReserved, name, value }) => { + if (value === undefined || value === null) { + return ""; + } + if (typeof value === "object") { + throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."); + } + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; +}; +var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly }) => { + if (value instanceof Date) { + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; + } + if (style !== "deepObject" && !explode) { + let values = []; + Object.entries(value).forEach(([key, v]) => { + values = [...values, key, allowReserved ? v : encodeURIComponent(v)]; + }); + const joinedValues2 = values.join(","); + switch (style) { + case "form": + return `${name}=${joinedValues2}`; + case "label": + return `.${joinedValues2}`; + case "matrix": + return `;${name}=${joinedValues2}`; + default: + return joinedValues2; + } + } + const separator = separatorObjectExplode(style); + const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({ + allowReserved, + name: style === "deepObject" ? `${name}[${key}]` : key, + value: v + })).join(separator); + return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues; +}; + +// node_modules/@opencode-ai/sdk/dist/gen/core/utils.gen.js +var PATH_PARAM_RE = /\{[^{}]+\}/g; +var defaultPathSerializer = ({ path, url: _url }) => { + let url = _url; + const matches = _url.match(PATH_PARAM_RE); + if (matches) { + for (const match of matches) { + let explode = false; + let name = match.substring(1, match.length - 1); + let style = "simple"; + if (name.endsWith("*")) { + explode = true; + name = name.substring(0, name.length - 1); + } + if (name.startsWith(".")) { + name = name.substring(1); + style = "label"; + } else if (name.startsWith(";")) { + name = name.substring(1); + style = "matrix"; + } + const value = path[name]; + if (value === undefined || value === null) { + continue; + } + if (Array.isArray(value)) { + url = url.replace(match, serializeArrayParam({ explode, name, style, value })); + continue; + } + if (typeof value === "object") { + url = url.replace(match, serializeObjectParam({ + explode, + name, + style, + value, + valueOnly: true + })); + continue; + } + if (style === "matrix") { + url = url.replace(match, `;${serializePrimitiveParam({ + name, + value + })}`); + continue; + } + const replaceValue = encodeURIComponent(style === "label" ? `.${value}` : value); + url = url.replace(match, replaceValue); + } + } + return url; +}; +var getUrl = ({ baseUrl, path, query, querySerializer, url: _url }) => { + const pathUrl = _url.startsWith("/") ? _url : `/${_url}`; + let url = (baseUrl ?? "") + pathUrl; + if (path) { + url = defaultPathSerializer({ path, url }); + } + let search = query ? querySerializer(query) : ""; + if (search.startsWith("?")) { + search = search.substring(1); + } + if (search) { + url += `?${search}`; + } + return url; +}; + +// node_modules/@opencode-ai/sdk/dist/gen/client/utils.gen.js +var createQuerySerializer = ({ allowReserved, array, object } = {}) => { + const querySerializer = (queryParams) => { + const search = []; + if (queryParams && typeof queryParams === "object") { + for (const name in queryParams) { + const value = queryParams[name]; + if (value === undefined || value === null) { + continue; + } + if (Array.isArray(value)) { + const serializedArray = serializeArrayParam({ + allowReserved, + explode: true, + name, + style: "form", + value, + ...array + }); + if (serializedArray) + search.push(serializedArray); + } else if (typeof value === "object") { + const serializedObject = serializeObjectParam({ + allowReserved, + explode: true, + name, + style: "deepObject", + value, + ...object + }); + if (serializedObject) + search.push(serializedObject); + } else { + const serializedPrimitive = serializePrimitiveParam({ + allowReserved, + name, + value + }); + if (serializedPrimitive) + search.push(serializedPrimitive); + } + } + } + return search.join("&"); + }; + return querySerializer; +}; +var getParseAs = (contentType) => { + if (!contentType) { + return "stream"; + } + const cleanContent = contentType.split(";")[0]?.trim(); + if (!cleanContent) { + return; + } + if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) { + return "json"; + } + if (cleanContent === "multipart/form-data") { + return "formData"; + } + if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) { + return "blob"; + } + if (cleanContent.startsWith("text/")) { + return "text"; + } + return; +}; +var checkForExistence = (options, name) => { + if (!name) { + return false; + } + if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) { + return true; + } + return false; +}; +var setAuthParams = async ({ security, ...options }) => { + for (const auth of security) { + if (checkForExistence(options, auth.name)) { + continue; + } + const token = await getAuthToken(auth, options.auth); + if (!token) { + continue; + } + const name = auth.name ?? "Authorization"; + switch (auth.in) { + case "query": + if (!options.query) { + options.query = {}; + } + options.query[name] = token; + break; + case "cookie": + options.headers.append("Cookie", `${name}=${token}`); + break; + case "header": + default: + options.headers.set(name, token); + break; + } + } +}; +var buildUrl = (options) => getUrl({ + baseUrl: options.baseUrl, + path: options.path, + query: options.query, + querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer), + url: options.url +}); +var mergeConfigs = (a, b) => { + const config = { ...a, ...b }; + if (config.baseUrl?.endsWith("/")) { + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); + } + config.headers = mergeHeaders(a.headers, b.headers); + return config; +}; +var mergeHeaders = (...headers) => { + const mergedHeaders = new Headers; + for (const header of headers) { + if (!header || typeof header !== "object") { + continue; + } + const iterator = header instanceof Headers ? header.entries() : Object.entries(header); + for (const [key, value] of iterator) { + if (value === null) { + mergedHeaders.delete(key); + } else if (Array.isArray(value)) { + for (const v of value) { + mergedHeaders.append(key, v); + } + } else if (value !== undefined) { + mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value); + } + } + } + return mergedHeaders; +}; + +class Interceptors { + _fns; + constructor() { + this._fns = []; + } + clear() { + this._fns = []; + } + getInterceptorIndex(id) { + if (typeof id === "number") { + return this._fns[id] ? id : -1; + } else { + return this._fns.indexOf(id); + } + } + exists(id) { + const index = this.getInterceptorIndex(id); + return !!this._fns[index]; + } + eject(id) { + const index = this.getInterceptorIndex(id); + if (this._fns[index]) { + this._fns[index] = null; + } + } + update(id, fn) { + const index = this.getInterceptorIndex(id); + if (this._fns[index]) { + this._fns[index] = fn; + return id; + } else { + return false; + } + } + use(fn) { + this._fns = [...this._fns, fn]; + return this._fns.length - 1; + } +} +var createInterceptors = () => ({ + error: new Interceptors, + request: new Interceptors, + response: new Interceptors +}); +var defaultQuerySerializer = createQuerySerializer({ + allowReserved: false, + array: { + explode: true, + style: "form" + }, + object: { + explode: true, + style: "deepObject" + } +}); +var defaultHeaders = { + "Content-Type": "application/json" +}; +var createConfig = (override = {}) => ({ + ...jsonBodySerializer, + headers: defaultHeaders, + parseAs: "auto", + querySerializer: defaultQuerySerializer, + ...override +}); + +// node_modules/@opencode-ai/sdk/dist/gen/client/client.gen.js +var createClient = (config = {}) => { + let _config = mergeConfigs(createConfig(), config); + const getConfig = () => ({ ..._config }); + const setConfig = (config2) => { + _config = mergeConfigs(_config, config2); + return getConfig(); + }; + const interceptors = createInterceptors(); + const beforeRequest = async (options) => { + const opts = { + ..._config, + ...options, + fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, + headers: mergeHeaders(_config.headers, options.headers), + serializedBody: undefined + }; + if (opts.security) { + await setAuthParams({ + ...opts, + security: opts.security + }); + } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + if (opts.body && opts.bodySerializer) { + opts.serializedBody = opts.bodySerializer(opts.body); + } + if (opts.serializedBody === undefined || opts.serializedBody === "") { + opts.headers.delete("Content-Type"); + } + const url = buildUrl(opts); + return { opts, url }; + }; + const request = async (options) => { + const { opts, url } = await beforeRequest(options); + const requestInit = { + redirect: "follow", + ...opts, + body: opts.serializedBody + }; + let request2 = new Request(url, requestInit); + for (const fn of interceptors.request._fns) { + if (fn) { + request2 = await fn(request2, opts); + } + } + const _fetch = opts.fetch; + let response = await _fetch(request2); + for (const fn of interceptors.response._fns) { + if (fn) { + response = await fn(response, request2, opts); + } + } + const result = { + request: request2, + response + }; + if (response.ok) { + if (response.status === 204 || response.headers.get("Content-Length") === "0") { + return opts.responseStyle === "data" ? {} : { + data: {}, + ...result + }; + } + const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json"; + let data; + switch (parseAs) { + case "arrayBuffer": + case "blob": + case "formData": + case "json": + case "text": + data = await response[parseAs](); + break; + case "stream": + return opts.responseStyle === "data" ? response.body : { + data: response.body, + ...result + }; + } + if (parseAs === "json") { + if (opts.responseValidator) { + await opts.responseValidator(data); + } + if (opts.responseTransformer) { + data = await opts.responseTransformer(data); + } + } + return opts.responseStyle === "data" ? data : { + data, + ...result + }; + } + const textError = await response.text(); + let jsonError; + try { + jsonError = JSON.parse(textError); + } catch {} + const error = jsonError ?? textError; + let finalError = error; + for (const fn of interceptors.error._fns) { + if (fn) { + finalError = await fn(error, response, request2, opts); + } + } + finalError = finalError || {}; + if (opts.throwOnError) { + throw finalError; + } + return opts.responseStyle === "data" ? undefined : { + error: finalError, + ...result + }; + }; + const makeMethod = (method) => { + const fn = (options) => request({ ...options, method }); + fn.sse = async (options) => { + const { opts, url } = await beforeRequest(options); + return createSseClient({ + ...opts, + body: opts.body, + headers: opts.headers, + method, + url + }); + }; + return fn; + }; + return { + buildUrl, + connect: makeMethod("CONNECT"), + delete: makeMethod("DELETE"), + get: makeMethod("GET"), + getConfig, + head: makeMethod("HEAD"), + interceptors, + options: makeMethod("OPTIONS"), + patch: makeMethod("PATCH"), + post: makeMethod("POST"), + put: makeMethod("PUT"), + request, + setConfig, + trace: makeMethod("TRACE") + }; +}; +// node_modules/@opencode-ai/sdk/dist/gen/core/params.gen.js +var extraPrefixesMap = { + $body_: "body", + $headers_: "headers", + $path_: "path", + $query_: "query" +}; +var extraPrefixes = Object.entries(extraPrefixesMap); +// node_modules/@opencode-ai/sdk/dist/gen/client.gen.js +var client = createClient(createConfig({ + baseUrl: "http://localhost:4096" +})); + +// node_modules/@opencode-ai/sdk/dist/gen/sdk.gen.js +class _HeyApiClient { + _client = client; + constructor(args) { + if (args?.client) { + this._client = args.client; + } + } +} + +class Global extends _HeyApiClient { + event(options) { + return (options?.client ?? this._client).get.sse({ + url: "/global/event", + ...options + }); + } +} + +class Project extends _HeyApiClient { + list(options) { + return (options?.client ?? this._client).get({ + url: "/project", + ...options + }); + } + current(options) { + return (options?.client ?? this._client).get({ + url: "/project/current", + ...options + }); + } +} + +class Pty extends _HeyApiClient { + list(options) { + return (options?.client ?? this._client).get({ + url: "/pty", + ...options + }); + } + create(options) { + return (options?.client ?? this._client).post({ + url: "/pty", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers + } + }); + } + remove(options) { + return (options.client ?? this._client).delete({ + url: "/pty/{id}", + ...options + }); + } + get(options) { + return (options.client ?? this._client).get({ + url: "/pty/{id}", + ...options + }); + } + update(options) { + return (options.client ?? this._client).put({ + url: "/pty/{id}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers + } + }); + } + connect(options) { + return (options.client ?? this._client).get({ + url: "/pty/{id}/connect", + ...options + }); + } +} + +class Config extends _HeyApiClient { + get(options) { + return (options?.client ?? this._client).get({ + url: "/config", + ...options + }); + } + update(options) { + return (options?.client ?? this._client).patch({ + url: "/config", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers + } + }); + } + providers(options) { + return (options?.client ?? this._client).get({ + url: "/config/providers", + ...options + }); + } +} + +class Tool extends _HeyApiClient { + ids(options) { + return (options?.client ?? this._client).get({ + url: "/experimental/tool/ids", + ...options + }); + } + list(options) { + return (options.client ?? this._client).get({ + url: "/experimental/tool", + ...options + }); + } +} + +class Instance extends _HeyApiClient { + dispose(options) { + return (options?.client ?? this._client).post({ + url: "/instance/dispose", + ...options + }); + } +} + +class Path extends _HeyApiClient { + get(options) { + return (options?.client ?? this._client).get({ + url: "/path", + ...options + }); + } +} + +class Vcs extends _HeyApiClient { + get(options) { + return (options?.client ?? this._client).get({ + url: "/vcs", + ...options + }); + } +} + +class Session extends _HeyApiClient { + list(options) { + return (options?.client ?? this._client).get({ + url: "/session", + ...options + }); + } + create(options) { + return (options?.client ?? this._client).post({ + url: "/session", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers + } + }); + } + status(options) { + return (options?.client ?? this._client).get({ + url: "/session/status", + ...options + }); + } + delete(options) { + return (options.client ?? this._client).delete({ + url: "/session/{id}", + ...options + }); + } + get(options) { + return (options.client ?? this._client).get({ + url: "/session/{id}", + ...options + }); + } + update(options) { + return (options.client ?? this._client).patch({ + url: "/session/{id}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers + } + }); + } + children(options) { + return (options.client ?? this._client).get({ + url: "/session/{id}/children", + ...options + }); + } + todo(options) { + return (options.client ?? this._client).get({ + url: "/session/{id}/todo", + ...options + }); + } + init(options) { + return (options.client ?? this._client).post({ + url: "/session/{id}/init", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers + } + }); + } + fork(options) { + return (options.client ?? this._client).post({ + url: "/session/{id}/fork", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers + } + }); + } + abort(options) { + return (options.client ?? this._client).post({ + url: "/session/{id}/abort", + ...options + }); + } + unshare(options) { + return (options.client ?? this._client).delete({ + url: "/session/{id}/share", + ...options + }); + } + share(options) { + return (options.client ?? this._client).post({ + url: "/session/{id}/share", + ...options + }); + } + diff(options) { + return (options.client ?? this._client).get({ + url: "/session/{id}/diff", + ...options + }); + } + summarize(options) { + return (options.client ?? this._client).post({ + url: "/session/{id}/summarize", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers + } + }); + } + messages(options) { + return (options.client ?? this._client).get({ + url: "/session/{id}/message", + ...options + }); + } + prompt(options) { + return (options.client ?? this._client).post({ + url: "/session/{id}/message", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers + } + }); + } + message(options) { + return (options.client ?? this._client).get({ + url: "/session/{id}/message/{messageID}", + ...options + }); + } + promptAsync(options) { + return (options.client ?? this._client).post({ + url: "/session/{id}/prompt_async", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers + } + }); + } + command(options) { + return (options.client ?? this._client).post({ + url: "/session/{id}/command", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers + } + }); + } + shell(options) { + return (options.client ?? this._client).post({ + url: "/session/{id}/shell", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers + } + }); + } + revert(options) { + return (options.client ?? this._client).post({ + url: "/session/{id}/revert", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers + } + }); + } + unrevert(options) { + return (options.client ?? this._client).post({ + url: "/session/{id}/unrevert", + ...options + }); + } +} + +class Command extends _HeyApiClient { + list(options) { + return (options?.client ?? this._client).get({ + url: "/command", + ...options + }); + } +} + +class Oauth extends _HeyApiClient { + authorize(options) { + return (options.client ?? this._client).post({ + url: "/provider/{id}/oauth/authorize", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers + } + }); + } + callback(options) { + return (options.client ?? this._client).post({ + url: "/provider/{id}/oauth/callback", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers + } + }); + } +} + +class Provider extends _HeyApiClient { + list(options) { + return (options?.client ?? this._client).get({ + url: "/provider", + ...options + }); + } + auth(options) { + return (options?.client ?? this._client).get({ + url: "/provider/auth", + ...options + }); + } + oauth = new Oauth({ client: this._client }); +} + +class Find extends _HeyApiClient { + text(options) { + return (options.client ?? this._client).get({ + url: "/find", + ...options + }); + } + files(options) { + return (options.client ?? this._client).get({ + url: "/find/file", + ...options + }); + } + symbols(options) { + return (options.client ?? this._client).get({ + url: "/find/symbol", + ...options + }); + } +} + +class File2 extends _HeyApiClient { + list(options) { + return (options.client ?? this._client).get({ + url: "/file", + ...options + }); + } + read(options) { + return (options.client ?? this._client).get({ + url: "/file/content", + ...options + }); + } + status(options) { + return (options?.client ?? this._client).get({ + url: "/file/status", + ...options + }); + } +} + +class App extends _HeyApiClient { + log(options) { + return (options?.client ?? this._client).post({ + url: "/log", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers + } + }); + } + agents(options) { + return (options?.client ?? this._client).get({ + url: "/agent", + ...options + }); + } +} + +class Auth extends _HeyApiClient { + remove(options) { + return (options.client ?? this._client).delete({ + url: "/mcp/{name}/auth", + ...options + }); + } + start(options) { + return (options.client ?? this._client).post({ + url: "/mcp/{name}/auth", + ...options + }); + } + callback(options) { + return (options.client ?? this._client).post({ + url: "/mcp/{name}/auth/callback", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers + } + }); + } + authenticate(options) { + return (options.client ?? this._client).post({ + url: "/mcp/{name}/auth/authenticate", + ...options + }); + } + set(options) { + return (options.client ?? this._client).put({ + url: "/auth/{id}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers + } + }); + } +} + +class Mcp extends _HeyApiClient { + status(options) { + return (options?.client ?? this._client).get({ + url: "/mcp", + ...options + }); + } + add(options) { + return (options?.client ?? this._client).post({ + url: "/mcp", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers + } + }); + } + connect(options) { + return (options.client ?? this._client).post({ + url: "/mcp/{name}/connect", + ...options + }); + } + disconnect(options) { + return (options.client ?? this._client).post({ + url: "/mcp/{name}/disconnect", + ...options + }); + } + auth = new Auth({ client: this._client }); +} + +class Lsp extends _HeyApiClient { + status(options) { + return (options?.client ?? this._client).get({ + url: "/lsp", + ...options + }); + } +} + +class Formatter extends _HeyApiClient { + status(options) { + return (options?.client ?? this._client).get({ + url: "/formatter", + ...options + }); + } +} + +class Control extends _HeyApiClient { + next(options) { + return (options?.client ?? this._client).get({ + url: "/tui/control/next", + ...options + }); + } + response(options) { + return (options?.client ?? this._client).post({ + url: "/tui/control/response", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers + } + }); + } +} + +class Tui extends _HeyApiClient { + appendPrompt(options) { + return (options?.client ?? this._client).post({ + url: "/tui/append-prompt", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers + } + }); + } + openHelp(options) { + return (options?.client ?? this._client).post({ + url: "/tui/open-help", + ...options + }); + } + openSessions(options) { + return (options?.client ?? this._client).post({ + url: "/tui/open-sessions", + ...options + }); + } + openThemes(options) { + return (options?.client ?? this._client).post({ + url: "/tui/open-themes", + ...options + }); + } + openModels(options) { + return (options?.client ?? this._client).post({ + url: "/tui/open-models", + ...options + }); + } + submitPrompt(options) { + return (options?.client ?? this._client).post({ + url: "/tui/submit-prompt", + ...options + }); + } + clearPrompt(options) { + return (options?.client ?? this._client).post({ + url: "/tui/clear-prompt", + ...options + }); + } + executeCommand(options) { + return (options?.client ?? this._client).post({ + url: "/tui/execute-command", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers + } + }); + } + showToast(options) { + return (options?.client ?? this._client).post({ + url: "/tui/show-toast", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers + } + }); + } + publish(options) { + return (options?.client ?? this._client).post({ + url: "/tui/publish", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers + } + }); + } + control = new Control({ client: this._client }); +} + +class Event extends _HeyApiClient { + subscribe(options) { + return (options?.client ?? this._client).get.sse({ + url: "/event", + ...options + }); + } +} + +class OpencodeClient extends _HeyApiClient { + postSessionIdPermissionsPermissionId(options) { + return (options.client ?? this._client).post({ + url: "/session/{id}/permissions/{permissionID}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers + } + }); + } + global = new Global({ client: this._client }); + project = new Project({ client: this._client }); + pty = new Pty({ client: this._client }); + config = new Config({ client: this._client }); + tool = new Tool({ client: this._client }); + instance = new Instance({ client: this._client }); + path = new Path({ client: this._client }); + vcs = new Vcs({ client: this._client }); + session = new Session({ client: this._client }); + command = new Command({ client: this._client }); + provider = new Provider({ client: this._client }); + find = new Find({ client: this._client }); + file = new File2({ client: this._client }); + app = new App({ client: this._client }); + mcp = new Mcp({ client: this._client }); + lsp = new Lsp({ client: this._client }); + formatter = new Formatter({ client: this._client }); + tui = new Tui({ client: this._client }); + auth = new Auth({ client: this._client }); + event = new Event({ client: this._client }); +} + +// node_modules/@opencode-ai/sdk/dist/error-interceptor.js +function wrapClientError(error, response, request, opts) { + if (!opts?.throwOnError) + return error; + if (error instanceof Error) + return error; + if (typeof error === "object" && error !== null && Object.keys(error).length > 0) { + const obj = error; + const message = typeof obj.data?.message === "string" && obj.data.message || typeof obj.message === "string" && obj.message || typeof obj.name === "string" && obj.name || describe(request, response); + return new Error(message, { cause: { body: error, status: response?.status } }); + } + if (typeof error === "string" && error.length > 0) { + return new Error(error, { cause: { body: error, status: response?.status } }); + } + const reason = response ? "(empty response body)" : "network error (no response)"; + return new Error(`opencode server ${describe(request, response)}: ${reason}`, { + cause: { body: error, status: response?.status } + }); +} +function describe(request, response) { + const method = request?.method ?? "?"; + const url = request?.url ?? "?"; + const status = response?.status; + const statusText = response?.statusText; + return `${method} ${url}${status ? " \u2192 " + status : ""}${statusText ? " " + statusText : ""}`; +} + +// node_modules/@opencode-ai/sdk/dist/client.js +function pick(value, fallback) { + if (!value) + return; + if (!fallback) + return value; + if (value === fallback) + return fallback; + if (value === encodeURIComponent(fallback)) + return fallback; + return value; +} +function rewrite(request, directory) { + if (request.method !== "GET" && request.method !== "HEAD") + return request; + const value = pick(request.headers.get("x-opencode-directory"), directory); + if (!value) + return request; + const url = new URL(request.url); + if (!url.searchParams.has("directory")) { + url.searchParams.set("directory", value); + } + const next = new Request(url, request); + next.headers.delete("x-opencode-directory"); + return next; +} +function createOpencodeClient(config) { + if (!config?.fetch) { + const customFetch = (req) => { + req.timeout = false; + return fetch(req); + }; + config = { + ...config, + fetch: customFetch + }; + } + if (config?.directory) { + config.headers = { + ...config.headers, + "x-opencode-directory": encodeURIComponent(config.directory) + }; + } + const client2 = createClient(config); + client2.interceptors.request.use((request) => rewrite(request, config?.directory)); + client2.interceptors.error.use(wrapClientError); + return new OpencodeClient({ client: client2 }); +} +// node_modules/@opencode-ai/sdk/dist/server.js +var import_cross_spawn = __toESM(require_cross_spawn(), 1); +// src/backend.ts +async function publishDiagnostic(rpc, diagnostic) { + const { instanceID, ...value } = diagnostic; + await rpc.notify("backend.diagnostic.publish", { + ...instanceID ? { instanceID } : {}, + diagnostic: { + severity: value.level === "warn" ? "warning" : value.level, + code: value.operation ?? "extension_host", + message: value.message, + plugin: value.plugin?.id ?? value.plugin?.spec, + method: value.operation, + data: value.error ? { + ...value.error.name ? { name: value.error.name } : {}, + message: value.error.message, + ...value.error.stack ? { stack: value.error.stack } : {}, + ...value.error.cause === undefined ? {} : { cause: String(value.error.cause) } + } : undefined + } + }); +} + +// src/log.ts +var LOG_LEVELS = ["trace", "debug", "info", "warn", "error", "off"]; +var DEFAULT_LOG_LEVEL = "debug"; +var LOG_LEVEL_RANK = { + trace: 0, + debug: 1, + info: 2, + warn: 3, + error: 4, + off: 5 +}; +var currentLogLevel = parseLogLevel(process.env.OPENCODE_EXTENSION_HOST_LOG_LEVEL) ?? DEFAULT_LOG_LEVEL; +function setLogLevel(level) { + const parsed = parseLogLevel(level); + if (!parsed) + throw new TypeError(`Invalid extension host log level: ${level}`); + currentLogLevel = parsed; + return currentLogLevel; +} +function logEvent(event, fields = {}, level = "info") { + if (!shouldLog(level)) + return; + const record = { + timestamp: new Date().toISOString(), + level, + event, + ...fields + }; + console.error(`[extension-host] ${JSON.stringify(record)}`); +} +function parseLogLevel(value) { + if (!value) + return; + return LOG_LEVELS.find((candidate) => candidate === value.trim().toLowerCase()); +} +function shouldLog(level) { + return currentLogLevel !== "off" && LOG_LEVEL_RANK[level] >= LOG_LEVEL_RANK[currentLogLevel]; +} +function logError(event, error, fields = {}) { + const value = error instanceof Error ? error : new Error(String(error)); + logEvent(event, { + ...fields, + error_name: value.name, + error_message: value.message + }, "error"); +} +function rpcMessageSummary(message) { + if (!message || typeof message !== "object") + return { kind: "invalid" }; + const value = message; + const id = typeof value.id === "string" ? { request_id: value.id } : {}; + if (typeof value.method === "string") { + return { + ...id, + kind: value.id === undefined ? "notification" : "request", + method: value.method + }; + } + return { + ...id, + kind: "error" in value ? "error_response" : "response" + }; +} + +// src/loader.ts +var import_npm_package_arg = __toESM(require_npa(), 1); +var import_semver = __toESM(require_semver2(), 1); +import { readFile, readdir, realpath, stat } from "fs/promises"; +import path from "path"; +import { fileURLToPath, pathToFileURL } from "url"; +import { createHash } from "crypto"; +var OPENCODE_COMPATIBILITY_VERSION = "1.17.18"; +var INDEX_FILES = ["index.ts", "index.tsx", "index.js", "index.mjs", "index.cjs"]; +async function preparePlugins(input) { + const normalized = await normalizePluginDeclarations(input.declarations, input.defaultBaseDirectory); + const readJson = input.readJson ?? readNodeJson; + const satisfies = input.satisfies ?? ((version, range) => import_semver.default.satisfies(version, range)); + const install = input.install ?? unavailableInstaller; + const results = await Promise.all(normalized.declarations.map((declaration) => prepareCandidate(declaration, input.cacheDirectory, input.compatibilityVersion ?? OPENCODE_COMPATIBILITY_VERSION, install, readJson, satisfies, input.allowInstall ?? true))); + return { + reviewed: normalized.declarations, + prepared: results.flatMap((result) => ("prepared" in result) ? [result.prepared] : []), + diagnostics: [ + ...normalized.diagnostics, + ...results.flatMap((result) => ("diagnostic" in result) ? [result.diagnostic] : []) + ].sort((a, b) => a.declarationIndex - b.declarationIndex) + }; +} +async function loadPreparedPlugins(input) { + const results = await Promise.all(input.prepared.map(loadPreparedCandidate)); + return { + loaded: results.flatMap((result) => ("loaded" in result) ? [result.loaded] : []), + diagnostics: [ + ...input.diagnostics, + ...results.flatMap((result) => ("diagnostic" in result) ? [result.diagnostic] : []) + ].sort((a, b) => a.declarationIndex - b.declarationIndex) + }; +} +async function normalizePluginDeclarations(declarations, defaultBaseDirectory = process.cwd()) { + const results = await Promise.all(declarations.map(async (declaration, declarationIndex) => { + try { + return { + declaration: await normalizeDeclaration(declaration, declarationIndex, defaultBaseDirectory) + }; + } catch (error) { + return { + diagnostic: makeDiagnostic(declarationIndex, declarationSpec(declaration), "declaration", error) + }; + } + })); + const seen = new Set; + const deduplicated = []; + for (const result of results.toReversed()) { + if (!result.declaration) + continue; + if (seen.has(result.declaration.identity)) + continue; + seen.add(result.declaration.identity); + deduplicated.push(result.declaration); + } + return { + declarations: deduplicated.toReversed(), + diagnostics: results.flatMap((result) => result.diagnostic ? [result.diagnostic] : []) + }; +} +function extractServerEntrypoints(input) { + const preferred = preferredServerEntrypoint(input); + if (preferred) + return [{ ...preferred, index: 0 }]; + const seen = new Set; + const result = []; + for (const value of Object.values(input.module)) { + if (seen.has(value)) + continue; + seen.add(value); + const server2 = serverFunction(value); + if (!server2) + throw new TypeError(`Plugin ${input.spec} export is not a function`); + result.push({ + ...legacyPluginID(value) ? { id: legacyPluginID(value) } : {}, + server: server2, + index: result.length + }); + } + if (!result.length) + throw new TypeError(`Plugin ${input.spec} module is empty`); + return result; +} +function parseNpmPluginSpecifier(spec, baseDirectory = process.cwd()) { + const parsed = import_npm_package_arg.default(spec, baseDirectory); + const packageName = parsed.name ?? undefined; + const canonical = parsed.saveSpec ?? parsed.fetchSpec ?? parsed.raw; + const installSpec = parsed.type === "directory" || parsed.type === "file" ? pathToFileURL(String(parsed.fetchSpec)).href : parsed.registry && parsed.raw === parsed.name ? `${parsed.name}@latest` : spec; + return { + packageName, + identity: packageName ?? String(canonical), + installSpec, + type: parsed.type + }; +} +async function prepareCandidate(declaration, cacheDirectory, compatibilityVersion, install, readJson, satisfies, allowInstall) { + let target; + let cache; + try { + if (declaration.source === "file") { + target = await resolveFileTarget(declaration.resolvedSpec); + cache = "validated"; + } else { + const installed = await install({ + spec: parseNpmPluginSpecifier(declaration.spec, declaration.baseDirectory).installSpec, + packageName: declaration.packageName, + cacheDirectory, + allowInstall + }); + target = typeof installed === "string" ? installed : installed.target; + cache = typeof installed === "string" ? "installed" : installed.cache; + } + } catch (error) { + return { + diagnostic: makeDiagnostic(declaration.declarationIndex, declaration.spec, declaration.source === "file" ? "resolve" : "install", error) + }; + } + let pkg; + let entry; + try { + pkg = await readPluginPackage(target, declaration.source === "npm", readJson); + entry = await resolveServerEntrypoint(declaration.spec, declaration.source, target, pkg); + if (!entry) + throw new Error(`Plugin ${declaration.spec} does not expose a server entrypoint`); + } catch (error) { + return { + diagnostic: makeDiagnostic(declaration.declarationIndex, declaration.spec, "entry", error) + }; + } + if (declaration.source === "npm" && pkg) { + try { + checkCompatibility(declaration.spec, pkg, compatibilityVersion, satisfies); + } catch (error) { + return { + diagnostic: makeDiagnostic(declaration.declarationIndex, declaration.spec, "compatibility", error) + }; + } + } + const contentHash = await pluginContentHash(target, pkg); + return { + prepared: { + ...declaration, + target, + entry, + cache, + contentHash, + package: pkg + } + }; +} +async function pluginContentHash(target, pkg) { + try { + const hash = createHash("sha256"); + const targetStat = await stat(target); + const sourceRoot = pkg?.directory ?? (targetStat.isDirectory() ? target : path.dirname(target)); + await updateLocalSourceTreeHash(hash, sourceRoot); + if (pkg) { + for (const directory of pluginDigestDirectories(pkg.directory)) { + for (const lockName of ["package-lock.json", "pnpm-lock.yaml", "yarn.lock", "bun.lockb", "bun.lock"]) { + const lockPath = path.join(directory, lockName); + if (await exists(lockPath)) { + hash.update(lockName); + hash.update(await readFile(lockPath)); + } + } + } + } + return hash.digest("hex"); + } catch { + return; + } +} +async function updateLocalSourceTreeHash(hash, root) { + const walk = async (directory) => { + const entries = await readdir(directory, { withFileTypes: true }); + entries.sort((left, right) => left.name.localeCompare(right.name)); + for (const entry of entries) { + if (entry.isSymbolicLink()) + continue; + if (entry.isDirectory() && [".git", "node_modules"].includes(entry.name)) + continue; + const absolute = path.join(directory, entry.name); + if (entry.isDirectory()) { + await walk(absolute); + continue; + } + if (!entry.isFile()) + continue; + if (!localExecutableSourceFile(entry.name)) + continue; + hash.update(path.relative(root, absolute).replaceAll(path.sep, "/")); + hash.update("\x00"); + hash.update(await readFile(absolute)); + hash.update("\x00"); + } + }; + await walk(root); +} +function localExecutableSourceFile(name) { + return [".cjs", ".js", ".json", ".jsx", ".mjs", ".node", ".ts", ".tsx", ".wasm"].includes(path.extname(name).toLowerCase()); +} +function pluginDigestDirectories(packageDirectory) { + const directories = [packageDirectory]; + let current = path.dirname(packageDirectory); + while (current !== path.dirname(current)) { + if (path.basename(current).toLowerCase() === "node_modules") { + directories.push(path.dirname(current)); + break; + } + current = path.dirname(current); + } + return directories; +} +async function loadPreparedCandidate(plugin) { + let module; + try { + const cacheKey = plugin.contentHash ?? `${plugin.spec}:${plugin.declarationIndex}`; + const imported = await import(`${plugin.entry}?openbitfunGeneration=${encodeURIComponent(cacheKey)}`); + if (!isRecord(imported)) + throw new Error(`Plugin ${plugin.spec} module is empty`); + module = imported; + } catch (error) { + return { + diagnostic: makeDiagnostic(plugin.declarationIndex, plugin.spec, "load", error) + }; + } + try { + return { + loaded: { + ...plugin, + module, + entrypoints: extractServerEntrypoints({ + module, + spec: plugin.spec, + source: plugin.source, + package: plugin.package + }) + } + }; + } catch (error) { + return { + diagnostic: makeDiagnostic(plugin.declarationIndex, plugin.spec, "shape", error) + }; + } +} +async function normalizeDeclaration(input, declarationIndex, defaultBaseDirectory) { + const declaration = declarationObject(input); + if (typeof declaration.spec !== "string" || !declaration.spec.trim()) { + throw new TypeError("Plugin declaration spec must be a non-empty string"); + } + if (declaration.options !== undefined && !isRecord(declaration.options)) { + throw new TypeError("Plugin declaration options must be an object"); + } + if (declaration.baseDirectory !== undefined && typeof declaration.baseDirectory !== "string") { + throw new TypeError("Plugin declaration baseDirectory must be a string"); + } + const spec = declaration.spec.trim(); + const baseDirectory = path.resolve(declaration.baseDirectory ?? defaultBaseDirectory); + const optionsDigest = stableJsonDigest(declaration.options ?? null); + const source = pluginSource(spec); + if (source === "npm") { + const parsed = parseNpmPluginSpecifier(spec, baseDirectory); + return { + declarationIndex, + spec, + resolvedSpec: spec, + identity: `npm:${parsed.identity}`, + optionsDigest, + source, + packageName: parsed.packageName, + options: declaration.options, + baseDirectory + }; + } + const file = spec.startsWith("file://") ? fileURLToPath(spec) : path.isAbsolute(spec) || isWindowsAbsolutePath(spec) ? spec : path.resolve(baseDirectory, spec); + const canonical = await realpath(file).catch(() => path.resolve(file)); + const resolvedSpec = pathToFileURL(canonical).href; + return { + declarationIndex, + spec, + resolvedSpec, + identity: `file:${resolvedSpec}`, + optionsDigest, + source, + options: declaration.options, + baseDirectory + }; +} +function stableJsonDigest(value) { + const canonical = JSON.stringify(value, (_key, nested) => { + if (!isRecord(nested)) + return nested; + return Object.fromEntries(Object.entries(nested).sort(([left], [right]) => left.localeCompare(right))); + }); + return createHash("sha256").update(canonical).digest("hex"); +} +function declarationObject(input) { + if (typeof input === "string") + return { spec: input }; + if (Array.isArray(input)) + return { spec: input[0], options: input[1] }; + if (isRecord(input)) + return input; + throw new TypeError("Plugin declaration must be a string, tuple, or object"); +} +function declarationSpec(input) { + if (typeof input === "string") + return input; + if (Array.isArray(input)) + return typeof input[0] === "string" ? input[0] : ""; + if (isRecord(input) && typeof input.spec === "string") + return input.spec; + return ""; +} +function pluginSource(spec) { + if (spec.startsWith("file://") || spec.startsWith(".") || path.isAbsolute(spec) || isWindowsAbsolutePath(spec)) { + return "file"; + } + return "npm"; +} +async function resolveFileTarget(spec) { + const file = fileURLToPath(spec); + const info = await stat(file); + if (!info.isDirectory()) + return realpath(file); + if (await exists(path.join(file, "package.json"))) + return realpath(file); + const index = await resolveDirectoryIndex(file); + if (index) + return index; + throw new Error(`Plugin directory ${file} is missing package.json or index file`); +} +async function readPluginPackage(target, required, readJson) { + const info = await stat(target); + const directory = info.isDirectory() ? target : path.dirname(target); + const manifestPath = path.join(directory, "package.json"); + if (!await exists(manifestPath)) { + if (required) + throw new Error(`Plugin package ${directory} is missing package.json`); + return; + } + return { + directory: await realpath(directory), + manifestPath, + manifest: await readJson(manifestPath) + }; +} +async function resolveServerEntrypoint(spec, source, target, pkg) { + if (pkg) { + const exports = pkg.manifest.exports; + if (isRecord(exports)) { + const server2 = extractExportValue(exports["./server"]); + if (server2) + return resolvePackageEntry(spec, server2, "server", pkg); + } + const main = typeof pkg.manifest.main === "string" ? pkg.manifest.main.trim() : ""; + if (main) + return resolvePackageEntry(spec, main, "main", pkg); + } + const info = await stat(target); + if (!info.isDirectory()) + return pathToFileURL(await realpath(target)).href; + if (source === "npm") + return; + const index = await resolveDirectoryIndex(target); + return index ? pathToFileURL(index).href : undefined; +} +async function resolvePackageEntry(spec, raw, kind, pkg) { + const file = raw.startsWith("file://") ? fileURLToPath(raw) : path.isAbsolute(raw) || isWindowsAbsolutePath(raw) ? raw : path.resolve(pkg.directory, raw); + if (!contains(pkg.directory, path.resolve(file))) { + throw new Error(`Plugin ${spec} resolved ${kind} entry outside plugin directory`); + } + const [root, entry] = await Promise.all([realpath(pkg.directory), realpath(file)]); + if (!contains(root, entry)) + throw new Error(`Plugin ${spec} resolved ${kind} entry outside plugin directory`); + return pathToFileURL(entry).href; +} +function extractExportValue(value) { + if (typeof value === "string") + return value; + if (!isRecord(value)) + return; + if (typeof value.import === "string") + return value.import; + if (typeof value.default === "string") + return value.default; +} +async function resolveDirectoryIndex(directory) { + for (const name of INDEX_FILES) { + const file = path.join(directory, name); + if (await exists(file)) + return realpath(file); + } +} +function checkCompatibility(spec, pkg, version, satisfies) { + const engines = pkg.manifest.engines; + if (!isRecord(engines) || typeof engines.opencode !== "string") + return; + if (satisfies(version, engines.opencode)) + return; + throw new Error(`Plugin ${spec} requires opencode ${engines.opencode} but running ${version}`); +} +function preferredServerEntrypoint(input) { + const value = input.module.default; + if (!isRecord(value)) + return; + if (!("id" in value) && !("server" in value) && !("tui" in value)) + return; + if (value.server !== undefined && typeof value.server !== "function") { + throw new TypeError(`Plugin ${input.spec} has invalid server export`); + } + if (value.tui !== undefined && typeof value.tui !== "function") { + throw new TypeError(`Plugin ${input.spec} has invalid tui export`); + } + if (value.server !== undefined && value.tui !== undefined) { + throw new TypeError(`Plugin ${input.spec} must default export either server() or tui(), not both`); + } + if (value.server === undefined) { + throw new TypeError(`Plugin ${input.spec} must default export an object with server()`); + } + const declaredID = readPluginID(value.id, input.spec); + if (input.source === "file" && !declaredID) { + throw new TypeError(`Path plugin ${input.spec} must export id`); + } + const packageID = input.source === "npm" && !declaredID ? packageName(input.package, input.spec) : undefined; + return { + id: declaredID ?? packageID, + server: value.server + }; +} +function readPluginID(value, spec) { + if (value === undefined) + return; + if (typeof value !== "string") + throw new TypeError(`Plugin ${spec} has invalid id type ${typeof value}`); + const id = value.trim(); + if (!id) + throw new TypeError(`Plugin ${spec} has an empty id`); + return id; +} +function packageName(pkg, spec) { + const name = pkg?.manifest.name; + if (typeof name !== "string" || !name.trim()) { + throw new TypeError(`Plugin package for ${spec} is missing name`); + } + return name.trim(); +} +function serverFunction(value) { + if (typeof value === "function") + return value; + if (!isRecord(value) || typeof value.server !== "function") + return; + return value.server; +} +function legacyPluginID(value) { + if (!isRecord(value) || typeof value.id !== "string") + return; + const id = value.id.trim(); + return id || undefined; +} +function contains(root, file) { + const relative = path.relative(root, file); + return relative === "" || !relative.startsWith(`..${path.sep}`) && relative !== ".." && !path.isAbsolute(relative); +} +function isWindowsAbsolutePath(value) { + return /^[A-Za-z]:[\\/]/.test(value); +} +function isRecord(value) { + return typeof value === "object" && value !== null && !Array.isArray(value); +} +async function exists(file) { + return stat(file).then(() => true).catch(() => false); +} +async function readNodeJson(file) { + const value = JSON.parse(await readFile(file, "utf8")); + if (!isRecord(value)) + throw new TypeError(`${file} must contain a JSON object`); + return value; +} +function unavailableInstaller(input) { + return Promise.reject(new Error(`No installer is configured for plugin ${input.spec}`)); +} +function makeDiagnostic(declarationIndex, spec, stage, error) { + const detail = errorInfo(error); + return { + level: "error", + declarationIndex, + spec, + stage, + message: detail.message, + error: detail + }; +} +function errorInfo(error) { + if (!(error instanceof Error)) + return { message: String(error) }; + return { + name: error.name, + message: error.message, + stack: error.stack, + ...error.cause === undefined ? {} : { cause: error.cause instanceof Error ? errorInfo(error.cause) : String(error.cause) } + }; +} + +// node_modules/zod/v4/classic/external.js +var exports_external = {}; +__export(exports_external, { + xid: () => xid2, + void: () => _void2, + uuidv7: () => uuidv7, + uuidv6: () => uuidv6, + uuidv4: () => uuidv4, + uuid: () => uuid2, + util: () => exports_util, + url: () => url, + uppercase: () => _uppercase, + unknown: () => unknown, + union: () => union, + undefined: () => _undefined3, + ulid: () => ulid2, + uint64: () => uint64, + uint32: () => uint32, + tuple: () => tuple, + trim: () => _trim, + treeifyError: () => treeifyError, + transform: () => transform, + toUpperCase: () => _toUpperCase, + toLowerCase: () => _toLowerCase, + toJSONSchema: () => toJSONSchema, + templateLiteral: () => templateLiteral, + symbol: () => symbol, + superRefine: () => superRefine, + success: () => success, + stringbool: () => stringbool, + stringFormat: () => stringFormat, + string: () => string2, + strictObject: () => strictObject, + startsWith: () => _startsWith, + size: () => _size, + setErrorMap: () => setErrorMap, + set: () => set, + safeParseAsync: () => safeParseAsync2, + safeParse: () => safeParse2, + safeEncodeAsync: () => safeEncodeAsync2, + safeEncode: () => safeEncode2, + safeDecodeAsync: () => safeDecodeAsync2, + safeDecode: () => safeDecode2, + registry: () => registry, + regexes: () => exports_regexes, + regex: () => _regex, + refine: () => refine, + record: () => record, + readonly: () => readonly, + property: () => _property, + promise: () => promise, + prettifyError: () => prettifyError, + preprocess: () => preprocess, + prefault: () => prefault, + positive: () => _positive, + pipe: () => pipe, + partialRecord: () => partialRecord, + parseAsync: () => parseAsync2, + parse: () => parse3, + overwrite: () => _overwrite, + optional: () => optional, + object: () => object, + number: () => number2, + nullish: () => nullish2, + nullable: () => nullable, + null: () => _null3, + normalize: () => _normalize, + nonpositive: () => _nonpositive, + nonoptional: () => nonoptional, + nonnegative: () => _nonnegative, + never: () => never, + negative: () => _negative, + nativeEnum: () => nativeEnum, + nanoid: () => nanoid2, + nan: () => nan, + multipleOf: () => _multipleOf, + minSize: () => _minSize, + minLength: () => _minLength, + mime: () => _mime, + maxSize: () => _maxSize, + maxLength: () => _maxLength, + map: () => map, + lte: () => _lte, + lt: () => _lt, + lowercase: () => _lowercase, + looseObject: () => looseObject, + locales: () => exports_locales, + literal: () => literal, + length: () => _length, + lazy: () => lazy, + ksuid: () => ksuid2, + keyof: () => keyof, + jwt: () => jwt, + json: () => json, + iso: () => exports_iso, + ipv6: () => ipv62, + ipv4: () => ipv42, + intersection: () => intersection, + int64: () => int64, + int32: () => int32, + int: () => int, + instanceof: () => _instanceof, + includes: () => _includes, + httpUrl: () => httpUrl, + hostname: () => hostname2, + hex: () => hex2, + hash: () => hash, + guid: () => guid2, + gte: () => _gte, + gt: () => _gt, + globalRegistry: () => globalRegistry, + getErrorMap: () => getErrorMap, + function: () => _function, + formatError: () => formatError, + float64: () => float64, + float32: () => float32, + flattenError: () => flattenError, + file: () => file, + enum: () => _enum2, + endsWith: () => _endsWith, + encodeAsync: () => encodeAsync2, + encode: () => encode2, + emoji: () => emoji2, + email: () => email2, + e164: () => e1642, + discriminatedUnion: () => discriminatedUnion, + decodeAsync: () => decodeAsync2, + decode: () => decode2, + date: () => date3, + custom: () => custom, + cuid2: () => cuid22, + cuid: () => cuid3, + core: () => exports_core2, + config: () => config, + coerce: () => exports_coerce, + codec: () => codec, + clone: () => clone, + cidrv6: () => cidrv62, + cidrv4: () => cidrv42, + check: () => check, + catch: () => _catch2, + boolean: () => boolean2, + bigint: () => bigint2, + base64url: () => base64url2, + base64: () => base642, + array: () => array, + any: () => any, + _function: () => _function, + _default: () => _default2, + _ZodString: () => _ZodString, + ZodXID: () => ZodXID, + ZodVoid: () => ZodVoid, + ZodUnknown: () => ZodUnknown, + ZodUnion: () => ZodUnion, + ZodUndefined: () => ZodUndefined, + ZodUUID: () => ZodUUID, + ZodURL: () => ZodURL, + ZodULID: () => ZodULID, + ZodType: () => ZodType, + ZodTuple: () => ZodTuple, + ZodTransform: () => ZodTransform, + ZodTemplateLiteral: () => ZodTemplateLiteral, + ZodSymbol: () => ZodSymbol, + ZodSuccess: () => ZodSuccess, + ZodStringFormat: () => ZodStringFormat, + ZodString: () => ZodString, + ZodSet: () => ZodSet, + ZodRecord: () => ZodRecord, + ZodRealError: () => ZodRealError, + ZodReadonly: () => ZodReadonly, + ZodPromise: () => ZodPromise, + ZodPrefault: () => ZodPrefault, + ZodPipe: () => ZodPipe, + ZodOptional: () => ZodOptional, + ZodObject: () => ZodObject, + ZodNumberFormat: () => ZodNumberFormat, + ZodNumber: () => ZodNumber, + ZodNullable: () => ZodNullable, + ZodNull: () => ZodNull, + ZodNonOptional: () => ZodNonOptional, + ZodNever: () => ZodNever, + ZodNanoID: () => ZodNanoID, + ZodNaN: () => ZodNaN, + ZodMap: () => ZodMap, + ZodLiteral: () => ZodLiteral, + ZodLazy: () => ZodLazy, + ZodKSUID: () => ZodKSUID, + ZodJWT: () => ZodJWT, + ZodIssueCode: () => ZodIssueCode, + ZodIntersection: () => ZodIntersection, + ZodISOTime: () => ZodISOTime, + ZodISODuration: () => ZodISODuration, + ZodISODateTime: () => ZodISODateTime, + ZodISODate: () => ZodISODate, + ZodIPv6: () => ZodIPv6, + ZodIPv4: () => ZodIPv4, + ZodGUID: () => ZodGUID, + ZodFunction: () => ZodFunction, + ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind, + ZodFile: () => ZodFile, + ZodError: () => ZodError, + ZodEnum: () => ZodEnum, + ZodEmoji: () => ZodEmoji, + ZodEmail: () => ZodEmail, + ZodE164: () => ZodE164, + ZodDiscriminatedUnion: () => ZodDiscriminatedUnion, + ZodDefault: () => ZodDefault, + ZodDate: () => ZodDate, + ZodCustomStringFormat: () => ZodCustomStringFormat, + ZodCustom: () => ZodCustom, + ZodCodec: () => ZodCodec, + ZodCatch: () => ZodCatch, + ZodCUID2: () => ZodCUID2, + ZodCUID: () => ZodCUID, + ZodCIDRv6: () => ZodCIDRv6, + ZodCIDRv4: () => ZodCIDRv4, + ZodBoolean: () => ZodBoolean, + ZodBigIntFormat: () => ZodBigIntFormat, + ZodBigInt: () => ZodBigInt, + ZodBase64URL: () => ZodBase64URL, + ZodBase64: () => ZodBase64, + ZodArray: () => ZodArray, + ZodAny: () => ZodAny, + TimePrecision: () => TimePrecision, + NEVER: () => NEVER, + $output: () => $output, + $input: () => $input, + $brand: () => $brand +}); + +// node_modules/zod/v4/core/index.js +var exports_core2 = {}; +__export(exports_core2, { + version: () => version, + util: () => exports_util, + treeifyError: () => treeifyError, + toJSONSchema: () => toJSONSchema, + toDotPath: () => toDotPath, + safeParseAsync: () => safeParseAsync, + safeParse: () => safeParse, + safeEncodeAsync: () => safeEncodeAsync, + safeEncode: () => safeEncode, + safeDecodeAsync: () => safeDecodeAsync, + safeDecode: () => safeDecode, + registry: () => registry, + regexes: () => exports_regexes, + prettifyError: () => prettifyError, + parseAsync: () => parseAsync, + parse: () => parse, + locales: () => exports_locales, + isValidJWT: () => isValidJWT, + isValidBase64URL: () => isValidBase64URL, + isValidBase64: () => isValidBase64, + globalRegistry: () => globalRegistry, + globalConfig: () => globalConfig, + formatError: () => formatError, + flattenError: () => flattenError, + encodeAsync: () => encodeAsync, + encode: () => encode, + decodeAsync: () => decodeAsync, + decode: () => decode, + config: () => config, + clone: () => clone, + _xid: () => _xid, + _void: () => _void, + _uuidv7: () => _uuidv7, + _uuidv6: () => _uuidv6, + _uuidv4: () => _uuidv4, + _uuid: () => _uuid, + _url: () => _url, + _uppercase: () => _uppercase, + _unknown: () => _unknown, + _union: () => _union, + _undefined: () => _undefined2, + _ulid: () => _ulid, + _uint64: () => _uint64, + _uint32: () => _uint32, + _tuple: () => _tuple, + _trim: () => _trim, + _transform: () => _transform, + _toUpperCase: () => _toUpperCase, + _toLowerCase: () => _toLowerCase, + _templateLiteral: () => _templateLiteral, + _symbol: () => _symbol, + _superRefine: () => _superRefine, + _success: () => _success, + _stringbool: () => _stringbool, + _stringFormat: () => _stringFormat, + _string: () => _string, + _startsWith: () => _startsWith, + _size: () => _size, + _set: () => _set, + _safeParseAsync: () => _safeParseAsync, + _safeParse: () => _safeParse, + _safeEncodeAsync: () => _safeEncodeAsync, + _safeEncode: () => _safeEncode, + _safeDecodeAsync: () => _safeDecodeAsync, + _safeDecode: () => _safeDecode, + _regex: () => _regex, + _refine: () => _refine, + _record: () => _record, + _readonly: () => _readonly, + _property: () => _property, + _promise: () => _promise, + _positive: () => _positive, + _pipe: () => _pipe, + _parseAsync: () => _parseAsync, + _parse: () => _parse, + _overwrite: () => _overwrite, + _optional: () => _optional, + _number: () => _number, + _nullable: () => _nullable, + _null: () => _null2, + _normalize: () => _normalize, + _nonpositive: () => _nonpositive, + _nonoptional: () => _nonoptional, + _nonnegative: () => _nonnegative, + _never: () => _never, + _negative: () => _negative, + _nativeEnum: () => _nativeEnum, + _nanoid: () => _nanoid, + _nan: () => _nan, + _multipleOf: () => _multipleOf, + _minSize: () => _minSize, + _minLength: () => _minLength, + _min: () => _gte, + _mime: () => _mime, + _maxSize: () => _maxSize, + _maxLength: () => _maxLength, + _max: () => _lte, + _map: () => _map, + _lte: () => _lte, + _lt: () => _lt, + _lowercase: () => _lowercase, + _literal: () => _literal, + _length: () => _length, + _lazy: () => _lazy, + _ksuid: () => _ksuid, + _jwt: () => _jwt, + _isoTime: () => _isoTime, + _isoDuration: () => _isoDuration, + _isoDateTime: () => _isoDateTime, + _isoDate: () => _isoDate, + _ipv6: () => _ipv6, + _ipv4: () => _ipv4, + _intersection: () => _intersection, + _int64: () => _int64, + _int32: () => _int32, + _int: () => _int, + _includes: () => _includes, + _guid: () => _guid, + _gte: () => _gte, + _gt: () => _gt, + _float64: () => _float64, + _float32: () => _float32, + _file: () => _file, + _enum: () => _enum, + _endsWith: () => _endsWith, + _encodeAsync: () => _encodeAsync, + _encode: () => _encode, + _emoji: () => _emoji2, + _email: () => _email, + _e164: () => _e164, + _discriminatedUnion: () => _discriminatedUnion, + _default: () => _default, + _decodeAsync: () => _decodeAsync, + _decode: () => _decode, + _date: () => _date, + _custom: () => _custom, + _cuid2: () => _cuid2, + _cuid: () => _cuid, + _coercedString: () => _coercedString, + _coercedNumber: () => _coercedNumber, + _coercedDate: () => _coercedDate, + _coercedBoolean: () => _coercedBoolean, + _coercedBigint: () => _coercedBigint, + _cidrv6: () => _cidrv6, + _cidrv4: () => _cidrv4, + _check: () => _check, + _catch: () => _catch, + _boolean: () => _boolean, + _bigint: () => _bigint, + _base64url: () => _base64url, + _base64: () => _base64, + _array: () => _array, + _any: () => _any, + TimePrecision: () => TimePrecision, + NEVER: () => NEVER, + JSONSchemaGenerator: () => JSONSchemaGenerator, + JSONSchema: () => exports_json_schema, + Doc: () => Doc, + $output: () => $output, + $input: () => $input, + $constructor: () => $constructor, + $brand: () => $brand, + $ZodXID: () => $ZodXID, + $ZodVoid: () => $ZodVoid, + $ZodUnknown: () => $ZodUnknown, + $ZodUnion: () => $ZodUnion, + $ZodUndefined: () => $ZodUndefined, + $ZodUUID: () => $ZodUUID, + $ZodURL: () => $ZodURL, + $ZodULID: () => $ZodULID, + $ZodType: () => $ZodType, + $ZodTuple: () => $ZodTuple, + $ZodTransform: () => $ZodTransform, + $ZodTemplateLiteral: () => $ZodTemplateLiteral, + $ZodSymbol: () => $ZodSymbol, + $ZodSuccess: () => $ZodSuccess, + $ZodStringFormat: () => $ZodStringFormat, + $ZodString: () => $ZodString, + $ZodSet: () => $ZodSet, + $ZodRegistry: () => $ZodRegistry, + $ZodRecord: () => $ZodRecord, + $ZodRealError: () => $ZodRealError, + $ZodReadonly: () => $ZodReadonly, + $ZodPromise: () => $ZodPromise, + $ZodPrefault: () => $ZodPrefault, + $ZodPipe: () => $ZodPipe, + $ZodOptional: () => $ZodOptional, + $ZodObjectJIT: () => $ZodObjectJIT, + $ZodObject: () => $ZodObject, + $ZodNumberFormat: () => $ZodNumberFormat, + $ZodNumber: () => $ZodNumber, + $ZodNullable: () => $ZodNullable, + $ZodNull: () => $ZodNull, + $ZodNonOptional: () => $ZodNonOptional, + $ZodNever: () => $ZodNever, + $ZodNanoID: () => $ZodNanoID, + $ZodNaN: () => $ZodNaN, + $ZodMap: () => $ZodMap, + $ZodLiteral: () => $ZodLiteral, + $ZodLazy: () => $ZodLazy, + $ZodKSUID: () => $ZodKSUID, + $ZodJWT: () => $ZodJWT, + $ZodIntersection: () => $ZodIntersection, + $ZodISOTime: () => $ZodISOTime, + $ZodISODuration: () => $ZodISODuration, + $ZodISODateTime: () => $ZodISODateTime, + $ZodISODate: () => $ZodISODate, + $ZodIPv6: () => $ZodIPv6, + $ZodIPv4: () => $ZodIPv4, + $ZodGUID: () => $ZodGUID, + $ZodFunction: () => $ZodFunction, + $ZodFile: () => $ZodFile, + $ZodError: () => $ZodError, + $ZodEnum: () => $ZodEnum, + $ZodEncodeError: () => $ZodEncodeError, + $ZodEmoji: () => $ZodEmoji, + $ZodEmail: () => $ZodEmail, + $ZodE164: () => $ZodE164, + $ZodDiscriminatedUnion: () => $ZodDiscriminatedUnion, + $ZodDefault: () => $ZodDefault, + $ZodDate: () => $ZodDate, + $ZodCustomStringFormat: () => $ZodCustomStringFormat, + $ZodCustom: () => $ZodCustom, + $ZodCodec: () => $ZodCodec, + $ZodCheckUpperCase: () => $ZodCheckUpperCase, + $ZodCheckStringFormat: () => $ZodCheckStringFormat, + $ZodCheckStartsWith: () => $ZodCheckStartsWith, + $ZodCheckSizeEquals: () => $ZodCheckSizeEquals, + $ZodCheckRegex: () => $ZodCheckRegex, + $ZodCheckProperty: () => $ZodCheckProperty, + $ZodCheckOverwrite: () => $ZodCheckOverwrite, + $ZodCheckNumberFormat: () => $ZodCheckNumberFormat, + $ZodCheckMultipleOf: () => $ZodCheckMultipleOf, + $ZodCheckMinSize: () => $ZodCheckMinSize, + $ZodCheckMinLength: () => $ZodCheckMinLength, + $ZodCheckMimeType: () => $ZodCheckMimeType, + $ZodCheckMaxSize: () => $ZodCheckMaxSize, + $ZodCheckMaxLength: () => $ZodCheckMaxLength, + $ZodCheckLowerCase: () => $ZodCheckLowerCase, + $ZodCheckLessThan: () => $ZodCheckLessThan, + $ZodCheckLengthEquals: () => $ZodCheckLengthEquals, + $ZodCheckIncludes: () => $ZodCheckIncludes, + $ZodCheckGreaterThan: () => $ZodCheckGreaterThan, + $ZodCheckEndsWith: () => $ZodCheckEndsWith, + $ZodCheckBigIntFormat: () => $ZodCheckBigIntFormat, + $ZodCheck: () => $ZodCheck, + $ZodCatch: () => $ZodCatch, + $ZodCUID2: () => $ZodCUID2, + $ZodCUID: () => $ZodCUID, + $ZodCIDRv6: () => $ZodCIDRv6, + $ZodCIDRv4: () => $ZodCIDRv4, + $ZodBoolean: () => $ZodBoolean, + $ZodBigIntFormat: () => $ZodBigIntFormat, + $ZodBigInt: () => $ZodBigInt, + $ZodBase64URL: () => $ZodBase64URL, + $ZodBase64: () => $ZodBase64, + $ZodAsyncError: () => $ZodAsyncError, + $ZodArray: () => $ZodArray, + $ZodAny: () => $ZodAny +}); + +// node_modules/zod/v4/core/core.js +var NEVER = Object.freeze({ + status: "aborted" +}); +function $constructor(name, initializer, params) { + function init(inst, def) { + var _a; + Object.defineProperty(inst, "_zod", { + value: inst._zod ?? {}, + enumerable: false + }); + (_a = inst._zod).traits ?? (_a.traits = new Set); + inst._zod.traits.add(name); + initializer(inst, def); + for (const k in _.prototype) { + if (!(k in inst)) + Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) }); + } + inst._zod.constr = _; + inst._zod.def = def; + } + const Parent = params?.Parent ?? Object; + + class Definition extends Parent { + } + Object.defineProperty(Definition, "name", { value: name }); + function _(def) { + var _a; + const inst = params?.Parent ? new Definition : this; + init(inst, def); + (_a = inst._zod).deferred ?? (_a.deferred = []); + for (const fn of inst._zod.deferred) { + fn(); + } + return inst; + } + Object.defineProperty(_, "init", { value: init }); + Object.defineProperty(_, Symbol.hasInstance, { + value: (inst) => { + if (params?.Parent && inst instanceof params.Parent) + return true; + return inst?._zod?.traits?.has(name); + } + }); + Object.defineProperty(_, "name", { value: name }); + return _; +} +var $brand = Symbol("zod_brand"); + +class $ZodAsyncError extends Error { + constructor() { + super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`); + } +} + +class $ZodEncodeError extends Error { + constructor(name) { + super(`Encountered unidirectional transform during encode: ${name}`); + this.name = "ZodEncodeError"; + } +} +var globalConfig = {}; +function config(newConfig) { + if (newConfig) + Object.assign(globalConfig, newConfig); + return globalConfig; +} +// node_modules/zod/v4/core/util.js +var exports_util = {}; +__export(exports_util, { + unwrapMessage: () => unwrapMessage, + uint8ArrayToHex: () => uint8ArrayToHex, + uint8ArrayToBase64url: () => uint8ArrayToBase64url, + uint8ArrayToBase64: () => uint8ArrayToBase64, + stringifyPrimitive: () => stringifyPrimitive, + shallowClone: () => shallowClone, + safeExtend: () => safeExtend, + required: () => required, + randomString: () => randomString, + propertyKeyTypes: () => propertyKeyTypes, + promiseAllObject: () => promiseAllObject, + primitiveTypes: () => primitiveTypes, + prefixIssues: () => prefixIssues, + pick: () => pick2, + partial: () => partial, + optionalKeys: () => optionalKeys, + omit: () => omit, + objectClone: () => objectClone, + numKeys: () => numKeys, + nullish: () => nullish, + normalizeParams: () => normalizeParams, + mergeDefs: () => mergeDefs, + merge: () => merge, + jsonStringifyReplacer: () => jsonStringifyReplacer, + joinValues: () => joinValues, + issue: () => issue, + isPlainObject: () => isPlainObject, + isObject: () => isObject, + hexToUint8Array: () => hexToUint8Array, + getSizableOrigin: () => getSizableOrigin, + getParsedType: () => getParsedType, + getLengthableOrigin: () => getLengthableOrigin, + getEnumValues: () => getEnumValues, + getElementAtPath: () => getElementAtPath, + floatSafeRemainder: () => floatSafeRemainder, + finalizeIssue: () => finalizeIssue, + extend: () => extend, + escapeRegex: () => escapeRegex, + esc: () => esc, + defineLazy: () => defineLazy, + createTransparentProxy: () => createTransparentProxy, + cloneDef: () => cloneDef, + clone: () => clone, + cleanRegex: () => cleanRegex, + cleanEnum: () => cleanEnum, + captureStackTrace: () => captureStackTrace, + cached: () => cached, + base64urlToUint8Array: () => base64urlToUint8Array, + base64ToUint8Array: () => base64ToUint8Array, + assignProp: () => assignProp, + assertNotEqual: () => assertNotEqual, + assertNever: () => assertNever, + assertIs: () => assertIs, + assertEqual: () => assertEqual, + assert: () => assert, + allowsEval: () => allowsEval, + aborted: () => aborted, + NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES, + Class: () => Class, + BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES +}); +function assertEqual(val) { + return val; +} +function assertNotEqual(val) { + return val; +} +function assertIs(_arg) {} +function assertNever(_x) { + throw new Error; +} +function assert(_) {} +function getEnumValues(entries) { + const numericValues = Object.values(entries).filter((v) => typeof v === "number"); + const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v); + return values; +} +function joinValues(array, separator = "|") { + return array.map((val) => stringifyPrimitive(val)).join(separator); +} +function jsonStringifyReplacer(_, value) { + if (typeof value === "bigint") + return value.toString(); + return value; +} +function cached(getter) { + const set = false; + return { + get value() { + if (!set) { + const value = getter(); + Object.defineProperty(this, "value", { value }); + return value; + } + throw new Error("cached value already set"); + } + }; +} +function nullish(input) { + return input === null || input === undefined; +} +function cleanRegex(source) { + const start = source.startsWith("^") ? 1 : 0; + const end = source.endsWith("$") ? source.length - 1 : source.length; + return source.slice(start, end); +} +function floatSafeRemainder(val, step) { + const valDecCount = (val.toString().split(".")[1] || "").length; + const stepString = step.toString(); + let stepDecCount = (stepString.split(".")[1] || "").length; + if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) { + const match = stepString.match(/\d?e-(\d?)/); + if (match?.[1]) { + stepDecCount = Number.parseInt(match[1]); + } + } + const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount; + const valInt = Number.parseInt(val.toFixed(decCount).replace(".", "")); + const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", "")); + return valInt % stepInt / 10 ** decCount; +} +var EVALUATING = Symbol("evaluating"); +function defineLazy(object, key, getter) { + let value = undefined; + Object.defineProperty(object, key, { + get() { + if (value === EVALUATING) { + return; + } + if (value === undefined) { + value = EVALUATING; + value = getter(); + } + return value; + }, + set(v) { + Object.defineProperty(object, key, { + value: v + }); + }, + configurable: true + }); +} +function objectClone(obj) { + return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj)); +} +function assignProp(target, prop, value) { + Object.defineProperty(target, prop, { + value, + writable: true, + enumerable: true, + configurable: true + }); +} +function mergeDefs(...defs) { + const mergedDescriptors = {}; + for (const def of defs) { + const descriptors = Object.getOwnPropertyDescriptors(def); + Object.assign(mergedDescriptors, descriptors); + } + return Object.defineProperties({}, mergedDescriptors); +} +function cloneDef(schema) { + return mergeDefs(schema._zod.def); +} +function getElementAtPath(obj, path2) { + if (!path2) + return obj; + return path2.reduce((acc, key) => acc?.[key], obj); +} +function promiseAllObject(promisesObj) { + const keys = Object.keys(promisesObj); + const promises = keys.map((key) => promisesObj[key]); + return Promise.all(promises).then((results) => { + const resolvedObj = {}; + for (let i = 0;i < keys.length; i++) { + resolvedObj[keys[i]] = results[i]; + } + return resolvedObj; + }); +} +function randomString(length = 10) { + const chars = "abcdefghijklmnopqrstuvwxyz"; + let str = ""; + for (let i = 0;i < length; i++) { + str += chars[Math.floor(Math.random() * chars.length)]; + } + return str; +} +function esc(str) { + return JSON.stringify(str); +} +var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {}; +function isObject(data) { + return typeof data === "object" && data !== null && !Array.isArray(data); +} +var allowsEval = cached(() => { + if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) { + return false; + } + try { + const F = Function; + new F(""); + return true; + } catch (_) { + return false; + } +}); +function isPlainObject(o) { + if (isObject(o) === false) + return false; + const ctor = o.constructor; + if (ctor === undefined) + return true; + const prot = ctor.prototype; + if (isObject(prot) === false) + return false; + if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) { + return false; + } + return true; +} +function shallowClone(o) { + if (isPlainObject(o)) + return { ...o }; + if (Array.isArray(o)) + return [...o]; + return o; +} +function numKeys(data) { + let keyCount = 0; + for (const key in data) { + if (Object.prototype.hasOwnProperty.call(data, key)) { + keyCount++; + } + } + return keyCount; +} +var getParsedType = (data) => { + const t = typeof data; + switch (t) { + case "undefined": + return "undefined"; + case "string": + return "string"; + case "number": + return Number.isNaN(data) ? "nan" : "number"; + case "boolean": + return "boolean"; + case "function": + return "function"; + case "bigint": + return "bigint"; + case "symbol": + return "symbol"; + case "object": + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") { + return "promise"; + } + if (typeof Map !== "undefined" && data instanceof Map) { + return "map"; + } + if (typeof Set !== "undefined" && data instanceof Set) { + return "set"; + } + if (typeof Date !== "undefined" && data instanceof Date) { + return "date"; + } + if (typeof File !== "undefined" && data instanceof File) { + return "file"; + } + return "object"; + default: + throw new Error(`Unknown data type: ${t}`); + } +}; +var propertyKeyTypes = new Set(["string", "number", "symbol"]); +var primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]); +function escapeRegex(str) { + return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} +function clone(inst, def, params) { + const cl = new inst._zod.constr(def ?? inst._zod.def); + if (!def || params?.parent) + cl._zod.parent = inst; + return cl; +} +function normalizeParams(_params) { + const params = _params; + if (!params) + return {}; + if (typeof params === "string") + return { error: () => params }; + if (params?.message !== undefined) { + if (params?.error !== undefined) + throw new Error("Cannot specify both `message` and `error` params"); + params.error = params.message; + } + delete params.message; + if (typeof params.error === "string") + return { ...params, error: () => params.error }; + return params; +} +function createTransparentProxy(getter) { + let target; + return new Proxy({}, { + get(_, prop, receiver) { + target ?? (target = getter()); + return Reflect.get(target, prop, receiver); + }, + set(_, prop, value, receiver) { + target ?? (target = getter()); + return Reflect.set(target, prop, value, receiver); + }, + has(_, prop) { + target ?? (target = getter()); + return Reflect.has(target, prop); + }, + deleteProperty(_, prop) { + target ?? (target = getter()); + return Reflect.deleteProperty(target, prop); + }, + ownKeys(_) { + target ?? (target = getter()); + return Reflect.ownKeys(target); + }, + getOwnPropertyDescriptor(_, prop) { + target ?? (target = getter()); + return Reflect.getOwnPropertyDescriptor(target, prop); + }, + defineProperty(_, prop, descriptor) { + target ?? (target = getter()); + return Reflect.defineProperty(target, prop, descriptor); + } + }); +} +function stringifyPrimitive(value) { + if (typeof value === "bigint") + return value.toString() + "n"; + if (typeof value === "string") + return `"${value}"`; + return `${value}`; +} +function optionalKeys(shape) { + return Object.keys(shape).filter((k) => { + return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional"; + }); +} +var NUMBER_FORMAT_RANGES = { + safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER], + int32: [-2147483648, 2147483647], + uint32: [0, 4294967295], + float32: [-340282346638528860000000000000000000000, 340282346638528860000000000000000000000], + float64: [-Number.MAX_VALUE, Number.MAX_VALUE] +}; +var BIGINT_FORMAT_RANGES = { + int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")], + uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")] +}; +function pick2(schema, mask) { + const currDef = schema._zod.def; + const def = mergeDefs(schema._zod.def, { + get shape() { + const newShape = {}; + for (const key in mask) { + if (!(key in currDef.shape)) { + throw new Error(`Unrecognized key: "${key}"`); + } + if (!mask[key]) + continue; + newShape[key] = currDef.shape[key]; + } + assignProp(this, "shape", newShape); + return newShape; + }, + checks: [] + }); + return clone(schema, def); +} +function omit(schema, mask) { + const currDef = schema._zod.def; + const def = mergeDefs(schema._zod.def, { + get shape() { + const newShape = { ...schema._zod.def.shape }; + for (const key in mask) { + if (!(key in currDef.shape)) { + throw new Error(`Unrecognized key: "${key}"`); + } + if (!mask[key]) + continue; + delete newShape[key]; + } + assignProp(this, "shape", newShape); + return newShape; + }, + checks: [] + }); + return clone(schema, def); +} +function extend(schema, shape) { + if (!isPlainObject(shape)) { + throw new Error("Invalid input to extend: expected a plain object"); + } + const checks = schema._zod.def.checks; + const hasChecks = checks && checks.length > 0; + if (hasChecks) { + throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead."); + } + const def = mergeDefs(schema._zod.def, { + get shape() { + const _shape = { ...schema._zod.def.shape, ...shape }; + assignProp(this, "shape", _shape); + return _shape; + }, + checks: [] + }); + return clone(schema, def); +} +function safeExtend(schema, shape) { + if (!isPlainObject(shape)) { + throw new Error("Invalid input to safeExtend: expected a plain object"); + } + const def = { + ...schema._zod.def, + get shape() { + const _shape = { ...schema._zod.def.shape, ...shape }; + assignProp(this, "shape", _shape); + return _shape; + }, + checks: schema._zod.def.checks + }; + return clone(schema, def); +} +function merge(a, b) { + const def = mergeDefs(a._zod.def, { + get shape() { + const _shape = { ...a._zod.def.shape, ...b._zod.def.shape }; + assignProp(this, "shape", _shape); + return _shape; + }, + get catchall() { + return b._zod.def.catchall; + }, + checks: [] + }); + return clone(a, def); +} +function partial(Class, schema, mask) { + const def = mergeDefs(schema._zod.def, { + get shape() { + const oldShape = schema._zod.def.shape; + const shape = { ...oldShape }; + if (mask) { + for (const key in mask) { + if (!(key in oldShape)) { + throw new Error(`Unrecognized key: "${key}"`); + } + if (!mask[key]) + continue; + shape[key] = Class ? new Class({ + type: "optional", + innerType: oldShape[key] + }) : oldShape[key]; + } + } else { + for (const key in oldShape) { + shape[key] = Class ? new Class({ + type: "optional", + innerType: oldShape[key] + }) : oldShape[key]; + } + } + assignProp(this, "shape", shape); + return shape; + }, + checks: [] + }); + return clone(schema, def); +} +function required(Class, schema, mask) { + const def = mergeDefs(schema._zod.def, { + get shape() { + const oldShape = schema._zod.def.shape; + const shape = { ...oldShape }; + if (mask) { + for (const key in mask) { + if (!(key in shape)) { + throw new Error(`Unrecognized key: "${key}"`); + } + if (!mask[key]) + continue; + shape[key] = new Class({ + type: "nonoptional", + innerType: oldShape[key] + }); + } + } else { + for (const key in oldShape) { + shape[key] = new Class({ + type: "nonoptional", + innerType: oldShape[key] + }); + } + } + assignProp(this, "shape", shape); + return shape; + }, + checks: [] + }); + return clone(schema, def); +} +function aborted(x, startIndex = 0) { + if (x.aborted === true) + return true; + for (let i = startIndex;i < x.issues.length; i++) { + if (x.issues[i]?.continue !== true) { + return true; + } + } + return false; +} +function prefixIssues(path2, issues) { + return issues.map((iss) => { + var _a; + (_a = iss).path ?? (_a.path = []); + iss.path.unshift(path2); + return iss; + }); +} +function unwrapMessage(message) { + return typeof message === "string" ? message : message?.message; +} +function finalizeIssue(iss, ctx, config2) { + const full = { ...iss, path: iss.path ?? [] }; + if (!iss.message) { + const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input"; + full.message = message; + } + delete full.inst; + delete full.continue; + if (!ctx?.reportInput) { + delete full.input; + } + return full; +} +function getSizableOrigin(input) { + if (input instanceof Set) + return "set"; + if (input instanceof Map) + return "map"; + if (input instanceof File) + return "file"; + return "unknown"; +} +function getLengthableOrigin(input) { + if (Array.isArray(input)) + return "array"; + if (typeof input === "string") + return "string"; + return "unknown"; +} +function issue(...args) { + const [iss, input, inst] = args; + if (typeof iss === "string") { + return { + message: iss, + code: "custom", + input, + inst + }; + } + return { ...iss }; +} +function cleanEnum(obj) { + return Object.entries(obj).filter(([k, _]) => { + return Number.isNaN(Number.parseInt(k, 10)); + }).map((el) => el[1]); +} +function base64ToUint8Array(base64) { + const binaryString = atob(base64); + const bytes = new Uint8Array(binaryString.length); + for (let i = 0;i < binaryString.length; i++) { + bytes[i] = binaryString.charCodeAt(i); + } + return bytes; +} +function uint8ArrayToBase64(bytes) { + let binaryString = ""; + for (let i = 0;i < bytes.length; i++) { + binaryString += String.fromCharCode(bytes[i]); + } + return btoa(binaryString); +} +function base64urlToUint8Array(base64url) { + const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/"); + const padding = "=".repeat((4 - base64.length % 4) % 4); + return base64ToUint8Array(base64 + padding); +} +function uint8ArrayToBase64url(bytes) { + return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, ""); +} +function hexToUint8Array(hex) { + const cleanHex = hex.replace(/^0x/, ""); + if (cleanHex.length % 2 !== 0) { + throw new Error("Invalid hex string length"); + } + const bytes = new Uint8Array(cleanHex.length / 2); + for (let i = 0;i < cleanHex.length; i += 2) { + bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16); + } + return bytes; +} +function uint8ArrayToHex(bytes) { + return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join(""); +} + +class Class { + constructor(..._args) {} +} + +// node_modules/zod/v4/core/errors.js +var initializer = (inst, def) => { + inst.name = "$ZodError"; + Object.defineProperty(inst, "_zod", { + value: inst._zod, + enumerable: false + }); + Object.defineProperty(inst, "issues", { + value: def, + enumerable: false + }); + inst.message = JSON.stringify(def, jsonStringifyReplacer, 2); + Object.defineProperty(inst, "toString", { + value: () => inst.message, + enumerable: false + }); +}; +var $ZodError = $constructor("$ZodError", initializer); +var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error }); +function flattenError(error, mapper = (issue2) => issue2.message) { + const fieldErrors = {}; + const formErrors = []; + for (const sub of error.issues) { + if (sub.path.length > 0) { + fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || []; + fieldErrors[sub.path[0]].push(mapper(sub)); + } else { + formErrors.push(mapper(sub)); + } + } + return { formErrors, fieldErrors }; +} +function formatError(error, _mapper) { + const mapper = _mapper || function(issue2) { + return issue2.message; + }; + const fieldErrors = { _errors: [] }; + const processError = (error2) => { + for (const issue2 of error2.issues) { + if (issue2.code === "invalid_union" && issue2.errors.length) { + issue2.errors.map((issues) => processError({ issues })); + } else if (issue2.code === "invalid_key") { + processError({ issues: issue2.issues }); + } else if (issue2.code === "invalid_element") { + processError({ issues: issue2.issues }); + } else if (issue2.path.length === 0) { + fieldErrors._errors.push(mapper(issue2)); + } else { + let curr = fieldErrors; + let i = 0; + while (i < issue2.path.length) { + const el = issue2.path[i]; + const terminal = i === issue2.path.length - 1; + if (!terminal) { + curr[el] = curr[el] || { _errors: [] }; + } else { + curr[el] = curr[el] || { _errors: [] }; + curr[el]._errors.push(mapper(issue2)); + } + curr = curr[el]; + i++; + } + } + } + }; + processError(error); + return fieldErrors; +} +function treeifyError(error, _mapper) { + const mapper = _mapper || function(issue2) { + return issue2.message; + }; + const result = { errors: [] }; + const processError = (error2, path2 = []) => { + var _a, _b; + for (const issue2 of error2.issues) { + if (issue2.code === "invalid_union" && issue2.errors.length) { + issue2.errors.map((issues) => processError({ issues }, issue2.path)); + } else if (issue2.code === "invalid_key") { + processError({ issues: issue2.issues }, issue2.path); + } else if (issue2.code === "invalid_element") { + processError({ issues: issue2.issues }, issue2.path); + } else { + const fullpath = [...path2, ...issue2.path]; + if (fullpath.length === 0) { + result.errors.push(mapper(issue2)); + continue; + } + let curr = result; + let i = 0; + while (i < fullpath.length) { + const el = fullpath[i]; + const terminal = i === fullpath.length - 1; + if (typeof el === "string") { + curr.properties ?? (curr.properties = {}); + (_a = curr.properties)[el] ?? (_a[el] = { errors: [] }); + curr = curr.properties[el]; + } else { + curr.items ?? (curr.items = []); + (_b = curr.items)[el] ?? (_b[el] = { errors: [] }); + curr = curr.items[el]; + } + if (terminal) { + curr.errors.push(mapper(issue2)); + } + i++; + } + } + } + }; + processError(error); + return result; +} +function toDotPath(_path) { + const segs = []; + const path2 = _path.map((seg) => typeof seg === "object" ? seg.key : seg); + for (const seg of path2) { + if (typeof seg === "number") + segs.push(`[${seg}]`); + else if (typeof seg === "symbol") + segs.push(`[${JSON.stringify(String(seg))}]`); + else if (/[^\w$]/.test(seg)) + segs.push(`[${JSON.stringify(seg)}]`); + else { + if (segs.length) + segs.push("."); + segs.push(seg); + } + } + return segs.join(""); +} +function prettifyError(error) { + const lines = []; + const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length); + for (const issue2 of issues) { + lines.push(`\u2716 ${issue2.message}`); + if (issue2.path?.length) + lines.push(` \u2192 at ${toDotPath(issue2.path)}`); + } + return lines.join(` +`); +} + +// node_modules/zod/v4/core/parse.js +var _parse = (_Err) => (schema, value, _ctx, _params) => { + const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false }; + const result = schema._zod.run({ value, issues: [] }, ctx); + if (result instanceof Promise) { + throw new $ZodAsyncError; + } + if (result.issues.length) { + const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))); + captureStackTrace(e, _params?.callee); + throw e; + } + return result.value; +}; +var parse = /* @__PURE__ */ _parse($ZodRealError); +var _parseAsync = (_Err) => async (schema, value, _ctx, params) => { + const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true }; + let result = schema._zod.run({ value, issues: [] }, ctx); + if (result instanceof Promise) + result = await result; + if (result.issues.length) { + const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))); + captureStackTrace(e, params?.callee); + throw e; + } + return result.value; +}; +var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError); +var _safeParse = (_Err) => (schema, value, _ctx) => { + const ctx = _ctx ? { ..._ctx, async: false } : { async: false }; + const result = schema._zod.run({ value, issues: [] }, ctx); + if (result instanceof Promise) { + throw new $ZodAsyncError; + } + return result.issues.length ? { + success: false, + error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))) + } : { success: true, data: result.value }; +}; +var safeParse = /* @__PURE__ */ _safeParse($ZodRealError); +var _safeParseAsync = (_Err) => async (schema, value, _ctx) => { + const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true }; + let result = schema._zod.run({ value, issues: [] }, ctx); + if (result instanceof Promise) + result = await result; + return result.issues.length ? { + success: false, + error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))) + } : { success: true, data: result.value }; +}; +var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError); +var _encode = (_Err) => (schema, value, _ctx) => { + const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" }; + return _parse(_Err)(schema, value, ctx); +}; +var encode = /* @__PURE__ */ _encode($ZodRealError); +var _decode = (_Err) => (schema, value, _ctx) => { + return _parse(_Err)(schema, value, _ctx); +}; +var decode = /* @__PURE__ */ _decode($ZodRealError); +var _encodeAsync = (_Err) => async (schema, value, _ctx) => { + const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" }; + return _parseAsync(_Err)(schema, value, ctx); +}; +var encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError); +var _decodeAsync = (_Err) => async (schema, value, _ctx) => { + return _parseAsync(_Err)(schema, value, _ctx); +}; +var decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError); +var _safeEncode = (_Err) => (schema, value, _ctx) => { + const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" }; + return _safeParse(_Err)(schema, value, ctx); +}; +var safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError); +var _safeDecode = (_Err) => (schema, value, _ctx) => { + return _safeParse(_Err)(schema, value, _ctx); +}; +var safeDecode = /* @__PURE__ */ _safeDecode($ZodRealError); +var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => { + const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" }; + return _safeParseAsync(_Err)(schema, value, ctx); +}; +var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError); +var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => { + return _safeParseAsync(_Err)(schema, value, _ctx); +}; +var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError); +// node_modules/zod/v4/core/regexes.js +var exports_regexes = {}; +__export(exports_regexes, { + xid: () => xid, + uuid7: () => uuid7, + uuid6: () => uuid6, + uuid4: () => uuid4, + uuid: () => uuid, + uppercase: () => uppercase, + unicodeEmail: () => unicodeEmail, + undefined: () => _undefined, + ulid: () => ulid, + time: () => time, + string: () => string, + sha512_hex: () => sha512_hex, + sha512_base64url: () => sha512_base64url, + sha512_base64: () => sha512_base64, + sha384_hex: () => sha384_hex, + sha384_base64url: () => sha384_base64url, + sha384_base64: () => sha384_base64, + sha256_hex: () => sha256_hex, + sha256_base64url: () => sha256_base64url, + sha256_base64: () => sha256_base64, + sha1_hex: () => sha1_hex, + sha1_base64url: () => sha1_base64url, + sha1_base64: () => sha1_base64, + rfc5322Email: () => rfc5322Email, + number: () => number, + null: () => _null, + nanoid: () => nanoid, + md5_hex: () => md5_hex, + md5_base64url: () => md5_base64url, + md5_base64: () => md5_base64, + lowercase: () => lowercase, + ksuid: () => ksuid, + ipv6: () => ipv6, + ipv4: () => ipv4, + integer: () => integer, + idnEmail: () => idnEmail, + html5Email: () => html5Email, + hostname: () => hostname, + hex: () => hex, + guid: () => guid, + extendedDuration: () => extendedDuration, + emoji: () => emoji, + email: () => email, + e164: () => e164, + duration: () => duration, + domain: () => domain, + datetime: () => datetime, + date: () => date, + cuid2: () => cuid2, + cuid: () => cuid, + cidrv6: () => cidrv6, + cidrv4: () => cidrv4, + browserEmail: () => browserEmail, + boolean: () => boolean, + bigint: () => bigint, + base64url: () => base64url, + base64: () => base64 +}); +var cuid = /^[cC][^\s-]{8,}$/; +var cuid2 = /^[0-9a-z]+$/; +var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/; +var xid = /^[0-9a-vA-V]{20}$/; +var ksuid = /^[A-Za-z0-9]{27}$/; +var nanoid = /^[a-zA-Z0-9_-]{21}$/; +var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/; +var extendedDuration = /^[-+]?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)?)??$/; +var guid = /^([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})$/; +var uuid = (version) => { + if (!version) + return /^([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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/; + return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`); +}; +var uuid4 = /* @__PURE__ */ uuid(4); +var uuid6 = /* @__PURE__ */ uuid(6); +var uuid7 = /* @__PURE__ */ uuid(7); +var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/; +var html5Email = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; +var rfc5322Email = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; +var unicodeEmail = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u; +var idnEmail = unicodeEmail; +var browserEmail = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; +var _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`; +function emoji() { + return new RegExp(_emoji, "u"); +} +var ipv4 = /^(?:(?: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])$/; +var ipv6 = /^(([0-9a-fA-F]{1,4}:){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}|:))$/; +var cidrv4 = /^((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])$/; +var cidrv6 = /^(([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])$/; +var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/; +var base64url = /^[A-Za-z0-9_-]*$/; +var hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/; +var domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/; +var e164 = /^\+(?:[0-9]){6,14}[0-9]$/; +var dateSource = `(?:(?:\\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])))`; +var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`); +function timeSource(args) { + const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`; + const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`; + return regex; +} +function time(args) { + return new RegExp(`^${timeSource(args)}$`); +} +function datetime(args) { + const time2 = timeSource({ precision: args.precision }); + const opts = ["Z"]; + if (args.local) + opts.push(""); + if (args.offset) + opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`); + const timeRegex = `${time2}(?:${opts.join("|")})`; + return new RegExp(`^${dateSource}T(?:${timeRegex})$`); +} +var string = (params) => { + const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`; + return new RegExp(`^${regex}$`); +}; +var bigint = /^-?\d+n?$/; +var integer = /^-?\d+$/; +var number = /^-?\d+(?:\.\d+)?/; +var boolean = /^(?:true|false)$/i; +var _null = /^null$/i; +var _undefined = /^undefined$/i; +var lowercase = /^[^A-Z]*$/; +var uppercase = /^[^a-z]*$/; +var hex = /^[0-9a-fA-F]*$/; +function fixedBase64(bodyLength, padding) { + return new RegExp(`^[A-Za-z0-9+/]{${bodyLength}}${padding}$`); +} +function fixedBase64url(length) { + return new RegExp(`^[A-Za-z0-9_-]{${length}}$`); +} +var md5_hex = /^[0-9a-fA-F]{32}$/; +var md5_base64 = /* @__PURE__ */ fixedBase64(22, "=="); +var md5_base64url = /* @__PURE__ */ fixedBase64url(22); +var sha1_hex = /^[0-9a-fA-F]{40}$/; +var sha1_base64 = /* @__PURE__ */ fixedBase64(27, "="); +var sha1_base64url = /* @__PURE__ */ fixedBase64url(27); +var sha256_hex = /^[0-9a-fA-F]{64}$/; +var sha256_base64 = /* @__PURE__ */ fixedBase64(43, "="); +var sha256_base64url = /* @__PURE__ */ fixedBase64url(43); +var sha384_hex = /^[0-9a-fA-F]{96}$/; +var sha384_base64 = /* @__PURE__ */ fixedBase64(64, ""); +var sha384_base64url = /* @__PURE__ */ fixedBase64url(64); +var sha512_hex = /^[0-9a-fA-F]{128}$/; +var sha512_base64 = /* @__PURE__ */ fixedBase64(86, "=="); +var sha512_base64url = /* @__PURE__ */ fixedBase64url(86); + +// node_modules/zod/v4/core/checks.js +var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => { + var _a; + inst._zod ?? (inst._zod = {}); + inst._zod.def = def; + (_a = inst._zod).onattach ?? (_a.onattach = []); +}); +var numericOriginMap = { + number: "number", + bigint: "bigint", + object: "date" +}; +var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => { + $ZodCheck.init(inst, def); + const origin = numericOriginMap[typeof def.value]; + inst._zod.onattach.push((inst2) => { + const bag = inst2._zod.bag; + const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY; + if (def.value < curr) { + if (def.inclusive) + bag.maximum = def.value; + else + bag.exclusiveMaximum = def.value; + } + }); + inst._zod.check = (payload) => { + if (def.inclusive ? payload.value <= def.value : payload.value < def.value) { + return; + } + payload.issues.push({ + origin, + code: "too_big", + maximum: def.value, + input: payload.value, + inclusive: def.inclusive, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => { + $ZodCheck.init(inst, def); + const origin = numericOriginMap[typeof def.value]; + inst._zod.onattach.push((inst2) => { + const bag = inst2._zod.bag; + const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY; + if (def.value > curr) { + if (def.inclusive) + bag.minimum = def.value; + else + bag.exclusiveMinimum = def.value; + } + }); + inst._zod.check = (payload) => { + if (def.inclusive ? payload.value >= def.value : payload.value > def.value) { + return; + } + payload.issues.push({ + origin, + code: "too_small", + minimum: def.value, + input: payload.value, + inclusive: def.inclusive, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => { + $ZodCheck.init(inst, def); + inst._zod.onattach.push((inst2) => { + var _a; + (_a = inst2._zod.bag).multipleOf ?? (_a.multipleOf = def.value); + }); + inst._zod.check = (payload) => { + if (typeof payload.value !== typeof def.value) + throw new Error("Cannot mix number and bigint in multiple_of check."); + const isMultiple = typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0; + if (isMultiple) + return; + payload.issues.push({ + origin: typeof payload.value, + code: "not_multiple_of", + divisor: def.value, + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => { + $ZodCheck.init(inst, def); + def.format = def.format || "float64"; + const isInt = def.format?.includes("int"); + const origin = isInt ? "int" : "number"; + const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format]; + inst._zod.onattach.push((inst2) => { + const bag = inst2._zod.bag; + bag.format = def.format; + bag.minimum = minimum; + bag.maximum = maximum; + if (isInt) + bag.pattern = integer; + }); + inst._zod.check = (payload) => { + const input = payload.value; + if (isInt) { + if (!Number.isInteger(input)) { + payload.issues.push({ + expected: origin, + format: def.format, + code: "invalid_type", + continue: false, + input, + inst + }); + return; + } + if (!Number.isSafeInteger(input)) { + if (input > 0) { + payload.issues.push({ + input, + code: "too_big", + maximum: Number.MAX_SAFE_INTEGER, + note: "Integers must be within the safe integer range.", + inst, + origin, + continue: !def.abort + }); + } else { + payload.issues.push({ + input, + code: "too_small", + minimum: Number.MIN_SAFE_INTEGER, + note: "Integers must be within the safe integer range.", + inst, + origin, + continue: !def.abort + }); + } + return; + } + } + if (input < minimum) { + payload.issues.push({ + origin: "number", + input, + code: "too_small", + minimum, + inclusive: true, + inst, + continue: !def.abort + }); + } + if (input > maximum) { + payload.issues.push({ + origin: "number", + input, + code: "too_big", + maximum, + inst + }); + } + }; +}); +var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat", (inst, def) => { + $ZodCheck.init(inst, def); + const [minimum, maximum] = BIGINT_FORMAT_RANGES[def.format]; + inst._zod.onattach.push((inst2) => { + const bag = inst2._zod.bag; + bag.format = def.format; + bag.minimum = minimum; + bag.maximum = maximum; + }); + inst._zod.check = (payload) => { + const input = payload.value; + if (input < minimum) { + payload.issues.push({ + origin: "bigint", + input, + code: "too_small", + minimum, + inclusive: true, + inst, + continue: !def.abort + }); + } + if (input > maximum) { + payload.issues.push({ + origin: "bigint", + input, + code: "too_big", + maximum, + inst + }); + } + }; +}); +var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, def) => { + var _a; + $ZodCheck.init(inst, def); + (_a = inst._zod.def).when ?? (_a.when = (payload) => { + const val = payload.value; + return !nullish(val) && val.size !== undefined; + }); + inst._zod.onattach.push((inst2) => { + const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY; + if (def.maximum < curr) + inst2._zod.bag.maximum = def.maximum; + }); + inst._zod.check = (payload) => { + const input = payload.value; + const size = input.size; + if (size <= def.maximum) + return; + payload.issues.push({ + origin: getSizableOrigin(input), + code: "too_big", + maximum: def.maximum, + inclusive: true, + input, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, def) => { + var _a; + $ZodCheck.init(inst, def); + (_a = inst._zod.def).when ?? (_a.when = (payload) => { + const val = payload.value; + return !nullish(val) && val.size !== undefined; + }); + inst._zod.onattach.push((inst2) => { + const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY; + if (def.minimum > curr) + inst2._zod.bag.minimum = def.minimum; + }); + inst._zod.check = (payload) => { + const input = payload.value; + const size = input.size; + if (size >= def.minimum) + return; + payload.issues.push({ + origin: getSizableOrigin(input), + code: "too_small", + minimum: def.minimum, + inclusive: true, + input, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (inst, def) => { + var _a; + $ZodCheck.init(inst, def); + (_a = inst._zod.def).when ?? (_a.when = (payload) => { + const val = payload.value; + return !nullish(val) && val.size !== undefined; + }); + inst._zod.onattach.push((inst2) => { + const bag = inst2._zod.bag; + bag.minimum = def.size; + bag.maximum = def.size; + bag.size = def.size; + }); + inst._zod.check = (payload) => { + const input = payload.value; + const size = input.size; + if (size === def.size) + return; + const tooBig = size > def.size; + payload.issues.push({ + origin: getSizableOrigin(input), + ...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size }, + inclusive: true, + exact: true, + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => { + var _a; + $ZodCheck.init(inst, def); + (_a = inst._zod.def).when ?? (_a.when = (payload) => { + const val = payload.value; + return !nullish(val) && val.length !== undefined; + }); + inst._zod.onattach.push((inst2) => { + const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY; + if (def.maximum < curr) + inst2._zod.bag.maximum = def.maximum; + }); + inst._zod.check = (payload) => { + const input = payload.value; + const length = input.length; + if (length <= def.maximum) + return; + const origin = getLengthableOrigin(input); + payload.issues.push({ + origin, + code: "too_big", + maximum: def.maximum, + inclusive: true, + input, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => { + var _a; + $ZodCheck.init(inst, def); + (_a = inst._zod.def).when ?? (_a.when = (payload) => { + const val = payload.value; + return !nullish(val) && val.length !== undefined; + }); + inst._zod.onattach.push((inst2) => { + const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY; + if (def.minimum > curr) + inst2._zod.bag.minimum = def.minimum; + }); + inst._zod.check = (payload) => { + const input = payload.value; + const length = input.length; + if (length >= def.minimum) + return; + const origin = getLengthableOrigin(input); + payload.issues.push({ + origin, + code: "too_small", + minimum: def.minimum, + inclusive: true, + input, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => { + var _a; + $ZodCheck.init(inst, def); + (_a = inst._zod.def).when ?? (_a.when = (payload) => { + const val = payload.value; + return !nullish(val) && val.length !== undefined; + }); + inst._zod.onattach.push((inst2) => { + const bag = inst2._zod.bag; + bag.minimum = def.length; + bag.maximum = def.length; + bag.length = def.length; + }); + inst._zod.check = (payload) => { + const input = payload.value; + const length = input.length; + if (length === def.length) + return; + const origin = getLengthableOrigin(input); + const tooBig = length > def.length; + payload.issues.push({ + origin, + ...tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length }, + inclusive: true, + exact: true, + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => { + var _a, _b; + $ZodCheck.init(inst, def); + inst._zod.onattach.push((inst2) => { + const bag = inst2._zod.bag; + bag.format = def.format; + if (def.pattern) { + bag.patterns ?? (bag.patterns = new Set); + bag.patterns.add(def.pattern); + } + }); + if (def.pattern) + (_a = inst._zod).check ?? (_a.check = (payload) => { + def.pattern.lastIndex = 0; + if (def.pattern.test(payload.value)) + return; + payload.issues.push({ + origin: "string", + code: "invalid_format", + format: def.format, + input: payload.value, + ...def.pattern ? { pattern: def.pattern.toString() } : {}, + inst, + continue: !def.abort + }); + }); + else + (_b = inst._zod).check ?? (_b.check = () => {}); +}); +var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => { + $ZodCheckStringFormat.init(inst, def); + inst._zod.check = (payload) => { + def.pattern.lastIndex = 0; + if (def.pattern.test(payload.value)) + return; + payload.issues.push({ + origin: "string", + code: "invalid_format", + format: "regex", + input: payload.value, + pattern: def.pattern.toString(), + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => { + def.pattern ?? (def.pattern = lowercase); + $ZodCheckStringFormat.init(inst, def); +}); +var $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => { + def.pattern ?? (def.pattern = uppercase); + $ZodCheckStringFormat.init(inst, def); +}); +var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => { + $ZodCheck.init(inst, def); + const escapedRegex = escapeRegex(def.includes); + const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex); + def.pattern = pattern; + inst._zod.onattach.push((inst2) => { + const bag = inst2._zod.bag; + bag.patterns ?? (bag.patterns = new Set); + bag.patterns.add(pattern); + }); + inst._zod.check = (payload) => { + if (payload.value.includes(def.includes, def.position)) + return; + payload.issues.push({ + origin: "string", + code: "invalid_format", + format: "includes", + includes: def.includes, + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => { + $ZodCheck.init(inst, def); + const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`); + def.pattern ?? (def.pattern = pattern); + inst._zod.onattach.push((inst2) => { + const bag = inst2._zod.bag; + bag.patterns ?? (bag.patterns = new Set); + bag.patterns.add(pattern); + }); + inst._zod.check = (payload) => { + if (payload.value.startsWith(def.prefix)) + return; + payload.issues.push({ + origin: "string", + code: "invalid_format", + format: "starts_with", + prefix: def.prefix, + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => { + $ZodCheck.init(inst, def); + const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`); + def.pattern ?? (def.pattern = pattern); + inst._zod.onattach.push((inst2) => { + const bag = inst2._zod.bag; + bag.patterns ?? (bag.patterns = new Set); + bag.patterns.add(pattern); + }); + inst._zod.check = (payload) => { + if (payload.value.endsWith(def.suffix)) + return; + payload.issues.push({ + origin: "string", + code: "invalid_format", + format: "ends_with", + suffix: def.suffix, + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +function handleCheckPropertyResult(result, payload, property) { + if (result.issues.length) { + payload.issues.push(...prefixIssues(property, result.issues)); + } +} +var $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst, def) => { + $ZodCheck.init(inst, def); + inst._zod.check = (payload) => { + const result = def.schema._zod.run({ + value: payload.value[def.property], + issues: [] + }, {}); + if (result instanceof Promise) { + return result.then((result2) => handleCheckPropertyResult(result2, payload, def.property)); + } + handleCheckPropertyResult(result, payload, def.property); + return; + }; +}); +var $ZodCheckMimeType = /* @__PURE__ */ $constructor("$ZodCheckMimeType", (inst, def) => { + $ZodCheck.init(inst, def); + const mimeSet = new Set(def.mime); + inst._zod.onattach.push((inst2) => { + inst2._zod.bag.mime = def.mime; + }); + inst._zod.check = (payload) => { + if (mimeSet.has(payload.value.type)) + return; + payload.issues.push({ + code: "invalid_value", + values: def.mime, + input: payload.value.type, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => { + $ZodCheck.init(inst, def); + inst._zod.check = (payload) => { + payload.value = def.tx(payload.value); + }; +}); + +// node_modules/zod/v4/core/doc.js +class Doc { + constructor(args = []) { + this.content = []; + this.indent = 0; + if (this) + this.args = args; + } + indented(fn) { + this.indent += 1; + fn(this); + this.indent -= 1; + } + write(arg) { + if (typeof arg === "function") { + arg(this, { execution: "sync" }); + arg(this, { execution: "async" }); + return; + } + const content = arg; + const lines = content.split(` +`).filter((x) => x); + const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length)); + const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x); + for (const line of dedented) { + this.content.push(line); + } + } + compile() { + const F = Function; + const args = this?.args; + const content = this?.content ?? [``]; + const lines = [...content.map((x) => ` ${x}`)]; + return new F(...args, lines.join(` +`)); + } +} + +// node_modules/zod/v4/core/versions.js +var version = { + major: 4, + minor: 1, + patch: 8 +}; + +// node_modules/zod/v4/core/schemas.js +var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => { + var _a; + inst ?? (inst = {}); + inst._zod.def = def; + inst._zod.bag = inst._zod.bag || {}; + inst._zod.version = version; + const checks = [...inst._zod.def.checks ?? []]; + if (inst._zod.traits.has("$ZodCheck")) { + checks.unshift(inst); + } + for (const ch of checks) { + for (const fn of ch._zod.onattach) { + fn(inst); + } + } + if (checks.length === 0) { + (_a = inst._zod).deferred ?? (_a.deferred = []); + inst._zod.deferred?.push(() => { + inst._zod.run = inst._zod.parse; + }); + } else { + const runChecks = (payload, checks2, ctx) => { + let isAborted = aborted(payload); + let asyncResult; + for (const ch of checks2) { + if (ch._zod.def.when) { + const shouldRun = ch._zod.def.when(payload); + if (!shouldRun) + continue; + } else if (isAborted) { + continue; + } + const currLen = payload.issues.length; + const _ = ch._zod.check(payload); + if (_ instanceof Promise && ctx?.async === false) { + throw new $ZodAsyncError; + } + if (asyncResult || _ instanceof Promise) { + asyncResult = (asyncResult ?? Promise.resolve()).then(async () => { + await _; + const nextLen = payload.issues.length; + if (nextLen === currLen) + return; + if (!isAborted) + isAborted = aborted(payload, currLen); + }); + } else { + const nextLen = payload.issues.length; + if (nextLen === currLen) + continue; + if (!isAborted) + isAborted = aborted(payload, currLen); + } + } + if (asyncResult) { + return asyncResult.then(() => { + return payload; + }); + } + return payload; + }; + const handleCanaryResult = (canary, payload, ctx) => { + if (aborted(canary)) { + canary.aborted = true; + return canary; + } + const checkResult = runChecks(payload, checks, ctx); + if (checkResult instanceof Promise) { + if (ctx.async === false) + throw new $ZodAsyncError; + return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx)); + } + return inst._zod.parse(checkResult, ctx); + }; + inst._zod.run = (payload, ctx) => { + if (ctx.skipChecks) { + return inst._zod.parse(payload, ctx); + } + if (ctx.direction === "backward") { + const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true }); + if (canary instanceof Promise) { + return canary.then((canary2) => { + return handleCanaryResult(canary2, payload, ctx); + }); + } + return handleCanaryResult(canary, payload, ctx); + } + const result = inst._zod.parse(payload, ctx); + if (result instanceof Promise) { + if (ctx.async === false) + throw new $ZodAsyncError; + return result.then((result2) => runChecks(result2, checks, ctx)); + } + return runChecks(result, checks, ctx); + }; + } + inst["~standard"] = { + validate: (value) => { + try { + const r = safeParse(inst, value); + return r.success ? { value: r.data } : { issues: r.error?.issues }; + } catch (_) { + return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues }); + } + }, + vendor: "zod", + version: 1 + }; +}); +var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag); + inst._zod.parse = (payload, _) => { + if (def.coerce) + try { + payload.value = String(payload.value); + } catch (_2) {} + if (typeof payload.value === "string") + return payload; + payload.issues.push({ + expected: "string", + code: "invalid_type", + input: payload.value, + inst + }); + return payload; + }; +}); +var $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => { + $ZodCheckStringFormat.init(inst, def); + $ZodString.init(inst, def); +}); +var $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => { + def.pattern ?? (def.pattern = guid); + $ZodStringFormat.init(inst, def); +}); +var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => { + if (def.version) { + const versionMap = { + v1: 1, + v2: 2, + v3: 3, + v4: 4, + v5: 5, + v6: 6, + v7: 7, + v8: 8 + }; + const v = versionMap[def.version]; + if (v === undefined) + throw new Error(`Invalid UUID version: "${def.version}"`); + def.pattern ?? (def.pattern = uuid(v)); + } else + def.pattern ?? (def.pattern = uuid()); + $ZodStringFormat.init(inst, def); +}); +var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => { + def.pattern ?? (def.pattern = email); + $ZodStringFormat.init(inst, def); +}); +var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => { + $ZodStringFormat.init(inst, def); + inst._zod.check = (payload) => { + try { + const trimmed = payload.value.trim(); + const url = new URL(trimmed); + if (def.hostname) { + def.hostname.lastIndex = 0; + if (!def.hostname.test(url.hostname)) { + payload.issues.push({ + code: "invalid_format", + format: "url", + note: "Invalid hostname", + pattern: hostname.source, + input: payload.value, + inst, + continue: !def.abort + }); + } + } + if (def.protocol) { + def.protocol.lastIndex = 0; + if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) { + payload.issues.push({ + code: "invalid_format", + format: "url", + note: "Invalid protocol", + pattern: def.protocol.source, + input: payload.value, + inst, + continue: !def.abort + }); + } + } + if (def.normalize) { + payload.value = url.href; + } else { + payload.value = trimmed; + } + return; + } catch (_) { + payload.issues.push({ + code: "invalid_format", + format: "url", + input: payload.value, + inst, + continue: !def.abort + }); + } + }; +}); +var $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => { + def.pattern ?? (def.pattern = emoji()); + $ZodStringFormat.init(inst, def); +}); +var $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => { + def.pattern ?? (def.pattern = nanoid); + $ZodStringFormat.init(inst, def); +}); +var $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => { + def.pattern ?? (def.pattern = cuid); + $ZodStringFormat.init(inst, def); +}); +var $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => { + def.pattern ?? (def.pattern = cuid2); + $ZodStringFormat.init(inst, def); +}); +var $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => { + def.pattern ?? (def.pattern = ulid); + $ZodStringFormat.init(inst, def); +}); +var $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => { + def.pattern ?? (def.pattern = xid); + $ZodStringFormat.init(inst, def); +}); +var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => { + def.pattern ?? (def.pattern = ksuid); + $ZodStringFormat.init(inst, def); +}); +var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => { + def.pattern ?? (def.pattern = datetime(def)); + $ZodStringFormat.init(inst, def); +}); +var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => { + def.pattern ?? (def.pattern = date); + $ZodStringFormat.init(inst, def); +}); +var $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => { + def.pattern ?? (def.pattern = time(def)); + $ZodStringFormat.init(inst, def); +}); +var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => { + def.pattern ?? (def.pattern = duration); + $ZodStringFormat.init(inst, def); +}); +var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => { + def.pattern ?? (def.pattern = ipv4); + $ZodStringFormat.init(inst, def); + inst._zod.onattach.push((inst2) => { + const bag = inst2._zod.bag; + bag.format = `ipv4`; + }); +}); +var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => { + def.pattern ?? (def.pattern = ipv6); + $ZodStringFormat.init(inst, def); + inst._zod.onattach.push((inst2) => { + const bag = inst2._zod.bag; + bag.format = `ipv6`; + }); + inst._zod.check = (payload) => { + try { + new URL(`http://[${payload.value}]`); + } catch { + payload.issues.push({ + code: "invalid_format", + format: "ipv6", + input: payload.value, + inst, + continue: !def.abort + }); + } + }; +}); +var $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => { + def.pattern ?? (def.pattern = cidrv4); + $ZodStringFormat.init(inst, def); +}); +var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => { + def.pattern ?? (def.pattern = cidrv6); + $ZodStringFormat.init(inst, def); + inst._zod.check = (payload) => { + const parts = payload.value.split("/"); + try { + if (parts.length !== 2) + throw new Error; + const [address, prefix] = parts; + if (!prefix) + throw new Error; + const prefixNum = Number(prefix); + if (`${prefixNum}` !== prefix) + throw new Error; + if (prefixNum < 0 || prefixNum > 128) + throw new Error; + new URL(`http://[${address}]`); + } catch { + payload.issues.push({ + code: "invalid_format", + format: "cidrv6", + input: payload.value, + inst, + continue: !def.abort + }); + } + }; +}); +function isValidBase64(data) { + if (data === "") + return true; + if (data.length % 4 !== 0) + return false; + try { + atob(data); + return true; + } catch { + return false; + } +} +var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => { + def.pattern ?? (def.pattern = base64); + $ZodStringFormat.init(inst, def); + inst._zod.onattach.push((inst2) => { + inst2._zod.bag.contentEncoding = "base64"; + }); + inst._zod.check = (payload) => { + if (isValidBase64(payload.value)) + return; + payload.issues.push({ + code: "invalid_format", + format: "base64", + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +function isValidBase64URL(data) { + if (!base64url.test(data)) + return false; + const base642 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/"); + const padded = base642.padEnd(Math.ceil(base642.length / 4) * 4, "="); + return isValidBase64(padded); +} +var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => { + def.pattern ?? (def.pattern = base64url); + $ZodStringFormat.init(inst, def); + inst._zod.onattach.push((inst2) => { + inst2._zod.bag.contentEncoding = "base64url"; + }); + inst._zod.check = (payload) => { + if (isValidBase64URL(payload.value)) + return; + payload.issues.push({ + code: "invalid_format", + format: "base64url", + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => { + def.pattern ?? (def.pattern = e164); + $ZodStringFormat.init(inst, def); +}); +function isValidJWT(token, algorithm = null) { + try { + const tokensParts = token.split("."); + if (tokensParts.length !== 3) + return false; + const [header] = tokensParts; + if (!header) + return false; + const parsedHeader = JSON.parse(atob(header)); + if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") + return false; + if (!parsedHeader.alg) + return false; + if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) + return false; + return true; + } catch { + return false; + } +} +var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => { + $ZodStringFormat.init(inst, def); + inst._zod.check = (payload) => { + if (isValidJWT(payload.value, def.alg)) + return; + payload.issues.push({ + code: "invalid_format", + format: "jwt", + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCustomStringFormat = /* @__PURE__ */ $constructor("$ZodCustomStringFormat", (inst, def) => { + $ZodStringFormat.init(inst, def); + inst._zod.check = (payload) => { + if (def.fn(payload.value)) + return; + payload.issues.push({ + code: "invalid_format", + format: def.format, + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.pattern = inst._zod.bag.pattern ?? number; + inst._zod.parse = (payload, _ctx) => { + if (def.coerce) + try { + payload.value = Number(payload.value); + } catch (_) {} + const input = payload.value; + if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) { + return payload; + } + const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : undefined : undefined; + payload.issues.push({ + expected: "number", + code: "invalid_type", + input, + inst, + ...received ? { received } : {} + }); + return payload; + }; +}); +var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => { + $ZodCheckNumberFormat.init(inst, def); + $ZodNumber.init(inst, def); +}); +var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.pattern = boolean; + inst._zod.parse = (payload, _ctx) => { + if (def.coerce) + try { + payload.value = Boolean(payload.value); + } catch (_) {} + const input = payload.value; + if (typeof input === "boolean") + return payload; + payload.issues.push({ + expected: "boolean", + code: "invalid_type", + input, + inst + }); + return payload; + }; +}); +var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.pattern = bigint; + inst._zod.parse = (payload, _ctx) => { + if (def.coerce) + try { + payload.value = BigInt(payload.value); + } catch (_) {} + if (typeof payload.value === "bigint") + return payload; + payload.issues.push({ + expected: "bigint", + code: "invalid_type", + input: payload.value, + inst + }); + return payload; + }; +}); +var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => { + $ZodCheckBigIntFormat.init(inst, def); + $ZodBigInt.init(inst, def); +}); +var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, _ctx) => { + const input = payload.value; + if (typeof input === "symbol") + return payload; + payload.issues.push({ + expected: "symbol", + code: "invalid_type", + input, + inst + }); + return payload; + }; +}); +var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.pattern = _undefined; + inst._zod.values = new Set([undefined]); + inst._zod.optin = "optional"; + inst._zod.optout = "optional"; + inst._zod.parse = (payload, _ctx) => { + const input = payload.value; + if (typeof input === "undefined") + return payload; + payload.issues.push({ + expected: "undefined", + code: "invalid_type", + input, + inst + }); + return payload; + }; +}); +var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.pattern = _null; + inst._zod.values = new Set([null]); + inst._zod.parse = (payload, _ctx) => { + const input = payload.value; + if (input === null) + return payload; + payload.issues.push({ + expected: "null", + code: "invalid_type", + input, + inst + }); + return payload; + }; +}); +var $ZodAny = /* @__PURE__ */ $constructor("$ZodAny", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload) => payload; +}); +var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload) => payload; +}); +var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, _ctx) => { + payload.issues.push({ + expected: "never", + code: "invalid_type", + input: payload.value, + inst + }); + return payload; + }; +}); +var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, _ctx) => { + const input = payload.value; + if (typeof input === "undefined") + return payload; + payload.issues.push({ + expected: "void", + code: "invalid_type", + input, + inst + }); + return payload; + }; +}); +var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, _ctx) => { + if (def.coerce) { + try { + payload.value = new Date(payload.value); + } catch (_err) {} + } + const input = payload.value; + const isDate = input instanceof Date; + const isValidDate = isDate && !Number.isNaN(input.getTime()); + if (isValidDate) + return payload; + payload.issues.push({ + expected: "date", + code: "invalid_type", + input, + ...isDate ? { received: "Invalid Date" } : {}, + inst + }); + return payload; + }; +}); +function handleArrayResult(result, final, index) { + if (result.issues.length) { + final.issues.push(...prefixIssues(index, result.issues)); + } + final.value[index] = result.value; +} +var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, ctx) => { + const input = payload.value; + if (!Array.isArray(input)) { + payload.issues.push({ + expected: "array", + code: "invalid_type", + input, + inst + }); + return payload; + } + payload.value = Array(input.length); + const proms = []; + for (let i = 0;i < input.length; i++) { + const item = input[i]; + const result = def.element._zod.run({ + value: item, + issues: [] + }, ctx); + if (result instanceof Promise) { + proms.push(result.then((result2) => handleArrayResult(result2, payload, i))); + } else { + handleArrayResult(result, payload, i); + } + } + if (proms.length) { + return Promise.all(proms).then(() => payload); + } + return payload; + }; +}); +function handlePropertyResult(result, final, key, input) { + if (result.issues.length) { + final.issues.push(...prefixIssues(key, result.issues)); + } + if (result.value === undefined) { + if (key in input) { + final.value[key] = undefined; + } + } else { + final.value[key] = result.value; + } +} +function normalizeDef(def) { + const keys = Object.keys(def.shape); + for (const k of keys) { + if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) { + throw new Error(`Invalid element at key "${k}": expected a Zod schema`); + } + } + const okeys = optionalKeys(def.shape); + return { + ...def, + keys, + keySet: new Set(keys), + numKeys: keys.length, + optionalKeys: new Set(okeys) + }; +} +function handleCatchall(proms, input, payload, ctx, def, inst) { + const unrecognized = []; + const keySet = def.keySet; + const _catchall = def.catchall._zod; + const t = _catchall.def.type; + for (const key of Object.keys(input)) { + if (keySet.has(key)) + continue; + if (t === "never") { + unrecognized.push(key); + continue; + } + const r = _catchall.run({ value: input[key], issues: [] }, ctx); + if (r instanceof Promise) { + proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input))); + } else { + handlePropertyResult(r, payload, key, input); + } + } + if (unrecognized.length) { + payload.issues.push({ + code: "unrecognized_keys", + keys: unrecognized, + input, + inst + }); + } + if (!proms.length) + return payload; + return Promise.all(proms).then(() => { + return payload; + }); +} +var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => { + $ZodType.init(inst, def); + const _normalized = cached(() => normalizeDef(def)); + defineLazy(inst._zod, "propValues", () => { + const shape = def.shape; + const propValues = {}; + for (const key in shape) { + const field = shape[key]._zod; + if (field.values) { + propValues[key] ?? (propValues[key] = new Set); + for (const v of field.values) + propValues[key].add(v); + } + } + return propValues; + }); + const isObject2 = isObject; + const catchall = def.catchall; + let value; + inst._zod.parse = (payload, ctx) => { + value ?? (value = _normalized.value); + const input = payload.value; + if (!isObject2(input)) { + payload.issues.push({ + expected: "object", + code: "invalid_type", + input, + inst + }); + return payload; + } + payload.value = {}; + const proms = []; + const shape = value.shape; + for (const key of value.keys) { + const el = shape[key]; + const r = el._zod.run({ value: input[key], issues: [] }, ctx); + if (r instanceof Promise) { + proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input))); + } else { + handlePropertyResult(r, payload, key, input); + } + } + if (!catchall) { + return proms.length ? Promise.all(proms).then(() => payload) : payload; + } + return handleCatchall(proms, input, payload, ctx, _normalized.value, inst); + }; +}); +var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => { + $ZodObject.init(inst, def); + const superParse = inst._zod.parse; + const _normalized = cached(() => normalizeDef(def)); + const generateFastpass = (shape) => { + const doc = new Doc(["shape", "payload", "ctx"]); + const normalized = _normalized.value; + const parseStr = (key) => { + const k = esc(key); + return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`; + }; + doc.write(`const input = payload.value;`); + const ids = Object.create(null); + let counter = 0; + for (const key of normalized.keys) { + ids[key] = `key_${counter++}`; + } + doc.write(`const newResult = {};`); + for (const key of normalized.keys) { + const id = ids[key]; + const k = esc(key); + doc.write(`const ${id} = ${parseStr(key)};`); + doc.write(` + if (${id}.issues.length) { + payload.issues = payload.issues.concat(${id}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${k}, ...iss.path] : [${k}] + }))); + } + + + if (${id}.value === undefined) { + if (${k} in input) { + newResult[${k}] = undefined; + } + } else { + newResult[${k}] = ${id}.value; + } + + `); + } + doc.write(`payload.value = newResult;`); + doc.write(`return payload;`); + const fn = doc.compile(); + return (payload, ctx) => fn(shape, payload, ctx); + }; + let fastpass; + const isObject2 = isObject; + const jit = !globalConfig.jitless; + const allowsEval2 = allowsEval; + const fastEnabled = jit && allowsEval2.value; + const catchall = def.catchall; + let value; + inst._zod.parse = (payload, ctx) => { + value ?? (value = _normalized.value); + const input = payload.value; + if (!isObject2(input)) { + payload.issues.push({ + expected: "object", + code: "invalid_type", + input, + inst + }); + return payload; + } + if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) { + if (!fastpass) + fastpass = generateFastpass(def.shape); + payload = fastpass(payload, ctx); + if (!catchall) + return payload; + return handleCatchall([], input, payload, ctx, value, inst); + } + return superParse(payload, ctx); + }; +}); +function handleUnionResults(results, final, inst, ctx) { + for (const result of results) { + if (result.issues.length === 0) { + final.value = result.value; + return final; + } + } + const nonaborted = results.filter((r) => !aborted(r)); + if (nonaborted.length === 1) { + final.value = nonaborted[0].value; + return nonaborted[0]; + } + final.issues.push({ + code: "invalid_union", + input: final.value, + inst, + errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config()))) + }); + return final; +} +var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => { + $ZodType.init(inst, def); + defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : undefined); + defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined); + defineLazy(inst._zod, "values", () => { + if (def.options.every((o) => o._zod.values)) { + return new Set(def.options.flatMap((option) => Array.from(option._zod.values))); + } + return; + }); + defineLazy(inst._zod, "pattern", () => { + if (def.options.every((o) => o._zod.pattern)) { + const patterns = def.options.map((o) => o._zod.pattern); + return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`); + } + return; + }); + const single = def.options.length === 1; + const first = def.options[0]._zod.run; + inst._zod.parse = (payload, ctx) => { + if (single) { + return first(payload, ctx); + } + let async = false; + const results = []; + for (const option of def.options) { + const result = option._zod.run({ + value: payload.value, + issues: [] + }, ctx); + if (result instanceof Promise) { + results.push(result); + async = true; + } else { + if (result.issues.length === 0) + return result; + results.push(result); + } + } + if (!async) + return handleUnionResults(results, payload, inst, ctx); + return Promise.all(results).then((results2) => { + return handleUnionResults(results2, payload, inst, ctx); + }); + }; +}); +var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => { + $ZodUnion.init(inst, def); + const _super = inst._zod.parse; + defineLazy(inst._zod, "propValues", () => { + const propValues = {}; + for (const option of def.options) { + const pv = option._zod.propValues; + if (!pv || Object.keys(pv).length === 0) + throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`); + for (const [k, v] of Object.entries(pv)) { + if (!propValues[k]) + propValues[k] = new Set; + for (const val of v) { + propValues[k].add(val); + } + } + } + return propValues; + }); + const disc = cached(() => { + const opts = def.options; + const map = new Map; + for (const o of opts) { + const values = o._zod.propValues?.[def.discriminator]; + if (!values || values.size === 0) + throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`); + for (const v of values) { + if (map.has(v)) { + throw new Error(`Duplicate discriminator value "${String(v)}"`); + } + map.set(v, o); + } + } + return map; + }); + inst._zod.parse = (payload, ctx) => { + const input = payload.value; + if (!isObject(input)) { + payload.issues.push({ + code: "invalid_type", + expected: "object", + input, + inst + }); + return payload; + } + const opt = disc.value.get(input?.[def.discriminator]); + if (opt) { + return opt._zod.run(payload, ctx); + } + if (def.unionFallback) { + return _super(payload, ctx); + } + payload.issues.push({ + code: "invalid_union", + errors: [], + note: "No matching discriminator", + discriminator: def.discriminator, + input, + path: [def.discriminator], + inst + }); + return payload; + }; +}); +var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, ctx) => { + const input = payload.value; + const left = def.left._zod.run({ value: input, issues: [] }, ctx); + const right = def.right._zod.run({ value: input, issues: [] }, ctx); + const async = left instanceof Promise || right instanceof Promise; + if (async) { + return Promise.all([left, right]).then(([left2, right2]) => { + return handleIntersectionResults(payload, left2, right2); + }); + } + return handleIntersectionResults(payload, left, right); + }; +}); +function mergeValues(a, b) { + if (a === b) { + return { valid: true, data: a }; + } + if (a instanceof Date && b instanceof Date && +a === +b) { + return { valid: true, data: a }; + } + if (isPlainObject(a) && isPlainObject(b)) { + const bKeys = Object.keys(b); + const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1); + const newObj = { ...a, ...b }; + for (const key of sharedKeys) { + const sharedValue = mergeValues(a[key], b[key]); + if (!sharedValue.valid) { + return { + valid: false, + mergeErrorPath: [key, ...sharedValue.mergeErrorPath] + }; + } + newObj[key] = sharedValue.data; + } + return { valid: true, data: newObj }; + } + if (Array.isArray(a) && Array.isArray(b)) { + if (a.length !== b.length) { + return { valid: false, mergeErrorPath: [] }; + } + const newArray = []; + for (let index = 0;index < a.length; index++) { + const itemA = a[index]; + const itemB = b[index]; + const sharedValue = mergeValues(itemA, itemB); + if (!sharedValue.valid) { + return { + valid: false, + mergeErrorPath: [index, ...sharedValue.mergeErrorPath] + }; + } + newArray.push(sharedValue.data); + } + return { valid: true, data: newArray }; + } + return { valid: false, mergeErrorPath: [] }; +} +function handleIntersectionResults(result, left, right) { + if (left.issues.length) { + result.issues.push(...left.issues); + } + if (right.issues.length) { + result.issues.push(...right.issues); + } + if (aborted(result)) + return result; + const merged = mergeValues(left.value, right.value); + if (!merged.valid) { + throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`); + } + result.value = merged.data; + return result; +} +var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => { + $ZodType.init(inst, def); + const items = def.items; + const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional"); + inst._zod.parse = (payload, ctx) => { + const input = payload.value; + if (!Array.isArray(input)) { + payload.issues.push({ + input, + inst, + expected: "tuple", + code: "invalid_type" + }); + return payload; + } + payload.value = []; + const proms = []; + if (!def.rest) { + const tooBig = input.length > items.length; + const tooSmall = input.length < optStart - 1; + if (tooBig || tooSmall) { + payload.issues.push({ + ...tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length }, + input, + inst, + origin: "array" + }); + return payload; + } + } + let i = -1; + for (const item of items) { + i++; + if (i >= input.length) { + if (i >= optStart) + continue; + } + const result = item._zod.run({ + value: input[i], + issues: [] + }, ctx); + if (result instanceof Promise) { + proms.push(result.then((result2) => handleTupleResult(result2, payload, i))); + } else { + handleTupleResult(result, payload, i); + } + } + if (def.rest) { + const rest = input.slice(items.length); + for (const el of rest) { + i++; + const result = def.rest._zod.run({ + value: el, + issues: [] + }, ctx); + if (result instanceof Promise) { + proms.push(result.then((result2) => handleTupleResult(result2, payload, i))); + } else { + handleTupleResult(result, payload, i); + } + } + } + if (proms.length) + return Promise.all(proms).then(() => payload); + return payload; + }; +}); +function handleTupleResult(result, final, index) { + if (result.issues.length) { + final.issues.push(...prefixIssues(index, result.issues)); + } + final.value[index] = result.value; +} +var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, ctx) => { + const input = payload.value; + if (!isPlainObject(input)) { + payload.issues.push({ + expected: "record", + code: "invalid_type", + input, + inst + }); + return payload; + } + const proms = []; + if (def.keyType._zod.values) { + const values = def.keyType._zod.values; + payload.value = {}; + for (const key of values) { + if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") { + const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx); + if (result instanceof Promise) { + proms.push(result.then((result2) => { + if (result2.issues.length) { + payload.issues.push(...prefixIssues(key, result2.issues)); + } + payload.value[key] = result2.value; + })); + } else { + if (result.issues.length) { + payload.issues.push(...prefixIssues(key, result.issues)); + } + payload.value[key] = result.value; + } + } + } + let unrecognized; + for (const key in input) { + if (!values.has(key)) { + unrecognized = unrecognized ?? []; + unrecognized.push(key); + } + } + if (unrecognized && unrecognized.length > 0) { + payload.issues.push({ + code: "unrecognized_keys", + input, + inst, + keys: unrecognized + }); + } + } else { + payload.value = {}; + for (const key of Reflect.ownKeys(input)) { + if (key === "__proto__") + continue; + const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx); + if (keyResult instanceof Promise) { + throw new Error("Async schemas not supported in object keys currently"); + } + if (keyResult.issues.length) { + payload.issues.push({ + code: "invalid_key", + origin: "record", + issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())), + input: key, + path: [key], + inst + }); + payload.value[keyResult.value] = keyResult.value; + continue; + } + const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx); + if (result instanceof Promise) { + proms.push(result.then((result2) => { + if (result2.issues.length) { + payload.issues.push(...prefixIssues(key, result2.issues)); + } + payload.value[keyResult.value] = result2.value; + })); + } else { + if (result.issues.length) { + payload.issues.push(...prefixIssues(key, result.issues)); + } + payload.value[keyResult.value] = result.value; + } + } + } + if (proms.length) { + return Promise.all(proms).then(() => payload); + } + return payload; + }; +}); +var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, ctx) => { + const input = payload.value; + if (!(input instanceof Map)) { + payload.issues.push({ + expected: "map", + code: "invalid_type", + input, + inst + }); + return payload; + } + const proms = []; + payload.value = new Map; + for (const [key, value] of input) { + const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx); + const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx); + if (keyResult instanceof Promise || valueResult instanceof Promise) { + proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => { + handleMapResult(keyResult2, valueResult2, payload, key, input, inst, ctx); + })); + } else { + handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx); + } + } + if (proms.length) + return Promise.all(proms).then(() => payload); + return payload; + }; +}); +function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) { + if (keyResult.issues.length) { + if (propertyKeyTypes.has(typeof key)) { + final.issues.push(...prefixIssues(key, keyResult.issues)); + } else { + final.issues.push({ + code: "invalid_key", + origin: "map", + input, + inst, + issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())) + }); + } + } + if (valueResult.issues.length) { + if (propertyKeyTypes.has(typeof key)) { + final.issues.push(...prefixIssues(key, valueResult.issues)); + } else { + final.issues.push({ + origin: "map", + code: "invalid_element", + input, + inst, + key, + issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config())) + }); + } + } + final.value.set(keyResult.value, valueResult.value); +} +var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, ctx) => { + const input = payload.value; + if (!(input instanceof Set)) { + payload.issues.push({ + input, + inst, + expected: "set", + code: "invalid_type" + }); + return payload; + } + const proms = []; + payload.value = new Set; + for (const item of input) { + const result = def.valueType._zod.run({ value: item, issues: [] }, ctx); + if (result instanceof Promise) { + proms.push(result.then((result2) => handleSetResult(result2, payload))); + } else + handleSetResult(result, payload); + } + if (proms.length) + return Promise.all(proms).then(() => payload); + return payload; + }; +}); +function handleSetResult(result, final) { + if (result.issues.length) { + final.issues.push(...result.issues); + } + final.value.add(result.value); +} +var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => { + $ZodType.init(inst, def); + const values = getEnumValues(def.entries); + const valuesSet = new Set(values); + inst._zod.values = valuesSet; + inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`); + inst._zod.parse = (payload, _ctx) => { + const input = payload.value; + if (valuesSet.has(input)) { + return payload; + } + payload.issues.push({ + code: "invalid_value", + values, + input, + inst + }); + return payload; + }; +}); +var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => { + $ZodType.init(inst, def); + if (def.values.length === 0) { + throw new Error("Cannot create literal schema with no valid values"); + } + inst._zod.values = new Set(def.values); + inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`); + inst._zod.parse = (payload, _ctx) => { + const input = payload.value; + if (inst._zod.values.has(input)) { + return payload; + } + payload.issues.push({ + code: "invalid_value", + values: def.values, + input, + inst + }); + return payload; + }; +}); +var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, _ctx) => { + const input = payload.value; + if (input instanceof File) + return payload; + payload.issues.push({ + expected: "file", + code: "invalid_type", + input, + inst + }); + return payload; + }; +}); +var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, ctx) => { + if (ctx.direction === "backward") { + throw new $ZodEncodeError(inst.constructor.name); + } + const _out = def.transform(payload.value, payload); + if (ctx.async) { + const output = _out instanceof Promise ? _out : Promise.resolve(_out); + return output.then((output2) => { + payload.value = output2; + return payload; + }); + } + if (_out instanceof Promise) { + throw new $ZodAsyncError; + } + payload.value = _out; + return payload; + }; +}); +function handleOptionalResult(result, input) { + if (result.issues.length && input === undefined) { + return { issues: [], value: undefined }; + } + return result; +} +var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.optin = "optional"; + inst._zod.optout = "optional"; + defineLazy(inst._zod, "values", () => { + return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined; + }); + defineLazy(inst._zod, "pattern", () => { + const pattern = def.innerType._zod.pattern; + return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : undefined; + }); + inst._zod.parse = (payload, ctx) => { + if (def.innerType._zod.optin === "optional") { + const result = def.innerType._zod.run(payload, ctx); + if (result instanceof Promise) + return result.then((r) => handleOptionalResult(r, payload.value)); + return handleOptionalResult(result, payload.value); + } + if (payload.value === undefined) { + return payload; + } + return def.innerType._zod.run(payload, ctx); + }; +}); +var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => { + $ZodType.init(inst, def); + defineLazy(inst._zod, "optin", () => def.innerType._zod.optin); + defineLazy(inst._zod, "optout", () => def.innerType._zod.optout); + defineLazy(inst._zod, "pattern", () => { + const pattern = def.innerType._zod.pattern; + return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : undefined; + }); + defineLazy(inst._zod, "values", () => { + return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined; + }); + inst._zod.parse = (payload, ctx) => { + if (payload.value === null) + return payload; + return def.innerType._zod.run(payload, ctx); + }; +}); +var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.optin = "optional"; + defineLazy(inst._zod, "values", () => def.innerType._zod.values); + inst._zod.parse = (payload, ctx) => { + if (ctx.direction === "backward") { + return def.innerType._zod.run(payload, ctx); + } + if (payload.value === undefined) { + payload.value = def.defaultValue; + return payload; + } + const result = def.innerType._zod.run(payload, ctx); + if (result instanceof Promise) { + return result.then((result2) => handleDefaultResult(result2, def)); + } + return handleDefaultResult(result, def); + }; +}); +function handleDefaultResult(payload, def) { + if (payload.value === undefined) { + payload.value = def.defaultValue; + } + return payload; +} +var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.optin = "optional"; + defineLazy(inst._zod, "values", () => def.innerType._zod.values); + inst._zod.parse = (payload, ctx) => { + if (ctx.direction === "backward") { + return def.innerType._zod.run(payload, ctx); + } + if (payload.value === undefined) { + payload.value = def.defaultValue; + } + return def.innerType._zod.run(payload, ctx); + }; +}); +var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => { + $ZodType.init(inst, def); + defineLazy(inst._zod, "values", () => { + const v = def.innerType._zod.values; + return v ? new Set([...v].filter((x) => x !== undefined)) : undefined; + }); + inst._zod.parse = (payload, ctx) => { + const result = def.innerType._zod.run(payload, ctx); + if (result instanceof Promise) { + return result.then((result2) => handleNonOptionalResult(result2, inst)); + } + return handleNonOptionalResult(result, inst); + }; +}); +function handleNonOptionalResult(payload, inst) { + if (!payload.issues.length && payload.value === undefined) { + payload.issues.push({ + code: "invalid_type", + expected: "nonoptional", + input: payload.value, + inst + }); + } + return payload; +} +var $ZodSuccess = /* @__PURE__ */ $constructor("$ZodSuccess", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, ctx) => { + if (ctx.direction === "backward") { + throw new $ZodEncodeError("ZodSuccess"); + } + const result = def.innerType._zod.run(payload, ctx); + if (result instanceof Promise) { + return result.then((result2) => { + payload.value = result2.issues.length === 0; + return payload; + }); + } + payload.value = result.issues.length === 0; + return payload; + }; +}); +var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => { + $ZodType.init(inst, def); + defineLazy(inst._zod, "optin", () => def.innerType._zod.optin); + defineLazy(inst._zod, "optout", () => def.innerType._zod.optout); + defineLazy(inst._zod, "values", () => def.innerType._zod.values); + inst._zod.parse = (payload, ctx) => { + if (ctx.direction === "backward") { + return def.innerType._zod.run(payload, ctx); + } + const result = def.innerType._zod.run(payload, ctx); + if (result instanceof Promise) { + return result.then((result2) => { + payload.value = result2.value; + if (result2.issues.length) { + payload.value = def.catchValue({ + ...payload, + error: { + issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config())) + }, + input: payload.value + }); + payload.issues = []; + } + return payload; + }); + } + payload.value = result.value; + if (result.issues.length) { + payload.value = def.catchValue({ + ...payload, + error: { + issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) + }, + input: payload.value + }); + payload.issues = []; + } + return payload; + }; +}); +var $ZodNaN = /* @__PURE__ */ $constructor("$ZodNaN", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, _ctx) => { + if (typeof payload.value !== "number" || !Number.isNaN(payload.value)) { + payload.issues.push({ + input: payload.value, + inst, + expected: "nan", + code: "invalid_type" + }); + return payload; + } + return payload; + }; +}); +var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => { + $ZodType.init(inst, def); + defineLazy(inst._zod, "values", () => def.in._zod.values); + defineLazy(inst._zod, "optin", () => def.in._zod.optin); + defineLazy(inst._zod, "optout", () => def.out._zod.optout); + defineLazy(inst._zod, "propValues", () => def.in._zod.propValues); + inst._zod.parse = (payload, ctx) => { + if (ctx.direction === "backward") { + const right = def.out._zod.run(payload, ctx); + if (right instanceof Promise) { + return right.then((right2) => handlePipeResult(right2, def.in, ctx)); + } + return handlePipeResult(right, def.in, ctx); + } + const left = def.in._zod.run(payload, ctx); + if (left instanceof Promise) { + return left.then((left2) => handlePipeResult(left2, def.out, ctx)); + } + return handlePipeResult(left, def.out, ctx); + }; +}); +function handlePipeResult(left, next, ctx) { + if (left.issues.length) { + left.aborted = true; + return left; + } + return next._zod.run({ value: left.value, issues: left.issues }, ctx); +} +var $ZodCodec = /* @__PURE__ */ $constructor("$ZodCodec", (inst, def) => { + $ZodType.init(inst, def); + defineLazy(inst._zod, "values", () => def.in._zod.values); + defineLazy(inst._zod, "optin", () => def.in._zod.optin); + defineLazy(inst._zod, "optout", () => def.out._zod.optout); + defineLazy(inst._zod, "propValues", () => def.in._zod.propValues); + inst._zod.parse = (payload, ctx) => { + const direction = ctx.direction || "forward"; + if (direction === "forward") { + const left = def.in._zod.run(payload, ctx); + if (left instanceof Promise) { + return left.then((left2) => handleCodecAResult(left2, def, ctx)); + } + return handleCodecAResult(left, def, ctx); + } else { + const right = def.out._zod.run(payload, ctx); + if (right instanceof Promise) { + return right.then((right2) => handleCodecAResult(right2, def, ctx)); + } + return handleCodecAResult(right, def, ctx); + } + }; +}); +function handleCodecAResult(result, def, ctx) { + if (result.issues.length) { + result.aborted = true; + return result; + } + const direction = ctx.direction || "forward"; + if (direction === "forward") { + const transformed = def.transform(result.value, result); + if (transformed instanceof Promise) { + return transformed.then((value) => handleCodecTxResult(result, value, def.out, ctx)); + } + return handleCodecTxResult(result, transformed, def.out, ctx); + } else { + const transformed = def.reverseTransform(result.value, result); + if (transformed instanceof Promise) { + return transformed.then((value) => handleCodecTxResult(result, value, def.in, ctx)); + } + return handleCodecTxResult(result, transformed, def.in, ctx); + } +} +function handleCodecTxResult(left, value, nextSchema, ctx) { + if (left.issues.length) { + left.aborted = true; + return left; + } + return nextSchema._zod.run({ value, issues: left.issues }, ctx); +} +var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => { + $ZodType.init(inst, def); + defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues); + defineLazy(inst._zod, "values", () => def.innerType._zod.values); + defineLazy(inst._zod, "optin", () => def.innerType._zod.optin); + defineLazy(inst._zod, "optout", () => def.innerType._zod.optout); + inst._zod.parse = (payload, ctx) => { + if (ctx.direction === "backward") { + return def.innerType._zod.run(payload, ctx); + } + const result = def.innerType._zod.run(payload, ctx); + if (result instanceof Promise) { + return result.then(handleReadonlyResult); + } + return handleReadonlyResult(result); + }; +}); +function handleReadonlyResult(payload) { + payload.value = Object.freeze(payload.value); + return payload; +} +var $ZodTemplateLiteral = /* @__PURE__ */ $constructor("$ZodTemplateLiteral", (inst, def) => { + $ZodType.init(inst, def); + const regexParts = []; + for (const part of def.parts) { + if (typeof part === "object" && part !== null) { + if (!part._zod.pattern) { + throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`); + } + const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern; + if (!source) + throw new Error(`Invalid template literal part: ${part._zod.traits}`); + const start = source.startsWith("^") ? 1 : 0; + const end = source.endsWith("$") ? source.length - 1 : source.length; + regexParts.push(source.slice(start, end)); + } else if (part === null || primitiveTypes.has(typeof part)) { + regexParts.push(escapeRegex(`${part}`)); + } else { + throw new Error(`Invalid template literal part: ${part}`); + } + } + inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`); + inst._zod.parse = (payload, _ctx) => { + if (typeof payload.value !== "string") { + payload.issues.push({ + input: payload.value, + inst, + expected: "template_literal", + code: "invalid_type" + }); + return payload; + } + inst._zod.pattern.lastIndex = 0; + if (!inst._zod.pattern.test(payload.value)) { + payload.issues.push({ + input: payload.value, + inst, + code: "invalid_format", + format: def.format ?? "template_literal", + pattern: inst._zod.pattern.source + }); + return payload; + } + return payload; + }; +}); +var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => { + $ZodType.init(inst, def); + inst._def = def; + inst._zod.def = def; + inst.implement = (func) => { + if (typeof func !== "function") { + throw new Error("implement() must be called with a function"); + } + return function(...args) { + const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args; + const result = Reflect.apply(func, this, parsedArgs); + if (inst._def.output) { + return parse(inst._def.output, result); + } + return result; + }; + }; + inst.implementAsync = (func) => { + if (typeof func !== "function") { + throw new Error("implementAsync() must be called with a function"); + } + return async function(...args) { + const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args; + const result = await Reflect.apply(func, this, parsedArgs); + if (inst._def.output) { + return await parseAsync(inst._def.output, result); + } + return result; + }; + }; + inst._zod.parse = (payload, _ctx) => { + if (typeof payload.value !== "function") { + payload.issues.push({ + code: "invalid_type", + expected: "function", + input: payload.value, + inst + }); + return payload; + } + const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === "promise"; + if (hasPromiseOutput) { + payload.value = inst.implementAsync(payload.value); + } else { + payload.value = inst.implement(payload.value); + } + return payload; + }; + inst.input = (...args) => { + const F = inst.constructor; + if (Array.isArray(args[0])) { + return new F({ + type: "function", + input: new $ZodTuple({ + type: "tuple", + items: args[0], + rest: args[1] + }), + output: inst._def.output + }); + } + return new F({ + type: "function", + input: args[0], + output: inst._def.output + }); + }; + inst.output = (output) => { + const F = inst.constructor; + return new F({ + type: "function", + input: inst._def.input, + output + }); + }; + return inst; +}); +var $ZodPromise = /* @__PURE__ */ $constructor("$ZodPromise", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, ctx) => { + return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx)); + }; +}); +var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => { + $ZodType.init(inst, def); + defineLazy(inst._zod, "innerType", () => def.getter()); + defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern); + defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues); + defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin ?? undefined); + defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout ?? undefined); + inst._zod.parse = (payload, ctx) => { + const inner = inst._zod.innerType; + return inner._zod.run(payload, ctx); + }; +}); +var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => { + $ZodCheck.init(inst, def); + $ZodType.init(inst, def); + inst._zod.parse = (payload, _) => { + return payload; + }; + inst._zod.check = (payload) => { + const input = payload.value; + const r = def.fn(input); + if (r instanceof Promise) { + return r.then((r2) => handleRefineResult(r2, payload, input, inst)); + } + handleRefineResult(r, payload, input, inst); + return; + }; +}); +function handleRefineResult(result, payload, input, inst) { + if (!result) { + const _iss = { + code: "custom", + input, + inst, + path: [...inst._zod.def.path ?? []], + continue: !inst._zod.def.abort + }; + if (inst._zod.def.params) + _iss.params = inst._zod.def.params; + payload.issues.push(issue(_iss)); + } +} +// node_modules/zod/v4/locales/index.js +var exports_locales = {}; +__export(exports_locales, { + zhTW: () => zh_TW_default, + zhCN: () => zh_CN_default, + yo: () => yo_default, + vi: () => vi_default, + ur: () => ur_default, + uk: () => uk_default, + ua: () => ua_default, + tr: () => tr_default, + th: () => th_default, + ta: () => ta_default, + sv: () => sv_default, + sl: () => sl_default, + ru: () => ru_default, + pt: () => pt_default, + ps: () => ps_default, + pl: () => pl_default, + ota: () => ota_default, + no: () => no_default, + nl: () => nl_default, + ms: () => ms_default, + mk: () => mk_default, + lt: () => lt_default, + ko: () => ko_default, + km: () => km_default, + kh: () => kh_default, + ka: () => ka_default, + ja: () => ja_default, + it: () => it_default, + is: () => is_default, + id: () => id_default, + hu: () => hu_default, + he: () => he_default, + frCA: () => fr_CA_default, + fr: () => fr_default, + fi: () => fi_default, + fa: () => fa_default, + es: () => es_default, + eo: () => eo_default, + en: () => en_default, + de: () => de_default, + da: () => da_default, + cs: () => cs_default, + ca: () => ca_default, + be: () => be_default, + az: () => az_default, + ar: () => ar_default +}); + +// node_modules/zod/v4/locales/ar.js +var error = () => { + const Sizable = { + string: { unit: "\u062D\u0631\u0641", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" }, + file: { unit: "\u0628\u0627\u064A\u062A", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" }, + array: { unit: "\u0639\u0646\u0635\u0631", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" }, + set: { unit: "\u0639\u0646\u0635\u0631", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "number"; + } + case "object": { + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u0645\u062F\u062E\u0644", + email: "\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A", + url: "\u0631\u0627\u0628\u0637", + emoji: "\u0625\u064A\u0645\u0648\u062C\u064A", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO", + date: "\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO", + time: "\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO", + duration: "\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO", + ipv4: "\u0639\u0646\u0648\u0627\u0646 IPv4", + ipv6: "\u0639\u0646\u0648\u0627\u0646 IPv6", + cidrv4: "\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4", + cidrv6: "\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6", + base64: "\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded", + base64url: "\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded", + json_string: "\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON", + e164: "\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164", + jwt: "JWT", + template_literal: "\u0645\u062F\u062E\u0644" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${issue2.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${parsedType(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${stringifyPrimitive(issue2.values[0])}`; + return `\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return ` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${issue2.origin ?? "\u0627\u0644\u0642\u064A\u0645\u0629"} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "\u0639\u0646\u0635\u0631"}`; + return `\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${issue2.origin ?? "\u0627\u0644\u0642\u064A\u0645\u0629"} ${adj} ${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${issue2.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${adj} ${issue2.minimum.toString()} ${sizing.unit}`; + } + return `\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${issue2.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${adj} ${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${issue2.prefix}"`; + if (_issue.format === "ends_with") + return `\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${_issue.suffix}"`; + if (_issue.format === "includes") + return `\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${_issue.includes}"`; + if (_issue.format === "regex") + return `\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${_issue.pattern}`; + return `${Nouns[_issue.format] ?? issue2.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`; + } + case "not_multiple_of": + return `\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${issue2.divisor}`; + case "unrecognized_keys": + return `\u0645\u0639\u0631\u0641${issue2.keys.length > 1 ? "\u0627\u062A" : ""} \u063A\u0631\u064A\u0628${issue2.keys.length > 1 ? "\u0629" : ""}: ${joinValues(issue2.keys, "\u060C ")}`; + case "invalid_key": + return `\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${issue2.origin}`; + case "invalid_union": + return "\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"; + case "invalid_element": + return `\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${issue2.origin}`; + default: + return "\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"; + } + }; +}; +function ar_default() { + return { + localeError: error() + }; +} +// node_modules/zod/v4/locales/az.js +var error2 = () => { + const Sizable = { + string: { unit: "simvol", verb: "olmal\u0131d\u0131r" }, + file: { unit: "bayt", verb: "olmal\u0131d\u0131r" }, + array: { unit: "element", verb: "olmal\u0131d\u0131r" }, + set: { unit: "element", verb: "olmal\u0131d\u0131r" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "number"; + } + case "object": { + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "input", + email: "email address", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO datetime", + date: "ISO date", + time: "ISO time", + duration: "ISO duration", + ipv4: "IPv4 address", + ipv6: "IPv6 address", + cidrv4: "IPv4 range", + cidrv6: "IPv6 range", + base64: "base64-encoded string", + base64url: "base64url-encoded string", + json_string: "JSON string", + e164: "E.164 number", + jwt: "JWT", + template_literal: "input" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${issue2.expected}, daxil olan ${parsedType(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${stringifyPrimitive(issue2.values[0])}`; + return `Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${issue2.origin ?? "d\u0259y\u0259r"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "element"}`; + return `\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${issue2.origin ?? "d\u0259y\u0259r"} ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + return `\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${issue2.origin} ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `Yanl\u0131\u015F m\u0259tn: "${_issue.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`; + if (_issue.format === "ends_with") + return `Yanl\u0131\u015F m\u0259tn: "${_issue.suffix}" il\u0259 bitm\u0259lidir`; + if (_issue.format === "includes") + return `Yanl\u0131\u015F m\u0259tn: "${_issue.includes}" daxil olmal\u0131d\u0131r`; + if (_issue.format === "regex") + return `Yanl\u0131\u015F m\u0259tn: ${_issue.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`; + return `Yanl\u0131\u015F ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Yanl\u0131\u015F \u0259d\u0259d: ${issue2.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`; + case "unrecognized_keys": + return `Tan\u0131nmayan a\xE7ar${issue2.keys.length > 1 ? "lar" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `${issue2.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`; + case "invalid_union": + return "Yanl\u0131\u015F d\u0259y\u0259r"; + case "invalid_element": + return `${issue2.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`; + default: + return `Yanl\u0131\u015F d\u0259y\u0259r`; + } + }; +}; +function az_default() { + return { + localeError: error2() + }; +} +// node_modules/zod/v4/locales/be.js +function getBelarusianPlural(count, one, few, many) { + const absCount = Math.abs(count); + const lastDigit = absCount % 10; + const lastTwoDigits = absCount % 100; + if (lastTwoDigits >= 11 && lastTwoDigits <= 19) { + return many; + } + if (lastDigit === 1) { + return one; + } + if (lastDigit >= 2 && lastDigit <= 4) { + return few; + } + return many; +} +var error3 = () => { + const Sizable = { + string: { + unit: { + one: "\u0441\u0456\u043C\u0432\u0430\u043B", + few: "\u0441\u0456\u043C\u0432\u0430\u043B\u044B", + many: "\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E" + }, + verb: "\u043C\u0435\u0446\u044C" + }, + array: { + unit: { + one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442", + few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B", + many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E" + }, + verb: "\u043C\u0435\u0446\u044C" + }, + set: { + unit: { + one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442", + few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B", + many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E" + }, + verb: "\u043C\u0435\u0446\u044C" + }, + file: { + unit: { + one: "\u0431\u0430\u0439\u0442", + few: "\u0431\u0430\u0439\u0442\u044B", + many: "\u0431\u0430\u0439\u0442\u0430\u045E" + }, + verb: "\u043C\u0435\u0446\u044C" + } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "\u043B\u0456\u043A"; + } + case "object": { + if (Array.isArray(data)) { + return "\u043C\u0430\u0441\u0456\u045E"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u0443\u0432\u043E\u0434", + email: "email \u0430\u0434\u0440\u0430\u0441", + url: "URL", + emoji: "\u044D\u043C\u043E\u0434\u0437\u0456", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441", + date: "ISO \u0434\u0430\u0442\u0430", + time: "ISO \u0447\u0430\u0441", + duration: "ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C", + ipv4: "IPv4 \u0430\u0434\u0440\u0430\u0441", + ipv6: "IPv6 \u0430\u0434\u0440\u0430\u0441", + cidrv4: "IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D", + cidrv6: "IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D", + base64: "\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64", + base64url: "\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url", + json_string: "JSON \u0440\u0430\u0434\u043E\u043A", + e164: "\u043D\u0443\u043C\u0430\u0440 E.164", + jwt: "JWT", + template_literal: "\u0443\u0432\u043E\u0434" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${issue2.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${parsedType(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${stringifyPrimitive(issue2.values[0])}`; + return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) { + const maxValue = Number(issue2.maximum); + const unit = getBelarusianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many); + return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${sizing.verb} ${adj}${issue2.maximum.toString()} ${unit}`; + } + return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + const minValue = Number(issue2.minimum); + const unit = getBelarusianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many); + return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${sizing.verb} ${adj}${issue2.minimum.toString()} ${unit}`; + } + return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${_issue.suffix}"`; + if (_issue.format === "includes") + return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${_issue.includes}"`; + if (_issue.format === "regex") + return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${_issue.pattern}`; + return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${issue2.divisor}`; + case "unrecognized_keys": + return `\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${issue2.keys.length > 1 ? "\u043A\u043B\u044E\u0447\u044B" : "\u043A\u043B\u044E\u0447"}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${issue2.origin}`; + case "invalid_union": + return "\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"; + case "invalid_element": + return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${issue2.origin}`; + default: + return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434`; + } + }; +}; +function be_default() { + return { + localeError: error3() + }; +} +// node_modules/zod/v4/locales/ca.js +var error4 = () => { + const Sizable = { + string: { unit: "car\xE0cters", verb: "contenir" }, + file: { unit: "bytes", verb: "contenir" }, + array: { unit: "elements", verb: "contenir" }, + set: { unit: "elements", verb: "contenir" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "number"; + } + case "object": { + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "entrada", + email: "adre\xE7a electr\xF2nica", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "data i hora ISO", + date: "data ISO", + time: "hora ISO", + duration: "durada ISO", + ipv4: "adre\xE7a IPv4", + ipv6: "adre\xE7a IPv6", + cidrv4: "rang IPv4", + cidrv6: "rang IPv6", + base64: "cadena codificada en base64", + base64url: "cadena codificada en base64url", + json_string: "cadena JSON", + e164: "n\xFAmero E.164", + jwt: "JWT", + template_literal: "entrada" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Tipus inv\xE0lid: s'esperava ${issue2.expected}, s'ha rebut ${parsedType(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Valor inv\xE0lid: s'esperava ${stringifyPrimitive(issue2.values[0])}`; + return `Opci\xF3 inv\xE0lida: s'esperava una de ${joinValues(issue2.values, " o ")}`; + case "too_big": { + const adj = issue2.inclusive ? "com a m\xE0xim" : "menys de"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Massa gran: s'esperava que ${issue2.origin ?? "el valor"} contingu\xE9s ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`; + return `Massa gran: s'esperava que ${issue2.origin ?? "el valor"} fos ${adj} ${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? "com a m\xEDnim" : "m\xE9s de"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Massa petit: s'esperava que ${issue2.origin} contingu\xE9s ${adj} ${issue2.minimum.toString()} ${sizing.unit}`; + } + return `Massa petit: s'esperava que ${issue2.origin} fos ${adj} ${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `Format inv\xE0lid: ha de comen\xE7ar amb "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") + return `Format inv\xE0lid: ha d'acabar amb "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Format inv\xE0lid: ha d'incloure "${_issue.includes}"`; + if (_issue.format === "regex") + return `Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${_issue.pattern}`; + return `Format inv\xE0lid per a ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${issue2.divisor}`; + case "unrecognized_keys": + return `Clau${issue2.keys.length > 1 ? "s" : ""} no reconeguda${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Clau inv\xE0lida a ${issue2.origin}`; + case "invalid_union": + return "Entrada inv\xE0lida"; + case "invalid_element": + return `Element inv\xE0lid a ${issue2.origin}`; + default: + return `Entrada inv\xE0lida`; + } + }; +}; +function ca_default() { + return { + localeError: error4() + }; +} +// node_modules/zod/v4/locales/cs.js +var error5 = () => { + const Sizable = { + string: { unit: "znak\u016F", verb: "m\xEDt" }, + file: { unit: "bajt\u016F", verb: "m\xEDt" }, + array: { unit: "prvk\u016F", verb: "m\xEDt" }, + set: { unit: "prvk\u016F", verb: "m\xEDt" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "\u010D\xEDslo"; + } + case "string": { + return "\u0159et\u011Bzec"; + } + case "boolean": { + return "boolean"; + } + case "bigint": { + return "bigint"; + } + case "function": { + return "funkce"; + } + case "symbol": { + return "symbol"; + } + case "undefined": { + return "undefined"; + } + case "object": { + if (Array.isArray(data)) { + return "pole"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "regul\xE1rn\xED v\xFDraz", + email: "e-mailov\xE1 adresa", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "datum a \u010Das ve form\xE1tu ISO", + date: "datum ve form\xE1tu ISO", + time: "\u010Das ve form\xE1tu ISO", + duration: "doba trv\xE1n\xED ISO", + ipv4: "IPv4 adresa", + ipv6: "IPv6 adresa", + cidrv4: "rozsah IPv4", + cidrv6: "rozsah IPv6", + base64: "\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64", + base64url: "\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url", + json_string: "\u0159et\u011Bzec ve form\xE1tu JSON", + e164: "\u010D\xEDslo E.164", + jwt: "JWT", + template_literal: "vstup" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${issue2.expected}, obdr\u017Eeno ${parsedType(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${stringifyPrimitive(issue2.values[0])}`; + return `Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${issue2.origin ?? "hodnota"} mus\xED m\xEDt ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "prvk\u016F"}`; + } + return `Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${issue2.origin ?? "hodnota"} mus\xED b\xFDt ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${issue2.origin ?? "hodnota"} mus\xED m\xEDt ${adj}${issue2.minimum.toString()} ${sizing.unit ?? "prvk\u016F"}`; + } + return `Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${issue2.origin ?? "hodnota"} mus\xED b\xFDt ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${_issue.includes}"`; + if (_issue.format === "regex") + return `Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${_issue.pattern}`; + return `Neplatn\xFD form\xE1t ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${issue2.divisor}`; + case "unrecognized_keys": + return `Nezn\xE1m\xE9 kl\xED\u010De: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Neplatn\xFD kl\xED\u010D v ${issue2.origin}`; + case "invalid_union": + return "Neplatn\xFD vstup"; + case "invalid_element": + return `Neplatn\xE1 hodnota v ${issue2.origin}`; + default: + return `Neplatn\xFD vstup`; + } + }; +}; +function cs_default() { + return { + localeError: error5() + }; +} +// node_modules/zod/v4/locales/da.js +var error6 = () => { + const Sizable = { + string: { unit: "tegn", verb: "havde" }, + file: { unit: "bytes", verb: "havde" }, + array: { unit: "elementer", verb: "indeholdt" }, + set: { unit: "elementer", verb: "indeholdt" } + }; + const TypeNames = { + string: "streng", + number: "tal", + boolean: "boolean", + array: "liste", + object: "objekt", + set: "s\xE6t", + file: "fil" + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + function getTypeName(type) { + return TypeNames[type] ?? type; + } + const parsedType = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "tal"; + } + case "object": { + if (Array.isArray(data)) { + return "liste"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + return "objekt"; + } + } + return t; + }; + const Nouns = { + regex: "input", + email: "e-mailadresse", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO dato- og klokkesl\xE6t", + date: "ISO-dato", + time: "ISO-klokkesl\xE6t", + duration: "ISO-varighed", + ipv4: "IPv4-omr\xE5de", + ipv6: "IPv6-omr\xE5de", + cidrv4: "IPv4-spektrum", + cidrv6: "IPv6-spektrum", + base64: "base64-kodet streng", + base64url: "base64url-kodet streng", + json_string: "JSON-streng", + e164: "E.164-nummer", + jwt: "JWT", + template_literal: "input" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Ugyldigt input: forventede ${getTypeName(issue2.expected)}, fik ${getTypeName(parsedType(issue2.input))}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Ugyldig v\xE6rdi: forventede ${stringifyPrimitive(issue2.values[0])}`; + return `Ugyldigt valg: forventede en af f\xF8lgende ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + const origin = getTypeName(issue2.origin); + if (sizing) + return `For stor: forventede ${origin ?? "value"} ${sizing.verb} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "elementer"}`; + return `For stor: forventede ${origin ?? "value"} havde ${adj} ${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + const origin = getTypeName(issue2.origin); + if (sizing) { + return `For lille: forventede ${origin} ${sizing.verb} ${adj} ${issue2.minimum.toString()} ${sizing.unit}`; + } + return `For lille: forventede ${origin} havde ${adj} ${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `Ugyldig streng: skal starte med "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `Ugyldig streng: skal ende med "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Ugyldig streng: skal indeholde "${_issue.includes}"`; + if (_issue.format === "regex") + return `Ugyldig streng: skal matche m\xF8nsteret ${_issue.pattern}`; + return `Ugyldig ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Ugyldigt tal: skal v\xE6re deleligt med ${issue2.divisor}`; + case "unrecognized_keys": + return `${issue2.keys.length > 1 ? "Ukendte n\xF8gler" : "Ukendt n\xF8gle"}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Ugyldig n\xF8gle i ${issue2.origin}`; + case "invalid_union": + return "Ugyldigt input: matcher ingen af de tilladte typer"; + case "invalid_element": + return `Ugyldig v\xE6rdi i ${issue2.origin}`; + default: + return `Ugyldigt input`; + } + }; +}; +function da_default() { + return { + localeError: error6() + }; +} +// node_modules/zod/v4/locales/de.js +var error7 = () => { + const Sizable = { + string: { unit: "Zeichen", verb: "zu haben" }, + file: { unit: "Bytes", verb: "zu haben" }, + array: { unit: "Elemente", verb: "zu haben" }, + set: { unit: "Elemente", verb: "zu haben" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "Zahl"; + } + case "object": { + if (Array.isArray(data)) { + return "Array"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "Eingabe", + email: "E-Mail-Adresse", + url: "URL", + emoji: "Emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO-Datum und -Uhrzeit", + date: "ISO-Datum", + time: "ISO-Uhrzeit", + duration: "ISO-Dauer", + ipv4: "IPv4-Adresse", + ipv6: "IPv6-Adresse", + cidrv4: "IPv4-Bereich", + cidrv6: "IPv6-Bereich", + base64: "Base64-codierter String", + base64url: "Base64-URL-codierter String", + json_string: "JSON-String", + e164: "E.164-Nummer", + jwt: "JWT", + template_literal: "Eingabe" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Ung\xFCltige Eingabe: erwartet ${issue2.expected}, erhalten ${parsedType(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Ung\xFCltige Eingabe: erwartet ${stringifyPrimitive(issue2.values[0])}`; + return `Ung\xFCltige Option: erwartet eine von ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Zu gro\xDF: erwartet, dass ${issue2.origin ?? "Wert"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "Elemente"} hat`; + return `Zu gro\xDF: erwartet, dass ${issue2.origin ?? "Wert"} ${adj}${issue2.maximum.toString()} ist`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Zu klein: erwartet, dass ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} hat`; + } + return `Zu klein: erwartet, dass ${issue2.origin} ${adj}${issue2.minimum.toString()} ist`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `Ung\xFCltiger String: muss mit "${_issue.prefix}" beginnen`; + if (_issue.format === "ends_with") + return `Ung\xFCltiger String: muss mit "${_issue.suffix}" enden`; + if (_issue.format === "includes") + return `Ung\xFCltiger String: muss "${_issue.includes}" enthalten`; + if (_issue.format === "regex") + return `Ung\xFCltiger String: muss dem Muster ${_issue.pattern} entsprechen`; + return `Ung\xFCltig: ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Ung\xFCltige Zahl: muss ein Vielfaches von ${issue2.divisor} sein`; + case "unrecognized_keys": + return `${issue2.keys.length > 1 ? "Unbekannte Schl\xFCssel" : "Unbekannter Schl\xFCssel"}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Ung\xFCltiger Schl\xFCssel in ${issue2.origin}`; + case "invalid_union": + return "Ung\xFCltige Eingabe"; + case "invalid_element": + return `Ung\xFCltiger Wert in ${issue2.origin}`; + default: + return `Ung\xFCltige Eingabe`; + } + }; +}; +function de_default() { + return { + localeError: error7() + }; +} +// node_modules/zod/v4/locales/en.js +var parsedType = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "number"; + } + case "object": { + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; +}; +var error8 = () => { + const Sizable = { + string: { unit: "characters", verb: "to have" }, + file: { unit: "bytes", verb: "to have" }, + array: { unit: "items", verb: "to have" }, + set: { unit: "items", verb: "to have" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const Nouns = { + regex: "input", + email: "email address", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO datetime", + date: "ISO date", + time: "ISO time", + duration: "ISO duration", + ipv4: "IPv4 address", + ipv6: "IPv6 address", + cidrv4: "IPv4 range", + cidrv6: "IPv6 range", + base64: "base64-encoded string", + base64url: "base64url-encoded string", + json_string: "JSON string", + e164: "E.164 number", + jwt: "JWT", + template_literal: "input" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Invalid input: expected ${issue2.expected}, received ${parsedType(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`; + return `Invalid option: expected one of ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Too big: expected ${issue2.origin ?? "value"} to have ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`; + return `Too big: expected ${issue2.origin ?? "value"} to be ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Too small: expected ${issue2.origin} to have ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `Too small: expected ${issue2.origin} to be ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `Invalid string: must start with "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") + return `Invalid string: must end with "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Invalid string: must include "${_issue.includes}"`; + if (_issue.format === "regex") + return `Invalid string: must match pattern ${_issue.pattern}`; + return `Invalid ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Invalid number: must be a multiple of ${issue2.divisor}`; + case "unrecognized_keys": + return `Unrecognized key${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Invalid key in ${issue2.origin}`; + case "invalid_union": + return "Invalid input"; + case "invalid_element": + return `Invalid value in ${issue2.origin}`; + default: + return `Invalid input`; + } + }; +}; +function en_default() { + return { + localeError: error8() + }; +} +// node_modules/zod/v4/locales/eo.js +var parsedType2 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "nombro"; + } + case "object": { + if (Array.isArray(data)) { + return "tabelo"; + } + if (data === null) { + return "senvalora"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; +}; +var error9 = () => { + const Sizable = { + string: { unit: "karaktrojn", verb: "havi" }, + file: { unit: "bajtojn", verb: "havi" }, + array: { unit: "elementojn", verb: "havi" }, + set: { unit: "elementojn", verb: "havi" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const Nouns = { + regex: "enigo", + email: "retadreso", + url: "URL", + emoji: "emo\u011Dio", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO-datotempo", + date: "ISO-dato", + time: "ISO-tempo", + duration: "ISO-da\u016Dro", + ipv4: "IPv4-adreso", + ipv6: "IPv6-adreso", + cidrv4: "IPv4-rango", + cidrv6: "IPv6-rango", + base64: "64-ume kodita karaktraro", + base64url: "URL-64-ume kodita karaktraro", + json_string: "JSON-karaktraro", + e164: "E.164-nombro", + jwt: "JWT", + template_literal: "enigo" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Nevalida enigo: atendi\u011Dis ${issue2.expected}, ricevi\u011Dis ${parsedType2(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Nevalida enigo: atendi\u011Dis ${stringifyPrimitive(issue2.values[0])}`; + return `Nevalida opcio: atendi\u011Dis unu el ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Tro granda: atendi\u011Dis ke ${issue2.origin ?? "valoro"} havu ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementojn"}`; + return `Tro granda: atendi\u011Dis ke ${issue2.origin ?? "valoro"} havu ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Tro malgranda: atendi\u011Dis ke ${issue2.origin} havu ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `Tro malgranda: atendi\u011Dis ke ${issue2.origin} estu ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `Nevalida karaktraro: devas komenci\u011Di per "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `Nevalida karaktraro: devas fini\u011Di per "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Nevalida karaktraro: devas inkluzivi "${_issue.includes}"`; + if (_issue.format === "regex") + return `Nevalida karaktraro: devas kongrui kun la modelo ${_issue.pattern}`; + return `Nevalida ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Nevalida nombro: devas esti oblo de ${issue2.divisor}`; + case "unrecognized_keys": + return `Nekonata${issue2.keys.length > 1 ? "j" : ""} \u015Dlosilo${issue2.keys.length > 1 ? "j" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Nevalida \u015Dlosilo en ${issue2.origin}`; + case "invalid_union": + return "Nevalida enigo"; + case "invalid_element": + return `Nevalida valoro en ${issue2.origin}`; + default: + return `Nevalida enigo`; + } + }; +}; +function eo_default() { + return { + localeError: error9() + }; +} +// node_modules/zod/v4/locales/es.js +var error10 = () => { + const Sizable = { + string: { unit: "caracteres", verb: "tener" }, + file: { unit: "bytes", verb: "tener" }, + array: { unit: "elementos", verb: "tener" }, + set: { unit: "elementos", verb: "tener" } + }; + const TypeNames = { + string: "texto", + number: "n\xFAmero", + boolean: "booleano", + array: "arreglo", + object: "objeto", + set: "conjunto", + file: "archivo", + date: "fecha", + bigint: "n\xFAmero grande", + symbol: "s\xEDmbolo", + undefined: "indefinido", + null: "nulo", + function: "funci\xF3n", + map: "mapa", + record: "registro", + tuple: "tupla", + enum: "enumeraci\xF3n", + union: "uni\xF3n", + literal: "literal", + promise: "promesa", + void: "vac\xEDo", + never: "nunca", + unknown: "desconocido", + any: "cualquiera" + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + function getTypeName(type) { + return TypeNames[type] ?? type; + } + const parsedType3 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "number"; + } + case "object": { + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype) { + return data.constructor.name; + } + return "object"; + } + } + return t; + }; + const Nouns = { + regex: "entrada", + email: "direcci\xF3n de correo electr\xF3nico", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "fecha y hora ISO", + date: "fecha ISO", + time: "hora ISO", + duration: "duraci\xF3n ISO", + ipv4: "direcci\xF3n IPv4", + ipv6: "direcci\xF3n IPv6", + cidrv4: "rango IPv4", + cidrv6: "rango IPv6", + base64: "cadena codificada en base64", + base64url: "URL codificada en base64", + json_string: "cadena JSON", + e164: "n\xFAmero E.164", + jwt: "JWT", + template_literal: "entrada" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Entrada inv\xE1lida: se esperaba ${getTypeName(issue2.expected)}, recibido ${getTypeName(parsedType3(issue2.input))}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Entrada inv\xE1lida: se esperaba ${stringifyPrimitive(issue2.values[0])}`; + return `Opci\xF3n inv\xE1lida: se esperaba una de ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + const origin = getTypeName(issue2.origin); + if (sizing) + return `Demasiado grande: se esperaba que ${origin ?? "valor"} tuviera ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementos"}`; + return `Demasiado grande: se esperaba que ${origin ?? "valor"} fuera ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + const origin = getTypeName(issue2.origin); + if (sizing) { + return `Demasiado peque\xF1o: se esperaba que ${origin} tuviera ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `Demasiado peque\xF1o: se esperaba que ${origin} fuera ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `Cadena inv\xE1lida: debe comenzar con "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `Cadena inv\xE1lida: debe terminar en "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Cadena inv\xE1lida: debe incluir "${_issue.includes}"`; + if (_issue.format === "regex") + return `Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${_issue.pattern}`; + return `Inv\xE1lido ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${issue2.divisor}`; + case "unrecognized_keys": + return `Llave${issue2.keys.length > 1 ? "s" : ""} desconocida${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Llave inv\xE1lida en ${getTypeName(issue2.origin)}`; + case "invalid_union": + return "Entrada inv\xE1lida"; + case "invalid_element": + return `Valor inv\xE1lido en ${getTypeName(issue2.origin)}`; + default: + return `Entrada inv\xE1lida`; + } + }; +}; +function es_default() { + return { + localeError: error10() + }; +} +// node_modules/zod/v4/locales/fa.js +var error11 = () => { + const Sizable = { + string: { unit: "\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" }, + file: { unit: "\u0628\u0627\u06CC\u062A", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" }, + array: { unit: "\u0622\u06CC\u062A\u0645", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" }, + set: { unit: "\u0622\u06CC\u062A\u0645", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType3 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "\u0639\u062F\u062F"; + } + case "object": { + if (Array.isArray(data)) { + return "\u0622\u0631\u0627\u06CC\u0647"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u0648\u0631\u0648\u062F\u06CC", + email: "\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644", + url: "URL", + emoji: "\u0627\u06CC\u0645\u0648\u062C\u06CC", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648", + date: "\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648", + time: "\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648", + duration: "\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648", + ipv4: "IPv4 \u0622\u062F\u0631\u0633", + ipv6: "IPv6 \u0622\u062F\u0631\u0633", + cidrv4: "IPv4 \u062F\u0627\u0645\u0646\u0647", + cidrv6: "IPv6 \u062F\u0627\u0645\u0646\u0647", + base64: "base64-encoded \u0631\u0634\u062A\u0647", + base64url: "base64url-encoded \u0631\u0634\u062A\u0647", + json_string: "JSON \u0631\u0634\u062A\u0647", + e164: "E.164 \u0639\u062F\u062F", + jwt: "JWT", + template_literal: "\u0648\u0631\u0648\u062F\u06CC" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${issue2.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${parsedType3(issue2.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`; + case "invalid_value": + if (issue2.values.length === 1) { + return `\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${stringifyPrimitive(issue2.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`; + } + return `\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${joinValues(issue2.values, "|")} \u0645\u06CC\u200C\u0628\u0648\u062F`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${issue2.origin ?? "\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`; + } + return `\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${issue2.origin ?? "\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${adj}${issue2.maximum.toString()} \u0628\u0627\u0634\u062F`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${issue2.origin} \u0628\u0627\u06CC\u062F ${adj}${issue2.minimum.toString()} ${sizing.unit} \u0628\u0627\u0634\u062F`; + } + return `\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${issue2.origin} \u0628\u0627\u06CC\u062F ${adj}${issue2.minimum.toString()} \u0628\u0627\u0634\u062F`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${_issue.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`; + } + if (_issue.format === "ends_with") { + return `\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${_issue.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`; + } + if (_issue.format === "includes") { + return `\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${_issue.includes}" \u0628\u0627\u0634\u062F`; + } + if (_issue.format === "regex") { + return `\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${_issue.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`; + } + return `${Nouns[_issue.format] ?? issue2.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`; + } + case "not_multiple_of": + return `\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${issue2.divisor} \u0628\u0627\u0634\u062F`; + case "unrecognized_keys": + return `\u06A9\u0644\u06CC\u062F${issue2.keys.length > 1 ? "\u0647\u0627\u06CC" : ""} \u0646\u0627\u0634\u0646\u0627\u0633: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${issue2.origin}`; + case "invalid_union": + return `\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631`; + case "invalid_element": + return `\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${issue2.origin}`; + default: + return `\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631`; + } + }; +}; +function fa_default() { + return { + localeError: error11() + }; +} +// node_modules/zod/v4/locales/fi.js +var error12 = () => { + const Sizable = { + string: { unit: "merkki\xE4", subject: "merkkijonon" }, + file: { unit: "tavua", subject: "tiedoston" }, + array: { unit: "alkiota", subject: "listan" }, + set: { unit: "alkiota", subject: "joukon" }, + number: { unit: "", subject: "luvun" }, + bigint: { unit: "", subject: "suuren kokonaisluvun" }, + int: { unit: "", subject: "kokonaisluvun" }, + date: { unit: "", subject: "p\xE4iv\xE4m\xE4\xE4r\xE4n" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType3 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "number"; + } + case "object": { + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "s\xE4\xE4nn\xF6llinen lauseke", + email: "s\xE4hk\xF6postiosoite", + url: "URL-osoite", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO-aikaleima", + date: "ISO-p\xE4iv\xE4m\xE4\xE4r\xE4", + time: "ISO-aika", + duration: "ISO-kesto", + ipv4: "IPv4-osoite", + ipv6: "IPv6-osoite", + cidrv4: "IPv4-alue", + cidrv6: "IPv6-alue", + base64: "base64-koodattu merkkijono", + base64url: "base64url-koodattu merkkijono", + json_string: "JSON-merkkijono", + e164: "E.164-luku", + jwt: "JWT", + template_literal: "templaattimerkkijono" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Virheellinen tyyppi: odotettiin ${issue2.expected}, oli ${parsedType3(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Virheellinen sy\xF6te: t\xE4ytyy olla ${stringifyPrimitive(issue2.values[0])}`; + return `Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Liian suuri: ${sizing.subject} t\xE4ytyy olla ${adj}${issue2.maximum.toString()} ${sizing.unit}`.trim(); + } + return `Liian suuri: arvon t\xE4ytyy olla ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Liian pieni: ${sizing.subject} t\xE4ytyy olla ${adj}${issue2.minimum.toString()} ${sizing.unit}`.trim(); + } + return `Liian pieni: arvon t\xE4ytyy olla ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `Virheellinen sy\xF6te: t\xE4ytyy alkaa "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `Virheellinen sy\xF6te: t\xE4ytyy loppua "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${_issue.includes}"`; + if (_issue.format === "regex") { + return `Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${_issue.pattern}`; + } + return `Virheellinen ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Virheellinen luku: t\xE4ytyy olla luvun ${issue2.divisor} monikerta`; + case "unrecognized_keys": + return `${issue2.keys.length > 1 ? "Tuntemattomat avaimet" : "Tuntematon avain"}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return "Virheellinen avain tietueessa"; + case "invalid_union": + return "Virheellinen unioni"; + case "invalid_element": + return "Virheellinen arvo joukossa"; + default: + return `Virheellinen sy\xF6te`; + } + }; +}; +function fi_default() { + return { + localeError: error12() + }; +} +// node_modules/zod/v4/locales/fr.js +var error13 = () => { + const Sizable = { + string: { unit: "caract\xE8res", verb: "avoir" }, + file: { unit: "octets", verb: "avoir" }, + array: { unit: "\xE9l\xE9ments", verb: "avoir" }, + set: { unit: "\xE9l\xE9ments", verb: "avoir" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType3 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "nombre"; + } + case "object": { + if (Array.isArray(data)) { + return "tableau"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "entr\xE9e", + email: "adresse e-mail", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "date et heure ISO", + date: "date ISO", + time: "heure ISO", + duration: "dur\xE9e ISO", + ipv4: "adresse IPv4", + ipv6: "adresse IPv6", + cidrv4: "plage IPv4", + cidrv6: "plage IPv6", + base64: "cha\xEEne encod\xE9e en base64", + base64url: "cha\xEEne encod\xE9e en base64url", + json_string: "cha\xEEne JSON", + e164: "num\xE9ro E.164", + jwt: "JWT", + template_literal: "entr\xE9e" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Entr\xE9e invalide : ${issue2.expected} attendu, ${parsedType3(issue2.input)} re\xE7u`; + case "invalid_value": + if (issue2.values.length === 1) + return `Entr\xE9e invalide : ${stringifyPrimitive(issue2.values[0])} attendu`; + return `Option invalide : une valeur parmi ${joinValues(issue2.values, "|")} attendue`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Trop grand : ${issue2.origin ?? "valeur"} doit ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\xE9l\xE9ment(s)"}`; + return `Trop grand : ${issue2.origin ?? "valeur"} doit \xEAtre ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Trop petit : ${issue2.origin} doit ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `Trop petit : ${issue2.origin} doit \xEAtre ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `Cha\xEEne invalide : doit commencer par "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `Cha\xEEne invalide : doit se terminer par "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Cha\xEEne invalide : doit inclure "${_issue.includes}"`; + if (_issue.format === "regex") + return `Cha\xEEne invalide : doit correspondre au mod\xE8le ${_issue.pattern}`; + return `${Nouns[_issue.format] ?? issue2.format} invalide`; + } + case "not_multiple_of": + return `Nombre invalide : doit \xEAtre un multiple de ${issue2.divisor}`; + case "unrecognized_keys": + return `Cl\xE9${issue2.keys.length > 1 ? "s" : ""} non reconnue${issue2.keys.length > 1 ? "s" : ""} : ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Cl\xE9 invalide dans ${issue2.origin}`; + case "invalid_union": + return "Entr\xE9e invalide"; + case "invalid_element": + return `Valeur invalide dans ${issue2.origin}`; + default: + return `Entr\xE9e invalide`; + } + }; +}; +function fr_default() { + return { + localeError: error13() + }; +} +// node_modules/zod/v4/locales/fr-CA.js +var error14 = () => { + const Sizable = { + string: { unit: "caract\xE8res", verb: "avoir" }, + file: { unit: "octets", verb: "avoir" }, + array: { unit: "\xE9l\xE9ments", verb: "avoir" }, + set: { unit: "\xE9l\xE9ments", verb: "avoir" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType3 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "number"; + } + case "object": { + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "entr\xE9e", + email: "adresse courriel", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "date-heure ISO", + date: "date ISO", + time: "heure ISO", + duration: "dur\xE9e ISO", + ipv4: "adresse IPv4", + ipv6: "adresse IPv6", + cidrv4: "plage IPv4", + cidrv6: "plage IPv6", + base64: "cha\xEEne encod\xE9e en base64", + base64url: "cha\xEEne encod\xE9e en base64url", + json_string: "cha\xEEne JSON", + e164: "num\xE9ro E.164", + jwt: "JWT", + template_literal: "entr\xE9e" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Entr\xE9e invalide : attendu ${issue2.expected}, re\xE7u ${parsedType3(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Entr\xE9e invalide : attendu ${stringifyPrimitive(issue2.values[0])}`; + return `Option invalide : attendu l'une des valeurs suivantes ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "\u2264" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Trop grand : attendu que ${issue2.origin ?? "la valeur"} ait ${adj}${issue2.maximum.toString()} ${sizing.unit}`; + return `Trop grand : attendu que ${issue2.origin ?? "la valeur"} soit ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? "\u2265" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Trop petit : attendu que ${issue2.origin} ait ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `Trop petit : attendu que ${issue2.origin} soit ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `Cha\xEEne invalide : doit commencer par "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") + return `Cha\xEEne invalide : doit se terminer par "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Cha\xEEne invalide : doit inclure "${_issue.includes}"`; + if (_issue.format === "regex") + return `Cha\xEEne invalide : doit correspondre au motif ${_issue.pattern}`; + return `${Nouns[_issue.format] ?? issue2.format} invalide`; + } + case "not_multiple_of": + return `Nombre invalide : doit \xEAtre un multiple de ${issue2.divisor}`; + case "unrecognized_keys": + return `Cl\xE9${issue2.keys.length > 1 ? "s" : ""} non reconnue${issue2.keys.length > 1 ? "s" : ""} : ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Cl\xE9 invalide dans ${issue2.origin}`; + case "invalid_union": + return "Entr\xE9e invalide"; + case "invalid_element": + return `Valeur invalide dans ${issue2.origin}`; + default: + return `Entr\xE9e invalide`; + } + }; +}; +function fr_CA_default() { + return { + localeError: error14() + }; +} +// node_modules/zod/v4/locales/he.js +var error15 = () => { + const Sizable = { + string: { unit: "\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA", verb: "\u05DC\u05DB\u05DC\u05D5\u05DC" }, + file: { unit: "\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD", verb: "\u05DC\u05DB\u05DC\u05D5\u05DC" }, + array: { unit: "\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD", verb: "\u05DC\u05DB\u05DC\u05D5\u05DC" }, + set: { unit: "\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD", verb: "\u05DC\u05DB\u05DC\u05D5\u05DC" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType3 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "number"; + } + case "object": { + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u05E7\u05DC\u05D8", + email: "\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC", + url: "\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA", + emoji: "\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO", + date: "\u05EA\u05D0\u05E8\u05D9\u05DA ISO", + time: "\u05D6\u05DE\u05DF ISO", + duration: "\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO", + ipv4: "\u05DB\u05EA\u05D5\u05D1\u05EA IPv4", + ipv6: "\u05DB\u05EA\u05D5\u05D1\u05EA IPv6", + cidrv4: "\u05D8\u05D5\u05D5\u05D7 IPv4", + cidrv6: "\u05D8\u05D5\u05D5\u05D7 IPv6", + base64: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64", + base64url: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA", + json_string: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON", + e164: "\u05DE\u05E1\u05E4\u05E8 E.164", + jwt: "JWT", + template_literal: "\u05E7\u05DC\u05D8" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${issue2.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${parsedType3(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${stringifyPrimitive(issue2.values[0])}`; + return `\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05D0\u05D7\u05EA \u05DE\u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${issue2.origin ?? "value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`; + return `\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${issue2.origin ?? "value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${issue2.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${issue2.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1"${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${_issue.suffix}"`; + if (_issue.format === "includes") + return `\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${_issue.includes}"`; + if (_issue.format === "regex") + return `\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${_issue.pattern}`; + return `${Nouns[_issue.format] ?? issue2.format} \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF`; + } + case "not_multiple_of": + return `\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${issue2.divisor}`; + case "unrecognized_keys": + return `\u05DE\u05E4\u05EA\u05D7${issue2.keys.length > 1 ? "\u05D5\u05EA" : ""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${issue2.keys.length > 1 ? "\u05D9\u05DD" : "\u05D4"}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\u05DE\u05E4\u05EA\u05D7 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${issue2.origin}`; + case "invalid_union": + return "\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"; + case "invalid_element": + return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${issue2.origin}`; + default: + return `\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF`; + } + }; +}; +function he_default() { + return { + localeError: error15() + }; +} +// node_modules/zod/v4/locales/hu.js +var error16 = () => { + const Sizable = { + string: { unit: "karakter", verb: "legyen" }, + file: { unit: "byte", verb: "legyen" }, + array: { unit: "elem", verb: "legyen" }, + set: { unit: "elem", verb: "legyen" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType3 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "sz\xE1m"; + } + case "object": { + if (Array.isArray(data)) { + return "t\xF6mb"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "bemenet", + email: "email c\xEDm", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO id\u0151b\xE9lyeg", + date: "ISO d\xE1tum", + time: "ISO id\u0151", + duration: "ISO id\u0151intervallum", + ipv4: "IPv4 c\xEDm", + ipv6: "IPv6 c\xEDm", + cidrv4: "IPv4 tartom\xE1ny", + cidrv6: "IPv6 tartom\xE1ny", + base64: "base64-k\xF3dolt string", + base64url: "base64url-k\xF3dolt string", + json_string: "JSON string", + e164: "E.164 sz\xE1m", + jwt: "JWT", + template_literal: "bemenet" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${issue2.expected}, a kapott \xE9rt\xE9k ${parsedType3(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${stringifyPrimitive(issue2.values[0])}`; + return `\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `T\xFAl nagy: ${issue2.origin ?? "\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elem"}`; + return `T\xFAl nagy: a bemeneti \xE9rt\xE9k ${issue2.origin ?? "\xE9rt\xE9k"} t\xFAl nagy: ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${issue2.origin} m\xE9rete t\xFAl kicsi ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${issue2.origin} t\xFAl kicsi ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `\xC9rv\xE9nytelen string: "${_issue.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`; + if (_issue.format === "ends_with") + return `\xC9rv\xE9nytelen string: "${_issue.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`; + if (_issue.format === "includes") + return `\xC9rv\xE9nytelen string: "${_issue.includes}" \xE9rt\xE9ket kell tartalmaznia`; + if (_issue.format === "regex") + return `\xC9rv\xE9nytelen string: ${_issue.pattern} mint\xE1nak kell megfelelnie`; + return `\xC9rv\xE9nytelen ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\xC9rv\xE9nytelen sz\xE1m: ${issue2.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`; + case "unrecognized_keys": + return `Ismeretlen kulcs${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\xC9rv\xE9nytelen kulcs ${issue2.origin}`; + case "invalid_union": + return "\xC9rv\xE9nytelen bemenet"; + case "invalid_element": + return `\xC9rv\xE9nytelen \xE9rt\xE9k: ${issue2.origin}`; + default: + return `\xC9rv\xE9nytelen bemenet`; + } + }; +}; +function hu_default() { + return { + localeError: error16() + }; +} +// node_modules/zod/v4/locales/id.js +var error17 = () => { + const Sizable = { + string: { unit: "karakter", verb: "memiliki" }, + file: { unit: "byte", verb: "memiliki" }, + array: { unit: "item", verb: "memiliki" }, + set: { unit: "item", verb: "memiliki" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType3 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "number"; + } + case "object": { + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "input", + email: "alamat email", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "tanggal dan waktu format ISO", + date: "tanggal format ISO", + time: "jam format ISO", + duration: "durasi format ISO", + ipv4: "alamat IPv4", + ipv6: "alamat IPv6", + cidrv4: "rentang alamat IPv4", + cidrv6: "rentang alamat IPv6", + base64: "string dengan enkode base64", + base64url: "string dengan enkode base64url", + json_string: "string JSON", + e164: "angka E.164", + jwt: "JWT", + template_literal: "input" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Input tidak valid: diharapkan ${issue2.expected}, diterima ${parsedType3(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Input tidak valid: diharapkan ${stringifyPrimitive(issue2.values[0])}`; + return `Pilihan tidak valid: diharapkan salah satu dari ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Terlalu besar: diharapkan ${issue2.origin ?? "value"} memiliki ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemen"}`; + return `Terlalu besar: diharapkan ${issue2.origin ?? "value"} menjadi ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Terlalu kecil: diharapkan ${issue2.origin} memiliki ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `Terlalu kecil: diharapkan ${issue2.origin} menjadi ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `String tidak valid: harus dimulai dengan "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `String tidak valid: harus berakhir dengan "${_issue.suffix}"`; + if (_issue.format === "includes") + return `String tidak valid: harus menyertakan "${_issue.includes}"`; + if (_issue.format === "regex") + return `String tidak valid: harus sesuai pola ${_issue.pattern}`; + return `${Nouns[_issue.format] ?? issue2.format} tidak valid`; + } + case "not_multiple_of": + return `Angka tidak valid: harus kelipatan dari ${issue2.divisor}`; + case "unrecognized_keys": + return `Kunci tidak dikenali ${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Kunci tidak valid di ${issue2.origin}`; + case "invalid_union": + return "Input tidak valid"; + case "invalid_element": + return `Nilai tidak valid di ${issue2.origin}`; + default: + return `Input tidak valid`; + } + }; +}; +function id_default() { + return { + localeError: error17() + }; +} +// node_modules/zod/v4/locales/is.js +var parsedType3 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "n\xFAmer"; + } + case "object": { + if (Array.isArray(data)) { + return "fylki"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; +}; +var error18 = () => { + const Sizable = { + string: { unit: "stafi", verb: "a\xF0 hafa" }, + file: { unit: "b\xE6ti", verb: "a\xF0 hafa" }, + array: { unit: "hluti", verb: "a\xF0 hafa" }, + set: { unit: "hluti", verb: "a\xF0 hafa" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const Nouns = { + regex: "gildi", + email: "netfang", + url: "vefsl\xF3\xF0", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO dagsetning og t\xEDmi", + date: "ISO dagsetning", + time: "ISO t\xEDmi", + duration: "ISO t\xEDmalengd", + ipv4: "IPv4 address", + ipv6: "IPv6 address", + cidrv4: "IPv4 range", + cidrv6: "IPv6 range", + base64: "base64-encoded strengur", + base64url: "base64url-encoded strengur", + json_string: "JSON strengur", + e164: "E.164 t\xF6lugildi", + jwt: "JWT", + template_literal: "gildi" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Rangt gildi: \xDE\xFA sl\xF3st inn ${parsedType3(issue2.input)} \xFEar sem \xE1 a\xF0 vera ${issue2.expected}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Rangt gildi: gert r\xE1\xF0 fyrir ${stringifyPrimitive(issue2.values[0])}`; + return `\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${issue2.origin ?? "gildi"} hafi ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "hluti"}`; + return `Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${issue2.origin ?? "gildi"} s\xE9 ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${issue2.origin} hafi ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${issue2.origin} s\xE9 ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") + return `\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${_issue.suffix}"`; + if (_issue.format === "includes") + return `\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${_issue.includes}"`; + if (_issue.format === "regex") + return `\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${_issue.pattern}`; + return `Rangt ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${issue2.divisor}`; + case "unrecognized_keys": + return `\xD3\xFEekkt ${issue2.keys.length > 1 ? "ir lyklar" : "ur lykill"}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Rangur lykill \xED ${issue2.origin}`; + case "invalid_union": + return "Rangt gildi"; + case "invalid_element": + return `Rangt gildi \xED ${issue2.origin}`; + default: + return `Rangt gildi`; + } + }; +}; +function is_default() { + return { + localeError: error18() + }; +} +// node_modules/zod/v4/locales/it.js +var error19 = () => { + const Sizable = { + string: { unit: "caratteri", verb: "avere" }, + file: { unit: "byte", verb: "avere" }, + array: { unit: "elementi", verb: "avere" }, + set: { unit: "elementi", verb: "avere" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType4 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "numero"; + } + case "object": { + if (Array.isArray(data)) { + return "vettore"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "input", + email: "indirizzo email", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "data e ora ISO", + date: "data ISO", + time: "ora ISO", + duration: "durata ISO", + ipv4: "indirizzo IPv4", + ipv6: "indirizzo IPv6", + cidrv4: "intervallo IPv4", + cidrv6: "intervallo IPv6", + base64: "stringa codificata in base64", + base64url: "URL codificata in base64", + json_string: "stringa JSON", + e164: "numero E.164", + jwt: "JWT", + template_literal: "input" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Input non valido: atteso ${issue2.expected}, ricevuto ${parsedType4(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Input non valido: atteso ${stringifyPrimitive(issue2.values[0])}`; + return `Opzione non valida: atteso uno tra ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Troppo grande: ${issue2.origin ?? "valore"} deve avere ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementi"}`; + return `Troppo grande: ${issue2.origin ?? "valore"} deve essere ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Troppo piccolo: ${issue2.origin} deve avere ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `Troppo piccolo: ${issue2.origin} deve essere ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `Stringa non valida: deve iniziare con "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `Stringa non valida: deve terminare con "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Stringa non valida: deve includere "${_issue.includes}"`; + if (_issue.format === "regex") + return `Stringa non valida: deve corrispondere al pattern ${_issue.pattern}`; + return `Invalid ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Numero non valido: deve essere un multiplo di ${issue2.divisor}`; + case "unrecognized_keys": + return `Chiav${issue2.keys.length > 1 ? "i" : "e"} non riconosciut${issue2.keys.length > 1 ? "e" : "a"}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Chiave non valida in ${issue2.origin}`; + case "invalid_union": + return "Input non valido"; + case "invalid_element": + return `Valore non valido in ${issue2.origin}`; + default: + return `Input non valido`; + } + }; +}; +function it_default() { + return { + localeError: error19() + }; +} +// node_modules/zod/v4/locales/ja.js +var error20 = () => { + const Sizable = { + string: { unit: "\u6587\u5B57", verb: "\u3067\u3042\u308B" }, + file: { unit: "\u30D0\u30A4\u30C8", verb: "\u3067\u3042\u308B" }, + array: { unit: "\u8981\u7D20", verb: "\u3067\u3042\u308B" }, + set: { unit: "\u8981\u7D20", verb: "\u3067\u3042\u308B" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType4 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "\u6570\u5024"; + } + case "object": { + if (Array.isArray(data)) { + return "\u914D\u5217"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u5165\u529B\u5024", + email: "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9", + url: "URL", + emoji: "\u7D75\u6587\u5B57", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO\u65E5\u6642", + date: "ISO\u65E5\u4ED8", + time: "ISO\u6642\u523B", + duration: "ISO\u671F\u9593", + ipv4: "IPv4\u30A2\u30C9\u30EC\u30B9", + ipv6: "IPv6\u30A2\u30C9\u30EC\u30B9", + cidrv4: "IPv4\u7BC4\u56F2", + cidrv6: "IPv6\u7BC4\u56F2", + base64: "base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217", + base64url: "base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217", + json_string: "JSON\u6587\u5B57\u5217", + e164: "E.164\u756A\u53F7", + jwt: "JWT", + template_literal: "\u5165\u529B\u5024" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u7121\u52B9\u306A\u5165\u529B: ${issue2.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${parsedType4(issue2.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`; + case "invalid_value": + if (issue2.values.length === 1) + return `\u7121\u52B9\u306A\u5165\u529B: ${stringifyPrimitive(issue2.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`; + return `\u7121\u52B9\u306A\u9078\u629E: ${joinValues(issue2.values, "\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; + case "too_big": { + const adj = issue2.inclusive ? "\u4EE5\u4E0B\u3067\u3042\u308B" : "\u3088\u308A\u5C0F\u3055\u3044"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u5927\u304D\u3059\u304E\u308B\u5024: ${issue2.origin ?? "\u5024"}\u306F${issue2.maximum.toString()}${sizing.unit ?? "\u8981\u7D20"}${adj}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; + return `\u5927\u304D\u3059\u304E\u308B\u5024: ${issue2.origin ?? "\u5024"}\u306F${issue2.maximum.toString()}${adj}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; + } + case "too_small": { + const adj = issue2.inclusive ? "\u4EE5\u4E0A\u3067\u3042\u308B" : "\u3088\u308A\u5927\u304D\u3044"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u5C0F\u3055\u3059\u304E\u308B\u5024: ${issue2.origin}\u306F${issue2.minimum.toString()}${sizing.unit}${adj}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; + return `\u5C0F\u3055\u3059\u304E\u308B\u5024: ${issue2.origin}\u306F${issue2.minimum.toString()}${adj}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `\u7121\u52B9\u306A\u6587\u5B57\u5217: "${_issue.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; + if (_issue.format === "ends_with") + return `\u7121\u52B9\u306A\u6587\u5B57\u5217: "${_issue.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; + if (_issue.format === "includes") + return `\u7121\u52B9\u306A\u6587\u5B57\u5217: "${_issue.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; + if (_issue.format === "regex") + return `\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${_issue.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; + return `\u7121\u52B9\u306A${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u7121\u52B9\u306A\u6570\u5024: ${issue2.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; + case "unrecognized_keys": + return `\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${issue2.keys.length > 1 ? "\u7FA4" : ""}: ${joinValues(issue2.keys, "\u3001")}`; + case "invalid_key": + return `${issue2.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`; + case "invalid_union": + return "\u7121\u52B9\u306A\u5165\u529B"; + case "invalid_element": + return `${issue2.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`; + default: + return `\u7121\u52B9\u306A\u5165\u529B`; + } + }; +}; +function ja_default() { + return { + localeError: error20() + }; +} +// node_modules/zod/v4/locales/ka.js +var parsedType4 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8"; + } + case "object": { + if (Array.isArray(data)) { + return "\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + const typeMap = { + string: "\u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8", + boolean: "\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8", + undefined: "undefined", + bigint: "bigint", + symbol: "symbol", + function: "\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0" + }; + return typeMap[t] ?? t; +}; +var error21 = () => { + const Sizable = { + string: { unit: "\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" }, + file: { unit: "\u10D1\u10D0\u10D8\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" }, + array: { unit: "\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" }, + set: { unit: "\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const Nouns = { + regex: "\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0", + email: "\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8", + url: "URL", + emoji: "\u10D4\u10DB\u10DD\u10EF\u10D8", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD", + date: "\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8", + time: "\u10D3\u10E0\u10DD", + duration: "\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0", + ipv4: "IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8", + ipv6: "IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8", + cidrv4: "IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8", + cidrv6: "IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8", + base64: "base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8", + base64url: "base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8", + json_string: "JSON \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8", + e164: "E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8", + jwt: "JWT", + template_literal: "\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${issue2.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${parsedType4(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${stringifyPrimitive(issue2.values[0])}`; + return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${joinValues(issue2.values, "|")}-\u10D3\u10D0\u10DC`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${issue2.origin ?? "\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit}`; + return `\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${issue2.origin ?? "\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${issue2.origin} \u10D8\u10E7\u10DD\u10E1 ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${_issue.prefix}"-\u10D8\u10D7`; + } + if (_issue.format === "ends_with") + return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${_issue.suffix}"-\u10D8\u10D7`; + if (_issue.format === "includes") + return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${_issue.includes}"-\u10E1`; + if (_issue.format === "regex") + return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${_issue.pattern}`; + return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${issue2.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`; + case "unrecognized_keys": + return `\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${issue2.keys.length > 1 ? "\u10D4\u10D1\u10D8" : "\u10D8"}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${issue2.origin}-\u10E8\u10D8`; + case "invalid_union": + return "\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"; + case "invalid_element": + return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${issue2.origin}-\u10E8\u10D8`; + default: + return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0`; + } + }; +}; +function ka_default() { + return { + localeError: error21() + }; +} +// node_modules/zod/v4/locales/km.js +var error22 = () => { + const Sizable = { + string: { unit: "\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" }, + file: { unit: "\u1794\u17C3", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" }, + array: { unit: "\u1792\u17B6\u178F\u17BB", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" }, + set: { unit: "\u1792\u17B6\u178F\u17BB", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType5 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)" : "\u179B\u17C1\u1781"; + } + case "object": { + if (Array.isArray(data)) { + return "\u17A2\u17B6\u179A\u17C1 (Array)"; + } + if (data === null) { + return "\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B", + email: "\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B", + url: "URL", + emoji: "\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO", + date: "\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO", + time: "\u1798\u17C9\u17C4\u1784 ISO", + duration: "\u179A\u1799\u17C8\u1796\u17C1\u179B ISO", + ipv4: "\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4", + ipv6: "\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6", + cidrv4: "\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4", + cidrv6: "\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6", + base64: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64", + base64url: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url", + json_string: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON", + e164: "\u179B\u17C1\u1781 E.164", + jwt: "JWT", + template_literal: "\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${issue2.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${parsedType5(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${stringifyPrimitive(issue2.values[0])}`; + return `\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${issue2.origin ?? "\u178F\u1798\u17D2\u179B\u17C3"} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "\u1792\u17B6\u178F\u17BB"}`; + return `\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${issue2.origin ?? "\u178F\u1798\u17D2\u179B\u17C3"} ${adj} ${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${issue2.origin} ${adj} ${issue2.minimum.toString()} ${sizing.unit}`; + } + return `\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${issue2.origin} ${adj} ${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") + return `\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${_issue.suffix}"`; + if (_issue.format === "includes") + return `\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${_issue.includes}"`; + if (_issue.format === "regex") + return `\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${_issue.pattern}`; + return `\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${issue2.divisor}`; + case "unrecognized_keys": + return `\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${issue2.origin}`; + case "invalid_union": + return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C`; + case "invalid_element": + return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${issue2.origin}`; + default: + return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C`; + } + }; +}; +function km_default() { + return { + localeError: error22() + }; +} + +// node_modules/zod/v4/locales/kh.js +function kh_default() { + return km_default(); +} +// node_modules/zod/v4/locales/ko.js +var error23 = () => { + const Sizable = { + string: { unit: "\uBB38\uC790", verb: "to have" }, + file: { unit: "\uBC14\uC774\uD2B8", verb: "to have" }, + array: { unit: "\uAC1C", verb: "to have" }, + set: { unit: "\uAC1C", verb: "to have" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType5 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "number"; + } + case "object": { + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\uC785\uB825", + email: "\uC774\uBA54\uC77C \uC8FC\uC18C", + url: "URL", + emoji: "\uC774\uBAA8\uC9C0", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO \uB0A0\uC9DC\uC2DC\uAC04", + date: "ISO \uB0A0\uC9DC", + time: "ISO \uC2DC\uAC04", + duration: "ISO \uAE30\uAC04", + ipv4: "IPv4 \uC8FC\uC18C", + ipv6: "IPv6 \uC8FC\uC18C", + cidrv4: "IPv4 \uBC94\uC704", + cidrv6: "IPv6 \uBC94\uC704", + base64: "base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4", + base64url: "base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4", + json_string: "JSON \uBB38\uC790\uC5F4", + e164: "E.164 \uBC88\uD638", + jwt: "JWT", + template_literal: "\uC785\uB825" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${issue2.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${parsedType5(issue2.input)}\uC785\uB2C8\uB2E4`; + case "invalid_value": + if (issue2.values.length === 1) + return `\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${stringifyPrimitive(issue2.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`; + return `\uC798\uBABB\uB41C \uC635\uC158: ${joinValues(issue2.values, "\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`; + case "too_big": { + const adj = issue2.inclusive ? "\uC774\uD558" : "\uBBF8\uB9CC"; + const suffix = adj === "\uBBF8\uB9CC" ? "\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4" : "\uC5EC\uC57C \uD569\uB2C8\uB2E4"; + const sizing = getSizing(issue2.origin); + const unit = sizing?.unit ?? "\uC694\uC18C"; + if (sizing) + return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${issue2.maximum.toString()}${unit} ${adj}${suffix}`; + return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${issue2.maximum.toString()} ${adj}${suffix}`; + } + case "too_small": { + const adj = issue2.inclusive ? "\uC774\uC0C1" : "\uCD08\uACFC"; + const suffix = adj === "\uC774\uC0C1" ? "\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4" : "\uC5EC\uC57C \uD569\uB2C8\uB2E4"; + const sizing = getSizing(issue2.origin); + const unit = sizing?.unit ?? "\uC694\uC18C"; + if (sizing) { + return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${issue2.minimum.toString()}${unit} ${adj}${suffix}`; + } + return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${issue2.minimum.toString()} ${adj}${suffix}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${_issue.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`; + } + if (_issue.format === "ends_with") + return `\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${_issue.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`; + if (_issue.format === "includes") + return `\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${_issue.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`; + if (_issue.format === "regex") + return `\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${_issue.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`; + return `\uC798\uBABB\uB41C ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\uC798\uBABB\uB41C \uC22B\uC790: ${issue2.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`; + case "unrecognized_keys": + return `\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\uC798\uBABB\uB41C \uD0A4: ${issue2.origin}`; + case "invalid_union": + return `\uC798\uBABB\uB41C \uC785\uB825`; + case "invalid_element": + return `\uC798\uBABB\uB41C \uAC12: ${issue2.origin}`; + default: + return `\uC798\uBABB\uB41C \uC785\uB825`; + } + }; +}; +function ko_default() { + return { + localeError: error23() + }; +} +// node_modules/zod/v4/locales/lt.js +var parsedType5 = (data) => { + const t = typeof data; + return parsedTypeFromType(t, data); +}; +var parsedTypeFromType = (t, data = undefined) => { + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "skai\u010Dius"; + } + case "bigint": { + return "sveikasis skai\u010Dius"; + } + case "string": { + return "eilut\u0117"; + } + case "boolean": { + return "login\u0117 reik\u0161m\u0117"; + } + case "undefined": + case "void": { + return "neapibr\u0117\u017Eta reik\u0161m\u0117"; + } + case "function": { + return "funkcija"; + } + case "symbol": { + return "simbolis"; + } + case "object": { + if (data === undefined) + return "ne\u017Einomas objektas"; + if (data === null) + return "nulin\u0117 reik\u0161m\u0117"; + if (Array.isArray(data)) + return "masyvas"; + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + return "objektas"; + } + case "null": { + return "nulin\u0117 reik\u0161m\u0117"; + } + } + return t; +}; +var capitalizeFirstCharacter = (text) => { + return text.charAt(0).toUpperCase() + text.slice(1); +}; +function getUnitTypeFromNumber(number2) { + const abs = Math.abs(number2); + const last = abs % 10; + const last2 = abs % 100; + if (last2 >= 11 && last2 <= 19 || last === 0) + return "many"; + if (last === 1) + return "one"; + return "few"; +} +var error24 = () => { + const Sizable = { + string: { + unit: { + one: "simbolis", + few: "simboliai", + many: "simboli\u0173" + }, + verb: { + smaller: { + inclusive: "turi b\u016Bti ne ilgesn\u0117 kaip", + notInclusive: "turi b\u016Bti trumpesn\u0117 kaip" + }, + bigger: { + inclusive: "turi b\u016Bti ne trumpesn\u0117 kaip", + notInclusive: "turi b\u016Bti ilgesn\u0117 kaip" + } + } + }, + file: { + unit: { + one: "baitas", + few: "baitai", + many: "bait\u0173" + }, + verb: { + smaller: { + inclusive: "turi b\u016Bti ne didesnis kaip", + notInclusive: "turi b\u016Bti ma\u017Eesnis kaip" + }, + bigger: { + inclusive: "turi b\u016Bti ne ma\u017Eesnis kaip", + notInclusive: "turi b\u016Bti didesnis kaip" + } + } + }, + array: { + unit: { + one: "element\u0105", + few: "elementus", + many: "element\u0173" + }, + verb: { + smaller: { + inclusive: "turi tur\u0117ti ne daugiau kaip", + notInclusive: "turi tur\u0117ti ma\u017Eiau kaip" + }, + bigger: { + inclusive: "turi tur\u0117ti ne ma\u017Eiau kaip", + notInclusive: "turi tur\u0117ti daugiau kaip" + } + } + }, + set: { + unit: { + one: "element\u0105", + few: "elementus", + many: "element\u0173" + }, + verb: { + smaller: { + inclusive: "turi tur\u0117ti ne daugiau kaip", + notInclusive: "turi tur\u0117ti ma\u017Eiau kaip" + }, + bigger: { + inclusive: "turi tur\u0117ti ne ma\u017Eiau kaip", + notInclusive: "turi tur\u0117ti daugiau kaip" + } + } + } + }; + function getSizing(origin, unitType, inclusive, targetShouldBe) { + const result = Sizable[origin] ?? null; + if (result === null) + return result; + return { + unit: result.unit[unitType], + verb: result.verb[targetShouldBe][inclusive ? "inclusive" : "notInclusive"] + }; + } + const Nouns = { + regex: "\u012Fvestis", + email: "el. pa\u0161to adresas", + url: "URL", + emoji: "jaustukas", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO data ir laikas", + date: "ISO data", + time: "ISO laikas", + duration: "ISO trukm\u0117", + ipv4: "IPv4 adresas", + ipv6: "IPv6 adresas", + cidrv4: "IPv4 tinklo prefiksas (CIDR)", + cidrv6: "IPv6 tinklo prefiksas (CIDR)", + base64: "base64 u\u017Ekoduota eilut\u0117", + base64url: "base64url u\u017Ekoduota eilut\u0117", + json_string: "JSON eilut\u0117", + e164: "E.164 numeris", + jwt: "JWT", + template_literal: "\u012Fvestis" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Gautas tipas ${parsedType5(issue2.input)}, o tik\u0117tasi - ${parsedTypeFromType(issue2.expected)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Privalo b\u016Bti ${stringifyPrimitive(issue2.values[0])}`; + return `Privalo b\u016Bti vienas i\u0161 ${joinValues(issue2.values, "|")} pasirinkim\u0173`; + case "too_big": { + const origin = parsedTypeFromType(issue2.origin); + const sizing = getSizing(issue2.origin, getUnitTypeFromNumber(Number(issue2.maximum)), issue2.inclusive ?? false, "smaller"); + if (sizing?.verb) + return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reik\u0161m\u0117")} ${sizing.verb} ${issue2.maximum.toString()} ${sizing.unit ?? "element\u0173"}`; + const adj = issue2.inclusive ? "ne didesnis kaip" : "ma\u017Eesnis kaip"; + return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reik\u0161m\u0117")} turi b\u016Bti ${adj} ${issue2.maximum.toString()} ${sizing?.unit}`; + } + case "too_small": { + const origin = parsedTypeFromType(issue2.origin); + const sizing = getSizing(issue2.origin, getUnitTypeFromNumber(Number(issue2.minimum)), issue2.inclusive ?? false, "bigger"); + if (sizing?.verb) + return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reik\u0161m\u0117")} ${sizing.verb} ${issue2.minimum.toString()} ${sizing.unit ?? "element\u0173"}`; + const adj = issue2.inclusive ? "ne ma\u017Eesnis kaip" : "didesnis kaip"; + return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reik\u0161m\u0117")} turi b\u016Bti ${adj} ${issue2.minimum.toString()} ${sizing?.unit}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `Eilut\u0117 privalo prasid\u0117ti "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") + return `Eilut\u0117 privalo pasibaigti "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Eilut\u0117 privalo \u012Ftraukti "${_issue.includes}"`; + if (_issue.format === "regex") + return `Eilut\u0117 privalo atitikti ${_issue.pattern}`; + return `Neteisingas ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Skai\u010Dius privalo b\u016Bti ${issue2.divisor} kartotinis.`; + case "unrecognized_keys": + return `Neatpa\u017Eint${issue2.keys.length > 1 ? "i" : "as"} rakt${issue2.keys.length > 1 ? "ai" : "as"}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return "Rastas klaidingas raktas"; + case "invalid_union": + return "Klaidinga \u012Fvestis"; + case "invalid_element": { + const origin = parsedTypeFromType(issue2.origin); + return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`; + } + default: + return "Klaidinga \u012Fvestis"; + } + }; +}; +function lt_default() { + return { + localeError: error24() + }; +} +// node_modules/zod/v4/locales/mk.js +var error25 = () => { + const Sizable = { + string: { unit: "\u0437\u043D\u0430\u0446\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" }, + file: { unit: "\u0431\u0430\u0458\u0442\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" }, + array: { unit: "\u0441\u0442\u0430\u0432\u043A\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" }, + set: { unit: "\u0441\u0442\u0430\u0432\u043A\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType6 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "\u0431\u0440\u043E\u0458"; + } + case "object": { + if (Array.isArray(data)) { + return "\u043D\u0438\u0437\u0430"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u0432\u043D\u0435\u0441", + email: "\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430", + url: "URL", + emoji: "\u0435\u043C\u043E\u045F\u0438", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435", + date: "ISO \u0434\u0430\u0442\u0443\u043C", + time: "ISO \u0432\u0440\u0435\u043C\u0435", + duration: "ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435", + ipv4: "IPv4 \u0430\u0434\u0440\u0435\u0441\u0430", + ipv6: "IPv6 \u0430\u0434\u0440\u0435\u0441\u0430", + cidrv4: "IPv4 \u043E\u043F\u0441\u0435\u0433", + cidrv6: "IPv6 \u043E\u043F\u0441\u0435\u0433", + base64: "base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430", + base64url: "base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430", + json_string: "JSON \u043D\u0438\u0437\u0430", + e164: "E.164 \u0431\u0440\u043E\u0458", + jwt: "JWT", + template_literal: "\u0432\u043D\u0435\u0441" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${issue2.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${parsedType6(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`; + return `\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${issue2.origin ?? "\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`; + return `\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${issue2.origin ?? "\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${issue2.origin} \u0434\u0430 \u0438\u043C\u0430 ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${issue2.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") + return `\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${_issue.suffix}"`; + if (_issue.format === "includes") + return `\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${_issue.includes}"`; + if (_issue.format === "regex") + return `\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${_issue.pattern}`; + return `Invalid ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${issue2.divisor}`; + case "unrecognized_keys": + return `${issue2.keys.length > 1 ? "\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438" : "\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${issue2.origin}`; + case "invalid_union": + return "\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"; + case "invalid_element": + return `\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${issue2.origin}`; + default: + return `\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441`; + } + }; +}; +function mk_default() { + return { + localeError: error25() + }; +} +// node_modules/zod/v4/locales/ms.js +var error26 = () => { + const Sizable = { + string: { unit: "aksara", verb: "mempunyai" }, + file: { unit: "bait", verb: "mempunyai" }, + array: { unit: "elemen", verb: "mempunyai" }, + set: { unit: "elemen", verb: "mempunyai" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType6 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "nombor"; + } + case "object": { + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "input", + email: "alamat e-mel", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "tarikh masa ISO", + date: "tarikh ISO", + time: "masa ISO", + duration: "tempoh ISO", + ipv4: "alamat IPv4", + ipv6: "alamat IPv6", + cidrv4: "julat IPv4", + cidrv6: "julat IPv6", + base64: "string dikodkan base64", + base64url: "string dikodkan base64url", + json_string: "string JSON", + e164: "nombor E.164", + jwt: "JWT", + template_literal: "input" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Input tidak sah: dijangka ${issue2.expected}, diterima ${parsedType6(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Input tidak sah: dijangka ${stringifyPrimitive(issue2.values[0])}`; + return `Pilihan tidak sah: dijangka salah satu daripada ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Terlalu besar: dijangka ${issue2.origin ?? "nilai"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemen"}`; + return `Terlalu besar: dijangka ${issue2.origin ?? "nilai"} adalah ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Terlalu kecil: dijangka ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `Terlalu kecil: dijangka ${issue2.origin} adalah ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `String tidak sah: mesti bermula dengan "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `String tidak sah: mesti berakhir dengan "${_issue.suffix}"`; + if (_issue.format === "includes") + return `String tidak sah: mesti mengandungi "${_issue.includes}"`; + if (_issue.format === "regex") + return `String tidak sah: mesti sepadan dengan corak ${_issue.pattern}`; + return `${Nouns[_issue.format] ?? issue2.format} tidak sah`; + } + case "not_multiple_of": + return `Nombor tidak sah: perlu gandaan ${issue2.divisor}`; + case "unrecognized_keys": + return `Kunci tidak dikenali: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Kunci tidak sah dalam ${issue2.origin}`; + case "invalid_union": + return "Input tidak sah"; + case "invalid_element": + return `Nilai tidak sah dalam ${issue2.origin}`; + default: + return `Input tidak sah`; + } + }; +}; +function ms_default() { + return { + localeError: error26() + }; +} +// node_modules/zod/v4/locales/nl.js +var error27 = () => { + const Sizable = { + string: { unit: "tekens" }, + file: { unit: "bytes" }, + array: { unit: "elementen" }, + set: { unit: "elementen" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType6 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "getal"; + } + case "object": { + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "invoer", + email: "emailadres", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO datum en tijd", + date: "ISO datum", + time: "ISO tijd", + duration: "ISO duur", + ipv4: "IPv4-adres", + ipv6: "IPv6-adres", + cidrv4: "IPv4-bereik", + cidrv6: "IPv6-bereik", + base64: "base64-gecodeerde tekst", + base64url: "base64 URL-gecodeerde tekst", + json_string: "JSON string", + e164: "E.164-nummer", + jwt: "JWT", + template_literal: "invoer" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Ongeldige invoer: verwacht ${issue2.expected}, ontving ${parsedType6(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Ongeldige invoer: verwacht ${stringifyPrimitive(issue2.values[0])}`; + return `Ongeldige optie: verwacht \xE9\xE9n van ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Te lang: verwacht dat ${issue2.origin ?? "waarde"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementen"} bevat`; + return `Te lang: verwacht dat ${issue2.origin ?? "waarde"} ${adj}${issue2.maximum.toString()} is`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Te kort: verwacht dat ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} bevat`; + } + return `Te kort: verwacht dat ${issue2.origin} ${adj}${issue2.minimum.toString()} is`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `Ongeldige tekst: moet met "${_issue.prefix}" beginnen`; + } + if (_issue.format === "ends_with") + return `Ongeldige tekst: moet op "${_issue.suffix}" eindigen`; + if (_issue.format === "includes") + return `Ongeldige tekst: moet "${_issue.includes}" bevatten`; + if (_issue.format === "regex") + return `Ongeldige tekst: moet overeenkomen met patroon ${_issue.pattern}`; + return `Ongeldig: ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Ongeldig getal: moet een veelvoud van ${issue2.divisor} zijn`; + case "unrecognized_keys": + return `Onbekende key${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Ongeldige key in ${issue2.origin}`; + case "invalid_union": + return "Ongeldige invoer"; + case "invalid_element": + return `Ongeldige waarde in ${issue2.origin}`; + default: + return `Ongeldige invoer`; + } + }; +}; +function nl_default() { + return { + localeError: error27() + }; +} +// node_modules/zod/v4/locales/no.js +var error28 = () => { + const Sizable = { + string: { unit: "tegn", verb: "\xE5 ha" }, + file: { unit: "bytes", verb: "\xE5 ha" }, + array: { unit: "elementer", verb: "\xE5 inneholde" }, + set: { unit: "elementer", verb: "\xE5 inneholde" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType6 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "tall"; + } + case "object": { + if (Array.isArray(data)) { + return "liste"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "input", + email: "e-postadresse", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO dato- og klokkeslett", + date: "ISO-dato", + time: "ISO-klokkeslett", + duration: "ISO-varighet", + ipv4: "IPv4-omr\xE5de", + ipv6: "IPv6-omr\xE5de", + cidrv4: "IPv4-spekter", + cidrv6: "IPv6-spekter", + base64: "base64-enkodet streng", + base64url: "base64url-enkodet streng", + json_string: "JSON-streng", + e164: "E.164-nummer", + jwt: "JWT", + template_literal: "input" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Ugyldig input: forventet ${issue2.expected}, fikk ${parsedType6(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Ugyldig verdi: forventet ${stringifyPrimitive(issue2.values[0])}`; + return `Ugyldig valg: forventet en av ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `For stor(t): forventet ${issue2.origin ?? "value"} til \xE5 ha ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementer"}`; + return `For stor(t): forventet ${issue2.origin ?? "value"} til \xE5 ha ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `For lite(n): forventet ${issue2.origin} til \xE5 ha ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `For lite(n): forventet ${issue2.origin} til \xE5 ha ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `Ugyldig streng: m\xE5 starte med "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `Ugyldig streng: m\xE5 ende med "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Ugyldig streng: m\xE5 inneholde "${_issue.includes}"`; + if (_issue.format === "regex") + return `Ugyldig streng: m\xE5 matche m\xF8nsteret ${_issue.pattern}`; + return `Ugyldig ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Ugyldig tall: m\xE5 v\xE6re et multiplum av ${issue2.divisor}`; + case "unrecognized_keys": + return `${issue2.keys.length > 1 ? "Ukjente n\xF8kler" : "Ukjent n\xF8kkel"}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Ugyldig n\xF8kkel i ${issue2.origin}`; + case "invalid_union": + return "Ugyldig input"; + case "invalid_element": + return `Ugyldig verdi i ${issue2.origin}`; + default: + return `Ugyldig input`; + } + }; +}; +function no_default() { + return { + localeError: error28() + }; +} +// node_modules/zod/v4/locales/ota.js +var error29 = () => { + const Sizable = { + string: { unit: "harf", verb: "olmal\u0131d\u0131r" }, + file: { unit: "bayt", verb: "olmal\u0131d\u0131r" }, + array: { unit: "unsur", verb: "olmal\u0131d\u0131r" }, + set: { unit: "unsur", verb: "olmal\u0131d\u0131r" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType6 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "numara"; + } + case "object": { + if (Array.isArray(data)) { + return "saf"; + } + if (data === null) { + return "gayb"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "giren", + email: "epostag\xE2h", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO heng\xE2m\u0131", + date: "ISO tarihi", + time: "ISO zaman\u0131", + duration: "ISO m\xFCddeti", + ipv4: "IPv4 ni\u015F\xE2n\u0131", + ipv6: "IPv6 ni\u015F\xE2n\u0131", + cidrv4: "IPv4 menzili", + cidrv6: "IPv6 menzili", + base64: "base64-\u015Fifreli metin", + base64url: "base64url-\u015Fifreli metin", + json_string: "JSON metin", + e164: "E.164 say\u0131s\u0131", + jwt: "JWT", + template_literal: "giren" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `F\xE2sit giren: umulan ${issue2.expected}, al\u0131nan ${parsedType6(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `F\xE2sit giren: umulan ${stringifyPrimitive(issue2.values[0])}`; + return `F\xE2sit tercih: m\xFBteberler ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Fazla b\xFCy\xFCk: ${issue2.origin ?? "value"}, ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"} sahip olmal\u0131yd\u0131.`; + return `Fazla b\xFCy\xFCk: ${issue2.origin ?? "value"}, ${adj}${issue2.maximum.toString()} olmal\u0131yd\u0131.`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Fazla k\xFC\xE7\xFCk: ${issue2.origin}, ${adj}${issue2.minimum.toString()} ${sizing.unit} sahip olmal\u0131yd\u0131.`; + } + return `Fazla k\xFC\xE7\xFCk: ${issue2.origin}, ${adj}${issue2.minimum.toString()} olmal\u0131yd\u0131.`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `F\xE2sit metin: "${_issue.prefix}" ile ba\u015Flamal\u0131.`; + if (_issue.format === "ends_with") + return `F\xE2sit metin: "${_issue.suffix}" ile bitmeli.`; + if (_issue.format === "includes") + return `F\xE2sit metin: "${_issue.includes}" ihtiv\xE2 etmeli.`; + if (_issue.format === "regex") + return `F\xE2sit metin: ${_issue.pattern} nak\u015F\u0131na uymal\u0131.`; + return `F\xE2sit ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `F\xE2sit say\u0131: ${issue2.divisor} kat\u0131 olmal\u0131yd\u0131.`; + case "unrecognized_keys": + return `Tan\u0131nmayan anahtar ${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `${issue2.origin} i\xE7in tan\u0131nmayan anahtar var.`; + case "invalid_union": + return "Giren tan\u0131namad\u0131."; + case "invalid_element": + return `${issue2.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`; + default: + return `K\u0131ymet tan\u0131namad\u0131.`; + } + }; +}; +function ota_default() { + return { + localeError: error29() + }; +} +// node_modules/zod/v4/locales/ps.js +var error30 = () => { + const Sizable = { + string: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" }, + file: { unit: "\u0628\u0627\u06CC\u067C\u0633", verb: "\u0648\u0644\u0631\u064A" }, + array: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" }, + set: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType6 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "\u0639\u062F\u062F"; + } + case "object": { + if (Array.isArray(data)) { + return "\u0627\u0631\u06D0"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u0648\u0631\u0648\u062F\u064A", + email: "\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9", + url: "\u06CC\u0648 \u0622\u0631 \u0627\u0644", + emoji: "\u0627\u06CC\u0645\u0648\u062C\u064A", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A", + date: "\u0646\u06D0\u067C\u0647", + time: "\u0648\u062E\u062A", + duration: "\u0645\u0648\u062F\u0647", + ipv4: "\u062F IPv4 \u067E\u062A\u0647", + ipv6: "\u062F IPv6 \u067E\u062A\u0647", + cidrv4: "\u062F IPv4 \u0633\u0627\u062D\u0647", + cidrv6: "\u062F IPv6 \u0633\u0627\u062D\u0647", + base64: "base64-encoded \u0645\u062A\u0646", + base64url: "base64url-encoded \u0645\u062A\u0646", + json_string: "JSON \u0645\u062A\u0646", + e164: "\u062F E.164 \u0634\u0645\u06D0\u0631\u0647", + jwt: "JWT", + template_literal: "\u0648\u0631\u0648\u062F\u064A" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${issue2.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${parsedType6(issue2.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`; + case "invalid_value": + if (issue2.values.length === 1) { + return `\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${stringifyPrimitive(issue2.values[0])} \u0648\u0627\u06CC`; + } + return `\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${joinValues(issue2.values, "|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${issue2.origin ?? "\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`; + } + return `\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${issue2.origin ?? "\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${adj}${issue2.maximum.toString()} \u0648\u064A`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${issue2.origin} \u0628\u0627\u06CC\u062F ${adj}${issue2.minimum.toString()} ${sizing.unit} \u0648\u0644\u0631\u064A`; + } + return `\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${issue2.origin} \u0628\u0627\u06CC\u062F ${adj}${issue2.minimum.toString()} \u0648\u064A`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${_issue.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`; + } + if (_issue.format === "ends_with") { + return `\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${_issue.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`; + } + if (_issue.format === "includes") { + return `\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${_issue.includes}" \u0648\u0644\u0631\u064A`; + } + if (_issue.format === "regex") { + return `\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${_issue.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`; + } + return `${Nouns[_issue.format] ?? issue2.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`; + } + case "not_multiple_of": + return `\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${issue2.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`; + case "unrecognized_keys": + return `\u0646\u0627\u0633\u0645 ${issue2.keys.length > 1 ? "\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647" : "\u06A9\u0644\u06CC\u0689"}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${issue2.origin} \u06A9\u06D0`; + case "invalid_union": + return `\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A`; + case "invalid_element": + return `\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${issue2.origin} \u06A9\u06D0`; + default: + return `\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A`; + } + }; +}; +function ps_default() { + return { + localeError: error30() + }; +} +// node_modules/zod/v4/locales/pl.js +var error31 = () => { + const Sizable = { + string: { unit: "znak\xF3w", verb: "mie\u0107" }, + file: { unit: "bajt\xF3w", verb: "mie\u0107" }, + array: { unit: "element\xF3w", verb: "mie\u0107" }, + set: { unit: "element\xF3w", verb: "mie\u0107" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType6 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "liczba"; + } + case "object": { + if (Array.isArray(data)) { + return "tablica"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "wyra\u017Cenie", + email: "adres email", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "data i godzina w formacie ISO", + date: "data w formacie ISO", + time: "godzina w formacie ISO", + duration: "czas trwania ISO", + ipv4: "adres IPv4", + ipv6: "adres IPv6", + cidrv4: "zakres IPv4", + cidrv6: "zakres IPv6", + base64: "ci\u0105g znak\xF3w zakodowany w formacie base64", + base64url: "ci\u0105g znak\xF3w zakodowany w formacie base64url", + json_string: "ci\u0105g znak\xF3w w formacie JSON", + e164: "liczba E.164", + jwt: "JWT", + template_literal: "wej\u015Bcie" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${issue2.expected}, otrzymano ${parsedType6(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${stringifyPrimitive(issue2.values[0])}`; + return `Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${issue2.origin ?? "warto\u015B\u0107"} b\u0119dzie mie\u0107 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "element\xF3w"}`; + } + return `Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${issue2.origin ?? "warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${issue2.origin ?? "warto\u015B\u0107"} b\u0119dzie mie\u0107 ${adj}${issue2.minimum.toString()} ${sizing.unit ?? "element\xF3w"}`; + } + return `Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${issue2.origin ?? "warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${_issue.includes}"`; + if (_issue.format === "regex") + return `Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${_issue.pattern}`; + return `Nieprawid\u0142ow(y/a/e) ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${issue2.divisor}`; + case "unrecognized_keys": + return `Nierozpoznane klucze${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Nieprawid\u0142owy klucz w ${issue2.origin}`; + case "invalid_union": + return "Nieprawid\u0142owe dane wej\u015Bciowe"; + case "invalid_element": + return `Nieprawid\u0142owa warto\u015B\u0107 w ${issue2.origin}`; + default: + return `Nieprawid\u0142owe dane wej\u015Bciowe`; + } + }; +}; +function pl_default() { + return { + localeError: error31() + }; +} +// node_modules/zod/v4/locales/pt.js +var error32 = () => { + const Sizable = { + string: { unit: "caracteres", verb: "ter" }, + file: { unit: "bytes", verb: "ter" }, + array: { unit: "itens", verb: "ter" }, + set: { unit: "itens", verb: "ter" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType6 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "n\xFAmero"; + } + case "object": { + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "nulo"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "padr\xE3o", + email: "endere\xE7o de e-mail", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "data e hora ISO", + date: "data ISO", + time: "hora ISO", + duration: "dura\xE7\xE3o ISO", + ipv4: "endere\xE7o IPv4", + ipv6: "endere\xE7o IPv6", + cidrv4: "faixa de IPv4", + cidrv6: "faixa de IPv6", + base64: "texto codificado em base64", + base64url: "URL codificada em base64", + json_string: "texto JSON", + e164: "n\xFAmero E.164", + jwt: "JWT", + template_literal: "entrada" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Tipo inv\xE1lido: esperado ${issue2.expected}, recebido ${parsedType6(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Entrada inv\xE1lida: esperado ${stringifyPrimitive(issue2.values[0])}`; + return `Op\xE7\xE3o inv\xE1lida: esperada uma das ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Muito grande: esperado que ${issue2.origin ?? "valor"} tivesse ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementos"}`; + return `Muito grande: esperado que ${issue2.origin ?? "valor"} fosse ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Muito pequeno: esperado que ${issue2.origin} tivesse ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `Muito pequeno: esperado que ${issue2.origin} fosse ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `Texto inv\xE1lido: deve come\xE7ar com "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `Texto inv\xE1lido: deve terminar com "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Texto inv\xE1lido: deve incluir "${_issue.includes}"`; + if (_issue.format === "regex") + return `Texto inv\xE1lido: deve corresponder ao padr\xE3o ${_issue.pattern}`; + return `${Nouns[_issue.format] ?? issue2.format} inv\xE1lido`; + } + case "not_multiple_of": + return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`; + case "unrecognized_keys": + return `Chave${issue2.keys.length > 1 ? "s" : ""} desconhecida${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Chave inv\xE1lida em ${issue2.origin}`; + case "invalid_union": + return "Entrada inv\xE1lida"; + case "invalid_element": + return `Valor inv\xE1lido em ${issue2.origin}`; + default: + return `Campo inv\xE1lido`; + } + }; +}; +function pt_default() { + return { + localeError: error32() + }; +} +// node_modules/zod/v4/locales/ru.js +function getRussianPlural(count, one, few, many) { + const absCount = Math.abs(count); + const lastDigit = absCount % 10; + const lastTwoDigits = absCount % 100; + if (lastTwoDigits >= 11 && lastTwoDigits <= 19) { + return many; + } + if (lastDigit === 1) { + return one; + } + if (lastDigit >= 2 && lastDigit <= 4) { + return few; + } + return many; +} +var error33 = () => { + const Sizable = { + string: { + unit: { + one: "\u0441\u0438\u043C\u0432\u043E\u043B", + few: "\u0441\u0438\u043C\u0432\u043E\u043B\u0430", + many: "\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432" + }, + verb: "\u0438\u043C\u0435\u0442\u044C" + }, + file: { + unit: { + one: "\u0431\u0430\u0439\u0442", + few: "\u0431\u0430\u0439\u0442\u0430", + many: "\u0431\u0430\u0439\u0442" + }, + verb: "\u0438\u043C\u0435\u0442\u044C" + }, + array: { + unit: { + one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442", + few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430", + many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432" + }, + verb: "\u0438\u043C\u0435\u0442\u044C" + }, + set: { + unit: { + one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442", + few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430", + many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432" + }, + verb: "\u0438\u043C\u0435\u0442\u044C" + } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType6 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E"; + } + case "object": { + if (Array.isArray(data)) { + return "\u043C\u0430\u0441\u0441\u0438\u0432"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u0432\u0432\u043E\u0434", + email: "email \u0430\u0434\u0440\u0435\u0441", + url: "URL", + emoji: "\u044D\u043C\u043E\u0434\u0437\u0438", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F", + date: "ISO \u0434\u0430\u0442\u0430", + time: "ISO \u0432\u0440\u0435\u043C\u044F", + duration: "ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C", + ipv4: "IPv4 \u0430\u0434\u0440\u0435\u0441", + ipv6: "IPv6 \u0430\u0434\u0440\u0435\u0441", + cidrv4: "IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D", + cidrv6: "IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D", + base64: "\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64", + base64url: "\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url", + json_string: "JSON \u0441\u0442\u0440\u043E\u043A\u0430", + e164: "\u043D\u043E\u043C\u0435\u0440 E.164", + jwt: "JWT", + template_literal: "\u0432\u0432\u043E\u0434" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${issue2.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${parsedType6(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${stringifyPrimitive(issue2.values[0])}`; + return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) { + const maxValue = Number(issue2.maximum); + const unit = getRussianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many); + return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${adj}${issue2.maximum.toString()} ${unit}`; + } + return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + const minValue = Number(issue2.minimum); + const unit = getRussianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many); + return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${adj}${issue2.minimum.toString()} ${unit}`; + } + return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin} \u0431\u0443\u0434\u0435\u0442 ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${_issue.suffix}"`; + if (_issue.format === "includes") + return `\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${_issue.includes}"`; + if (_issue.format === "regex") + return `\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${_issue.pattern}`; + return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${issue2.divisor}`; + case "unrecognized_keys": + return `\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${issue2.keys.length > 1 ? "\u044B\u0435" : "\u044B\u0439"} \u043A\u043B\u044E\u0447${issue2.keys.length > 1 ? "\u0438" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${issue2.origin}`; + case "invalid_union": + return "\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"; + case "invalid_element": + return `\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${issue2.origin}`; + default: + return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435`; + } + }; +}; +function ru_default() { + return { + localeError: error33() + }; +} +// node_modules/zod/v4/locales/sl.js +var error34 = () => { + const Sizable = { + string: { unit: "znakov", verb: "imeti" }, + file: { unit: "bajtov", verb: "imeti" }, + array: { unit: "elementov", verb: "imeti" }, + set: { unit: "elementov", verb: "imeti" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType6 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "\u0161tevilo"; + } + case "object": { + if (Array.isArray(data)) { + return "tabela"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "vnos", + email: "e-po\u0161tni naslov", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO datum in \u010Das", + date: "ISO datum", + time: "ISO \u010Das", + duration: "ISO trajanje", + ipv4: "IPv4 naslov", + ipv6: "IPv6 naslov", + cidrv4: "obseg IPv4", + cidrv6: "obseg IPv6", + base64: "base64 kodiran niz", + base64url: "base64url kodiran niz", + json_string: "JSON niz", + e164: "E.164 \u0161tevilka", + jwt: "JWT", + template_literal: "vnos" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Neveljaven vnos: pri\u010Dakovano ${issue2.expected}, prejeto ${parsedType6(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Neveljaven vnos: pri\u010Dakovano ${stringifyPrimitive(issue2.values[0])}`; + return `Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Preveliko: pri\u010Dakovano, da bo ${issue2.origin ?? "vrednost"} imelo ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementov"}`; + return `Preveliko: pri\u010Dakovano, da bo ${issue2.origin ?? "vrednost"} ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Premajhno: pri\u010Dakovano, da bo ${issue2.origin} imelo ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `Premajhno: pri\u010Dakovano, da bo ${issue2.origin} ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `Neveljaven niz: mora se za\u010Deti z "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") + return `Neveljaven niz: mora se kon\u010Dati z "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Neveljaven niz: mora vsebovati "${_issue.includes}"`; + if (_issue.format === "regex") + return `Neveljaven niz: mora ustrezati vzorcu ${_issue.pattern}`; + return `Neveljaven ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${issue2.divisor}`; + case "unrecognized_keys": + return `Neprepoznan${issue2.keys.length > 1 ? "i klju\u010Di" : " klju\u010D"}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Neveljaven klju\u010D v ${issue2.origin}`; + case "invalid_union": + return "Neveljaven vnos"; + case "invalid_element": + return `Neveljavna vrednost v ${issue2.origin}`; + default: + return "Neveljaven vnos"; + } + }; +}; +function sl_default() { + return { + localeError: error34() + }; +} +// node_modules/zod/v4/locales/sv.js +var error35 = () => { + const Sizable = { + string: { unit: "tecken", verb: "att ha" }, + file: { unit: "bytes", verb: "att ha" }, + array: { unit: "objekt", verb: "att inneh\xE5lla" }, + set: { unit: "objekt", verb: "att inneh\xE5lla" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType6 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "antal"; + } + case "object": { + if (Array.isArray(data)) { + return "lista"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "regulj\xE4rt uttryck", + email: "e-postadress", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO-datum och tid", + date: "ISO-datum", + time: "ISO-tid", + duration: "ISO-varaktighet", + ipv4: "IPv4-intervall", + ipv6: "IPv6-intervall", + cidrv4: "IPv4-spektrum", + cidrv6: "IPv6-spektrum", + base64: "base64-kodad str\xE4ng", + base64url: "base64url-kodad str\xE4ng", + json_string: "JSON-str\xE4ng", + e164: "E.164-nummer", + jwt: "JWT", + template_literal: "mall-literal" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Ogiltig inmatning: f\xF6rv\xE4ntat ${issue2.expected}, fick ${parsedType6(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Ogiltig inmatning: f\xF6rv\xE4ntat ${stringifyPrimitive(issue2.values[0])}`; + return `Ogiltigt val: f\xF6rv\xE4ntade en av ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `F\xF6r stor(t): f\xF6rv\xE4ntade ${issue2.origin ?? "v\xE4rdet"} att ha ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "element"}`; + } + return `F\xF6r stor(t): f\xF6rv\xE4ntat ${issue2.origin ?? "v\xE4rdet"} att ha ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `F\xF6r lite(t): f\xF6rv\xE4ntade ${issue2.origin ?? "v\xE4rdet"} att ha ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `F\xF6r lite(t): f\xF6rv\xE4ntade ${issue2.origin ?? "v\xE4rdet"} att ha ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") + return `Ogiltig str\xE4ng: m\xE5ste sluta med "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${_issue.includes}"`; + if (_issue.format === "regex") + return `Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${_issue.pattern}"`; + return `Ogiltig(t) ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Ogiltigt tal: m\xE5ste vara en multipel av ${issue2.divisor}`; + case "unrecognized_keys": + return `${issue2.keys.length > 1 ? "Ok\xE4nda nycklar" : "Ok\xE4nd nyckel"}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Ogiltig nyckel i ${issue2.origin ?? "v\xE4rdet"}`; + case "invalid_union": + return "Ogiltig input"; + case "invalid_element": + return `Ogiltigt v\xE4rde i ${issue2.origin ?? "v\xE4rdet"}`; + default: + return `Ogiltig input`; + } + }; +}; +function sv_default() { + return { + localeError: error35() + }; +} +// node_modules/zod/v4/locales/ta.js +var error36 = () => { + const Sizable = { + string: { unit: "\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" }, + file: { unit: "\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" }, + array: { unit: "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" }, + set: { unit: "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType6 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1" : "\u0B8E\u0BA3\u0BCD"; + } + case "object": { + if (Array.isArray(data)) { + return "\u0B85\u0BA3\u0BBF"; + } + if (data === null) { + return "\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1", + email: "\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD", + date: "ISO \u0BA4\u0BC7\u0BA4\u0BBF", + time: "ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD", + duration: "ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1", + ipv4: "IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF", + ipv6: "IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF", + cidrv4: "IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1", + cidrv6: "IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1", + base64: "base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD", + base64url: "base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD", + json_string: "JSON \u0B9A\u0BB0\u0BAE\u0BCD", + e164: "E.164 \u0B8E\u0BA3\u0BCD", + jwt: "JWT", + template_literal: "input" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${issue2.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${parsedType6(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${stringifyPrimitive(issue2.values[0])}`; + return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${joinValues(issue2.values, "|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${issue2.origin ?? "\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; + } + return `\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${issue2.origin ?? "\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${adj}${issue2.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; + } + return `\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${issue2.origin} ${adj}${issue2.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${_issue.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; + if (_issue.format === "ends_with") + return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${_issue.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; + if (_issue.format === "includes") + return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${_issue.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; + if (_issue.format === "regex") + return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${_issue.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; + return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${issue2.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; + case "unrecognized_keys": + return `\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${issue2.keys.length > 1 ? "\u0B95\u0BB3\u0BCD" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `${issue2.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`; + case "invalid_union": + return "\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"; + case "invalid_element": + return `${issue2.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`; + default: + return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1`; + } + }; +}; +function ta_default() { + return { + localeError: error36() + }; +} +// node_modules/zod/v4/locales/th.js +var error37 = () => { + const Sizable = { + string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }, + file: { unit: "\u0E44\u0E1A\u0E15\u0E4C", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }, + array: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }, + set: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType6 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)" : "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02"; + } + case "object": { + if (Array.isArray(data)) { + return "\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)"; + } + if (data === null) { + return "\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19", + email: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25", + url: "URL", + emoji: "\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO", + date: "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO", + time: "\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO", + duration: "\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO", + ipv4: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4", + ipv6: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6", + cidrv4: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4", + cidrv6: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6", + base64: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64", + base64url: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL", + json_string: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON", + e164: "\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)", + jwt: "\u0E42\u0E17\u0E40\u0E04\u0E19 JWT", + template_literal: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${issue2.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${parsedType6(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${stringifyPrimitive(issue2.values[0])}`; + return `\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19" : "\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${issue2.origin ?? "\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`; + return `\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${issue2.origin ?? "\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${adj} ${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? "\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22" : "\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${issue2.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${adj} ${issue2.minimum.toString()} ${sizing.unit}`; + } + return `\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${issue2.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${adj} ${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") + return `\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${_issue.suffix}"`; + if (_issue.format === "includes") + return `\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${_issue.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`; + if (_issue.format === "regex") + return `\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${_issue.pattern}`; + return `\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${issue2.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`; + case "unrecognized_keys": + return `\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${issue2.origin}`; + case "invalid_union": + return "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49"; + case "invalid_element": + return `\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${issue2.origin}`; + default: + return `\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07`; + } + }; +}; +function th_default() { + return { + localeError: error37() + }; +} +// node_modules/zod/v4/locales/tr.js +var parsedType6 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "number"; + } + case "object": { + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; +}; +var error38 = () => { + const Sizable = { + string: { unit: "karakter", verb: "olmal\u0131" }, + file: { unit: "bayt", verb: "olmal\u0131" }, + array: { unit: "\xF6\u011Fe", verb: "olmal\u0131" }, + set: { unit: "\xF6\u011Fe", verb: "olmal\u0131" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const Nouns = { + regex: "girdi", + email: "e-posta adresi", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO tarih ve saat", + date: "ISO tarih", + time: "ISO saat", + duration: "ISO s\xFCre", + ipv4: "IPv4 adresi", + ipv6: "IPv6 adresi", + cidrv4: "IPv4 aral\u0131\u011F\u0131", + cidrv6: "IPv6 aral\u0131\u011F\u0131", + base64: "base64 ile \u015Fifrelenmi\u015F metin", + base64url: "base64url ile \u015Fifrelenmi\u015F metin", + json_string: "JSON dizesi", + e164: "E.164 say\u0131s\u0131", + jwt: "JWT", + template_literal: "\u015Eablon dizesi" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `Ge\xE7ersiz de\u011Fer: beklenen ${issue2.expected}, al\u0131nan ${parsedType6(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `Ge\xE7ersiz de\u011Fer: beklenen ${stringifyPrimitive(issue2.values[0])}`; + return `Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\xC7ok b\xFCy\xFCk: beklenen ${issue2.origin ?? "de\u011Fer"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\xF6\u011Fe"}`; + return `\xC7ok b\xFCy\xFCk: beklenen ${issue2.origin ?? "de\u011Fer"} ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\xC7ok k\xFC\xE7\xFCk: beklenen ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + return `\xC7ok k\xFC\xE7\xFCk: beklenen ${issue2.origin} ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `Ge\xE7ersiz metin: "${_issue.prefix}" ile ba\u015Flamal\u0131`; + if (_issue.format === "ends_with") + return `Ge\xE7ersiz metin: "${_issue.suffix}" ile bitmeli`; + if (_issue.format === "includes") + return `Ge\xE7ersiz metin: "${_issue.includes}" i\xE7ermeli`; + if (_issue.format === "regex") + return `Ge\xE7ersiz metin: ${_issue.pattern} desenine uymal\u0131`; + return `Ge\xE7ersiz ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Ge\xE7ersiz say\u0131: ${issue2.divisor} ile tam b\xF6l\xFCnebilmeli`; + case "unrecognized_keys": + return `Tan\u0131nmayan anahtar${issue2.keys.length > 1 ? "lar" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `${issue2.origin} i\xE7inde ge\xE7ersiz anahtar`; + case "invalid_union": + return "Ge\xE7ersiz de\u011Fer"; + case "invalid_element": + return `${issue2.origin} i\xE7inde ge\xE7ersiz de\u011Fer`; + default: + return `Ge\xE7ersiz de\u011Fer`; + } + }; +}; +function tr_default() { + return { + localeError: error38() + }; +} +// node_modules/zod/v4/locales/uk.js +var error39 = () => { + const Sizable = { + string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" }, + file: { unit: "\u0431\u0430\u0439\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" }, + array: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" }, + set: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType7 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E"; + } + case "object": { + if (Array.isArray(data)) { + return "\u043C\u0430\u0441\u0438\u0432"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456", + email: "\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438", + url: "URL", + emoji: "\u0435\u043C\u043E\u0434\u0437\u0456", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO", + date: "\u0434\u0430\u0442\u0430 ISO", + time: "\u0447\u0430\u0441 ISO", + duration: "\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO", + ipv4: "\u0430\u0434\u0440\u0435\u0441\u0430 IPv4", + ipv6: "\u0430\u0434\u0440\u0435\u0441\u0430 IPv6", + cidrv4: "\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4", + cidrv6: "\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6", + base64: "\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64", + base64url: "\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url", + json_string: "\u0440\u044F\u0434\u043E\u043A JSON", + e164: "\u043D\u043E\u043C\u0435\u0440 E.164", + jwt: "JWT", + template_literal: "\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${issue2.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${parsedType7(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${stringifyPrimitive(issue2.values[0])}`; + return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`; + return `\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${issue2.origin} \u0431\u0443\u0434\u0435 ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${_issue.suffix}"`; + if (_issue.format === "includes") + return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${_issue.includes}"`; + if (_issue.format === "regex") + return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${_issue.pattern}`; + return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${issue2.divisor}`; + case "unrecognized_keys": + return `\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${issue2.keys.length > 1 ? "\u0456" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${issue2.origin}`; + case "invalid_union": + return "\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"; + case "invalid_element": + return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${issue2.origin}`; + default: + return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456`; + } + }; +}; +function uk_default() { + return { + localeError: error39() + }; +} + +// node_modules/zod/v4/locales/ua.js +function ua_default() { + return uk_default(); +} +// node_modules/zod/v4/locales/ur.js +var error40 = () => { + const Sizable = { + string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" }, + file: { unit: "\u0628\u0627\u0626\u0679\u0633", verb: "\u06C1\u0648\u0646\u0627" }, + array: { unit: "\u0622\u0626\u0679\u0645\u0632", verb: "\u06C1\u0648\u0646\u0627" }, + set: { unit: "\u0622\u0626\u0679\u0645\u0632", verb: "\u06C1\u0648\u0646\u0627" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType7 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "\u0646\u0645\u0628\u0631"; + } + case "object": { + if (Array.isArray(data)) { + return "\u0622\u0631\u06D2"; + } + if (data === null) { + return "\u0646\u0644"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u0627\u0646 \u067E\u0679", + email: "\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633", + url: "\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644", + emoji: "\u0627\u06CC\u0645\u0648\u062C\u06CC", + uuid: "\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC", + uuidv4: "\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4", + uuidv6: "\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6", + nanoid: "\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC", + guid: "\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC", + cuid: "\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC", + cuid2: "\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2", + ulid: "\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC", + xid: "\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC", + ksuid: "\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC", + datetime: "\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645", + date: "\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E", + time: "\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A", + duration: "\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A", + ipv4: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633", + ipv6: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633", + cidrv4: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C", + cidrv6: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C", + base64: "\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF", + base64url: "\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF", + json_string: "\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF", + e164: "\u0627\u06CC 164 \u0646\u0645\u0628\u0631", + jwt: "\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC", + template_literal: "\u0627\u0646 \u067E\u0679" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${issue2.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${parsedType7(issue2.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`; + case "invalid_value": + if (issue2.values.length === 1) + return `\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${stringifyPrimitive(issue2.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`; + return `\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${joinValues(issue2.values, "|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u0628\u06C1\u062A \u0628\u0691\u0627: ${issue2.origin ?? "\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`; + return `\u0628\u06C1\u062A \u0628\u0691\u0627: ${issue2.origin ?? "\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${adj}${issue2.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${issue2.origin} \u06A9\u06D2 ${adj}${issue2.minimum.toString()} ${sizing.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`; + } + return `\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${issue2.origin} \u06A9\u0627 ${adj}${issue2.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${_issue.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`; + } + if (_issue.format === "ends_with") + return `\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${_issue.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`; + if (_issue.format === "includes") + return `\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${_issue.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`; + if (_issue.format === "regex") + return `\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${_issue.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`; + return `\u063A\u0644\u0637 ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${issue2.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`; + case "unrecognized_keys": + return `\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${issue2.keys.length > 1 ? "\u0632" : ""}: ${joinValues(issue2.keys, "\u060C ")}`; + case "invalid_key": + return `${issue2.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`; + case "invalid_union": + return "\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"; + case "invalid_element": + return `${issue2.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`; + default: + return `\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679`; + } + }; +}; +function ur_default() { + return { + localeError: error40() + }; +} +// node_modules/zod/v4/locales/vi.js +var error41 = () => { + const Sizable = { + string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" }, + file: { unit: "byte", verb: "c\xF3" }, + array: { unit: "ph\u1EA7n t\u1EED", verb: "c\xF3" }, + set: { unit: "ph\u1EA7n t\u1EED", verb: "c\xF3" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType7 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "s\u1ED1"; + } + case "object": { + if (Array.isArray(data)) { + return "m\u1EA3ng"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u0111\u1EA7u v\xE0o", + email: "\u0111\u1ECBa ch\u1EC9 email", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ng\xE0y gi\u1EDD ISO", + date: "ng\xE0y ISO", + time: "gi\u1EDD ISO", + duration: "kho\u1EA3ng th\u1EDDi gian ISO", + ipv4: "\u0111\u1ECBa ch\u1EC9 IPv4", + ipv6: "\u0111\u1ECBa ch\u1EC9 IPv6", + cidrv4: "d\u1EA3i IPv4", + cidrv6: "d\u1EA3i IPv6", + base64: "chu\u1ED7i m\xE3 h\xF3a base64", + base64url: "chu\u1ED7i m\xE3 h\xF3a base64url", + json_string: "chu\u1ED7i JSON", + e164: "s\u1ED1 E.164", + jwt: "JWT", + template_literal: "\u0111\u1EA7u v\xE0o" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${issue2.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${parsedType7(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${stringifyPrimitive(issue2.values[0])}`; + return `T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${issue2.origin ?? "gi\xE1 tr\u1ECB"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "ph\u1EA7n t\u1EED"}`; + return `Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${issue2.origin ?? "gi\xE1 tr\u1ECB"} ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${issue2.origin} ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${_issue.includes}"`; + if (_issue.format === "regex") + return `Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${_issue.pattern}`; + return `${Nouns[_issue.format] ?? issue2.format} kh\xF4ng h\u1EE3p l\u1EC7`; + } + case "not_multiple_of": + return `S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${issue2.divisor}`; + case "unrecognized_keys": + return `Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${issue2.origin}`; + case "invalid_union": + return "\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"; + case "invalid_element": + return `Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${issue2.origin}`; + default: + return `\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7`; + } + }; +}; +function vi_default() { + return { + localeError: error41() + }; +} +// node_modules/zod/v4/locales/zh-CN.js +var error42 = () => { + const Sizable = { + string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" }, + file: { unit: "\u5B57\u8282", verb: "\u5305\u542B" }, + array: { unit: "\u9879", verb: "\u5305\u542B" }, + set: { unit: "\u9879", verb: "\u5305\u542B" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType7 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "\u975E\u6570\u5B57(NaN)" : "\u6570\u5B57"; + } + case "object": { + if (Array.isArray(data)) { + return "\u6570\u7EC4"; + } + if (data === null) { + return "\u7A7A\u503C(null)"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u8F93\u5165", + email: "\u7535\u5B50\u90AE\u4EF6", + url: "URL", + emoji: "\u8868\u60C5\u7B26\u53F7", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO\u65E5\u671F\u65F6\u95F4", + date: "ISO\u65E5\u671F", + time: "ISO\u65F6\u95F4", + duration: "ISO\u65F6\u957F", + ipv4: "IPv4\u5730\u5740", + ipv6: "IPv6\u5730\u5740", + cidrv4: "IPv4\u7F51\u6BB5", + cidrv6: "IPv6\u7F51\u6BB5", + base64: "base64\u7F16\u7801\u5B57\u7B26\u4E32", + base64url: "base64url\u7F16\u7801\u5B57\u7B26\u4E32", + json_string: "JSON\u5B57\u7B26\u4E32", + e164: "E.164\u53F7\u7801", + jwt: "JWT", + template_literal: "\u8F93\u5165" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${issue2.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${parsedType7(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${stringifyPrimitive(issue2.values[0])}`; + return `\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${issue2.origin ?? "\u503C"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u4E2A\u5143\u7D20"}`; + return `\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${issue2.origin ?? "\u503C"} ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${issue2.origin} ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${_issue.prefix}" \u5F00\u5934`; + if (_issue.format === "ends_with") + return `\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${_issue.suffix}" \u7ED3\u5C3E`; + if (_issue.format === "includes") + return `\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${_issue.includes}"`; + if (_issue.format === "regex") + return `\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${_issue.pattern}`; + return `\u65E0\u6548${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${issue2.divisor} \u7684\u500D\u6570`; + case "unrecognized_keys": + return `\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `${issue2.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`; + case "invalid_union": + return "\u65E0\u6548\u8F93\u5165"; + case "invalid_element": + return `${issue2.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`; + default: + return `\u65E0\u6548\u8F93\u5165`; + } + }; +}; +function zh_CN_default() { + return { + localeError: error42() + }; +} +// node_modules/zod/v4/locales/zh-TW.js +var error43 = () => { + const Sizable = { + string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" }, + file: { unit: "\u4F4D\u5143\u7D44", verb: "\u64C1\u6709" }, + array: { unit: "\u9805\u76EE", verb: "\u64C1\u6709" }, + set: { unit: "\u9805\u76EE", verb: "\u64C1\u6709" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType7 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "number"; + } + case "object": { + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u8F38\u5165", + email: "\u90F5\u4EF6\u5730\u5740", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO \u65E5\u671F\u6642\u9593", + date: "ISO \u65E5\u671F", + time: "ISO \u6642\u9593", + duration: "ISO \u671F\u9593", + ipv4: "IPv4 \u4F4D\u5740", + ipv6: "IPv6 \u4F4D\u5740", + cidrv4: "IPv4 \u7BC4\u570D", + cidrv6: "IPv6 \u7BC4\u570D", + base64: "base64 \u7DE8\u78BC\u5B57\u4E32", + base64url: "base64url \u7DE8\u78BC\u5B57\u4E32", + json_string: "JSON \u5B57\u4E32", + e164: "E.164 \u6578\u503C", + jwt: "JWT", + template_literal: "\u8F38\u5165" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${issue2.expected}\uFF0C\u4F46\u6536\u5230 ${parsedType7(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${stringifyPrimitive(issue2.values[0])}`; + return `\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${issue2.origin ?? "\u503C"} \u61C9\u70BA ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u500B\u5143\u7D20"}`; + return `\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${issue2.origin ?? "\u503C"} \u61C9\u70BA ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${issue2.origin} \u61C9\u70BA ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${issue2.origin} \u61C9\u70BA ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${_issue.prefix}" \u958B\u982D`; + } + if (_issue.format === "ends_with") + return `\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${_issue.suffix}" \u7D50\u5C3E`; + if (_issue.format === "includes") + return `\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${_issue.includes}"`; + if (_issue.format === "regex") + return `\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${_issue.pattern}`; + return `\u7121\u6548\u7684 ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${issue2.divisor} \u7684\u500D\u6578`; + case "unrecognized_keys": + return `\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${issue2.keys.length > 1 ? "\u5011" : ""}\uFF1A${joinValues(issue2.keys, "\u3001")}`; + case "invalid_key": + return `${issue2.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`; + case "invalid_union": + return "\u7121\u6548\u7684\u8F38\u5165\u503C"; + case "invalid_element": + return `${issue2.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`; + default: + return `\u7121\u6548\u7684\u8F38\u5165\u503C`; + } + }; +}; +function zh_TW_default() { + return { + localeError: error43() + }; +} +// node_modules/zod/v4/locales/yo.js +var error44 = () => { + const Sizable = { + string: { unit: "\xE0mi", verb: "n\xED" }, + file: { unit: "bytes", verb: "n\xED" }, + array: { unit: "nkan", verb: "n\xED" }, + set: { unit: "nkan", verb: "n\xED" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const parsedType7 = (data) => { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "NaN" : "n\u1ECD\u0301mb\xE0"; + } + case "object": { + if (Array.isArray(data)) { + return "akop\u1ECD"; + } + if (data === null) { + return "null"; + } + if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { + return data.constructor.name; + } + } + } + return t; + }; + const Nouns = { + regex: "\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9", + email: "\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "\xE0k\xF3k\xF2 ISO", + date: "\u1ECDj\u1ECD\u0301 ISO", + time: "\xE0k\xF3k\xF2 ISO", + duration: "\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO", + ipv4: "\xE0d\xEDr\u1EB9\u0301s\xEC IPv4", + ipv6: "\xE0d\xEDr\u1EB9\u0301s\xEC IPv6", + cidrv4: "\xE0gb\xE8gb\xE8 IPv4", + cidrv6: "\xE0gb\xE8gb\xE8 IPv6", + base64: "\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64", + base64url: "\u1ECD\u0300r\u1ECD\u0300 base64url", + json_string: "\u1ECD\u0300r\u1ECD\u0300 JSON", + e164: "n\u1ECD\u0301mb\xE0 E.164", + jwt: "JWT", + template_literal: "\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": + return `\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${issue2.expected}, \xE0m\u1ECD\u0300 a r\xED ${parsedType7(issue2.input)}`; + case "invalid_value": + if (issue2.values.length === 1) + return `\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${stringifyPrimitive(issue2.values[0])}`; + return `\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${issue2.origin ?? "iye"} ${sizing.verb} ${adj}${issue2.maximum} ${sizing.unit}`; + return `T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${adj}${issue2.maximum}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum} ${sizing.unit}`; + return `K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${adj}${issue2.minimum}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${_issue.suffix}"`; + if (_issue.format === "includes") + return `\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${_issue.includes}"`; + if (_issue.format === "regex") + return `\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${_issue.pattern}`; + return `A\u1E63\xEC\u1E63e: ${Nouns[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${issue2.divisor}`; + case "unrecognized_keys": + return `B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${issue2.origin}`; + case "invalid_union": + return "\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"; + case "invalid_element": + return `Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${issue2.origin}`; + default: + return "\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"; + } + }; +}; +function yo_default() { + return { + localeError: error44() + }; +} +// node_modules/zod/v4/core/registries.js +var $output = Symbol("ZodOutput"); +var $input = Symbol("ZodInput"); + +class $ZodRegistry { + constructor() { + this._map = new WeakMap; + this._idmap = new Map; + } + add(schema, ..._meta) { + const meta = _meta[0]; + this._map.set(schema, meta); + if (meta && typeof meta === "object" && "id" in meta) { + if (this._idmap.has(meta.id)) { + throw new Error(`ID ${meta.id} already exists in the registry`); + } + this._idmap.set(meta.id, schema); + } + return this; + } + clear() { + this._map = new WeakMap; + this._idmap = new Map; + return this; + } + remove(schema) { + const meta = this._map.get(schema); + if (meta && typeof meta === "object" && "id" in meta) { + this._idmap.delete(meta.id); + } + this._map.delete(schema); + return this; + } + get(schema) { + const p = schema._zod.parent; + if (p) { + const pm = { ...this.get(p) ?? {} }; + delete pm.id; + const f = { ...pm, ...this._map.get(schema) }; + return Object.keys(f).length ? f : undefined; + } + return this._map.get(schema); + } + has(schema) { + return this._map.has(schema); + } +} +function registry() { + return new $ZodRegistry; +} +var globalRegistry = /* @__PURE__ */ registry(); +// node_modules/zod/v4/core/api.js +function _string(Class2, params) { + return new Class2({ + type: "string", + ...normalizeParams(params) + }); +} +function _coercedString(Class2, params) { + return new Class2({ + type: "string", + coerce: true, + ...normalizeParams(params) + }); +} +function _email(Class2, params) { + return new Class2({ + type: "string", + format: "email", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _guid(Class2, params) { + return new Class2({ + type: "string", + format: "guid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _uuid(Class2, params) { + return new Class2({ + type: "string", + format: "uuid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _uuidv4(Class2, params) { + return new Class2({ + type: "string", + format: "uuid", + check: "string_format", + abort: false, + version: "v4", + ...normalizeParams(params) + }); +} +function _uuidv6(Class2, params) { + return new Class2({ + type: "string", + format: "uuid", + check: "string_format", + abort: false, + version: "v6", + ...normalizeParams(params) + }); +} +function _uuidv7(Class2, params) { + return new Class2({ + type: "string", + format: "uuid", + check: "string_format", + abort: false, + version: "v7", + ...normalizeParams(params) + }); +} +function _url(Class2, params) { + return new Class2({ + type: "string", + format: "url", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _emoji2(Class2, params) { + return new Class2({ + type: "string", + format: "emoji", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _nanoid(Class2, params) { + return new Class2({ + type: "string", + format: "nanoid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _cuid(Class2, params) { + return new Class2({ + type: "string", + format: "cuid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _cuid2(Class2, params) { + return new Class2({ + type: "string", + format: "cuid2", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _ulid(Class2, params) { + return new Class2({ + type: "string", + format: "ulid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _xid(Class2, params) { + return new Class2({ + type: "string", + format: "xid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _ksuid(Class2, params) { + return new Class2({ + type: "string", + format: "ksuid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _ipv4(Class2, params) { + return new Class2({ + type: "string", + format: "ipv4", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _ipv6(Class2, params) { + return new Class2({ + type: "string", + format: "ipv6", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _cidrv4(Class2, params) { + return new Class2({ + type: "string", + format: "cidrv4", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _cidrv6(Class2, params) { + return new Class2({ + type: "string", + format: "cidrv6", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _base64(Class2, params) { + return new Class2({ + type: "string", + format: "base64", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _base64url(Class2, params) { + return new Class2({ + type: "string", + format: "base64url", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _e164(Class2, params) { + return new Class2({ + type: "string", + format: "e164", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +function _jwt(Class2, params) { + return new Class2({ + type: "string", + format: "jwt", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +var TimePrecision = { + Any: null, + Minute: -1, + Second: 0, + Millisecond: 3, + Microsecond: 6 +}; +function _isoDateTime(Class2, params) { + return new Class2({ + type: "string", + format: "datetime", + check: "string_format", + offset: false, + local: false, + precision: null, + ...normalizeParams(params) + }); +} +function _isoDate(Class2, params) { + return new Class2({ + type: "string", + format: "date", + check: "string_format", + ...normalizeParams(params) + }); +} +function _isoTime(Class2, params) { + return new Class2({ + type: "string", + format: "time", + check: "string_format", + precision: null, + ...normalizeParams(params) + }); +} +function _isoDuration(Class2, params) { + return new Class2({ + type: "string", + format: "duration", + check: "string_format", + ...normalizeParams(params) + }); +} +function _number(Class2, params) { + return new Class2({ + type: "number", + checks: [], + ...normalizeParams(params) + }); +} +function _coercedNumber(Class2, params) { + return new Class2({ + type: "number", + coerce: true, + checks: [], + ...normalizeParams(params) + }); +} +function _int(Class2, params) { + return new Class2({ + type: "number", + check: "number_format", + abort: false, + format: "safeint", + ...normalizeParams(params) + }); +} +function _float32(Class2, params) { + return new Class2({ + type: "number", + check: "number_format", + abort: false, + format: "float32", + ...normalizeParams(params) + }); +} +function _float64(Class2, params) { + return new Class2({ + type: "number", + check: "number_format", + abort: false, + format: "float64", + ...normalizeParams(params) + }); +} +function _int32(Class2, params) { + return new Class2({ + type: "number", + check: "number_format", + abort: false, + format: "int32", + ...normalizeParams(params) + }); +} +function _uint32(Class2, params) { + return new Class2({ + type: "number", + check: "number_format", + abort: false, + format: "uint32", + ...normalizeParams(params) + }); +} +function _boolean(Class2, params) { + return new Class2({ + type: "boolean", + ...normalizeParams(params) + }); +} +function _coercedBoolean(Class2, params) { + return new Class2({ + type: "boolean", + coerce: true, + ...normalizeParams(params) + }); +} +function _bigint(Class2, params) { + return new Class2({ + type: "bigint", + ...normalizeParams(params) + }); +} +function _coercedBigint(Class2, params) { + return new Class2({ + type: "bigint", + coerce: true, + ...normalizeParams(params) + }); +} +function _int64(Class2, params) { + return new Class2({ + type: "bigint", + check: "bigint_format", + abort: false, + format: "int64", + ...normalizeParams(params) + }); +} +function _uint64(Class2, params) { + return new Class2({ + type: "bigint", + check: "bigint_format", + abort: false, + format: "uint64", + ...normalizeParams(params) + }); +} +function _symbol(Class2, params) { + return new Class2({ + type: "symbol", + ...normalizeParams(params) + }); +} +function _undefined2(Class2, params) { + return new Class2({ + type: "undefined", + ...normalizeParams(params) + }); +} +function _null2(Class2, params) { + return new Class2({ + type: "null", + ...normalizeParams(params) + }); +} +function _any(Class2) { + return new Class2({ + type: "any" + }); +} +function _unknown(Class2) { + return new Class2({ + type: "unknown" + }); +} +function _never(Class2, params) { + return new Class2({ + type: "never", + ...normalizeParams(params) + }); +} +function _void(Class2, params) { + return new Class2({ + type: "void", + ...normalizeParams(params) + }); +} +function _date(Class2, params) { + return new Class2({ + type: "date", + ...normalizeParams(params) + }); +} +function _coercedDate(Class2, params) { + return new Class2({ + type: "date", + coerce: true, + ...normalizeParams(params) + }); +} +function _nan(Class2, params) { + return new Class2({ + type: "nan", + ...normalizeParams(params) + }); +} +function _lt(value, params) { + return new $ZodCheckLessThan({ + check: "less_than", + ...normalizeParams(params), + value, + inclusive: false + }); +} +function _lte(value, params) { + return new $ZodCheckLessThan({ + check: "less_than", + ...normalizeParams(params), + value, + inclusive: true + }); +} +function _gt(value, params) { + return new $ZodCheckGreaterThan({ + check: "greater_than", + ...normalizeParams(params), + value, + inclusive: false + }); +} +function _gte(value, params) { + return new $ZodCheckGreaterThan({ + check: "greater_than", + ...normalizeParams(params), + value, + inclusive: true + }); +} +function _positive(params) { + return _gt(0, params); +} +function _negative(params) { + return _lt(0, params); +} +function _nonpositive(params) { + return _lte(0, params); +} +function _nonnegative(params) { + return _gte(0, params); +} +function _multipleOf(value, params) { + return new $ZodCheckMultipleOf({ + check: "multiple_of", + ...normalizeParams(params), + value + }); +} +function _maxSize(maximum, params) { + return new $ZodCheckMaxSize({ + check: "max_size", + ...normalizeParams(params), + maximum + }); +} +function _minSize(minimum, params) { + return new $ZodCheckMinSize({ + check: "min_size", + ...normalizeParams(params), + minimum + }); +} +function _size(size, params) { + return new $ZodCheckSizeEquals({ + check: "size_equals", + ...normalizeParams(params), + size + }); +} +function _maxLength(maximum, params) { + const ch = new $ZodCheckMaxLength({ + check: "max_length", + ...normalizeParams(params), + maximum + }); + return ch; +} +function _minLength(minimum, params) { + return new $ZodCheckMinLength({ + check: "min_length", + ...normalizeParams(params), + minimum + }); +} +function _length(length, params) { + return new $ZodCheckLengthEquals({ + check: "length_equals", + ...normalizeParams(params), + length + }); +} +function _regex(pattern, params) { + return new $ZodCheckRegex({ + check: "string_format", + format: "regex", + ...normalizeParams(params), + pattern + }); +} +function _lowercase(params) { + return new $ZodCheckLowerCase({ + check: "string_format", + format: "lowercase", + ...normalizeParams(params) + }); +} +function _uppercase(params) { + return new $ZodCheckUpperCase({ + check: "string_format", + format: "uppercase", + ...normalizeParams(params) + }); +} +function _includes(includes, params) { + return new $ZodCheckIncludes({ + check: "string_format", + format: "includes", + ...normalizeParams(params), + includes + }); +} +function _startsWith(prefix, params) { + return new $ZodCheckStartsWith({ + check: "string_format", + format: "starts_with", + ...normalizeParams(params), + prefix + }); +} +function _endsWith(suffix, params) { + return new $ZodCheckEndsWith({ + check: "string_format", + format: "ends_with", + ...normalizeParams(params), + suffix + }); +} +function _property(property, schema, params) { + return new $ZodCheckProperty({ + check: "property", + property, + schema, + ...normalizeParams(params) + }); +} +function _mime(types, params) { + return new $ZodCheckMimeType({ + check: "mime_type", + mime: types, + ...normalizeParams(params) + }); +} +function _overwrite(tx) { + return new $ZodCheckOverwrite({ + check: "overwrite", + tx + }); +} +function _normalize(form) { + return _overwrite((input) => input.normalize(form)); +} +function _trim() { + return _overwrite((input) => input.trim()); +} +function _toLowerCase() { + return _overwrite((input) => input.toLowerCase()); +} +function _toUpperCase() { + return _overwrite((input) => input.toUpperCase()); +} +function _array(Class2, element, params) { + return new Class2({ + type: "array", + element, + ...normalizeParams(params) + }); +} +function _union(Class2, options, params) { + return new Class2({ + type: "union", + options, + ...normalizeParams(params) + }); +} +function _discriminatedUnion(Class2, discriminator, options, params) { + return new Class2({ + type: "union", + options, + discriminator, + ...normalizeParams(params) + }); +} +function _intersection(Class2, left, right) { + return new Class2({ + type: "intersection", + left, + right + }); +} +function _tuple(Class2, items, _paramsOrRest, _params) { + const hasRest = _paramsOrRest instanceof $ZodType; + const params = hasRest ? _params : _paramsOrRest; + const rest = hasRest ? _paramsOrRest : null; + return new Class2({ + type: "tuple", + items, + rest, + ...normalizeParams(params) + }); +} +function _record(Class2, keyType, valueType, params) { + return new Class2({ + type: "record", + keyType, + valueType, + ...normalizeParams(params) + }); +} +function _map(Class2, keyType, valueType, params) { + return new Class2({ + type: "map", + keyType, + valueType, + ...normalizeParams(params) + }); +} +function _set(Class2, valueType, params) { + return new Class2({ + type: "set", + valueType, + ...normalizeParams(params) + }); +} +function _enum(Class2, values, params) { + const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values; + return new Class2({ + type: "enum", + entries, + ...normalizeParams(params) + }); +} +function _nativeEnum(Class2, entries, params) { + return new Class2({ + type: "enum", + entries, + ...normalizeParams(params) + }); +} +function _literal(Class2, value, params) { + return new Class2({ + type: "literal", + values: Array.isArray(value) ? value : [value], + ...normalizeParams(params) + }); +} +function _file(Class2, params) { + return new Class2({ + type: "file", + ...normalizeParams(params) + }); +} +function _transform(Class2, fn) { + return new Class2({ + type: "transform", + transform: fn + }); +} +function _optional(Class2, innerType) { + return new Class2({ + type: "optional", + innerType + }); +} +function _nullable(Class2, innerType) { + return new Class2({ + type: "nullable", + innerType + }); +} +function _default(Class2, innerType, defaultValue) { + return new Class2({ + type: "default", + innerType, + get defaultValue() { + return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue); + } + }); +} +function _nonoptional(Class2, innerType, params) { + return new Class2({ + type: "nonoptional", + innerType, + ...normalizeParams(params) + }); +} +function _success(Class2, innerType) { + return new Class2({ + type: "success", + innerType + }); +} +function _catch(Class2, innerType, catchValue) { + return new Class2({ + type: "catch", + innerType, + catchValue: typeof catchValue === "function" ? catchValue : () => catchValue + }); +} +function _pipe(Class2, in_, out) { + return new Class2({ + type: "pipe", + in: in_, + out + }); +} +function _readonly(Class2, innerType) { + return new Class2({ + type: "readonly", + innerType + }); +} +function _templateLiteral(Class2, parts, params) { + return new Class2({ + type: "template_literal", + parts, + ...normalizeParams(params) + }); +} +function _lazy(Class2, getter) { + return new Class2({ + type: "lazy", + getter + }); +} +function _promise(Class2, innerType) { + return new Class2({ + type: "promise", + innerType + }); +} +function _custom(Class2, fn, _params) { + const norm = normalizeParams(_params); + norm.abort ?? (norm.abort = true); + const schema = new Class2({ + type: "custom", + check: "custom", + fn, + ...norm + }); + return schema; +} +function _refine(Class2, fn, _params) { + const schema = new Class2({ + type: "custom", + check: "custom", + fn, + ...normalizeParams(_params) + }); + return schema; +} +function _superRefine(fn) { + const ch = _check((payload) => { + payload.addIssue = (issue2) => { + if (typeof issue2 === "string") { + payload.issues.push(issue(issue2, payload.value, ch._zod.def)); + } else { + const _issue = issue2; + if (_issue.fatal) + _issue.continue = false; + _issue.code ?? (_issue.code = "custom"); + _issue.input ?? (_issue.input = payload.value); + _issue.inst ?? (_issue.inst = ch); + _issue.continue ?? (_issue.continue = !ch._zod.def.abort); + payload.issues.push(issue(_issue)); + } + }; + return fn(payload.value, payload); + }); + return ch; +} +function _check(fn, params) { + const ch = new $ZodCheck({ + check: "custom", + ...normalizeParams(params) + }); + ch._zod.check = fn; + return ch; +} +function _stringbool(Classes, _params) { + const params = normalizeParams(_params); + let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"]; + let falsyArray = params.falsy ?? ["false", "0", "no", "off", "n", "disabled"]; + if (params.case !== "sensitive") { + truthyArray = truthyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v); + falsyArray = falsyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v); + } + const truthySet = new Set(truthyArray); + const falsySet = new Set(falsyArray); + const _Codec = Classes.Codec ?? $ZodCodec; + const _Boolean = Classes.Boolean ?? $ZodBoolean; + const _String = Classes.String ?? $ZodString; + const stringSchema = new _String({ type: "string", error: params.error }); + const booleanSchema = new _Boolean({ type: "boolean", error: params.error }); + const codec = new _Codec({ + type: "pipe", + in: stringSchema, + out: booleanSchema, + transform: (input, payload) => { + let data = input; + if (params.case !== "sensitive") + data = data.toLowerCase(); + if (truthySet.has(data)) { + return true; + } else if (falsySet.has(data)) { + return false; + } else { + payload.issues.push({ + code: "invalid_value", + expected: "stringbool", + values: [...truthySet, ...falsySet], + input: payload.value, + inst: codec, + continue: false + }); + return {}; + } + }, + reverseTransform: (input, _payload) => { + if (input === true) { + return truthyArray[0] || "true"; + } else { + return falsyArray[0] || "false"; + } + }, + error: params.error + }); + return codec; +} +function _stringFormat(Class2, format, fnOrRegex, _params = {}) { + const params = normalizeParams(_params); + const def = { + ...normalizeParams(_params), + check: "string_format", + type: "string", + format, + fn: typeof fnOrRegex === "function" ? fnOrRegex : (val) => fnOrRegex.test(val), + ...params + }; + if (fnOrRegex instanceof RegExp) { + def.pattern = fnOrRegex; + } + const inst = new Class2(def); + return inst; +} +// node_modules/zod/v4/core/to-json-schema.js +class JSONSchemaGenerator { + constructor(params) { + this.counter = 0; + this.metadataRegistry = params?.metadata ?? globalRegistry; + this.target = params?.target ?? "draft-2020-12"; + this.unrepresentable = params?.unrepresentable ?? "throw"; + this.override = params?.override ?? (() => {}); + this.io = params?.io ?? "output"; + this.seen = new Map; + } + process(schema, _params = { path: [], schemaPath: [] }) { + var _a; + const def = schema._zod.def; + const formatMap = { + guid: "uuid", + url: "uri", + datetime: "date-time", + json_string: "json-string", + regex: "" + }; + const seen = this.seen.get(schema); + if (seen) { + seen.count++; + const isCycle = _params.schemaPath.includes(schema); + if (isCycle) { + seen.cycle = _params.path; + } + return seen.schema; + } + const result = { schema: {}, count: 1, cycle: undefined, path: _params.path }; + this.seen.set(schema, result); + const overrideSchema = schema._zod.toJSONSchema?.(); + if (overrideSchema) { + result.schema = overrideSchema; + } else { + const params = { + ..._params, + schemaPath: [..._params.schemaPath, schema], + path: _params.path + }; + const parent = schema._zod.parent; + if (parent) { + result.ref = parent; + this.process(parent, params); + this.seen.get(parent).isParent = true; + } else { + const _json = result.schema; + switch (def.type) { + case "string": { + const json = _json; + json.type = "string"; + const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag; + if (typeof minimum === "number") + json.minLength = minimum; + if (typeof maximum === "number") + json.maxLength = maximum; + if (format) { + json.format = formatMap[format] ?? format; + if (json.format === "") + delete json.format; + } + if (contentEncoding) + json.contentEncoding = contentEncoding; + if (patterns && patterns.size > 0) { + const regexes = [...patterns]; + if (regexes.length === 1) + json.pattern = regexes[0].source; + else if (regexes.length > 1) { + result.schema.allOf = [ + ...regexes.map((regex) => ({ + ...this.target === "draft-7" || this.target === "draft-4" || this.target === "openapi-3.0" ? { type: "string" } : {}, + pattern: regex.source + })) + ]; + } + } + break; + } + case "number": { + const json = _json; + const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag; + if (typeof format === "string" && format.includes("int")) + json.type = "integer"; + else + json.type = "number"; + if (typeof exclusiveMinimum === "number") { + if (this.target === "draft-4" || this.target === "openapi-3.0") { + json.minimum = exclusiveMinimum; + json.exclusiveMinimum = true; + } else { + json.exclusiveMinimum = exclusiveMinimum; + } + } + if (typeof minimum === "number") { + json.minimum = minimum; + if (typeof exclusiveMinimum === "number" && this.target !== "draft-4") { + if (exclusiveMinimum >= minimum) + delete json.minimum; + else + delete json.exclusiveMinimum; + } + } + if (typeof exclusiveMaximum === "number") { + if (this.target === "draft-4" || this.target === "openapi-3.0") { + json.maximum = exclusiveMaximum; + json.exclusiveMaximum = true; + } else { + json.exclusiveMaximum = exclusiveMaximum; + } + } + if (typeof maximum === "number") { + json.maximum = maximum; + if (typeof exclusiveMaximum === "number" && this.target !== "draft-4") { + if (exclusiveMaximum <= maximum) + delete json.maximum; + else + delete json.exclusiveMaximum; + } + } + if (typeof multipleOf === "number") + json.multipleOf = multipleOf; + break; + } + case "boolean": { + const json = _json; + json.type = "boolean"; + break; + } + case "bigint": { + if (this.unrepresentable === "throw") { + throw new Error("BigInt cannot be represented in JSON Schema"); + } + break; + } + case "symbol": { + if (this.unrepresentable === "throw") { + throw new Error("Symbols cannot be represented in JSON Schema"); + } + break; + } + case "null": { + if (this.target === "openapi-3.0") { + _json.type = "string"; + _json.nullable = true; + _json.enum = [null]; + } else + _json.type = "null"; + break; + } + case "any": { + break; + } + case "unknown": { + break; + } + case "undefined": { + if (this.unrepresentable === "throw") { + throw new Error("Undefined cannot be represented in JSON Schema"); + } + break; + } + case "void": { + if (this.unrepresentable === "throw") { + throw new Error("Void cannot be represented in JSON Schema"); + } + break; + } + case "never": { + _json.not = {}; + break; + } + case "date": { + if (this.unrepresentable === "throw") { + throw new Error("Date cannot be represented in JSON Schema"); + } + break; + } + case "array": { + const json = _json; + const { minimum, maximum } = schema._zod.bag; + if (typeof minimum === "number") + json.minItems = minimum; + if (typeof maximum === "number") + json.maxItems = maximum; + json.type = "array"; + json.items = this.process(def.element, { ...params, path: [...params.path, "items"] }); + break; + } + case "object": { + const json = _json; + json.type = "object"; + json.properties = {}; + const shape = def.shape; + for (const key in shape) { + json.properties[key] = this.process(shape[key], { + ...params, + path: [...params.path, "properties", key] + }); + } + const allKeys = new Set(Object.keys(shape)); + const requiredKeys = new Set([...allKeys].filter((key) => { + const v = def.shape[key]._zod; + if (this.io === "input") { + return v.optin === undefined; + } else { + return v.optout === undefined; + } + })); + if (requiredKeys.size > 0) { + json.required = Array.from(requiredKeys); + } + if (def.catchall?._zod.def.type === "never") { + json.additionalProperties = false; + } else if (!def.catchall) { + if (this.io === "output") + json.additionalProperties = false; + } else if (def.catchall) { + json.additionalProperties = this.process(def.catchall, { + ...params, + path: [...params.path, "additionalProperties"] + }); + } + break; + } + case "union": { + const json = _json; + const options = def.options.map((x, i) => this.process(x, { + ...params, + path: [...params.path, "anyOf", i] + })); + json.anyOf = options; + break; + } + case "intersection": { + const json = _json; + const a = this.process(def.left, { + ...params, + path: [...params.path, "allOf", 0] + }); + const b = this.process(def.right, { + ...params, + path: [...params.path, "allOf", 1] + }); + const isSimpleIntersection = (val) => ("allOf" in val) && Object.keys(val).length === 1; + const allOf = [ + ...isSimpleIntersection(a) ? a.allOf : [a], + ...isSimpleIntersection(b) ? b.allOf : [b] + ]; + json.allOf = allOf; + break; + } + case "tuple": { + const json = _json; + json.type = "array"; + const prefixPath = this.target === "draft-2020-12" ? "prefixItems" : "items"; + const restPath = this.target === "draft-2020-12" ? "items" : this.target === "openapi-3.0" ? "items" : "additionalItems"; + const prefixItems = def.items.map((x, i) => this.process(x, { + ...params, + path: [...params.path, prefixPath, i] + })); + const rest = def.rest ? this.process(def.rest, { + ...params, + path: [...params.path, restPath, ...this.target === "openapi-3.0" ? [def.items.length] : []] + }) : null; + if (this.target === "draft-2020-12") { + json.prefixItems = prefixItems; + if (rest) { + json.items = rest; + } + } else if (this.target === "openapi-3.0") { + json.items = { + anyOf: prefixItems + }; + if (rest) { + json.items.anyOf.push(rest); + } + json.minItems = prefixItems.length; + if (!rest) { + json.maxItems = prefixItems.length; + } + } else { + json.items = prefixItems; + if (rest) { + json.additionalItems = rest; + } + } + const { minimum, maximum } = schema._zod.bag; + if (typeof minimum === "number") + json.minItems = minimum; + if (typeof maximum === "number") + json.maxItems = maximum; + break; + } + case "record": { + const json = _json; + json.type = "object"; + if (this.target === "draft-7" || this.target === "draft-2020-12") { + json.propertyNames = this.process(def.keyType, { + ...params, + path: [...params.path, "propertyNames"] + }); + } + json.additionalProperties = this.process(def.valueType, { + ...params, + path: [...params.path, "additionalProperties"] + }); + break; + } + case "map": { + if (this.unrepresentable === "throw") { + throw new Error("Map cannot be represented in JSON Schema"); + } + break; + } + case "set": { + if (this.unrepresentable === "throw") { + throw new Error("Set cannot be represented in JSON Schema"); + } + break; + } + case "enum": { + const json = _json; + const values = getEnumValues(def.entries); + if (values.every((v) => typeof v === "number")) + json.type = "number"; + if (values.every((v) => typeof v === "string")) + json.type = "string"; + json.enum = values; + break; + } + case "literal": { + const json = _json; + const vals = []; + for (const val of def.values) { + if (val === undefined) { + if (this.unrepresentable === "throw") { + throw new Error("Literal `undefined` cannot be represented in JSON Schema"); + } + } else if (typeof val === "bigint") { + if (this.unrepresentable === "throw") { + throw new Error("BigInt literals cannot be represented in JSON Schema"); + } else { + vals.push(Number(val)); + } + } else { + vals.push(val); + } + } + if (vals.length === 0) {} else if (vals.length === 1) { + const val = vals[0]; + json.type = val === null ? "null" : typeof val; + if (this.target === "draft-4" || this.target === "openapi-3.0") { + json.enum = [val]; + } else { + json.const = val; + } + } else { + if (vals.every((v) => typeof v === "number")) + json.type = "number"; + if (vals.every((v) => typeof v === "string")) + json.type = "string"; + if (vals.every((v) => typeof v === "boolean")) + json.type = "string"; + if (vals.every((v) => v === null)) + json.type = "null"; + json.enum = vals; + } + break; + } + case "file": { + const json = _json; + const file = { + type: "string", + format: "binary", + contentEncoding: "binary" + }; + const { minimum, maximum, mime } = schema._zod.bag; + if (minimum !== undefined) + file.minLength = minimum; + if (maximum !== undefined) + file.maxLength = maximum; + if (mime) { + if (mime.length === 1) { + file.contentMediaType = mime[0]; + Object.assign(json, file); + } else { + json.anyOf = mime.map((m) => { + const mFile = { ...file, contentMediaType: m }; + return mFile; + }); + } + } else { + Object.assign(json, file); + } + break; + } + case "transform": { + if (this.unrepresentable === "throw") { + throw new Error("Transforms cannot be represented in JSON Schema"); + } + break; + } + case "nullable": { + const inner = this.process(def.innerType, params); + if (this.target === "openapi-3.0") { + result.ref = def.innerType; + _json.nullable = true; + } else { + _json.anyOf = [inner, { type: "null" }]; + } + break; + } + case "nonoptional": { + this.process(def.innerType, params); + result.ref = def.innerType; + break; + } + case "success": { + const json = _json; + json.type = "boolean"; + break; + } + case "default": { + this.process(def.innerType, params); + result.ref = def.innerType; + _json.default = JSON.parse(JSON.stringify(def.defaultValue)); + break; + } + case "prefault": { + this.process(def.innerType, params); + result.ref = def.innerType; + if (this.io === "input") + _json._prefault = JSON.parse(JSON.stringify(def.defaultValue)); + break; + } + case "catch": { + this.process(def.innerType, params); + result.ref = def.innerType; + let catchValue; + try { + catchValue = def.catchValue(undefined); + } catch { + throw new Error("Dynamic catch values are not supported in JSON Schema"); + } + _json.default = catchValue; + break; + } + case "nan": { + if (this.unrepresentable === "throw") { + throw new Error("NaN cannot be represented in JSON Schema"); + } + break; + } + case "template_literal": { + const json = _json; + const pattern = schema._zod.pattern; + if (!pattern) + throw new Error("Pattern not found in template literal"); + json.type = "string"; + json.pattern = pattern.source; + break; + } + case "pipe": { + const innerType = this.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out; + this.process(innerType, params); + result.ref = innerType; + break; + } + case "readonly": { + this.process(def.innerType, params); + result.ref = def.innerType; + _json.readOnly = true; + break; + } + case "promise": { + this.process(def.innerType, params); + result.ref = def.innerType; + break; + } + case "optional": { + this.process(def.innerType, params); + result.ref = def.innerType; + break; + } + case "lazy": { + const innerType = schema._zod.innerType; + this.process(innerType, params); + result.ref = innerType; + break; + } + case "custom": { + if (this.unrepresentable === "throw") { + throw new Error("Custom types cannot be represented in JSON Schema"); + } + break; + } + case "function": { + if (this.unrepresentable === "throw") { + throw new Error("Function types cannot be represented in JSON Schema"); + } + break; + } + default: {} + } + } + } + const meta = this.metadataRegistry.get(schema); + if (meta) + Object.assign(result.schema, meta); + if (this.io === "input" && isTransforming(schema)) { + delete result.schema.examples; + delete result.schema.default; + } + if (this.io === "input" && result.schema._prefault) + (_a = result.schema).default ?? (_a.default = result.schema._prefault); + delete result.schema._prefault; + const _result = this.seen.get(schema); + return _result.schema; + } + emit(schema, _params) { + const params = { + cycles: _params?.cycles ?? "ref", + reused: _params?.reused ?? "inline", + external: _params?.external ?? undefined + }; + const root = this.seen.get(schema); + if (!root) + throw new Error("Unprocessed schema. This is a bug in Zod."); + const makeURI = (entry) => { + const defsSegment = this.target === "draft-2020-12" ? "$defs" : "definitions"; + if (params.external) { + const externalId = params.external.registry.get(entry[0])?.id; + const uriGenerator = params.external.uri ?? ((id2) => id2); + if (externalId) { + return { ref: uriGenerator(externalId) }; + } + const id = entry[1].defId ?? entry[1].schema.id ?? `schema${this.counter++}`; + entry[1].defId = id; + return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` }; + } + if (entry[1] === root) { + return { ref: "#" }; + } + const uriPrefix = `#`; + const defUriPrefix = `${uriPrefix}/${defsSegment}/`; + const defId = entry[1].schema.id ?? `__schema${this.counter++}`; + return { defId, ref: defUriPrefix + defId }; + }; + const extractToDef = (entry) => { + if (entry[1].schema.$ref) { + return; + } + const seen = entry[1]; + const { ref, defId } = makeURI(entry); + seen.def = { ...seen.schema }; + if (defId) + seen.defId = defId; + const schema2 = seen.schema; + for (const key in schema2) { + delete schema2[key]; + } + schema2.$ref = ref; + }; + if (params.cycles === "throw") { + for (const entry of this.seen.entries()) { + const seen = entry[1]; + if (seen.cycle) { + throw new Error("Cycle detected: " + `#/${seen.cycle?.join("/")}/` + '\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.'); + } + } + } + for (const entry of this.seen.entries()) { + const seen = entry[1]; + if (schema === entry[0]) { + extractToDef(entry); + continue; + } + if (params.external) { + const ext = params.external.registry.get(entry[0])?.id; + if (schema !== entry[0] && ext) { + extractToDef(entry); + continue; + } + } + const id = this.metadataRegistry.get(entry[0])?.id; + if (id) { + extractToDef(entry); + continue; + } + if (seen.cycle) { + extractToDef(entry); + continue; + } + if (seen.count > 1) { + if (params.reused === "ref") { + extractToDef(entry); + continue; + } + } + } + const flattenRef = (zodSchema, params2) => { + const seen = this.seen.get(zodSchema); + const schema2 = seen.def ?? seen.schema; + const _cached = { ...schema2 }; + if (seen.ref === null) { + return; + } + const ref = seen.ref; + seen.ref = null; + if (ref) { + flattenRef(ref, params2); + const refSchema = this.seen.get(ref).schema; + if (refSchema.$ref && (params2.target === "draft-7" || params2.target === "draft-4" || params2.target === "openapi-3.0")) { + schema2.allOf = schema2.allOf ?? []; + schema2.allOf.push(refSchema); + } else { + Object.assign(schema2, refSchema); + Object.assign(schema2, _cached); + } + } + if (!seen.isParent) + this.override({ + zodSchema, + jsonSchema: schema2, + path: seen.path ?? [] + }); + }; + for (const entry of [...this.seen.entries()].reverse()) { + flattenRef(entry[0], { target: this.target }); + } + const result = {}; + if (this.target === "draft-2020-12") { + result.$schema = "https://json-schema.org/draft/2020-12/schema"; + } else if (this.target === "draft-7") { + result.$schema = "http://json-schema.org/draft-07/schema#"; + } else if (this.target === "draft-4") { + result.$schema = "http://json-schema.org/draft-04/schema#"; + } else if (this.target === "openapi-3.0") {} else { + console.warn(`Invalid target: ${this.target}`); + } + if (params.external?.uri) { + const id = params.external.registry.get(schema)?.id; + if (!id) + throw new Error("Schema is missing an `id` property"); + result.$id = params.external.uri(id); + } + Object.assign(result, root.def); + const defs = params.external?.defs ?? {}; + for (const entry of this.seen.entries()) { + const seen = entry[1]; + if (seen.def && seen.defId) { + defs[seen.defId] = seen.def; + } + } + if (params.external) {} else { + if (Object.keys(defs).length > 0) { + if (this.target === "draft-2020-12") { + result.$defs = defs; + } else { + result.definitions = defs; + } + } + } + try { + return JSON.parse(JSON.stringify(result)); + } catch (_err) { + throw new Error("Error converting schema to JSON."); + } + } +} +function toJSONSchema(input, _params) { + if (input instanceof $ZodRegistry) { + const gen2 = new JSONSchemaGenerator(_params); + const defs = {}; + for (const entry of input._idmap.entries()) { + const [_, schema] = entry; + gen2.process(schema); + } + const schemas = {}; + const external = { + registry: input, + uri: _params?.uri, + defs + }; + for (const entry of input._idmap.entries()) { + const [key, schema] = entry; + schemas[key] = gen2.emit(schema, { + ..._params, + external + }); + } + if (Object.keys(defs).length > 0) { + const defsSegment = gen2.target === "draft-2020-12" ? "$defs" : "definitions"; + schemas.__shared = { + [defsSegment]: defs + }; + } + return { schemas }; + } + const gen = new JSONSchemaGenerator(_params); + gen.process(input); + return gen.emit(input, _params); +} +function isTransforming(_schema, _ctx) { + const ctx = _ctx ?? { seen: new Set }; + if (ctx.seen.has(_schema)) + return false; + ctx.seen.add(_schema); + const schema = _schema; + const def = schema._zod.def; + switch (def.type) { + case "string": + case "number": + case "bigint": + case "boolean": + case "date": + case "symbol": + case "undefined": + case "null": + case "any": + case "unknown": + case "never": + case "void": + case "literal": + case "enum": + case "nan": + case "file": + case "template_literal": + return false; + case "array": { + return isTransforming(def.element, ctx); + } + case "object": { + for (const key in def.shape) { + if (isTransforming(def.shape[key], ctx)) + return true; + } + return false; + } + case "union": { + for (const option of def.options) { + if (isTransforming(option, ctx)) + return true; + } + return false; + } + case "intersection": { + return isTransforming(def.left, ctx) || isTransforming(def.right, ctx); + } + case "tuple": { + for (const item of def.items) { + if (isTransforming(item, ctx)) + return true; + } + if (def.rest && isTransforming(def.rest, ctx)) + return true; + return false; + } + case "record": { + return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx); + } + case "map": { + return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx); + } + case "set": { + return isTransforming(def.valueType, ctx); + } + case "promise": + case "optional": + case "nonoptional": + case "nullable": + case "readonly": + return isTransforming(def.innerType, ctx); + case "lazy": + return isTransforming(def.getter(), ctx); + case "default": { + return isTransforming(def.innerType, ctx); + } + case "prefault": { + return isTransforming(def.innerType, ctx); + } + case "custom": { + return false; + } + case "transform": { + return true; + } + case "pipe": { + return isTransforming(def.in, ctx) || isTransforming(def.out, ctx); + } + case "success": { + return false; + } + case "catch": { + return false; + } + case "function": { + return false; + } + default: + } + throw new Error(`Unknown schema type: ${def.type}`); +} +// node_modules/zod/v4/core/json-schema.js +var exports_json_schema = {}; +// node_modules/zod/v4/classic/iso.js +var exports_iso = {}; +__export(exports_iso, { + time: () => time2, + duration: () => duration2, + datetime: () => datetime2, + date: () => date2, + ZodISOTime: () => ZodISOTime, + ZodISODuration: () => ZodISODuration, + ZodISODateTime: () => ZodISODateTime, + ZodISODate: () => ZodISODate +}); +var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => { + $ZodISODateTime.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function datetime2(params) { + return _isoDateTime(ZodISODateTime, params); +} +var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => { + $ZodISODate.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function date2(params) { + return _isoDate(ZodISODate, params); +} +var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => { + $ZodISOTime.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function time2(params) { + return _isoTime(ZodISOTime, params); +} +var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => { + $ZodISODuration.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function duration2(params) { + return _isoDuration(ZodISODuration, params); +} + +// node_modules/zod/v4/classic/errors.js +var initializer2 = (inst, issues) => { + $ZodError.init(inst, issues); + inst.name = "ZodError"; + Object.defineProperties(inst, { + format: { + value: (mapper) => formatError(inst, mapper) + }, + flatten: { + value: (mapper) => flattenError(inst, mapper) + }, + addIssue: { + value: (issue2) => { + inst.issues.push(issue2); + inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2); + } + }, + addIssues: { + value: (issues2) => { + inst.issues.push(...issues2); + inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2); + } + }, + isEmpty: { + get() { + return inst.issues.length === 0; + } + } + }); +}; +var ZodError = $constructor("ZodError", initializer2); +var ZodRealError = $constructor("ZodError", initializer2, { + Parent: Error +}); + +// node_modules/zod/v4/classic/parse.js +var parse3 = /* @__PURE__ */ _parse(ZodRealError); +var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError); +var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError); +var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError); +var encode2 = /* @__PURE__ */ _encode(ZodRealError); +var decode2 = /* @__PURE__ */ _decode(ZodRealError); +var encodeAsync2 = /* @__PURE__ */ _encodeAsync(ZodRealError); +var decodeAsync2 = /* @__PURE__ */ _decodeAsync(ZodRealError); +var safeEncode2 = /* @__PURE__ */ _safeEncode(ZodRealError); +var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError); +var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError); +var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError); + +// node_modules/zod/v4/classic/schemas.js +var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => { + $ZodType.init(inst, def); + inst.def = def; + inst.type = def.type; + Object.defineProperty(inst, "_def", { value: def }); + inst.check = (...checks2) => { + return inst.clone({ + ...def, + checks: [ + ...def.checks ?? [], + ...checks2.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch) + ] + }); + }; + inst.clone = (def2, params) => clone(inst, def2, params); + inst.brand = () => inst; + inst.register = (reg, meta) => { + reg.add(inst, meta); + return inst; + }; + inst.parse = (data, params) => parse3(inst, data, params, { callee: inst.parse }); + inst.safeParse = (data, params) => safeParse2(inst, data, params); + inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync }); + inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params); + inst.spa = inst.safeParseAsync; + inst.encode = (data, params) => encode2(inst, data, params); + inst.decode = (data, params) => decode2(inst, data, params); + inst.encodeAsync = async (data, params) => encodeAsync2(inst, data, params); + inst.decodeAsync = async (data, params) => decodeAsync2(inst, data, params); + inst.safeEncode = (data, params) => safeEncode2(inst, data, params); + inst.safeDecode = (data, params) => safeDecode2(inst, data, params); + inst.safeEncodeAsync = async (data, params) => safeEncodeAsync2(inst, data, params); + inst.safeDecodeAsync = async (data, params) => safeDecodeAsync2(inst, data, params); + inst.refine = (check, params) => inst.check(refine(check, params)); + inst.superRefine = (refinement) => inst.check(superRefine(refinement)); + inst.overwrite = (fn) => inst.check(_overwrite(fn)); + inst.optional = () => optional(inst); + inst.nullable = () => nullable(inst); + inst.nullish = () => optional(nullable(inst)); + inst.nonoptional = (params) => nonoptional(inst, params); + inst.array = () => array(inst); + inst.or = (arg) => union([inst, arg]); + inst.and = (arg) => intersection(inst, arg); + inst.transform = (tx) => pipe(inst, transform(tx)); + inst.default = (def2) => _default2(inst, def2); + inst.prefault = (def2) => prefault(inst, def2); + inst.catch = (params) => _catch2(inst, params); + inst.pipe = (target) => pipe(inst, target); + inst.readonly = () => readonly(inst); + inst.describe = (description) => { + const cl = inst.clone(); + globalRegistry.add(cl, { description }); + return cl; + }; + Object.defineProperty(inst, "description", { + get() { + return globalRegistry.get(inst)?.description; + }, + configurable: true + }); + inst.meta = (...args) => { + if (args.length === 0) { + return globalRegistry.get(inst); + } + const cl = inst.clone(); + globalRegistry.add(cl, args[0]); + return cl; + }; + inst.isOptional = () => inst.safeParse(undefined).success; + inst.isNullable = () => inst.safeParse(null).success; + return inst; +}); +var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => { + $ZodString.init(inst, def); + ZodType.init(inst, def); + const bag = inst._zod.bag; + inst.format = bag.format ?? null; + inst.minLength = bag.minimum ?? null; + inst.maxLength = bag.maximum ?? null; + inst.regex = (...args) => inst.check(_regex(...args)); + inst.includes = (...args) => inst.check(_includes(...args)); + inst.startsWith = (...args) => inst.check(_startsWith(...args)); + inst.endsWith = (...args) => inst.check(_endsWith(...args)); + inst.min = (...args) => inst.check(_minLength(...args)); + inst.max = (...args) => inst.check(_maxLength(...args)); + inst.length = (...args) => inst.check(_length(...args)); + inst.nonempty = (...args) => inst.check(_minLength(1, ...args)); + inst.lowercase = (params) => inst.check(_lowercase(params)); + inst.uppercase = (params) => inst.check(_uppercase(params)); + inst.trim = () => inst.check(_trim()); + inst.normalize = (...args) => inst.check(_normalize(...args)); + inst.toLowerCase = () => inst.check(_toLowerCase()); + inst.toUpperCase = () => inst.check(_toUpperCase()); +}); +var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => { + $ZodString.init(inst, def); + _ZodString.init(inst, def); + inst.email = (params) => inst.check(_email(ZodEmail, params)); + inst.url = (params) => inst.check(_url(ZodURL, params)); + inst.jwt = (params) => inst.check(_jwt(ZodJWT, params)); + inst.emoji = (params) => inst.check(_emoji2(ZodEmoji, params)); + inst.guid = (params) => inst.check(_guid(ZodGUID, params)); + inst.uuid = (params) => inst.check(_uuid(ZodUUID, params)); + inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params)); + inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params)); + inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params)); + inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params)); + inst.guid = (params) => inst.check(_guid(ZodGUID, params)); + inst.cuid = (params) => inst.check(_cuid(ZodCUID, params)); + inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params)); + inst.ulid = (params) => inst.check(_ulid(ZodULID, params)); + inst.base64 = (params) => inst.check(_base64(ZodBase64, params)); + inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params)); + inst.xid = (params) => inst.check(_xid(ZodXID, params)); + inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params)); + inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params)); + inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params)); + inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params)); + inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params)); + inst.e164 = (params) => inst.check(_e164(ZodE164, params)); + inst.datetime = (params) => inst.check(datetime2(params)); + inst.date = (params) => inst.check(date2(params)); + inst.time = (params) => inst.check(time2(params)); + inst.duration = (params) => inst.check(duration2(params)); +}); +function string2(params) { + return _string(ZodString, params); +} +var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => { + $ZodStringFormat.init(inst, def); + _ZodString.init(inst, def); +}); +var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => { + $ZodEmail.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function email2(params) { + return _email(ZodEmail, params); +} +var ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => { + $ZodGUID.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function guid2(params) { + return _guid(ZodGUID, params); +} +var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => { + $ZodUUID.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function uuid2(params) { + return _uuid(ZodUUID, params); +} +function uuidv4(params) { + return _uuidv4(ZodUUID, params); +} +function uuidv6(params) { + return _uuidv6(ZodUUID, params); +} +function uuidv7(params) { + return _uuidv7(ZodUUID, params); +} +var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => { + $ZodURL.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function url(params) { + return _url(ZodURL, params); +} +function httpUrl(params) { + return _url(ZodURL, { + protocol: /^https?$/, + hostname: exports_regexes.domain, + ...exports_util.normalizeParams(params) + }); +} +var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => { + $ZodEmoji.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function emoji2(params) { + return _emoji2(ZodEmoji, params); +} +var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => { + $ZodNanoID.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function nanoid2(params) { + return _nanoid(ZodNanoID, params); +} +var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => { + $ZodCUID.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function cuid3(params) { + return _cuid(ZodCUID, params); +} +var ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => { + $ZodCUID2.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function cuid22(params) { + return _cuid2(ZodCUID2, params); +} +var ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => { + $ZodULID.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function ulid2(params) { + return _ulid(ZodULID, params); +} +var ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => { + $ZodXID.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function xid2(params) { + return _xid(ZodXID, params); +} +var ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => { + $ZodKSUID.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function ksuid2(params) { + return _ksuid(ZodKSUID, params); +} +var ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => { + $ZodIPv4.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function ipv42(params) { + return _ipv4(ZodIPv4, params); +} +var ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => { + $ZodIPv6.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function ipv62(params) { + return _ipv6(ZodIPv6, params); +} +var ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => { + $ZodCIDRv4.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function cidrv42(params) { + return _cidrv4(ZodCIDRv4, params); +} +var ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => { + $ZodCIDRv6.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function cidrv62(params) { + return _cidrv6(ZodCIDRv6, params); +} +var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => { + $ZodBase64.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function base642(params) { + return _base64(ZodBase64, params); +} +var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => { + $ZodBase64URL.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function base64url2(params) { + return _base64url(ZodBase64URL, params); +} +var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => { + $ZodE164.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function e1642(params) { + return _e164(ZodE164, params); +} +var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => { + $ZodJWT.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function jwt(params) { + return _jwt(ZodJWT, params); +} +var ZodCustomStringFormat = /* @__PURE__ */ $constructor("ZodCustomStringFormat", (inst, def) => { + $ZodCustomStringFormat.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function stringFormat(format, fnOrRegex, _params = {}) { + return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params); +} +function hostname2(_params) { + return _stringFormat(ZodCustomStringFormat, "hostname", exports_regexes.hostname, _params); +} +function hex2(_params) { + return _stringFormat(ZodCustomStringFormat, "hex", exports_regexes.hex, _params); +} +function hash(alg, params) { + const enc = params?.enc ?? "hex"; + const format = `${alg}_${enc}`; + const regex = exports_regexes[format]; + if (!regex) + throw new Error(`Unrecognized hash format: ${format}`); + return _stringFormat(ZodCustomStringFormat, format, regex, params); +} +var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => { + $ZodNumber.init(inst, def); + ZodType.init(inst, def); + inst.gt = (value, params) => inst.check(_gt(value, params)); + inst.gte = (value, params) => inst.check(_gte(value, params)); + inst.min = (value, params) => inst.check(_gte(value, params)); + inst.lt = (value, params) => inst.check(_lt(value, params)); + inst.lte = (value, params) => inst.check(_lte(value, params)); + inst.max = (value, params) => inst.check(_lte(value, params)); + inst.int = (params) => inst.check(int(params)); + inst.safe = (params) => inst.check(int(params)); + inst.positive = (params) => inst.check(_gt(0, params)); + inst.nonnegative = (params) => inst.check(_gte(0, params)); + inst.negative = (params) => inst.check(_lt(0, params)); + inst.nonpositive = (params) => inst.check(_lte(0, params)); + inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params)); + inst.step = (value, params) => inst.check(_multipleOf(value, params)); + inst.finite = () => inst; + const bag = inst._zod.bag; + inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null; + inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null; + inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5); + inst.isFinite = true; + inst.format = bag.format ?? null; +}); +function number2(params) { + return _number(ZodNumber, params); +} +var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => { + $ZodNumberFormat.init(inst, def); + ZodNumber.init(inst, def); +}); +function int(params) { + return _int(ZodNumberFormat, params); +} +function float32(params) { + return _float32(ZodNumberFormat, params); +} +function float64(params) { + return _float64(ZodNumberFormat, params); +} +function int32(params) { + return _int32(ZodNumberFormat, params); +} +function uint32(params) { + return _uint32(ZodNumberFormat, params); +} +var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => { + $ZodBoolean.init(inst, def); + ZodType.init(inst, def); +}); +function boolean2(params) { + return _boolean(ZodBoolean, params); +} +var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => { + $ZodBigInt.init(inst, def); + ZodType.init(inst, def); + inst.gte = (value, params) => inst.check(_gte(value, params)); + inst.min = (value, params) => inst.check(_gte(value, params)); + inst.gt = (value, params) => inst.check(_gt(value, params)); + inst.gte = (value, params) => inst.check(_gte(value, params)); + inst.min = (value, params) => inst.check(_gte(value, params)); + inst.lt = (value, params) => inst.check(_lt(value, params)); + inst.lte = (value, params) => inst.check(_lte(value, params)); + inst.max = (value, params) => inst.check(_lte(value, params)); + inst.positive = (params) => inst.check(_gt(BigInt(0), params)); + inst.negative = (params) => inst.check(_lt(BigInt(0), params)); + inst.nonpositive = (params) => inst.check(_lte(BigInt(0), params)); + inst.nonnegative = (params) => inst.check(_gte(BigInt(0), params)); + inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params)); + const bag = inst._zod.bag; + inst.minValue = bag.minimum ?? null; + inst.maxValue = bag.maximum ?? null; + inst.format = bag.format ?? null; +}); +function bigint2(params) { + return _bigint(ZodBigInt, params); +} +var ZodBigIntFormat = /* @__PURE__ */ $constructor("ZodBigIntFormat", (inst, def) => { + $ZodBigIntFormat.init(inst, def); + ZodBigInt.init(inst, def); +}); +function int64(params) { + return _int64(ZodBigIntFormat, params); +} +function uint64(params) { + return _uint64(ZodBigIntFormat, params); +} +var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => { + $ZodSymbol.init(inst, def); + ZodType.init(inst, def); +}); +function symbol(params) { + return _symbol(ZodSymbol, params); +} +var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => { + $ZodUndefined.init(inst, def); + ZodType.init(inst, def); +}); +function _undefined3(params) { + return _undefined2(ZodUndefined, params); +} +var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => { + $ZodNull.init(inst, def); + ZodType.init(inst, def); +}); +function _null3(params) { + return _null2(ZodNull, params); +} +var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => { + $ZodAny.init(inst, def); + ZodType.init(inst, def); +}); +function any() { + return _any(ZodAny); +} +var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => { + $ZodUnknown.init(inst, def); + ZodType.init(inst, def); +}); +function unknown() { + return _unknown(ZodUnknown); +} +var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => { + $ZodNever.init(inst, def); + ZodType.init(inst, def); +}); +function never(params) { + return _never(ZodNever, params); +} +var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => { + $ZodVoid.init(inst, def); + ZodType.init(inst, def); +}); +function _void2(params) { + return _void(ZodVoid, params); +} +var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => { + $ZodDate.init(inst, def); + ZodType.init(inst, def); + inst.min = (value, params) => inst.check(_gte(value, params)); + inst.max = (value, params) => inst.check(_lte(value, params)); + const c = inst._zod.bag; + inst.minDate = c.minimum ? new Date(c.minimum) : null; + inst.maxDate = c.maximum ? new Date(c.maximum) : null; +}); +function date3(params) { + return _date(ZodDate, params); +} +var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => { + $ZodArray.init(inst, def); + ZodType.init(inst, def); + inst.element = def.element; + inst.min = (minLength, params) => inst.check(_minLength(minLength, params)); + inst.nonempty = (params) => inst.check(_minLength(1, params)); + inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params)); + inst.length = (len, params) => inst.check(_length(len, params)); + inst.unwrap = () => inst.element; +}); +function array(element, params) { + return _array(ZodArray, element, params); +} +function keyof(schema) { + const shape = schema._zod.def.shape; + return _enum2(Object.keys(shape)); +} +var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => { + $ZodObjectJIT.init(inst, def); + ZodType.init(inst, def); + exports_util.defineLazy(inst, "shape", () => def.shape); + inst.keyof = () => _enum2(Object.keys(inst._zod.def.shape)); + inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall }); + inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() }); + inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() }); + inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() }); + inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined }); + inst.extend = (incoming) => { + return exports_util.extend(inst, incoming); + }; + inst.safeExtend = (incoming) => { + return exports_util.safeExtend(inst, incoming); + }; + inst.merge = (other) => exports_util.merge(inst, other); + inst.pick = (mask) => exports_util.pick(inst, mask); + inst.omit = (mask) => exports_util.omit(inst, mask); + inst.partial = (...args) => exports_util.partial(ZodOptional, inst, args[0]); + inst.required = (...args) => exports_util.required(ZodNonOptional, inst, args[0]); +}); +function object(shape, params) { + const def = { + type: "object", + get shape() { + exports_util.assignProp(this, "shape", shape ? exports_util.objectClone(shape) : {}); + return this.shape; + }, + ...exports_util.normalizeParams(params) + }; + return new ZodObject(def); +} +function strictObject(shape, params) { + return new ZodObject({ + type: "object", + get shape() { + exports_util.assignProp(this, "shape", exports_util.objectClone(shape)); + return this.shape; + }, + catchall: never(), + ...exports_util.normalizeParams(params) + }); +} +function looseObject(shape, params) { + return new ZodObject({ + type: "object", + get shape() { + exports_util.assignProp(this, "shape", exports_util.objectClone(shape)); + return this.shape; + }, + catchall: unknown(), + ...exports_util.normalizeParams(params) + }); +} +var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => { + $ZodUnion.init(inst, def); + ZodType.init(inst, def); + inst.options = def.options; +}); +function union(options, params) { + return new ZodUnion({ + type: "union", + options, + ...exports_util.normalizeParams(params) + }); +} +var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => { + ZodUnion.init(inst, def); + $ZodDiscriminatedUnion.init(inst, def); +}); +function discriminatedUnion(discriminator, options, params) { + return new ZodDiscriminatedUnion({ + type: "union", + options, + discriminator, + ...exports_util.normalizeParams(params) + }); +} +var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => { + $ZodIntersection.init(inst, def); + ZodType.init(inst, def); +}); +function intersection(left, right) { + return new ZodIntersection({ + type: "intersection", + left, + right + }); +} +var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => { + $ZodTuple.init(inst, def); + ZodType.init(inst, def); + inst.rest = (rest) => inst.clone({ + ...inst._zod.def, + rest + }); +}); +function tuple(items, _paramsOrRest, _params) { + const hasRest = _paramsOrRest instanceof $ZodType; + const params = hasRest ? _params : _paramsOrRest; + const rest = hasRest ? _paramsOrRest : null; + return new ZodTuple({ + type: "tuple", + items, + rest, + ...exports_util.normalizeParams(params) + }); +} +var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => { + $ZodRecord.init(inst, def); + ZodType.init(inst, def); + inst.keyType = def.keyType; + inst.valueType = def.valueType; +}); +function record(keyType, valueType, params) { + return new ZodRecord({ + type: "record", + keyType, + valueType, + ...exports_util.normalizeParams(params) + }); +} +function partialRecord(keyType, valueType, params) { + const k = clone(keyType); + k._zod.values = undefined; + return new ZodRecord({ + type: "record", + keyType: k, + valueType, + ...exports_util.normalizeParams(params) + }); +} +var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => { + $ZodMap.init(inst, def); + ZodType.init(inst, def); + inst.keyType = def.keyType; + inst.valueType = def.valueType; +}); +function map(keyType, valueType, params) { + return new ZodMap({ + type: "map", + keyType, + valueType, + ...exports_util.normalizeParams(params) + }); +} +var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => { + $ZodSet.init(inst, def); + ZodType.init(inst, def); + inst.min = (...args) => inst.check(_minSize(...args)); + inst.nonempty = (params) => inst.check(_minSize(1, params)); + inst.max = (...args) => inst.check(_maxSize(...args)); + inst.size = (...args) => inst.check(_size(...args)); +}); +function set(valueType, params) { + return new ZodSet({ + type: "set", + valueType, + ...exports_util.normalizeParams(params) + }); +} +var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => { + $ZodEnum.init(inst, def); + ZodType.init(inst, def); + inst.enum = def.entries; + inst.options = Object.values(def.entries); + const keys = new Set(Object.keys(def.entries)); + inst.extract = (values, params) => { + const newEntries = {}; + for (const value of values) { + if (keys.has(value)) { + newEntries[value] = def.entries[value]; + } else + throw new Error(`Key ${value} not found in enum`); + } + return new ZodEnum({ + ...def, + checks: [], + ...exports_util.normalizeParams(params), + entries: newEntries + }); + }; + inst.exclude = (values, params) => { + const newEntries = { ...def.entries }; + for (const value of values) { + if (keys.has(value)) { + delete newEntries[value]; + } else + throw new Error(`Key ${value} not found in enum`); + } + return new ZodEnum({ + ...def, + checks: [], + ...exports_util.normalizeParams(params), + entries: newEntries + }); + }; +}); +function _enum2(values, params) { + const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values; + return new ZodEnum({ + type: "enum", + entries, + ...exports_util.normalizeParams(params) + }); +} +function nativeEnum(entries, params) { + return new ZodEnum({ + type: "enum", + entries, + ...exports_util.normalizeParams(params) + }); +} +var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => { + $ZodLiteral.init(inst, def); + ZodType.init(inst, def); + inst.values = new Set(def.values); + Object.defineProperty(inst, "value", { + get() { + if (def.values.length > 1) { + throw new Error("This schema contains multiple valid literal values. Use `.values` instead."); + } + return def.values[0]; + } + }); +}); +function literal(value, params) { + return new ZodLiteral({ + type: "literal", + values: Array.isArray(value) ? value : [value], + ...exports_util.normalizeParams(params) + }); +} +var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => { + $ZodFile.init(inst, def); + ZodType.init(inst, def); + inst.min = (size, params) => inst.check(_minSize(size, params)); + inst.max = (size, params) => inst.check(_maxSize(size, params)); + inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params)); +}); +function file(params) { + return _file(ZodFile, params); +} +var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => { + $ZodTransform.init(inst, def); + ZodType.init(inst, def); + inst._zod.parse = (payload, _ctx) => { + if (_ctx.direction === "backward") { + throw new $ZodEncodeError(inst.constructor.name); + } + payload.addIssue = (issue2) => { + if (typeof issue2 === "string") { + payload.issues.push(exports_util.issue(issue2, payload.value, def)); + } else { + const _issue = issue2; + if (_issue.fatal) + _issue.continue = false; + _issue.code ?? (_issue.code = "custom"); + _issue.input ?? (_issue.input = payload.value); + _issue.inst ?? (_issue.inst = inst); + payload.issues.push(exports_util.issue(_issue)); + } + }; + const output = def.transform(payload.value, payload); + if (output instanceof Promise) { + return output.then((output2) => { + payload.value = output2; + return payload; + }); + } + payload.value = output; + return payload; + }; +}); +function transform(fn) { + return new ZodTransform({ + type: "transform", + transform: fn + }); +} +var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => { + $ZodOptional.init(inst, def); + ZodType.init(inst, def); + inst.unwrap = () => inst._zod.def.innerType; +}); +function optional(innerType) { + return new ZodOptional({ + type: "optional", + innerType + }); +} +var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => { + $ZodNullable.init(inst, def); + ZodType.init(inst, def); + inst.unwrap = () => inst._zod.def.innerType; +}); +function nullable(innerType) { + return new ZodNullable({ + type: "nullable", + innerType + }); +} +function nullish2(innerType) { + return optional(nullable(innerType)); +} +var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => { + $ZodDefault.init(inst, def); + ZodType.init(inst, def); + inst.unwrap = () => inst._zod.def.innerType; + inst.removeDefault = inst.unwrap; +}); +function _default2(innerType, defaultValue) { + return new ZodDefault({ + type: "default", + innerType, + get defaultValue() { + return typeof defaultValue === "function" ? defaultValue() : exports_util.shallowClone(defaultValue); + } + }); +} +var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => { + $ZodPrefault.init(inst, def); + ZodType.init(inst, def); + inst.unwrap = () => inst._zod.def.innerType; +}); +function prefault(innerType, defaultValue) { + return new ZodPrefault({ + type: "prefault", + innerType, + get defaultValue() { + return typeof defaultValue === "function" ? defaultValue() : exports_util.shallowClone(defaultValue); + } + }); +} +var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => { + $ZodNonOptional.init(inst, def); + ZodType.init(inst, def); + inst.unwrap = () => inst._zod.def.innerType; +}); +function nonoptional(innerType, params) { + return new ZodNonOptional({ + type: "nonoptional", + innerType, + ...exports_util.normalizeParams(params) + }); +} +var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => { + $ZodSuccess.init(inst, def); + ZodType.init(inst, def); + inst.unwrap = () => inst._zod.def.innerType; +}); +function success(innerType) { + return new ZodSuccess({ + type: "success", + innerType + }); +} +var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => { + $ZodCatch.init(inst, def); + ZodType.init(inst, def); + inst.unwrap = () => inst._zod.def.innerType; + inst.removeCatch = inst.unwrap; +}); +function _catch2(innerType, catchValue) { + return new ZodCatch({ + type: "catch", + innerType, + catchValue: typeof catchValue === "function" ? catchValue : () => catchValue + }); +} +var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => { + $ZodNaN.init(inst, def); + ZodType.init(inst, def); +}); +function nan(params) { + return _nan(ZodNaN, params); +} +var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => { + $ZodPipe.init(inst, def); + ZodType.init(inst, def); + inst.in = def.in; + inst.out = def.out; +}); +function pipe(in_, out) { + return new ZodPipe({ + type: "pipe", + in: in_, + out + }); +} +var ZodCodec = /* @__PURE__ */ $constructor("ZodCodec", (inst, def) => { + ZodPipe.init(inst, def); + $ZodCodec.init(inst, def); +}); +function codec(in_, out, params) { + return new ZodCodec({ + type: "pipe", + in: in_, + out, + transform: params.decode, + reverseTransform: params.encode + }); +} +var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => { + $ZodReadonly.init(inst, def); + ZodType.init(inst, def); + inst.unwrap = () => inst._zod.def.innerType; +}); +function readonly(innerType) { + return new ZodReadonly({ + type: "readonly", + innerType + }); +} +var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => { + $ZodTemplateLiteral.init(inst, def); + ZodType.init(inst, def); +}); +function templateLiteral(parts, params) { + return new ZodTemplateLiteral({ + type: "template_literal", + parts, + ...exports_util.normalizeParams(params) + }); +} +var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => { + $ZodLazy.init(inst, def); + ZodType.init(inst, def); + inst.unwrap = () => inst._zod.def.getter(); +}); +function lazy(getter) { + return new ZodLazy({ + type: "lazy", + getter + }); +} +var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => { + $ZodPromise.init(inst, def); + ZodType.init(inst, def); + inst.unwrap = () => inst._zod.def.innerType; +}); +function promise(innerType) { + return new ZodPromise({ + type: "promise", + innerType + }); +} +var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => { + $ZodFunction.init(inst, def); + ZodType.init(inst, def); +}); +function _function(params) { + return new ZodFunction({ + type: "function", + input: Array.isArray(params?.input) ? tuple(params?.input) : params?.input ?? array(unknown()), + output: params?.output ?? unknown() + }); +} +var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => { + $ZodCustom.init(inst, def); + ZodType.init(inst, def); +}); +function check(fn) { + const ch = new $ZodCheck({ + check: "custom" + }); + ch._zod.check = fn; + return ch; +} +function custom(fn, _params) { + return _custom(ZodCustom, fn ?? (() => true), _params); +} +function refine(fn, _params = {}) { + return _refine(ZodCustom, fn, _params); +} +function superRefine(fn) { + return _superRefine(fn); +} +function _instanceof(cls, params = { + error: `Input not instance of ${cls.name}` +}) { + const inst = new ZodCustom({ + type: "custom", + check: "custom", + fn: (data) => data instanceof cls, + abort: true, + ...exports_util.normalizeParams(params) + }); + inst._zod.bag.Class = cls; + return inst; +} +var stringbool = (...args) => _stringbool({ + Codec: ZodCodec, + Boolean: ZodBoolean, + String: ZodString +}, ...args); +function json(params) { + const jsonSchema = lazy(() => { + return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]); + }); + return jsonSchema; +} +function preprocess(fn, schema) { + return pipe(transform(fn), schema); +} +// node_modules/zod/v4/classic/compat.js +var ZodIssueCode = { + invalid_type: "invalid_type", + too_big: "too_big", + too_small: "too_small", + invalid_format: "invalid_format", + not_multiple_of: "not_multiple_of", + unrecognized_keys: "unrecognized_keys", + invalid_union: "invalid_union", + invalid_key: "invalid_key", + invalid_element: "invalid_element", + invalid_value: "invalid_value", + custom: "custom" +}; +function setErrorMap(map2) { + config({ + customError: map2 + }); +} +function getErrorMap() { + return config().customError; +} +var ZodFirstPartyTypeKind; +(function(ZodFirstPartyTypeKind2) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {})); +// node_modules/zod/v4/classic/coerce.js +var exports_coerce = {}; +__export(exports_coerce, { + string: () => string3, + number: () => number3, + date: () => date4, + boolean: () => boolean3, + bigint: () => bigint3 +}); +function string3(params) { + return _coercedString(ZodString, params); +} +function number3(params) { + return _coercedNumber(ZodNumber, params); +} +function boolean3(params) { + return _coercedBoolean(ZodBoolean, params); +} +function bigint3(params) { + return _coercedBigint(ZodBigInt, params); +} +function date4(params) { + return _coercedDate(ZodDate, params); +} + +// node_modules/zod/v4/classic/external.js +config(en_default()); +// src/protocol.ts +var PROTOCOL_VERSION = 1; +var OPENCODE_VERSION = "1.17.18"; +var HOST_CAPABILITIES = [ + "config-contributors-v1", + "config-contributions-v2", + "generation-fencing-v1" +]; +var DEFAULT_MAX_FRAME_BYTES = 16 * 1024 * 1024; +var MAX_MAX_FRAME_BYTES = 64 * 1024 * 1024; +var MAX_STREAM_CHUNK_BYTES = 64 * 1024; +var JsonValueSchema = exports_external.json(); +var JsonObjectSchema = exports_external.record(exports_external.string(), JsonValueSchema); +var EmptyResultSchema = exports_external.object({}).strict(); +var LogLevelSchema = exports_external.enum(["trace", "debug", "info", "warn", "error", "off"]); +var InstanceParamsSchema = exports_external.object({ instanceID: exports_external.string().min(1) }); +var HeaderSchema = exports_external.array(exports_external.string()).length(2); +var HeadersSchema = exports_external.array(HeaderSchema); +var StreamDescriptorSchema = exports_external.object({ + streamID: exports_external.string().min(1), + length: exports_external.number().int().nonnegative().optional() +}); +var StreamReadParamsSchema = exports_external.object({ + instanceID: exports_external.string().min(1), + streamID: exports_external.string().min(1), + maxBytes: exports_external.number().int().positive().max(MAX_STREAM_CHUNK_BYTES).optional() +}); +var StreamReadResultSchema = exports_external.object({ + data: exports_external.string().regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/), + eof: exports_external.boolean() +}); +var StreamCancelParamsSchema = StreamReadParamsSchema.omit({ maxBytes: true }).extend({ + reason: exports_external.string().optional() +}); +var CancelResultSchema = exports_external.object({ cancelled: exports_external.boolean() }); +var CloseResultSchema = exports_external.object({ closed: exports_external.boolean() }); +var ReleaseResultSchema = exports_external.object({ released: exports_external.boolean() }); +var RpcErrorObjectSchema = exports_external.object({ + code: exports_external.number().int(), + message: exports_external.string(), + data: JsonValueSchema.optional() +}); +var RpcRequestSchema = exports_external.object({ + jsonrpc: exports_external.literal("2.0"), + id: exports_external.string().min(1), + method: exports_external.string().min(1), + params: JsonValueSchema.optional() +}); +var RpcNotificationSchema = RpcRequestSchema.omit({ id: true }); +var RpcSuccessResponseSchema = exports_external.object({ + jsonrpc: exports_external.literal("2.0"), + id: exports_external.string().min(1), + result: JsonValueSchema +}); +var RpcErrorResponseSchema = exports_external.object({ + jsonrpc: exports_external.literal("2.0"), + id: exports_external.string().min(1), + error: RpcErrorObjectSchema +}); +var RpcMessageSchema = exports_external.union([ + RpcRequestSchema, + RpcNotificationSchema, + RpcSuccessResponseSchema, + RpcErrorResponseSchema +]); +var DiagnosticSchema = exports_external.object({ + severity: exports_external.enum(["debug", "info", "warning", "error"]), + code: exports_external.string(), + message: exports_external.string(), + plugin: exports_external.string().optional(), + method: exports_external.string().optional(), + data: JsonValueSchema.optional() +}); +var PluginDeclarationSchema = exports_external.object({ + spec: exports_external.string().min(1), + options: JsonObjectSchema.optional(), + baseDirectory: exports_external.string().optional() +}); +var PluginPrepareFailureSchema = exports_external.object({ + spec: exports_external.string(), + stage: exports_external.enum(["declaration", "resolve", "install", "entry", "compatibility", "load", "shape"]), + message: exports_external.string() +}); +var ToolAttachmentSchema = exports_external.object({ + type: exports_external.literal("file"), + mime: exports_external.string(), + url: exports_external.string(), + filename: exports_external.string().optional() +}); +var ToolResultSchema = exports_external.union([ + exports_external.string(), + exports_external.object({ + title: exports_external.string().optional(), + output: exports_external.string(), + metadata: JsonObjectSchema.optional(), + attachments: exports_external.array(ToolAttachmentSchema).optional() + }) +]); +var ToolRegistrationSchema = exports_external.object({ + registrationID: exports_external.string().min(1), + id: exports_external.string().min(1), + plugin: JsonObjectSchema.optional(), + description: exports_external.string(), + parameters: JsonValueSchema +}); +var AuthRuleSchema = exports_external.object({ + key: exports_external.string(), + op: exports_external.enum(["eq", "neq"]), + value: exports_external.string() +}); +var AuthPromptSchema = exports_external.object({ + type: exports_external.enum(["text", "select"]), + promptIndex: exports_external.number().int().nonnegative(), + key: exports_external.string(), + message: exports_external.string(), + placeholder: exports_external.string().optional(), + options: exports_external.array(exports_external.object({ label: exports_external.string(), value: exports_external.string(), hint: exports_external.string().optional() })).optional(), + when: AuthRuleSchema.optional(), + hasValidate: exports_external.boolean(), + hasCondition: exports_external.boolean() +}); +var AuthRegistrationSchema = exports_external.object({ + provider: exports_external.string().min(1), + plugin: JsonObjectSchema.optional(), + hasLoader: exports_external.boolean(), + methods: exports_external.array(exports_external.object({ + type: exports_external.enum(["oauth", "api"]), + label: exports_external.string(), + methodIndex: exports_external.number().int().nonnegative(), + hasAuthorize: exports_external.boolean(), + prompts: exports_external.array(AuthPromptSchema) + })) +}); +var ProviderRegistrationSchema = exports_external.object({ + provider: exports_external.string().min(1), + plugin: JsonObjectSchema.optional(), + hasModels: exports_external.boolean() +}); +var WorkspaceRegistrationSchema = exports_external.object({ + registrationID: exports_external.string().min(1), + type: exports_external.string().min(1), + plugin: JsonObjectSchema.optional(), + name: exports_external.string(), + description: exports_external.string() +}); +var PluginMetaSchema = exports_external.object({ + id: exports_external.string().optional(), + spec: exports_external.string().min(1), + entry: exports_external.string().min(1), + index: exports_external.number().int().nonnegative() +}); +var ConfigContributorSchema = exports_external.object({ + plugin: PluginMetaSchema, + outcome: exports_external.enum(["applied", "failed"]) +}); +var ConfigContributionSchema = ConfigContributorSchema.extend({ + config: JsonObjectSchema +}); +var AuthSuccessSchema = exports_external.union([ + exports_external.object({ + type: exports_external.literal("success"), + provider: exports_external.string().optional(), + refresh: exports_external.string(), + access: exports_external.string(), + expires: exports_external.number(), + accountId: exports_external.string().optional(), + enterpriseUrl: exports_external.string().optional() + }), + exports_external.object({ + type: exports_external.literal("success"), + provider: exports_external.string().optional(), + key: exports_external.string(), + metadata: exports_external.record(exports_external.string(), exports_external.string()).optional() + }) +]); +var AuthFailedSchema = exports_external.object({ type: exports_external.literal("failed") }); +var AuthFetchRequestSchema = exports_external.object({ + url: exports_external.string().url(), + method: exports_external.string().min(1).optional(), + headers: HeadersSchema.optional(), + body: StreamDescriptorSchema.optional() +}); +var HttpResponseSchema = exports_external.object({ + status: exports_external.number().int().min(100).max(599), + statusText: exports_external.string().optional(), + headers: HeadersSchema, + body: StreamDescriptorSchema.optional() +}); +var HostMethodSchemas = { + "host.plugins.prepare": { + params: exports_external.object({ + plugins: exports_external.array(PluginDeclarationSchema), + configurationFingerprint: exports_external.string().min(1).optional(), + defaultBaseDirectory: exports_external.string().optional(), + allowInstall: exports_external.boolean().optional() + }), + result: exports_external.object({ + configurationFingerprint: exports_external.string().min(1).optional(), + reviewDigest: exports_external.string().length(64), + reviewed: exports_external.array(exports_external.object({ + spec: exports_external.string(), + source: exports_external.enum(["file", "npm"]), + identity: exports_external.string().min(1), + canonicalSource: exports_external.string().min(1), + baseDirectory: exports_external.string().min(1), + optionsDigest: exports_external.string().length(64) + })), + prepared: exports_external.array(exports_external.object({ + spec: exports_external.string(), + identity: exports_external.string().min(1), + source: exports_external.enum(["file", "npm"]), + target: exports_external.string(), + entry: exports_external.string(), + cache: exports_external.enum(["hit", "installed", "validated"]), + contentHash: exports_external.string().length(64).optional(), + version: exports_external.string().optional() + })), + failed: exports_external.array(PluginPrepareFailureSchema), + diagnostics: exports_external.array(DiagnosticSchema) + }) + }, + "host.instance.open": { + params: exports_external.object({ + instanceID: exports_external.string().min(1), + generationKey: exports_external.string().min(1).optional(), + revision: exports_external.string().min(1).optional(), + project: JsonValueSchema, + config: JsonObjectSchema, + directory: exports_external.string(), + worktree: exports_external.string(), + plugins: exports_external.array(PluginDeclarationSchema), + configurationFingerprint: exports_external.string().min(1).optional(), + expectedContentDigests: exports_external.record(exports_external.string(), exports_external.string().length(64)).optional(), + expectedReviewDigest: exports_external.string().length(64).optional() + }), + result: exports_external.object({ + instanceID: exports_external.string().min(1), + generationKey: exports_external.string().min(1).optional(), + revision: exports_external.string().min(1).optional(), + config: JsonObjectSchema, + configContributors: exports_external.array(ConfigContributorSchema), + configContributions: exports_external.array(ConfigContributionSchema), + diagnostics: exports_external.array(DiagnosticSchema), + hooks: exports_external.array(exports_external.string()), + tools: exports_external.array(ToolRegistrationSchema), + auth: exports_external.array(AuthRegistrationSchema), + providers: exports_external.array(ProviderRegistrationSchema), + workspaces: exports_external.array(WorkspaceRegistrationSchema), + gatewayURL: exports_external.string().url() + }) + }, + "host.instance.close": { params: InstanceParamsSchema, result: CloseResultSchema }, + "host.log.setLevel": { params: exports_external.object({ level: LogLevelSchema }), result: exports_external.object({ level: LogLevelSchema }) }, + "host.shutdown": { params: EmptyResultSchema, result: CloseResultSchema }, + "host.hook.call": { + params: exports_external.object({ + instanceID: exports_external.string().min(1), + generationKey: exports_external.string().min(1).optional(), + revision: exports_external.string().min(1).optional(), + hook: exports_external.string().min(1), + input: JsonValueSchema, + output: JsonValueSchema + }), + result: exports_external.object({ + instanceID: exports_external.string().min(1).optional(), + generationKey: exports_external.string().min(1).optional(), + revision: exports_external.string().min(1).optional(), + hook: exports_external.string().min(1), + input: JsonValueSchema, + output: JsonValueSchema + }) + }, + "host.event.emit": { + params: exports_external.object({ instanceID: exports_external.string().min(1), event: JsonValueSchema }), + result: exports_external.object({ accepted: exports_external.literal(true) }) + }, + "host.tool.execute": { + params: exports_external.object({ + instanceID: exports_external.string().min(1), + generationKey: exports_external.string().min(1).optional(), + revision: exports_external.string().min(1).optional(), + executionID: exports_external.string().min(1), + registrationID: exports_external.string().min(1), + args: JsonValueSchema, + context: exports_external.object({ + sessionID: exports_external.string(), + messageID: exports_external.string(), + agent: exports_external.string(), + callID: exports_external.string().optional() + }) + }), + result: exports_external.object({ + instanceID: exports_external.string().min(1).optional(), + generationKey: exports_external.string().min(1).optional(), + revision: exports_external.string().min(1).optional(), + executionID: exports_external.string().min(1), + result: ToolResultSchema + }) + }, + "host.tool.cancel": { + params: exports_external.object({ + instanceID: exports_external.string().min(1), + generationKey: exports_external.string().min(1).optional(), + revision: exports_external.string().min(1).optional(), + executionID: exports_external.string().min(1), + reason: exports_external.string().optional() + }), + result: CancelResultSchema + }, + "host.auth.prompt.evaluate": { + params: exports_external.object({ + instanceID: exports_external.string().min(1), + provider: exports_external.string().min(1), + methodIndex: exports_external.number().int().nonnegative(), + promptIndex: exports_external.number().int().nonnegative(), + operation: exports_external.enum(["validate", "condition"]), + value: exports_external.string().optional(), + inputs: exports_external.record(exports_external.string(), exports_external.string()) + }), + result: exports_external.union([ + exports_external.object({ operation: exports_external.literal("validate"), error: exports_external.string().optional() }), + exports_external.object({ operation: exports_external.literal("condition"), active: exports_external.boolean() }) + ]) + }, + "host.auth.authorize": { + params: exports_external.object({ + instanceID: exports_external.string().min(1), + provider: exports_external.string().min(1), + methodIndex: exports_external.number().int().nonnegative(), + inputs: exports_external.record(exports_external.string(), exports_external.string()).optional() + }), + result: exports_external.union([ + exports_external.object({ + type: exports_external.literal("oauth"), + flowID: exports_external.string().min(1), + url: exports_external.string().url(), + instructions: exports_external.string(), + method: exports_external.enum(["auto", "code"]) + }), + exports_external.object({ type: exports_external.literal("api"), result: exports_external.union([AuthSuccessSchema, AuthFailedSchema]).optional() }) + ]) + }, + "host.auth.callback": { + params: exports_external.object({ instanceID: exports_external.string().min(1), flowID: exports_external.string().min(1), code: exports_external.string().optional() }), + result: exports_external.union([AuthSuccessSchema, AuthFailedSchema]) + }, + "host.auth.flow.cancel": { + params: exports_external.object({ instanceID: exports_external.string().min(1), flowID: exports_external.string().min(1), reason: exports_external.string().optional() }), + result: CancelResultSchema + }, + "host.auth.loader": { + params: exports_external.object({ + instanceID: exports_external.string().min(1), + provider: exports_external.string().min(1), + providerInfo: JsonValueSchema + }), + result: exports_external.object({ value: JsonObjectSchema, fetchID: exports_external.string().min(1).optional() }) + }, + "host.auth.fetch": { + params: exports_external.object({ + instanceID: exports_external.string().min(1), + fetchID: exports_external.string().min(1), + requestID: exports_external.string().min(1), + request: AuthFetchRequestSchema + }), + result: HttpResponseSchema + }, + "host.auth.fetch.cancel": { + params: exports_external.object({ instanceID: exports_external.string().min(1), requestID: exports_external.string().min(1), reason: exports_external.string().optional() }), + result: CancelResultSchema + }, + "host.auth.fetch.release": { + params: exports_external.object({ instanceID: exports_external.string().min(1), fetchID: exports_external.string().min(1) }), + result: ReleaseResultSchema + }, + "host.provider.models": { + params: exports_external.object({ + instanceID: exports_external.string().min(1), + providerID: exports_external.string().min(1), + provider: JsonValueSchema, + auth: JsonValueSchema.optional() + }), + result: exports_external.object({ models: JsonObjectSchema }) + }, + "host.workspace.configure": { + params: exports_external.object({ instanceID: exports_external.string().min(1), registrationID: exports_external.string().min(1), config: JsonValueSchema }), + result: exports_external.object({ config: JsonValueSchema }) + }, + "host.workspace.create": { + params: exports_external.object({ + instanceID: exports_external.string().min(1), + registrationID: exports_external.string().min(1), + config: JsonValueSchema, + env: exports_external.record(exports_external.string(), exports_external.string().nullable()), + from: JsonValueSchema.optional() + }), + result: EmptyResultSchema + }, + "host.workspace.remove": { + params: exports_external.object({ instanceID: exports_external.string().min(1), registrationID: exports_external.string().min(1), config: JsonValueSchema }), + result: EmptyResultSchema + }, + "host.workspace.target": { + params: exports_external.object({ instanceID: exports_external.string().min(1), registrationID: exports_external.string().min(1), config: JsonValueSchema }), + result: exports_external.object({ + target: exports_external.union([ + exports_external.object({ type: exports_external.literal("local"), directory: exports_external.string() }), + exports_external.object({ type: exports_external.literal("remote"), url: exports_external.string().url(), headers: HeadersSchema.optional() }) + ]) + }) + }, + "host.stream.read": { params: StreamReadParamsSchema, result: StreamReadResultSchema }, + "host.stream.cancel": { params: StreamCancelParamsSchema, result: CancelResultSchema } +}; +var BackendMethodSchemas = { + "backend.handshake": { + params: exports_external.object({ + token: exports_external.string().min(1), + protocolVersion: exports_external.literal(PROTOCOL_VERSION), + opencodeVersion: exports_external.literal(OPENCODE_VERSION), + maxFrameBytes: exports_external.number().int().positive().max(MAX_MAX_FRAME_BYTES), + capabilities: exports_external.array(exports_external.string().min(1)).optional() + }), + result: exports_external.object({ + protocolVersion: exports_external.literal(PROTOCOL_VERSION), + maxFrameBytes: exports_external.number().int().positive().max(MAX_MAX_FRAME_BYTES), + cacheDirectory: exports_external.string(), + capabilities: exports_external.array(exports_external.string().min(1)).optional() + }) + }, + "backend.http.request": { + params: exports_external.object({ + instanceID: exports_external.string().min(1), + requestID: exports_external.string().min(1), + method: exports_external.string().min(1), + path: exports_external.string(), + headers: HeadersSchema, + body: StreamDescriptorSchema.optional() + }), + result: HttpResponseSchema + }, + "backend.auth.get": { + params: exports_external.object({ instanceID: exports_external.string().min(1), providerID: exports_external.string().min(1) }), + result: exports_external.object({ auth: JsonValueSchema.nullable() }) + }, + "backend.tool.ask": { + params: exports_external.object({ + instanceID: exports_external.string().min(1), + generationKey: exports_external.string().min(1).optional(), + revision: exports_external.string().min(1).optional(), + executionID: exports_external.string().min(1), + permission: exports_external.string(), + patterns: exports_external.array(exports_external.string()), + always: exports_external.array(exports_external.string()), + metadata: JsonObjectSchema + }), + result: EmptyResultSchema + }, + "backend.tool.metadata": { + params: exports_external.object({ + instanceID: exports_external.string().min(1), + generationKey: exports_external.string().min(1).optional(), + revision: exports_external.string().min(1).optional(), + executionID: exports_external.string().min(1), + title: exports_external.string().optional(), + metadata: JsonObjectSchema.optional() + }), + result: EmptyResultSchema + }, + "backend.diagnostic.publish": { + params: exports_external.object({ instanceID: exports_external.string().min(1).optional(), diagnostic: DiagnosticSchema }), + result: EmptyResultSchema + }, + "backend.stream.read": { params: StreamReadParamsSchema, result: StreamReadResultSchema }, + "backend.stream.cancel": { params: StreamCancelParamsSchema, result: CancelResultSchema } +}; + +// src/tool-schema.ts +function toolParametersToJsonSchema(args) { + const entries = Object.entries(isRecord2(args) ? args : {}); + const zodParameters = entries.every((entry) => isZodType(entry[1])) ? exports_external.object(Object.fromEntries(entries)) : undefined; + if (!zodParameters) + return legacyJsonSchema(entries); + const result = normalizeZodJsonSchema(exports_external.toJSONSchema(zodParameters, { io: "input", metadata: zodMetadataRegistry(zodParameters) })); + if (!isRecord2(result)) + throw new Error("plugin tool Zod schema produced a non-object JSON Schema"); + const { $defs, ...rest } = result; + return $defs && isRecord2($defs) ? { ...rest, definitions: $defs } : rest; +} +function validateToolArguments(argsDefinition, value) { + const entries = Object.entries(isRecord2(argsDefinition) ? argsDefinition : {}); + if (!entries.every((entry) => isZodType(entry[1]))) + return value; + return exports_external.object(Object.fromEntries(entries)).parse(value); +} +function isZodType(value) { + return typeof value === "object" && value !== null && "_zod" in value; +} +function isJsonSchemaDefinition(value) { + return typeof value === "boolean" || isRecord2(value); +} +function legacyJsonSchema(entries) { + const properties = Object.fromEntries(entries.filter((entry) => isJsonSchemaDefinition(entry[1]))); + return { + type: "object", + properties, + required: Object.keys(properties) + }; +} +function zodMetadataRegistry(schema) { + const registry2 = exports_external.registry(); + const seen = new WeakSet; + const collect = (value) => { + if (typeof value !== "object" || value === null) + return; + if (seen.has(value)) + return; + seen.add(value); + if (isZodType(value)) { + const metadata = typeof value.meta === "function" ? value.meta() : undefined; + const description = typeof value.description === "string" ? value.description : undefined; + const merged = { + ...metadata && typeof metadata === "object" ? metadata : {}, + ...description ? { description } : {} + }; + if (Object.keys(merged).length) + registry2.add(value, merged); + collect(value._zod.def); + return; + } + for (const item of Object.values(value)) + collect(item); + }; + collect(schema); + return registry2; +} +function normalizeZodJsonSchema(value) { + if (Array.isArray(value)) + return value.map((item) => normalizeZodJsonSchema(item)); + if (!isRecord2(value)) + return value; + return Object.fromEntries(Object.entries(value).filter((entry) => (entry[0] === "exclusiveMaximum" || entry[0] === "exclusiveMinimum") && typeof entry[1] === "boolean" ? false : true).map(([key, item]) => [key, normalizeZodJsonSchema(item)])); +} +function isRecord2(value) { + return typeof value === "object" && value !== null && !Array.isArray(value); +} + +// src/wire.ts +class WireValueError extends TypeError { + path; + constructor(path2, message) { + super(`Wire value at ${path2} ${message}`); + this.name = "WireValueError"; + this.path = path2; + } +} +function cloneWireValue(value, path2 = "$") { + return clone2(value, path2, new Map); +} +function clone2(value, path2, ancestors) { + if (value === null || typeof value === "string" || typeof value === "boolean") + return value; + if (typeof value === "number") { + if (!Number.isFinite(value)) + throw new WireValueError(path2, "cannot contain a non-finite number"); + return value; + } + if (typeof value === "function") + throw new WireValueError(path2, "cannot contain a function"); + if (typeof value === "bigint") + throw new WireValueError(path2, "cannot contain a BigInt"); + if (typeof value === "undefined") + throw new WireValueError(path2, "cannot contain undefined"); + if (typeof value === "symbol") + throw new WireValueError(path2, "cannot contain a symbol"); + if (typeof value !== "object") + throw new WireValueError(path2, `has unsupported type ${typeof value}`); + const previous = ancestors.get(value); + if (previous !== undefined) + throw new WireValueError(path2, `contains a cycle referencing ${previous}`); + ancestors.set(value, path2); + try { + if (Array.isArray(value)) { + return Array.from(value, (item, index) => item === undefined ? null : clone2(item, `${path2}[${index}]`, ancestors)); + } + const prototype = Object.getPrototypeOf(value); + if (prototype !== Object.prototype && prototype !== null) { + throw new WireValueError(path2, `must be a plain object, received ${objectName(value)}`); + } + return Object.fromEntries(Object.entries(value).filter((entry) => entry[1] !== undefined).map(([key, item]) => [key, clone2(item, propertyPath(path2, key), ancestors)])); + } finally { + ancestors.delete(value); + } +} +function propertyPath(parent, key) { + return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key) ? `${parent}.${key}` : `${parent}[${JSON.stringify(key)}]`; +} +function objectName(value) { + return Object.prototype.toString.call(value); +} + +// src/host.ts +var OPENCODE_VERSION2 = "1.17.18"; +var GENERIC_HOOKS = [ + "chat.message", + "chat.params", + "chat.headers", + "permission.ask", + "command.execute.before", + "tool.execute.before", + "shell.env", + "tool.execute.after", + "experimental.chat.messages.transform", + "experimental.chat.system.transform", + "experimental.provider.small_model", + "experimental.session.compacting", + "experimental.compaction.autocontinue", + "experimental.text.complete", + "tool.definition" +]; + +class ExtensionHost { + #rpc; + #streams; + #cacheDirectory; + #gatewayFactory; + #preparePlugins; + #shell; + #instances = new Map; + #directories = new Map; + #opening = new Map; + #preparations = new Map; + #cancelledOpenings = new Set; + #status = "running"; + #shutdownPromise; + constructor(input) { + this.#rpc = input.rpc; + this.#streams = input.streams; + this.#cacheDirectory = input.cacheDirectory; + this.#gatewayFactory = input.gatewayFactory; + this.#preparePlugins = input.preparePlugins; + this.#shell = input.shell; + } + async prepare(input) { + this.#assertAccepting(); + const prepared = await this.#prepare({ + declarations: input.plugins, + defaultBaseDirectory: input.defaultBaseDirectory, + configurationFingerprint: input.configurationFingerprint, + allowInstall: input.allowInstall + }); + const result = { + ...input.configurationFingerprint ? { configurationFingerprint: input.configurationFingerprint } : {}, + reviewed: prepared.reviewed.map((plugin) => ({ + spec: plugin.spec, + source: plugin.source, + identity: plugin.identity, + canonicalSource: plugin.resolvedSpec, + baseDirectory: plugin.baseDirectory, + optionsDigest: plugin.optionsDigest + })), + prepared: prepared.prepared.map((plugin) => ({ + spec: plugin.spec, + identity: plugin.identity, + source: plugin.source, + target: plugin.target, + entry: plugin.entry, + cache: plugin.cache, + ...plugin.contentHash ? { contentHash: plugin.contentHash } : {}, + ...typeof plugin.package?.manifest.version === "string" ? { version: plugin.package.manifest.version } : {} + })), + failed: prepared.diagnostics.map((diagnostic) => ({ + spec: diagnostic.spec, + stage: diagnostic.stage, + message: diagnostic.message + })), + diagnostics: prepared.diagnostics.map(protocolDiagnostic) + }; + return HostMethodSchemas["host.plugins.prepare"].result.parse({ + ...result, + reviewDigest: preparationReviewDigest(result) + }); + } + async open(input) { + this.#assertAccepting(); + if (this.#instances.has(input.instanceID) || this.#opening.has(input.instanceID)) { + throw new ExtensionHostError(-32002, `Instance ${input.instanceID} already exists`, { + kind: "instance_exists", + instanceID: input.instanceID + }); + } + const operation = Promise.withResolvers(); + this.#opening.set(input.instanceID, operation.promise); + try { + const canonicalDirectory = await realpath2(path2.resolve(input.directory)).catch(() => path2.resolve(input.directory)); + this.#assertAccepting(); + if (this.#cancelledOpenings.has(input.instanceID)) { + throw new ExtensionHostError(-32004, `Instance ${input.instanceID} was closed while opening`, { + kind: "instance_closing", + instanceID: input.instanceID + }); + } + const owner = this.#directories.get(canonicalDirectory); + if (owner) { + throw new ExtensionHostError(-32002, `Directory ${canonicalDirectory} is already owned by ${owner}`, { + kind: "directory_exists", + instanceID: owner, + directory: canonicalDirectory + }); + } + let config2 = cloneWireValue(input.config, "config"); + const gateway = await this.#gatewayFactory({ + instanceID: input.instanceID, + rpc: this.#rpc, + streams: this.#streams + }); + const opened = Promise.withResolvers(); + const instance = { + id: input.instanceID, + generationKey: input.generationKey, + revision: input.revision, + canonicalDirectory, + directory: input.directory, + worktree: input.worktree, + status: "opening", + gateway, + hooks: [], + tools: new Map, + auth: new Map, + providers: new Map, + workspaces: new Map, + flows: new Map, + fetches: new Map, + activeTools: new Map, + activeHooks: new Set, + activeFetches: new Map, + openDone: opened.promise, + finishOpen: opened.resolve, + disposed: new Set, + counter: 0 + }; + this.#instances.set(instance.id, instance); + this.#directories.set(canonicalDirectory, instance.id); + let failure; + const diagnostics = []; + try { + logEvent("plugin.activation.begin", { + instance_id: instance.id, + plugin_count: input.plugins.length, + plugins: input.plugins.map(pluginDeclarationSpec) + }); + const prepared = await this.#prepare({ + declarations: input.plugins, + defaultBaseDirectory: input.directory, + configurationFingerprint: input.configurationFingerprint, + allowInstall: true + }); + if (input.expectedReviewDigest) { + const reviewDigest = preparationReviewDigest({ + ...input.configurationFingerprint ? { configurationFingerprint: input.configurationFingerprint } : {}, + reviewed: prepared.reviewed.map((plugin) => ({ + spec: plugin.spec, + source: plugin.source, + identity: plugin.identity, + canonicalSource: plugin.resolvedSpec, + baseDirectory: plugin.baseDirectory, + optionsDigest: plugin.optionsDigest + })), + prepared: prepared.prepared.map((plugin) => ({ + spec: plugin.spec, + identity: plugin.identity, + source: plugin.source, + target: plugin.target, + entry: plugin.entry, + ...plugin.contentHash ? { contentHash: plugin.contentHash } : {}, + ...typeof plugin.package?.manifest.version === "string" ? { version: plugin.package.manifest.version } : {} + })), + failed: prepared.diagnostics.map((diagnostic) => ({ + spec: diagnostic.spec, + stage: diagnostic.stage + })) + }); + if (reviewDigest !== input.expectedReviewDigest) { + throw new ExtensionHostError(-32004, "Plugin preparation changed before import", { + kind: "prepared_review_changed" + }); + } + } + if (input.expectedContentDigests) { + for (const plugin of prepared.prepared) { + const expected = input.expectedContentDigests[plugin.identity]; + if (!expected || !plugin.contentHash || expected !== plugin.contentHash) { + throw new ExtensionHostError(-32004, `Plugin ${plugin.spec} content changed before import`, { + kind: "prepared_content_changed", + plugin: plugin.spec + }); + } + } + if (prepared.prepared.length !== Object.keys(input.expectedContentDigests).length) { + throw new ExtensionHostError(-32004, "Prepared plugin graph changed before import", { + kind: "prepared_graph_changed" + }); + } + } + const loaded = await loadPreparedPlugins(prepared); + this.#assertOpening(instance); + diagnostics.push(...loaded.diagnostics); + const client3 = createOpencodeClient({ baseUrl: gateway.url.toString(), directory: input.directory }); + for (const plugin of loaded.loaded) { + this.#assertOpening(instance); + await this.#startPlugin(instance, plugin, input.project, client3, diagnostics); + } + const activatedPlugins = instance.hooks.map(({ plugin }) => plugin.spec); + logEvent("plugin.activation.complete", { + instance_id: instance.id, + configured_plugin_count: input.plugins.length, + loaded_plugin_count: loaded.loaded.length, + activated_plugin_count: activatedPlugins.length, + plugins: activatedPlugins, + diagnostic_count: diagnostics.length + }); + const configContributions = []; + for (const retained of instance.hooks) { + this.#assertOpening(instance); + if (!retained.hooks.config) + continue; + const configBeforeHook = cloneWireValue(config2, "configBeforeHook"); + logEvent("plugin.activation.config_hook.begin", { + instance_id: instance.id, + plugin: retained.plugin.spec + }, "debug"); + try { + await Promise.resolve(retained.hooks.config(config2)); + configContributions.push({ + plugin: retained.plugin, + outcome: "applied", + config: cloneWireValue(config2, "configContribution.config") + }); + logEvent("plugin.activation.config_hook.complete", { + instance_id: instance.id, + plugin: retained.plugin.spec + }, "debug"); + } catch (error45) { + config2 = configBeforeHook; + const diagnostic = runtimeDiagnostic(retained.plugin, "config", error45); + diagnostics.push(diagnostic); + configContributions.push({ + plugin: retained.plugin, + outcome: "failed", + config: cloneWireValue(config2, "configContribution.config") + }); + logError("plugin.activation.config_hook.failed", error45, { + instance_id: instance.id, + plugin: retained.plugin.spec + }); + await publishDiagnostic(this.#rpc, toPublishedDiagnostic(instance.id, diagnostic)).catch(() => {}); + } + this.#assertOpening(instance); + } + this.#assertOpening(instance); + this.#indexRegistrations(instance, diagnostics); + this.#assertOpening(instance); + const result = HostMethodSchemas["host.instance.open"].result.parse(openResult(instance, config2, diagnostics, configContributions)); + logEvent("plugin.activation.registrations", { + instance_id: instance.id, + hook_count: result.hooks.length, + config_hook_count: instance.hooks.filter(({ hooks }) => typeof hooks.config === "function").length, + tool_count: result.tools.length, + diagnostic_count: result.diagnostics.length + }); + instance.status = "open"; + return result; + } catch (error45) { + logError("plugin.activation.failed", error45, { + instance_id: instance.id, + configured_plugin_count: input.plugins.length, + activated_plugin_count: instance.hooks.length, + plugins: instance.hooks.map(({ plugin }) => plugin.spec) + }); + failure = error45; + } finally { + instance.finishOpen(); + } + await this.#beginClose(instance); + throw failure; + } finally { + if (this.#opening.get(input.instanceID) === operation.promise) + this.#opening.delete(input.instanceID); + this.#cancelledOpenings.delete(input.instanceID); + operation.resolve(); + } + } + async close(input) { + const pending = this.#opening.get(input.instanceID); + const instance = this.#instances.get(input.instanceID); + if (!instance && pending) { + this.#cancelledOpenings.add(input.instanceID); + await pending; + return { closed: true }; + } + if (!instance) + return { closed: false }; + const first = !instance.closePromise; + await this.#beginClose(instance); + return { closed: first }; + } + async shutdown() { + if (!this.#shutdownPromise) { + this.#status = "closing"; + this.#shutdownPromise = (async () => { + await Promise.all([ + ...Array.from(this.#instances.values(), (instance) => this.#beginClose(instance)), + ...this.#opening.values(), + ...this.#preparations.values() + ]); + await Promise.all(Array.from(this.#instances.values(), (instance) => this.#beginClose(instance))); + this.#status = "closed"; + })(); + } + await this.#shutdownPromise; + return { closed: true }; + } + #prepare(input) { + const key = preparationKey(input); + const pending = this.#preparations.get(key); + if (pending) { + logEvent("plugin.prepare.waiting_existing", { + configuration_fingerprint: input.configurationFingerprint, + plugin_count: input.declarations.length, + plugins: input.declarations.map(pluginDeclarationSpec) + }, "debug"); + return pending; + } + const startedAt = performance.now(); + logEvent("plugin.prepare.begin", { + configuration_fingerprint: input.configurationFingerprint, + plugin_count: input.declarations.length, + plugins: input.declarations.map(pluginDeclarationSpec) + }); + const operation = this.#preparePlugins({ + declarations: input.declarations, + cacheDirectory: this.#cacheDirectory, + defaultBaseDirectory: input.defaultBaseDirectory, + compatibilityVersion: OPENCODE_VERSION2, + allowInstall: input.allowInstall + }).then((result) => { + for (const diagnostic of result.diagnostics) { + logEvent("plugin.prepare.failed", { + configuration_fingerprint: input.configurationFingerprint, + plugin: diagnostic.spec, + stage: diagnostic.stage, + error_message: diagnostic.message + }, "error"); + } + logEvent("plugin.prepare.completed", { + configuration_fingerprint: input.configurationFingerprint, + configured_plugin_count: input.declarations.length, + prepared_plugin_count: result.prepared.length, + failed_plugin_count: result.diagnostics.length, + plugins: result.prepared.map((plugin) => plugin.spec), + duration_ms: Math.round(performance.now() - startedAt) + }); + return result; + }).catch((error45) => { + logError("plugin.prepare.failed", error45, { + configuration_fingerprint: input.configurationFingerprint, + plugin_count: input.declarations.length, + plugins: input.declarations.map(pluginDeclarationSpec), + duration_ms: Math.round(performance.now() - startedAt) + }); + throw error45; + }).finally(() => { + this.#preparations.delete(key); + }); + this.#preparations.set(key, operation); + return operation; + } + async callHook(input) { + const instance = this.#instance(input.instanceID); + assertGeneration(instance, input.generationKey, input.revision); + const hookInput = cloneWireValue(input.input, "input"); + const hookOutput = cloneWireValue(input.output, "output"); + const completed = Promise.withResolvers(); + instance.activeHooks.add(completed.promise); + try { + for (const retained of instance.hooks) { + const hook = Reflect.get(retained.hooks, input.name); + if (typeof hook !== "function") + continue; + try { + await Promise.resolve(hook(hookInput, hookOutput)); + } catch (error45) { + throw pluginError(retained.plugin, input.name, error45); + } + } + return { + instanceID: instance.id, + generationKey: instance.generationKey, + revision: instance.revision, + hook: input.name, + input: cloneWireValue(hookInput, "input"), + output: cloneWireValue(hookOutput, "output") + }; + } finally { + instance.activeHooks.delete(completed.promise); + completed.resolve(); + } + } + emitEvent(input) { + const instance = this.#instance(input.instanceID); + const event = cloneWireValue(input.event, "event"); + (async () => { + for (const retained of instance.hooks) { + if (!retained.hooks.event) + continue; + try { + await retained.hooks.event({ event }); + } catch (error45) { + await publishDiagnostic(this.#rpc, { + level: "error", + message: `Plugin ${retained.plugin.spec} event hook failed`, + instanceID: instance.id, + plugin: retained.plugin, + operation: "event", + error: errorData(error45) + }).catch(() => {}); + } + } + })(); + return { accepted: true }; + } + async executeTool(input) { + const instance = this.#instance(input.instanceID); + assertGeneration(instance, input.generationKey, input.revision); + const registration = findRegistration(instance.tools, input.registrationID); + if (!registration) + throw missingHandle("tool", input.registrationID); + if (instance.activeTools.has(input.executionID)) { + throw new ExtensionHostError(-32002, `Tool execution ${input.executionID} already exists`); + } + const controller = new AbortController; + const completed = Promise.withResolvers(); + const active = { + controller, + done: completed.promise, + stoppedAfterAbort: false + }; + instance.activeTools.set(input.executionID, active); + try { + const args = validateToolArguments(registration.definition.args, cloneWireValue(input.args, "args")); + const result = await registration.definition.execute(args, { + ...input.context, + directory: instance.directory, + worktree: instance.worktree, + abort: controller.signal, + metadata: (metadata) => { + const pending = this.#rpc.notify("backend.tool.metadata", { + instanceID: instance.id, + generationKey: instance.generationKey, + revision: instance.revision, + executionID: input.executionID, + ...cloneWireValue(metadata, "metadata") + }); + if (pending) + pending.catch(() => {}); + }, + ask: async (request) => { + await this.#rpc.request("backend.tool.ask", { + instanceID: instance.id, + generationKey: instance.generationKey, + revision: instance.revision, + executionID: input.executionID, + ...cloneWireValue(request, "request") + }, { signal: controller.signal }); + } + }); + return { + instanceID: instance.id, + generationKey: instance.generationKey, + revision: instance.revision, + executionID: input.executionID, + result: cloneWireValue(result, "result") + }; + } catch (error45) { + if (controller.signal.aborted) + active.stoppedAfterAbort = true; + throw pluginError(registration.plugin, `tool:${registration.id}`, error45); + } finally { + instance.activeTools.delete(input.executionID); + completed.resolve(); + } + } + async cancelTool(input) { + const instance = this.#instance(input.instanceID); + assertGeneration(instance, input.generationKey, input.revision); + const active = instance.activeTools.get(input.executionID); + if (!active) + return { cancelled: false }; + active.controller.abort(input.reason); + await active.done; + return { cancelled: active.stoppedAfterAbort }; + } + evaluateAuthPrompt(input) { + const registration = this.#auth(input.instanceID, input.provider); + const method = registration.hook.methods[input.methodIndex]; + const prompt = method?.prompts?.[input.promptIndex]; + if (!method || !prompt) { + throw missingHandle("auth prompt", `${input.provider}:${input.methodIndex}:${input.promptIndex}`); + } + if (input.operation === "validate") { + const error45 = prompt.type === "text" && prompt.validate ? prompt.validate(input.value ?? input.inputs[prompt.key] ?? "") : undefined; + return { operation: "validate", ...error45 ? { error: error45 } : {} }; + } + const active = prompt.when ? prompt.when.op === "eq" ? input.inputs[prompt.when.key] === prompt.when.value : input.inputs[prompt.when.key] !== prompt.when.value : prompt.condition ? prompt.condition(input.inputs) : true; + return { operation: "condition", active }; + } + async authorize(input) { + const instance = this.#instance(input.instanceID); + const registration = this.#auth(input.instanceID, input.provider); + const method = registration.hook.methods[input.methodIndex]; + if (!method) + throw missingHandle("auth method", `${input.provider}:${input.methodIndex}`); + if (method.type === "api") { + const result2 = method.authorize ? await method.authorize(input.inputs) : undefined; + return { type: "api", ...result2 === undefined ? {} : { result: cloneWireValue(result2, "result") } }; + } + const result = await method.authorize(input.inputs); + const flowID = handleID(instance, "flow"); + instance.flows.set(flowID, { + plugin: registration.plugin, + method: result.method, + callback: result.callback + }); + return { + type: "oauth", + flowID, + url: result.url, + instructions: result.instructions, + method: result.method + }; + } + async authCallback(input) { + const instance = this.#instance(input.instanceID); + const flow = instance.flows.get(input.flowID); + if (!flow) + throw missingHandle("auth flow", input.flowID); + if (flow.method === "code" && input.code === undefined) { + throw new ExtensionHostError(-32602, `Auth flow ${input.flowID} requires a code`); + } + try { + const result = await (flow.method === "code" ? flow.callback(input.code) : flow.callback()); + if (result && typeof result === "object" && Reflect.get(result, "type") === "success") { + instance.flows.delete(input.flowID); + } + return cloneWireValue(result, "result"); + } catch (error45) { + throw pluginError(flow.plugin, "auth.callback", error45); + } + } + cancelAuthFlow(input) { + return { cancelled: this.#instance(input.instanceID).flows.delete(input.flowID) }; + } + async loadAuth(input) { + const instance = this.#instance(input.instanceID); + const registration = this.#auth(input.instanceID, input.provider); + if (!registration.hook.loader) + return { value: {} }; + try { + const result = await registration.hook.loader(async () => { + const result2 = await this.#rpc.request("backend.auth.get", { + instanceID: instance.id, + providerID: input.provider + }); + if (!result2.auth) + throw new Error(`No auth is available for ${input.provider}`); + return result2.auth; + }, cloneWireValue(input.providerInfo, "providerInfo")); + if (!result || typeof result !== "object" || Array.isArray(result)) { + throw new TypeError("auth.loader must return an object"); + } + const options = { ...result }; + const candidate = Reflect.get(options, "fetch"); + if (candidate !== undefined && typeof candidate !== "function") { + throw new TypeError("auth.loader options.fetch must be a function"); + } + Reflect.deleteProperty(options, "fetch"); + const plain = cloneWireValue(options, "options"); + if (!candidate) + return { value: plain }; + const fetchID = handleID(instance, "fetch"); + instance.fetches.set(fetchID, { + plugin: registration.plugin, + provider: input.provider, + fetch: candidate + }); + return { value: plain, fetchID }; + } catch (error45) { + throw pluginError(registration.plugin, "auth.loader", error45); + } + } + async authFetch(input) { + const instance = this.#instance(input.instanceID); + const registration = instance.fetches.get(input.fetchID); + if (!registration) + throw missingHandle("auth fetch", input.fetchID); + if (instance.activeFetches.has(input.requestID)) { + throw new ExtensionHostError(-32002, `Auth fetch ${input.requestID} already exists`); + } + const controller = new AbortController; + const body = input.request.body ? this.#streams.remote("backend", instance.id, input.request.body) : undefined; + instance.activeFetches.set(input.requestID, { controller, body, descriptor: input.request.body }); + let returnedResponse = false; + try { + const init = { + method: input.request.method, + headers: input.request.headers, + body, + signal: controller.signal, + ...body ? { duplex: "half" } : {} + }; + const response = await registration.fetch(input.request.url, init); + if (!(response instanceof Response)) + throw new TypeError("auth loader fetch did not return a Response"); + returnedResponse = true; + return { + status: response.status, + statusText: response.statusText, + headers: Array.from(response.headers.entries()), + body: response.body ? this.#streams.register(instance.id, response.body, contentLength(response.headers)) : undefined + }; + } catch (error45) { + throw pluginError(registration.plugin, "auth.fetch", error45); + } finally { + instance.activeFetches.delete(input.requestID); + if (body && !body.locked) + await body.cancel("Auth fetch completed").catch(() => {}); + if (input.request.body && !returnedResponse) { + await this.#streams.cancelRemote?.(instance.id, input.request.body, "Auth fetch failed").catch(() => {}); + } + } + } + cancelAuthFetch(input) { + const active = this.#instance(input.instanceID).activeFetches.get(input.requestID); + if (!active) + return { cancelled: false }; + active.controller.abort(input.reason); + active.body?.cancel(input.reason).catch(() => {}); + if (active.descriptor) { + this.#streams.cancelRemote?.(input.instanceID, active.descriptor, input.reason).catch(() => {}); + } + return { cancelled: true }; + } + releaseAuthFetch(input) { + return { released: this.#instance(input.instanceID).fetches.delete(input.fetchID) }; + } + async providerModels(input) { + const instance = this.#instance(input.instanceID); + const registration = instance.providers.get(input.providerID); + if (!registration?.hook.models) + throw missingHandle("provider models", input.providerID); + try { + const result = await registration.hook.models(cloneWireValue(input.provider, "provider"), { + auth: input.auth === undefined ? undefined : cloneWireValue(input.auth, "auth") + }); + return { models: cloneWireValue(result, "models") }; + } catch (error45) { + throw pluginError(registration.plugin, "provider.models", error45); + } + } + async workspaceConfigure(input) { + const registration = this.#workspace(input.instanceID, input.registrationID); + return { + config: cloneWireValue(await registration.adapter.configure(cloneWireValue(input.config, "config")), "config") + }; + } + async workspaceCreate(input) { + const registration = this.#workspace(input.instanceID, input.registrationID); + await registration.adapter.create(cloneWireValue(input.config, "config"), Object.fromEntries(Object.entries(input.env).map(([key, value]) => [key, value ?? undefined])), input.from === undefined ? undefined : cloneWireValue(input.from, "from")); + return {}; + } + async workspaceRemove(input) { + const registration = this.#workspace(input.instanceID, input.registrationID); + await registration.adapter.remove(cloneWireValue(input.config, "config")); + return {}; + } + async workspaceTarget(input) { + const registration = this.#workspace(input.instanceID, input.registrationID); + return { + target: normalizeWorkspaceTarget(await registration.adapter.target(cloneWireValue(input.config, "config"))) + }; + } + #assertAccepting() { + if (this.#status === "running") + return; + throw new ExtensionHostError(-32004, "Extension host is shutting down", { kind: "host_shutting_down" }); + } + #assertOpening(instance) { + if (this.#status === "running" && instance.status === "opening") + return; + throw new ExtensionHostError(-32004, `Instance ${instance.id} is closing`, { + kind: "instance_closing", + instanceID: instance.id + }); + } + #beginClose(instance) { + if (instance.closePromise) + return instance.closePromise; + instance.status = "closing"; + instance.closePromise = (async () => { + await instance.openDone; + await this.#disposeInstance(instance); + })(); + return instance.closePromise; + } + async#disposeInstance(instance) { + let lifecycleTimeout; + const activeHookDrains = [...instance.activeHooks]; + const activeToolDrains = [...instance.activeTools.values()].map((active) => { + active.controller.abort("Instance closed"); + return active.done; + }); + for (const active of instance.activeFetches.values()) { + active.controller.abort("Instance closed"); + active.body?.cancel("Instance closed").catch(() => {}); + if (active.descriptor) { + this.#streams.cancelRemote?.(instance.id, active.descriptor, "Instance closed").catch(() => {}); + } + } + try { + await promiseWithDeadline(Promise.allSettled(activeHookDrains).then(() => { + return; + }), 2000, "Plugin hook drain timed out"); + } catch (error45) { + lifecycleTimeout = error45; + this.#status = "closing"; + await publishDiagnostic(this.#rpc, { + level: "error", + message: `Instance ${instance.id} active hook drain failed`, + instanceID: instance.id, + operation: "dispose", + error: errorData(error45) + }).catch(() => {}); + } + try { + await promiseWithDeadline(Promise.allSettled(activeToolDrains).then(() => { + return; + }), 2000, "Plugin tool drain timed out"); + } catch (error45) { + lifecycleTimeout = error45; + this.#status = "closing"; + await publishDiagnostic(this.#rpc, { + level: "error", + message: `Instance ${instance.id} active tool drain failed`, + instanceID: instance.id, + operation: "dispose", + error: errorData(error45) + }).catch(() => {}); + } + instance.activeHooks.clear(); + instance.activeTools.clear(); + instance.activeFetches.clear(); + try { + await this.#streams.cancelAll(instance.id); + } catch (error45) { + await publishDiagnostic(this.#rpc, { + level: "error", + message: `Instance ${instance.id} stream cleanup failed`, + instanceID: instance.id, + operation: "dispose", + error: errorData(error45) + }).catch(() => {}); + } finally { + await instance.gateway.close().catch(() => {}); + instance.flows.clear(); + instance.fetches.clear(); + for (const retained of instance.hooks) { + if (instance.disposed.has(retained)) + continue; + instance.disposed.add(retained); + if (!retained.hooks.dispose) + continue; + try { + await promiseWithDeadline(Promise.resolve(retained.hooks.dispose()), 2000, "Plugin dispose timed out"); + } catch (error45) { + if (error45 instanceof Error && error45.message === "Plugin dispose timed out") { + lifecycleTimeout ??= error45; + this.#status = "closing"; + } + await publishDiagnostic(this.#rpc, { + level: "error", + message: `Plugin ${retained.plugin.spec} dispose hook failed`, + instanceID: instance.id, + plugin: retained.plugin, + operation: "dispose", + error: errorData(error45) + }).catch(() => {}); + } + } + if (this.#instances.get(instance.id) === instance) + this.#instances.delete(instance.id); + if (this.#directories.get(instance.canonicalDirectory) === instance.id) { + this.#directories.delete(instance.canonicalDirectory); + } + } + if (lifecycleTimeout) + throw lifecycleTimeout; + } + #instance(instanceID) { + const instance = this.#instances.get(instanceID); + if (!instance || instance.status !== "open") + throw missingHandle("instance", instanceID); + return instance; + } + #auth(instanceID, provider) { + const registration = this.#instance(instanceID).auth.get(provider); + if (!registration) + throw missingHandle("auth provider", provider); + return registration; + } + #workspace(instanceID, registrationID) { + const registration = findRegistration(this.#instance(instanceID).workspaces, registrationID); + if (!registration) + throw missingHandle("workspace", registrationID); + return registration; + } + async#startPlugin(instance, loaded, project, client3, diagnostics) { + for (const entrypoint of loaded.entrypoints) { + this.#assertOpening(instance); + const plugin = { + ...entrypoint.id ? { id: entrypoint.id } : {}, + spec: loaded.spec, + entry: loaded.entry, + index: entrypoint.index + }; + const workspaces = new Map; + const pluginInput = { + client: client3, + project: cloneWireValue(project, "project"), + directory: instance.directory, + worktree: instance.worktree, + serverUrl: instance.gateway.url, + $: this.#shell, + experimental_workspace: { + register: (type, adapter) => { + workspaces.set(type, { + registrationID: handleID(instance, "workspace"), + plugin, + type, + adapter + }); + } + } + }; + try { + const hooks = await entrypoint.server(pluginInput, loaded.options); + if (!hooks || typeof hooks !== "object" || Array.isArray(hooks)) { + throw new TypeError("Plugin entrypoint did not return a Hooks object"); + } + instance.hooks.push({ plugin, hooks }); + logEvent("plugin.activation.completed", { + instance_id: instance.id, + plugin: plugin.spec, + plugin_id: plugin.id, + entrypoint_index: plugin.index + }); + this.#assertOpening(instance); + for (const [type, registration] of workspaces) + instance.workspaces.set(type, registration); + } catch (error45) { + if (instance.status === "closing" || this.#status !== "running") + throw error45; + const diagnostic = runtimeDiagnostic(plugin, "entrypoint", error45); + diagnostics.push(diagnostic); + await publishDiagnostic(this.#rpc, toPublishedDiagnostic(instance.id, diagnostic)).catch(() => {}); + } + } + } + #indexRegistrations(instance, diagnostics) { + for (const retained of instance.hooks) { + for (const [id, definition] of Object.entries(retained.hooks.tool ?? {})) { + try { + instance.tools.set(id, { + registrationID: handleID(instance, "tool"), + plugin: retained.plugin, + id, + definition, + parameters: cloneWireValue(toolParametersToJsonSchema(definition.args), `tool.${id}.parameters`) + }); + } catch (error45) { + diagnostics.push(runtimeDiagnostic(retained.plugin, `tool:${id}`, error45)); + } + } + if (retained.hooks.auth) { + instance.auth.set(retained.hooks.auth.provider, { plugin: retained.plugin, hook: retained.hooks.auth }); + } + if (retained.hooks.provider) { + instance.providers.set(retained.hooks.provider.id, { plugin: retained.plugin, hook: retained.hooks.provider }); + } + } + } +} +async function promiseWithDeadline(promise2, timeoutMs, message) { + let timer; + try { + return await Promise.race([ + promise2, + new Promise((_, reject) => { + timer = setTimeout(() => reject(new Error(message)), timeoutMs); + }) + ]); + } finally { + if (timer !== undefined) + clearTimeout(timer); + } +} +function openResult(instance, config2, diagnostics, configContributions) { + return { + instanceID: instance.id, + generationKey: instance.generationKey, + revision: instance.revision, + config: cloneWireValue(config2, "config"), + configContributors: configContributions.map(({ plugin, outcome }) => ({ plugin, outcome })), + configContributions, + diagnostics: diagnostics.map(protocolDiagnostic), + gatewayURL: instance.gateway.url.toString(), + hooks: GENERIC_HOOKS.filter((name) => instance.hooks.some((retained) => typeof retained.hooks[name] === "function")), + tools: Array.from(instance.tools.values(), ({ registrationID, id, plugin, definition, parameters }) => ({ + registrationID, + id, + plugin, + description: definition.description, + parameters + })), + auth: Array.from(instance.auth.entries(), ([provider, registration]) => authDescriptor(provider, registration)), + providers: Array.from(instance.providers.entries(), ([provider, registration]) => ({ + provider, + plugin: registration.plugin, + hasModels: typeof registration.hook.models === "function" + })), + workspaces: Array.from(instance.workspaces.values(), ({ registrationID, type, plugin, adapter }) => ({ + registrationID, + type, + plugin, + name: adapter.name, + description: adapter.description + })) + }; +} +function assertGeneration(instance, generationKey, revision) { + if (instance.generationKey === generationKey && instance.revision === revision) + return; + throw new ExtensionHostError(-32002, `Generation lease does not match instance ${instance.id}`, { + kind: "generation_mismatch", + instanceID: instance.id + }); +} +function authDescriptor(provider, registration) { + return { + provider, + plugin: registration.plugin, + hasLoader: typeof registration.hook.loader === "function", + methods: registration.hook.methods.map((method, methodIndex) => ({ + type: method.type, + label: method.label, + methodIndex, + hasAuthorize: typeof method.authorize === "function", + prompts: method.prompts?.map((prompt, promptIndex) => ({ + type: prompt.type, + key: prompt.key, + message: prompt.message, + promptIndex, + placeholder: prompt.type === "text" ? prompt.placeholder : undefined, + options: prompt.type === "select" ? prompt.options : undefined, + when: prompt.when, + hasValidate: prompt.type === "text" && typeof prompt.validate === "function", + hasCondition: typeof prompt.condition === "function" + })) ?? [] + })) + }; +} +function normalizeWorkspaceTarget(target) { + if (target.type === "local") + return { type: "local", directory: target.directory }; + return { + type: "remote", + url: target.url.toString(), + headers: target.headers ? Array.from(new Headers(target.headers).entries()) : undefined + }; +} +function handleID(instance, type) { + instance.counter += 1; + return `${instance.id}:${type}:${instance.counter}`; +} +function pluginDeclarationSpec(declaration) { + if (typeof declaration === "string") + return declaration; + if (Array.isArray(declaration)) + return declaration[0]; + return declaration.spec; +} +function preparationKey(input) { + const needsDefaultBaseDirectory = input.declarations.some(({ baseDirectory }) => !baseDirectory); + return JSON.stringify({ + configurationFingerprint: input.configurationFingerprint, + allowInstall: input.allowInstall ?? true, + declarations: input.declarations, + ...needsDefaultBaseDirectory ? { defaultBaseDirectory: input.defaultBaseDirectory } : {} + }); +} +function preparationReviewDigest(input) { + const material = { + ...input.configurationFingerprint ? { configurationFingerprint: input.configurationFingerprint } : {}, + reviewed: input.reviewed.map((plugin) => ({ + spec: plugin.spec, + source: plugin.source, + identity: plugin.identity, + canonicalSource: plugin.canonicalSource, + baseDirectory: plugin.baseDirectory, + optionsDigest: plugin.optionsDigest + })), + prepared: input.prepared.map((plugin) => ({ + spec: plugin.spec, + identity: plugin.identity, + source: plugin.source, + target: plugin.target, + entry: plugin.entry, + ...plugin.contentHash ? { contentHash: plugin.contentHash } : {}, + ...plugin.version ? { version: plugin.version } : {} + })), + failed: input.failed.map((failure) => ({ spec: failure.spec, stage: failure.stage })) + }; + return createHash2("sha256").update(JSON.stringify(material)).digest("hex"); +} +function findRegistration(map2, registrationID) { + return Array.from(map2.values()).find((registration) => registration.registrationID === registrationID); +} +function missingHandle(type, id) { + return new ExtensionHostError(-32002, `Unknown ${type} ${id}`, { kind: "missing_handle", type, id }); +} +function pluginError(plugin, operation, error45) { + return new ExtensionHostError(-32003, `Plugin ${plugin.spec} failed during ${operation}: ${errorMessage(error45)}`, { + kind: "plugin_error", + plugin, + operation, + error: errorData(error45) + }); +} +function runtimeDiagnostic(plugin, operation, error45) { + return { + level: "error", + stage: "runtime", + spec: plugin.spec, + pluginID: plugin.id, + message: `Plugin ${plugin.spec} failed during ${operation}: ${errorMessage(error45)}`, + error: errorData(error45) + }; +} +function toPublishedDiagnostic(instanceID, diagnostic) { + return { + level: diagnostic.level, + message: diagnostic.message, + instanceID, + plugin: { id: "pluginID" in diagnostic ? diagnostic.pluginID : undefined, spec: diagnostic.spec }, + operation: diagnostic.stage, + error: diagnostic.error + }; +} +function protocolDiagnostic(diagnostic) { + const pluginID = "pluginID" in diagnostic ? diagnostic.pluginID : undefined; + return { + severity: "error", + code: diagnostic.stage, + message: diagnostic.message, + ...pluginID ? { plugin: pluginID } : {}, + method: diagnostic.stage, + data: { + spec: diagnostic.spec, + ...diagnostic.error ? { error: serializableDiagnosticError(diagnostic.error) } : {}, + ...diagnostic.stage === "runtime" ? {} : { declarationIndex: diagnostic.declarationIndex } + } + }; +} +function serializableDiagnosticError(error45) { + return { + ...error45.name ? { name: error45.name } : {}, + message: error45.message, + ...error45.stack ? { stack: error45.stack } : {}, + ...error45.cause === undefined ? {} : { cause: String(error45.cause) } + }; +} +function errorMessage(error45) { + return error45 instanceof Error ? error45.message : String(error45); +} +function contentLength(headers) { + const value = Number(headers.get("content-length")); + return Number.isSafeInteger(value) && value >= 0 ? value : undefined; +} + +// src/gateway.ts +function createGateway(input) { + const active = new Set; + const server2 = Bun.serve({ + hostname: "127.0.0.1", + port: 0, + async fetch(request) { + if (request.headers.get("upgrade")) { + return Response.json({ error: "WebSocket forwarding is not supported by this extension host" }, { status: 426, headers: { upgrade: "close" } }); + } + const length = request.headers.get("content-length"); + const body = request.body ? input.streams.register(input.instanceID, request.body, length && Number.isSafeInteger(Number(length)) ? Number(length) : undefined) : undefined; + if (body) + active.add(body); + try { + const url2 = new URL(request.url); + const result = await input.rpc.request("backend.http.request", { + instanceID: input.instanceID, + requestID: crypto.randomUUID(), + method: request.method, + path: `${url2.pathname}${url2.search}`, + headers: Array.from(request.headers.entries()), + body + }, { signal: request.signal }); + validateResponse(result); + const headers = new Headers(result.headers); + if (!result.body) { + return new Response(null, { status: result.status, statusText: result.statusText, headers }); + } + const stream = input.streams.remote("backend", input.instanceID, result.body); + return new Response(stream, { status: result.status, statusText: result.statusText, headers }); + } catch (error45) { + if (body) + await input.streams.cancel(input.instanceID, body).catch(() => {}); + await publishDiagnostic(input.rpc, { + level: "error", + message: "Failed to forward plugin HTTP request", + instanceID: input.instanceID, + operation: "backend.http.request", + error: errorInfo2(error45) + }).catch(() => {}); + return Response.json({ error: "Extension backend request failed" }, { status: 502 }); + } finally { + if (body) + active.delete(body); + } + } + }); + return { + url: server2.url, + async close() { + await Promise.all(Array.from(active, (descriptor) => input.streams.cancel(input.instanceID, descriptor).catch(() => {}))); + active.clear(); + await server2.stop(true); + } + }; +} +function validateResponse(value) { + if (!value || typeof value !== "object") + throw new TypeError("backend.http.request returned a non-object"); + if (!Number.isInteger(value.status) || value.status < 100 || value.status > 599) { + throw new TypeError("backend.http.request returned an invalid status"); + } + if (!value.body) + return; + if (typeof value.body.streamID !== "string" || !value.body.streamID) { + throw new TypeError("backend.http.request returned an invalid body stream"); + } +} +function errorInfo2(error45) { + if (!(error45 instanceof Error)) + return { message: String(error45) }; + return { + name: error45.name, + message: error45.message, + stack: error45.stack, + cause: error45.cause + }; +} + +// src/bun-loader.ts +import { mkdir, realpath as realpath3, stat as stat2 } from "fs/promises"; +import path3 from "path"; +var installs = new Map; +function prepareBunPlugins(input) { + return preparePlugins({ ...input, install: installNpmPlugin }); +} +function installNpmPlugin(input) { + const directory = path3.join(path3.resolve(input.cacheDirectory), "plugins", `${packageSlug(input.packageName ?? "plugin")}-${Bun.hash(input.spec).toString(16)}`); + const pending = installs.get(directory); + if (pending) + return pending; + if (input.allowInstall === false) + return reviewCachedNpmPlugin(input, directory); + const operation = installNpmPluginAt(input, directory).finally(() => installs.delete(directory)); + installs.set(directory, operation); + return operation; +} +async function reviewCachedNpmPlugin(input, directory) { + const existing = await installedPackage(directory, input.packageName); + if (existing) { + logEvent("plugin.prepare.cache_hit", { plugin: input.spec, target: existing }, "debug"); + return { target: existing, cache: "hit" }; + } + throw new Error(`Plugin ${input.spec} is not cached; activation review requires installation approval`); +} +async function installNpmPluginAt(input, directory) { + await mkdir(directory, { recursive: true }); + const manifestPath = path3.join(directory, "package.json"); + if (!await Bun.file(manifestPath).exists()) { + await Bun.write(manifestPath, `${JSON.stringify({ private: true }, null, 2)} +`); + } + const existing = await installedPackage(directory, input.packageName); + if (existing) { + logEvent("plugin.prepare.cache_hit", { plugin: input.spec, target: existing }, "debug"); + return { target: existing, cache: "hit" }; + } + const startedAt = performance.now(); + logEvent("plugin.prepare.install.begin", { plugin: input.spec, cache_directory: directory }); + const child = Bun.spawn({ + cmd: [process.execPath, ...bunAddArguments(input.spec)], + cwd: directory, + stdin: "ignore", + stdout: "pipe", + stderr: "pipe" + }); + const [code, stdout, stderr] = await Promise.all([child.exited, new Response(child.stdout).text(), new Response(child.stderr).text()]); + if (code !== 0) + throw new Error(`Failed to install plugin ${input.spec}: ${stderr.trim() || stdout.trim() || `bun add exited with status ${code}`}`); + const installed = await installedPackage(directory, input.packageName); + if (installed) { + logEvent("plugin.prepare.install.completed", { + plugin: input.spec, + target: installed, + cache_directory: directory, + duration_ms: Math.round(performance.now() - startedAt) + }); + return { target: installed, cache: "installed" }; + } + throw new Error(`Plugin ${input.spec} was installed but its package directory could not be found`); +} +function bunAddArguments(spec) { + return ["add", "--ignore-scripts", "--exact", "--", spec]; +} +async function installedPackage(directory, preferred) { + const manifestPath = path3.join(directory, "package.json"); + if (!await Bun.file(manifestPath).exists()) + return; + const manifest = await Bun.file(manifestPath).json(); + const dependencies = isRecord3(manifest.dependencies) ? Object.keys(manifest.dependencies) : []; + const name = preferred && dependencies.includes(preferred) ? preferred : dependencies.length === 1 ? dependencies[0] : undefined; + if (!name) + return; + const target = path3.join(directory, "node_modules", name); + const metadata = await stat2(target).catch(() => { + return; + }); + return metadata?.isDirectory() ? realpath3(target) : undefined; +} +function packageSlug(name) { + const slug = name.replaceAll(/[^A-Za-z0-9._-]/g, "-").replaceAll(/^-+|-+$/g, ""); + return slug || "plugin"; +} +function isRecord3(value) { + return typeof value === "object" && value !== null && !Array.isArray(value); +} + +// src/rpc.ts +class RpcError extends Error { + code; + data; + constructor(code, message, data) { + super(message); + this.name = "RpcError"; + this.code = code; + this.data = data; + } +} + +class RpcConnectionClosedError extends Error { + constructor(message = "JSON-RPC connection is closed", options) { + super(message, options); + this.name = "RpcConnectionClosedError"; + } +} + +class RpcProtocolError extends RpcError { + constructor(code, message, data) { + super(code, message, data); + this.name = "RpcProtocolError"; + } +} + +class RpcPeer { + closed; + #transport; + #idPrefix; + #handlers = new Map; + #pending = new Map; + #onEof; + #onError; + #onRequest; + #resolveClosed; + #buffer = new Uint8Array; + #sequence = 0; + #ended = false; + #closeError; + #maxFrameBytes; + #writeTail = Promise.resolve(); + constructor(transport, options) { + if (!options.idPrefix) + throw new TypeError("JSON-RPC ID prefix must not be empty"); + this.#transport = transport; + this.#idPrefix = options.idPrefix; + this.#maxFrameBytes = validateMaxFrameBytes(options.maxFrameBytes ?? DEFAULT_MAX_FRAME_BYTES); + this.#onEof = options.onEof; + this.#onError = options.onError; + this.#onRequest = options.onRequest; + const deferred = Promise.withResolvers(); + this.closed = deferred.promise; + this.#resolveClosed = deferred.resolve; + } + get maxFrameBytes() { + return this.#maxFrameBytes; + } + get closeError() { + return this.#closeError; + } + setMaxFrameBytes(value) { + this.#maxFrameBytes = validateMaxFrameBytes(value); + } + handle(method, handler) { + if (!method) + throw new TypeError("JSON-RPC method must not be empty"); + if (this.#handlers.has(method)) + throw new Error(`JSON-RPC handler already registered for ${method}`); + this.#handlers.set(method, handler); + return () => { + if (this.#handlers.get(method) === handler) + this.#handlers.delete(method); + }; + } + async request(method, params = {}, options = {}) { + this.#assertOpen(); + if (options.signal?.aborted) + throw abortError(options.signal.reason); + const id = `${this.#idPrefix}:${++this.#sequence}`; + const deferred = Promise.withResolvers(); + const abort = () => { + this.#pending.delete(id); + deferred.reject(abortError(options.signal?.reason)); + }; + const cleanup = () => options.signal?.removeEventListener("abort", abort); + this.#pending.set(id, { + resolve: deferred.resolve, + reject: deferred.reject, + cleanup, + ...options.onResult ? { onResult: options.onResult } : {} + }); + options.signal?.addEventListener("abort", abort, { once: true }); + try { + await this.#send({ jsonrpc: "2.0", id, method, params }); + } catch (error45) { + const pending = this.#pending.get(id); + if (pending) { + this.#pending.delete(id); + pending.cleanup(); + pending.reject(asError(error45)); + } + } + return await deferred.promise; + } + notify(method, params = {}) { + this.#assertOpen(); + return this.#send({ jsonrpc: "2.0", method, params }); + } + receive(data) { + if (this.#ended || data.byteLength === 0) + return; + this.#buffer = concatBytes(this.#buffer, data); + while (this.#buffer.byteLength >= 4) { + const length = new DataView(this.#buffer.buffer, this.#buffer.byteOffset, 4).getUint32(0, false); + if (length === 0) { + this.#fail(new RpcProtocolError(-32600, "JSON-RPC frame must not be empty")); + return; + } + if (length > this.#maxFrameBytes) { + this.#fail(new RpcProtocolError(-32600, `JSON-RPC frame length ${length} exceeds limit ${this.#maxFrameBytes}`, { + length, + maxFrameBytes: this.#maxFrameBytes + })); + return; + } + if (this.#buffer.byteLength < length + 4) + return; + const payload = this.#buffer.slice(4, length + 4); + this.#buffer = this.#buffer.slice(length + 4); + this.#receivePayload(payload); + if (this.#ended) + return; + } + } + end(error45) { + this.#finish(error45); + } + close(error45) { + if (this.#ended) + return; + try { + this.#transport.end?.(); + } catch (cause) { + error45 ??= asError(cause); + } + this.#finish(error45); + } + async flushAndClose(error45) { + await this.#writeTail; + this.close(error45); + } + #receivePayload(payload) { + let value; + try { + value = JSON.parse(new TextDecoder().decode(payload)); + } catch (error45) { + this.#fail(new RpcProtocolError(-32700, "Invalid JSON-RPC JSON payload", errorDetails(error45))); + return; + } + const parsed = RpcMessageSchema.safeParse(value); + if (!parsed.success) { + const id = responseID(value); + if (!id) { + this.#fail(new RpcProtocolError(-32600, "Invalid JSON-RPC message", { issues: parsed.error.issues })); + return; + } + this.#sendError(id, { + code: -32600, + message: "Invalid JSON-RPC message", + data: safeErrorData({ issues: parsed.error.issues }) + }); + return; + } + const message = parsed.data; + logEvent("rpc.receive", { ...rpcMessageSummary(message), frame_bytes: payload.byteLength }, "debug"); + if ("method" in message) { + this.#dispatch(message.method, message.params, "id" in message ? message.id : undefined); + return; + } + const pending = this.#pending.get(message.id); + if (!pending) + return; + this.#pending.delete(message.id); + pending.cleanup(); + if ("error" in message) { + pending.reject(new RpcError(message.error.code, message.error.message, message.error.data)); + return; + } + try { + pending.onResult?.(message.result); + } catch (error45) { + pending.reject(asError(error45)); + return; + } + pending.resolve(message.result); + } + async#dispatch(method, params, id) { + try { + this.#onRequest?.(method); + } catch (error45) { + if (id) + await this.#sendError(id, rpcErrorObject(error45)); + else + this.#reportError(asError(error45)); + return; + } + const handler = this.#handlers.get(method); + if (!handler) { + if (id) + await this.#sendError(id, { code: -32601, message: `Method not found: ${method}` }); + return; + } + let result; + try { + result = await handler(params); + } catch (error45) { + if (id) { + await this.#sendError(id, rpcErrorObject(error45)); + return; + } + this.#reportError(asError(error45)); + return; + } + if (!id) + return; + try { + await this.#send({ jsonrpc: "2.0", id, result: result === undefined ? null : result }); + } catch (error45) { + if (error45 instanceof RangeError) { + await this.#sendError(id, { + code: -32000, + message: "JSON-RPC response exceeds the negotiated frame limit", + data: { kind: "response_too_large", maxFrameBytes: this.#maxFrameBytes } + }); + } else if (!this.#ended) { + this.#fail(asError(error45)); + } + } + } + async#sendError(id, error45) { + try { + await this.#send({ jsonrpc: "2.0", id, error: error45 }); + } catch (cause) { + this.#reportError(asError(cause)); + } + } + async#send(message) { + this.#assertOpen(); + const frame = encodeFrame(message, this.#maxFrameBytes); + logEvent("rpc.send", { ...rpcMessageSummary(message), frame_bytes: frame.byteLength - 4 }, "debug"); + const write = this.#writeTail.then(async () => { + this.#assertOpen(); + const written = await this.#transport.write(frame); + if (typeof written === "number" && written < frame.byteLength) { + throw new Error(`JSON-RPC transport accepted ${written} of ${frame.byteLength} bytes`); + } + }); + this.#writeTail = write.catch(() => {}); + try { + await write; + } catch (error45) { + this.#fail(asError(error45)); + throw error45; + } + } + #assertOpen() { + if (this.#ended) + throw new RpcConnectionClosedError(undefined, { cause: this.#closeError }); + } + #fail(error45) { + if (this.#ended) + return; + this.#finish(error45); + try { + if (this.#transport.terminate) + this.#transport.terminate(); + if (!this.#transport.terminate) + this.#transport.end?.(); + } catch {} + this.#reportError(error45); + } + #finish(error45) { + if (this.#ended) + return; + this.#ended = true; + this.#closeError = error45; + this.#buffer = new Uint8Array; + const reason = new RpcConnectionClosedError(undefined, { cause: error45 }); + for (const pending of this.#pending.values()) { + pending.cleanup(); + pending.reject(reason); + } + this.#pending.clear(); + this.#resolveClosed(); + if (this.#onEof) + Promise.resolve(this.#onEof(error45)).catch((cause) => this.#reportError(asError(cause))); + } + #reportError(error45) { + if (this.#onError) { + this.#onError(error45); + return; + } + logError("rpc.failure", error45); + } +} +function encodeFrame(message, maxFrameBytes = DEFAULT_MAX_FRAME_BYTES) { + const limit = validateMaxFrameBytes(maxFrameBytes); + const text = JSON.stringify(message, (_key, value) => { + if (typeof value === "bigint") + throw new TypeError("JSON-RPC values cannot contain BigInt"); + if (typeof value === "function" || typeof value === "symbol") { + throw new TypeError(`JSON-RPC values cannot contain ${typeof value}`); + } + if (typeof value === "number" && !Number.isFinite(value)) { + throw new TypeError("JSON-RPC values cannot contain non-finite numbers"); + } + return value; + }); + if (text === undefined) + throw new TypeError("JSON-RPC message is not serializable"); + const payload = new TextEncoder().encode(text); + if (payload.byteLength === 0 || payload.byteLength > limit) { + throw new RangeError(`JSON-RPC payload length ${payload.byteLength} exceeds limit ${limit}`); + } + const frame = new Uint8Array(payload.byteLength + 4); + new DataView(frame.buffer).setUint32(0, payload.byteLength, false); + frame.set(payload, 4); + return frame; +} +async function connectRpcPeer(address, options = {}) { + const target = parseRpcAddress(address); + let socket; + let drain; + const peer = new RpcPeer({ + async write(data) { + let offset = 0; + while (offset < data.byteLength) { + const written = socket.write(data, offset, data.byteLength - offset); + if (written < 0) + throw new RpcConnectionClosedError("JSON-RPC socket closed while writing"); + offset += written; + if (offset === data.byteLength) + return offset; + drain ??= Promise.withResolvers(); + await drain.promise; + } + return offset; + }, + end: () => socket.end(), + terminate: () => socket.terminate() + }, { ...options, idPrefix: options.idPrefix ?? "host" }); + socket = await Bun.connect({ + hostname: target.hostname, + port: target.port, + socket: { + data(_socket, data) { + peer.receive(data); + }, + drain() { + drain?.resolve(); + drain = undefined; + }, + close() { + drain?.reject(new RpcConnectionClosedError); + drain = undefined; + peer.end(); + }, + error(_socket, error45) { + drain?.reject(error45); + drain = undefined; + peer.end(error45); + } + } + }); + return peer; +} +function parseRpcAddress(address) { + const url2 = new URL(address.includes("://") ? address : `tcp://${address}`); + if (url2.protocol !== "tcp:") + throw new TypeError(`Unsupported RPC address protocol: ${url2.protocol}`); + if (!url2.hostname || !url2.port) + throw new TypeError(`RPC address must include a host and port: ${address}`); + const port = Number(url2.port); + if (!Number.isInteger(port) || port < 1 || port > 65535) + throw new TypeError(`Invalid RPC port: ${url2.port}`); + return { hostname: url2.hostname, port }; +} +function validateMaxFrameBytes(value) { + if (!Number.isInteger(value) || value < 1 || value > MAX_MAX_FRAME_BYTES) { + throw new RangeError(`maxFrameBytes must be an integer between 1 and ${MAX_MAX_FRAME_BYTES}`); + } + return value; +} +function rpcErrorObject(error45) { + if (hasNumericCode(error45)) { + return { + code: error45.code, + message: error45 instanceof Error ? error45.message : String(Reflect.get(error45, "message") ?? "JSON-RPC error"), + ...error45.data === undefined ? {} : { data: safeErrorData(error45.data) } + }; + } + const value = asError(error45); + return { + code: -32603, + message: value.message || "Internal error", + data: { + name: value.name, + message: value.message, + ...value.stack ? { stack: value.stack } : {} + } + }; +} +function hasNumericCode(value) { + return typeof value === "object" && value !== null && typeof Reflect.get(value, "code") === "number" && Number.isInteger(Reflect.get(value, "code")); +} +function safeErrorData(value) { + const parsed = JsonValueSchema.safeParse(value); + if (parsed.success) + return parsed.data; + return { kind: "invalid_error_data", message: "Thrown JSON-RPC error data was not JSON-compatible" }; +} +function responseID(value) { + if (typeof value !== "object" || value === null) + return; + const id = Reflect.get(value, "id"); + return typeof id === "string" && id ? id : undefined; +} +function errorDetails(error45) { + const value = asError(error45); + return { name: value.name, message: value.message }; +} +function abortError(reason) { + if (reason instanceof Error) + return reason; + return new DOMException(typeof reason === "string" ? reason : "The operation was aborted", "AbortError"); +} +function asError(error45) { + return error45 instanceof Error ? error45 : new Error(String(error45)); +} +function concatBytes(left, right) { + if (left.byteLength === 0) + return right.slice(); + const result = new Uint8Array(left.byteLength + right.byteLength); + result.set(left); + result.set(right, left.byteLength); + return result; +} + +// src/service.ts +function registerHostMethods(input) { + const host = () => Promise.resolve(input.host); + const register = (method, handler) => { + input.peer.handle(method, async (params) => { + const parsed = HostMethodSchemas[method].params.safeParse(params); + if (!parsed.success) { + throw new ExtensionHostError(-32602, `Invalid parameters for ${method}`, { + kind: "invalid_params", + method, + issues: parsed.error.issues + }); + } + return HostMethodSchemas[method].result.parse(await handler(parsed.data)); + }); + }; + register("host.plugins.prepare", async (params) => (await host()).prepare(params)); + register("host.instance.open", async (params) => (await host()).open(params)); + register("host.instance.close", async (params) => (await host()).close(params)); + register("host.log.setLevel", (params) => { + const value = HostMethodSchemas["host.log.setLevel"].params.parse(params); + return { level: setLogLevel(value.level) }; + }); + register("host.hook.call", async (params) => (await host()).callHook((() => { + const value = params; + return { ...value, name: value.hook }; + })())); + register("host.event.emit", async (params) => (await host()).emitEvent(params)); + register("host.tool.execute", async (params) => (await host()).executeTool(params)); + register("host.tool.cancel", async (params) => (await host()).cancelTool(params)); + register("host.auth.prompt.evaluate", async (params) => (await host()).evaluateAuthPrompt(params)); + register("host.auth.authorize", async (params) => (await host()).authorize(params)); + register("host.auth.callback", async (params) => (await host()).authCallback(params)); + register("host.auth.flow.cancel", async (params) => (await host()).cancelAuthFlow(params)); + register("host.auth.loader", async (params) => (await host()).loadAuth(params)); + register("host.auth.fetch", async (params) => (await host()).authFetch(params)); + register("host.auth.fetch.cancel", async (params) => (await host()).cancelAuthFetch(params)); + register("host.auth.fetch.release", async (params) => (await host()).releaseAuthFetch(params)); + register("host.provider.models", async (params) => (await host()).providerModels(params)); + register("host.workspace.configure", async (params) => (await host()).workspaceConfigure(params)); + register("host.workspace.create", async (params) => (await host()).workspaceCreate(params)); + register("host.workspace.remove", async (params) => (await host()).workspaceRemove(params)); + register("host.workspace.target", async (params) => (await host()).workspaceTarget(params)); + register("host.shutdown", async () => { + logEvent("shutdown.requested"); + const result = await (await host()).shutdown(); + logEvent("shutdown.instances_closed"); + setTimeout(() => input.shutdown(), 0); + return result; + }); +} + +// src/streams.ts +class StreamRegistry { + #prefix; + #streams = new Map; + #sequence = 0; + constructor(prefix = "host") { + if (!prefix) + throw new TypeError("Stream ID prefix must not be empty"); + this.#prefix = prefix; + } + get size() { + return this.#streams.size; + } + add(stream, length) { + if (length !== undefined && (!Number.isSafeInteger(length) || length < 0)) { + throw new RangeError("Stream length must be a non-negative safe integer"); + } + const streamID = `${this.#prefix}-stream:${++this.#sequence}`; + this.#streams.set(streamID, { reader: stream.getReader(), tail: Promise.resolve(), done: false, released: false }); + return { streamID, ...length === undefined ? {} : { length } }; + } + register(stream, length) { + return this.add(stream, length); + } + async read(input) { + const maxBytes = input.maxBytes ?? MAX_STREAM_CHUNK_BYTES; + if (!Number.isInteger(maxBytes) || maxBytes < 1 || maxBytes > MAX_STREAM_CHUNK_BYTES) { + throw new RangeError(`maxBytes must be an integer between 1 and ${MAX_STREAM_CHUNK_BYTES}`); + } + const entry = this.#streams.get(input.streamID); + if (!entry) + return { data: "", eof: true }; + return this.#serialized(entry, async () => { + if (entry.done) + return { data: "", eof: true }; + if (entry.remainder?.byteLength) + return this.#take(entry, maxBytes); + while (true) { + let result; + try { + result = await entry.reader.read(); + } catch (error45) { + entry.done = true; + this.#streams.delete(input.streamID); + throw error45; + } + if (result.done) { + entry.done = true; + this.#streams.delete(input.streamID); + this.#release(entry); + return { data: "", eof: true }; + } + if (!result.value || result.value.byteLength === 0) + continue; + entry.remainder = result.value; + return this.#take(entry, maxBytes); + } + }); + } + async cancel(input) { + const entry = this.#streams.get(input.streamID); + if (!entry) + return { cancelled: false }; + this.#streams.delete(input.streamID); + if (entry.done) + return { cancelled: false }; + entry.done = true; + entry.remainder = undefined; + try { + await entry.reader.cancel(input.reason); + await entry.tail; + } finally { + this.#release(entry); + } + return { cancelled: true }; + } + async cancelAll(reason = "Stream registry closed") { + await Promise.all(Array.from(this.#streams, ([streamID]) => this.cancel({ streamID, reason }))); + } + #take(entry, maxBytes) { + const value = entry.remainder; + const data = value.byteLength <= maxBytes ? value : value.subarray(0, maxBytes); + entry.remainder = value.byteLength <= maxBytes ? undefined : value.subarray(maxBytes); + return { data: Buffer.from(data).toString("base64"), eof: false }; + } + #release(entry) { + if (entry.released) + return; + entry.released = true; + entry.reader.releaseLock(); + } + async#serialized(entry, operation) { + const previous = entry.tail; + const deferred = Promise.withResolvers(); + entry.tail = deferred.promise; + await previous; + try { + return await operation(); + } finally { + deferred.resolve(); + } + } +} +function remoteReadable(peer, methodPrefix, descriptor, params = {}) { + let released = false; + return new ReadableStream({ + async pull(controller) { + try { + const result = StreamReadResultSchema.parse(await peer.request(`${methodPrefix}.stream.read`, { + ...params, + streamID: descriptor.streamID, + maxBytes: MAX_STREAM_CHUNK_BYTES + })); + if (result.data) + controller.enqueue(Buffer.from(result.data, "base64")); + if (!result.eof) + return; + released = true; + controller.close(); + } catch (error45) { + controller.error(error45); + if (released) + return; + released = true; + peer.request(`${methodPrefix}.stream.cancel`, { + ...params, + streamID: descriptor.streamID, + reason: error45 instanceof Error ? error45.message : String(error45) + }).catch(() => {}); + } + }, + async cancel(reason) { + if (released) + return; + released = true; + await peer.request(`${methodPrefix}.stream.cancel`, { + ...params, + streamID: descriptor.streamID, + ...reason === undefined ? {} : { reason: reason instanceof Error ? reason.message : String(reason) } + }); + } + }); +} + +// src/stream-methods.ts +function registerStreamMethods(peer, registry2, owners) { + peer.handle("host.stream.read", async (value) => { + const input = parseStreamParams("host.stream.read", value); + requireStreamOwner(owners, input.instanceID, input.streamID); + try { + const result = await registry2.read(input); + if (result.eof) + owners.delete(input.streamID); + return HostMethodSchemas["host.stream.read"].result.parse(result); + } catch (error45) { + owners.delete(input.streamID); + throw error45; + } + }); + peer.handle("host.stream.cancel", async (value) => { + const input = parseStreamParams("host.stream.cancel", value); + if (!owners.has(input.streamID)) + return { cancelled: false }; + requireStreamOwner(owners, input.instanceID, input.streamID); + owners.delete(input.streamID); + return HostMethodSchemas["host.stream.cancel"].result.parse(await registry2.cancel(input)); + }); +} +function parseStreamParams(method, value) { + const parsed = HostMethodSchemas[method].params.safeParse(value); + if (parsed.success) + return parsed.data; + throw new ExtensionHostError(-32602, `Invalid parameters for ${method}`, { + kind: "invalid_params", + method, + issues: parsed.error.issues + }); +} +function requireStreamOwner(owners, instanceID, streamID) { + if (owners.get(streamID) === instanceID) + return; + throw new ExtensionHostError(-32002, `Unknown stream ${streamID} for instance ${instanceID}`, { + kind: "missing_handle", + type: "stream", + id: streamID, + instanceID + }); +} + +// src/loopback.ts +import { isIP } from "net"; +function requireLoopbackAddress(address) { + const hostname3 = parseRpcAddress(address).hostname.toLowerCase(); + const normalized = hostname3.replace(/^\[|\]$/g, ""); + if (normalized === "localhost" || normalized === "127.0.0.1" || isIP(normalized) === 6 && normalized === "::1") + return; + throw new Error(`OPENCODE_EXTENSION_HOST_RPC_ADDRESS must be loopback, received ${hostname3}`); +} + +// src/main.ts +await main(); +async function main() { + logEvent("startup.begin", { runtime: "bun" }); + configureLoopbackProxyBypass(); + const address = requiredEnvironment("OPENCODE_EXTENSION_HOST_RPC_ADDRESS"); + const token = requiredEnvironment("OPENCODE_EXTENSION_HOST_RPC_TOKEN"); + requireLoopbackAddress(address); + let handshakeAccepted = false; + const peer = await connectRpcPeer(address, { + idPrefix: "host", + onRequest(method) { + if (handshakeAccepted) + return; + throw new ExtensionHostError(-32601, `Method not found: ${method}`); + }, + onError(error45) { + logError("rpc.failure", error45, { runtime: "bun" }); + } + }); + logEvent("startup.rpc_connected", { runtime: "bun", address }); + const backend = protocolConnection(peer); + const registry2 = new StreamRegistry("host"); + const owners = new Map; + const deferred = Promise.withResolvers(); + deferred.promise.catch(() => {}); + const streams = { + register(instanceID, stream, length) { + const descriptor = registry2.register(stream, length); + owners.set(descriptor.streamID, instanceID); + return descriptor; + }, + remote(methodPrefix, instanceID, descriptor) { + return remoteReadable(backend, methodPrefix, descriptor, { instanceID }); + }, + async cancel(instanceID, descriptor) { + if (owners.get(descriptor.streamID) !== instanceID) + return; + owners.delete(descriptor.streamID); + await registry2.cancel({ streamID: descriptor.streamID, reason: "Stream owner released it" }); + }, + async cancelAll(instanceID) { + await Promise.all(Array.from(owners, ([streamID, owner]) => { + if (owner !== instanceID) + return Promise.resolve(); + owners.delete(streamID); + return registry2.cancel({ streamID, reason: `Instance ${instanceID} closed` }).then(() => {}); + })); + }, + async cancelRemote(instanceID, descriptor, reason) { + await backend.request("backend.stream.cancel", { + instanceID, + streamID: descriptor.streamID, + ...reason ? { reason } : {} + }); + } + }; + let host; + registerStreamMethods(peer, registry2, owners); + registerHostMethods({ + peer, + host: deferred.promise, + shutdown() { + peer.flushAndClose().catch((error45) => logError("shutdown.rpc_close_failed", error45, { runtime: "bun" })); + } + }); + try { + const handshakeMethod = BackendMethodSchemas["backend.handshake"]; + const handshake = handshakeMethod.result.parse(await peer.request("backend.handshake", handshakeMethod.params.parse({ + token, + protocolVersion: PROTOCOL_VERSION, + opencodeVersion: OPENCODE_VERSION, + maxFrameBytes: DEFAULT_MAX_FRAME_BYTES, + capabilities: [...HOST_CAPABILITIES] + }), { + onResult(value) { + handshakeMethod.result.parse(value); + handshakeAccepted = true; + } + })); + if (!path4.isAbsolute(handshake.cacheDirectory)) { + throw new ExtensionHostError(-32001, "backend.handshake returned a relative cacheDirectory", { + kind: "invalid_handshake", + cacheDirectory: handshake.cacheDirectory + }); + } + peer.setMaxFrameBytes(handshake.maxFrameBytes); + logEvent("startup.handshake_complete", { + runtime: "bun", + max_frame_bytes: handshake.maxFrameBytes + }); + host = new ExtensionHost({ + rpc: backend, + streams, + cacheDirectory: handshake.cacheDirectory, + gatewayFactory: createGateway, + preparePlugins: prepareBunPlugins, + shell: Bun.$ + }); + deferred.resolve(host); + logEvent("startup.ready", { runtime: "bun" }); + await peer.closed; + logEvent("rpc.closed", { runtime: "bun", failed: peer.closeError !== undefined }); + if (peer.closeError) + throw peer.closeError; + } catch (error45) { + logError("startup.failed", error45, { runtime: "bun" }); + deferred.reject(error45); + peer.close(error45 instanceof Error ? error45 : new Error(String(error45))); + throw error45; + } finally { + await host?.shutdown().catch((error45) => logError("shutdown.failed", error45, { runtime: "bun" })); + await registry2.cancelAll("Extension host connection closed"); + owners.clear(); + logEvent("shutdown.complete", { runtime: "bun" }); + } +} +function protocolConnection(peer) { + return { + async request(method, params, options) { + const definition = BackendMethodSchemas[method]; + if (!definition) + throw new TypeError(`Unknown backend method ${method}`); + const validated = definition.params.parse(params); + return definition.result.parse(await peer.request(method, validated, options)); + }, + notify(method, params) { + const definition = BackendMethodSchemas[method]; + if (!definition) + throw new TypeError(`Unknown backend method ${method}`); + return peer.notify(method, definition.params.parse(params)); + } + }; +} +function requiredEnvironment(name) { + const value = Bun.env[name]; + if (value) + return value; + throw new Error(`Missing required environment variable ${name}`); +} +function configureLoopbackProxyBypass() { + for (const name of ["NO_PROXY", "no_proxy"]) { + const values = new Set((Bun.env[name] ?? "").split(",").map((value) => value.trim()).filter(Boolean)); + values.add("127.0.0.1"); + values.add("localhost"); + values.add("::1"); + Bun.env[name] = Array.from(values).join(","); + } +} diff --git a/src/apps/ohos/entry/src/main/resources/resfile/resources/worker_host.js b/src/apps/ohos/entry/src/main/resources/resfile/resources/worker_host.js new file mode 100644 index 0000000000..2838527fd9 --- /dev/null +++ b/src/apps/ohos/entry/src/main/resources/resfile/resources/worker_host.js @@ -0,0 +1,203 @@ +#!/usr/bin/env node +/** + * MiniApp JS Worker host — runs in Bun or Node.js. + * stdin: JSON-RPC requests (one per line) + * stderr: JSON-RPC responses (one per line) + * stdout: user console.log (forwarded to host) + * + * Usage: node worker_host.js '' + * Cwd: MiniApp app directory (contains source/worker.js, package.json, storage.json) + */ + +const fs = require('fs'); +const path = require('path'); +const { exec: execCallback } = require('child_process'); +const { promisify } = require('util'); +const execAsync = promisify(execCallback); + +const policy = JSON.parse(process.argv[2] || '{}'); +const appDir = process.cwd(); +const storageRequests = new Map(); +let storageRequestId = 0; + +function rpcSend(obj) { + process.stderr.write(JSON.stringify(obj) + '\n'); +} + +/** + * Emit a push event to the MiniApp iframe (no request id, no reply expected). + * The host process will forward this to the iframe via "miniapp://worker-event:{appId}". + * + * @param {string} event - Event name (e.g. 'progress', 'status') + * @param {any} data - Event payload + */ +function rpcEmit(event, data) { + process.stderr.write(JSON.stringify({ event, data }) + '\n'); +} + +// Make rpcEmit available globally so source/worker.js can use it. +global.rpcEmit = rpcEmit; + +function isPathAllowed(targetPath, mode) { + if (!policy.fs) return false; + const resolved = path.resolve(targetPath); + const scopes = mode === 'write' ? (policy.fs.write || []) : (policy.fs.read || []); + return scopes.some((scope) => resolved.startsWith(path.resolve(scope))); +} + +function storageCall(method, params) { + return new Promise((resolve, reject) => { + const id = 'storage-' + (++storageRequestId); + storageRequests.set(id, { resolve, reject }); + rpcSend({ hostRequest: 'storage', id, method, params }); + }); +} + +let userHandlers = {}; +let userHandlerLoadError = null; +try { + const workerPath = path.join(appDir, 'source', 'worker.js'); + if (fs.existsSync(workerPath)) { + userHandlers = require(workerPath) || {}; + } +} catch (e) { + userHandlerLoadError = e; + console.error('Failed to load source/worker.js:', e.message); +} + +async function dispatch(method, params) { + if (userHandlerLoadError) { + throw new Error('Failed to load source/worker.js: ' + (userHandlerLoadError.message || String(userHandlerLoadError))); + } + if (userHandlers[method] && typeof userHandlers[method] === 'function') { + return await userHandlers[method](params || {}); + } + + const [ns, name] = method.split('.'); + if (ns === 'fs') { + const p = params.path || params.p; + if (p !== undefined && !isPathAllowed(p, 'read') && name !== 'access') { + if (name === 'writeFile' || name === 'mkdir' || name === 'rm' || name === 'appendFile' || name === 'rename' || name === 'copyFile') { + if (!isPathAllowed(p, 'write')) throw new Error('Path not allowed'); + } else if (!isPathAllowed(p, 'read')) throw new Error('Path not allowed'); + } + switch (name) { + case 'readFile': { + const enc = params.encoding || 'utf8'; + const data = fs.readFileSync(p, enc === 'base64' ? undefined : enc); + return enc === 'base64' ? data.toString('base64') : data; + } + case 'writeFile': + fs.writeFileSync(p, params.data, params.encoding || 'utf8'); + return null; + case 'readdir': { + const entries = fs.readdirSync(p, { withFileTypes: true }); + return entries.map((e) => ({ name: e.name, path: path.join(p, e.name), isDirectory: e.isDirectory() })); + } + case 'stat': { + const s = fs.statSync(p); + return { size: s.size, isDirectory: s.isDirectory(), isFile: s.isFile() }; + } + case 'mkdir': + fs.mkdirSync(p, { recursive: !!params.recursive }); + return null; + case 'rm': + fs.rmSync(p, { recursive: !!params.recursive, force: !!params.force }); + return null; + case 'copyFile': + fs.copyFileSync(params.src, params.dst); + return null; + case 'rename': + fs.renameSync(params.oldPath, params.newPath); + return null; + case 'appendFile': + fs.appendFileSync(p, params.data); + return null; + case 'access': + fs.accessSync(p); + return null; + default: + throw new Error('Unknown fs method: ' + method); + } + } + + if (ns === 'shell') { + if (name === 'exec') { + const allow = (policy.shell && policy.shell.allow) || []; + const cmd = (params.command || '').trim().split(/\s+/)[0]; + const base = path.basename(cmd, path.extname(cmd)); + if (allow.length === 0 || !allow.some((a) => a.toLowerCase() === base.toLowerCase())) { + throw new Error('Command not in allowlist'); + } + const opts = { + cwd: params.cwd || appDir, + timeout: params.timeout || 30000, + windowsHide: process.platform === 'win32' + }; + const { stdout, stderr } = await execAsync(params.command || '', opts); + return { stdout, stderr, exit_code: 0 }; + } + } + + if (ns === 'net' && name === 'fetch') { + const allow = (policy.net && policy.net.allow) || []; + let url; + try { + url = new URL(params.url); + } catch { + throw new Error('Invalid URL'); + } + const host = url.hostname; + if (allow.length === 0 || (!allow.includes('*') && !allow.some((d) => host === d || host.endsWith('.' + d)))) { + throw new Error('Domain not in allowlist'); + } + const fetch = globalThis.fetch; + const res = await fetch(params.url, { method: params.method || 'GET', headers: params.headers, body: params.body }); + const body = await res.text(); + const headers = {}; + for (const [k, v] of res.headers.entries()) headers[k] = v; + return { status: res.status, headers, body }; + } + + if (ns === 'os' && name === 'info') { + const os = require('os'); + return { platform: process.platform, homedir: os.homedir(), tmpdir: os.tmpdir(), cpus: os.cpus().length, totalmem: os.totalmem(), freemem: os.freemem() }; + } + + if (ns === 'storage') { + if (name === 'get' || name === 'set') return storageCall(method, params); + } + + throw new Error('Unknown method: ' + method); +} + +rpcSend({ id: '__ready', result: { pid: process.pid, version: process.version } }); + +const readline = require('readline'); +const rl = readline.createInterface({ input: process.stdin, crlfDelay: Infinity }); +rl.on('close', () => process.exit(0)); +rl.on('line', async (line) => { + if (!line.trim()) return; + let msg; + try { + msg = JSON.parse(line); + } catch { + return; + } + if (typeof msg.hostResponse === 'string') { + const pending = storageRequests.get(msg.hostResponse); + if (!pending) return; + storageRequests.delete(msg.hostResponse); + if (msg.error) pending.reject(new Error(msg.error)); + else pending.resolve(msg.result); + return; + } + const { id, method, params } = msg; + if (!id || !method) return; + try { + const result = await dispatch(method, params || {}); + rpcSend({ id, result }); + } catch (err) { + rpcSend({ id, error: { code: -32603, message: err.message || String(err) } }); + } +}); diff --git a/src/crates/adapters/ai-adapters/src/providers/openai/codex_chatgpt.rs b/src/crates/adapters/ai-adapters/src/providers/openai/codex_chatgpt.rs index ae9c918ae1..3be52ac245 100644 --- a/src/crates/adapters/ai-adapters/src/providers/openai/codex_chatgpt.rs +++ b/src/crates/adapters/ai-adapters/src/providers/openai/codex_chatgpt.rs @@ -216,6 +216,17 @@ fn try_build_request_body_with_context( } } + // Request-scoped output contracts must survive custom body merging on + // this Responses route too (including independent review calls). + if let Some(schema) = request_context.and_then(|context| context.output_schema.as_ref()) { + body["text"]["format"] = json!({ + "type": "json_schema", + "name": "openbitfun_output", + "strict": true, + "schema": schema + }); + } + shared::log_request_body( TARGET, "Codex ChatGPT request body (excluding tools):", @@ -287,6 +298,41 @@ pub(crate) async fn send_stream( #[cfg(test)] mod tests { use super::*; + #[test] + fn request_output_schema_survives_custom_body_without_leaking_to_next_request() { + let client = AIClient::new( + serde_json::from_value(json!({ + "name": "test", "base_url": "https://chatgpt.com/backend-api/codex", + "request_url": "https://chatgpt.com/backend-api/codex/responses", + "api_key": "synthetic", "model": "gpt-5.5", "format": "responses", + "context_window": 128000, "inline_think_in_text": false, "skip_ssl_verify": false + })) + .unwrap(), + ); + let schema = json!({"type":"object","properties":{"issues":{"type":"array","items":{"type":"string"}}},"required":["issues"],"additionalProperties":false}); + let context = ModelRequestContext { + output_schema: Some(schema.clone()), + ..Default::default() + }; + let custom = json!({"text":{"format":{"type":"text"},"verbosity":"low"}}); + let body = try_build_request_body_with_context( + &client, + None, + vec![], + None, + Some(custom.clone()), + Some(&context), + ) + .unwrap(); + assert_eq!(body["text"]["format"]["schema"], schema); + assert_eq!(body["text"]["format"]["type"], "json_schema"); + assert_eq!(body["text"]["format"]["strict"], true); + assert_eq!(body["text"]["verbosity"], "low"); + let next = + try_build_request_body_with_context(&client, None, vec![], None, Some(custom), None) + .unwrap(); + assert_eq!(next["text"]["format"]["type"], "text"); + } #[test] fn ordinary_api_codex_endpoint_preserves_custom_body_and_does_not_gain_affinity() { diff --git a/src/crates/assembly/core/Cargo.toml b/src/crates/assembly/core/Cargo.toml index b6b24bbdb9..82cdca1404 100644 --- a/src/crates/assembly/core/Cargo.toml +++ b/src/crates/assembly/core/Cargo.toml @@ -174,10 +174,8 @@ product-full = [ "tools-miniapp", "tools-pages", "tools-creation", - "tools-canvas", "tools-agent-control", "function-agents", - "canvas-runtime", "external-sources", "plugin-runtime", "opencode-plugin-host", @@ -387,6 +385,7 @@ tools-image-generation = [ "openbitfun-ai-adapters/image-generation", ] tools-miniapp = [ + "openbitfun-services-integrations/generative-ui", "dep:openbitfun-product-domains", "openbitfun-tool-packs/miniapp", "openbitfun-product-domains/appearance-market", @@ -403,10 +402,6 @@ tools-pages = [ tools-creation = [ "openbitfun-tool-packs/creation", ] -tools-canvas = [ - "openbitfun-tool-packs/canvas", - "canvas-runtime", -] tools-agent-control = [ "openbitfun-tool-packs/agent-control", "scheduled-jobs", @@ -445,10 +440,6 @@ function-agents = [ "openbitfun-services-integrations/function-agents", "runtime-services", ] -canvas-runtime = [ - "dep:openbitfun-product-domains", - "openbitfun-services-integrations/canvas-runtime", -] runtime-services = ["dep:openbitfun-runtime-services"] legacy-migration = ["dep:openbitfun-legacy-migration-adapters"] file-watch = ["openbitfun-services-integrations/file-watch"] diff --git a/src/crates/assembly/core/builtin_skills/agent-eval-canvas/SKILL.md b/src/crates/assembly/core/builtin_skills/agent-eval-canvas/SKILL.md deleted file mode 100644 index f2ee564014..0000000000 --- a/src/crates/assembly/core/builtin_skills/agent-eval-canvas/SKILL.md +++ /dev/null @@ -1,218 +0,0 @@ ---- -name: agent-eval-canvas -description: >- - Create a OpenBitFun Canvas for single-case agent evaluation and trajectory - diagnosis. Use when the user asks to analyze one agent run, trace, case, - benchmark item, failure trajectory, eval result, or critical failure step, - and wants an incident-review style report covering verdict, step timeline, - root cause, error propagation, tool/evidence analysis, efficiency, safety, - and repair recommendations. ---- - -# Agent Eval Canvas - -Use this skill to produce a session-scoped OpenBitFun Canvas for a **single agent -case**. The report should read like an incident review or clinical diagnosis, -not like an aggregate benchmark summary. Its job is to explain what happened in -one run, which step determined success or failure, why, and what to fix next. - -Read and follow `openbitfun-canvas` first. It defines the Canvas tool workflow, -source rules, SDK surface, design constraints, and final response requirements. - -## Inputs - -Gather the case evidence before writing TSX: - -- Case ID, task type, original user request, expected result, actual result, - final verdict, score, model, prompt version, tools, max steps, timeout, and - environment facts when available. -- Full or summarized trajectory: LLM calls, tool calls, handoffs, guardrail - events, custom events, observations, retries, and final answer. -- Tool call details: tool name, call timing, arguments, raw or summarized - result, error state, whether the result was used, and recovery behavior. -- Evidence artifacts: files, retrieved sources, code snippets, tables, judge - output, screenshots, or execution logs that support the verdict. -- Cost facts: total latency, steps, LLM calls, tool calls, tokens, repeated - calls, invalid steps, budget/timeout status. -- Safety facts: risky commands, permission prompts, sensitive data, production - side effects, prompt injection exposure, and guardrail behavior. - -If the trace or expected result is missing, ask for it unless the user clearly -wants a best-effort report from partial evidence. In a best-effort report, mark -unsupported fields as unavailable and keep root-cause claims conservative. - -## Canvas Structure - -Lead with diagnosis, then evidence. The first screen should answer: did the -case pass, what was the decisive step, and what should change next. - -1. **Case header**: Case ID, task type, verdict, score, run configuration, and - a one-sentence conclusion. -2. **Diagnostic summary**: final outcome, critical failure or success step, - primary root cause, downstream propagation, confidence, and top repair. -3. **Trajectory timeline**: compact step table or swimlane showing behavior - type, agent action, input/observation, reasonableness, tag, and issue. -4. **Step-level evaluation**: per-step cards or rows with labels: - `OK`, `WARN`, `ERROR`, `ROOT_CAUSE`, and `PROPAGATED`. -5. **Critical step deep dive**: why this step changed the run, what evidence - proves it, why later errors are downstream, and what should have happened. -6. **Root cause and propagation**: category breakdown plus a clear chain from - first error to final result. -7. **Tool and evidence analysis**: tool choice, parameters, results, result - use, recovery behavior, unsupported claims, stale evidence, and source fit. -8. **Cost, efficiency, and safety**: latency, tokens, duplicate work, invalid - steps, risky actions, sensitive data, and confirmation/guardrail handling. -9. **Repair plan and regression**: fixes grouped by Prompt, Planner, Tool - schema, Tool result, Memory/RAG, Runtime, Evaluator, and Guardrail; include - next-run pass criteria and steps to watch. - -For successful cases, replace the failure emphasis with the **critical success -step**: the moment the agent made the run robust, such as verifying evidence, -recovering from an empty result, narrowing a query, or correcting a plan. - -## Diagnostic Rules - -- Separate **root-cause errors** from **propagated errors**. A later bad answer - is not the root cause if it merely follows from earlier wrong evidence. -- Do not write "model hallucination" as the only cause. Classify concrete - failure modes: task understanding, planning, tool choice, tool parameters, - observation understanding, retrieval, evidence use, memory contamination, - reflection/recovery, output format, resource limit, environment, or safety. -- Tie every critical claim to trace evidence. If the trace does not support a - root cause, label it as a hypothesis and show what evidence is missing. -- Preserve the user's wording for the original request. Redact secrets, access - tokens, private personal data, and credentials before rendering. -- Treat tool errors carefully: distinguish wrong tool choice, wrong arguments, - noisy/empty results, tool/runtime failure, and correct result misread by the - agent. -- Include "what should have happened" for the critical step. Make it concrete: - expected constraint extraction, query rewrite, retry policy, validation, - human confirmation, or final evidence check. -- For partial-success cases, show which user requirements passed, which failed, - and whether remaining failures are independent or downstream of one root - cause. - -## Useful Representations - -Pick the layout that makes the diagnosis fastest to understand: - -- A verdict strip with score, pass/fail, confidence, critical step, and primary - failure category. -- A horizontal timeline or vertical trace table for step-by-step behavior. -- A dependency or propagation graph: `Step 3 -> Step 4 -> Step 6 -> Final`. -- A root-cause matrix separating primary cause, secondary contributors, and - downstream symptoms. -- A tool-call audit table with arguments, result quality, result use, and - recovery. -- An evidence ledger mapping final claims to observations, with unsupported or - stale claims highlighted. -- A repair backlog grouped by system layer and tagged with expected impact. - -Use `computeDAGLayout` plus inline SVG for propagation graphs when it is clearer -than text. Use `DiffView` only when the case is code-review-like and the exact -hunk is part of the evidence. - -## Report Template - -Cover these fields when the evidence supports them: - -```text -Case information: -- Case ID -- Task type -- Original user request -- Expected result -- Actual result -- Verdict: success / partial success / failure / timeout -- Agent configuration -- Overall score - -One-sentence conclusion: -- Direct statement of why the case passed or failed. - -Trajectory summary: -- Step -- Behavior type -- Agent behavior -- Tool / observation result -- Judgment -- Issue - -Critical step: -- Critical failure step / critical success step -- Failure or success type -- Concrete behavior -- Why this step is decisive -- What should have happened - -Root cause: -- Primary category -- Secondary category -- Root cause vs propagated symptom -- Confidence and missing evidence - -Propagation: -- Step X -> Step Y -> Step Z -> Final - -Tool analysis: -- Selection -- Timing -- Parameters -- Return quality -- Observation use -- Retry or fallback - -Evidence analysis: -- Supported claims -- Unsupported claims -- Misread, stale, irrelevant, or missing evidence - -Cost and safety: -- Latency, steps, calls, tokens, duplicate work, invalid steps -- Risky actions, sensitive data, prompt injection, guardrails, confirmations - -Repair and regression: -- Prompt -- Planner -- Tool schema / result -- Memory / RAG -- Runtime -- Evaluator -- Guardrail -- Regression inclusion and pass criteria -``` - -## Do Not - -- Do not turn a single case into an aggregate benchmark dashboard. -- Do not paste the complete raw trace. Summarize the trajectory and quote only - the spans needed to justify the diagnosis. -- Do not invent missing metrics, traces, CI status, tool results, or model - configuration. Mark unavailable facts as unavailable. -- Do not bury the verdict under metadata. The first screen must show outcome, - critical step, root cause, and next fix. -- Do not make every section a uniform card stack. Use cards for high-signal - summaries and deep dives; use open sections, tables, compact callouts, and - diagrams for the rest. -- Do not expose credentials, secrets, private data, or unnecessarily verbose - user content in the canvas. - -## Output Self-Check - -Before calling `CreateCanvas`, verify: - -- The report answers the five core questions: outcome, trajectory, critical - step, root cause category, and next repair. -- The critical step is justified by trace evidence, not only final outcome. -- Root-cause and propagated errors are separated. -- Tool, evidence, cost, and safety sections are present when relevant. -- The repair plan is specific enough to implement or test. -- The first screen is diagnostic, not just descriptive metadata. -- The design passes the `openbitfun-canvas` slop-pattern check. - -## Output - -Call `CreateCanvas` with a concise title and the complete TSX source. In the -final response, mention the Canvas title and trace or case source used, but do -not print the internal `openbitfun-canvas://...` reference; OpenBitFun renders its -openable card automatically below the response. diff --git a/src/crates/assembly/core/builtin_skills/create-agent/references/tool-catalog.md b/src/crates/assembly/core/builtin_skills/create-agent/references/tool-catalog.md index ac54600aeb..47a2b552d6 100644 --- a/src/crates/assembly/core/builtin_skills/create-agent/references/tool-catalog.md +++ b/src/crates/assembly/core/builtin_skills/create-agent/references/tool-catalog.md @@ -61,16 +61,12 @@ Use these tables to select tools for the user's tasks, then put their exact name | `analyze_image` | Analyze an image file with the configured vision model. | | `view_image` | Attach an image file for the current model to inspect visually. | -## Interaction and canvas +## Interaction and generated UI | Tool name | Purpose | | --- | --- | | `AskUserQuestion` | Ask the user focused follow-up questions during execution. | | `GenerativeUI` | Render HTML or SVG visualizations and lightweight interactive widgets in chat. | -| `CreateCanvas` | Create a Canvas artifact scoped to the session. | -| `ReadCanvas` | Read Canvas metadata, diagnostics, and source. | -| `PatchCanvas` | Apply targeted patches to an existing Canvas artifact. | -| `UpdateCanvas` | Update an existing Canvas artifact. | ## Computer use and automation diff --git a/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/examples/cinematic-animated-wallpaper/scripts/cinematic_recipe.py b/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/examples/cinematic-animated-wallpaper/scripts/cinematic_recipe.py index 1de47e3b4c..7139733198 100644 --- a/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/examples/cinematic-animated-wallpaper/scripts/cinematic_recipe.py +++ b/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/examples/cinematic-animated-wallpaper/scripts/cinematic_recipe.py @@ -357,23 +357,6 @@ def build_renderers(colors: Mapping[str, str], appearance_id: str) -> dict[str, "vars": widget_tokens, }, }, - "openbitfun-canvas": { - "version": 1, - "settings": { - "id": appearance_id, - "mode": "dark", - "bg": background, - "panel": elevated, - "fg": colors["text"], - "muted": colors["textMuted"], - "border": colors["textDisabled"], - "accent": accent, - "success": colors["success"], - "warning": colors["warning"], - "danger": colors["danger"], - "info": colors["info"], - }, - }, } diff --git a/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/references/appearance-registry.json b/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/references/appearance-registry.json index efdadf3908..842915611a 100644 --- a/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/references/appearance-registry.json +++ b/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/references/appearance-registry.json @@ -15708,8 +15708,7 @@ "monaco", "xterm", "mermaid", - "generative-widget", - "openbitfun-canvas" + "generative-widget" ], "defaultForceableProperties": [ "backgroundColor", diff --git a/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/references/renderer-contracts.md b/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/references/renderer-contracts.md index f22a880474..0087301a81 100644 --- a/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/references/renderer-contracts.md +++ b/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/references/renderer-contracts.md @@ -48,9 +48,3 @@ Accepted settings: `id`, `mode`, and `vars`. Query accepted variable names with: ```powershell python scripts/openbitfun_appearance.py contract tokens widget ``` - -## openbitfun-canvas - -Accepted settings: `id`, `mode`, `bg`, `panel`, `fg`, `muted`, `border`, `accent`, `success`, `warning`, `danger`, and `info`. - -Run package validation for the exact value constraints and required fields. diff --git a/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/scripts/openbitfun_appearance.py b/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/scripts/openbitfun_appearance.py index 9ba25ec109..df2f4ba1e7 100644 --- a/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/scripts/openbitfun_appearance.py +++ b/src/crates/assembly/core/builtin_skills/create-openbitfun-skin/scripts/openbitfun_appearance.py @@ -201,7 +201,6 @@ "activationStroke", "success", "warning", "error", "errorBackground", "info", "highlight", "pieColors", ] -CANVAS_COLOR_KEYS = ["bg", "panel", "fg", "muted", "border", "accent", "success", "warning", "danger", "info"] MIME_BY_EXTENSION = { ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".webp": "image/webp", ".gif": "image/gif", ".mp4": "video/mp4", ".webm": "video/webm", @@ -810,8 +809,6 @@ def validate_renderer_settings(self, renderer_id: str, settings: Mapping[str, An return self.validate_mermaid(settings) if renderer_id == "generative-widget": return self.validate_widget(settings) - if renderer_id == "openbitfun-canvas": - return self.validate_canvas(settings) return [f"Unsupported renderer: {renderer_id}"] def validate_theme_token_map( @@ -969,22 +966,6 @@ def validate_widget(self, settings: Mapping[str, Any]) -> list[str]: errors.append(f"vars.{key} has an unsafe value") return errors - def validate_canvas(self, settings: Mapping[str, Any]) -> list[str]: - errors: list[str] = [] - known = {"id", "mode", *CANVAS_COLOR_KEYS} - for key in settings: - if key not in known: - errors.append(f"Unknown setting: {key}") - if not isinstance(settings.get("id"), str) or not re.fullmatch(r"[a-z][a-z0-9.-]{0,95}", settings["id"]): - errors.append("id is invalid") - if settings.get("mode") not in ("light", "dark"): - errors.append("mode must be light or dark") - for key in CANVAS_COLOR_KEYS: - color = settings.get(key) - if not isinstance(color, str) or not COLOR_STRING_PATTERN.fullmatch(color): - errors.append(f"{key} is not a supported color") - return errors - def validate_assets(self, value: Any) -> None: if value is None: return diff --git a/src/crates/assembly/core/builtin_skills/docs-canvas/SKILL.md b/src/crates/assembly/core/builtin_skills/docs-canvas/SKILL.md deleted file mode 100644 index 18cc684a72..0000000000 --- a/src/crates/assembly/core/builtin_skills/docs-canvas/SKILL.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -name: docs-canvas -description: >- - Render a documentation-style OpenBitFun Canvas that organizes architecture - notes, API references, walkthroughs, runbooks, and how-tos into a navigable - layout with sections, tables of contents, diagrams, and cross-references. - Use when the user asks for a docs canvas, documentation overview, - architecture walkthrough, API reference page, codebase map, runbook, - or wants to render structured documentation as an interactive canvas. ---- - -# Docs Canvas - -Build a canvas that presents documentation — architecture notes, API references, design docs, runbooks, or codebase walkthroughs — as an interactive, navigable surface rather than as a flat markdown file. - -> **Status:** placeholder. The skill structure is in place so the canvas -> welcome page can surface this plugin via the marketplace query, but the -> full skill body still needs to be written. Treat the steps below as a -> starting outline and refine as the docs canvas pattern matures. - -## Prerequisites - -Read `openbitfun-canvas` first. It contains the generation policy, design guidance, slop rules, self-check, Canvas runtime rules, and SDK usage notes. - -## Gather the source material - -Accept any of: a directory of markdown files, a single doc URL, an inline outline, or a question to answer from the codebase. Collect headings, code blocks, diagrams, and any cross-references between documents. - -## Plan the canvas layout - -Decide the top-level structure before writing any components. A docs canvas usually has: - -1. **Overview** — A short summary card with the purpose of the doc, scope, and audience. -2. **Table of contents** — Navigable list of sections, ideally pinned or sticky so the reader can jump around. -3. **Body sections** — One section per logical unit (architecture, API, examples, gotchas). Each section can mix prose, code blocks, diagrams, and callouts. -4. **References** — Links to related docs, source files, RFCs, and external material. - -## Render with canvas primitives - -Prefer built-in canvas components over raw HTML: - -- Use cards/sections to group related content visually. -- Use code blocks with syntax highlighting for snippets. -- Use diagrams (DAG layout, mermaid) for architecture. -- Use callouts for "Important", "Warning", "Note", "Deprecated". -- Use tables for API parameter lists and option matrices. - -## Tone and content - -Write reader-facing prose. Lead with the answer or the headline, then explain. Keep examples small and runnable. Cite source files with `code references` so readers can jump in. - -## Be creative - -The sections above are a floor, not a ceiling. The goal is the fastest possible path for the reader to understand the topic — so look at the source material in front of you and ask what representation would actually help. A diagram, a sequence chart, a side-by-side comparison, a decision tree, a glossary, a curated FAQ, a single large worked example — whatever fits. diff --git a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/SKILL.md b/src/crates/assembly/core/builtin_skills/openbitfun-canvas/SKILL.md deleted file mode 100644 index d053e43507..0000000000 --- a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/SKILL.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -name: openbitfun-canvas -description: >- - A OpenBitFun Canvas is a live React app that the user can open beside the chat. - You MUST use a canvas when the agent produces a standalone analytical artifact - — quantitative analyses, billing investigations, security audits, architecture - reviews, data-heavy content, timelines, charts, tables, interactive - explorations, repeatable tools, or any response that benefits from visual - layout. Especially prefer a canvas when presenting structured tool or service - results where the data is the deliverable — render it in a rich canvas rather - than dumping it into a markdown table or code block. If you catch yourself - about to write a markdown table, stop and use a canvas instead. You MUST also - read this skill whenever you create, edit, or debug a OpenBitFun Canvas artifact. -metadata: - surfaces: - - ide ---- -A canvas is a single TSX source artifact that OpenBitFun compiles so the user can open it beside the chat. Follow the workflow below in order. - -## Workflow - -### 1. Decide whether to use a canvas - -The trigger is **user intent**, not response shape. Ask: would the user benefit from viewing this output as its **own standalone artifact**, separate from the chat? If the output is a means to an end (a drafted message, a code fix, a dashboard in another tool), skip the canvas. - -**Use a canvas when the agent produces new standalone analytical output:** -- Quantitative analyses and metrics breakdowns (e.g. "send 500 requests and tell me how many fail") -- Billing or account investigations that surface structured findings from database queries -- Security audits or architecture reviews with categorized findings -- Cross-system data analyses and overlap reports -- Structured data from tools or services where the data IS the deliverable -- Financial analyses, margin decompositions, usage trend reports -- Tables with more than a handful of rows that the user asked to see - -**Do NOT use a canvas when:** -- The user asks for work in a **specific tool** — "create a Datadog dashboard" means give them a Datadog dashboard, not a canvas -- The user has a **specific deliverable** — "draft a support response", "fix this code", "make this PR" -- The user is **working within an existing artifact** — improving an HTML dashboard, editing an existing file -- The user is doing **targeted debugging** or active development, even if structured findings emerge along the way -- Short factual answers, one-off file edits, or quick clarifying questions -- Tools are queried as an **intermediate step** for a different deliverable (e.g. querying Stripe to draft a support reply) - -### 2. Write the canvas - -**Location.** OpenBitFun Canvases are session-scoped artifacts created with `CreateCanvas`. For a new canvas, always call `CreateCanvas` with a concise title and complete TSX source; do not stop after telling the user what the source would be or showing code in chat. For small targeted revisions, use `PatchCanvas` with exact unique text replacements. Use `ReadCanvas` first when you do not have the latest source in context. Use `UpdateCanvas` only for large rewrites that need a complete replacement TSX source. - -**File rules:** -- Exactly one TSX source per canvas. Never create helper files, style files, or supporting modules. -- Import **only** from `openbitfun/canvas`. No relative imports, no npm packages, no Node built-ins. -- Default-export the top-level component. -- Embed all data inline. **No `fetch()`, no network calls.** -- Do not locally redeclare names imported from `openbitfun/canvas` such as `Grid`, `Code`, `Stack`, `Text`, `Row`, or `Card`. Use the SDK component directly, or choose a distinct helper name such as `LayerGrid` or `InlineCodeText`. - -**Never render empty states.** A canvas exists to show real content. If a section, chart, table, or component has no data to display, **omit it** — do not render it with placeholder text ("Add header here", "TODO", "Example"), a "No data" message, an empty array, zeroed rows, or an empty chart frame. If the entire canvas would be empty because you don't have the underlying data, do not produce a canvas — tell the user what's missing and ask for it instead. - -**Label every plot.** Charts and tables must be self-describing — a reader looking at the canvas alone should know exactly what they're seeing. For every plot include: -- A title naming the **specific metric** (not "Metrics" — "API error rate by service"). -- **Axis labels with units** on both axes (e.g. "Date", "Latency (ms)"). -- A **legend** when more than one series is shown, with the exact series names from the source data. -- The **source and time range** in a small caption (e.g. "Source: Datadog · last 7 days"). If a value is a transformation (mean, p95, normalized, smoothed), say so in the label. - -**Component discovery:** prefer built-in `openbitfun/canvas` components over hand-rolled markup. Read `sdk/sdk-contract.generated.json` first: it is the generated, versioned source of truth for runtime exports and accepted component props. Use `sdk/index.d.ts` and its sibling `.d.ts` files for richer type documentation and examples, but never invent an export or prop that is absent from the generated contract. - -Apply the Canvas generation policy below as you write, and complete its pre-delivery self-check (section 6) before returning the canvas. - -## Design guidance - -Be creative. The SDK gives you expressive building blocks — use them in whatever combination best serves the content. But avoid slop: no gradients, no emojis, no box-shadows, no rainbow coloring. OpenBitFun canvases are flat, minimal, and purposeful. - -### Visual hierarchy - -Not everything deserves equal treatment. Primary content gets more space, larger headings, and accent color. Supporting content stays compact. Squint test: blur your eyes — can you tell what matters? - -**Color.** All colors from `useHostAppearance()` tokens — read its JSDoc in the SDK declarations for the return shape and usage pattern. No hardcoded hex. Use accent color deliberately, not on everything. - -### Slop patterns — forbidden - -These specific patterns produce low-quality output. If 2+ are present, redesign. - -- **Gradients** — no `linear-gradient`, `radial-gradient`, `background-clip: text`. -- **Emojis** — no emoji as icons, status indicators, bullets, or section markers. -- **Box shadows** — no `box-shadow`. Flat surfaces only. -- **Wall of identical cards** — every section wrapped in the same card style with no variation. Mix open sections with cards. -- **Rainbow coloring** — a different color on every element. Most elements are neutral; color is used sparingly with purpose. -- **Giant text** — font sizes above H1 (24px), or bold text stuffed in CardHeader. -- **Decorative borders** — colored borders on every element. Borders are structural (subtle stroke tokens), not decorative. - -### Pre-delivery self-check - -Before returning canvas code, verify: -1. Does the layout have visual hierarchy? One thing should stand out. -2. Is there variety in the composition? Not just a single column of uniform blocks. -3. Slop check: scan for the forbidden patterns above. - -## Introducing the canvas - -The `openbitfun-canvas://...` artifact reference is an internal resource identifier. **Never copy it into the chat response or format it as a link.** OpenBitFun automatically collects successful Canvas tool results and renders openable Canvas cards below the completed response. Keep the returned reference only for subsequent `ReadCanvas`, `PatchCanvas`, or `UpdateCanvas` calls. - -When you create a canvas, add a short note in your chat response telling the user they can open it from the Canvas card below: - -- **First canvas** — include one sentence explaining what a canvas is. -- **Unsolicited canvas** — if the user didn't ask for a canvas, include one sentence explaining why you chose it over plain text. - -Both can apply at once; one or two sentences total is enough. Skip the intro for subsequent canvases unless you need to describe what changed. Refer to a canvas by title, never by its internal URI. - -## Troubleshooting - -If a canvas appears blank or missing, first inspect the Canvas tool result diagnostics and runtime diagnostics. `CreateCanvas`, `PatchCanvas`, and `UpdateCanvas` save the source first, then compile it. Compilation means the source was accepted and transformed; `Preview ready` is reported only after the same revision completes a real first render. If compilation or policy validation fails, the tool reports failure with diagnostics and preserves the previous render-validated payload when one exists. Runtime errors are reported back to the host as Canvas diagnostics; open the source view, fix the exception, then call `PatchCanvas` for a small exact edit or `UpdateCanvas` for a full rewrite. diff --git a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/appearance.d.ts b/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/appearance.d.ts deleted file mode 100644 index cbe47672e2..0000000000 --- a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/appearance.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -export type { CanvasPalette, CanvasTokens } from "./canvas-tokens.js"; -export { canvasPaletteDark, canvasPaletteLight, canvasTokens, canvasTokensLight, } from "./canvas-tokens.js"; -/** Typography presets used by the built-in `openbitfun/canvas` components. */ -export declare const canvasTypography: { - readonly h1: { - readonly fontSize: "24px"; - readonly lineHeight: "30px"; - readonly fontWeight: 590; - }; - readonly h2: { - readonly fontSize: "18px"; - readonly lineHeight: "24px"; - readonly fontWeight: 590; - }; - readonly h3: { - readonly fontSize: "16px"; - readonly lineHeight: "22px"; - readonly fontWeight: 590; - }; - readonly body: { - readonly fontSize: "14px"; - readonly lineHeight: "20px"; - readonly fontWeight: 400; - }; - readonly small: { - readonly fontSize: "12px"; - readonly lineHeight: "16px"; - readonly fontWeight: 400; - }; -}; -/** Spacing scale (px). */ -export declare const canvasSpacing: { - readonly "0.5": 2; - readonly "1": 4; - readonly "1.5": 6; - readonly "2": 8; - readonly "2.5": 10; - readonly "3": 12; - readonly "3.5": 14; - readonly "4": 16; - readonly "4.5": 18; - readonly "5": 20; - readonly "6": 24; - readonly "7": 28; - readonly "8": 32; - readonly "9": 36; - readonly "10": 40; -}; -export type CanvasSpacing = typeof canvasSpacing; -/** Border radius (px). */ -export declare const canvasRadius: { - readonly none: 0; - readonly xs: 2; - readonly sm: 4; - readonly md: 6; - readonly lg: 8; - readonly xl: 12; - readonly full: 9999; -}; -export type CanvasRadius = typeof canvasRadius; -//# sourceMappingURL=appearance.d.ts.map diff --git a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/callout-tone-icons.d.ts b/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/callout-tone-icons.d.ts deleted file mode 100644 index b57919b572..0000000000 --- a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/callout-tone-icons.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { JSX } from "react"; -type CalloutToneIconGlyph = "info" | "warning" | "circles-check" | "exclamation-circle"; -type CalloutToneForIcon = "info" | "success" | "warning" | "danger" | "neutral"; -/** Maps `Callout` tone to the same status icons used by `OpenBitFun UI` toasts. */ -export declare const calloutToneIconGlyph: Record, CalloutToneIconGlyph>; -export declare function CalloutToneIcon({ tone, color }: { - tone: CalloutToneForIcon; - color: string; -}): JSX.Element; -export {}; -//# sourceMappingURL=callout-tone-icons.d.ts.map \ No newline at end of file diff --git a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/canvas-tokens.d.ts b/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/canvas-tokens.d.ts deleted file mode 100644 index c5153e911b..0000000000 --- a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/canvas-tokens.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Design-token contract for `openbitfun/canvas`. - * - * Canvas uses host-provided OpenBitFun semantic CSS variables instead of declaring - * an independent hardcoded color palette. Treat exported colors as token - * references or host-resolved strings; do not depend on concrete hex values. - */ -export interface CanvasPalette { - readonly foreground: string; - readonly foregroundSecondary: string; - readonly foregroundTertiary: string; - readonly foregroundQuaternary: string; - readonly editor: string; - readonly chrome: string; - readonly sidebar: string; - readonly elevated: string; - readonly fillPrimary: string; - readonly fillSecondary: string; - readonly fillTertiary: string; - readonly fillQuaternary: string; - readonly strokePrimary: string; - readonly strokeSecondary: string; - readonly strokeTertiary: string; - readonly strokeFocused: string; - readonly accent: string; - readonly buttonBackground: string; - readonly buttonForeground: string; - readonly buttonHoverBackground: string; - readonly link: string; - readonly diffInsertedLine: string; - readonly diffRemovedLine: string; - readonly diffStripAdded: string; - readonly diffStripRemoved: string; -} -export interface CanvasHostAppearanceOverrides { - readonly primary?: string; - readonly editorBackground?: string; - readonly editorForeground?: string; -} -export type Color = "gray" | "purple" | "green" | "yellow" | "cyan" | "pink" | "blue" | "orange"; -export type CategoryPalette = Readonly>; -export declare const canvasPaletteDark: CanvasPalette; -export declare const canvasPaletteLight: CanvasPalette; -export declare function applyWorkbenchSurfaces(palette: CanvasPalette, surfaces: Pick): CanvasPalette; -export declare function applyPrimaryColor(palette: CanvasPalette, primary: string): CanvasPalette; -export declare const categoryPaletteDark: CategoryPalette; -export declare const categoryPaletteLight: CategoryPalette; -export declare const usageColorSequence: readonly Color[]; -export declare const chartColorSequence: readonly string[]; -export interface CanvasTokens { - readonly bg: { - readonly editor: string; - readonly chrome: string; - readonly elevated: string; - }; - readonly text: { - readonly primary: string; - readonly secondary: string; - readonly tertiary: string; - readonly quaternary: string; - readonly link: string; - readonly onAccent: string; - }; - readonly stroke: { - readonly primary: string; - readonly secondary: string; - readonly tertiary: string; - readonly focused: string; - }; - readonly fill: { - readonly primary: string; - readonly secondary: string; - readonly tertiary: string; - readonly quaternary: string; - }; - readonly accent: { - readonly primary: string; - readonly control: string; - readonly controlHover: string; - }; - readonly diff: { - readonly insertedLine: string; - readonly removedLine: string; - readonly stripAdded: string; - readonly stripRemoved: string; - }; - readonly category: CategoryPalette; -} -/** Semantic colors for components. Spacing and radius live in `appearance.ts`. */ -export declare const canvasTokens: CanvasTokens; -export declare const canvasTokensLight: CanvasTokens; -export declare function buildHostTokens(kind: string, overrides?: CanvasHostAppearanceOverrides): { - tokens: CanvasTokens; - palette: CanvasPalette; -}; -//# sourceMappingURL=canvas-tokens.d.ts.map diff --git a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/chart-primitives.d.ts b/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/chart-primitives.d.ts deleted file mode 100644 index 49331327a3..0000000000 --- a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/chart-primitives.d.ts +++ /dev/null @@ -1,272 +0,0 @@ -/** - * Chart primitives for `openbitfun/canvas` — multi-series, stacked, and pie charts - * rendered as pure inline SVG with zero external dependencies. - * - * Distilled from the portal-website Highcharts analytics charting layer. - */ -import type { CSSProperties, JSX } from "react"; -/** - * Semantic tone for a chart series or slice. Mirrors the tone vocabulary - * used by `Stat`, `Pill`, `Table`, and other SDK primitives so colors - * match across a canvas — e.g. a `Stat tone="success"` and a - * `ChartSeries tone="success"` render in the same green. - * - * Omit `tone` to let the chart auto-assign a distinct color from the - * chart palette; supply `tone` only when the value carries semantic - * meaning that should match other tonal elements on the page. - */ -export type ChartTone = "success" | "danger" | "warning" | "info" | "neutral"; -/** A single labeled value, used by `PieChart`. */ -export type ChartDataPoint = { - label: string; - /** Non-negative numeric value. */ - value: number; -}; -/** - * A named data series for `BarChart` and `LineChart`. - * The `data` array aligns by index with the parent component's `categories`. - * If `tone` is omitted, a color is auto-assigned from the chart palette. - */ -export type ChartSeries = { - name: string; - data: number[]; - tone?: ChartTone; -}; -/** - * A dashed marker line drawn across the plot at a fixed value — for targets, - * SLOs, budgets, means, or limits. Drawn horizontally on line / vertical-bar - * charts and vertically on `horizontal` bar charts; either way it marks the - * value axis and is folded into the auto domain so it stays on-canvas. - */ -export type ChartReferenceLine = { - /** Position on the value axis, in the same units as the series data. */ - value: number; - /** Short label drawn in a chip at the line's end. */ - label?: string; - /** Line color. Omit for a muted neutral; set to match other tonal elements. */ - tone?: ChartTone; -}; -/** - * Shared value-axis controls (the y-axis, or the x-axis on `horizontal` bar - * charts). By default the axis starts at zero; override to zoom into a tight - * range. On stacked / normalized bars these are ignored — those always start - * at zero. - */ -type ValueAxisProps = { - /** - * Start the value axis at zero. Defaults to `true`. Set `false` to - * auto-fit the axis to the data range — useful for tightly-clustered - * series (e.g. uptime 99.0–99.9%) that a zero baseline would flatten. - */ - beginAtZero?: boolean; - /** Explicit axis minimum. Overrides `beginAtZero`. */ - yMin?: number; - /** Explicit axis maximum. */ - yMax?: number; - /** Horizontal marker lines for targets / thresholds / means. */ - referenceLines?: ChartReferenceLine[]; -}; -export type BarChartProps = ValueAxisProps & { - /** Category labels along the independent axis. */ - categories: string[]; - /** One or more data series. Values align by index with `categories`. */ - series: ChartSeries[]; - height?: number; - /** Stack series on top of each other instead of grouping side-by-side. */ - stacked?: boolean; - /** Render horizontal bars instead of vertical columns. */ - horizontal?: boolean; - /** Show as 100% stacked (implies `stacked`). */ - normalized?: boolean; - /** Suffix for value labels (e.g. "%", " ms"). */ - valueSuffix?: string; - /** Prefix for value labels (e.g. "$"). Ignored in `normalized` mode. */ - valuePrefix?: string; - /** - * Print each bar's value as a label. Defaults to auto: on for a single - * series with ≤8 categories, off otherwise. Set `true` to force labels on - * (e.g. grouped multi-series), or `false` to force them off. No effect on - * `stacked` / `normalized` charts — use the hover tooltip there. - */ - showValues?: boolean; - style?: CSSProperties; -}; -export type LineChartProps = ValueAxisProps & { - categories: string[]; - series: ChartSeries[]; - height?: number; - /** Fill the area under each line with a soft tint. */ - fill?: boolean; - /** Suffix for value labels (e.g. "%", " ms"). */ - valueSuffix?: string; - /** Prefix for value labels (e.g. "$"). */ - valuePrefix?: string; - /** Print the value next to every data point (≤20 categories). */ - showValues?: boolean; - /** Draw a vertical guide through the cursor while hovering. Defaults to `true`. */ - showHoverGuide?: boolean; - style?: CSSProperties; -}; -export type PieChartProps = { - data: Array; - /** Diameter in px. Defaults to 200. */ - size?: number; - /** Render as a donut with the summed total shown in the hollow center. */ - donut?: boolean; - style?: CSSProperties; -}; -/** - * Multi-series bar/column chart with optional stacking and normalization. - * Distilled from the portal-website Highcharts analytics charts. - * - * Pass `categories` for x-axis labels and one or more `series` whose `data` - * arrays align by index. With a single series you get simple bars; with - * multiple series the default is grouped (side-by-side) — set `stacked` for - * stacked columns or `normalized` for 100%-stacked share-mode. - * - * Colors are auto-assigned from the chart palette. With a **single series**, - * each bar gets a different color by category (so a chart of 5 categories - * shows 5 colors out of the box). With **multiple series**, each series gets - * its own color. A legend appears when there are 2+ series. - * - * For semantic coloring, pass `tone` on a series — it maps to the same - * palette entries used by `Stat`, `Pill`, and `Table` so your chart matches - * tonal elements elsewhere on the page. - * - * @example - * ```tsx - * // Simple single-series - * - * - * // Stacked multi-series (like portal AI commit chart) - * - * - * // Semantic tones — "accepted" renders in the same green as - * // elsewhere on the page. - * - * - * // Mark a target with a reference line. Grouped/single bars also accept - * // `yMin` / `yMax` to frame the axis (stacked bars stay zero-based). - * - * ``` - */ -export declare function BarChart({ categories, series, height, stacked, horizontal, normalized, valueSuffix, valuePrefix, showValues, beginAtZero, yMin, yMax, referenceLines, style }: BarChartProps): JSX.Element; -/** - * Multi-series line chart with optional area fill. Distilled from the - * portal-website Highcharts analytics charts. - * - * Each series draws a polyline with dot markers at each data point. - * Set `fill` to shade the area under every line. Hover over any category - * column to see a tooltip with all series values and a vertical cursor guide. - * - * This is **not** a time-series component — it does not parse dates. - * Pass pre-formatted date strings as `categories` if plotting over time. - * - * Colors are auto-assigned from the chart palette. For semantic coloring, - * pass `tone` on a series — it maps to the same palette entries used by - * `Stat`, `Pill`, and `Table`. - * - * @example - * ```tsx - * // Single line - * - * - * // Multi-series with area fill - * - * - * // Semantic tones — "errors" renders in the same red as a - * // elsewhere on the page. - * - * - * // Zoom into a tight range and mark an SLO. `beginAtZero={false}` - * // auto-fits the axis; `referenceLines` draws the target. - * - * ``` - */ -export declare function LineChart({ categories, series, height, fill, valueSuffix, valuePrefix, showValues, showHoverGuide, beginAtZero, yMin, yMax, referenceLines, style }: LineChartProps): JSX.Element; -/** - * Pie (or donut) chart with hover highlighting. Distilled from the - * portal-website Highcharts analytics charts. - * - * Unlike `BarChart` and `LineChart`, `PieChart` takes a flat `data` array of - * `{ label, value }` points — each slice is its own category. Colors are - * auto-assigned from the chart palette; pass `tone` on a point to give a - * slice a semantic color that matches other tonal elements on the page. - * - * Hovering a slice expands it outward and dims the others; hovering a legend - * item does the same. A tooltip with value and percentage appears below the - * chart. Set `donut` for a hollow center that shows the summed total. - * - * **Do not** use for bar-style comparisons — use `BarChart` instead. - * - * @example - * ```tsx - * // Basic pie - * - * - * // Donut with semantic tones - * - * ``` - */ -export declare function PieChart({ data, size, donut, style }: PieChartProps): JSX.Element; -export {}; -//# sourceMappingURL=chart-primitives.d.ts.map \ No newline at end of file diff --git a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/collapsible-section.d.ts b/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/collapsible-section.d.ts deleted file mode 100644 index 87b0ed9099..0000000000 --- a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/collapsible-section.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Borderless disclosure row — chevron + structured header (title, optional - * leading slot, count, trailing slot) with a body that toggles open. Distilled - * from baby-glass `ContextTreeRow`'s lightweight list-row chrome (no card - * border, no background fill). - * - * For a bordered surface that collapses, use `` instead. - */ -import { type CSSProperties, type JSX, type ReactNode } from "react"; -export type CollapsibleSectionProps = { - /** Plain-text title rendered next to the disclosure chevron. */ - title: string; - /** - * Optional leading visual (e.g. ``) shown between the chevron and - * the title. - */ - leading?: ReactNode; - /** - * Optional small count rendered after the title (e.g. number of children). - */ - count?: number; - /** - * Optional trailing node, right-aligned (e.g. token readout, badge, button). - * Rendered with `t.text.tertiary` color hint via the wrapper; the slot can - * override. - */ - trailing?: ReactNode; - /** Body shown when expanded. */ - children?: ReactNode; - /** When true, the section starts expanded (uncontrolled). */ - defaultOpen?: boolean; - style?: CSSProperties; -}; -/** - * Borderless collapsible row with a structured header. Starts closed unless - * `defaultOpen` is set. - * - * Compose with `` in the `leading` slot for a colored category icon, - * and put a token readout / pill / button in `trailing`. Body content is - * indented under the row so nested `CollapsibleSection`s read as a tree. - * - * For a bordered, card-shaped collapsible surface, use `` - * instead — `CollapsibleSection` has no border or background and is meant to - * sit in a list of similar rows. - * - * @example - * ```tsx - * // Basic - * - * Messages go here. - * - * - * // With a colored category swatch + count + trailing token readout - * } - * trailing={12.3k} - * > - * - * Search results. - * - * - * ``` - */ -export declare function CollapsibleSection({ title, leading, count, trailing, children, defaultOpen, style }: CollapsibleSectionProps): JSX.Element; -//# sourceMappingURL=collapsible-section.d.ts.map \ No newline at end of file diff --git a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/dag-layout.d.ts b/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/dag-layout.d.ts deleted file mode 100644 index 722e1a01a8..0000000000 --- a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/dag-layout.d.ts +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Pure layout math for directed acyclic graphs. Returns positioned node - * coordinates, edge anchor points, rank bounding boxes, and back-edge flags. - * Rendering is the caller's responsibility. - * - * Handles cycles gracefully: back-edges are detected via DFS, excluded from - * ranking, and flagged in the output so the caller can render them differently - * (e.g. dashed arcs). - */ -export type DAGLayoutOptions = { - /** Nodes to lay out. Only `id` is required. */ - nodes: Array<{ - id: string; - }>; - /** Directed edges. */ - edges: Array<{ - from: string; - to: string; - }>; - /** Flow direction. Default `"vertical"` (top-to-bottom). */ - direction?: "vertical" | "horizontal"; - /** Node box width in px. Default 160. */ - nodeWidth?: number; - /** Node box height in px. Default 40. */ - nodeHeight?: number; - /** Gap between ranks (layers) in px. Default 64. */ - rankGap?: number; - /** Gap between sibling nodes in the same rank in px. Default 48. */ - nodeGap?: number; - /** Padding around the bounding box in px. Default 24. */ - padding?: number; -}; -export type DAGLayoutNode = { - id: string; - /** Left edge of the node box. */ - x: number; - /** Top edge of the node box. */ - y: number; - /** Layer index (0 = root). */ - rank: number; - /** Position within the rank (0-indexed). */ - order: number; -}; -export type DAGLayoutEdge = { - from: string; - to: string; - /** Suggested source anchor point (center of the outgoing side). */ - sourceX: number; - sourceY: number; - /** Suggested target anchor point (center of the incoming side). */ - targetX: number; - targetY: number; - /** True when this edge was identified as a back-edge (part of a cycle). */ - isBackEdge: boolean; -}; -export type DAGLayoutRank = { - /** Rank index (0 = root). */ - rank: number; - /** Left edge of the rank bounding box. */ - x: number; - /** Top edge of the rank bounding box. */ - y: number; - /** Width of the rank bounding box. */ - width: number; - /** Height of the rank bounding box. */ - height: number; - /** Node ids in this rank, in order. */ - nodeIds: string[]; -}; -export type DAGLayoutResult = { - nodes: DAGLayoutNode[]; - edges: DAGLayoutEdge[]; - /** Bounding box per rank — useful for drawing layer bands. */ - ranks: DAGLayoutRank[]; - /** The direction used for this layout. */ - direction: "vertical" | "horizontal"; - /** Total width of the bounding box. */ - width: number; - /** Total height of the bounding box. */ - height: number; -}; -/** - * Compute a hierarchical layout for a directed graph. - * - * Returns node positions, edge anchor points, rank bounding boxes, and - * back-edge flags. The caller handles all rendering. - * - * @example - * ```ts - * const layout = computeDAGLayout({ - * nodes: [{ id: "a" }, { id: "b" }, { id: "c" }], - * edges: [{ from: "a", to: "b" }, { from: "b", to: "c" }], - * }); - * - * // layout.nodes[i].x / .y → position your own SVG/HTML elements - * // layout.edges[i].sourceX/Y, targetX/Y → draw lines between them - * // layout.edges[i].isBackEdge → style cycle edges differently - * // layout.ranks[i] → draw layer bands behind each rank - * ``` - */ -export declare function computeDAGLayout(options: DAGLayoutOptions): DAGLayoutResult; -//# sourceMappingURL=dag-layout.d.ts.map \ No newline at end of file diff --git a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/diff-view.d.ts b/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/diff-view.d.ts deleted file mode 100644 index 8457bcd8a6..0000000000 --- a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/diff-view.d.ts +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Low-level diff primitives for the canvas SDK. - * - * The canvas diff surface is intentionally minimal — two components that - * compose with the generic `Card` / `CardHeader` / `CardBody` / `Pill` / - * `Text` primitives to build any diff layout an agent can imagine: - * - * - `DiffView` — a monospaced, syntax-highlighted unified diff renderer. - * Drops into any container (a `Card`, a table cell, a bare layout, - * nothing at all). No card chrome, no header, no path display. Pass - * `path` to auto-detect the language for highlighting, or `language` - * to override. - * - * - `DiffStats` — the canonical `+N` green / `-N` red glyph pair. Use - * it anywhere a small "added/deleted" summary makes sense — in a - * `CardHeader`'s `trailing` slot, next to a filename in a file tree, - * inside a status row, etc. - * - * For file-level metadata the preferred composition is to use the - * generic `Card` family: - * - * ```tsx - * - * }> - * src/utils.ts - * - * - * - * - * - * ``` - */ -import type { CSSProperties, JSX } from "react"; -export type DiffStatsProps = { - additions?: number; - deletions?: number; - style?: CSSProperties; -}; -/** - * Inline `+N` / `-N` glyph pair. Green additions, red deletions, with - * tabular numerals so columns of stats line up. Renders nothing when - * both counts are zero. - * - * @example - * ```tsx - * }> - * src/utils.ts - * - * - * - * Refactor pass - * - * - * ``` - */ -export declare function DiffStats({ additions, deletions, style }: DiffStatsProps): JSX.Element | null; -export type DiffLineType = "added" | "removed" | "unchanged"; -export type DiffLineData = { - type: DiffLineType; - content: string; - lineNumber?: number; -}; -export type DiffViewProps = { - lines: DiffLineData[]; - /** - * File path used to infer the syntax-highlighting language from the - * extension (e.g. `"src/utils.ts"` → `typescript`). The most ergonomic - * way to enable highlighting — pass the same path you show in the - * enclosing card header. Unknown extensions silently render as plain - * text. - * - * If both `path` and `language` are provided, `language` wins. - */ - path?: string; - /** - * Explicit language override for syntax highlighting (e.g. - * `"typescript"`, `"python"`, `"tsx"`). Use this when no file path is - * available, when the path's extension is misleading, or when the - * content is a snippet rather than a real file. Accepts common - * aliases (`ts`, `py`, `rs`, `md`, etc.). Unknown languages silently - * fall back to plain text. - * - * Highlighting is applied per line, so multi-line constructs (block - * comments, template literals) may not colorize perfectly across line - * boundaries. For typical diff-sized inputs this is fine. - */ - language?: string; - /** Show line numbers in the gutter. Default `true`. */ - showLineNumbers?: boolean; - /** Color line numbers green/red for added/removed lines. Default `true`. */ - coloredLineNumbers?: boolean; - /** Show a 3px accent strip on the left edge for changed lines. Default `true`. */ - showAccentStrip?: boolean; - style?: CSSProperties; -}; -/** - * Unified diff body renderer with monospaced type, colored line - * backgrounds, line-number gutter, accent strip, and optional Shiki - * syntax highlighting. - * - * `DiffView` does not provide any surrounding chrome — place it inside - * a `Card` + `CardBody` (with `padding: 0`) when you want the standard - * bordered "file diff" look, or drop it anywhere else if you want the - * bare renderer. - * - * Pass `path` to enable syntax highlighting from the file extension. - * - * @example - * ```tsx - * - * }> - * src/utils.ts - * - * - * - * - * - * ``` - */ -export declare function DiffView({ lines, path, language, showLineNumbers, coloredLineNumbers, showAccentStrip, style }: DiffViewProps): JSX.Element; -//# sourceMappingURL=diff-view.d.ts.map \ No newline at end of file diff --git a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/form-primitives.d.ts b/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/form-primitives.d.ts deleted file mode 100644 index 7b30654c27..0000000000 --- a/src/crates/assembly/core/builtin_skills/openbitfun-canvas/sdk/form-primitives.d.ts +++ /dev/null @@ -1,195 +0,0 @@ -/** - * Form primitives for `openbitfun/canvas`. Provides themed, controlled form controls - * for interactive canvas apps with persistent state. All `onChange` callbacks - * receive the **value directly** (not a DOM event), so they pair naturally - * with `useCanvasState`: - * - * ```tsx - * const [name, setName] = useCanvasState("name", ""); - * - * ``` - */ -import { type CSSProperties, type JSX, type ReactNode } from "react"; -export type TextInputProps = { - value?: string; - /** Called with the new string value on every keystroke. */ - onChange?: (value: string) => void; - placeholder?: string; - disabled?: boolean; - type?: "text" | "email" | "password" | "number" | "url" | "search"; - style?: CSSProperties; -}; -/** - * Single-line text input (28px height). Use for names, titles, search - * queries, and short text fields. - * - * `onChange` receives the **string value**, not a DOM event — this pairs - * directly with `useCanvasState` setters. - * - * @example - * ```tsx - * const [name, setName] = useCanvasState("name", ""); - * - * - * ``` - */ -export declare function TextInput({ value, onChange, placeholder, disabled, type, style }: TextInputProps): JSX.Element; -export type TextAreaProps = { - value?: string; - /** Called with the new string value on every keystroke. */ - onChange?: (value: string) => void; - placeholder?: string; - disabled?: boolean; - /** Minimum visible rows. Defaults to 3. */ - rows?: number; - style?: CSSProperties; -}; -/** - * Multi-line text input that auto-resizes to fit its content. - * Use for notes, descriptions, comments, and multi-line text fields. - * - * The textarea grows as the user types. Set `rows` for the minimum visible - * height (defaults to 3). Override with `style={{ height: "100px" }}` for a - * fixed size. - * - * @example - * ```tsx - * const [notes, setNotes] = useCanvasState("notes", ""); - * - *